@emailmaker/emailmaker 1.0.98 → 1.0.100
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 +165 -0
- package/css.worker.js +2 -0
- package/css.worker.js.LICENSE.txt +6 -0
- package/editor.worker.js +1 -0
- package/emailmaker-esm.js +1 -0
- package/emailmaker.d.ts +1826 -0
- package/emailmaker.js +1 -0
- package/html.worker.js +1 -0
- package/iframe/429.js +1 -1
- package/iframe/766.js +1 -1
- package/iframe/iframe-eblock.e88ae8a9ae883be1118b.html +1 -0
- package/iframe/iframe.e88ae8a9ae883be1118b.html +1 -0
- package/iframe/js/330.4622fd92.js +1 -0
- package/iframe/sandbox-eblock.js +1 -1
- package/iframe/sandbox.js +1 -1
- package/package.json +1 -1
- package/plugin.html +294 -0
- package/plugin_blocks_test.html +144 -0
- package/plugin_default.html +56 -0
- package/plugin_idigital.html +254 -0
- package/plugin_nota.html +861 -0
- package/plugin_s.html +31 -0
- package/static/css/1169.c8d4ad26.chunk.css +1 -0
- package/static/css/57.c4280089.chunk.css +1 -0
- package/static/css/6501.e131603e.chunk.css +1 -0
- package/static/css/6798.4b23f0cb.chunk.css +1 -0
- package/static/css/84.709e209c.chunk.css +1 -0
- package/static/js/1169.baef237c.chunk.js +2 -0
- package/static/js/1169.baef237c.chunk.js.LICENSE.txt +6 -0
- package/static/js/1303.92cc3c9c.js +2 -0
- package/static/js/1303.92cc3c9c.js.LICENSE.txt +11 -0
- package/static/js/1538.68b12a82.chunk.js +2 -0
- package/static/js/1538.68b12a82.chunk.js.LICENSE.txt +23 -0
- package/static/js/1729.a0be903e.chunk.js +1 -0
- package/static/js/1880.5668de7d.chunk.js +1 -0
- package/static/js/207.2a052cc2.js +2 -0
- package/static/js/207.2a052cc2.js.LICENSE.txt +59 -0
- package/static/js/2624.5a8b68ca.js +2 -0
- package/static/js/2624.5a8b68ca.js.LICENSE.txt +21 -0
- package/static/js/2642.b60a63f6.chunk.js +1 -0
- package/static/js/2854.da9b4ca6.js +2 -0
- package/static/js/2854.da9b4ca6.js.LICENSE.txt +31 -0
- package/static/js/3017.102adc4c.chunk.js +1 -0
- package/static/js/3019.8534e1e7.chunk.js +2 -0
- package/static/js/3019.8534e1e7.chunk.js.LICENSE.txt +6 -0
- package/static/js/3065.c2b60870.js +2 -0
- package/static/js/3065.c2b60870.js.LICENSE.txt +39 -0
- package/static/js/3085.bcc62ca0.chunk.js +2 -0
- package/static/js/3085.bcc62ca0.chunk.js.LICENSE.txt +54 -0
- package/static/js/4309.6c1989bb.chunk.js +1 -0
- package/static/js/4972.a230fee4.js +1 -0
- package/static/js/57.3e1e762a.chunk.js +1 -0
- package/static/js/6144.a3bf0881.chunk.js +2 -0
- package/static/js/6144.a3bf0881.chunk.js.LICENSE.txt +6 -0
- package/static/js/6419.3f1ccca4.js +2 -0
- package/static/js/6419.3f1ccca4.js.LICENSE.txt +1 -0
- package/static/js/6501.40bbf4df.chunk.js +1 -0
- package/static/js/6798.65ecf642.chunk.js +2 -0
- package/static/js/6798.65ecf642.chunk.js.LICENSE.txt +39 -0
- package/static/js/6801.562ec824.chunk.js +2 -0
- package/static/js/6801.562ec824.chunk.js.LICENSE.txt +6 -0
- package/static/js/6819.16ca9581.chunk.js +2 -0
- package/static/js/6819.16ca9581.chunk.js.LICENSE.txt +6 -0
- package/static/js/6957.7ea22637.chunk.js +1 -0
- package/static/js/7463.51929d73.chunk.js +2 -0
- package/static/js/7463.51929d73.chunk.js.LICENSE.txt +6 -0
- package/static/js/84.25bf13c1.chunk.js +1 -0
- package/static/js/8473.88a48c70.chunk.js +2 -0
- package/static/js/8473.88a48c70.chunk.js.LICENSE.txt +101 -0
- package/static/js/8521.0e5efd08.chunk.js +2 -0
- package/static/js/8521.0e5efd08.chunk.js.LICENSE.txt +6 -0
- package/static/js/9644.eb778968.chunk.js +2 -0
- package/static/js/9644.eb778968.chunk.js.LICENSE.txt +6 -0
- package/static/js/9960.6fbe3e6d.chunk.js +2 -0
- package/static/js/9960.6fbe3e6d.chunk.js.LICENSE.txt +30 -0
- package/static/js/9981.4c03120e.js +1 -0
- package/static/js/ant-locale/locale-ar_EG-js.a068e3a8.chunk.js +1 -0
- package/static/js/ant-locale/locale-az_AZ-js.b84a560f.chunk.js +1 -0
- package/static/js/ant-locale/locale-bg_BG-js.3d7c7e4f.chunk.js +1 -0
- package/static/js/ant-locale/locale-bn_BD-js.dd1a7e84.chunk.js +1 -0
- package/static/js/ant-locale/locale-by_BY-js.49b7fc6b.chunk.js +1 -0
- package/static/js/ant-locale/locale-ca_ES-js.24fe4aef.chunk.js +1 -0
- package/static/js/ant-locale/locale-cs_CZ-js.1e90fb24.chunk.js +1 -0
- package/static/js/ant-locale/locale-da_DK-js.61788209.chunk.js +1 -0
- package/static/js/ant-locale/locale-de_DE-js.8e7fdd44.chunk.js +1 -0
- package/static/js/ant-locale/locale-el_GR-js.6c5e0839.chunk.js +1 -0
- package/static/js/ant-locale/locale-en_GB-js.92cc4647.chunk.js +1 -0
- package/static/js/ant-locale/locale-es_ES-js.a31d70e0.chunk.js +1 -0
- package/static/js/ant-locale/locale-et_EE-js.337814a0.chunk.js +1 -0
- package/static/js/ant-locale/locale-eu_ES-js.18f1c965.chunk.js +1 -0
- package/static/js/ant-locale/locale-fa_IR-js.f0f50266.chunk.js +1 -0
- package/static/js/ant-locale/locale-fi_FI-js.e2e08d8a.chunk.js +1 -0
- package/static/js/ant-locale/locale-fr_BE-js.2e2298ab.chunk.js +1 -0
- package/static/js/ant-locale/locale-fr_CA-js.b2f59d9c.chunk.js +1 -0
- package/static/js/ant-locale/locale-fr_FR-js.5d07a79a.chunk.js +1 -0
- package/static/js/ant-locale/locale-ga_IE-js.afa510f9.chunk.js +1 -0
- package/static/js/ant-locale/locale-gl_ES-js.72e19ffc.chunk.js +1 -0
- package/static/js/ant-locale/locale-he_IL-js.47b71730.chunk.js +1 -0
- package/static/js/ant-locale/locale-hi_IN-js.7af15f51.chunk.js +1 -0
- package/static/js/ant-locale/locale-hr_HR-js.4ebb11e0.chunk.js +1 -0
- package/static/js/ant-locale/locale-hu_HU-js.ecde5d7e.chunk.js +1 -0
- package/static/js/ant-locale/locale-hy_AM-js.15e07ba1.chunk.js +1 -0
- package/static/js/ant-locale/locale-id_ID-js.ab0888b9.chunk.js +1 -0
- package/static/js/ant-locale/locale-is_IS-js.fdbfc750.chunk.js +1 -0
- package/static/js/ant-locale/locale-it_IT-js.59a531ef.chunk.js +1 -0
- package/static/js/ant-locale/locale-ja_JP-js.7870613a.chunk.js +1 -0
- package/static/js/ant-locale/locale-ka_GE-js.853f3af0.chunk.js +1 -0
- package/static/js/ant-locale/locale-kk_KZ-js.5fdcc75b.chunk.js +1 -0
- package/static/js/ant-locale/locale-km_KH-js.988792d2.chunk.js +1 -0
- package/static/js/ant-locale/locale-kmr_IQ-js.6903b04d.chunk.js +1 -0
- package/static/js/ant-locale/locale-kn_IN-js.5fbd9645.chunk.js +1 -0
- package/static/js/ant-locale/locale-ko_KR-js.07676057.chunk.js +1 -0
- package/static/js/ant-locale/locale-ku_IQ-js.8d56188e.chunk.js +1 -0
- package/static/js/ant-locale/locale-lt_LT-js.976c50a6.chunk.js +1 -0
- package/static/js/ant-locale/locale-lv_LV-js.d2b7eb7a.chunk.js +1 -0
- package/static/js/ant-locale/locale-mk_MK-js.1a324243.chunk.js +1 -0
- package/static/js/ant-locale/locale-ml_IN-js.9ca0875e.chunk.js +1 -0
- package/static/js/ant-locale/locale-mn_MN-js.e5c5e6b3.chunk.js +1 -0
- package/static/js/ant-locale/locale-ms_MY-js.68d51cfa.chunk.js +1 -0
- package/static/js/ant-locale/locale-my_MM-js.1d798fbf.chunk.js +1 -0
- package/static/js/ant-locale/locale-nb_NO-js.85b15451.chunk.js +1 -0
- package/static/js/ant-locale/locale-ne_NP-js.db143616.chunk.js +1 -0
- package/static/js/ant-locale/locale-nl_BE-js.71247744.chunk.js +1 -0
- package/static/js/ant-locale/locale-nl_NL-js.26845b27.chunk.js +1 -0
- package/static/js/ant-locale/locale-pl_PL-js.44a62852.chunk.js +1 -0
- package/static/js/ant-locale/locale-pt_BR-js.17328a86.chunk.js +1 -0
- package/static/js/ant-locale/locale-pt_PT-js.05d4d804.chunk.js +1 -0
- package/static/js/ant-locale/locale-ro_RO-js.3e1e40bb.chunk.js +1 -0
- package/static/js/ant-locale/locale-si_LK-js.facbc144.chunk.js +1 -0
- package/static/js/ant-locale/locale-sk_SK-js.32bd8996.chunk.js +1 -0
- package/static/js/ant-locale/locale-sl_SI-js.f054d794.chunk.js +1 -0
- package/static/js/ant-locale/locale-sr_RS-js.317370b5.chunk.js +1 -0
- package/static/js/ant-locale/locale-sv_SE-js.ecd8298d.chunk.js +1 -0
- package/static/js/ant-locale/locale-ta_IN-js.ee264565.chunk.js +1 -0
- package/static/js/ant-locale/locale-th_TH-js.f1d32c8f.chunk.js +1 -0
- package/static/js/ant-locale/locale-tk_TK-js.015ee01f.chunk.js +1 -0
- package/static/js/ant-locale/locale-tr_TR-js.4c6d775a.chunk.js +1 -0
- package/static/js/ant-locale/locale-uk_UA-js.cef1c751.chunk.js +1 -0
- package/static/js/ant-locale/locale-ur_PK-js.b5d52218.chunk.js +1 -0
- package/static/js/ant-locale/locale-vi_VN-js.c5140ea5.chunk.js +1 -0
- package/static/js/ant-locale/locale-zh_CN-js.861c7ef0.chunk.js +1 -0
- package/static/js/ant-locale/locale-zh_HK-js.ca14eb1f.chunk.js +1 -0
- package/static/js/ant-locale/locale-zh_TW-js.69bb4746.chunk.js +1 -0
- package/static/js/emailmaker_core.c2851865.js +2 -0
- package/static/js/emailmaker_core.c2851865.js.LICENSE.txt +23 -0
- package/static/js/mergeTags/locale0.24c6e2da.chunk.js +1 -0
- package/static/js/mergeTags/locale1.24fd0fd2.chunk.js +1 -0
- package/static/media/ai-image.7c42c2e12001ebf31881.png +0 -0
- package/static/media/codicon.f13d28f3e470ec5c0896.ttf +0 -0
- package/static/media/empty-image.1827d6561f3c4042dfb3.png +0 -0
- package/static/media/fb.ff10384394f8044ec889.png +0 -0
- package/static/media/frame_dark.318d7ed53535d80662dc.png +0 -0
- package/static/media/frame_light.22a9b4ec728365d8193f.png +0 -0
- package/static/media/frame_template_gallery.85693b3950e7689fb3a5.png +0 -0
- package/static/media/icon-border-radius.2a56b93a7711558098a622296b7ae2e1.svg +1 -0
- package/static/media/icon-create-block.0b077f4000bf7907b9ea871d28c7fb1e.svg +1 -0
- package/static/media/icon-menu-block-welcome.1c534a003522feadd2e7.png +0 -0
- package/static/media/ig.47a89992b4bec92d4364.png +0 -0
- package/static/media/project-email-back-dark.9916625a9a714830b770.svg +29 -0
- package/static/media/project-email-back.0ce470def19ce7c063e0.svg +29 -0
- package/static/media/sign_up_01.333271584216122b89ba.png +0 -0
- package/static/media/sign_up_01_blocks.5538cfdb90d4869794dc.png +0 -0
- package/static/media/sign_up_02.d99d2aa6bf1ea74f01fa.png +0 -0
- package/static/media/sign_up_02_blocks.837fc2c9a9461fda13be.png +0 -0
- package/static/media/sign_up_03.5545ffad60a2cb5e0336.png +0 -0
- package/static/media/sign_up_03_blocks.126601f7a6fbea4b6c54.png +0 -0
- package/static/media/sign_up_04.398a4ca50d5f5b3cd837.png +0 -0
- package/static/media/sign_up_04_blocks.255c5c07b23cbcc256fd.png +0 -0
- package/static/media/sign_up_05.4c58df1be2edaa79d52b.png +0 -0
- package/static/media/sign_up_05_blocks.431b6844fdf3e14642c2.png +0 -0
- package/static/media/tg.10f004529a98df9732b9.png +0 -0
- package/static/media/tw.823a7736ac2d82815c71.png +0 -0
- package/static/media/video.854adea50295d0a3f7ae.png +0 -0
- package/static/media/vk.fe41df919f4e8718e0b3.png +0 -0
- package/static/media/yd.c40d05dde64ef695fdf2.png +0 -0
- package/static/media/yt.4ac57e55d158b40c7fc1.png +0 -0
- package/translations.pot +76 -76
- package/iframe/iframe-eblock.441a4dbc4384f20fcf1e.html +0 -1
- package/iframe/iframe.441a4dbc4384f20fcf1e.html +0 -1
- package/iframe/js/330.378aec42.js +0 -1
- /package/iframe/js/{330.378aec42.js.LICENSE.txt → 330.4622fd92.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see 3085.bcc62ca0.chunk.js.LICENSE.txt */
|
|
2
|
+
"use strict";(globalThis.webpackChunkemail_maker=globalThis.webpackChunkemail_maker||[]).push([[3085],{85466:(t,e,n)=>{n.d(e,{A:()=>Pk});var r=n(23689),i=n(98173),o=n(73013),s=n(85740),a=n(45764).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);function u(t,e){return void 0===e&&(e=15),+parseFloat(Number(t).toPrecision(e))}function h(t){var e=t.toString().split(/[eE]/),n=(e[0].split(".")[1]||"").length-+(e[1]||0);return n>0?n:0}function d(t){if(-1===t.toString().indexOf("e"))return Number(t.toString().replace(".",""));var e=h(t);return e>0?u(Number(t)*Math.pow(10,e)):Number(t)}function p(t){y&&(t>Number.MAX_SAFE_INTEGER||Number.MIN_SAFE_INTEGER)}function f(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=e[0];return e.slice(1).reduce(function(e,n){return t(e,n)},r)}}var g=f(function(t,e){var n=d(t),r=d(e),i=h(t)+h(e),o=n*r;return p(o),o/Math.pow(10,i)}),m=f(function(t,e){var n=Math.pow(10,Math.max(h(t),h(e)));return(g(t,n)+g(e,n))/n}),v=f(function(t,e){var n=Math.pow(10,Math.max(h(t),h(e)));return(g(t,n)-g(e,n))/n}),b=f(function(t,e){var n=d(t),r=d(e);return p(n),p(r),g(n/r,u(Math.pow(10,h(e)-h(t))))});var y=!0;var x={strip:u,plus:m,minus:v,times:g,divide:b,round:function(t,e){var n=Math.pow(10,e),r=b(Math.round(Math.abs(g(t,n))),n);return t<0&&0!==r&&(r=g(r,-1)),r},digitLength:h,float2Fixed:d,enableBoundaryChecking:function(t){void 0===t&&(t=!0),y=t}};const w=Object.prototype.toString;function _(t){switch(w.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return A(t,Error)}}function C(t,e){return w.call(t)===`[object ${e}]`}function S(t){return C(t,"ErrorEvent")}function k(t){return C(t,"DOMError")}function T(t){return C(t,"String")}function j(t){return"object"==typeof t&&null!==t&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function O(t){return null===t||j(t)||"object"!=typeof t&&"function"!=typeof t}function E(t){return C(t,"Object")}function M(t){return typeof Event<"u"&&A(t,Event)}function P(t){return!(!t||!t.then||"function"!=typeof t.then)}function A(t,e){try{return t instanceof e}catch{return!1}}function D(t){return!("object"!=typeof t||null===t||!t.__isVue&&!t._isVue)}function I(t,e=0){return"string"!=typeof t||0===e||t.length<=e?t:`${t.slice(0,e)}...`}function R(t,e){if(!Array.isArray(t))return"";const n=[];for(let r=0;r<t.length;r++){const e=t[r];try{D(e)?n.push("[VueViewModel]"):n.push(String(e))}catch{n.push("[value cannot be serialized]")}}return n.join(e)}function z(t,e,n=!1){return!!T(t)&&(function(t){return C(t,"RegExp")}(e)?e.test(t):!!T(e)&&(n?t===e:t.includes(e)))}function L(t,e=[],n=!1){return e.some(e=>z(t,e,n))}function F(t,e,n=250,r,i,o,s){if(!o.exception||!o.exception.values||!s||!A(s.originalException,Error))return;const a=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;a&&(o.exception.values=function(t,e){return t.map(t=>(t.value&&(t.value=I(t.value,e)),t))}(N(t,e,i,s.originalException,r,o.exception.values,a,0),n))}function N(t,e,n,r,i,o,s,a){if(o.length>=n+1)return o;let l=[...o];if(A(r[i],Error)){B(s,a);const o=t(e,r[i]),c=l.length;V(o,i,c,a),l=N(t,e,n,r[i],i,[o,...l],o,c)}return Array.isArray(r.errors)&&r.errors.forEach((r,o)=>{if(A(r,Error)){B(s,a);const c=t(e,r),u=l.length;V(c,`errors[${o}]`,u,a),l=N(t,e,n,r,i,[c,...l],c,u)}}),l}function B(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism={...t.mechanism,..."AggregateError"===t.type&&{is_exception_group:!0},exception_id:e}}function V(t,e,n,r){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism={...t.mechanism,type:"chained",source:e,exception_id:n,parent_id:r}}function $(t){return t&&t.Math==Math?t:void 0}const H="object"==typeof globalThis&&$(globalThis)||"object"==typeof window&&$(window)||"object"==typeof self&&$(self)||"object"==typeof n.g&&$(n.g)||function(){return this}()||{};function W(){return H}function U(t,e,n){const r=n||H,i=r.__SENTRY__=r.__SENTRY__||{};return i[t]||(i[t]=e())}const X=W();function Y(t,e={}){if(!t)return"<unknown>";try{let n=t;const r=5,i=[];let o=0,s=0;const a=" > ",l=a.length;let c;const u=Array.isArray(e)?e:e.keyAttrs,h=!Array.isArray(e)&&e.maxStringLength||80;for(;n&&o++<r&&(c=G(n,u),!("html"===c||o>1&&s+i.length*l+c.length>=h));)i.push(c),s+=c.length,n=n.parentNode;return i.reverse().join(a)}catch{return"<unknown>"}}function G(t,e){const n=t,r=[];let i,o,s,a,l;if(!n||!n.tagName)return"";if(X.HTMLElement&&n instanceof HTMLElement&&n.dataset&&n.dataset.sentryComponent)return n.dataset.sentryComponent;r.push(n.tagName.toLowerCase());const 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&&T(i))for(o=i.split(/\s+/),l=0;l<o.length;l++)r.push(`.${o[l]}`);const u=["aria-label","type","name","title","alt"];for(l=0;l<u.length;l++)s=u[l],a=n.getAttribute(s),a&&r.push(`[${s}="${a}"]`);return r.join("")}const q=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,K=["debug","info","warn","error","log","assert","trace"],Z={};function J(t){if(!("console"in H))return t();const e=H.console,n={},r=Object.keys(Z);r.forEach(t=>{const r=Z[t];n[t]=e[t],e[t]=r});try{return t()}finally{r.forEach(t=>{e[t]=n[t]})}}const Q=function(){let t=!1;const e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return q?K.forEach(n=>{e[n]=(...e)=>{t&&J(()=>{H.console[n](`Sentry Logger [${n}]:`,...e)})}}):K.forEach(t=>{e[t]=()=>{}}),e}(),tt=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function et(t,e=!1){const{host:n,path:r,pass:i,port:o,projectId:s,protocol:a,publicKey:l}=t;return`${a}://${l}${e&&i?`:${i}`:""}@${n}${o?`:${o}`:""}/${r&&`${r}/`}${s}`}function nt(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function rt(t){const e="string"==typeof t?function(t){const e=tt.exec(t);if(!e)return void J(()=>{});const[n,r,i="",o,s="",a]=e.slice(1);let l="",c=a;const u=c.split("/");if(u.length>1&&(l=u.slice(0,-1).join("/"),c=u.pop()),c){const t=c.match(/^\d+/);t&&(c=t[0])}return nt({host:o,pass:i,path:l,projectId:c,port:s,protocol:n,publicKey:r})}(t):nt(t);if(e&&function(t){if(!q)return!0;const{port:e,projectId:n,protocol:r}=t;return!["protocol","publicKey","host","projectId"].find(e=>!t[e]&&(Q.error(`Invalid Sentry Dsn: ${e} missing`),!0))&&(n.match(/^\d+$/)?function(t){return"http"===t||"https"===t}(r)?!e||!isNaN(parseInt(e,10))||(Q.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):(Q.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(Q.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1))}(e))return e}class it 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}}function ot(t,e,n){if(!(e in t))return;const r=t[e],i=n(r);"function"==typeof i&&at(i,r),t[e]=i}function st(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{q&&Q.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function at(t,e){try{const n=e.prototype||{};t.prototype=e.prototype=n,st(t,"__sentry_original__",e)}catch{}}function lt(t){return t.__sentry_original__}function ct(t){if(_(t))return{message:t.message,name:t.name,stack:t.stack,...ht(t)};if(M(t)){const e={type:t.type,target:ut(t.target),currentTarget:ut(t.currentTarget),...ht(t)};return typeof CustomEvent<"u"&&A(t,CustomEvent)&&(e.detail=t.detail),e}return t}function ut(t){try{return function(t){return typeof Element<"u"&&A(t,Element)}(t)?Y(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function ht(t){if("object"==typeof t&&null!==t){const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}return{}}function dt(t){return pt(t,new Map)}function pt(t,e){if(function(t){if(!E(t))return!1;try{const e=Object.getPrototypeOf(t).constructor.name;return!e||"Object"===e}catch{return!0}}(t)){const n=e.get(t);if(void 0!==n)return n;const r={};e.set(t,r);for(const i of Object.keys(t))typeof t[i]<"u"&&(r[i]=pt(t[i],e));return r}if(Array.isArray(t)){const n=e.get(t);if(void 0!==n)return n;const r=[];return e.set(t,r),t.forEach(t=>{r.push(pt(t,e))}),r}return t}const ft=/\(error: (.*)\)/,gt=/captureMessage|captureException/;function mt(...t){const e=t.sort((t,e)=>t[0]-e[0]).map(t=>t[1]);return(t,n=0)=>{const r=[],i=t.split("\n");for(let o=n;o<i.length;o++){const t=i[o];if(t.length>1024)continue;const n=ft.test(t)?t.replace(ft,"$1"):t;if(!n.match(/\S*Error: /)){for(const t of e){const e=t(n);if(e){r.push(e);break}}if(r.length>=50)break}}return function(t){if(!t.length)return[];const e=Array.from(t);return/sentryWrapped/.test(e[e.length-1].function||"")&&e.pop(),e.reverse(),gt.test(e[e.length-1].function||"")&&(e.pop(),gt.test(e[e.length-1].function||"")&&e.pop()),e.slice(0,50).map(t=>({...t,filename:t.filename||e[e.length-1].filename,function:t.function||"?"}))}(r)}}function vt(t){return Array.isArray(t)?mt(...t):t}const bt="<anonymous>";function yt(t){try{return t&&"function"==typeof t&&t.name||bt}catch{return bt}}const xt={},wt={};function _t(t,e){xt[t]=xt[t]||[],xt[t].push(e)}function Ct(t,e){wt[t]||(e(),wt[t]=!0)}function St(t,e){const n=t&&xt[t];if(n)for(const i of n)try{i(e)}catch(r){q&&Q.error(`Error while triggering instrumentation handler.\nType: ${t}\nName: ${yt(i)}\nError:`,r)}}function kt(){"console"in H&&K.forEach(function(t){t in H.console&&ot(H.console,t,function(e){return Z[t]=e,function(...e){St("console",{args:e,level:t});const n=Z[t];n&&n.apply(H.console,e)}})})}function Tt(){const t=H,e=t.crypto||t.msCrypto;let n=()=>16*Math.random();try{if(e&&e.randomUUID)return e.randomUUID().replace(/-/g,"");e&&e.getRandomValues&&(n=()=>{const t=new Uint8Array(1);return e.getRandomValues(t),t[0]})}catch{}return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,t=>(t^(15&n())>>t/4).toString(16))}function jt(t){return t.exception&&t.exception.values?t.exception.values[0]:void 0}function Ot(t){const{message:e,event_id:n}=t;if(e)return e;const r=jt(t);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function Et(t,e,n){const 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 Mt(t,e){const n=jt(t);if(!n)return;const r=n.mechanism;if(n.mechanism={type:"generic",handled:!0,...r,...e},e&&"data"in e){const t={...r&&r.data,...e.data};n.mechanism.data=t}}function Pt(t){if(t&&t.__sentry_captured__)return!0;try{st(t,"__sentry_captured__",!0)}catch{}return!1}function At(t){return Array.isArray(t)?t:[t]}const Dt=H;let It,Rt,zt;function Lt(){if(!Dt.document)return;const t=St.bind(null,"dom"),e=Ft(t,!0);Dt.document.addEventListener("click",e,!1),Dt.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(e=>{const n=Dt[e]&&Dt[e].prototype;!n||!n.hasOwnProperty||!n.hasOwnProperty("addEventListener")||(ot(n,"addEventListener",function(e){return function(n,r,i){if("click"===n||"keypress"==n)try{const r=this,o=r.__sentry_instrumentation_handlers__=r.__sentry_instrumentation_handlers__||{},s=o[n]=o[n]||{refCount:0};if(!s.handler){const r=Ft(t);s.handler=r,e.call(this,n,r,i)}s.refCount++}catch{}return e.call(this,n,r,i)}}),ot(n,"removeEventListener",function(t){return function(e,n,r){if("click"===e||"keypress"==e)try{const n=this,i=n.__sentry_instrumentation_handlers__||{},o=i[e];o&&(o.refCount--,o.refCount<=0&&(t.call(this,e,o.handler,r),o.handler=void 0,delete i[e]),0===Object.keys(i).length&&delete n.__sentry_instrumentation_handlers__)}catch{}return t.call(this,e,n,r)}}))})}function Ft(t,e=!1){return n=>{if(!n||n._sentryCaptured)return;const r=function(t){try{return t.target}catch{return null}}(n);if(function(t,e){return"keypress"===t&&(!e||!e.tagName||!("INPUT"===e.tagName||"TEXTAREA"===e.tagName||e.isContentEditable))}(n.type,r))return;st(n,"_sentryCaptured",!0),r&&!r._sentryId&&st(r,"_sentryId",Tt());const i="keypress"===n.type?"input":n.type;(function(t){if(t.type!==Rt)return!1;try{if(!t.target||t.target._sentryId!==zt)return!1}catch{}return!0})(n)||(t({event:n,name:i,global:e}),Rt=n.type,zt=r?r._sentryId:void 0),clearTimeout(It),It=Dt.setTimeout(()=>{zt=void 0,Rt=void 0},1e3)}}const Nt=W();function Bt(){if(!("fetch"in Nt))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function Vt(t){return t&&/^function fetch\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function $t(){(function(){if("string"==typeof EdgeRuntime)return!0;if(!Bt())return!1;if(Vt(Nt.fetch))return!0;let t=!1;const e=Nt.document;if(e&&"function"==typeof e.createElement)try{const n=e.createElement("iframe");n.hidden=!0,e.head.appendChild(n),n.contentWindow&&n.contentWindow.fetch&&(t=Vt(n.contentWindow.fetch)),e.head.removeChild(n)}catch(n){q&&Q.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",n)}return t})()&&ot(H,"fetch",function(t){return function(...e){const{method:n,url:r}=function(t){if(0===t.length)return{method:"GET",url:""};if(2===t.length){const[e,n]=t;return{url:Wt(e),method:Ht(n,"method")?String(n.method).toUpperCase():"GET"}}const e=t[0];return{url:Wt(e),method:Ht(e,"method")?String(e.method).toUpperCase():"GET"}}(e),i={args:e,fetchData:{method:n,url:r},startTimestamp:Date.now()};return St("fetch",{...i}),t.apply(H,e).then(t=>(St("fetch",{...i,endTimestamp:Date.now(),response:t}),t),t=>{throw St("fetch",{...i,endTimestamp:Date.now(),error:t}),t})}})}function Ht(t,e){return!!t&&"object"==typeof t&&!!t[e]}function Wt(t){return"string"==typeof t?t:t?Ht(t,"url")?t.url:t.toString?t.toString():"":""}let Ut=null;function Xt(){Ut=H.onerror,H.onerror=function(t,e,n,r,i){return St("error",{column:r,error:i,line:n,msg:t,url:e}),!(!Ut||Ut.__SENTRY_LOADER__)&&Ut.apply(this,arguments)},H.onerror.__SENTRY_INSTRUMENTED__=!0}let Yt=null;function Gt(){Yt=H.onunhandledrejection,H.onunhandledrejection=function(t){return St("unhandledrejection",t),!(Yt&&!Yt.__SENTRY_LOADER__)||Yt.apply(this,arguments)},H.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const qt=W();const Kt=H;let Zt;function Jt(t){const e="history";_t(e,t),Ct(e,Qt)}function Qt(){if(!function(){const t=qt.chrome,e=t&&t.app&&t.app.runtime,n="history"in qt&&!!qt.history.pushState&&!!qt.history.replaceState;return!e&&n}())return;const t=Kt.onpopstate;function e(t){return function(...e){const n=e.length>2?e[2]:void 0;if(n){const t=Zt,e=String(n);Zt=e,St("history",{from:t,to:e})}return t.apply(this,e)}}Kt.onpopstate=function(...e){const n=Kt.location.href,r=Zt;if(Zt=n,St("history",{from:r,to:n}),t)try{return t.apply(this,e)}catch{}},ot(Kt.history,"pushState",e),ot(Kt.history,"replaceState",e)}const te=H,ee="__sentry_xhr_v3__";function ne(){if(!te.XMLHttpRequest)return;const t=XMLHttpRequest.prototype;ot(t,"open",function(t){return function(...e){const n=Date.now(),r=T(e[0])?e[0].toUpperCase():void 0,i=function(t){if(T(t))return t;try{return t.toString()}catch{}}(e[1]);if(!r||!i)return t.apply(this,e);this[ee]={method:r,url:i,request_headers:{}},"POST"===r&&i.match(/sentry_key/)&&(this.__sentry_own_request__=!0);const o=()=>{const t=this[ee];if(t&&4===this.readyState){try{t.status_code=this.status}catch{}St("xhr",{args:[r,i],endTimestamp:Date.now(),startTimestamp:n,xhr:this})}};return"onreadystatechange"in this&&"function"==typeof this.onreadystatechange?ot(this,"onreadystatechange",function(t){return function(...e){return o(),t.apply(this,e)}}):this.addEventListener("readystatechange",o),ot(this,"setRequestHeader",function(t){return function(...e){const[n,r]=e,i=this[ee];return i&&T(n)&&T(r)&&(i.request_headers[n.toLowerCase()]=r),t.apply(this,e)}}),t.apply(this,e)}}),ot(t,"send",function(t){return function(...e){const n=this[ee];if(!n)return t.apply(this,e);void 0!==e[0]&&(n.body=e[0]);return St("xhr",{args:[n.method,n.url],startTimestamp:Date.now(),xhr:this}),t.apply(this,e)}})}function re(t,e=100,n=1/0){try{return oe("",t,e,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function ie(t,e=3,n=102400){const r=re(t,e);return function(t){return function(t){return~-encodeURI(t).split(/%..|./).length}(JSON.stringify(t))}(r)>n?ie(t,e-1,n):r}function oe(t,e,r=1/0,i=1/0,o=function(){const 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[s,a]=o;if(null==e||["number","boolean","string"].includes(typeof e)&&!function(t){return"number"==typeof t&&t!==t}(e))return e;const l=function(t,e){try{if("domain"===t&&e&&"object"==typeof e&&e._events)return"[Domain]";if("domainEmitter"===t)return"[DomainEmitter]";if(typeof n.g<"u"&&e===n.g)return"[Global]";if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(D(e))return"[VueViewModel]";if(function(t){return E(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}(e))return"[SyntheticEvent]";if("number"==typeof e&&e!==e)return"[NaN]";if("function"==typeof e)return`[Function: ${yt(e)}]`;if("symbol"==typeof e)return`[${String(e)}]`;if("bigint"==typeof e)return`[BigInt: ${String(e)}]`;const r=function(t){const e=Object.getPrototypeOf(t);return e?e.constructor.name:"null prototype"}(e);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(r){return`**non-serializable** (${r})`}}(t,e);if(!l.startsWith("[object "))return l;if(e.__sentry_skip_normalization__)return e;const c="number"==typeof e.__sentry_override_normalization_depth__?e.__sentry_override_normalization_depth__:r;if(0===c)return l.replace("object ","");if(s(e))return"[Circular ~]";const u=e;if(u&&"function"==typeof u.toJSON)try{return oe("",u.toJSON(),c-1,i,o)}catch{}const h=Array.isArray(e)?[]:{};let d=0;const p=ct(e);for(const n in p){if(!Object.prototype.hasOwnProperty.call(p,n))continue;if(d>=i){h[n]="[MaxProperties ~]";break}const t=p[n];h[n]=oe(n,t,c-1,i,o),d++}return a(e),h}var se;function ae(t){return new ce(e=>{e(t)})}function le(t){return new ce((e,n)=>{n(t)})}!function(t){t[t.PENDING=0]="PENDING";t[t.RESOLVED=1]="RESOLVED";t[t.REJECTED=2]="REJECTED"}(se||(se={}));class ce{constructor(t){ce.prototype.__init.call(this),ce.prototype.__init2.call(this),ce.prototype.__init3.call(this),ce.prototype.__init4.call(this),this._state=se.PENDING,this._handlers=[];try{t(this._resolve,this._reject)}catch(e){this._reject(e)}}then(t,e){return new ce((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 ce((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)})})}__init(){this._resolve=t=>{this._setResult(se.RESOLVED,t)}}__init2(){this._reject=t=>{this._setResult(se.REJECTED,t)}}__init3(){this._setResult=(t,e)=>{if(this._state===se.PENDING){if(P(e))return void e.then(this._resolve,this._reject);this._state=t,this._value=e,this._executeHandlers()}}}__init4(){this._executeHandlers=()=>{if(this._state===se.PENDING)return;const t=this._handlers.slice();this._handlers=[],t.forEach(t=>{t[0]||(this._state===se.RESOLVED&&t[1](this._value),this._state===se.REJECTED&&t[2](this._value),t[0]=!0)})}}}function ue(t){const 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 le(new it("Not adding Promise because buffer limit was reached."));const 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 ce((n,r)=>{let i=e.length;if(!i)return n(!0);const o=setTimeout(()=>{t&&t>0&&n(!1)},t);e.forEach(t=>{ae(t).then(()=>{--i||(clearTimeout(o),n(!0))},r)})})}}}function he(t){if(!t)return{};const e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};const n=e[6]||"",r=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:n,hash:r,relative:e[5]+n+r}}const de=["fatal","error","warning","log","info","debug"];function pe(t){return"warn"===t?"warning":de.includes(t)?t:"log"}function fe(){return Date.now()/1e3}const ge=function(){const{performance:t}=H;if(!t||!t.now)return fe;const e=Date.now()-t.now(),n=null==t.timeOrigin?e:t.timeOrigin;return()=>(n+t.now())/1e3}();function me(t,e=[]){return[t,e]}function ve(t,e){const[n,r]=t;return[n,[...r,e]]}function be(t,e){const n=t[1];for(const r of n){if(e(r,r[0].type))return!0}return!1}function ye(t,e){return(e||new TextEncoder).encode(t)}function xe(t,e){const[n,r]=t;let i=JSON.stringify(n);function o(t){"string"==typeof i?i="string"==typeof t?i+t:[ye(i,e),t]:i.push("string"==typeof t?ye(t,e):t)}for(const s of r){const[t,e]=s;if(o(`\n${JSON.stringify(t)}\n`),"string"==typeof e||e instanceof Uint8Array)o(e);else{let t;try{t=JSON.stringify(e)}catch{t=JSON.stringify(re(e))}o(t)}}return"string"==typeof i?i:function(t){const e=t.reduce((t,e)=>t+e.length,0),n=new Uint8Array(e);let r=0;for(const i of t)n.set(i,r),r+=i.length;return n}(i)}function we(t,e){const n="string"==typeof t.data?ye(t.data,e):t.data;return[dt({type:"attachment",length:n.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType}),n]}(()=>{const{performance:t}=H;if(!t||!t.now)return;const e=36e5,n=t.now(),r=Date.now(),i=t.timeOrigin?Math.abs(t.timeOrigin+n-r):e,o=i<e,s=t.timing&&t.timing.navigationStart,a="number"==typeof s?Math.abs(s+n-r):e;(o||a<e)&&(i<=a&&t.timeOrigin)})();const _e={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",statsd:"metric_bucket"};function Ce(t){return _e[t]}function Se(t){if(!t||!t.sdk)return;const{name:e,version:n}=t.sdk;return{name:e,version:n}}function ke(t,{statusCode:e,headers:n},r=Date.now()){const i={...t},o=n&&n["x-sentry-rate-limits"],s=n&&n["retry-after"];if(o)for(const a of o.trim().split(",")){const[t,e,,,n]=a.split(":",5),o=parseInt(t,10),s=1e3*(isNaN(o)?60:o);if(e)for(const a of e.split(";"))"metric_bucket"===a?(!n||n.split(";").includes("custom"))&&(i[a]=r+s):i[a]=r+s;else i.all=r+s}else s?i.all=r+function(t,e=Date.now()){const n=parseInt(`${t}`,10);if(!isNaN(n))return 1e3*n;const r=Date.parse(`${t}`);return isNaN(r)?6e4:r-e}(s,r):429===e&&(i.all=r+6e4);return i}const Te=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,je="production";function Oe(){return U("globalEventProcessors",()=>[])}function Ee(t){Oe().push(t)}function Me(t,e,n,r=0){return new ce((i,o)=>{const s=t[r];if(null===e||"function"!=typeof s)i(e);else{const a=s({...e},n);Te&&s.id&&null===a&&Q.log(`Event processor "${s.id}" dropped event`),P(a)?a.then(e=>Me(t,e,n,r+1).then(i)).then(null,o):Me(t,a,n,r+1).then(i).then(null,o)}})}function Pe(t){const e=ge(),n={sid:Tt(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(t){return dt({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,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}})}(n)};return t&&Ae(n,t),n}function Ae(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||ge(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=32===e.sid.length?e.sid:Tt()),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{const e=t.timestamp-t.started;t.duration=e>=0?e: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)}function De(t,e){let n={};e?n={status:e}:"ok"===t.status&&(n={status:"exited"}),Ae(t,n)}function Ie(t){const{spanId:e,traceId:n}=t.spanContext(),{data:r,op:i,parent_span_id:o,status:s,tags:a,origin:l}=Re(t);return dt({data:r,op:i,parent_span_id:o,span_id:e,status:s,tags:a,trace_id:n,origin:l})}function Re(t){return function(t){return"function"==typeof t.getSpanJSON}(t)?t.getSpanJSON():"function"==typeof t.toJSON?t.toJSON():{}}function ze(t,e,n,r,i,o){const{normalizeDepth:s=3,normalizeMaxBreadth:a=1e3}=t,l={...e,event_id:e.event_id||n.event_id||Tt(),timestamp:e.timestamp||fe()},c=n.integrations||t.integrations.map(t=>t.name);(function(t,e){const{environment:n,release:r,dist:i,maxValueLength:o=250}=e;"environment"in t||(t.environment="environment"in e?n:je),void 0===t.release&&void 0!==r&&(t.release=r),void 0===t.dist&&void 0!==i&&(t.dist=i),t.message&&(t.message=I(t.message,o));const s=t.exception&&t.exception.values&&t.exception.values[0];s&&s.value&&(s.value=I(s.value,o));const a=t.request;a&&a.url&&(a.url=I(a.url,o))})(l,t),function(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}(l,c),void 0===e.type&&function(t,e){const n=H._sentryDebugIds;if(!n)return;let r;const i=Le.get(e);i?r=i:(r=new Map,Le.set(e,r));const o=Object.keys(n).reduce((t,i)=>{let o;const s=r.get(i);s?o=s:(o=e(i),r.set(i,o));for(let e=o.length-1;e>=0;e--){const r=o[e];if(r.filename){t[r.filename]=n[i];break}}return t},{});try{t.exception.values.forEach(t=>{t.stacktrace.frames.forEach(t=>{t.filename&&(t.debug_id=o[t.filename])})})}catch{}}(l,t.stackParser);const u=function(t,e){if(!e)return t;const n=t?t.clone():new en;return n.update(e),n}(r,n.captureContext);n.mechanism&&Mt(l,n.mechanism);const h=i&&i.getEventProcessors?i.getEventProcessors():[],d=(tn||(tn=new en),tn).getScopeData();if(o){Je(d,o.getScopeData())}if(u){Je(d,u.getScopeData())}const p=[...n.attachments||[],...d.attachments];p.length&&(n.attachments=p),Ze(l,d);return Me([...h,...Oe(),...d.eventProcessors],l,n).then(t=>(t&&function(t){const e={};try{t.exception.values.forEach(t=>{t.stacktrace.frames.forEach(t=>{t.debug_id&&(t.abs_path?e[t.abs_path]=t.debug_id:t.filename&&(e[t.filename]=t.debug_id),delete t.debug_id)})})}catch{}if(0===Object.keys(e).length)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];const n=t.debug_meta.images;Object.keys(e).forEach(t=>{n.push({type:"sourcemap",code_file:t,debug_id:e[t]})})}(t),"number"==typeof s&&s>0?function(t,e,n){if(!t)return null;const r={...t,...t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(t=>({...t,...t.data&&{data:re(t.data,e,n)}}))},...t.user&&{user:re(t.user,e,n)},...t.contexts&&{contexts:re(t.contexts,e,n)},...t.extra&&{extra:re(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=re(t.contexts.trace.data,e,n))),t.spans&&(r.spans=t.spans.map(t=>{const r=Re(t).data;return r&&(t.data=re(r,e,n)),t})),r}(t,s,a):t))}const Le=new WeakMap;function Fe(t){if(t)return function(t){return t instanceof en||"function"==typeof t}(t)||function(t){return Object.keys(t).some(t=>Ne.includes(t))}(t)?{captureContext:t}:t}const Ne=["user","level","extra","contexts","tags","fingerprint","requestSession","propagationContext"];function Be(t,e){return un().captureEvent(t,e)}function Ve(t,e){un().addBreadcrumb(t,e)}function $e(){return un().getClient()}function He(){return un().getScope()}function We(t){const e=$e(),n=hn(),r=He(),{release:i,environment:o=je}=e&&e.getOptions()||{},{userAgent:s}=H.navigator||{},a=Pe({release:i,environment:o,user:r.getUser()||n.getUser(),...s&&{userAgent:s},...t}),l=n.getSession();return l&&"ok"===l.status&&Ae(l,{status:"exited"}),Ue(),n.setSession(a),r.setSession(a),a}function Ue(){const t=hn(),e=He(),n=e.getSession()||t.getSession();n&&De(n),Xe(),t.setSession(),e.setSession()}function Xe(){const t=hn(),e=He(),n=$e(),r=e.getSession()||t.getSession();r&&n&&n.captureSession&&n.captureSession(r)}function Ye(t=!1){t?Ue():Xe()}function Ge(t){return t.transaction}function qe(t,e,n){const r=e.getOptions(),{publicKey:i}=e.getDsn()||{},{segment:o}=n&&n.getUser()||{},s=dt({environment:r.environment||je,release:r.release,user_segment:o,public_key:i,trace_id:t});return e.emit&&e.emit("createDsc",s),s}function Ke(t){const e=$e();if(!e)return{};const n=qe(Re(t).trace_id||"",e,He()),r=Ge(t);if(!r)return n;const i=r&&r._frozenDynamicSamplingContext;if(i)return i;const{sampleRate:o,source:s}=r.metadata;null!=o&&(n.sample_rate=`${o}`);const a=Re(r);return s&&"url"!==s&&(n.transaction=a.description),n.sampled=String(function(t){const{traceFlags:e}=t.spanContext();return!!(1&e)}(r)),e.emit&&e.emit("createDsc",n),n}function Ze(t,e){const{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:o}=e;(function(t,e){const{extra:n,tags:r,user:i,contexts:o,level:s,transactionName:a}=e,l=dt(n);l&&Object.keys(l).length&&(t.extra={...l,...t.extra});const c=dt(r);c&&Object.keys(c).length&&(t.tags={...c,...t.tags});const u=dt(i);u&&Object.keys(u).length&&(t.user={...u,...t.user});const h=dt(o);h&&Object.keys(h).length&&(t.contexts={...h,...t.contexts}),s&&(t.level=s),a&&(t.transaction=a)})(t,e),r&&function(t,e){t.contexts={trace:Ie(e),...t.contexts};const n=Ge(e);if(n){t.sdkProcessingMetadata={dynamicSamplingContext:Ke(e),...t.sdkProcessingMetadata};const r=Re(n).description;r&&(t.tags={transaction:r,...t.tags})}}(t,r),function(t,e){t.fingerprint=t.fingerprint?At(t.fingerprint):[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint}(t,n),function(t,e){const n=[...t.breadcrumbs||[],...e];t.breadcrumbs=n.length?n:void 0}(t,i),function(t,e){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...e}}(t,o)}function Je(t,e){const{extra:n,tags:r,user:i,contexts:o,level:s,sdkProcessingMetadata:a,breadcrumbs:l,fingerprint:c,eventProcessors:u,attachments:h,propagationContext:d,transactionName:p,span:f}=e;Qe(t,"extra",n),Qe(t,"tags",r),Qe(t,"user",i),Qe(t,"contexts",o),Qe(t,"sdkProcessingMetadata",a),s&&(t.level=s),p&&(t.transactionName=p),f&&(t.span=f),l.length&&(t.breadcrumbs=[...t.breadcrumbs,...l]),c.length&&(t.fingerprint=[...t.fingerprint,...c]),u.length&&(t.eventProcessors=[...t.eventProcessors,...u]),h.length&&(t.attachments=[...t.attachments,...h]),t.propagationContext={...t.propagationContext,...d}}function Qe(t,e,n){if(n&&Object.keys(n).length){t[e]={...t[e]};for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[e][r]=n[r])}}let tn;class en{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext=nn()}static clone(t){return t?t.clone():new en}clone(){const t=new en;return t._breadcrumbs=[...this._breadcrumbs],t._tags={...this._tags},t._extra={...this._extra},t._contexts={...this._contexts},t._user=this._user,t._level=this._level,t._span=this._span,t._session=this._session,t._transactionName=this._transactionName,t._fingerprint=this._fingerprint,t._eventProcessors=[...this._eventProcessors],t._requestSession=this._requestSession,t._attachments=[...this._attachments],t._sdkProcessingMetadata={...this._sdkProcessingMetadata},t._propagationContext={...this._propagationContext},t._client=this._client,t}setClient(t){this._client=t}getClient(){return this._client}addScopeListener(t){this._scopeListeners.push(t)}addEventProcessor(t){return this._eventProcessors.push(t),this}setUser(t){return this._user=t||{email:void 0,id:void 0,ip_address:void 0,segment:void 0,username:void 0},this._session&&Ae(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[t]=e,this._notifyScopeListeners(),this}setSpan(t){return this._span=t,this._notifyScopeListeners(),this}getSpan(){return this._span}getTransaction(){const t=this._span;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;const e="function"==typeof t?t(this):t;if(e instanceof en){const t=e.getScopeData();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.length&&(this._fingerprint=t.fingerprint),e.getRequestSession()&&(this._requestSession=e.getRequestSession()),t.propagationContext&&(this._propagationContext=t.propagationContext)}else if(E(e)){const e=t;this._tags={...this._tags,...e.tags},this._extra={...this._extra,...e.extra},this._contexts={...this._contexts,...e.contexts},e.user&&(this._user=e.user),e.level&&(this._level=e.level),e.fingerprint&&(this._fingerprint=e.fingerprint),e.requestSession&&(this._requestSession=e.requestSession),e.propagationContext&&(this._propagationContext=e.propagationContext)}return this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._span=void 0,this._session=void 0,this._notifyScopeListeners(),this._attachments=[],this._propagationContext=nn(),this}addBreadcrumb(t,e){const n="number"==typeof e?e:100;if(n<=0)return this;const r={timestamp:fe(),...t},i=this._breadcrumbs;return i.push(r),this._breadcrumbs=i.length>n?i.slice(-n):i,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(t){return this._attachments.push(t),this}getAttachments(){return this.getScopeData().attachments}clearAttachments(){return this._attachments=[],this}getScopeData(){const{_breadcrumbs:t,_attachments:e,_contexts:n,_tags:r,_extra:i,_user:o,_level:s,_fingerprint:a,_eventProcessors:l,_propagationContext:c,_sdkProcessingMetadata:u,_transactionName:h,_span:d}=this;return{breadcrumbs:t,attachments:e,contexts:n,tags:r,extra:i,user:o,level:s,fingerprint:a||[],eventProcessors:l,propagationContext:c,sdkProcessingMetadata:u,transactionName:h,span:d}}applyToEvent(t,e={},n=[]){Ze(t,this.getScopeData());return Me([...n,...Oe(),...this._eventProcessors],t,e)}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata={...this._sdkProcessingMetadata,...t},this}setPropagationContext(t){return this._propagationContext=t,this}getPropagationContext(){return this._propagationContext}captureException(t,e){const n=e&&e.event_id?e.event_id:Tt();if(!this._client)return Q.warn("No client configured on scope - will not capture exception!"),n;const r=new Error("Sentry syntheticException");return this._client.captureException(t,{originalException:t,syntheticException:r,...e,event_id:n},this),n}captureMessage(t,e,n){const r=n&&n.event_id?n.event_id:Tt();if(!this._client)return Q.warn("No client configured on scope - will not capture message!"),r;const i=new Error(t);return this._client.captureMessage(t,e,{originalException:t,syntheticException:i,...n,event_id:r},this),r}captureEvent(t,e){const n=e&&e.event_id?e.event_id:Tt();return this._client?(this._client.captureEvent(t,{...e,event_id:n},this),n):(Q.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(t=>{t(this)}),this._notifyingListeners=!1)}}function nn(){return{traceId:Tt(),spanId:Tt().substring(16)}}const rn="7.116.0",on=parseFloat(rn),sn=100;class an{constructor(t,e,n,r=on){let i,o;this._version=r,e?i=e:(i=new en,i.setClient(t)),n?o=n:(o=new en,o.setClient(t)),this._stack=[{scope:i}],t&&this.bindClient(t),this._isolationScope=o}isOlderThan(t){return this._version<t}bindClient(t){const e=this.getStackTop();e.client=t,e.scope.setClient(t),t&&t.setupIntegrations&&t.setupIntegrations()}pushScope(){const t=this.getScope().clone();return this.getStack().push({client:this.getClient(),scope:t}),t}popScope(){return!(this.getStack().length<=1)&&!!this.getStack().pop()}withScope(t){const e=this.pushScope();let n;try{n=t(e)}catch(r){throw this.popScope(),r}return P(n)?n.then(t=>(this.popScope(),t),t=>{throw this.popScope(),t}):(this.popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStack(){return this._stack}getStackTop(){return this._stack[this._stack.length-1]}captureException(t,e){const n=this._lastEventId=e&&e.event_id?e.event_id:Tt(),r=new Error("Sentry syntheticException");return this.getScope().captureException(t,{originalException:t,syntheticException:r,...e,event_id:n}),n}captureMessage(t,e,n){const r=this._lastEventId=n&&n.event_id?n.event_id:Tt(),i=new Error(t);return this.getScope().captureMessage(t,e,{originalException:t,syntheticException:i,...n,event_id:r}),r}captureEvent(t,e){const n=e&&e.event_id?e.event_id:Tt();return t.type||(this._lastEventId=n),this.getScope().captureEvent(t,{...e,event_id:n}),n}lastEventId(){return this._lastEventId}addBreadcrumb(t,e){const{scope:n,client:r}=this.getStackTop();if(!r)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:o=sn}=r.getOptions&&r.getOptions()||{};if(o<=0)return;const s={timestamp:fe(),...t},a=i?J(()=>i(s,e)):s;null!==a&&(r.emit&&r.emit("beforeAddBreadcrumb",a,e),n.addBreadcrumb(a,o))}setUser(t){this.getScope().setUser(t),this.getIsolationScope().setUser(t)}setTags(t){this.getScope().setTags(t),this.getIsolationScope().setTags(t)}setExtras(t){this.getScope().setExtras(t),this.getIsolationScope().setExtras(t)}setTag(t,e){this.getScope().setTag(t,e),this.getIsolationScope().setTag(t,e)}setExtra(t,e){this.getScope().setExtra(t,e),this.getIsolationScope().setExtra(t,e)}setContext(t,e){this.getScope().setContext(t,e),this.getIsolationScope().setContext(t,e)}configureScope(t){const{scope:e,client:n}=this.getStackTop();n&&t(e)}run(t){const e=cn(this);try{t(this)}finally{cn(e)}}getIntegration(t){const e=this.getClient();if(!e)return null;try{return e.getIntegration(t)}catch{return Te&&Q.warn(`Cannot retrieve integration ${t.id} from the current Hub`),null}}startTransaction(t,e){const n=this._callExtensionMethod("startTransaction",t,e);return Te&&!n&&(this.getClient()?Q.warn("Tracing extension 'startTransaction' has not been added. Call 'addTracingExtensions' before calling 'init':\nSentry.addTracingExtensions();\nSentry.init({...});\n"):Q.warn("Tracing extension 'startTransaction' is missing. You should 'init' the SDK before calling 'startTransaction'")),n}traceHeaders(){return this._callExtensionMethod("traceHeaders")}captureSession(t=!1){if(t)return this.endSession();this._sendSessionUpdate()}endSession(){const t=this.getStackTop().scope,e=t.getSession();e&&De(e),this._sendSessionUpdate(),t.setSession()}startSession(t){const{scope:e,client:n}=this.getStackTop(),{release:r,environment:i=je}=n&&n.getOptions()||{},{userAgent:o}=H.navigator||{},s=Pe({release:r,environment:i,user:e.getUser(),...o&&{userAgent:o},...t}),a=e.getSession&&e.getSession();return a&&"ok"===a.status&&Ae(a,{status:"exited"}),this.endSession(),e.setSession(s),s}shouldSendDefaultPii(){const t=this.getClient(),e=t&&t.getOptions();return!(!e||!e.sendDefaultPii)}_sendSessionUpdate(){const{scope:t,client:e}=this.getStackTop(),n=t.getSession();n&&e&&e.captureSession&&e.captureSession(n)}_callExtensionMethod(t,...e){const n=ln().__SENTRY__;if(n&&n.extensions&&"function"==typeof n.extensions[t])return n.extensions[t].apply(this,e);Te&&Q.warn(`Extension method ${t} couldn't be found, doing nothing.`)}}function ln(){return H.__SENTRY__=H.__SENTRY__||{extensions:{},hub:void 0},H}function cn(t){const e=ln(),n=dn(e);return pn(e,t),n}function un(){const t=ln();if(t.__SENTRY__&&t.__SENTRY__.acs){const e=t.__SENTRY__.acs.getCurrentHub();if(e)return e}return function(t=ln()){return(!function(t){return!!(t&&t.__SENTRY__&&t.__SENTRY__.hub)}(t)||dn(t).isOlderThan(on))&&pn(t,new an),dn(t)}(t)}function hn(){return un().getIsolationScope()}function dn(t){return U("hub",()=>new an,t)}function pn(t,e){if(!t)return!1;return(t.__SENTRY__=t.__SENTRY__||{}).hub=e,!0}function fn(t,e,n,r){const i=Se(n),o=t.type&&"replay_event"!==t.type?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);const s=function(t,e,n,r){const i=t.sdkProcessingMetadata&&t.sdkProcessingMetadata.dynamicSamplingContext;return{event_id:t.event_id,sent_at:(new Date).toISOString(),...e&&{sdk:e},...!!n&&r&&{dsn:et(r)},...i&&{trace:dt({...i})}}}(t,i,r,e);return delete t.sdkProcessingMetadata,me(s,[[{type:o},t]])}function gn(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}`}})}const mn=[];function vn(t){const e=t.defaultIntegrations||[],n=t.integrations;let r;e.forEach(t=>{t.isDefaultInstance=!0}),r=Array.isArray(n)?[...e,...n]:"function"==typeof n?At(n(e)):e;const i=function(t){const e={};return t.forEach(t=>{const{name:n}=t,r=e[n];r&&!r.isDefaultInstance&&t.isDefaultInstance||(e[n]=t)}),Object.keys(e).map(t=>e[t])}(r),o=function(t,e){for(let n=0;n<t.length;n++)if(!0===e(t[n]))return n;return-1}(i,t=>"Debug"===t.name);if(-1!==o){const[t]=i.splice(o,1);i.push(t)}return i}function bn(t,e){for(const n of e)n&&n.afterAllSetup&&n.afterAllSetup(t)}function yn(t,e,n){if(n[e.name])Te&&Q.log(`Integration skipped because it was already installed: ${e.name}`);else{if(n[e.name]=e,-1===mn.indexOf(e.name)&&(e.setupOnce(Ee,un),mn.push(e.name)),e.setup&&"function"==typeof e.setup&&e.setup(t),t.on&&"function"==typeof e.preprocessEvent){const n=e.preprocessEvent.bind(e);t.on("preprocessEvent",(e,r)=>n(e,r,t))}if(t.addEventProcessor&&"function"==typeof e.processEvent){const n=e.processEvent.bind(e),r=Object.assign((e,r)=>n(e,r,t),{id:e.name});t.addEventProcessor(r)}Te&&Q.log(`Integration installed: ${e.name}`)}}function xn(t,e){return Object.assign(function(...t){return e(...t)},{id:t})}function wn(t,e,n,r){const i={sent_at:(new Date).toISOString()};n&&n.sdk&&(i.sdk={name:n.sdk.name,version:n.sdk.version}),r&&e&&(i.dsn=et(e));const o=function(t){const e=function(t){let e="";for(const n of t){const t=Object.entries(n.tags),r=t.length>0?`|#${t.map(([t,e])=>`${t}:${e}`).join(",")}`:"";e+=`${n.name}@${n.unit}:${n.metric}|${n.metricType}${r}|T${n.timestamp}\n`}return e}(t);return[{type:"statsd",length:e.length},e]}(t);return me(i,[o])}const _n="Not capturing exception because it's already been captured.";class Cn{constructor(t){if(this._options=t,this._integrations={},this._integrationsInitialized=!1,this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],t.dsn?this._dsn=rt(t.dsn):Te&&Q.warn("No DSN provided, client will not send events."),this._dsn){const e=function(t,e={}){const 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){const 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)}?${gn(t,r)}`}(this._dsn,t);this._transport=t.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...t.transportOptions,url:e})}}captureException(t,e,n){if(Pt(t))return void(Te&&Q.log(_n));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;const o=j(t)?t:String(t),s=O(t)?this.eventFromMessage(o,e,n):this.eventFromException(t,n);return this._process(s.then(t=>this._captureEvent(t,n,r)).then(t=>{i=t})),i}captureEvent(t,e,n){if(e&&e.originalException&&Pt(e.originalException))return void(Te&&Q.log(_n));let r=e&&e.event_id;const i=(t.sdkProcessingMetadata||{}).capturedSpanScope;return this._process(this._captureEvent(t,e,i||n).then(t=>{r=t})),r}captureSession(t){"string"!=typeof t.release?Te&&Q.warn("Discarded session because of missing or non-string release"):(this.sendSession(t),Ae(t,{init:!1}))}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(t){const e=this._transport;return e?(this.metricsAggregator&&this.metricsAggregator.flush(),this._isClientDoneProcessing(t).then(n=>e.flush(t).then(t=>n&&t))):ae(!0)}close(t){return this.flush(t).then(t=>(this.getOptions().enabled=!1,this.metricsAggregator&&this.metricsAggregator.close(),t))}getEventProcessors(){return this._eventProcessors}addEventProcessor(t){this._eventProcessors.push(t)}setupIntegrations(t){(t&&!this._integrationsInitialized||this._isEnabled()&&!this._integrationsInitialized)&&this._setupIntegrations()}init(){this._isEnabled()&&this._setupIntegrations()}getIntegrationById(t){return this.getIntegrationByName(t)}getIntegrationByName(t){return this._integrations[t]}getIntegration(t){try{return this._integrations[t.id]||null}catch{return Te&&Q.warn(`Cannot retrieve integration ${t.id} from the current Client`),null}}addIntegration(t){const e=this._integrations[t.name];yn(this,t,this._integrations),e||bn(this,[t])}sendEvent(t,e={}){this.emit("beforeSendEvent",t,e);let n=fn(t,this._dsn,this._options._metadata,this._options.tunnel);for(const i of e.attachments||[])n=ve(n,we(i,this._options.transportOptions&&this._options.transportOptions.textEncoder));const r=this._sendEnvelope(n);r&&r.then(e=>this.emit("afterSendEvent",t,e),null)}sendSession(t){const e=function(t,e,n,r){const i=Se(n);return me({sent_at:(new Date).toISOString(),...i&&{sdk:i},...!!r&&e&&{dsn:et(e)}},["aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()]])}(t,this._dsn,this._options._metadata,this._options.tunnel);this._sendEnvelope(e)}recordDroppedEvent(t,e,n){if(this._options.sendClientReports){const n=`${t}:${e}`;Te&&Q.log(`Adding outcome: "${n}"`),this._outcomes[n]=this._outcomes[n]+1||1}}captureAggregateMetrics(t){Te&&Q.log(`Flushing aggregated metrics, number of metrics: ${t.length}`);const e=wn(t,this._dsn,this._options._metadata,this._options.tunnel);this._sendEnvelope(e)}on(t,e){this._hooks[t]||(this._hooks[t]=[]),this._hooks[t].push(e)}emit(t,...e){this._hooks[t]&&this._hooks[t].forEach(t=>t(...e))}_setupIntegrations(){const{integrations:t}=this._options;this._integrations=function(t,e){const n={};return e.forEach(e=>{e&&yn(t,e,n)}),n}(this,t),bn(this,t),this._integrationsInitialized=!0}_updateSessionFromEvent(t,e){let n=!1,r=!1;const i=e.exception&&e.exception.values;if(i){r=!0;for(const t of i){const e=t.mechanism;if(e&&!1===e.handled){n=!0;break}}}const o="ok"===t.status;(o&&0===t.errors||o&&n)&&(Ae(t,{...n&&{status:"crashed"},errors:t.errors||Number(r||n)}),this.captureSession(t))}_isClientDoneProcessing(t){return new ce(e=>{let n=0;const 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._transport}_prepareEvent(t,e,n,r=hn()){const i=this.getOptions(),o=Object.keys(this._integrations);return!e.integrations&&o.length>0&&(e.integrations=o),this.emit("preprocessEvent",t,e),ze(i,t,e,n,this,r).then(t=>{if(null===t)return t;const e={...r.getPropagationContext(),...n?n.getPropagationContext():void 0};if((!t.contexts||!t.contexts.trace)&&e){const{traceId:r,spanId:i,parentSpanId:o,dsc:s}=e;t.contexts={trace:{trace_id:r,span_id:i,parent_span_id:o},...t.contexts};const a=s||qe(r,this,n);t.sdkProcessingMetadata={dynamicSamplingContext:a,...t.sdkProcessingMetadata}}return t})}_captureEvent(t,e={},n){return this._processEvent(t,e,n).then(t=>t.event_id,t=>{if(Te){const e=t;"log"===e.logLevel?Q.log(e.message):Q.warn(e)}})}_processEvent(t,e,n){const r=this.getOptions(),{sampleRate:i}=r,o=kn(t),s=Sn(t),a=t.type||"error",l=`before send for type \`${a}\``;if(s&&"number"==typeof i&&Math.random()>i)return this.recordDroppedEvent("sample_rate","error",t),le(new it(`Discarding event because it's not included in the random sample (sampling rate = ${i})`,"log"));const c="replay_event"===a?"replay":a,u=(t.sdkProcessingMetadata||{}).capturedSpanIsolationScope;return this._prepareEvent(t,e,n,u).then(n=>{if(null===n)throw this.recordDroppedEvent("event_processor",c,t),new it("An event processor returned `null`, will not send event.","log");if(e.data&&!0===e.data.__sentry__)return n;const i=function(t,e,n){const{beforeSend:r,beforeSendTransaction:i}=t;return Sn(e)&&r?r(e,n):kn(e)&&i?i(e,n):e}(r,n,e);return function(t,e){const n=`${e} must return \`null\` or a valid event.`;if(P(t))return t.then(t=>{if(!E(t)&&null!==t)throw new it(n);return t},t=>{throw new it(`${e} rejected with ${t}`)});if(!E(t)&&null!==t)throw new it(n);return t}(i,l)}).then(r=>{if(null===r)throw this.recordDroppedEvent("before_send",c,t),new it(`${l} returned \`null\`, will not send event.`,"log");const i=n&&n.getSession();!o&&i&&this._updateSessionFromEvent(i,r);const s=r.transaction_info;if(o&&s&&r.transaction!==t.transaction){const t="custom";r.transaction_info={...s,source:t}}return this.sendEvent(r,e),r}).then(null,t=>{throw t instanceof it?t:(this.captureException(t,{data:{__sentry__:!0},originalException:t}),new it(`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++,t.then(t=>(this._numProcessing--,t),t=>(this._numProcessing--,t))}_sendEnvelope(t){if(this.emit("beforeEnvelope",t),this._isEnabled()&&this._transport)return this._transport.send(t).then(null,t=>{Te&&Q.error("Error while sending event:",t)});Te&&Q.error("Transport disabled")}_clearOutcomes(){const 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 Sn(t){return void 0===t.type}function kn(t){return"transaction"===t.type}function Tn(t,e){!0===e.debug&&(Te?Q.enable():J(()=>{})),He().update(e.initialScope);const n=new t(e);(function(t){const e=un().getStackTop();e.client=t,e.scope.setClient(t)})(n),function(t){t.init?t.init():t.setupIntegrations&&t.setupIntegrations()}(n)}function jn(t,e,n=ue(t.bufferSize||30)){let r={};function i(i){const o=[];if(be(i,(e,n)=>{const i=Ce(n);if(function(t,e,n=Date.now()){return function(t,e){return t[e]||t.all||0}(t,e)>n}(r,i)){const r=On(e,n);t.recordDroppedEvent("ratelimit_backoff",i,r)}else o.push(e)}),0===o.length)return ae();const s=me(i[0],o),a=e=>{be(s,(n,r)=>{const i=On(n,r);t.recordDroppedEvent(e,Ce(r),i)})};return n.add(()=>e({body:xe(s,t.textEncoder)}).then(t=>(void 0!==t.statusCode&&(t.statusCode<200||t.statusCode>=300)&&Te&&Q.warn(`Sentry responded with status code ${t.statusCode} to sent event.`),r=ke(r,t),t),t=>{throw a("network_error"),t})).then(t=>t,t=>{if(t instanceof it)return Te&&Q.error("Skipped sending event because buffer is full."),a("queue_overflow"),ae();throw t})}return i.__sentry__baseTransport__=!0,{send:i,flush:t=>n.drain(t)}}function On(t,e){if("event"===e||"transaction"===e)return Array.isArray(t)?t[1]:void 0}function En(t,e,n=[e],r="npm"){const i=t._metadata||{};i.sdk||(i.sdk={name:`sentry.javascript.${e}`,packages:n.map(t=>({name:`${r}:@sentry/${t}`,version:rn})),version:rn}),t._metadata=i}const Mn=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/],Pn=[/^.*\/healthcheck$/,/^.*\/healthy$/,/^.*\/live$/,/^.*\/ready$/,/^.*\/heartbeat$/,/^.*\/health$/,/^.*\/healthz$/],An="InboundFilters",Dn=(t={})=>({name:An,setupOnce(){},processEvent(e,n,r){const i=r.getOptions(),o=function(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...t.disableErrorDefaults?[]:Mn],ignoreTransactions:[...t.ignoreTransactions||[],...e.ignoreTransactions||[],...t.disableTransactionDefaults?[]:Pn],ignoreInternal:void 0===t.ignoreInternal||t.ignoreInternal}}(t,i);return function(t,e){return e.ignoreInternal&&function(t){try{return"SentryError"===t.exception.values[0].type}catch{}return!1}(t)?(Te&&Q.warn(`Event dropped due to being internal Sentry Error.\nEvent: ${Ot(t)}`),!0):function(t,e){return!(t.type||!e||!e.length)&&function(t){const e=[];let n;t.message&&e.push(t.message);try{n=t.exception.values[t.exception.values.length-1]}catch{}return n&&n.value&&(e.push(n.value),n.type&&e.push(`${n.type}: ${n.value}`)),Te&&0===e.length&&Q.error(`Could not extract message for event ${Ot(t)}`),e}(t).some(t=>L(t,e))}(t,e.ignoreErrors)?(Te&&Q.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${Ot(t)}`),!0):function(t,e){if("transaction"!==t.type||!e||!e.length)return!1;const n=t.transaction;return!!n&&L(n,e)}(t,e.ignoreTransactions)?(Te&&Q.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${Ot(t)}`),!0):function(t,e){if(!e||!e.length)return!1;const n=In(t);return!!n&&L(n,e)}(t,e.denyUrls)?(Te&&Q.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${Ot(t)}.\nUrl: ${In(t)}`),!0):!function(t,e){if(!e||!e.length)return!0;const n=In(t);return!n||L(n,e)}(t,e.allowUrls)&&(Te&&Q.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${Ot(t)}.\nUrl: ${In(t)}`),!0)}(e,o)?null:e}});function In(t){try{let e;try{e=t.exception.values[0].stacktrace.frames}catch{}return e?function(t=[]){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n&&"<anonymous>"!==n.filename&&"[native code]"!==n.filename)return n.filename||null}return null}(e):null}catch{return Te&&Q.error(`Cannot extract url for event ${Ot(t)}`),null}}let Rn;xn(An,Dn);const zn="FunctionToString",Ln=new WeakMap,Fn=()=>({name:zn,setupOnce(){Rn=Function.prototype.toString;try{Function.prototype.toString=function(...t){const e=lt(this),n=Ln.has($e())&&void 0!==e?e:this;return Rn.apply(n,t)}}catch{}},setup(t){Ln.set(t,!0)}});xn(zn,Fn);const Nn=H;let Bn=0;function Vn(){return Bn>0}function $n(t,e={},n){if("function"!=typeof t)return t;try{const e=t.__sentry_wrapped__;if(e)return e;if(lt(t))return t}catch{return t}const r=function(){const r=Array.prototype.slice.call(arguments);try{n&&"function"==typeof n&&n.apply(this,arguments);const i=r.map(t=>$n(t,e));return t.apply(this,i)}catch(i){throw Bn++,setTimeout(()=>{Bn--}),function(...t){const e=un();if(2===t.length){const[n,r]=t;return n?e.withScope(()=>(e.getStackTop().scope=n,r(n))):e.withScope(r)}e.withScope(t[0])}(t=>{t.addEventProcessor(t=>(e.mechanism&&(Et(t,void 0,void 0),Mt(t,e.mechanism)),t.extra={...t.extra,arguments:r},t)),function(t,e){un().captureException(t,Fe(e))}(i)}),i}};try{for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=t[e])}catch{}at(r,t),st(t,"__sentry_wrapped__",r);try{Object.getOwnPropertyDescriptor(r,"name").configurable&&Object.defineProperty(r,"name",{get:()=>t.name})}catch{}return r}const Hn=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function Wn(t,e){const n=Xn(t,e),r={type:e&&e.name,value:Gn(e)};return n.length&&(r.stacktrace={frames:n}),void 0===r.type&&""===r.value&&(r.value="Unrecoverable error caught"),r}function Un(t,e){return{exception:{values:[Wn(t,e)]}}}function Xn(t,e){const n=e.stacktrace||e.stack||"",r=function(t){if(t){if("number"==typeof t.framesToPop)return t.framesToPop;if(Yn.test(t.message))return 1}return 0}(e);try{return t(n,r)}catch{}return[]}const Yn=/Minified React error #\d+;/i;function Gn(t){const e=t&&t.message;return e?e.error&&"string"==typeof e.error.message?e.error.message:e:"No error message"}function qn(t,e,n,r,i){let o;if(S(e)&&e.error)return Un(t,e.error);if(k(e)||function(t){return C(t,"DOMException")}(e)){const i=e;if("stack"in e)o=Un(t,e);else{const e=i.name||(k(i)?"DOMError":"DOMException"),s=i.message?`${e}: ${i.message}`:e;o=Kn(t,s,n,r),Et(o,s)}return"code"in i&&(o.tags={...o.tags,"DOMException.code":`${i.code}`}),o}return _(e)?Un(t,e):E(e)||M(e)?(o=function(t,e,n,r){const i=$e(),o=i&&i.getOptions().normalizeDepth,s={exception:{values:[{type:M(e)?e.constructor.name:r?"UnhandledRejection":"Error",value:Zn(e,{isUnhandledRejection:r})}]},extra:{__serialized__:ie(e,o)}};if(n){const e=Xn(t,n);e.length&&(s.exception.values[0].stacktrace={frames:e})}return s}(t,e,n,i),Mt(o,{synthetic:!0}),o):(o=Kn(t,e,n,r),Et(o,`${e}`,void 0),Mt(o,{synthetic:!0}),o)}function Kn(t,e,n,r){const i={};if(r&&n){const r=Xn(t,n);r.length&&(i.exception={values:[{value:e,stacktrace:{frames:r}}]})}if(j(e)){const{__sentry_template_string__:t,__sentry_template_values__:n}=e;return i.logentry={message:t,params:n},i}return i.message=e,i}function Zn(t,{isUnhandledRejection:e}){const n=function(t,e=40){const n=Object.keys(ct(t));if(n.sort(),!n.length)return"[object has no keys]";if(n[0].length>=e)return I(n[0],e);for(let r=n.length;r>0;r--){const t=n.slice(0,r).join(", ");if(!(t.length>e))return r===n.length?t:I(t,e)}return""}(t),r=e?"promise rejection":"exception";return S(t)?`Event \`ErrorEvent\` captured as ${r} with message \`${t.message}\``:M(t)?`Event \`${function(t){try{const e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}(t)}\` (type=${t.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}class Jn extends Cn{constructor(t){En(t,"browser",["browser"],Nn.SENTRY_SDK_SOURCE||"npm"),super(t),t.sendClientReports&&Nn.document&&Nn.document.addEventListener("visibilitychange",()=>{"hidden"===Nn.document.visibilityState&&this._flushOutcomes()})}eventFromException(t,e){return function(t,e,n,r){const i=qn(t,e,n&&n.syntheticException||void 0,r);return Mt(i),i.level="error",n&&n.event_id&&(i.event_id=n.event_id),ae(i)}(this._options.stackParser,t,e,this._options.attachStacktrace)}eventFromMessage(t,e="info",n){return function(t,e,n="info",r,i){const o=Kn(t,e,r&&r.syntheticException||void 0,i);return o.level=n,r&&r.event_id&&(o.event_id=r.event_id),ae(o)}(this._options.stackParser,t,e,n,this._options.attachStacktrace)}captureUserFeedback(t){if(!this._isEnabled())return void(Hn&&Q.warn("SDK not enabled, will not capture user feedback."));const e=function(t,{metadata:e,tunnel:n,dsn:r}){const i={event_id:t.event_id,sent_at:(new Date).toISOString(),...e&&e.sdk&&{sdk:{name:e.sdk.name,version:e.sdk.version}},...!!n&&!!r&&{dsn:et(r)}},o=function(t){return[{type:"user_report"},t]}(t);return me(i,[o])}(t,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this._sendEnvelope(e)}_prepareEvent(t,e,n){return t.platform=t.platform||"javascript",super._prepareEvent(t,e,n)}_flushOutcomes(){const t=this._clearOutcomes();if(0===t.length)return void(Hn&&Q.log("No outcomes to send"));if(!this._dsn)return void(Hn&&Q.log("No dsn provided, will not send outcomes"));Hn&&Q.log("Sending outcomes:",t);const e=function(t,e,n){return me(e?{dsn:e}:{},[[{type:"client_report"},{timestamp:n||fe(),discarded_events:t}]])}(t,this._options.tunnel&&et(this._dsn));this._sendEnvelope(e)}}let Qn;function tr(t,e=function(){if(Qn)return Qn;if(Vt(Nn.fetch))return Qn=Nn.fetch.bind(Nn);const t=Nn.document;let e=Nn.fetch;if(t&&"function"==typeof t.createElement)try{const n=t.createElement("iframe");n.hidden=!0,t.head.appendChild(n);const r=n.contentWindow;r&&r.fetch&&(e=r.fetch),t.head.removeChild(n)}catch(n){Hn&&Q.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",n)}return Qn=e.bind(Nn)}()){let n=0,r=0;return jn(t,function(i){const o=i.body.length;n+=o,r++;const s={body:i.body,method:"POST",referrerPolicy:"origin",headers:t.headers,keepalive:n<=6e4&&r<15,...t.fetchOptions};try{return e(t.url,s).then(t=>(n-=o,r--,{statusCode:t.status,headers:{"x-sentry-rate-limits":t.headers.get("X-Sentry-Rate-Limits"),"retry-after":t.headers.get("Retry-After")}}))}catch(a){return Qn=void 0,n-=o,r--,le(a)}})}function er(t){return jn(t,function(e){return new ce((n,r)=>{const i=new XMLHttpRequest;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);for(const e in t.headers)Object.prototype.hasOwnProperty.call(t.headers,e)&&i.setRequestHeader(e,t.headers[e]);i.send(e.body)})})}const nr="?";function rr(t,e,n,r){const i={filename:t,function:e,in_app:!0};return void 0!==n&&(i.lineno=n),void 0!==r&&(i.colno=r),i}const ir=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,or=/\((\S*)(?::(\d+))(?::(\d+))\)/,sr=[30,t=>{const e=ir.exec(t);if(e){if(e[2]&&0===e[2].indexOf("eval")){const t=or.exec(e[2]);t&&(e[2]=t[1],e[3]=t[2],e[4]=t[3])}const[t,n]=pr(e[1]||nr,e[2]);return rr(n,t,e[3]?+e[3]:void 0,e[4]?+e[4]:void 0)}}],ar=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,lr=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,cr=[50,t=>{const e=ar.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const t=lr.exec(e[3]);t&&(e[1]=e[1]||"eval",e[3]=t[1],e[4]=t[2],e[5]="")}let t=e[3],n=e[1]||nr;return[n,t]=pr(n,t),rr(t,n,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}],ur=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,hr=[40,t=>{const e=ur.exec(t);return e?rr(e[2],e[1]||nr,+e[3],e[4]?+e[4]:void 0):void 0}],dr=mt(...[sr,cr,hr]),pr=(t,e)=>{const n=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return n||r?[-1!==t.indexOf("@")?t.split("@")[0]:nr,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},fr=1024,gr="Breadcrumbs",mr=(t={})=>{const e={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...t};return{name:gr,setupOnce(){},setup(t){e.console&&function(t){const e="console";_t(e,t),Ct(e,kt)}(function(t){return function(e){if($e()!==t)return;const n={category:"console",data:{arguments:e.args,logger:"console"},level:pe(e.level),message:R(e.args," ")};if("assert"===e.level){if(!1!==e.args[0])return;n.message=`Assertion failed: ${R(e.args.slice(1)," ")||"console.assert"}`,n.data.arguments=e.args.slice(1)}Ve(n,{input:e.args,level:e.level})}}(t)),e.dom&&function(t){_t("dom",t),Ct("dom",Lt)}(function(t,e){return function(n){if($e()!==t)return;let r,i,o="object"==typeof e?e.serializeAttribute:void 0,s="object"==typeof e&&"number"==typeof e.maxStringLength?e.maxStringLength:void 0;s&&s>fr&&(Hn&&Q.warn(`\`dom.maxStringLength\` cannot exceed 1024, but a value of ${s} was configured. Sentry will use 1024 instead.`),s=fr),"string"==typeof o&&(o=[o]);try{const t=n.event,e=function(t){return!!t&&!!t.target}(t)?t.target:t;r=Y(e,{keyAttrs:o,maxStringLength:s}),i=function(t){if(!X.HTMLElement)return null;let e=t;for(let n=0;n<5;n++){if(!e)return null;if(e instanceof HTMLElement&&e.dataset.sentryComponent)return e.dataset.sentryComponent;e=e.parentNode}return null}(e)}catch{r="<unknown>"}if(0===r.length)return;const a={category:`ui.${n.name}`,message:r};i&&(a.data={"ui.component_name":i}),Ve(a,{event:n.event,name:n.name,global:n.global})}}(t,e.dom)),e.xhr&&function(t){_t("xhr",t),Ct("xhr",ne)}(function(t){return function(e){if($e()!==t)return;const{startTimestamp:n,endTimestamp:r}=e,i=e.xhr[ee];if(!n||!r||!i)return;const{method:o,url:s,status_code:a,body:l}=i;Ve({category:"xhr",data:{method:o,url:s,status_code:a},type:"http"},{xhr:e.xhr,input:l,startTimestamp:n,endTimestamp:r})}}(t)),e.fetch&&function(t){const e="fetch";_t(e,t),Ct(e,$t)}(function(t){return function(e){if($e()!==t)return;const{startTimestamp:n,endTimestamp:r}=e;if(r&&(!e.fetchData.url.match(/sentry_key/)||"POST"!==e.fetchData.method))if(e.error){Ve({category:"fetch",data:e.fetchData,level:"error",type:"http"},{data:e.error,input:e.args,startTimestamp:n,endTimestamp:r})}else{const t=e.response;Ve({category:"fetch",data:{...e.fetchData,status_code:t&&t.status},type:"http"},{input:e.args,response:t,startTimestamp:n,endTimestamp:r})}}}(t)),e.history&&Jt(function(t){return function(e){if($e()!==t)return;let n=e.from,r=e.to;const i=he(Nn.location.href);let o=n?he(n):void 0;const s=he(r);(!o||!o.path)&&(o=i),i.protocol===s.protocol&&i.host===s.host&&(r=s.relative),i.protocol===o.protocol&&i.host===o.host&&(n=o.relative),Ve({category:"navigation",data:{from:n,to:r}})}}(t)),e.sentry&&t.on&&t.on("beforeSendEvent",function(t){return function(e){$e()===t&&Ve({category:"sentry."+("transaction"===e.type?"transaction":"event"),event_id:e.event_id,level:e.level,message:Ot(e)},{event:e})}}(t))}}};xn(gr,mr);const vr="Dedupe",br=()=>{let t;return{name:vr,setupOnce(){},processEvent(e){if(e.type)return e;try{if(function(t,e){return!!e&&!(!function(t,e){const n=t.message,r=e.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!xr(t,e)||!yr(t,e))}(t,e)&&!function(t,e){const n=wr(e),r=wr(t);return!(!n||!r||n.type!==r.type||n.value!==r.value||!xr(t,e)||!yr(t,e))}(t,e))}(e,t))return Hn&&Q.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}};function yr(t,e){let n=_r(t),r=_r(e);if(!n&&!r)return!0;if(n&&!r||!n&&r||r.length!==n.length)return!1;for(let i=0;i<r.length;i++){const t=r[i],e=n[i];if(t.filename!==e.filename||t.lineno!==e.lineno||t.colno!==e.colno||t.function!==e.function)return!1}return!0}function xr(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 wr(t){return t.exception&&t.exception.values&&t.exception.values[0]}function _r(t){const e=t.exception;if(e)try{return e.values[0].stacktrace.frames}catch{return}}xn(vr,br);const Cr="GlobalHandlers",Sr=(t={})=>{const e={onerror:!0,onunhandledrejection:!0,...t};return{name:Cr,setupOnce(){Error.stackTraceLimit=50},setup(t){e.onerror&&(function(t){!function(t){const e="error";_t(e,t),Ct(e,Xt)}(e=>{const{stackParser:n,attachStacktrace:r}=jr();if($e()!==t||Vn())return;const{msg:i,url:o,line:s,column:a,error:l}=e,c=void 0===l&&T(i)?function(t,e,n,r){const i=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;let o=S(t)?t.message:t,s="Error";const a=o.match(i);return a&&(s=a[1],o=a[2]),kr({exception:{values:[{type:s,value:o}]}},e,n,r)}(i,o,s,a):kr(qn(n,l||i,void 0,r,!1),o,s,a);c.level="error",Be(c,{originalException:l,mechanism:{handled:!1,type:"onerror"}})})}(t),Tr("onerror")),e.onunhandledrejection&&(function(t){!function(t){const e="unhandledrejection";_t(e,t),Ct(e,Gt)}(e=>{const{stackParser:n,attachStacktrace:r}=jr();if($e()!==t||Vn())return;const i=function(t){if(O(t))return t;const e=t;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return t}(e),o=O(i)?function(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`}]}}}(i):qn(n,i,void 0,r,!0);o.level="error",Be(o,{originalException:i,mechanism:{handled:!1,type:"onunhandledrejection"}})})}(t),Tr("onunhandledrejection"))}}};function kr(t,e,n,r){const i=t.exception=t.exception||{},o=i.values=i.values||[],s=o[0]=o[0]||{},a=s.stacktrace=s.stacktrace||{},l=a.frames=a.frames||[],c=isNaN(parseInt(r,10))?void 0:r,u=isNaN(parseInt(n,10))?void 0:n,h=T(e)&&e.length>0?e:function(){try{return X.document.location.href}catch{return""}}();return 0===l.length&&l.push({colno:c,filename:h,function:"?",in_app:!0,lineno:u}),t}function Tr(t){Hn&&Q.log(`Global Handler attached: ${t}`)}function jr(){const t=$e();return t&&t.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}xn(Cr,Sr);const Or="HttpContext",Er=()=>({name:Or,setupOnce(){},preprocessEvent(t){if(!Nn.navigator&&!Nn.location&&!Nn.document)return;const e=t.request&&t.request.url||Nn.location&&Nn.location.href,{referrer:n}=Nn.document||{},{userAgent:r}=Nn.navigator||{},i={...t.request&&t.request.headers,...n&&{Referer:n},...r&&{"User-Agent":r}},o={...t.request,...e&&{url:e},headers:i};t.request=o}});xn(Or,Er);const Mr="LinkedErrors",Pr=(t={})=>{const e=t.limit||5,n=t.key||"cause";return{name:Mr,setupOnce(){},preprocessEvent(t,r,i){const o=i.getOptions();F(Wn,o.stackParser,o.maxValueLength,n,e,t,r)}}};xn(Mr,Pr);const Ar=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],Dr="TryCatch",Ir=(t={})=>{const e={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,...t};return{name:Dr,setupOnce(){e.setTimeout&&ot(Nn,"setTimeout",Rr),e.setInterval&&ot(Nn,"setInterval",Rr),e.requestAnimationFrame&&ot(Nn,"requestAnimationFrame",zr),e.XMLHttpRequest&&"XMLHttpRequest"in Nn&&ot(XMLHttpRequest.prototype,"send",Lr);const t=e.eventTarget;t&&(Array.isArray(t)?t:Ar).forEach(Fr)}}};function Rr(t){return function(...e){const n=e[0];return e[0]=$n(n,{mechanism:{data:{function:yt(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function zr(t){return function(e){return t.apply(this,[$n(e,{mechanism:{data:{function:"requestAnimationFrame",handler:yt(t)},handled:!1,type:"instrument"}})])}}function Lr(t){return function(...e){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(t=>{t in n&&"function"==typeof n[t]&&ot(n,t,function(e){const n={mechanism:{data:{function:t,handler:yt(e)},handled:!1,type:"instrument"}},r=lt(e);return r&&(n.mechanism.data.handler=yt(r)),$n(e,n)})}),t.apply(this,e)}}function Fr(t){const e=Nn,n=e[t]&&e[t].prototype;!n||!n.hasOwnProperty||!n.hasOwnProperty("addEventListener")||(ot(n,"addEventListener",function(e){return function(n,r,i){try{"function"==typeof r.handleEvent&&(r.handleEvent=$n(r.handleEvent,{mechanism:{data:{function:"handleEvent",handler:yt(r),target:t},handled:!1,type:"instrument"}}))}catch{}return e.apply(this,[n,$n(r,{mechanism:{data:{function:"addEventListener",handler:yt(r),target:t},handled:!1,type:"instrument"}}),i])}}),ot(n,"removeEventListener",function(t){return function(e,n,r){const i=n;try{const n=i&&i.__sentry_wrapped__;n&&t.call(this,e,n,r)}catch{}return t.call(this,e,i,r)}}))}xn(Dr,Ir);const Nr=[Dn(),Fn(),Ir(),mr(),Sr(),Pr(),br(),Er()];function Br(t={}){void 0===t.defaultIntegrations&&(t.defaultIntegrations=[...Nr]),void 0===t.release&&("string"==typeof __SENTRY_RELEASE__&&(t.release=__SENTRY_RELEASE__),Nn.SENTRY_RELEASE&&Nn.SENTRY_RELEASE.id&&(t.release=Nn.SENTRY_RELEASE.id)),void 0===t.autoSessionTracking&&(t.autoSessionTracking=!0),void 0===t.sendClientReports&&(t.sendClientReports=!0);const e={...t,stackParser:vt(t.stackParser||dr),integrations:vn(t),transport:t.transport||(Bt()?tr:er)};Tn(Jn,e),t.autoSessionTracking&&function(){if(typeof Nn.document>"u")return void(Hn&&Q.warn("Session tracking in non-browser environment with @sentry/browser is not supported."));We({ignoreDuration:!0}),Ye(),Jt(({from:t,to:e})=>{void 0!==t&&t!==e&&(We({ignoreDuration:!0}),Ye())})}()}var Vr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof n.g<"u"?n.g:typeof self<"u"?self:{};function $r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Hr(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var n=function t(){return this instanceof t?Reflect.construct(e,arguments,this.constructor):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 Wr=(t=>(t.INLINE="inline",t.OVERLAY="overlay",t))(Wr||{}),Ur=(t=>(t.TOP="top",t.BOTTOM="bottom",t.HIDDEN="",t))(Ur||{});function Xr(t,e){return{...e,message:t}}const Yr=[{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}],Gr={emoticons:Xr("Emoticons"),doodles:Xr("Doodles"),landmarks:Xr("Landmarks"),bubbles:Xr("Bubbles"),transportation:Xr("Transportation"),beach:Xr("Beach")},qr={fill:"#1565C0",opacity:1,backgroundColor:null,strokeWidth:.05,stroke:"#000"},Kr=[1,8,15,20,25];var Zr=(t=>(t.DARK="dark",t.LIGHT="light",t))(Zr||{});const Jr=[{name:Zr.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:Zr.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 Qr=(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))(Qr||{});function ti(t){var e,n,r="";if("string"==typeof t||"number"==typeof t)r+=t;else if("object"==typeof t)if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(n=ti(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function ei(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=ti(t))&&(r&&(r+=" "),r+=e);return r}const ni=(0,i.forwardRef)((t,e)=>{const{attr:n,size:i,title:o,className:s,color:a,style:l,children:c,viewBox:u,width:h,height:d,...p}=t;return(0,r.jsxs)("svg",{"aria-hidden":!o,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:u||"0 0 24 24",...n,...p,className:ei("svg-icon",s,ri(i)),style:{color:a,...l},ref:e,height:d||"1em",width:h||"1em",children:[o&&(0,r.jsx)("title",{children:o}),c]})});function ri(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 t}}function ii(t,e="",n){return i.memo(i.forwardRef((i,o)=>(0,r.jsx)(ni,{"data-testid":`${e}Icon`,ref:o,viewBox:n,...i,size:i.size||"md",children:t})))}function oi(t,e=""){return ii(si(t),e)}function si(t){return(null==t?void 0:t.map)&&t.map((t,e)=>i.createElement(t.tag,{key:e,...t.attr},si(t.child)))}const ai=ii((0,r.jsx)("path",{d:"M3 17v2h6v-2H3zM3 5v2h10V5H3zm10 16v-2h8v-2h-8v-2h-2v6h2zM7 9v2H3v2h4v2h2V9H7zm14 4v-2H11v2h10zm-6-4h2V7h4V5h-4V3h-2v6z"}),"TuneOutlined"),li=ii((0,r.jsx)("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"),ci=ii((0,r.jsx)("path",{d:"M17 15h2V7c0-1.1-.9-2-2-2H9v2h8v8zM7 17V1H5v4H1v2h4v10c0 1.1.9 2 2 2h10v4h2v-4h4v-2H7z"}),"CropOutlined"),ui=ii((0,r.jsx)("path",{d:"M2.5 4v3h5v12h3V7h5V4h-13zm19 5h-9v3h3v7h3v-7h3V9z"}),"TextFieldsOutlined"),hi=ii((0,r.jsx)("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"),di=ii((0,r.jsx)("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"),pi=ii((0,r.jsx)("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"),fi=ii((0,r.jsx)("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"),gi=ii((0,r.jsx)("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"),mi=ii((0,r.jsx)("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"),vi=ii((0,r.jsx)("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"),bi=ii([(0,r.jsx)("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"),(0,r.jsx)("circle",{cx:"11",cy:"9",r:"1"},"1"),(0,r.jsx)("path",{d:"M5.88 19.75c0 1.1.9 2 2 2h1.45l-3.45-8.34v6.34z"},"2")],"StyleOutlined"),yi=ii((0,r.jsx)("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"),xi=ii((0,r.jsx)("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"),wi=ii((0,r.jsx)("path",{d:"m12 5.69 5 4.5V18h-2v-6H9v6H7v-7.81l5-4.5M12 3 2 12h3v8h6v-6h2v6h6v-8h3L12 3z"}),"HomeOutlined"),_i={[Qr.FILTER]:{name:Xr("Applied Filters"),icon:ai},[Qr.RESIZE]:{name:Xr("Resized Image"),icon:li},[Qr.CROP]:{name:Xr("Cropped Image"),icon:ci},[Qr.DRAW]:{name:Xr("Added Drawing"),icon:xi},[Qr.TEXT]:{name:Xr("Added Text"),icon:ui},[Qr.SHAPES]:{name:Xr("Added Shape"),icon:hi},[Qr.STICKERS]:{name:Xr("Added Sticker"),icon:di},[Qr.FRAME]:{name:Xr("Added Frame"),icon:pi},[Qr.MERGE]:{name:Xr("Merged Objects"),icon:fi},[Qr.CORNERS]:{name:Xr("Rounded Corner"),icon:gi},bgImage:{name:Xr("Replaced Background Image"),icon:mi},overlayImage:{name:Xr("Added Image"),icon:mi},initial:{name:Xr("Initial"),icon:wi},loadedState:{name:Xr("Loaded State"),icon:vi},objectStyle:{name:Xr("Changed Style"),icon:bi},deletedObject:{name:Xr("Deleted object"),icon:yi}},Ci=Object.values(Qr).map(t=>({name:t,icon:_i[t].icon,action:t===Qr.MERGE?t=>{t.tools.merge.apply()}:t})),Si={filter:Xr("filter"),resize:Xr("resize"),crop:Xr("crop"),draw:Xr("draw"),text:Xr("text"),shapes:Xr("shapes"),stickers:Xr("stickers"),frame:Xr("frame"),corners:Xr("corners"),merge:Xr("merge")},ki=ii((0,r.jsx)("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"),Ti="3.0.5",ji={selector:"pixie-editor",textureSize:4096,activeLanguage:"en",ui:{visible:!0,mode:Wr.INLINE,forceOverlayModeOnMobile:!0,activeTheme:Zr.LIGHT,themes:Jr,allowEditorClose:!0,menubar:{items:[{type:"undoWidget",align:"left"},{type:"zoomWidget",align:"center",desktopOnly:!0},{type:"button",icon:vi,align:"right",desktopOnly:!0,action:t=>{t.togglePanel("history")}},{type:"button",icon:ki,label:Xr("Done"),align:"right",action:t=>{var e;null!=(e=t.state.config.ui)&&e.showExportPanel?t.state.togglePanel("export",!0):t.tools.export.save()}}]},nav:{position:Ur.BOTTOM,items:[...Ci]},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:{...qr},sticker:{fill:void 0},text:{textAlign:"initial",underline:!1,linethrough:!1,fontStyle:"normal",fontFamily:"Times New Roman",fontWeight:"normal",stroke:void 0,fontSize:40}},tools:{filter:{items:["grayscale","blackWhite","sharpen","invert","vintage","polaroid","kodachrome","technicolor","brownie","sepia","removeColor","brightness","gamma","noise","pixelate","blur","emboss","blendColor"]},zoom:{allowUserZoom:!0,fitImageToScreen:!0},crop:{allowCustomRatio:!0,defaultRatio:"1:1",presets:[{ratio:null,name:"Custom"},{ratio:"1:1",name:"Square"},{ratio:"4:3"},{ratio:"16:9"},{ratio:"5:3"},{ratio:"5:4"},{ratio:"6:4"},{ratio:"7:5"},{ratio:"10:8"}]},text:{defaultText:"Double click to edit",controlsPadding:6,items:[{family:"Roboto",src:"fonts/open-sans-v27-latin-ext_latin-regular.woff2"},{family:"Fuzzy Bubbles",src:"fonts/fuzzy-bubbles-v3-latin-700.woff2",descriptors:{weight:"700"}},{family:"Aleo Bold",src:"fonts/aleo-v4-latin-ext_latin-700.woff2",descriptors:{weight:"700"}},{family:"Amatic SC",src:"fonts/amatic-sc-v16-latin-ext_latin-regular.woff2"},{family:"Corinthia Bold",src:"fonts/corinthia-v7-latin-ext_latin-700.woff2"},{family:"Bungee Inline",src:"fonts/bungee-inline-v6-latin-ext_latin-regular.woff2"},{family:"Robot Slab Bold",src:"fonts/roboto-slab-v16-latin-ext_latin-500.woff2"},{family:"Carter One",src:"fonts/carter-one-v12-latin-regular.woff2"},{family:"Cody Star",src:"fonts/codystar-v10-latin-ext_latin-regular.woff2"},{family:"Fira Sans",src:"fonts/fira-sans-v11-latin-ext_latin_cyrillic-regular.woff2"},{family:"Krona One",src:"fonts/krona-one-v9-latin-ext_latin-regular.woff2"},{family:"Kumar One Outline",src:"fonts/kumar-one-outline-v8-latin-ext_latin-regular.woff2"},{family:"Lobster Two",src:"fonts/lobster-two-v13-latin-regular.woff2"},{family:"Molle Italic",src:"fonts/molle-v11-latin-ext_latin-italic.woff2"},{family:"Monoton",src:"fonts/monoton-v10-latin-regular.woff2"},{family:"Nixie One",src:"fonts/nixie-one-v11-latin-regular.woff2"},{family:"Permanent Marker",src:"fonts/permanent-marker-v10-latin-regular.woff2"},{family:"Sancreek",src:"fonts/sancreek-v13-latin-ext_latin-regular.woff2"},{family:"Stint Ultra Expanded",src:"fonts/stint-ultra-expanded-v10-latin-regular.woff2"},{family:"VT323",src:"fonts/vt323-v12-latin-ext_latin-regular.woff2"},{family:"Trash Hand",src:"fonts/TrashHand.ttf"}]},draw:{brushSizes:Kr,brushTypes:["PencilBrush","EraserBrush","SprayBrush","CircleBrush","DiamondBrush","VLineBrush","HLineBrush","SquareBrush"]},shapes:{items:[{name:"circle",type:"Circle"},{name:"square",type:"Rect",options:{lockUniScaling:!1}},{name:"triangle",type:"Triangle"},{name:"ellipse",type:"Ellipse",options:{lockUniScaling:!1}},{name:"Arrow #1",type:"Path",options:{path:"M 294.9 16.4 l 15.7 42.2 c -171.4 70.3 -294 242.3 -289.1 437.4 l 14.7 -1 c 9.1 -0.6 18.1 -1.2 27.1 -1.9 l 14.7 -1 c -4.3 -170.1 102.5 -320 252 -381.3 l 15.7 42.2 c 34.7 -40.5 83.1 -76.6 144.8 -99.8 c -58.1 -26.2 -124.9 -39.6 -195.6 -36.8 z"}},{name:"Arrow #2",type:"Path",options:{path:"M 16 248.4 v 14.9 h 447.5 l -93.2 82.5 l 11.9 10.5 l 113.8 -100.2 l -113.6 -100.4 l -11.8 10.5 l 92.9 82.2 z"}},{name:"Arrow #3",type:"Path",options:{path:"M 496 256 l -118.6 -66 v 40.8 h -361.4 v 50.4 h 361.4 v 40.8 l 118.6 -66 z"}},{name:"Line",type:"Path",options:{path:"M 16 256 h 480",strokeWidth:10,stroke:"#000",padding:10}},{name:"Star",type:"Path",options:{path:"M 256 406.3 l 148.3 78 l -28.3 -165.2 l 120 -117 l -165.8 -24.1 l -74.2 -150.3 l -74.2 150.3 l -165.8 24.1 l 120 117 l -28.3 165.2 z"}},{name:"Polygon",type:"Path",options:{path:"M 256 19.6 l 156.6 57.1 l 83.4 144.3 l -28.9 164.2 l -127.7 107.2 h -166.8 l -127.7 -107.2 l -28.9 -164.2 l 83.4 -144.3 z"}},{name:"Badge",type:"Path",options:{path:"M 257.3 16.2 s -148 58.2 -204.4 81.4 c 0 75.7 -16.8 303.5 204.4 398.2 c 218.7 -94.6 201.9 -322.4 201.9 -398.2 c -62.1 -23.6 -201.9 -81.4 -201.9 -81.4 z"}}].slice()},stickers:{items:Yr},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}}]}}},Oi=t=>{let e;const n=new Set,r=(t,r)=>{const i="function"==typeof t?t(e):t;if(!Object.is(i,e)){const t=e;e=r??("object"!=typeof i||null===i)?i:Object.assign({},e,i),n.forEach(n=>n(e,t))}},i=()=>e,o={setState:r,getState:i,getInitialState:()=>s,subscribe:t=>(n.add(t),()=>n.delete(t)),destroy:()=>{n.clear()}},s=e=t(r,i,o);return o};var Ei={exports:{}},Mi={},Pi={exports:{}},Ai={},Di=i;var Ii="function"==typeof Object.is?Object.is:function(t,e){return t===e&&(0!==t||1/t===1/e)||t!==t&&e!==e},Ri=Di.useState,zi=Di.useEffect,Li=Di.useLayoutEffect,Fi=Di.useDebugValue;function Ni(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!Ii(t,n)}catch{return!0}}var Bi=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?function(t,e){return e()}:function(t,e){var n=e(),r=Ri({inst:{value:n,getSnapshot:e}}),i=r[0].inst,o=r[1];return Li(function(){i.value=n,i.getSnapshot=e,Ni(i)&&o({inst:i})},[t,n,e]),zi(function(){return Ni(i)&&o({inst:i}),t(function(){Ni(i)&&o({inst:i})})},[t]),Fi(n),n};Ai.useSyncExternalStore=void 0!==Di.useSyncExternalStore?Di.useSyncExternalStore:Bi,Pi.exports=Ai;var Vi=Pi.exports,$i=i,Hi=Vi;var Wi="function"==typeof Object.is?Object.is:function(t,e){return t===e&&(0!==t||1/t===1/e)||t!==t&&e!==e},Ui=Hi.useSyncExternalStore,Xi=$i.useRef,Yi=$i.useEffect,Gi=$i.useMemo,qi=$i.useDebugValue;Mi.useSyncExternalStoreWithSelector=function(t,e,n,r,i){var o=Xi(null);if(null===o.current){var s={hasValue:!1,value:null};o.current=s}else s=o.current;o=Gi(function(){function t(t){if(!l){if(l=!0,o=t,t=r(t),void 0!==i&&s.hasValue){var e=s.value;if(i(e,t))return a=e}return a=t}if(e=a,Wi(o,t))return e;var n=r(t);return void 0!==i&&i(e,n)?e:(o=t,a=n)}var o,a,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 a=Ui(t,o[0],o[1]);return Yi(function(){s.hasValue=!0,s.value=a},[a]),qi(a),a},Ei.exports=Mi;const Ki=$r(Ei.exports),{useDebugValue:Zi}=i,{useSyncExternalStoreWithSelector:Ji}=Ki,Qi=t=>t;const to=t=>{const e="function"==typeof t?(t=>t?Oi(t):Oi)(t):t,n=(t,n)=>function(t,e=Qi,n){const r=Ji(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return Zi(r),r}(e,t,n);return Object.assign(n,e),n},eo=t=>t?to(t):to,no=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 s=t(r.getState());o=n=>{const r=t(n);if(!i(s,r)){const t=s;e(s=r,t)}},null!=n&&n.fireImmediately&&e(s,s)}return i(o)},t(e,n,r)};var ro=Symbol.for("immer-nothing"),io=Symbol.for("immer-draftable"),oo=Symbol.for("immer-state");function so(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var ao=Object.getPrototypeOf;function lo(t){return!!t&&!!t[oo]}function co(t){var e;return!!t&&(ho(t)||Array.isArray(t)||!!t[io]||!(null==(e=t.constructor)||!e[io])||vo(t)||bo(t))}var uo=Object.prototype.constructor.toString();function ho(t){if(!t||"object"!=typeof t)return!1;const e=ao(t);if(null===e)return!0;const n=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===uo}function po(t,e){0===fo(t)?Reflect.ownKeys(t).forEach(n=>{e(n,t[n],t)}):t.forEach((n,r)=>e(r,n,t))}function fo(t){const e=t[oo];return e?e.type_:Array.isArray(t)?1:vo(t)?2:bo(t)?3:0}function go(t,e){return 2===fo(t)?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function mo(t,e,n){const r=fo(t);2===r?t.set(e,n):3===r?t.add(n):t[e]=n}function vo(t){return t instanceof Map}function bo(t){return t instanceof Set}function yo(t){return t.copy_||t.base_}function xo(t,e){if(vo(t))return new Map(t);if(bo(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=ho(t);if(!0===e||"class_only"===e&&!n){const e=Object.getOwnPropertyDescriptors(t);delete e[oo];let n=Reflect.ownKeys(e);for(let r=0;r<n.length;r++){const 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(ao(t),e)}{const e=ao(t);if(null!==e&&n)return{...t};const r=Object.create(e);return Object.assign(r,t)}}function wo(t,e=!1){return Co(t)||lo(t)||!co(t)||(fo(t)>1&&(t.set=t.add=t.clear=t.delete=_o),Object.freeze(t),e&&Object.entries(t).forEach(([t,e])=>wo(e,!0))),t}function _o(){so(2)}function Co(t){return Object.isFrozen(t)}var So,ko={};function To(t){const e=ko[t];return e||so(0),e}function jo(){return So}function Oo(t,e){e&&(To("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function Eo(t){Mo(t),t.drafts_.forEach(Ao),t.drafts_=null}function Mo(t){t===So&&(So=t.parent_)}function Po(t){return So=function(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}(So,t)}function Ao(t){const e=t[oo];0===e.type_||1===e.type_?e.revoke_():e.revoked_=!0}function Do(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return void 0!==t&&t!==n?(n[oo].modified_&&(Eo(e),so(4)),co(t)&&(t=Io(e,t),e.parent_||zo(e,t)),e.patches_&&To("Patches").generateReplacementPatches_(n[oo].base_,t,e.patches_,e.inversePatches_)):t=Io(e,n,[]),Eo(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==ro?t:void 0}function Io(t,e,n){if(Co(e))return e;const r=e[oo];if(!r)return po(e,(i,o)=>Ro(t,r,e,i,o,n)),e;if(r.scope_!==t)return e;if(!r.modified_)return zo(t,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const e=r.copy_;let i=e,o=!1;3===r.type_&&(i=new Set(e),e.clear(),o=!0),po(i,(i,s)=>Ro(t,r,e,i,s,n,o)),zo(t,e,!1),n&&t.patches_&&To("Patches").generatePatches_(r,n,t.patches_,t.inversePatches_)}return r.copy_}function Ro(t,e,n,r,i,o,s){if(lo(i)){const s=Io(t,i,o&&e&&3!==e.type_&&!go(e.assigned_,r)?o.concat(r):void 0);if(mo(n,r,s),!lo(s))return;t.canAutoFreeze_=!1}else s&&n.add(i);if(co(i)&&!Co(i)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;Io(t,i),(!e||!e.scope_.parent_)&&"symbol"!=typeof r&&Object.prototype.propertyIsEnumerable.call(n,r)&&zo(t,i)}}function zo(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&wo(e,n)}var Lo={get(t,e){if(e===oo)return t;const n=yo(t);if(!go(n,e))return function(t,e,n){var r;const i=Bo(e,n);return i?"value"in i?i.value:null==(r=i.get)?void 0:r.call(t.draft_):void 0}(t,n,e);const r=n[e];return t.finalized_||!co(r)?r:r===No(t.base_,e)?($o(t),t.copy_[e]=Ho(r,t)):r},has:(t,e)=>e in yo(t),ownKeys:t=>Reflect.ownKeys(yo(t)),set(t,e,n){const r=Bo(yo(t),e);if(null!=r&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const r=No(yo(t),e),i=null==r?void 0:r[oo];if(i&&i.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(function(t,e){return t===e?0!==t||1/t===1/e:t!==t&&e!==e}(n,r)&&(void 0!==n||go(t.base_,e)))return!0;$o(t),Vo(t)}return t.copy_[e]===n&&(void 0!==n||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_[e]=!0),!0},deleteProperty:(t,e)=>(void 0!==No(t.base_,e)||e in t.base_?(t.assigned_[e]=!1,$o(t),Vo(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0),getOwnPropertyDescriptor(t,e){const n=yo(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{writable:!0,configurable:1!==t.type_||"length"!==e,enumerable:r.enumerable,value:n[e]}},defineProperty(){so(11)},getPrototypeOf:t=>ao(t.base_),setPrototypeOf(){so(12)}},Fo={};function No(t,e){const n=t[oo];return(n?yo(n):t)[e]}function Bo(t,e){if(!(e in t))return;let n=ao(t);for(;n;){const t=Object.getOwnPropertyDescriptor(n,e);if(t)return t;n=ao(n)}}function Vo(t){t.modified_||(t.modified_=!0,t.parent_&&Vo(t.parent_))}function $o(t){t.copy_||(t.copy_=xo(t.base_,t.scope_.immer_.useStrictShallowCopy_))}po(Lo,(t,e)=>{Fo[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}}),Fo.deleteProperty=function(t,e){return Fo.set.call(this,t,e,void 0)},Fo.set=function(t,e,n){return Lo.set.call(this,t[0],e,n,t[0])};function Ho(t,e){const n=vo(t)?To("MapSet").proxyMap_(t,e):bo(t)?To("MapSet").proxySet_(t,e):function(t,e){const n=Array.isArray(t),r={type_:n?1:0,scope_:e?e.scope_:jo(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,o=Lo;n&&(i=[r],o=Fo);const{revoke:s,proxy:a}=Proxy.revocable(i,o);return r.draft_=a,r.revoke_=s,a}(t,e);return(e?e.scope_:jo()).drafts_.push(n),n}function Wo(t){if(!co(t)||Co(t))return t;const e=t[oo];let n;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=xo(t,e.scope_.immer_.useStrictShallowCopy_)}else n=xo(t,!0);return po(n,(t,e)=>{mo(n,t,Wo(e))}),e&&(e.finalized_=!1),n}var Uo=new class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,e,n)=>{if("function"==typeof t&&"function"!=typeof e){const n=e;e=t;const r=this;return function(t=n,...i){return r.produce(t,t=>e.call(this,t,...i))}}let r;if("function"!=typeof e&&so(6),void 0!==n&&"function"!=typeof n&&so(7),co(t)){const i=Po(this),o=Ho(t,void 0);let s=!0;try{r=e(o),s=!1}finally{s?Eo(i):Mo(i)}return Oo(i,n),Do(r,i)}if(!t||"object"!=typeof t){if(r=e(t),void 0===r&&(r=t),r===ro&&(r=void 0),this.autoFreeze_&&wo(r,!0),n){const e=[],i=[];To("Patches").generateReplacementPatches_(t,r,e,i),n(e,i)}return r}so(1)},this.produceWithPatches=(t,e)=>{if("function"==typeof t)return(e,...n)=>this.produceWithPatches(e,e=>t(e,...n));let n,r;return[this.produce(t,e,(t,e)=>{n=t,r=e}),n,r]},"boolean"==typeof(null==t?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),"boolean"==typeof(null==t?void 0:t.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){co(t)||so(8),lo(t)&&(t=function(t){return lo(t)||so(10),Wo(t)}(t));const e=Po(this),n=Ho(t,void 0);return n[oo].isManual_=!0,Mo(e),n}finishDraft(t,e){const n=t&&t[oo];(!n||!n.isManual_)&&so(9);const{scope_:r}=n;return Oo(r,e),Do(void 0,r)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,e){let n;for(n=e.length-1;n>=0;n--){const r=e[n];if(0===r.path.length&&"replace"===r.op){t=r.value;break}}n>-1&&(e=e.slice(n+1));const r=To("Patches").applyPatches_;return lo(t)?r(t,e):this.produce(t,t=>r(t,e))}},Xo=Uo.produce;Uo.produceWithPatches.bind(Uo),Uo.setAutoFreeze.bind(Uo),Uo.setUseStrictShallowCopy.bind(Uo),Uo.applyPatches.bind(Uo),Uo.createDraft.bind(Uo),Uo.finishDraft.bind(Uo);var Yo=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===Go}(t)}(t);var e};var Go="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function qo(t,e){return!1!==e.clone&&e.isMergeableObject(t)?ts(function(t){return Array.isArray(t)?[]:{}}(t),t,e):t}function Ko(t,e,n){return t.concat(e).map(function(t){return qo(t,n)})}function Zo(t){return Object.keys(t).concat(function(t){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t).filter(function(e){return Object.propertyIsEnumerable.call(t,e)}):[]}(t))}function Jo(t,e){try{return e in t}catch{return!1}}function Qo(t,e,n){var r={};return n.isMergeableObject(t)&&Zo(t).forEach(function(e){r[e]=qo(t[e],n)}),Zo(e).forEach(function(i){(function(t,e){return Jo(t,e)&&!(Object.hasOwnProperty.call(t,e)&&Object.propertyIsEnumerable.call(t,e))})(t,i)||(Jo(t,i)&&n.isMergeableObject(e[i])?r[i]=function(t,e){if(!e.customMerge)return ts;var n=e.customMerge(t);return"function"==typeof n?n:ts}(i,n)(t[i],e[i],n):r[i]=qo(e[i],n))}),r}function ts(t,e,n){(n=n||{}).arrayMerge=n.arrayMerge||Ko,n.isMergeableObject=n.isMergeableObject||Yo,n.cloneUnlessOtherwiseSpecified=qo;var r=Array.isArray(e);return r===Array.isArray(t)?r?n.arrayMerge(t,e,n):Qo(t,e,n):qo(e,n)}ts.all=function(t,e){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(t,n){return ts(t,n,e)},{})};const es=$r(ts);function ns(t,e){return rs(es(e,t),t)}function rs(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]&&rs(t[n],null==e?void 0:e[n])}),t}const is=(t,e)=>({history:{...os,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:n=>{t({history:{...e().history,...n??os}})}}}),os={items:[],pointer:0,canUndo:!1,canRedo:!1};var ss=(t=>(t.Filter="filter",t.Frame="frame",t.ActiveObject="activeObj",t.Text="text",t))(ss||{});const as=(t,e)=>({filter:{...ls,select(e,n=!1){t(t=>{t.filter.selected=e,t.activeToolOverlay=n?ss.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,...ls}})}}}),ls={selected:null,applied:[]},cs=(t,e)=>({crop:{...us,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,...us}})}}}),us={zoneRect:null,selectedAspectRatio:null,straightenAngle:0};function hs(t){return"i-text"===(null==t?void 0:t.type)}var ds=(t=>(t.Text="text",t.Shape="shape",t.Sticker="sticker",t.Drawing="drawing",t.Image="image",t.MainImage="mainImage",t.StraightenAnchor="straightenHelper",t))(ds||{});const ps={text:{name:Xr("Text"),icon:_i.text.icon},shape:{name:Xr("Shape"),icon:_i.shapes.icon},sticker:{name:Xr("Sticker"),icon:_i.stickers.icon},drawing:{name:Xr("Drawing"),icon:_i.draw.icon},image:{name:Xr("Image"),icon:_i.overlayImage.icon},mainImage:{name:Xr("Background Image"),icon:_i.bgImage.icon}};const fs={isMoving:!1,editableProps:{},id:null,isText:!1,isImage:!1,name:null};const gs=(t,e)=>({objects:{...ms,setActiveIsMoving:e=>{t(t=>{t.objects.active.isMoving=e})},setIsEditingText:e=>{t(t=>{t.objects.isEditingText=e})},setActive:n=>{t(n?t=>{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}),hs(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=n.name??null,t.objects.active.isText=hs(n),t.objects.active.isImage=function(t){return t.name===ds.Image}(n)}:t=>{var n,r,i,o,s;const a={...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==(s=null==(o=e().config.objectDefaults)?void 0:o.text)?void 0:s.fontSize};t.objects.active={...fs,editableProps:a}})},reset(){t({objects:{...e().objects,...ms}})}}}),ms={all:[],isEditingText:!1,active:fs},vs=(t,e)=>({frame:{...bs,select:n=>{t(t=>{t.frame.active=n}),e().frame.showOptionsPanel()},deselect:()=>{t(t=>{t.frame.active=null,t.activeToolOverlay=null})},showOptionsPanel:()=>{e().activeTool===Qr.FRAME&&t(t=>{t.activeToolOverlay=ss.Frame})},reset(){t({frame:{...e().frame,...bs}})}}}),bs={active:null},ys=(t,e)=>({resize:{...xs,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,...xs}})}}}),xs={formValue:{width:1,height:1,maintainAspect:!0,usePercentages:!1}},ws=(t,e)=>({corners:{..._s,setRadius:e=>{t(t=>{t.corners.radius=e})},apply:()=>e().editor.tools.corners.apply(e().corners.radius),reset(){t({corners:{...e().corners,..._s}})}}}),_s={radius:50},Cs=t=>(e,n,r)=>(r.setState=(t,n,...r)=>{const i="function"==typeof t?Xo(t):t;return e(i,n,...r)},t(r.setState,n,r));var Ss={exports:{}},ks={exports:{}},Ts=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))},js=Array.prototype.concat,Os=Array.prototype.slice,Es=ks.exports=function(t){for(var e=[],n=0,r=t.length;n<r;n++){var i=t[n];Ts(i)?e=js.call(e,Os.call(i)):e.push(i)}return e};Es.wrap=function(t){return function(){return t(Es(arguments))}};var Ms=ks.exports,Ps={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]},As=Ms,Ds=Object.hasOwnProperty,Is=Object.create(null);for(var Rs in Ps)Ds.call(Ps,Rs)&&(Is[Ps[Rs]]=Rs);var zs=Ss.exports={to:{},get:{}};function Ls(t,e,n){return Math.min(Math.max(e,t),n)}function Fs(t){var e=Math.round(t).toString(16).toUpperCase();return e.length<2?"0"+e:e}zs.get=function(t){var e,n;switch(t.substring(0,3).toLowerCase()){case"hsl":e=zs.get.hsl(t),n="hsl";break;case"hwb":e=zs.get.hwb(t),n="hwb";break;default:e=zs.get.rgb(t),n="rgb"}return e?{model:n,value:e}:null},zs.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]:Ds.call(Ps,e[1])?((i=Ps[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]=Ls(i[n],0,255);return i[3]=Ls(i[3],0,1),i},zs.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,Ls(parseFloat(e[2]),0,100),Ls(parseFloat(e[3]),0,100),Ls(isNaN(n)?1:n,0,1)]}return null},zs.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,Ls(parseFloat(e[2]),0,100),Ls(parseFloat(e[3]),0,100),Ls(isNaN(n)?1:n,0,1)]}return null},zs.to.hex=function(){var t=As(arguments);return"#"+Fs(t[0])+Fs(t[1])+Fs(t[2])+(t[3]<1?Fs(Math.round(255*t[3])):"")},zs.to.rgb=function(){var t=As(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]+")"},zs.to.rgb.percent=function(){var t=As(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]+")"},zs.to.hsl=function(){var t=As(arguments);return t.length<4||1===t[3]?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"},zs.to.hwb=function(){var t=As(arguments),e="";return t.length>=4&&1!==t[3]&&(e=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+e+")"},zs.to.keyword=function(t){return Is[t.slice(0,3)]};var Ns=Ss.exports;const Bs={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]},Vs={};for(const Ak of Object.keys(Bs))Vs[Bs[Ak]]=Ak;const $s={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 Hs=$s;for(const Ak of Object.keys($s)){if(!("channels"in $s[Ak]))throw new Error("missing channels property: "+Ak);if(!("labels"in $s[Ak]))throw new Error("missing channel labels property: "+Ak);if($s[Ak].labels.length!==$s[Ak].channels)throw new Error("channel and label counts mismatch: "+Ak);const{channels:t,labels:e}=$s[Ak];delete $s[Ak].channels,delete $s[Ak].labels,Object.defineProperty($s[Ak],"channels",{value:t}),Object.defineProperty($s[Ak],"labels",{value:e})}function Ws(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}$s.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),s=o-i;let a,l;o===i?a=0:e===o?a=(n-r)/s:n===o?a=2+(r-e)/s:r===o&&(a=4+(e-n)/s),a=Math.min(60*a,360),a<0&&(a+=360);const c=(i+o)/2;return l=o===i?0:c<=.5?s/(o+i):s/(2-o-i),[a,100*l,100*c]},$s.rgb.hsv=function(t){let e,n,r,i,o;const s=t[0]/255,a=t[1]/255,l=t[2]/255,c=Math.max(s,a,l),u=c-Math.min(s,a,l),h=function(t){return(c-t)/6/u+.5};return 0===u?(i=0,o=0):(o=u/c,e=h(s),n=h(a),r=h(l),s===c?i=r-n:a===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]},$s.rgb.hwb=function(t){const e=t[0],n=t[1];let r=t[2];const i=$s.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]},$s.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]},$s.rgb.keyword=function(t){const e=Vs[t];if(e)return e;let n,r=1/0;for(const i of Object.keys(Bs)){const e=Ws(t,Bs[i]);e<r&&(r=e,n=i)}return n},$s.keyword.rgb=function(t){return Bs[t]},$s.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)]},$s.rgb.lab=function(t){const e=$s.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)]},$s.hsl.rgb=function(t){const e=t[0]/360,n=t[1]/100,r=t[2]/100;let i,o,s;if(0===n)return s=255*r,[s,s,s];i=r<.5?r*(1+n):r+n-r*n;const a=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--,s=6*o<1?a+6*(i-a)*o:2*o<1?i:3*o<2?a+(i-a)*(2/3-o)*6:a,l[c]=255*s;return l},$s.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)]},$s.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),s=255*r*(1-n),a=255*r*(1-n*o),l=255*r*(1-n*(1-o));switch(r*=255,i){case 0:return[r,l,s];case 1:return[a,r,s];case 2:return[s,r,l];case 3:return[s,a,r];case 4:return[l,s,r];case 5:return[r,s,a]}},$s.hsv.hsl=function(t){const e=t[0],n=t[1]/100,r=t[2]/100,i=Math.max(r,.01);let o,s;s=(2-n)*r;const a=(2-n)*i;return o=n*i,o/=a<=1?a:2-a,o=o||0,s/=2,[e,100*o,100*s]},$s.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 s=Math.floor(6*e),a=1-r;o=6*e-s,1&s&&(o=1-o);const l=n+o*(a-n);let c,u,h;switch(s){default:case 6:case 0:c=a,u=l,h=n;break;case 1:c=l,u=a,h=n;break;case 2:c=n,u=a,h=l;break;case 3:c=n,u=l,h=a;break;case 4:c=l,u=n,h=a;break;case 5:c=a,u=n,h=l}return[255*c,255*u,255*h]},$s.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))]},$s.xyz.rgb=function(t){const e=t[0]/100,n=t[1]/100,r=t[2]/100;let i,o,s;return i=3.2406*e+-1.5372*n+-.4986*r,o=-.9689*e+1.8758*n+.0415*r,s=.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,s=s>.0031308?1.055*s**(1/2.4)-.055:12.92*s,i=Math.min(Math.max(0,i),1),o=Math.min(Math.max(0,o),1),s=Math.min(Math.max(0,s),1),[255*i,255*o,255*s]},$s.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)]},$s.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,s=r**3;return n=i>.008856?i:(n-16/116)/7.787,e=o>.008856?o:(e-16/116)/7.787,r=s>.008856?s:(r-16/116)/7.787,e*=95.047,n*=100,r*=108.883,[e,n,r]},$s.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]},$s.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)]},$s.rgb.ansi16=function(t,e=null){const[n,r,i]=t;let o=null===e?$s.rgb.hsv(t)[2]:e;if(o=Math.round(o/50),0===o)return 30;let s=30+(Math.round(i/255)<<2|Math.round(r/255)<<1|Math.round(n/255));return 2===o&&(s+=60),s},$s.hsv.ansi16=function(t){return $s.rgb.ansi16($s.hsv.rgb(t),t[2])},$s.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)},$s.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]},$s.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]},$s.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},$s.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]},$s.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),s=i-o;let a,l;return a=s<1?o/(1-s):0,l=s<=0?0:i===e?(n-r)/s%6:i===n?2+(r-e)/s:4+(e-n)/s,l/=6,l%=1,[360*l,100*s,100*a]},$s.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]},$s.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]},$s.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,s=o%1,a=1-s;let l=0;switch(Math.floor(o)){case 0:i[0]=1,i[1]=s,i[2]=0;break;case 1:i[0]=a,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=s;break;case 3:i[0]=0,i[1]=a,i[2]=1;break;case 4:i[0]=s,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=a}return l=(1-n)*r,[255*(n*i[0]+l),255*(n*i[1]+l),255*(n*i[2]+l)]},$s.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]},$s.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]},$s.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)]},$s.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]},$s.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},$s.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},$s.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},$s.gray.hsl=function(t){return[0,0,t[0]]},$s.gray.hsv=$s.gray.hsl,$s.gray.hwb=function(t){return[0,100,t[0]]},$s.gray.cmyk=function(t){return[0,0,0,t[0]]},$s.gray.lab=function(t){return[t[0],0,0]},$s.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},$s.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]};const Us=Hs;function Xs(t){const e=function(){const t={},e=Object.keys(Us);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(Us[t]);for(let i=r.length,o=0;o<i;o++){const i=r[o],s=e[i];-1===s.distance&&(s.distance=e[t].distance+1,s.parent=t,n.unshift(i))}}return e}function Ys(t,e){return function(n){return e(t(n))}}function Gs(t,e){const n=[e[t].parent,t];let r=Us[e[t].parent][t],i=e[t].parent;for(;e[i].parent;)n.unshift(e[i].parent),r=Ys(Us[e[i].parent][i],r),i=e[i].parent;return r.conversion=n,r}const qs=Hs,Ks=function(t){const e=Xs(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]=Gs(t,e))}return n},Zs={};Object.keys(qs).forEach(t=>{Zs[t]={},Object.defineProperty(Zs[t],"channels",{value:qs[t].channels}),Object.defineProperty(Zs[t],"labels",{value:qs[t].labels});const e=Ks(t);Object.keys(e).forEach(n=>{const r=e[n];Zs[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),Zs[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)})});const Js=Ns,Qs=Zs,ta=["keyword","gray","hex"],ea={};for(const Ak of Object.keys(Qs))ea[[...Qs[Ak].labels].sort().join("")]=Ak;const na={};function ra(t,e){if(!(this instanceof ra))return new ra(t,e);if(e&&e in ta&&(e=null),e&&!(e in Qs))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 ra)this.model=t.model,this.color=[...t.color],this.valpha=t.valpha;else if("string"==typeof t){const e=Js.get(t);if(null===e)throw new Error("Unable to parse color from string: "+t);this.model=e.model,r=Qs[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=Qs[this.model].channels;const n=Array.prototype.slice.call(t,0,r);this.color=la(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 ea))throw new Error("Unable to parse color from object: "+JSON.stringify(t));this.model=ea[r];const{labels:i}=Qs[this.model],o=[];for(n=0;n<i.length;n++)o.push(t[i[n]]);this.color=la(o)}if(na[this.model])for(r=Qs[this.model].channels,n=0;n<r;n++){const t=na[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)}ra.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(t){let e=this.model in Js.to?this:this.rgb();e=e.round("number"==typeof t?t:1);const n=1===e.valpha?e.color:[...e.color,this.valpha];return Js.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 Js.to.rgb.percent(n)},array(){return 1===this.valpha?[...this.color]:[...this.color,this.valpha]},object(){const t={},{channels:e}=Qs[this.model],{labels:n}=Qs[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 ra([...this.color.map(ia(t)),this.valpha],this.model)},alpha(t){return void 0!==t?new ra([...this.color,Math.max(0,Math.min(1,t))],this.model):this.valpha},red:oa("rgb",0,sa(255)),green:oa("rgb",1,sa(255)),blue:oa("rgb",2,sa(255)),hue:oa(["hsl","hsv","hsl","hwb","hcg"],0,t=>(t%360+360)%360),saturationl:oa("hsl",1,sa(100)),lightness:oa("hsl",2,sa(100)),saturationv:oa("hsv",1,sa(100)),value:oa("hsv",2,sa(100)),chroma:oa("hcg",1,sa(100)),gray:oa("hcg",2,sa(100)),white:oa("hwb",1,sa(100)),wblack:oa("hwb",2,sa(100)),cyan:oa("cmyk",0,sa(100)),magenta:oa("cmyk",1,sa(100)),yellow:oa("cmyk",2,sa(100)),black:oa("cmyk",3,sa(100)),x:oa("xyz",0,sa(95.047)),y:oa("xyz",1,sa(100)),z:oa("xyz",2,sa(108.833)),l:oa("lab",0,sa(100)),a:oa("lab",1),b:oa("lab",2),keyword(t){return void 0!==t?new ra(t):Qs[this.model].keyword(this.color)},hex(t){return void 0!==t?new ra(t):Js.to.hex(this.rgb().round().color)},hexa(t){if(void 0!==t)return new ra(t);const e=this.rgb().round().color;let n=Math.round(255*this.valpha).toString(16).toUpperCase();return 1===n.length&&(n="0"+n),Js.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 ra.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,s=n.alpha()-r.alpha(),a=((o*s===-1?o:(o+s)/(1+o*s))+1)/2,l=1-a;return ra.rgb(a*n.red()+l*r.red(),a*n.green()+l*r.green(),a*n.blue()+l*r.blue(),n.alpha()*i+r.alpha()*(1-i))}};for(const Ak of Object.keys(Qs)){if(ta.includes(Ak))continue;const{channels:t}=Qs[Ak];ra.prototype[Ak]=function(...t){return this.model===Ak?new ra(this):t.length>0?new ra(t,Ak):new ra([...aa(Qs[this.model][Ak].raw(this.color)),this.valpha],Ak)},ra[Ak]=function(...e){let n=e[0];return"number"==typeof n&&(n=la(e,t)),new ra(n,Ak)}}function ia(t){return function(e){return function(t,e){return Number(t.toFixed(e))}(e,t)}}function oa(t,e,n){t=Array.isArray(t)?t:[t];for(const r of t)(na[r]||(na[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 sa(t){return function(e){return Math.max(0,Math.min(t,e))}}function aa(t){return Array.isArray(t)?t:[t]}function la(t,e){for(let n=0;n<e;n++)"number"!=typeof t[n]&&(t[n]=0);return t}const ca=$r(ra);function ua(t){return t.endsWith("%")||3===t.split(" ").length?t:ca(t).rgb().array().slice(0,3).join(" ")}let ha=typeof document<"u"?document.getElementById("root")??document.body:void 0,da=typeof document<"u"?document.documentElement:void 0;function pa(t){Object.entries(t.values).forEach(([t,e])=>{!function(t,e){null==da||da.style.setProperty(t,e)}(t,e)}),t.is_dark?da.classList.add("dark"):da.classList.remove("dark")}const fa=eo()(t=>({data:typeof window<"u"&&window.bootstrapData?ma(window.bootstrapData):null,setData:e=>{const n="string"==typeof e?ma(e):e;t({data:n})},mergeData:e=>{t(t=>({data:{...t.data,...e}}))}}));fa.getState().setData;const ga=fa.getState().mergeData;function ma(t){return"string"==typeof t?JSON.parse(t):t}const va={top:0,right:0,bottom:0,left:0,width:0,height:0},ba=eo()(no(Cs((t,e)=>({editor:null,fabric:null,config:ji,zoom:1,dirty:!1,original:{width:1,height:1},stageSize:va,canvasSize:va,canvasRef:null,activeTool:null,activeToolOverlay:null,loading:!1,openPanels:{newImage:!1,history:!1,objects:!1,export:!1},...is(t,e),...gs(t,e),...as(t,e),...cs(t,e),...vs(t,e),...ys(t,e),...ws(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=ns(n,e().config);t.config=o;const s=o.activeLanguage||"en",a=null==(r=o.languages)?void 0:r[s],l=((null==(i=o.ui)?void 0:i.themes)||[]).map(t=>function(t){const e=t.isDark?Jr.find(t=>t.isDark):Jr.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,ua(e)]);return{id:n.name,name:n.name,values: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&&pa(c),ga({i18n:{language:s,name:s,id:0,lines:a},themes:{all:l}})}),togglePanel:(e,n)=>t(t=>{t.openPanels[e]=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 ya(){return ba.getState()}function xa(){return ya().editor.tools}function wa(){return ya().fabric}function _a(t){var e,n,r,i,o;xa().canvas.clear(),xa().frame.remove();const s=!(null!=(e=ya().config.ui)&&e.visible);return ya().setConfig({image:void 0,blankCanvasSize:void 0,...t}),ya().reset(),null!=(n=ya().config.ui)&&n.defaultTool&&ya().setActiveTool(null==(r=ya().config.ui)?void 0:r.defaultTool,null),s&&(null==(o=(i=ya().config).onOpen)||o.call(i)),new Promise(t=>setTimeout(t))}async function Ca(t){return(await fetch(t)).json()}const Sa={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 ka(t=[]){var e;t=[...Object.keys(Sa),"crossOrigin","name","displayName","data",...t];const n=wa().toJSON(t);n.objects=n.objects.filter(t=>!t.data.pixieInternal).map(t=>("image"===t.type&&ya().config.crossOrigin&&(t.crossOrigin="anonymous"),hs(t)&&(t.selectable=!0,t.lockMovementX=!1,t.lockMovementY=!1,t.lockUniScaling=!1),{...t,data:t.data?{...t.data}:{}}));return{canvas:n,editor:{frame:xa().frame.active.config?{name:xa().frame.active.config.name,sizePercent:xa().frame.active.currentSizeInPercent}:null,zoom:ya().zoom,activeObjectId:(null==(e=ya().objects.active)?void 0:e.id)||null},canvasWidth:ya().original.width,canvasHeight:ya().original.height}}function Ta(t=null){if(ya().dirty)return;xa().zoom.fitToScreen();const[e,n]=ja(wa().getActiveObject());t?ya().setActiveTool(t,e===t?n:null):ya().setActiveTool(e,n)}function ja(t){switch(null==t?void 0:t.name){case ds.Text:return[Qr.TEXT,ss.Text];case ds.Sticker:return[Qr.STICKERS,ss.ActiveObject];case ds.Image:return[null,ss.ActiveObject];case ds.Shape:return[Qr.SHAPES,ss.ActiveObject];default:return[null,null]}}let Oa=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&n[t]];return e};class Ea{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 Ma=eo()(Cs((t,e)=>({toasts:[],add:(n,r)=>{const i=e().toasts.length+1-1;i>0&&t(t=>{t.toasts.splice(0,i)});const o=(null==r?void 0:r.id)||Oa(6),s=(null==r?void 0:r.type)||"positive",a=(null==r?void 0:r.duration)??function(t){switch(t){case"danger":return 8e3;case"loading":return 0;default:return 3e3}}(s),l={timer:a>0?new Ea(()=>e().remove(o),a):null,message:n,...r,id:o,type:s,position:(null==r?void 0:r.position)||"bottom-center",duration:a,disableExitAnimation:null==r?void 0:r.disableExitAnimation,disableEnterAnimation:null==r?void 0:r.disableEnterAnimation},c=e().toasts.findIndex(t=>t.id===l.id);t(c>-1?t=>{t.toasts[c]=l}:t=>{t.toasts.push(l)})},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 Pa(){return Ma.getState()}function Aa(t,e){Pa().add(t,e)}Aa.danger=(t,e)=>{Pa().add(t,{...e,type:"danger"})},Aa.positive=(t,e)=>{Pa().add(t,{...e,type:"positive"})},Aa.loading=(t,e)=>{Pa().add(t,{...e,type:"loading"})};const Da=(0,i.createContext)({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),Ia=(0,i.createContext)({}),Ra=(0,i.createContext)(null),za=typeof document<"u",La=za?i.useLayoutEffect:i.useEffect,Fa=(0,i.createContext)({strict:!1}),Na=t=>t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),Ba="data-"+Na("framerAppearId");function Va(t){return t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}function $a(t){return"string"==typeof t||Array.isArray(t)}function Ha(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}const Wa=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Ua=["initial",...Wa];function Xa(t){return Ha(t.animate)||Ua.some(e=>$a(t[e]))}function Ya(t){return!(!Xa(t)&&!t.variants)}function Ga(t){const{initial:e,animate:n}=function(t,e){if(Xa(t)){const{initial:e,animate:n}=t;return{initial:!1===e||$a(e)?e:void 0,animate:$a(n)?n:void 0}}return!1!==t.inherit?e:{}}(t,(0,i.useContext)(Ia));return(0,i.useMemo)(()=>({initial:e,animate:n}),[qa(e),qa(n)])}function qa(t){return Array.isArray(t)?t.join(" "):t}const Ka={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Za={};for(const Ak in Ka)Za[Ak]={isEnabled:t=>Ka[Ak].some(e=>!!t[e])};function Ja(t){for(const e in t)Za[e]={...Za[e],...t[e]}}const Qa=(0,i.createContext)({}),tl=(0,i.createContext)({}),el=Symbol.for("motionComponentSymbol");function nl({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:r,Component:o}){t&&Ja(t);const s=(0,i.forwardRef)(function(s,a){let l;const c={...(0,i.useContext)(Da),...s,layoutId:rl(s)},{isStatic:u}=c,h=Ga(s),d=r(s,u);if(!u&&za){h.visualElement=function(t,e,n,r){const{visualElement:o}=(0,i.useContext)(Ia),s=(0,i.useContext)(Fa),a=(0,i.useContext)(Ra),l=(0,i.useContext)(Da).reducedMotion,c=(0,i.useRef)();r=r||s.renderer,!c.current&&r&&(c.current=r(t,{visualState:e,parent:o,props:n,presenceContext:a,blockInitialAnimation:!!a&&!1===a.initial,reducedMotionConfig:l}));const u=c.current;(0,i.useInsertionEffect)(()=>{u&&u.update(n,a)});const h=(0,i.useRef)(!(!n[Ba]||window.HandoffComplete));return La(()=>{u&&(u.render(),h.current&&u.animationState&&u.animationState.animateChanges())}),(0,i.useEffect)(()=>{u&&(u.updateFeatures(),!h.current&&u.animationState&&u.animationState.animateChanges(),h.current&&(h.current=!1,window.HandoffComplete=!0))}),u}(o,d,c,e);const n=(0,i.useContext)(tl),r=(0,i.useContext)(Fa).strict;h.visualElement&&(l=h.visualElement.loadFeatures(c,r,t,n))}return i.createElement(Ia.Provider,{value:h},l&&h.visualElement?i.createElement(l,{visualElement:h.visualElement,...c}):null,n(o,s,function(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):Va(n)&&(n.current=r))},[e])}(d,h.visualElement,a),d,u,h.visualElement))});return s[el]=o,s}function rl({layoutId:t}){const e=(0,i.useContext)(Qa).id;return e&&void 0!==t?e+"-"+t:t}const il=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function ol(t){return"string"==typeof t&&!t.includes("-")&&!!(il.indexOf(t)>-1||/[A-Z]/.test(t))}const sl={},al=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],ll=new Set(al);function cl(t,{layout:e,layoutId:n}){return ll.has(t)||t.startsWith("origin")||(e||void 0!==n)&&(!!sl[t]||"opacity"===t)}const ul=t=>!(!t||!t.getVelocity),hl={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},dl=al.length;const pl=t=>e=>"string"==typeof e&&e.startsWith(t),fl=pl("--"),gl=pl("var(--"),ml=(t,e)=>e&&"number"==typeof t?e.transform(t):t,vl=(t,e,n)=>Math.min(Math.max(n,t),e),bl={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},yl={...bl,transform:t=>vl(0,1,t)},xl={...bl,default:1},wl=t=>Math.round(1e5*t)/1e5,_l=/(-)?([\d]*\.?[\d])+/g,Cl=/(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,Sl=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function kl(t){return"string"==typeof t}const Tl=t=>({test:e=>kl(e)&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),jl=Tl("deg"),Ol=Tl("%"),El=Tl("px"),Ml=Tl("vh"),Pl=Tl("vw"),Al={...Ol,parse:t=>Ol.parse(t)/100,transform:t=>Ol.transform(100*t)},Dl={...bl,transform:Math.round},Il={borderWidth:El,borderTopWidth:El,borderRightWidth:El,borderBottomWidth:El,borderLeftWidth:El,borderRadius:El,radius:El,borderTopLeftRadius:El,borderTopRightRadius:El,borderBottomRightRadius:El,borderBottomLeftRadius:El,width:El,maxWidth:El,height:El,maxHeight:El,size:El,top:El,right:El,bottom:El,left:El,padding:El,paddingTop:El,paddingRight:El,paddingBottom:El,paddingLeft:El,margin:El,marginTop:El,marginRight:El,marginBottom:El,marginLeft:El,rotate:jl,rotateX:jl,rotateY:jl,rotateZ:jl,scale:xl,scaleX:xl,scaleY:xl,scaleZ:xl,skew:jl,skewX:jl,skewY:jl,distance:El,translateX:El,translateY:El,translateZ:El,x:El,y:El,z:El,perspective:El,transformPerspective:El,opacity:yl,originX:Al,originY:Al,originZ:El,zIndex:Dl,fillOpacity:yl,strokeOpacity:yl,numOctaves:Dl};function Rl(t,e,n,r){const{style:i,vars:o,transform:s,transformOrigin:a}=t;let l=!1,c=!1,u=!0;for(const h in e){const t=e[h];if(fl(h)){o[h]=t;continue}const n=Il[h],r=ml(t,n);if(ll.has(h)){if(l=!0,s[h]=r,!u)continue;t!==(n.default||0)&&(u=!1)}else h.startsWith("origin")?(c=!0,a[h]=r):i[h]=r}if(e.transform||(l||r?i.transform=function(t,{enableHardwareAcceleration:e=!0,allowTransformNone:n=!0},r,i){let o="";for(let s=0;s<dl;s++){const e=al[s];void 0!==t[e]&&(o+=`${hl[e]||e}(${t[e]}) `)}return e&&!t.z&&(o+="translateZ(0)"),o=o.trim(),i?o=i(t,r?"":o):n&&r&&(o="none"),o}(t.transform,n,u,r):i.transform&&(i.transform="none")),c){const{originX:t="50%",originY:e="50%",originZ:n=0}=a;i.transformOrigin=`${t} ${e} ${n}`}}const zl=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Ll(t,e,n){for(const r in e)!ul(e[r])&&!cl(r,n)&&(t[r]=e[r])}function Fl(t,e,n){const r={};return Ll(r,t.style||{},t),Object.assign(r,function({transformTemplate:t},e,n){return(0,i.useMemo)(()=>{const r={style:{},transform:{},transformOrigin:{},vars:{}};return Rl(r,e,{enableHardwareAcceleration:!n},t),Object.assign({},r.vars,r.style)},[e])}(t,e,n)),t.transformValues?t.transformValues(r):r}function Nl(t,e,n){const r={},i=Fl(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")),void 0===t.tabIndex&&(t.onTap||t.onTapStart||t.whileTap)&&(r.tabIndex=0),r.style=i,r}const Bl=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","transformValues","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Vl(t){return t.startsWith("while")||t.startsWith("drag")&&"draggable"!==t||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Bl.has(t)}let $l=t=>!Vl(t);try{(Hl=n(81214).A)&&($l=t=>t.startsWith("on")?!Vl(t):Hl(t))}catch{}var Hl;function Wl(t,e,n){const r={};for(const i in t)"values"===i&&"object"==typeof t.values||($l(i)||!0===n&&Vl(i)||!e&&!Vl(i)||t.draggable&&i.startsWith("onDrag"))&&(r[i]=t[i]);return r}function Ul(t,e,n){return"string"==typeof t?t:El.transform(e+n*t)}const Xl={offset:"stroke-dashoffset",array:"stroke-dasharray"},Yl={offset:"strokeDashoffset",array:"strokeDasharray"};function Gl(t,{attrX:e,attrY:n,attrScale:r,originX:i,originY:o,pathLength:s,pathSpacing:a=1,pathOffset:l=0,...c},u,h,d){if(Rl(t,c,u,d),h)return void(t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox));t.attrs=t.style,t.style={};const{attrs:p,style:f,dimensions:g}=t;p.transform&&(g&&(f.transform=p.transform),delete p.transform),g&&(void 0!==i||void 0!==o||f.transform)&&(f.transformOrigin=function(t,e,n){return`${Ul(e,t.x,t.width)} ${Ul(n,t.y,t.height)}`}(g,void 0!==i?i:.5,void 0!==o?o:.5)),void 0!==e&&(p.x=e),void 0!==n&&(p.y=n),void 0!==r&&(p.scale=r),void 0!==s&&function(t,e,n=1,r=0,i=!0){t.pathLength=1;const o=i?Xl:Yl;t[o.offset]=El.transform(-r);const s=El.transform(e),a=El.transform(n);t[o.array]=`${s} ${a}`}(p,s,a,l,!1)}const ql=()=>({style:{},transform:{},transformOrigin:{},vars:{},attrs:{}}),Kl=t=>"string"==typeof t&&"svg"===t.toLowerCase();function Zl(t,e,n,r){const o=(0,i.useMemo)(()=>{const n={style:{},transform:{},transformOrigin:{},vars:{},attrs:{}};return Gl(n,e,{enableHardwareAcceleration:!1},Kl(r),t.transformTemplate),{...n.attrs,style:{...n.style}}},[e]);if(t.style){const e={};Ll(e,t.style,t),o.style={...e,...o.style}}return o}function Jl(t=!1){return(e,n,r,{latestValues:o},s)=>{const a=(ol(e)?Zl:Nl)(n,o,s,e),l={...Wl(n,"string"==typeof e,t),...a,ref:r},{children:c}=n,u=(0,i.useMemo)(()=>ul(c)?c.get():c,[c]);return(0,i.createElement)(e,{...l,children:u})}}function Ql(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 tc=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function ec(t,e,n,r){Ql(t,e,void 0,r);for(const i in e.attrs)t.setAttribute(tc.has(i)?i:Na(i),e.attrs[i])}function nc(t,e){const{style:n}=t,r={};for(const i in n)(ul(n[i])||e.style&&ul(e.style[i])||cl(i,t))&&(r[i]=n[i]);return r}function rc(t,e){const n=nc(t,e);for(const r in t)if(ul(t[r])||ul(e[r])){n[-1!==al.indexOf(r)?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r]=t[r]}return n}function ic(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}function oc(t){const e=(0,i.useRef)(null);return null===e.current&&(e.current=t()),e.current}const sc=t=>Array.isArray(t),ac=t=>sc(t)?t[t.length-1]||0:t;function lc(t){const e=ul(t)?t.get():t;return(t=>!!(t&&"object"==typeof t&&t.mix&&t.toValue))(e)?e.toValue():e}const cc=t=>(e,n)=>{const r=(0,i.useContext)(Ia),o=(0,i.useContext)(Ra),s=()=>function({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:n},r,i,o){const s={latestValues:uc(r,i,o,t),renderState:e()};return n&&(s.mount=t=>n(r,t,s)),s}(t,e,r,o);return n?s():oc(s)};function uc(t,e,n,r){const i={},o=r(t,{});for(const d in o)i[d]=lc(o[d]);let{initial:s,animate:a}=t;const l=Xa(t),c=Ya(t);e&&c&&!l&&!1!==t.inherit&&(void 0===s&&(s=e.initial),void 0===a&&(a=e.animate));let u=!!n&&!1===n.initial;u=u||!1===s;const h=u?a:s;return h&&"boolean"!=typeof h&&!Ha(h)&&(Array.isArray(h)?h:[h]).forEach(e=>{const n=ic(t,e);if(!n)return;const{transitionEnd:r,transition:o,...s}=n;for(const t in s){let e=s[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 hc=t=>t;class dc{constructor(){this.order=[],this.scheduled=new Set}add(t){if(!this.scheduled.has(t))return this.scheduled.add(t),this.order.push(t),!0}remove(t){const e=this.order.indexOf(t);-1!==e&&(this.order.splice(e,1),this.scheduled.delete(t))}clear(){this.order.length=0,this.scheduled.clear()}}const pc=["prepare","read","update","preRender","render","postRender"];const{schedule:fc,cancel:gc,state:mc,steps:vc}=function(t,e){let n=!1,r=!0;const i={delta:0,timestamp:0,isProcessing:!1},o=pc.reduce((t,e)=>(t[e]=function(t){let e=new dc,n=new dc,r=0,i=!1,o=!1;const s=new WeakSet,a={schedule:(t,o=!1,a=!1)=>{const l=a&&i,c=l?e:n;return o&&s.add(t),c.add(t)&&l&&i&&(r=e.order.length),t},cancel:t=>{n.remove(t),s.delete(t)},process:l=>{if(i)o=!0;else{if(i=!0,[e,n]=[n,e],n.clear(),r=e.order.length,r)for(let n=0;n<r;n++){const r=e.order[n];r(l),s.has(r)&&(a.schedule(r),t())}i=!1,o&&(o=!1,a.process(l))}}};return a}(()=>n=!0),t),{}),s=t=>o[t].process(i),a=()=>{const o=performance.now();n=!1,i.delta=r?1e3/60:Math.max(Math.min(o-i.timestamp,40),1),i.timestamp=o,i.isProcessing=!0,pc.forEach(s),i.isProcessing=!1,n&&e&&(r=!1,t(a))};return{schedule:pc.reduce((e,s)=>{const l=o[s];return e[s]=(e,o=!1,s=!1)=>(n||(n=!0,r=!0,i.isProcessing||t(a)),l.schedule(e,o,s)),e},{}),cancel:t=>pc.forEach(e=>o[e].cancel(t)),state:i,steps:o}}(typeof requestAnimationFrame<"u"?requestAnimationFrame:hc,!0),bc={useVisualState:cc({scrapeMotionValuesFromProps:rc,createRenderState:ql,onMount:(t,e,{renderState:n,latestValues:r})=>{fc.read(()=>{try{n.dimensions="function"==typeof e.getBBox?e.getBBox():e.getBoundingClientRect()}catch{n.dimensions={x:0,y:0,width:0,height:0}}}),fc.render(()=>{Gl(n,r,{enableHardwareAcceleration:!1},Kl(e.tagName),t.transformTemplate),ec(e,n)})}})},yc={useVisualState:cc({scrapeMotionValuesFromProps:nc,createRenderState:zl})};function xc(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function wc(t,e="page"){return{point:{x:t[e+"X"],y:t[e+"Y"]}}}function _c(t,e,n,r){return xc(t,e,(t=>e=>(t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary)(e)&&t(e,wc(e)))(n),r)}const Cc=(t,e)=>n=>e(t(n)),Sc=(...t)=>t.reduce(Cc);function kc(t){let e=null;return()=>null===e&&(e=t,()=>{e=null})}const Tc=kc("dragHorizontal"),jc=kc("dragVertical");function Oc(){const t=function(t){let e=!1;if("y"===t)e=jc();else if("x"===t)e=Tc();else{const t=Tc(),n=jc();t&&n?e=()=>{t(),n()}:(t&&t(),n&&n())}return e}(!0);return!t||(t(),!1)}class Ec{constructor(t){this.isMounted=!1,this.node=t}update(){}}function Mc(t,e){const n="pointer"+(e?"enter":"leave"),r="onHover"+(e?"Start":"End");return _c(t.current,n,(n,i)=>{if("touch"===n.pointerType||Oc())return;const o=t.getProps();t.animationState&&o.whileHover&&t.animationState.setActive("whileHover",e),o[r]&&fc.update(()=>o[r](n,i))},{passive:!t.getProps()[r]})}const Pc=(t,e)=>!!e&&(t===e||Pc(t,e.parentElement));function Ac(t,e){if(!e)return;const n=new PointerEvent("pointer"+t);e(n,wc(n))}const Dc=new WeakMap,Ic=new WeakMap,Rc=t=>{const e=Dc.get(t.target);e&&e(t)},zc=t=>{t.forEach(Rc)};function Lc(t,e,n){const r=function({root:t,...e}){const n=t||document;Ic.has(n)||Ic.set(n,{});const r=Ic.get(n),i=JSON.stringify(e);return r[i]||(r[i]=new IntersectionObserver(zc,{root:t,...e})),r[i]}(e);return Dc.set(t,n),r.observe(t),()=>{Dc.delete(t),r.unobserve(t)}}const Fc={some:0,all:1};const Nc={inView:{Feature:class extends Ec{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:e,margin:n,amount:r="some",once:i}=t,o={root:e?e.current:void 0,rootMargin:n,threshold:"number"==typeof r?r:Fc[r]};return Lc(this.node.current,o,t=>{const{isIntersecting:e}=t;if(this.isInView===e||(this.isInView=e,i&&!e&&this.hasEnteredView))return;e&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",e);const{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),o=e?n:r;o&&o(t)})}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:e}=this.node;["amount","margin","root"].some(function({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}(t,e))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends Ec{constructor(){super(...arguments),this.removeStartListeners=hc,this.removeEndListeners=hc,this.removeAccessibleListeners=hc,this.startPointerPress=(t,e)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),r=_c(window,"pointerup",(t,e)=>{if(!this.checkPressEnd())return;const{onTap:n,onTapCancel:r,globalTapTarget:i}=this.node.getProps();fc.update(()=>{i||Pc(this.node.current,t.target)?n&&n(t,e):r&&r(t,e)})},{passive:!(n.onTap||n.onPointerUp)}),i=_c(window,"pointercancel",(t,e)=>this.cancelPress(t,e),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=Sc(r,i),this.startPress(t,e)},this.startAccessiblePress=()=>{const t=xc(this.node.current,"keydown",t=>{if("Enter"!==t.key||this.isPressing)return;this.removeEndListeners(),this.removeEndListeners=xc(this.node.current,"keyup",t=>{"Enter"!==t.key||!this.checkPressEnd()||Ac("up",(t,e)=>{const{onTap:n}=this.node.getProps();n&&fc.update(()=>n(t,e))})}),Ac("down",(t,e)=>{this.startPress(t,e)})}),e=xc(this.node.current,"blur",()=>{this.isPressing&&Ac("cancel",(t,e)=>this.cancelPress(t,e))});this.removeAccessibleListeners=Sc(t,e)}}startPress(t,e){this.isPressing=!0;const{onTapStart:n,whileTap:r}=this.node.getProps();r&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&fc.update(()=>n(t,e))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!Oc()}cancelPress(t,e){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&fc.update(()=>n(t,e))}mount(){const t=this.node.getProps(),e=_c(t.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),n=xc(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=Sc(e,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}},focus:{Feature:class extends Ec{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Sc(xc(this.node.current,"focus",()=>this.onFocus()),xc(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends Ec{mount(){this.unmount=Sc(Mc(this.node,!0),Mc(this.node,!1))}unmount(){}}}};function Bc(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}function Vc(t,e,n){const r=t.getProps();return ic(r,e,void 0!==n?n:r.custom,function(t){const e={};return t.values.forEach((t,n)=>e[n]=t.get()),e}(t),function(t){const e={};return t.values.forEach((t,n)=>e[n]=t.getVelocity()),e}(t))}let $c=hc,Hc=hc;const Wc=t=>1e3*t,Uc=t=>t/1e3,Xc=!1,Yc=t=>Array.isArray(t)&&"number"==typeof t[0];function Gc(t){return!!(!t||"string"==typeof t&&Kc[t]||Yc(t)||Array.isArray(t)&&t.every(Gc))}const qc=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,Kc={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:qc([0,.65,.55,1]),circOut:qc([.55,0,1,.45]),backIn:qc([.31,.01,.66,-.59]),backOut:qc([.33,1.53,.69,.99])};function Zc(t){if(t)return Yc(t)?qc(t):Array.isArray(t)?t.map(Zc):Kc[t]}const Jc=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function Qc(t,e,n,r){if(t===e&&n===r)return hc;const i=e=>function(t,e,n,r,i){let o,s,a=0;do{s=e+(n-e)/2,o=Jc(s,r,i)-t,o>0?n=s:e=s}while(Math.abs(o)>1e-7&&++a<12);return s}(e,0,1,t,n);return t=>0===t||1===t?t:Jc(i(t),e,r)}const tu=Qc(.42,0,1,1),eu=Qc(0,0,.58,1),nu=Qc(.42,0,.58,1),ru=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,iu=t=>e=>1-t(1-e),ou=t=>1-Math.sin(Math.acos(t)),su=iu(ou),au=ru(ou),lu=Qc(.33,1.53,.69,.99),cu=iu(lu),uu=ru(cu),hu={linear:hc,easeIn:tu,easeInOut:nu,easeOut:eu,circIn:ou,circInOut:au,circOut:su,backIn:cu,backInOut:uu,backOut:lu,anticipate:t=>(t*=2)<1?.5*cu(t):.5*(2-Math.pow(2,-10*(t-1)))},du=t=>{if(Array.isArray(t)){Hc(4===t.length);const[e,n,r,i]=t;return Qc(e,n,r,i)}return"string"==typeof t?hu[t]:t},pu=(t,e)=>n=>!!(kl(n)&&Sl.test(n)&&n.startsWith(t)||e&&Object.prototype.hasOwnProperty.call(n,e)),fu=(t,e,n)=>r=>{if(!kl(r))return r;const[i,o,s,a]=r.match(_l);return{[t]:parseFloat(i),[e]:parseFloat(o),[n]:parseFloat(s),alpha:void 0!==a?parseFloat(a):1}},gu={...bl,transform:t=>Math.round((t=>vl(0,255,t))(t))},mu={test:pu("rgb","red"),parse:fu("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+gu.transform(t)+", "+gu.transform(e)+", "+gu.transform(n)+", "+wl(yl.transform(r))+")"};const vu={test:pu("#"),parse:function(t){let e="",n="",r="",i="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),i=t.substring(4,5),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:mu.transform},bu={test:pu("hsl","hue"),parse:fu("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+Ol.transform(wl(e))+", "+Ol.transform(wl(n))+", "+wl(yl.transform(r))+")"},yu={test:t=>mu.test(t)||vu.test(t)||bu.test(t),parse:t=>mu.test(t)?mu.parse(t):bu.test(t)?bu.parse(t):vu.parse(t),transform:t=>kl(t)?t:t.hasOwnProperty("red")?mu.transform(t):bu.transform(t)},xu=(t,e,n)=>-n*t+n*e+t;function wu(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}const _u=(t,e,n)=>{const r=t*t;return Math.sqrt(Math.max(0,n*(e*e-r)+r))},Cu=[vu,mu,bu];function Su(t){const e=(t=>Cu.find(e=>e.test(t)))(t);let n=e.parse(t);return e===bu&&(n=function({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,n/=100;let i=0,o=0,s=0;if(e/=100){const r=n<.5?n*(1+e):n+e-n*e,a=2*n-r;i=wu(a,r,t+1/3),o=wu(a,r,t),s=wu(a,r,t-1/3)}else i=o=s=n;return{red:Math.round(255*i),green:Math.round(255*o),blue:Math.round(255*s),alpha:r}}(n)),n}const ku=(t,e)=>{const n=Su(t),r=Su(e),i={...n};return t=>(i.red=_u(n.red,r.red,t),i.green=_u(n.green,r.green,t),i.blue=_u(n.blue,r.blue,t),i.alpha=xu(n.alpha,r.alpha,t),mu.transform(i))};const Tu={regex:/var\s*\(\s*--[\w-]+(\s*,\s*(?:(?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)+)?\s*\)/g,countKey:"Vars",token:"${v}",parse:hc},ju={regex:Cl,countKey:"Colors",token:"${c}",parse:yu.parse},Ou={regex:_l,countKey:"Numbers",token:"${n}",parse:bl.parse};function Eu(t,{regex:e,countKey:n,token:r,parse:i}){const o=t.tokenised.match(e);o&&(t["num"+n]=o.length,t.tokenised=t.tokenised.replace(e,r),t.values.push(...o.map(i)))}function Mu(t){const e=t.toString(),n={value:e,tokenised:e,values:[],numVars:0,numColors:0,numNumbers:0};return n.value.includes("var(--")&&Eu(n,Tu),Eu(n,ju),Eu(n,Ou),n}function Pu(t){return Mu(t).values}function Au(t){const{values:e,numColors:n,numVars:r,tokenised:i}=Mu(t),o=e.length;return t=>{let e=i;for(let i=0;i<o;i++)e=i<r?e.replace(Tu.token,t[i]):i<r+n?e.replace(ju.token,yu.transform(t[i])):e.replace(Ou.token,wl(t[i]));return e}}const Du=t=>"number"==typeof t?0:t;const Iu={test:function(t){var e,n;return isNaN(t)&&kl(t)&&((null===(e=t.match(_l))||void 0===e?void 0:e.length)||0)+((null===(n=t.match(Cl))||void 0===n?void 0:n.length)||0)>0},parse:Pu,createTransformer:Au,getAnimatableNone:function(t){const e=Pu(t);return Au(t)(e.map(Du))}},Ru=(t,e)=>n=>`${n>0?e:t}`;function zu(t,e){return"number"==typeof t?n=>xu(t,e,n):yu.test(t)?ku(t,e):t.startsWith("var(")?Ru(t,e):Nu(t,e)}const Lu=(t,e)=>{const n=[...t],r=n.length,i=t.map((t,n)=>zu(t,e[n]));return t=>{for(let e=0;e<r;e++)n[e]=i[e](t);return n}},Fu=(t,e)=>{const n={...t,...e},r={};for(const i in n)void 0!==t[i]&&void 0!==e[i]&&(r[i]=zu(t[i],e[i]));return t=>{for(const e in r)n[e]=r[e](t);return n}},Nu=(t,e)=>{const n=Iu.createTransformer(e),r=Mu(t),i=Mu(e);return r.numVars===i.numVars&&r.numColors===i.numColors&&r.numNumbers>=i.numNumbers?Sc(Lu(r.values,i.values),n):Ru(t,e)},Bu=(t,e,n)=>{const r=e-t;return 0===r?1:(n-t)/r},Vu=(t,e)=>n=>xu(t,e,n);function $u(t,e,n){const r=[],i=n||function(t){return"number"==typeof t?Vu:"string"==typeof t?yu.test(t)?ku:Nu:Array.isArray(t)?Lu:"object"==typeof t?Fu:Vu}(t[0]),o=t.length-1;for(let s=0;s<o;s++){let n=i(t[s],t[s+1]);if(e){const t=Array.isArray(e)?e[s]||hc:e;n=Sc(t,n)}r.push(n)}return r}function Hu(t,e,{clamp:n=!0,ease:r,mixer:i}={}){const o=t.length;if(Hc(o===e.length),1===o)return()=>e[0];t[0]>t[o-1]&&(t=[...t].reverse(),e=[...e].reverse());const s=$u(e,r,i),a=s.length,l=e=>{let n=0;if(a>1)for(;n<t.length-2&&!(e<t[n+1]);n++);const r=Bu(t[n],t[n+1],e);return s[n](r)};return n?e=>l(vl(t[0],t[o-1],e)):l}function Wu(t){const e=[0];return function(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const i=Bu(0,e,r);t.push(xu(n,1,i))}}(e,t.length-1),e}function Uu(t,e){return t.map(()=>e||nu).splice(0,t.length-1)}function Xu({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const i=(t=>Array.isArray(t)&&"number"!=typeof t[0])(r)?r.map(du):du(r),o={done:!1,value:e[0]},s=function(t,e){return t.map(t=>t*e)}(n&&n.length===e.length?n:Wu(e),t),a=Hu(s,e,{ease:Array.isArray(i)?i:Uu(e,i)});return{calculatedDuration:t,next:e=>(o.value=a(e),o.done=e>=t,o)}}function Yu(t,e){return e?t*(1e3/e):0}function Gu(t,e,n){const r=Math.max(e-5,0);return Yu(n-t(r),e-r)}const qu=.001;function Ku({duration:t=800,bounce:e=.25,velocity:n=0,mass:r=1}){let i,o;$c(t<=Wc(10));let s=1-e;s=vl(.05,1,s),t=vl(.01,10,Uc(t)),s<1?(i=e=>{const r=e*s,i=r*t,o=r-n,a=Ju(e,s),l=Math.exp(-i);return qu-o/a*l},o=e=>{const r=e*s*t,o=r*n+n,a=Math.pow(s,2)*Math.pow(e,2)*t,l=Math.exp(-r),c=Ju(Math.pow(e,2),s);return(-i(e)+qu>0?-1:1)*((o-a)*l)/c}):(i=e=>Math.exp(-e*t)*((e-n)*t+1)-qu,o=e=>Math.exp(-e*t)*(t*t*(n-e)));const a=function(t,e,n){let r=n;for(let i=1;i<Zu;i++)r-=t(r)/e(r);return r}(i,o,5/t);if(t=Wc(t),isNaN(a))return{stiffness:100,damping:10,duration:t};{const e=Math.pow(a,2)*r;return{stiffness:e,damping:2*s*Math.sqrt(r*e),duration:t}}}const Zu=12;function Ju(t,e){return t*Math.sqrt(1-e*e)}const Qu=["duration","bounce"],th=["stiffness","damping","mass"];function eh(t,e){return e.some(e=>void 0!==t[e])}function nh({keyframes:t,restDelta:e,restSpeed:n,...r}){const i=t[0],o=t[t.length-1],s={done:!1,value:i},{stiffness:a,damping:l,mass:c,duration:u,velocity:h,isResolvedFromDuration:d}=function(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!eh(t,th)&&eh(t,Qu)){const n=Ku(t);e={...e,...n,mass:1},e.isResolvedFromDuration=!0}return e}({...r,velocity:-Uc(r.velocity||0)}),p=h||0,f=l/(2*Math.sqrt(a*c)),g=o-i,m=Uc(Math.sqrt(a/c)),v=Math.abs(g)<5;let b;if(n||(n=v?.01:2),e||(e=v?.005:.5),f<1){const t=Ju(m,f);b=e=>{const n=Math.exp(-f*m*e);return o-n*((p+f*m*g)/t*Math.sin(t*e)+g*Math.cos(t*e))}}else if(1===f)b=t=>o-Math.exp(-m*t)*(g+(p+m*g)*t);else{const t=m*Math.sqrt(f*f-1);b=e=>{const n=Math.exp(-f*m*e),r=Math.min(t*e,300);return o-n*((p+f*m*g)*Math.sinh(r)+t*g*Math.cosh(r))/t}}return{calculatedDuration:d&&u||null,next:t=>{const r=b(t);if(d)s.done=t>=u;else{let i=p;0!==t&&(i=f<1?Gu(b,t,r):0);const a=Math.abs(i)<=n,l=Math.abs(o-r)<=e;s.done=a&&l}return s.value=s.done?o:r,s}}}function rh({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:o=500,modifyTarget:s,min:a,max:l,restDelta:c=.5,restSpeed:u}){const h=t[0],d={done:!1,value:h},p=t=>void 0===a?l:void 0===l||Math.abs(a-t)<Math.abs(l-t)?a:l;let f=n*e;const g=h+f,m=void 0===s?g:s(g);m!==g&&(f=m-h);const v=t=>-f*Math.exp(-t/r),b=t=>m+v(t),y=t=>{const e=v(t),n=b(t);d.done=Math.abs(e)<=c,d.value=d.done?m:n};let x,w;const _=t=>{(t=>void 0!==a&&t<a||void 0!==l&&t>l)(d.value)&&(x=t,w=nh({keyframes:[d.value,p(d.value)],velocity:Gu(b,t,d.value),damping:i,stiffness:o,restDelta:c,restSpeed:u}))};return _(0),{calculatedDuration:null,next:t=>{let e=!1;return!w&&void 0===x&&(e=!0,y(t),_(t)),void 0!==x&&t>x?w.next(t-x):(!e&&y(t),d)}}}const ih=t=>{const e=({timestamp:e})=>t(e);return{start:()=>fc.update(e,!0),stop:()=>gc(e),now:()=>mc.isProcessing?mc.timestamp:performance.now()}};function oh(t){let e=0;let n=t.next(e);for(;!n.done&&e<2e4;)e+=50,n=t.next(e);return e>=2e4?1/0:e}const sh={decay:rh,inertia:rh,tween:Xu,keyframes:Xu,spring:nh};function ah({autoplay:t=!0,delay:e=0,driver:n=ih,keyframes:r,type:i="keyframes",repeat:o=0,repeatDelay:s=0,repeatType:a="loop",onPlay:l,onStop:c,onComplete:u,onUpdate:h,...d}){let p,f,g=1,m=!1;const v=()=>{f=new Promise(t=>{p=t})};let b;v();const y=sh[i]||Xu;let x;y!==Xu&&"number"!=typeof r[0]&&(x=Hu([0,100],r,{clamp:!1}),r=[0,100]);const w=y({...d,keyframes:r});let _;"mirror"===a&&(_=y({...d,keyframes:[...r].reverse(),velocity:-(d.velocity||0)}));let C="idle",S=null,k=null,T=null;null===w.calculatedDuration&&o&&(w.calculatedDuration=oh(w));const{calculatedDuration:j}=w;let O=1/0,E=1/0;null!==j&&(O=j+s,E=O*(o+1)-s);let M=0;const P=t=>{if(null===k)return;g>0&&(k=Math.min(k,t)),g<0&&(k=Math.min(t-E/g,k)),M=null!==S?S:Math.round(t-k)*g;const n=M-e*(g>=0?1:-1),i=g>=0?n<0:n>E;M=Math.max(n,0),"finished"===C&&null===S&&(M=E);let l=M,c=w;if(o){const t=Math.min(M,E)/O;let e=Math.floor(t),n=t%1;!n&&t>=1&&(n=1),1===n&&e--,e=Math.min(e,o+1),!!(e%2)&&("reverse"===a?(n=1-n,s&&(n-=s/O)):"mirror"===a&&(c=_)),l=vl(0,1,n)*O}const u=i?{done:!1,value:r[0]}:c.next(l);x&&(u.value=x(u.value));let{done:d}=u;!i&&null!==j&&(d=g>=0?M>=E:M<=0);const p=null===S&&("finished"===C||"running"===C&&d);return h&&h(u.value),p&&I(),u},A=()=>{b&&b.stop(),b=void 0},D=()=>{C="idle",A(),p(),v(),k=T=null},I=()=>{C="finished",u&&u(),A(),p()},R=()=>{if(m)return;b||(b=n(P));const t=b.now();l&&l(),null!==S?k=t-S:(!k||"finished"===C)&&(k=t),"finished"===C&&v(),T=k,S=null,C="running",b.start()};t&&R();const z={then:(t,e)=>f.then(t,e),get time(){return Uc(M)},set time(t){t=Wc(t),M=t,null===S&&b&&0!==g?k=b.now()-t/g:S=t},get duration(){const t=null===w.calculatedDuration?oh(w):w.calculatedDuration;return Uc(t)},get speed(){return g},set speed(t){t===g||!b||(g=t,z.time=Uc(M))},get state(){return C},play:R,pause:()=>{C="paused",S=M},stop:()=>{m=!0,"idle"!==C&&(C="idle",c&&c(),D())},cancel:()=>{null!==T&&P(T),D()},complete:()=>{C="finished"},sample:t=>(k=0,P(t))};return z}const lh=function(t){let e;return()=>(void 0===e&&(e=t()),e)}(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),ch=new Set(["opacity","clipPath","filter","transform","backgroundColor"]);function uh(t,e,{onUpdate:n,onComplete:r,...i}){if(!lh()||!ch.has(e)||i.repeatDelay||"mirror"===i.repeatType||0===i.damping||"inertia"===i.type)return!1;let o,s,a=!1,l=!1;const c=()=>{s=new Promise(t=>{o=t})};c();let{keyframes:u,duration:h=300,ease:d,times:p}=i;if(((t,e)=>"spring"===e.type||"backgroundColor"===t||!Gc(e.ease))(e,i)){const t=ah({...i,repeat:0,delay:0});let e={done:!1,value:u[0]};const n=[];let r=0;for(;!e.done&&r<2e4;)e=t.sample(r),n.push(e.value),r+=10;p=void 0,u=n,h=r-10,d="linear"}const f=function(t,e,n,{delay:r=0,duration:i,repeat:o=0,repeatType:s="loop",ease:a,times:l}={}){const c={[e]:n};l&&(c.offset=l);const u=Zc(a);return Array.isArray(u)&&(c.easing=u),t.animate(c,{delay:r,duration:i,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:o+1,direction:"reverse"===s?"alternate":"normal"})}(t.owner.current,e,u,{...i,duration:h,ease:d,times:p}),g=()=>{l=!1,f.cancel()},m=()=>{l=!0,fc.update(g),o(),c()};return f.onfinish=()=>{l||(t.set(function(t,{repeat:e,repeatType:n="loop"}){return t[e&&"loop"!==n&&e%2===1?0:t.length-1]}(u,i)),r&&r(),m())},{then:(t,e)=>s.then(t,e),attachTimeline:t=>(f.timeline=t,f.onfinish=null,hc),get time(){return Uc(f.currentTime||0)},set time(t){f.currentTime=Wc(t)},get speed(){return f.playbackRate},set speed(t){f.playbackRate=t},get duration(){return Uc(h)},play:()=>{a||(f.play(),gc(g))},pause:()=>f.pause(),stop:()=>{if(a=!0,"idle"===f.playState)return;const{currentTime:e}=f;if(e){const n=ah({...i,autoplay:!1});t.setWithVelocity(n.sample(e-10).value,n.sample(e).value,10)}m()},complete:()=>{l||f.finish()},cancel:m}}const hh={type:"spring",stiffness:500,damping:25,restSpeed:10},dh={type:"keyframes",duration:.8},ph={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},fh=(t,{keyframes:e})=>e.length>2?dh:ll.has(t)?t.startsWith("scale")?(t=>({type:"spring",stiffness:550,damping:0===t?2*Math.sqrt(550):30,restSpeed:10}))(e[1]):hh:ph,gh=(t,e)=>"zIndex"!==t&&!("number"!=typeof e&&!Array.isArray(e)&&("string"!=typeof e||!Iu.test(e)&&"0"!==e||e.startsWith("url("))),mh=new Set(["brightness","contrast","saturate","opacity"]);function vh(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[r]=n.match(_l)||[];if(!r)return t;const i=n.replace(r,"");let o=mh.has(e)?1:0;return r!==n&&(o*=100),e+"("+o+i+")"}const bh=/([a-z-]*)\(.*?\)/g,yh={...Iu,getAnimatableNone:t=>{const e=t.match(bh);return e?e.map(vh).join(" "):t}},xh={...Il,color:yu,backgroundColor:yu,outlineColor:yu,fill:yu,stroke:yu,borderColor:yu,borderTopColor:yu,borderRightColor:yu,borderBottomColor:yu,borderLeftColor:yu,filter:yh,WebkitFilter:yh},wh=t=>xh[t];function _h(t,e){let n=wh(t);return n!==yh&&(n=Iu),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const Ch=t=>/^0[^.\s]+$/.test(t);function Sh(t){return"number"==typeof t?0===t:null!==t?"none"===t||"0"===t||Ch(t):void 0}function kh(t,e){return t[e]||t.default||t}const Th=!1,jh=(t,e,n,r={})=>i=>{const o=kh(r,t)||{},s=o.delay||r.delay||0;let{elapsed:a=0}=r;a-=Wc(s);const l=function(t,e,n,r){const i=gh(e,n);let o;o=Array.isArray(n)?[...n]:[null,n];const s=void 0!==r.from?r.from:t.get();let a;const l=[];for(let c=0;c<o.length;c++)null===o[c]&&(o[c]=0===c?s:o[c-1]),Sh(o[c])&&l.push(c),"string"==typeof o[c]&&"none"!==o[c]&&"0"!==o[c]&&(a=o[c]);if(i&&l.length&&a)for(let c=0;c<l.length;c++)o[l[c]]=_h(e,a);return o}(e,t,n,o),c=l[0],u=l[l.length-1],h=gh(t,c),d=gh(t,u);let p={keyframes:l,velocity:e.getVelocity(),ease:"easeOut",...o,delay:-a,onUpdate:t=>{e.set(t),o.onUpdate&&o.onUpdate(t)},onComplete:()=>{i(),o.onComplete&&o.onComplete()}};if(function({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:i,repeat:o,repeatType:s,repeatDelay:a,from:l,elapsed:c,...u}){return!!Object.keys(u).length}(o)||(p={...p,...fh(t,p)}),p.duration&&(p.duration=Wc(p.duration)),p.repeatDelay&&(p.repeatDelay=Wc(p.repeatDelay)),!h||!d||Xc||!1===o.type||Th)return function({keyframes:t,delay:e,onUpdate:n,onComplete:r}){const i=()=>(n&&n(t[t.length-1]),r&&r(),{time:0,speed:1,duration:0,play:hc,pause:hc,stop:hc,then:t=>(t(),Promise.resolve()),cancel:hc,complete:hc});return e?ah({keyframes:[0,1],duration:0,delay:e,onComplete:i}):i()}(p);if(!r.isHandoff&&e.owner&&e.owner.current instanceof HTMLElement&&!e.owner.getProps().onUpdate){const n=uh(e,t,p);if(n)return n}return ah(p)};function Oh(t){return!(!ul(t)||!t.add)}const Eh=t=>/^\-?\d*\.?\d+$/.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 Ph{constructor(t,e={}){this.version="10.18.0",this.timeDelta=0,this.lastUpdated=0,this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(t,e=!0)=>{this.prev=this.current,this.current=t;const{delta:n,timestamp:r}=mc;this.lastUpdated!==r&&(this.timeDelta=n,this.lastUpdated=r,fc.postRender(this.scheduleVelocityCheck)),this.prev!==this.current&&this.events.change&&this.events.change.notify(this.current),this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()),e&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.scheduleVelocityCheck=()=>fc.postRender(this.velocityCheck),this.velocityCheck=({timestamp:t})=>{t!==this.lastUpdated&&(this.prev=this.current,this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=t,this.canTrackVelocity=(t=>!isNaN(parseFloat(t)))(this.current),this.owner=e.owner}onChange(t){return this.on("change",t)}on(t,e){this.events[t]||(this.events[t]=new Mh);const n=this.events[t].add(e);return"change"===t?()=>{n(),fc.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t,e=!0){e&&this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t,e)}setWithVelocity(t,e,n){this.set(e),this.prev=t,this.timeDelta=n}jump(t){this.updateAndNotify(t),this.prev=t,this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?Yu(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(t){return this.stop(),new Promise(e=>{this.hasAnimated=!0,this.animation=t(e),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Ah(t,e){return new Ph(t,e)}const Dh=t=>e=>e.test(t),Ih=[bl,El,Ol,jl,Pl,Ml,{test:t=>"auto"===t,parse:t=>t}],Rh=t=>Ih.find(Dh(t)),zh=[...Ih,yu,Iu],Lh=t=>zh.find(Dh(t));function Fh(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Ah(n))}function Nh(t,e){return e?(e[t]||e.default||e).from:void 0}function Bh({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,r}function Vh(t,e){const n=t.get();if(!Array.isArray(e))return n!==e;for(let r=0;r<e.length;r++)if(e[r]!==n)return!0}function $h(t,e,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:o=t.getDefaultTransition(),transitionEnd:s,...a}=t.makeTargetAnimatable(e);const l=t.getValue("willChange");r&&(o=r);const c=[],u=i&&t.animationState&&t.animationState.getState()[i];for(const h in a){const e=t.getValue(h),r=a[h];if(!e||void 0===r||u&&Bh(u,h))continue;const i={delay:n,elapsed:0,...kh(o||{},h)};if(window.HandoffAppearAnimations){const n=t.getProps()[Ba];if(n){const t=window.HandoffAppearAnimations(n,h,e,fc);null!==t&&(i.elapsed=t,i.isHandoff=!0)}}let s=!i.isHandoff&&!Vh(e,r);if("spring"===i.type&&(e.getVelocity()||i.velocity)&&(s=!1),e.animation&&(s=!1),s)continue;e.start(jh(h,e,r,t.shouldReduceMotion&&ll.has(h)?{type:!1}:i));const d=e.animation;Oh(l)&&(l.add(h),d.then(()=>l.remove(h))),c.push(d)}return s&&Promise.all(c).then(()=>{s&&function(t,e){const n=Vc(t,e);let{transitionEnd:r={},transition:i={},...o}=n?t.makeTargetAnimatable(n,!1):{};o={...o,...r};for(const s in o)Fh(t,s,ac(o[s]))}(t,s)}),c}function Hh(t,e,n={}){const r=Vc(t,e,n.custom);let{transition:i=t.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);const o=r?()=>Promise.all($h(t,r,n)):()=>Promise.resolve(),s=t.variantChildren&&t.variantChildren.size?(r=0)=>{const{delayChildren:o=0,staggerChildren:s,staggerDirection:a}=i;return function(t,e,n=0,r=0,i=1,o){const s=[],a=(t.variantChildren.size-1)*r,l=1===i?(t=0)=>t*r:(t=0)=>a-t*r;return Array.from(t.variantChildren).sort(Wh).forEach((t,r)=>{t.notify("AnimationStart",e),s.push(Hh(t,e,{...o,delay:n+l(r)}).then(()=>t.notify("AnimationComplete",e)))}),Promise.all(s)}(t,e,o+r,s,a,n)}:()=>Promise.resolve(),{when:a}=i;if(a){const[t,e]="beforeChildren"===a?[o,s]:[s,o];return t().then(()=>e())}return Promise.all([o(),s(n.delay)])}function Wh(t,e){return t.sortNodePosition(e)}const Uh=[...Wa].reverse(),Xh=Wa.length;function Yh(t){return e=>Promise.all(e.map(({animation:e,options:n})=>function(t,e,n={}){let r;if(t.notify("AnimationStart",e),Array.isArray(e)){const i=e.map(e=>Hh(t,e,n));r=Promise.all(i)}else if("string"==typeof e)r=Hh(t,e,n);else{const i="function"==typeof e?Vc(t,e,n.custom):e;r=Promise.all($h(t,i,n))}return r.then(()=>t.notify("AnimationComplete",e))}(t,e,n)))}function Gh(t){let e=Yh(t);const n={animate:Kh(!0),whileInView:Kh(),whileHover:Kh(),whileTap:Kh(),whileDrag:Kh(),whileFocus:Kh(),exit:Kh()};let r=!0;const i=(e,n)=>{const r=Vc(t,n);if(r){const{transition:t,transitionEnd:n,...i}=r;e={...e,...i,...n}}return e};function o(o,s){const a=t.getProps(),l=t.getVariantContext(!0)||{},c=[],u=new Set;let h={},d=1/0;for(let e=0;e<Xh;e++){const p=Uh[e],f=n[p],g=void 0!==a[p]?a[p]:l[p],m=$a(g),v=p===s?f.isActive:null;!1===v&&(d=e);let b=g===l[p]&&g!==a[p]&&m;if(b&&r&&t.manuallyAnimateOnMount&&(b=!1),f.protectedKeys={...h},!f.isActive&&null===v||!g&&!f.prevProp||Ha(g)||"boolean"==typeof g)continue;let y=qh(f.prevProp,g)||p===s&&f.isActive&&!b&&m||e>d&&m,x=!1;const w=Array.isArray(g)?g:[g];let _=w.reduce(i,{});!1===v&&(_={});const{prevResolvedValues:C={}}=f,S={...C,..._},k=t=>{y=!0,u.has(t)&&(x=!0,u.delete(t)),f.needsAnimating[t]=!0};for(const t in S){const e=_[t],n=C[t];if(h.hasOwnProperty(t))continue;let r=!1;r=sc(e)&&sc(n)?!Bc(e,n):e!==n,r?void 0!==e?k(t):u.add(t):void 0!==e&&u.has(t)?k(t):f.protectedKeys[t]=!0}f.prevProp=g,f.prevResolvedValues=_,f.isActive&&(h={...h,..._}),r&&t.blockInitialAnimation&&(y=!1),y&&(!b||x)&&c.push(...w.map(t=>({animation:t,options:{type:p,...o}})))}if(u.size){const e={};u.forEach(n=>{const r=t.getBaseTarget(n);void 0!==r&&(e[n]=r)}),c.push({animation:e})}let p=!!c.length;return r&&(!1===a.initial||a.initial===a.animate)&&!t.manuallyAnimateOnMount&&(p=!1),r=!1,p?e(c):Promise.resolve()}return{animateChanges:o,setActive:function(e,r,i){var s;if(n[e].isActive===r)return Promise.resolve();null===(s=t.variantChildren)||void 0===s||s.forEach(t=>{var n;return null===(n=t.animationState)||void 0===n?void 0:n.setActive(e,r)}),n[e].isActive=r;const a=o(i,e);for(const t in n)n[t].protectedKeys={};return a},setAnimateFunction:function(n){e=n(t)},getState:()=>n}}function qh(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!Bc(e,t)}function Kh(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}let Zh=0;const Jh={animation:{Feature:class extends Ec{constructor(t){super(t),t.animationState||(t.animationState=Gh(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();this.unmount(),Ha(t)&&(this.unmount=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:e}=this.node.prevProps||{};t!==e&&this.updateAnimationControlsSubscription()}unmount(){}}},exit:{Feature:class extends Ec{constructor(){super(...arguments),this.id=Zh++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:e,custom:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;const i=this.node.animationState.setActive("exit",!t,{custom:n??this.node.getProps().custom});e&&!t&&i.then(()=>e(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}}};const Qh=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function td(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);if(o){const t=o.trim();return Eh(t)?parseFloat(t):t}return gl(i)?td(i,e,n+1):i}const ed=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),nd=t=>ed.has(t),rd=t=>t===bl||t===El,id=(t,e)=>parseFloat(t.split(", ")[e]),od=(t,e)=>(n,{transform:r})=>{if("none"===r||!r)return 0;const i=r.match(/^matrix3d\((.+)\)$/);if(i)return id(i[1],e);{const e=r.match(/^matrix\((.+)\)$/);return e?id(e[1],t):0}},sd=new Set(["x","y","z"]),ad=al.filter(t=>!sd.has(t));const ld={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:od(4,13),y:od(5,14)};ld.translateX=ld.x,ld.translateY=ld.y;const cd=(t,e,n={},r={})=>{e={...e},r={...r};const i=Object.keys(e).filter(nd);let o=[],s=!1;const a=[];if(i.forEach(i=>{const l=t.getValue(i);if(!t.hasValue(i))return;let c=n[i],u=Rh(c);const h=e[i];let d;if(sc(h)){const t=h.length,e=null===h[0]?1:0;c=h[e],u=Rh(c);for(let n=e;n<t&&null!==h[n];n++)d?Hc(Rh(h[n])===d):d=Rh(h[n])}else d=Rh(h);if(u!==d)if(rd(u)&&rd(d)){const t=l.get();"string"==typeof t&&l.set(parseFloat(t)),"string"==typeof h?e[i]=parseFloat(h):Array.isArray(h)&&d===El&&(e[i]=h.map(parseFloat))}else null!=u&&u.transform&&null!=d&&d.transform&&(0===c||0===h)?0===c?l.set(d.transform(c)):e[i]=u.transform(h):(s||(o=function(t){const e=[];return ad.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.render(),e}(t),s=!0),a.push(i),r[i]=void 0!==r[i]?r[i]:e[i],l.jump(h))}),a.length){const n=a.indexOf("height")>=0?window.pageYOffset:null,i=((t,e,n)=>{const r=e.measureViewportBox(),i=e.current,o=getComputedStyle(i),{display:s}=o,a={};"none"===s&&e.setStaticValue("display",t.display||"block"),n.forEach(t=>{a[t]=ld[t](r,o)}),e.render();const l=e.measureViewportBox();return n.forEach(n=>{const r=e.getValue(n);r&&r.jump(a[n]),t[n]=ld[n](l,o)}),t})(e,t,a);return o.length&&o.forEach(([e,n])=>{t.getValue(e).set(n)}),t.render(),za&&null!==n&&window.scrollTo({top:n}),{target:i,transitionEnd:r}}return{target:e,transitionEnd:r}};function ud(t,e,n,r){return(t=>Object.keys(t).some(nd))(e)?cd(t,e,n,r):{target:e,transitionEnd:r}}const hd=(t,e,n,r)=>{const i=function(t,{...e},n){const r=t.current;if(!(r instanceof Element))return{target:e,transitionEnd:n};n&&(n={...n}),t.values.forEach(t=>{const e=t.get();if(!gl(e))return;const n=td(e,r);n&&t.set(n)});for(const i in e){const t=e[i];if(!gl(t))continue;const o=td(t,r);o&&(e[i]=o,n||(n={}),void 0===n[i]&&(n[i]=t))}return{target:e,transitionEnd:n}}(t,e,r);return ud(t,e=i.target,n,r=i.transitionEnd)},dd={current:null},pd={current:!1};const fd=new WeakMap,gd=Object.keys(Za),md=gd.length,vd=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],bd=Ua.length;class yd{constructor({parent:t,props:e,presenceContext:n,reducedMotionConfig:r,visualState:i},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.scheduleRender=()=>fc.render(this.render,!1,!0);const{latestValues:s,renderState:a}=i;this.latestValues=s,this.baseTarget={...s},this.initialValues=e.initial?{...s}:{},this.renderState=a,this.parent=t,this.props=e,this.presenceContext=n,this.depth=t?t.depth+1:0,this.reducedMotionConfig=r,this.options=o,this.isControllingVariants=Xa(e),this.isVariantNode=Ya(e),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!(!t||!t.current);const{willChange:l,...c}=this.scrapeMotionValuesFromProps(e,{});for(const u in c){const t=c[u];void 0!==s[u]&&ul(t)&&(t.set(s[u],!1),Oh(l)&&l.add(u))}}scrapeMotionValuesFromProps(t,e){return{}}mount(t){this.current=t,fd.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((t,e)=>this.bindToMotionValue(e,t)),pd.current||function(){if(pd.current=!0,za)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>dd.current=t.matches;t.addListener(e),e()}else dd.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||dd.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){fd.delete(this.current),this.projection&&this.projection.unmount(),gc(this.notifyUpdate),gc(this.render),this.valueSubscriptions.forEach(t=>t()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features)this.features[t].unmount();this.current=null}bindToMotionValue(t,e){const n=ll.has(t),r=e.on("change",e=>{this.latestValues[t]=e,this.props.onUpdate&&fc.update(this.notifyUpdate,!1,!0),n&&this.projection&&(this.projection.isTransformDirty=!0)}),i=e.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(t,()=>{r(),i()})}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}loadFeatures({children:t,...e},n,r,i){let o,s;for(let a=0;a<md;a++){const t=gd[a],{isEnabled:n,Feature:r,ProjectionNode:i,MeasureLayout:l}=Za[t];i&&(o=i),n(e)&&(!this.features[t]&&r&&(this.features[t]=new r(this)),l&&(s=l))}if(("html"===this.type||"svg"===this.type)&&!this.projection&&o){this.projection=new o(this.latestValues,this.parent&&this.parent.projection);const{layoutId:t,layout:n,drag:r,dragConstraints:s,layoutScroll:a,layoutRoot:l}=e;this.projection.setOptions({layoutId:t,layout:n,alwaysMeasureLayout:!!r||s&&Va(s),visualElement:this,scheduleRender:()=>this.scheduleRender(),animationType:"string"==typeof n?n:"both",initialPromotionConfig:i,layoutScroll:a,layoutRoot:l})}return s}updateFeatures(){for(const t in this.features){const e=this.features[t];e.isMounted?e.update():(e.mount(),e.isMounted=!0)}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,e){this.latestValues[t]=e}makeTargetAnimatable(t,e=!0){return this.makeTargetAnimatableFromInstance(t,this.props,e)}update(t,e){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let n=0;n<vd.length;n++){const e=vd[n];this.propEventSubscriptions[e]&&(this.propEventSubscriptions[e](),delete this.propEventSubscriptions[e]);const r=t["on"+e];r&&(this.propEventSubscriptions[e]=this.on(e,r))}this.prevMotionValues=function(t,e,n){const{willChange:r}=e;for(const i in e){const o=e[i],s=n[i];if(ul(o))t.addValue(i,o),Oh(r)&&r.add(i);else if(ul(s))t.addValue(i,Ah(o,{owner:t})),Oh(r)&&r.remove(i);else if(s!==o)if(t.hasValue(i)){const e=t.getValue(i);!e.hasAnimated&&e.set(o)}else{const e=t.getStaticValue(i);t.addValue(i,Ah(void 0!==e?e:o,{owner:t}))}}for(const i in n)void 0===e[i]&&t.removeValue(i);return e}(this,this.scrapeMotionValuesFromProps(t,this.prevProps),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}getVariantContext(t=!1){if(t)return this.parent?this.parent.getVariantContext():void 0;if(!this.isControllingVariants){const t=this.parent&&this.parent.getVariantContext()||{};return void 0!==this.props.initial&&(t.initial=this.props.initial),t}const e={};for(let n=0;n<bd;n++){const t=Ua[n],r=this.props[t];($a(r)||!1===r)&&(e[t]=r)}return e}addVariantChild(t){const e=this.getClosestVariantNode();if(e)return e.variantChildren&&e.variantChildren.add(t),()=>e.variantChildren.delete(t)}addValue(t,e){e!==this.values.get(t)&&(this.removeValue(t),this.bindToMotionValue(t,e)),this.values.set(t,e),this.latestValues[t]=e.get()}removeValue(t){this.values.delete(t);const e=this.valueSubscriptions.get(t);e&&(e(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,e){if(this.props.values&&this.props.values[t])return this.props.values[t];let n=this.values.get(t);return void 0===n&&void 0!==e&&(n=Ah(e,{owner:this}),this.addValue(t,n)),n}readValue(t){var e;return void 0===this.latestValues[t]&&this.current?null!==(e=this.getBaseTargetFromProps(this.props,t))&&void 0!==e?e:this.readValueFromInstance(this.current,t,this.options):this.latestValues[t]}setBaseTarget(t,e){this.baseTarget[t]=e}getBaseTarget(t){var e;const{initial:n}=this.props,r="string"==typeof n||"object"==typeof n?null===(e=ic(this.props,n))||void 0===e?void 0:e[t]:void 0;if(n&&void 0!==r)return r;const i=this.getBaseTargetFromProps(this.props,t);return void 0===i||ul(i)?void 0!==this.initialValues[t]&&void 0===r?void 0:this.baseTarget[t]:i}on(t,e){return this.events[t]||(this.events[t]=new Mh),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}}class xd extends yd{sortInstanceNodePosition(t,e){return 2&t.compareDocumentPosition(e)?1:-1}getBaseTargetFromProps(t,e){return t.style?t.style[e]:void 0}removeValueFromRenderState(t,{vars:e,style:n}){delete e[t],delete n[t]}makeTargetAnimatableFromInstance({transition:t,transitionEnd:e,...n},{transformValues:r},i){let o=function(t,e,n){const r={};for(const i in t){const t=Nh(i,e);if(void 0!==t)r[i]=t;else{const t=n.getValue(i);t&&(r[i]=t.get())}}return r}(n,t||{},this);if(r&&(e&&(e=r(e)),n&&(n=r(n)),o&&(o=r(o))),i){!function(t,e,n){var r,i;const o=Object.keys(e).filter(e=>!t.hasValue(e)),s=o.length;if(s)for(let a=0;a<s;a++){const s=o[a],l=e[s];let c=null;Array.isArray(l)&&(c=l[0]),null===c&&(c=null!==(i=null!==(r=n[s])&&void 0!==r?r:t.readValue(s))&&void 0!==i?i:e[s]),null!=c&&("string"==typeof c&&(Eh(c)||Ch(c))?c=parseFloat(c):!Lh(c)&&Iu.test(l)&&(c=_h(s,l)),t.addValue(s,Ah(c,{owner:t})),void 0===n[s]&&(n[s]=c),null!==c&&t.setBaseTarget(s,c))}}(this,n,o);const t=hd(this,n,o,e);e=t.transitionEnd,n=t.target}return{transition:t,transitionEnd:e,...n}}}class wd extends xd{constructor(){super(...arguments),this.type="html"}readValueFromInstance(t,e){if(ll.has(e)){const t=wh(e);return t&&t.default||0}{const n=function(t){return window.getComputedStyle(t)}(t),r=(fl(e)?n.getPropertyValue(e):n[e])||0;return"string"==typeof r?r.trim():r}}measureInstanceViewportBox(t,{transformPagePoint:e}){return 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)}build(t,e,n,r){Rl(t,e,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,e){return nc(t,e)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;ul(t)&&(this.childSubscription=t.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}renderInstance(t,e,n,r){Ql(t,e,n,r)}}class _d extends xd{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(ll.has(e)){const t=wh(e);return t&&t.default||0}return e=tc.has(e)?e:Na(e),t.getAttribute(e)}measureInstanceViewportBox(){return{x:{min:0,max:0},y:{min:0,max:0}}}scrapeMotionValuesFromProps(t,e){return rc(t,e)}build(t,e,n,r){Gl(t,e,n,this.isSVGTag,r.transformTemplate)}renderInstance(t,e,n,r){ec(t,e,0,r)}mount(t){this.isSVGTag=Kl(t.tagName),super.mount(t)}}const Cd=function(t){function e(e,n={}){return nl(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){return{...ol(t)?bc:yc,preloadedFeatures:n,useRender:Jl(e),createVisualElement:r,Component:t}});function Sd(){const t=(0,i.useRef)(!1);return La(()=>(t.current=!0,()=>{t.current=!1}),[]),t}class kd 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 Td({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:s,left:a}=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: ${s}px !important;\n left: ${a}px !important;\n }\n `),()=>{document.head.removeChild(l)}},[e]),i.createElement(kd,{isPresent:e,childRef:r,sizeRef:o},i.cloneElement(t,{ref:r}))}const jd=({children:t,initial:e,isPresent:n,onExitComplete:r,custom:o,presenceAffectsLayout:s,mode:a})=>{const l=oc(Od),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))}),s?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"===a&&(t=i.createElement(Td,{isPresent:n},t)),i.createElement(Ra.Provider,{value:u},t)};function Od(){return new Map}const Ed=t=>t.key||"";const Md=({children:t,custom:e,initial:n=!0,onExitComplete:r,exitBeforeEnter:o,presenceAffectsLayout:s=!0,mode:a="sync"})=>{const l=(0,i.useContext)(Qa).forceRender||function(){const t=Sd(),[e,n]=(0,i.useState)(0),r=(0,i.useCallback)(()=>{t.current&&n(e+1)},[e]);return[(0,i.useCallback)(()=>fc.postRender(r),[r]),e]}()[0],c=Sd(),u=function(t){const e=[];return i.Children.forEach(t,t=>{(0,i.isValidElement)(t)&&e.push(t)}),e}(t);let h=u;const d=(0,i.useRef)(new Map).current,p=(0,i.useRef)(h),f=(0,i.useRef)(new Map).current,g=(0,i.useRef)(!0);if(La(()=>{g.current=!1,function(t,e){t.forEach(t=>{const n=Ed(t);e.set(n,t)})}(u,f),p.current=h}),function(t){(0,i.useEffect)(()=>()=>t(),[])}(()=>{g.current=!0,f.clear(),d.clear()}),g.current)return i.createElement(i.Fragment,null,h.map(t=>i.createElement(jd,{key:Ed(t),isPresent:!0,initial:!!n&&void 0,presenceAffectsLayout:s,mode:a},t)));h=[...h];const m=p.current.map(Ed),v=u.map(Ed),b=m.length;for(let i=0;i<b;i++){const t=m[i];-1===v.indexOf(t)&&!d.has(t)&&d.set(t,void 0)}return"wait"===a&&d.size&&(h=[]),d.forEach((t,n)=>{if(-1!==v.indexOf(n))return;const o=f.get(n);if(!o)return;const g=m.indexOf(n);let b=t;if(!b){const t=()=>{d.delete(n);const t=Array.from(f.keys()).filter(t=>!v.includes(t));if(t.forEach(t=>f.delete(t)),p.current=u.filter(e=>{const r=Ed(e);return r===n||t.includes(r)}),!d.size){if(!1===c.current)return;l(),r&&r()}};b=i.createElement(jd,{key:Ed(o),isPresent:!1,onExitComplete:t,custom:e,presenceAffectsLayout:s,mode:a},o),d.set(n,b)}h.splice(g,0,b)}),h=h.map(t=>{const e=t.key;return d.has(e)?t:i.createElement(jd,{key:Ed(t),isPresent:!0,presenceAffectsLayout:s,mode:a},t)}),i.createElement(i.Fragment,null,d.size?h:h.map(t=>(0,i.cloneElement)(t)))};function Pd({children:t,features:e,strict:n=!1}){const[,r]=(0,i.useState)(!Ad(e)),o=(0,i.useRef)(void 0);if(!Ad(e)){const{renderer:t,...n}=e;o.current=t,Ja(n)}return(0,i.useEffect)(()=>{Ad(e)&&e().then(({renderer:t,...e})=>{Ja(e),o.current=t,r(!0)})},[]),i.createElement(Fa.Provider,{value:{renderer:o.current,strict:n}},t)}function Ad(t){return"function"==typeof t}const Dd={renderer:(t,e)=>ol(t)?new _d(e,{enableHardwareAcceleration:!1}):new wd(e,{enableHardwareAcceleration:!0}),...Jh,...Nc},Id=typeof document<"u"?i.useLayoutEffect:()=>{},Rd=(String(Math.round(1e10*Math.random())),i.createContext(!1));typeof window<"u"&&window.document&&window.document.createElement;function zd(){return!1}function Ld(){return!0}function Fd(t){return()=>{}}function Nd(){return"function"==typeof i.useSyncExternalStore?i.useSyncExternalStore(Fd,zd,Ld):(0,i.useContext)(Rd)}i.useId;let Bd=new Map;function Vd(t,e){if(t===e)return t;let n=Bd.get(t);if(n)return n(e),e;let r=Bd.get(e);return r?(r(t),t):e}function $d(...t){return(...e)=>{for(let n of t)"function"==typeof n&&n(...e)}}const Hd=t=>{var e;return null!==(e=null==t?void 0:t.ownerDocument)&&void 0!==e?e:document},Wd=t=>t&&"window"in t&&t.window===t?t:Hd(t).defaultView||window;function Ud(...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]=$d(n,i):"className"!==t&&"UNSAFE_className"!==t||"string"!=typeof n||"string"!=typeof i?"id"===t&&n&&i?e.id=Vd(n,i):e[t]=void 0!==i?i:n:e[t]=ei(n,i)}}return e}function Xd(t){if(function(){if(null==Yd){Yd=!1;try{document.createElement("div").focus({get preventScroll(){return Yd=!0,!0}})}catch{}}return Yd}())t.focus({preventScroll:!0});else{let e=function(t){let e=t.parentNode,n=[],r=document.scrollingElement||document.documentElement;for(;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 Yd=null;function Gd(){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)}function qd(){return function(t){var e;return!(typeof window>"u"||null==window.navigator)&&((null===(e=window.navigator.userAgentData)||void 0===e?void 0:e.brands.some(e=>t.test(e.brand)))||t.test(window.navigator.userAgent))}(/Android/i)}let Kd=new Map,Zd=new Set;function Jd(){if(typeof window>"u")return;function t(t){return"propertyName"in t}let e=n=>{if(!t(n)||!n.target)return;let r=Kd.get(n.target);if(r&&(r.delete(n.propertyName),0===r.size&&(n.target.removeEventListener("transitioncancel",e),Kd.delete(n.target)),0===Kd.size)){for(let t of Zd)t();Zd.clear()}};document.body.addEventListener("transitionrun",n=>{if(!t(n)||!n.target)return;let r=Kd.get(n.target);r||(r=new Set,Kd.set(n.target,r),n.target.addEventListener("transitioncancel",e,{once:!0})),r.add(n.propertyName)}),document.body.addEventListener("transitionend",e)}function Qd(){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 s=(null===(o=t.current.get(r))||void 0===o?void 0:o.fn)||r;e.removeEventListener(n,s,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 tp(t){const e=(0,i.useRef)(null);return(0,i.useMemo)(()=>({get current(){return e.current},set current(n){e.current=n,"function"==typeof t?t(n):t&&(t.current=n)}}),[t])}typeof document<"u"&&("loading"!==document.readyState?Jd():document.addEventListener("DOMContentLoaded",Jd));let ep=typeof document<"u"&&window.visualViewport;function np(){return{width:ep&&(null==ep?void 0:ep.width)||window.innerWidth,height:ep&&(null==ep?void 0:ep.height)||window.innerHeight}}function rp(t,e,n){let[r,o]=(0,i.useState)(t||e),s=(0,i.useRef)(void 0!==t),a=void 0!==t;(0,i.useEffect)(()=>{s.current;s.current=a},[a]);let l=a?t:r,c=(0,i.useCallback)((t,...e)=>{let r=(t,...e)=>{n&&(Object.is(l,t)||n(t,...e)),a||(l=t)};"function"==typeof t?o((n,...i)=>{let o=t(a?l:n,...i);return r(o,...e),a?n:o}):(a||o(t),r(t,...e))},[a,l,n]);return[l,c]}function ip(t,e=-1/0,n=1/0){return Math.min(Math.max(t,e),n)}function op(t,e){let n=t,r=e.toString(),i=r.indexOf("."),o=i>=0?r.length-i:0;if(o>0){let t=Math.pow(10,o);n=Math.round(n*t)/t}return n}function sp(t,e,n=10){const r=Math.pow(n,e);return Math.round(t*r)/r}var ap={};const lp=Hr(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));!function(t){var e,n=n||{version:"5.3.0"};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 lp.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=lp.implForWrapper,n.nodeCanvas=lp.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,s=new Uint8Array(this.imageBuffer,0,o),a=new Uint8ClampedArray(this.imageBuffer,0,o);t.readPixels(0,0,r,i,t.RGBA,t.UNSIGNED_BYTE,s);var l=new ImageData(a,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 a<"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)?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,s=Math.PI/2;n.util={cos:function(t){if(0===t)return 1;switch(t<0&&(t=-t),t/s){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/s){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),s=n.util.calcAngleBetweenVectors(i,o),a=s*(0===n.util.calcAngleBetweenVectors(n.util.rotateVector(i,s),o)?1:-1)/2;return{vector:n.util.getHatVector(n.util.rotateVector(i,a)),angle:s}},projectStrokeOnPoints:function(t,e,r){var i=[],o=e.strokeWidth/2,s=e.strokeUniform?new n.Point(1/e.scaleX,1/e.scaleY):new n.Point(1,1),a=function(t){var e=o/Math.hypot(t.x,t.y);return new n.Point(t.x*e*s.x,t.y*e*s.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?a(n.util.createVector(h,d)).addEquals(d):t[t.length-1]):c===t.length-1?(u=t[c-1],h=r?a(n.util.createVector(u,d)).addEquals(d):t[0]):(u=t[c-1],h=t[c+1]);var p,f,g=n.util.getBisector(d,u,h),m=g.vector,v=g.angle;if("miter"===e.strokeLineJoin&&(p=-o/Math.sin(v/2),f=new n.Point(m.x*p*s.x,m.y*p*s.y),Math.hypot(f.x,f.y)/o<=e.strokeMiterLimit))return i.push(d.add(f)),void i.push(d.subtract(f));p=-o*Math.SQRT2,f=new n.Point(m.x*p*s.x,m.y*p*s.y),i.push(d.add(f)),i.push(d.subtract(f))}),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),s=n.util.array.max(i)-o,a=[t[0].y,t[1].y,t[2].y,t[3].y],l=n.util.array.min(a);return{left:o,top:l,width:s,height:n.util.array.max(a)-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,s=t||n.window;for(r=0;r<o;++r)s=s[i[r]];return s},loadImage:function(t,e,r,i){if(t){var o=n.util.createImage(),s=function(){e&&e.call(r,o,!1),o=o.onload=o.onerror=null};o.onload=s,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,s)),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=[],s=0,a=(t=t||[]).length;function l(){++s===a&&e&&e(o.filter(function(t){return t}))}a?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===s&&e&&e(i)}var i=[],o=0,s=(t=t||[]).length;s?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]),s=i(t[0],2)+i(t[1],2),a=e(s),l=(t[0]*t[3]-t[2]*t[1])/a,c=r(t[0]*t[2]+t[1]*t[3],s);return{angle:n/o,scaleX:a,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,s=n.util.degreesToRadians;return t.skewX&&(i=o(i,[1,0,Math.tan(s(t.skewX)),1],!0)),t.skewY&&(i=o(i,[1,Math.tan(s(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,s=t.getImageData(e,n,2*r||1,2*r||1),a=s.data.length;for(i=3;i<a&&!1!==(o=s.data[i]<=0);i+=4);return s=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,s=[{x:-i,y:-o},{x:i,y:-o},{x:-i,y:o},{x:i,y:o}],a=n.util.calcDimensionsMatrix(r),l=n.util.makeBoundingBoxFromPoints(s,a);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.textBackgroundColor!==e.textBackgroundColor||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={},s=[],a=0;a<r.length;a++)if(t[a])for(var l=0;l<r[a].length;l++){i++;var c=t[a][l];if(c&&Object.keys(c).length>0)n.util.hasStyleChanged(o,c,!0)?s.push({start:i,end:i+1,style:c}):s[s.length-1].end++;o=c||{}}else i+=r[a].length;return s},stylesFromArray:function(t,e){if(!Array.isArray(t))return t;for(var n=e.split("\n"),r=-1,i=0,o={},s=0;s<n.length;s++)for(var a=0;a<n[s].length;a++)r++,t[i]&&t[i].start<=r&&r<t[i].end&&(o[s]=o[s]||{},o[s][a]=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,s,a,l,c,u,h){var d=n.util.cos(t),p=n.util.sin(t),f=n.util.cos(e),g=n.util.sin(e),m=r*o*f-i*s*g+a,v=i*o*f+r*s*g+l;return["C",u+c*(-r*o*p-i*s*d),h+c*(-i*o*p+r*s*d),m+c*(r*o*g+i*s*f),v+c*(i*o*g-r*s*f),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 s(t,e,r){for(var s=r[1],a=r[2],l=r[3],c=r[4],u=r[5],h=function(t,e,r,s,a,l,c){var u=Math.PI,h=c*u/180,d=n.util.sin(h),p=n.util.cos(h),f=0,g=0,m=-p*t*.5-d*e*.5,v=-p*e*.5+d*t*.5,b=(r=Math.abs(r))*r,y=(s=Math.abs(s))*s,x=v*v,w=m*m,_=b*y-b*x-y*w,C=0;if(_<0){var S=Math.sqrt(1-_/(b*y));r*=S,s*=S}else C=(a===l?-1:1)*Math.sqrt(_/(b*x+y*w));var k=C*r*v/s,T=-C*s*m/r,j=p*k-d*T+.5*t,O=d*k+p*T+.5*e,E=o(1,0,(m-k)/r,(v-T)/s),M=o((m-k)/r,(v-T)/s,(-m-k)/r,(-v-T)/s);0===l&&M>0?M-=2*u:1===l&&M<0&&(M+=2*u);for(var P=Math.ceil(Math.abs(M/u*2)),A=[],D=M/P,I=8/3*Math.sin(D/4)*Math.sin(D/4)/Math.sin(D/2),R=E+D,z=0;z<P;z++)A[z]=i(E,R,p,d,r,s,j,O,I,f,g),f=A[z][5],g=A[z][6],E=R,R+=D;return A}(r[6]-t,r[7]-e,s,a,c,u,l),d=0,p=h.length;d<p;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 a(t,e,n,r){return Math.sqrt((n-t)*(n-t)+(r-e)*(r-e))}function l(t,e,n,r,i,o,s,a){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:s*c+i*u+n*h+t*d,y:a*c+o*u+r*h+e*d}}}function c(t,e,n,r,i,o,s,a){return function(l){var c=1-l,u=3*c*c*(n-t)+6*c*l*(i-n)+3*l*l*(s-i),h=3*c*c*(r-e)+6*c*l*(o-r)+3*l*l*(a-o);return Math.atan2(h,u)}}function u(t,e,n,r,i,o){return function(s){var a=function(t){return t*t}(s),l=function(t){return 2*t*(1-t)}(s),c=function(t){return(1-t)*(1-t)}(s);return{x:i*a+n*l+t*c,y:o*a+r*l+e*c}}}function h(t,e,n,r,i,o){return function(s){var a=1-s,l=2*a*(n-t)+2*s*(i-n),c=2*a*(r-e)+2*s*(o-r);return Math.atan2(c,l)}}function d(t,e,n){var r,i,o={x:e,y:n},s=0;for(i=1;i<=100;i+=1)r=t(i/100),s+=a(o.x,o.y,r.x,r.y),o=r;return s}function p(t,e){for(var n,r,i,o=0,s=0,l=t.iterator,c={x:t.x,y:t.y},u=.01,h=t.angleFinder;s<e&&u>1e-4;)n=l(o),i=o,(r=a(c.x,c.y,n.x,n.y))+s>e?(o-=u,u/=2):(c=n,o+=u,s+=r);return n.angle=h(i),n}function f(t){for(var e,n,r,i,o=0,s=t.length,p=0,f=0,g=0,m=0,v=[],b=0;b<s;b++){switch(r={x:p,y:f,command:(e=t[b])[0]},e[0]){case"M":r.length=0,g=p=e[1],m=f=e[2];break;case"L":r.length=a(p,f,e[1],e[2]),p=e[1],f=e[2];break;case"C":n=l(p,f,e[1],e[2],e[3],e[4],e[5],e[6]),i=c(p,f,e[1],e[2],e[3],e[4],e[5],e[6]),r.iterator=n,r.angleFinder=i,r.length=d(n,p,f),p=e[5],f=e[6];break;case"Q":n=u(p,f,e[1],e[2],e[3],e[4]),i=h(p,f,e[1],e[2],e[3],e[4]),r.iterator=n,r.angleFinder=i,r.length=d(n,p,f),p=e[3],f=e[4];break;case"Z":case"z":r.destX=g,r.destY=m,r.length=a(p,f,g,m),p=g,f=m}o+=r.length,v.push(r)}return v.push({length:o,x:p,y:f}),v}n.util.joinPath=function(t){return t.map(function(t){return t.join(" ")}).join(" ")},n.util.parsePath=function(t){var i,o,s,a,l,c=[],u=[],h=n.rePathCommand,d="[-+]?(?:\\d*\\.\\d+|\\d+\\.?)(?:[eE][-+]?\\d+)?\\s*",p="("+d+")"+n.commaWsp,f="([01])"+n.commaWsp+"?",g=new RegExp(p+"?"+p+"?"+p+f+f+p+"?("+d+")","g");if(!t||!t.match)return c;for(var m,v=0,b=(l=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi)).length;v<b;v++){a=(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(a);)for(var w=1;w<x.length;w++)u.push(x[w]);else for(;s=h.exec(a);)u.push(s[0]);w=0;for(var _=u.length;w<_;w++)o=parseFloat(u[w]),isNaN(o)||m.push(o);var C=e[y.toLowerCase()],S=r[y]||y;if(m.length-1>C)for(var k=1,T=m.length;k<T;k+=C)c.push([y].concat(m.slice(k,k+C))),y=S;else c.push(m)}return c},n.util.makePathSimpler=function(t){var e,n,r,i,o,a,l=0,c=0,u=t.length,h=0,d=0,p=[];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],a=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,a=2*c-a):(o=l,a=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]=a,o=e[3],a=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],a=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,a=2*c-a):(o=l,a=c),e[0]="Q",l=e[1],c=e[2],e[1]=o,e[2]=a,e[3]=l,e[4]=c;break;case"a":e[0]="A",e[6]+=l,e[7]+=c;case"A":r=!0,p=p.concat(s(l,c,e)),l=e[6],c=e[7];break;case"z":case"Z":l=h,c=d}r||p.push(e),i=e[0]}return p},n.util.getSmoothPathFromPoints=function(t,e){var r,i=[],o=new n.Point(t[0].x,t[0].y),s=new n.Point(t[1].x,t[1].y),a=t.length,l=1,c=0,u=a>2;for(e=e||0,u&&(l=t[2].x<s.x?-1:t[2].x===s.x?0:1,c=t[2].y<s.y?-1:t[2].y===s.y?0:1),i.push(["M",o.x-l*e,o.y-c*e]),r=1;r<a;r++){if(!o.eq(s)){var h=o.midPointFrom(s);i.push(["Q",o.x,o.y,h.x,h.y])}o=t[r],r+1<t.length&&(s=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=f,n.util.getBoundsOfCurve=function(e,r,i,o,s,a,l,c){var u;if(n.cachesBoundsOfCurve&&(u=t.call(arguments),n.boundsOfCurveCache[u]))return n.boundsOfCurveCache[u];var h,d,p,f,g,m,v,b,y=Math.sqrt,x=Math.min,w=Math.max,_=Math.abs,C=[],S=[[],[]];d=6*e-12*i+6*s,h=-3*e+9*i-9*s+3*l,p=3*i-3*e;for(var k=0;k<2;++k)if(k>0&&(d=6*r-12*o+6*a,h=-3*r+9*o-9*a+3*c,p=3*o-3*r),_(h)<1e-12){if(_(d)<1e-12)continue;0<(f=-p/d)&&f<1&&C.push(f)}else!((v=d*d-4*p*h)<0)&&(0<(g=(-d+(b=y(v)))/(2*h))&&g<1&&C.push(g),0<(m=(-d-b)/(2*h))&&m<1&&C.push(m));for(var T,j,O,E=C.length,M=E;E--;)T=(O=1-(f=C[E]))*O*O*e+3*O*O*f*i+3*O*f*f*s+f*f*f*l,S[0][E]=T,j=O*O*O*r+3*O*O*f*o+3*O*f*f*a+f*f*f*c,S[1][E]=j;S[0][M]=e,S[1][M]=r,S[0][M+1]=l,S[1][M+1]=c;var P=[{x:x.apply(null,S[0]),y:x.apply(null,S[1])},{x:w.apply(null,S[0]),y:w.apply(null,S[1])}];return n.cachesBoundsOfCurve&&(n.boundsOfCurveCache[u]=P),P},n.util.getPointOnPath=function(t,e,r){r||(r=f(t));for(var i=0;e-r[i].length>0&&i<r.length-2;)e-=r[i].length,i++;var o,s=r[i],a=e/s.length,l=s.command,c=t[i];switch(l){case"M":return{x:s.x,y:s.y,angle:0};case"Z":case"z":return(o=new n.Point(s.x,s.y).lerp(new n.Point(s.destX,s.destY),a)).angle=Math.atan2(s.destY-s.y,s.destX-s.x),o;case"L":return(o=new n.Point(s.x,s.y).lerp(new n.Point(c[1],c[2]),a)).angle=Math.atan2(c[2]-s.y,c[1]-s.x),o;case"C":case"Q":return p(s,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,s=e.length;o<s;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,s=r.length;o<s;o++)e[o]=t({},r[o],i)}else if(r&&"object"==typeof r)for(var a in r)"canvas"===a||"group"===a?e[a]=null:r.hasOwnProperty(a)&&(e[a]=t({},r[a],i));else e=r;else for(var a in r)e[a]=r[a];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 s(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):void 0}n.util.createClass=function(){var n=null,r=t.call(arguments,0);function a(){this.initialize.apply(this,arguments)}"function"==typeof r[0]&&(n=r.shift()),a.superclass=n,a.subclasses=[],n&&(o.prototype=n.prototype,a.prototype=new o,n.subclasses.push(a));for(var l=0,c=r.length;l<c;l++)i(a,r[l],n);return a.prototype.initialize||(a.prototype.initialize=e),a.prototype.constructor=a,a.prototype.callSuper=s,a}}(),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 s(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=s,n.util.getElementOffset=function(t){var e,n,i=t&&t.ownerDocument,o={left:0,top:0},a={left:0,top:0},l={borderLeftWidth:"left",borderTopWidth:"top",paddingLeft:"left",paddingTop:"top"};if(!i)return a;for(var c in l)a[l[c]]+=parseInt(r(t,c),10)||0;return e=i.documentElement,typeof t.getBoundingClientRect<"u"&&(o=t.getBoundingClientRect()),n=s(t),{left:o.left+n.left-(e.clientLeft||0)+a.left,top:o.top+n.top-(e.clientTop||0)+a.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(){},s=new n.window.XMLHttpRequest,a=r.body||r.parameters;return s.onreadystatechange=function(){4===s.readyState&&(o(s),s.onreadystatechange=t)},"GET"===i&&(a=null,"string"==typeof r.parameters&&(e=function(t,e){return t+(/\?/.test(t)?"&":"?")+e}(e,r.parameters))),s.open(i,e,!0),("POST"===i||"PUT"===i)&&s.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),s.send(a),s}}(),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 s=n.window.requestAnimationFrame||n.window.webkitRequestAnimationFrame||n.window.mozRequestAnimationFrame||n.window.oRequestAnimationFrame||n.window.msRequestAnimationFrame||function(t){return n.window.setTimeout(t,1e3/60)},a=n.window.cancelAnimationFrame||n.window.clearTimeout;function l(){return s.apply(n.window,arguments)}n.util.animate=function(r){r||(r={});var s,a=!1,c=function(){var t=n.runningAnimations.indexOf(s);return t>-1&&n.runningAnimations.splice(t,1)[0]};return s=t(e(r),{cancel:function(){return a=!0,c()},currentValue:"startValue"in r?r.startValue:0,completionRate:0,durationRate:0}),n.runningAnimations.push(s),l(function(t){var e,n=t||+new Date,u=r.duration||500,h=n+u,d=r.onChange||i,p=r.abort||i,f=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(s.currentValue=m?x.slice():x,s.completionRate=w,s.durationRate=o,!a){if(p(x,w,o))return void c();if(e>h)return s.currentValue=m?b.slice():b,s.completionRate=1,s.durationRate=1,d(m?b.slice():b,1,1),f(b,1,1),void c();d(x,w,o),l(t)}}(n)}),s.cancel},n.util.requestAnimFrame=l,n.util.cancelAnimFrame=function(){return a.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 s=new n.Color(e).getSource(),a=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:s,endValue:a,byValue:a,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(a,a,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 s=0;return 0===n?r:1===(n/=o)?r+i:(s||(s=.3*o),-e(t(i,i,s,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 s=t(r,r,o,1.70158);return s.a*Math.pow(2,-10*e)*Math.sin((e*i-s.s)*(2*Math.PI)/s.p)+s.c+n},easeInOutElastic:function(n,r,i,o){var s=0;if(0===n)return r;if(2===(n/=o/2))return r+i;s||(s=o*(.3*1.5));var a=t(i,i,s,1.70158);return n<1?-.5*e(a,n,o)+r:a.a*Math.pow(2,-10*(n-=1))*Math.sin((n*o-a.s)*(2*Math.PI)/a.p)*.5+a.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,s=e.util.multiplyTransformMatrices,a={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 a?a[t]:t}function d(t,n,r,i){var a,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?s(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)a=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;a=l?n.map(o):o(n,i)}}else n="";return!l&&isNaN(a)?n:a}function p(t){return new RegExp("^("+t.join("|")+")\\b","i")}function f(t,e){var n,r,i,o,s=[];for(i=0,o=e.length;i<o;i++)n=e[i],r=t.getElementsByTagName(n),s=s.concat(Array.prototype.slice.call(r));return s}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"),s=t.getAttribute("id");if(n=new RegExp("^"+i,"i"),e=e.replace(n,""),s&&e.length&&(n=new RegExp("#"+s+"(?![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,s=t.getElementsByTagName("*");for(i=0,o=s.length;i<o;i++)if(e===(r=s[i]).getAttribute("id"))return r}e.svgValidTagNamesRegEx=p(["path","circle","polygon","polyline","ellipse","rect","line","image","text"]),e.svgViewBoxElementsRegEx=p(["symbol","image","marker","pattern","view","svg"]),e.svgInvalidAncestorsRegEx=p(["pattern","defs","symbol","metadata","clipPath","mask","desc"]),e.svgValidParentsRegEx=p(["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*\\))")+")",s=new RegExp("^\\s*(?:"+("(?:"+o+"(?:"+i+"*"+o+")*)")+"?)\\s*$"),a=new RegExp(o,"g");return function(r){var i=n.concat(),l=[];if(!r||r&&!s.test(r))return i;r.replace(a,function(r){var s=new RegExp(o).exec(r).filter(function(t){return!!t}),a=s[1],c=s.slice(2).map(parseFloat);switch(a){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,s=0;3===n.length&&(o=n[1],s=n[2]),t[0]=r,t[1]=i,t[2]=-i,t[3]=r,t[4]=o-(r*o-i*s),t[5]=s-(i*o+r*s)}(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,s,a,l,c=t.getAttribute("viewBox"),u=1,h=1,d=t.getAttribute("width"),p=t.getAttribute("height"),f=t.getAttribute("x")||0,g=t.getAttribute("y")||0,m=t.getAttribute("preserveAspectRatio")||"",v=!c||!(c=c.match(b)),y=!d||!p||"100%"===d||"100%"===p,x=v&&y,w={},_="",C=0,S=0;if(w.width=0,w.height=0,w.toBeParsed=x,v&&(f||g)&&t.parentNode&&"#document"!==t.parentNode.nodeName&&(_=" translate("+o(f)+" "+o(g)+") ",a=(t.getAttribute("transform")||"")+_,t.setAttribute("transform",a),t.removeAttribute("x"),t.removeAttribute("y")),x)return w;if(v)return w.width=o(d),w.height=o(p),w;if(n=-parseFloat(c[1]),r=-parseFloat(c[2]),i=parseFloat(c[3]),s=parseFloat(c[4]),w.minX=n,w.minY=r,w.viewBoxWidth=i,w.viewBoxHeight=s,y?(w.width=i,w.height=s):(w.width=o(d),w.height=o(p),u=w.width/i,h=w.height/s),"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),C=w.width-i*u,S=w.height-s*u,"Mid"===m.alignX&&(C/=2),"Mid"===m.alignY&&(S/=2),"Min"===m.alignX&&(C=0),"Min"===m.alignY&&(S=0)),1===u&&1===h&&0===n&&0===r&&0===f&&0===g)return w;if((f||g)&&"#document"!==t.parentNode.nodeName&&(_=" translate("+o(f)+" "+o(g)+") "),a=_+" matrix("+u+" 0 0 "+h+" "+(n*u+C)+" "+(r*h+S)+") ","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"),a=l.getAttribute("transform")+a;return l.setAttribute("transform",a),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=f(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 s,a,l,c,u=o.slice(1),h=i.getAttribute("x")||0,d=i.getAttribute("y")||0,p=v(t,u).cloneNode(!0),g=(p.getAttribute("transform")||"")+" translate("+h+", "+d+")",m=n.length,b=e.svgNS;if(y(p),/^svg$/i.test(p.nodeName)){var x=p.ownerDocument.createElementNS(b,"g");for(a=0,c=(l=p.attributes).length;a<c;a++)s=l.item(a),x.setAttributeNS(b,s.nodeName,s.nodeValue);for(;p.firstChild;)x.appendChild(p.firstChild);p=x}for(a=0,c=(l=i.attributes).length;a<c;a++)"x"!==(s=l.item(a)).nodeName&&"y"!==s.nodeName&&"xlink:href"!==s.nodeName&&"href"!==s.nodeName&&("transform"===s.nodeName?g=s.nodeValue+" "+g:p.setAttribute(s.nodeName,s.nodeValue));p.setAttribute("transform",g),p.setAttribute("instantiated_by_use","1"),p.removeAttribute("id"),i.parentNode.replaceChild(p,i),n.length===m&&r++}}(t);var s,a,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(s=0,a=(u=t.selectNodes('//*[name(.)!="svg"]')).length;s<a;s++)h[s]=u[s];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 p={};u.filter(function(t){return"clipPath"===t.nodeName.replace("svg:","")}).forEach(function(t){var n=t.getAttribute("id");p[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]=p,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],s=n[4],a=n[5],l=n[6];r&&(e.fontStyle=r),i&&(e.fontWeight=isNaN(parseFloat(i))?i:parseFloat(i)),s&&(e.fontSize=o(s)),l&&(e.fontFamily=l),a&&(e.lineHeight="normal"===a?1:a)}},getGradientDefs:function(t){var e,n=f(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,s){if(t){var a,p,f,m={};typeof s>"u"&&(s=t.getAttribute("svgUid")),t.parentNode&&e.svgValidParentsRegEx.test(t.parentNode.nodeName)&&(m=e.parseAttributes(t.parentNode,r,s));var v=r.reduce(function(e,n){return(a=t.getAttribute(n))&&(e[n]=a),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,s),e.parseStyleAttribute(t));v=n(v,b),b[u]&&t.setAttribute(u,b[u]),p=f=m.fontSize||e.Text.DEFAULT_SVG_FONT_SIZE,v[c]&&(v[c]=p=o(v[c],f));var y,x,w={};for(var _ in v)x=d(y=h(_),v[_],m,p),w[y]=x;w&&w.font&&e.parseFontDeclaration(w.font,w);var C=n(m,w);return e.svgValidParentsRegEx.test(t.nodeName)?C: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}(C)}},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 s=i[n].textContent;""!==(s=s.replace(/\/\*[\s\S]*?\*\//g,"")).trim()&&s.split("}").filter(function(t){return t.trim()}).forEach(function(t){var i=t.split("{"),s={},a=i[1].trim().split(";").filter(function(t){return t.trim()});for(n=0,r=a.length;n<r;n++){var l=a[n].split(":"),c=l[0].trim(),u=l[1].trim();s[c]=u}(t=i[0].trim()).split(",").forEach(function(t){""!==(t=t.replace(/^svg/i,"").trim())&&(o[t]?e.util.object.extend(o[t],s):o[t]=e.util.object.clone(s))})})}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 s=o.exec(i)[1];return o.lastIndex=0,n[r][this.svgUid][s]}},e.resolveGradient=function(t,e,r){var i=this.extractPropertyDefinition(t,r,"gradientDefs");if(i){var o=e.getAttribute(r+"-opacity"),s=n.Gradient.fromElement(i,t,o,this.options);t.set(r,s)}},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,s,a=this.extractPropertyDefinition(t,"clipPath","clipPaths");if(a){o=[],i=n.util.invertTransform(t.calcTransformMatrix());for(var l=a[0].parentNode,c=e;c.parentNode&&c.getAttribute("clip-path")!==t.clipPath;)c=c.parentNode;c.parentNode.appendChild(l);for(var u=0;u<a.length;u++)r=a[u],this.findTag(r).fromElement(r,this.createClipPathCallback(t,o),this.options);a=1===o.length?o[0]:new n.Group(o),s=n.util.multiplyTransformMatrices(i,a.calcTransformMatrix()),a.clipPath&&this.resolveClipPath(a,c);var h=n.util.qrDecompose(s);a.flipX=!1,a.flipY=!1,a.set("scaleX",h.scaleX),a.set("scaleY",h.scaleY),a.angle=h.angle,a.skewX=h.skewX,a.skewY=0,a.setPositionByOrigin({x:h.translateX,y:h.translateY},"center","center"),t.clipPath=a}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 s,a=(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=a/c,h=l/c;0<=u&&u<=1&&0<=h&&h<=1?(s=new n("Intersection")).appendPoint(new e.Point(t.x+u*(r.x-t.x),t.y+u*(r.y-t.y))):s=new n}else s=new n(0===a||0===l?"Coincident":"Parallel");return s},e.Intersection.intersectLinePolygon=function(t,e,r){var i,o,s,a,l=new n,c=r.length;for(a=0;a<c;a++)i=r[a],o=r[(a+1)%c],s=n.intersectLineLine(t,e,i,o),l.appendPoints(s.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 s=t[r],a=t[(r+1)%o],l=n.intersectLinePolygon(s,a,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),s=r.max(i),a=new e.Point(s.x,o.y),l=new e.Point(o.x,s.y),c=n.intersectLinePolygon(o,a,t),u=n.intersectLinePolygon(a,s,t),h=n.intersectLinePolygon(s,l,t),d=n.intersectLinePolygon(l,o,t),p=new n;return p.appendPoints(c.points),p.appendPoints(u.points),p.appendPoints(h.points),p.appendPoints(d.points),p.points.length>0&&(p.status="Intersection"),p})}(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,s,a=e.util.array.max([t,n,r]),l=e.util.array.min([t,n,r]);if(s=(a+l)/2,a===l)i=o=0;else{var c=a-l;switch(o=s>.5?c/(2-a-l):c/(a+l),a){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*s)]},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(),s=t.getSource();for(e=0;e<3;e++)r.push(Math.round(.5*o[e]+.5*s[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,s,a=(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=s=c;else{var u=c<=.5?c*(l+1):c+l-c*l,h=2*c-u;i=r(h,u,a+1/3),o=r(h,u,a),s=r(h,u,a-1/3)}return[Math.round(255*i),Math.round(255*o),Math.round(255*s),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),s=r?e.charAt(1)+e.charAt(1):e.substring(2,4),a=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(s,16),parseInt(a,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",s="top",a="right",l="bottom",c="center",u={top:l,bottom:s,left:a,right:o,center:c},h=e.util.radiansToDegrees,d=Math.sign||function(t){return(t>0)-(t<0)||+t};function p(t,e){var n=t.angle+h(Math.atan2(e.y,e.x))+360;return Math.round(n%360/45)}function f(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,s=o.getCenterPoint(),a=o.translateToOriginPoint(s,n.originX,n.originY),l=t(e,n,r,i);return o.setPositionByOrigin(a,n.originX,n.originY),l}}function x(t,e){return function(n,r,i,o){var s=e(n,r,i,o);return s&&f(t,b(n,r,i,o)),s}}function w(t,n,r,i,o){var s=t.target,a=s.controls[t.corner],l=s.canvas.getZoom(),c=s.padding/l,u=s.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-=a.offsetX,u.y-=a.offsetY,u}function _(t){return t.flipX!==t.flipY}function C(t,e,n,r,i){if(0!==t[e]){var o=i/t._getTransformedDimensions()[r]*t[n];t.set(n,o)}}function S(t,e,n,r){var i,c=e.target,u=c._getTransformedDimensions(0,c.skewY),d=w(e,e.originX,e.originY,n,r),p=Math.abs(2*d.x)-u.x,f=c.skewX;p<2?i=0:(i=h(Math.atan2(p/c.scaleX,u.y/c.scaleY)),e.originX===o&&e.originY===l&&(i=-i),e.originX===a&&e.originY===s&&(i=-i),_(c)&&(i=-i));var g=f!==i;if(g){var m=c._getTransformedDimensions().y;c.set("skewX",i),C(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),p=Math.abs(2*d.y)-u.y,f=c.skewY;p<2?i=0:(i=h(Math.atan2(p/c.scaleY,u.x/c.scaleX)),e.originX===o&&e.originY===l&&(i=-i),e.originX===a&&e.originY===s&&(i=-i),_(c)&&(i=-i));var g=f!==i;if(g){var m=c._getTransformedDimensions().x;c.set("skewY",i),C(c,"skewX","scaleX","x",m)}return g}function T(t,e,n,r,i){i=i||{};var o,s,a,l,c,h,p=e.target,f=p.lockScalingX,b=p.lockScalingY,y=i.by,x=g(t,p),_=v(p,y,x),C=e.gestureScale;if(_)return!1;if(C)s=e.scaleX*C,a=e.scaleY*C;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),p.lockScalingFlip&&(e.signX!==c||e.signY!==h))return!1;if(l=p._getTransformedDimensions(),x&&!y){var S=Math.abs(o.x)+Math.abs(o.y),k=e.original,T=S/(Math.abs(l.x*k.scaleX/p.scaleX)+Math.abs(l.y*k.scaleY/p.scaleY));s=k.scaleX*T,a=k.scaleY*T}else s=Math.abs(o.x*p.scaleX/l.x),a=Math.abs(o.y*p.scaleY/l.y);m(e)&&(s*=2,a*=2),e.signX!==c&&"y"!==y&&(e.originX=u[e.originX],s*=-1,e.signX=c),e.signY!==h&&"x"!==y&&(e.originY=u[e.originY],a*=-1,e.signY=h)}var j=p.scaleX,O=p.scaleY;return y?("x"===y&&p.set("scaleX",s),"y"===y&&p.set("scaleY",a)):(!f&&p.set("scaleX",s),!b&&p.set("scaleY",a)),j!==p.scaleX||O!==p.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 s=p(r,e);return n[s]+"-resize"},i.skewCursorStyleHandler=function(t,e,n){if(0!==e.x&&n.lockSkewingY||0!==e.y&&n.lockSkewingX)return"not-allowed";var i=p(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,s=o.translateToOriginPoint(o.getCenterPoint(),i.originX,i.originY);if(o.lockRotation)return!1;var a,l=Math.atan2(i.ey-s.y,i.ex-s.x),c=Math.atan2(r-s.y,n-s.x),u=h(c-l+i.theta);if(o.snapAngle>0){var d=o.snapAngle,p=o.snapThreshold||d,f=Math.ceil(u/d)*d,g=Math.floor(u/d)*d;Math.abs(u-g)<p?u=g:Math.abs(u-f)<p&&(u=f)}return u<0&&(u=360+u),u%=360,a=o.angle!==u,o.angle=u,a})),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),s=i.strokeWidth/(i.strokeUniform?i.scaleX:1),a=m(e)?2:1,l=i.width,c=Math.abs(o.x*a/i.scaleX)-s;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:a:(u>0&&(i=h===s?o:a),u<0&&(i=h===s?a:o),_(l)&&(i=i===o?a:o)),e.originX=i,x("skewing",y(S))(t,e,n,r))},i.skewHandlerY=function(t,e,n,r){var i,a=e.target,u=a.skewY,h=e.originX;return!a.lockSkewingY&&(0===u?i=w(e,c,c,n,r).y>0?s:l:(u>0&&(i=h===o?s:l),u<0&&(i=h===o?l:s),_(a)&&(i=i===s?l:s)),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,s=r-e.offsetY,a=!i.get("lockMovementX")&&i.left!==o,l=!i.get("lockMovementY")&&i.top!==s;return a&&i.set("left",o),l&&i.set("top",s),(a||l)&&f("moving",b(t,e,n,r)),a||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=f,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,s=this.sizeX||r.cornerSize||i.cornerSize,a=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,s>a?(o=s,t.scale(1,a/s),d=n*s/a):a>s?(o=a,t.scale(s/a,1),h=e*a/s):o=s,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 s=this.sizeX||i.cornerSize||o.cornerSize,a=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=s/2,d=a/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,s,a),u&&t.strokeRect(-h,-d,s,a),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 s,a,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),p=Math.sqrt(u*u+h*h)/2,f=d-e.util.degreesToRadians(t),g=Math.PI/2-d-e.util.degreesToRadians(t);s=p*e.util.cos(f),a=p*e.util.sin(f),l=p*e.util.cos(g),c=p*e.util.sin(g)}else{p=.7071067812*(u&&h?u:n);f=e.util.degreesToRadians(45-t);s=l=p*e.util.cos(f),a=c=p*e.util.sin(f)}return{tl:{x:r-c,y:i-l},tr:{x:r+s,y:i-a},bl:{x:r-s,y:i+a},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,s,a=t.getAttribute("style"),l=t.getAttribute("offset")||0;if(l=(l=parseFloat(l)/(/%$/.test(l)?100:1))<0?0:l>1?1:l,a){var c=a.split(/\s*;\s*/);for(""===c[c.length-1]&&c.pop(),s=c.length;s--;){var u=c[s].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,s,a,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,p=-this.offsetY,f=!!r.additionalTransform,g="pixels"===this.gradientUnits?"userSpaceOnUse":"objectBoundingBox";if(c.sort(function(t,e){return t.offset-e.offset}),"objectBoundingBox"===g?(d/=t.width,p/=t.height):(d+=t.width/2,p+=t.height/2),"path"===t.type&&"percentage"!==this.gradientUnits&&(d-=t.pathOffset.x,p-=t.pathOffset.y),h[4]-=d,h[5]-=p,a='id="SVGID_'+this.id+'" gradientUnits="'+g+'"',a+=' gradientTransform="'+(f?r.additionalTransform+" ":"")+n.util.matrixToSVG(h)+'" ',"linear"===this.type?s=["<linearGradient ",a,' x1="',l.x1,'" y1="',l.y1,'" x2="',l.x2,'" y2="',l.y2,'">\n']:"radial"===this.type&&(s=["<radialGradient ",a,' 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];s.push("<stop ",'offset="',100*b.offset+"%",'" style="stop-color:',b.color,typeof b.opacity<"u"?";stop-opacity: "+b.opacity:";",'"/>\n')}return s.push("linear"===this.type?"</linearGradient>\n":"</radialGradient>\n"),s.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 s=this.colorStops[r].color,a=this.colorStops[r].opacity,l=this.colorStops[r].offset;typeof a<"u"&&(s=new n.Color(s).setAlpha(a).toRgba()),e.addColorStop(l,s)}return e}}}),n.util.object.extend(n.Gradient,{fromElement:function(e,r,i,o){var s=parseFloat(i)/(/%$/.test(i)?100:1);s=s<0?0:s>1?1:s,isNaN(s)&&(s=1);var a,l,c,u,h=e.getElementsByTagName("stop"),d="userSpaceOnUse"===e.getAttribute("gradientUnits")?"pixels":"percentage",p=e.getAttribute("gradientTransform")||"",f=[],g=0,m=0;for("linearGradient"===e.nodeName||"LINEARGRADIENT"===e.nodeName?(a="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)):(a="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--;)f.push(t(h[c],s));return u=n.parseTransformAttribute(p),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:a,coords:l,colorStops:f,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,s="";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?s=e.src:e.toDataURL&&(s=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="'+s+'"></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,s=e.util.rotateVector({x:this.offsetX,y:this.offsetY},e.util.degreesToRadians(-t.angle)),a=new e.Color(this.color);return t.width&&t.height&&(r=100*n((Math.abs(s.x)+this.blur)/t.width,o)+20,i=100*n((Math.abs(s.y)+this.blur)/t.height,o)+20),t.flipX&&(s.x*=-1),t.flipY&&(s.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(s.x,o)+'" dy="'+n(s.y,o)+'" result="oBlur" ></feOffset>\n\t<feFlood flood-color="'+a.toRgb()+'" flood-opacity="'+a.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,s=n.util.invertTransform,a=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 s=new n.Image(e,i);this[t]=s,s.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,s=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),s&&s.setCoords(!0),this.calcViewportBoundaries(),this.renderOnAddRemove&&this.requestRenderAll(),this},zoomToPoint:function(t,e){var n=t,r=this.viewportTransform.slice(0);t=o(t,s(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=s(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 s=n.gradientTransform||n.patternTransform;s&&t.transform(s[0],s[1],s[2],s[3],s[4],s[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=s(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,s=this.overlayColor;return o&&o.toObject?o.excludeFromExport||(n.background=o.toObject(e)):o&&(n.background=o),s&&s.toObject?s.excludeFromExport||(n.overlay=s.toObject(e)):s&&(n.overlay=s),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,s=e.height||this.height,a='viewBox="0 0 '+this.width+" "+this.height+'" ',l=n.Object.NUM_FRACTION_DIGITS;e.viewBox?a='viewBox="'+e.viewBox.x+" "+e.viewBox.y+" "+e.viewBox.width+" "+e.viewBox.height+'" ':this.svgViewportTransformation&&(r=this.viewportTransform,a='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="',s,'" ',a,'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,s={width:t.width/(i?o[0]:1),height:t.height/(i?o[3]:1)};return r.toSVG(s,{additionalTransform:i?n.util.matrixToSVG(o):""})}}).join("")},createSVGFontFacesMarkup:function(){var t,e,r,i,o,s,a,l,c="",u={},h=n.fontPaths,d=[];for(this._objects.forEach(function t(e){d.push(e),e._objects&&e._objects.forEach(t)}),a=0,l=d.length;a<l;a++)if(e=(t=d[a]).fontFamily,-1!==t.type.indexOf("text")&&!u[e]&&h[e]&&(u[e]=!0,t.styles))for(o in r=t.styles)for(s in i=r[o])!u[e=i[s].fontFamily]&&h[e]&&(u[e]=!0);for(var p in u)c+=["\t\t@font-face {\n","\t\t\tfont-family: '",p,"';\n","\t\t\tsrc: url('",h[p],"');\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,s=this.height;if(r)if(r.toLive){var a=r.repeat,l=n.util.invertTransform(i),c=this[e+"Vpt"]?n.util.matrixToSVG(l):"";t.push('<rect transform="'+c+" translate(",o/2,",",s/2,')"',' x="',r.offsetX-o/2,'" y="',r.offsetY-s/2,'" ','width="',"repeat-y"===a||"no-repeat"===a?r.source.width:o,'" height="',"repeat-x"===a||"no-repeat"===a?r.source.height:s,'" 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,s,a,l=this._activeObject,c=0;if(t===l&&"activeSelection"===t.type)for(a=l._objects,n=0;n<a.length;n++)i=a[n],(o=this._objects.indexOf(i))>0+c&&(s=o-1,r(this._objects,i),this._objects.splice(s,0,i)),c++;else 0!==(o=this._objects.indexOf(t))&&(s=this._findNewLowerIndex(t,o,e),r(this._objects,t),this._objects.splice(s,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,s,a,l=this._activeObject,c=0;if(t===l&&"activeSelection"===t.type)for(n=(a=l._objects).length;n--;)i=a[n],(o=this._objects.indexOf(i))<this._objects.length-1-c&&(s=o+1,r(this._objects,i),this._objects.splice(s,0,i)),c++;else(o=this._objects.indexOf(t))!==this._objects.length-1&&(s=this._findNewUpperIndex(t,o,e),r(this._objects,t),this._objects.splice(s,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=a(this.lowerCanvasEl);return t&&t.createPNGStream()},n.StaticCanvas.prototype.createJPEGStream=function(t){var e=a(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 s=this.width/1e3;i=new n.Point(i.x,i.y),o=new n.Point(o.x,o.y),i.x-=s,o.x+=s}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,s=t[0],a=[s];for(n=1;n<o-1;n++)Math.pow(s.x-t[n].x,2)+Math.pow(s.y-t[n].y,2)>=i&&(s=t[n],a.push(s));return a.push(t[o]),a},_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],s=new n.Circle({radius:o.radius,left:o.x,top:o.y,originX:"center",originY:"center",fill:o.fill});this.shadow&&(s.shadow=new n.Shadow(this.shadow)),i.push(s)}var a=new n.Group(i);a.canvas=this.canvas,this.canvas.fire("before:path:created",{path:a}),this.canvas.add(a),this.canvas.fire("path:created",{path:a}),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],s=0,a=o.length;s<a;s++){var l=new n.Rect({width:o[s].width,height:o[s].width,left:o[s].x+1,top:o[s].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,s=this.width/2;for(o=0;o<this.density;o++){e=n.util.getRandomInt(t.x-s,t.x+s),r=n.util.getRandomInt(t.y-s,t.y+s),i=this.dotWidthVariance?n.util.getRandomInt(Math.max(1,this.dotWidth-this.dotWidthVariance),this.dotWidth+this.dotWidthVariance):this.dotWidth;var a=new n.Point(e,r);a.width=i,this.randomOpacity&&(a.opacity=n.util.getRandomInt(0,100)/100),this.sprayChunkPoints.push(a)}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),s=Math.max(t.cacheTranslationY+i.y*t.zoomY,0);return n.util.isTransparent(t._cacheContext,Math.round(o),Math.round(s),this.targetFindTolerance)}var a=this.contextCache,l=t.selectionBackgroundColor,c=this.viewportTransform;return t.selectionBackgroundColor="",this.clearContext(a),a.save(),a.transform(c[0],c[1],c[2],c[3],c[4],c[5]),t.render(a),a.restore(),t.selectionBackgroundColor=l,n.util.isTransparent(a,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),s=r.__corner,a=r.controls[s],l=i&&s?a.getActionHandler(t,r,a):n.controlsUtils.dragHandler,c=this._getActionFromCorner(i,s,t,r),u=this._getOriginFromCorner(r,s),h=t[this.centeredKey],d={target:r,action:c,actionHandler:l,corner:s,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),s=n.util.transformPoint(o,this.viewportTransform),a=Math.min(i.x,s.x),l=Math.min(i.y,s.y),c=Math.max(i.x,s.x),u=Math.max(i.y,s.y),h=this.selectionLineWidth/2;this.selectionColor&&(t.fillStyle=this.selectionColor,t.fillRect(a,l,c-a,u-l)),this.selectionLineWidth&&this.selectionBorderColor&&(t.lineWidth=this.selectionLineWidth,t.strokeStyle=this.selectionBorderColor,a+=h,l+=h,c-=h,u-=h,n.Object.prototype._setLineDash.call(this,t,this.selectionDashArray),t.strokeRect(a,l,c-a,u-l))},findTarget:function(t,e){if(!this.skipTargetFind){var n,i,o=this.getPointer(t,!0),s=this._activeObject,a=this.getActiveObjects(),l=r(t),c=a.length>1&&!e||1===a.length;if(this.targets=[],c&&s._findTargetCorner(o,l)||a.length>1&&!e&&s===this._searchPossibleTargets([s],o))return s;if(1===a.length&&s===this._searchPossibleTargets([s],o)){if(!this.preserveObjectStacking)return s;n=s,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 s=t[o],a=s.group?this._normalizePointer(s.group,e):e;if(this._checkTarget(a,s,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,s=o.getBoundingClientRect(),a=s.width||0,l=s.height||0;(!a||!l)&&("top"in s&&"bottom"in s&&(l=Math.abs(s.top-s.bottom)),"right"in s&&"left"in s&&(a=Math.abs(s.right-s.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===a||0===l?{width:1,height:1}:{width:o.width/a,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,s=this._getEventPrefix();t(n.document,"touchend",this._onTouchEnd,r),t(n.document,"touchmove",this._onMouseMove,r),e(o,s+"down",this._onMouseDown)},_onMouseDown:function(i){this.__onMouseDown(i),this._resetTransformEventData();var o=this.upperCanvasEl,s=this._getEventPrefix();e(o,s+"move",this._onMouseMove,r),t(n.document,s+"up",this._onMouseUp),t(n.document,s+"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 s=this;this._willAddMouseDown&&clearTimeout(this._willAddMouseDown),this._willAddMouseDown=setTimeout(function(){t(s.upperCanvasEl,o+"down",s._onMouseDown),s._willAddMouseDown=0},400)}},_onMouseUp:function(i){this.__onMouseUp(i),this._resetTransformEventData();var o=this.upperCanvasEl,s=this._getEventPrefix();this._isMainEvent(i)&&(e(n.document,s+"up",this._onMouseUp),e(n.document,s+"move",this._onMouseMove,r),t(o,s+"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,s=!1,a=!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,a);else{if(i(t,2))return this.fireMiddleClick&&this._handleEvent(t,"up",2,a),void this._resetTransformEventData();if(this.isDrawingMode&&this._isCurrentlyDrawing)this._onMouseUpInDrawingMode(t);else if(this._isMainEvent(t)){if(r&&(this._finalizeCurrentTransform(t),s=r.actionPerformed),!a){var l=e===this._activeObject;this._maybeGroupObjects(t),s||(s=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),s=!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 p=r.target&&r.target.controls[r.corner],f=p&&p.getMouseUpHandler(t,e,h);u=u||this.getPointer(t),f&&f(t,r,u.x,u.y)}this._setCursorFromEvent(t,e),this._handleEvent(t,"up",1,a),this._groupSelector=null,this._currentTransform=null,e&&(e.__corner=0),s?this.requestRenderAll():a||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||[],s={e:t,target:i,subTargets:o,button:n||1,isClick:r||!1,pointer:this._pointer,absolutePointer:this._absolutePointer,transform:this._currentTransform};"up"===e&&(s.currentTarget=this.findTarget(t),s.currentSubTargets=this.targets),this.fire("mouse:"+e,s),i&&i.fire("mouse"+e,s);for(var a=0;a<o.length;a++)o[a].fire("mouse"+e,s)},_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),s=this._shouldGroup(t,e);if(this._shouldClearSelection(t,e)?this.discardActiveObject(t):s&&(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 a=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||!s)){this._setupCurrentTransform(t,e,a);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||s)&&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 s=0;s<o;s++)this.fireSyntheticInOutEvents(i[s],e,{oldTarget:r[s],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 s=0;s<o;s++)this.fireSyntheticInOutEvents(i[s],e,{oldTarget:r[s],evtOut:"dragleave",evtIn:"dragenter"});this._draggedoverTarget=t},fireSyntheticInOutEvents:function(t,e,n){var r,i,o,s=n.oldTarget,a=s!==t,l=n.canvasEvtIn,c=n.canvasEvtOut;a&&(r={e:e,target:t,previousTarget:s},i={e:e,target:s,nextTarget:t}),o=t&&a,s&&a&&(c&&this.fire(c,i),s.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,s=!1,a=e.actionHandler;a&&(s=a(t,e,r,i)),"drag"===o&&s&&(e.target.isMoving=!0,this.setCursor(e.target.moveCursor||this.moveCursor)),e.actionPerformed=e.actionPerformed||s},_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=[],s=this._groupSelector.ex,a=this._groupSelector.ey,l=s+this._groupSelector.left,c=a+this._groupSelector.top,u=new n.Point(t(s,l),t(a,c)),h=new n.Point(e(s,l),e(a,c)),d=!this.selectionFullyContained,p=s===l&&a===c,f=this._objects.length;f--&&!((i=this._objects[f])&&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),p)););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(),s=this.width,a=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,p=[l,0,0,l,u,h],f=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=p,this.width=r,this.height=i,this.calcViewportBoundaries(),this.renderCanvas(g.getContext("2d"),this._objects),this.viewportTransform=c,this.width=s,this.height=a,this.calcViewportBoundaries(),this.interactive=d,this.enableRetinaScaling=f,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,s=i.clipPath,a=this.renderOnAddRemove;return this.renderOnAddRemove=!1,delete i.clipPath,this._enlivenObjects(i.objects,function(t){o.clear(),o._setBgOverlay(i,function(){s?o._enlivenObjects([s],function(n){o.clipPath=n[0],o.__setupCanvas.call(o,i,t,a,e)}):o.__setupCanvas.call(o,i,t,a,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,s=e.util.degreesToRadians,a=!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:a,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,s=e.minCacheSideLimit;if(r<=o&&i<=o&&r*i<=n)return r<s&&(t.width=s),i<s&&(t.height=s),t;var a=r/i,l=e.util.limitDimsByArea(a,n),c=e.util.capValue,u=c(s,l.x,o),h=c(s,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,s=this._cacheCanvas,a=this._limitCacheSize(this._getCacheCanvasDimensions()),l=e.minCacheSideLimit,c=a.width,u=a.height,h=a.zoomX,d=a.zoomY,p=c!==this.cacheWidth||u!==this.cacheHeight,f=this.zoomX!==h||this.zoomY!==d,g=p||f,m=0,v=0,b=!1;if(p){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&&!a.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?(s.width=Math.ceil(c+m),s.height=Math.ceil(u+v)):(this._cacheContext.setTransform(1,0,0,1,0,0),this._cacheContext.clearRect(0,0,s.width,s.height)),i=a.x/2,o=a.y/2,this.cacheTranslationX=Math.round(s.width/2-i)+i,this.cacheTranslationY=Math.round(s.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,a=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(a,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(s(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,s=i&&i.viewportTransform[3]||1;n=r.nonScaling?{scaleX:1,scaleY:1}:this.getObjectScaling(),i&&i._isRetinaScaling()&&(o*=e.devicePixelRatio,s*=e.devicePixelRatio),t.shadowColor=r.color,t.shadowBlur=r.blur*e.browserShadowBlurConstant*(o+s)*(n.scaleX+n.scaleY)/4,t.shadowOffsetX=r.offsetX*o*n.scaleX,t.shadowOffsetY=r.offsetY*s*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(),s=this.canvas.getRetinaScaling(),a=i.x/this.scaleX/s,l=i.y/this.scaleY/s;o.width=a,o.height=l,(r=o.getContext("2d")).beginPath(),r.moveTo(0,0),r.lineTo(a,0),r.lineTo(a,l),r.lineTo(0,l),r.closePath(),r.translate(a/2,l/2),r.scale(i.zoomX/this.scaleX/s,i.zoomY/this.scaleY/s),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(s*this.scaleX/i.zoomX,s*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,s=Math.abs,a=(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(),p=this.getBoundingRect(!0,!0),f=this.shadow,g={x:0,y:0};f&&(c=f.blur,l=f.nonScaling?{scaleX:1,scaleY:1}:this.getObjectScaling(),g.x=2*Math.round(s(f.offsetX)+c)*s(l.scaleX),g.y=2*Math.round(s(f.offsetY)+c)*s(l.scaleY)),u=p.width+g.x,h=p.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(a||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,s(-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 s=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 s(n[o],n):new s(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,s,a){var l,c,u,h=t.x,d=t.y;return"string"==typeof i?i=e[i]:i-=.5,"string"==typeof s?s=e[s]:s-=.5,"string"==typeof o?o=r[o]:o-=.5,"string"==typeof a?a=r[a]:a-=.5,c=a-o,((l=s-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,s,a=this.getCenterPoint();return o=typeof r<"u"&&typeof i<"u"?this.translateToGivenOrigin(a,"center","center",r,i):new n.Point(this.left,this.top),s=new n.Point(e.x,e.y),this.angle&&(s=n.util.rotatePoint(s,a,-t(this.angle))),s.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,s=t(this.angle),a=this.getScaledWidth(),l=n.util.cos(s)*a,c=n.util.sin(s)*a;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,s=t._getImageLines(i);o<4;o++)if(!t.containsPoint(r[o],s))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 s in e)if(!((i=e[s]).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),s=t.cos(o)*r,a=t.sin(o)*r,l=s+a,c=s-a,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),s=(o=r(o,[1/n[0],0,0,1/n[3],0,0]),this._calculateCurrentDimensions()),a={};return this.forEachControl(function(t,e,n){a[e]=t.positionHandler(s,o,n)}),a},calcACoords:function(){var t=this._calcRotateMatrix(),e=this._calcTranslateMatrix(),n=r(e,t),o=this._getTransformedDimensions(),s=o.x/2,a=o.y/2;return{tl:i({x:-s,y:-a},n),tr:i({x:s,y:-a},n),bl:i({x:-s,y:a},n),br:i({x:s,y:a},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,s=0===e&&0===n;if(this.strokeUniform?(i=this.width,o=this.height):(i=(r=this._getNonTransformedDimensions()).x,o=r.y),s)return this._finalizeDimensions(i*this.scaleX,o*this.scaleY);var a=t.sizeAfterTransform(i,o,{scaleX:this.scaleX,scaleY:this.scaleY,skewX:e,skewY:n});return this._finalizeDimensions(a.x,a.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",s=this.strokeLineCap?this.strokeLineCap:"butt",a=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: ",s,"; ","stroke-dashoffset: ",o,"; ","stroke-linejoin: ",a,"; ","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:"",s=(i=i,e.fontSize?"font-size: "+e.fontSize+"px"+r:""),a=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,s,a,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,s=e.reviver,a=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,p=this.fill,f=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(s)+"</clipPath>\n"),h&&g.push("<g ",l,this.getSvgCommons()," >\n"),g.push("<g ",this.getSvgTransform(!1),h?"":l+this.getSvgCommons()," >\n"),r=[a,u,o?"":this.addPaintOrder()," ",v?'transform="'+v+'" ':""].join(""),t[m]=r,p&&p.toLive&&g.push(p.toSVG(this)),d&&d.toLive&&g.push(d.toSVG(this)),f&&g.push(f.toSVG(this)),c&&g.push(i),g.push(t.join("")),g.push("</g>\n"),h&&g.push("</g>\n"),s?s(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 s,a=Object.keys(t);if(!e||"object"!=typeof e||!n&&a.length!==Object.keys(e).length)return!1;for(r=0,o=a.length;r<o;r++)if("canvas"!==(s=a[r])&&"group"!==s&&!i(t[s],e[s]))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,s=t.y,a=Object.keys(this.oCoords),l=a.length-1;for(this.__corner=0;l>=0;l--)if(i=a[l],this.isControlVisible(i)&&(r=this._getImageLines(e?this.oCoords[i].touchCorner:this.oCoords[i].corner),0!==(n=this._findCrossPoints({x:o,y:s},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,s=typeof e.hasControls<"u"?e.hasControls:this.hasControls,a=!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),s&&(t.beginPath(),this.forEachControl(function(e,n,r){e.withConnection&&e.getVisibility(r,n)&&(a=!0,t.moveTo(e.x*i,e.y*o),t.lineTo(e.x*i+e.offsetX,e.y*o+e.offsetY))}),a&&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,s=this.strokeUniform,a=this.borderScaleFactor,l=i.x+o*(s?this.canvas.getZoom():e.scaleX)+a,c=i.y+o*(s?this.canvas.getZoom():e.scaleY)+a;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,s,a){i=a.oCoords[s],o.getVisibility(a,s)&&(r&&(i=n.util.transformPoint(i,r)),o.render(t,i.x,i.y,e,a))}),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,s=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),s.requestRenderAll(),o()},onComplete:function(){t.setCoords(),i()}})},fxCenterObjectV:function(t,e){var r=function(){},i=(e=e||{}).onComplete||r,o=e.onChange||r,s=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),s.requestRenderAll(),o()},onComplete:function(){t.setCoords(),i()}})},fxRemove:function(t,e){var r=function(){},i=(e=e||{}).onComplete||r,o=e.onChange||r,s=this;return n.util.animate({target:this,startValue:t.opacity,endValue:0,duration:this.FX_DURATION,onChange:function(e){t.set("opacity",e),s.requestRenderAll(),o()},onComplete:function(){s.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,s=this;e=e.toString(),r=r?n.util.object.clone(r):{},~t.indexOf(".")&&(o=t.split("."));var a=s.colorProperties.indexOf(t)>-1||o&&s.colorProperties.indexOf(o[1])>-1,l=o?this.get(o[0])[o[1]]:this.get(t);"from"in r||(r.from=l),a||(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(s,t,e,n)},onChange:function(e,n,a){o?s[o[0]][o[1]]=e:s.set(t,e),!i&&r.onChange&&r.onChange(e,n,a)},onComplete:function(t,e,n){i||(s.setCoords(),r.onComplete&&r.onComplete(t,e,n))}};return a?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,s=e.nearest,a=e.center,l=e.farthest;return function(){switch(this.get(n)){case s:return Math.min(this.get(r),this.get(i));case a: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),s=[o.x1||0,o.y1||0,o.x2||0,o.y2||0];r(new e.Line(s,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),s=this.radius;t=['<path d="M '+e.util.cos(i)*s+" "+e.util.sin(i)*s," A "+s+" "+s," 0 ",+(r>180?"1":"0")+" 1"," "+e.util.cos(o)*s+" "+e.util.sin(o)*s,'" ',"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,s=-this.height/2,a=0!==e||0!==n,l=.4477152502;t.beginPath(),t.moveTo(o+e,s),t.lineTo(o+r-e,s),a&&t.bezierCurveTo(o+r-l*e,s,o+r,s+l*n,o+r,s+n),t.lineTo(o+r,s+i-n),a&&t.bezierCurveTo(o+r,s+i-l*n,o+r-l*e,s+i,o+r-e,s+i),t.lineTo(o+e,s+i),a&&t.bezierCurveTo(o+l*e,s+i,o,s+i-l*n,o,s+i-n),t.lineTo(o,s+n),a&&t.bezierCurveTo(o,s+l*n,o+l*e,s,o+e,s),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 s=new e.Rect(n(i?e.util.object.clone(i):{},o));s.visible=s.visible&&s.width>0&&s.height>0,r(s)},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,s=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 s(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,s=0,a=this.points.length;s<a;s++)t.push(o(this.points[s].x-n,i),",",o(this.points[s].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 s=e.parsePointsAttribute(r.getAttribute("points")),a=e.parseAttributes(r,e[t].ATTRIBUTE_NAMES);a.fromSVG=!0,i(new e[t](s,n(a,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,s=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,s=0,a=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],s=e[3],a=e[4],t.bezierCurveTo(e[1]+l,e[2]+c,s+l,a+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],s=e[1],a=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("+s(-this.pathOffset.x,t)+", "+s(-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=[],s=[],a=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":a=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=a,u=l}i.forEach(function(t){o.push(t.x),s.push(t.y)}),o.push(c),s.push(u)}var p=n(o)||0,f=n(s)||0;return{left:p,top:f,width:(r(o)||0)-p,height:(r(s)||0)-f}}}),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=[],s=[],a=["tr","br","bl","tl"],l=0,c=this._objects.length,u=a.length;l<c;++l){for(r=(e=this._objects[l]).calcACoords(),i=0;i<u;i++)n=a[i],o.push(r[n].x),s.push(r[n].y);e.aCoords=r}this._getBounds(o,s,t)},_getBounds:function(t,i,o){var s=new e.Point(n(t),n(i)),a=new e.Point(r(t),r(i)),l=s.y||0,c=s.x||0,u=a.x-s.x||0,h=a.y-s.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 s=e.util.groupSVGElements(o,t,r),a=i.clipPath;delete i.clipPath,s.set(i),a?e.util.enlivenObjects([a],function(t){s.clipPath=t[0],n&&n(s)}):n&&n(s)})})}(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,s=-this.height/2,a="",l="";if(!i)return[];if(this.hasCrop()){var c=n.Object.__uid++;e.push('<clipPath id="imageCrop_'+c+'">\n','\t<rect x="'+o+'" y="'+s+'" width="'+this.width+'" height="'+this.height+'" />\n',"</clipPath>\n"),a=' 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="',s-this.cropY,'" width="',i.width||i.naturalWidth,'" height="',i.height||i.height,l,'"',a,"></image>\n"),this.stroke||this.strokeDashArray){var u=this.fill;this.fill=null,t=["\t<rect ",'x="',o,'" y="',s,'" 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,s=this._filteredEl||this._originalElement;if(this.group&&this.set("dirty",!0),!t||i>e&&o>e)return this._element=s,this._filterScalingX=1,this._filterScalingY=1,this._lastScaleX=i,void(this._lastScaleY=o);n.filterBackend||(n.filterBackend=n.initFilterBackend());var a=n.util.createCanvasElement(),l=this._filteredEl?this.cacheKey+"_filtered":this.cacheKey,c=s.width,u=s.height;a.width=c,a.height=u,this._element=a,this._lastScaleX=t.scaleX=i,this._lastScaleY=t.scaleY=o,n.filterBackend.applyFilters([t],s,c,u,this._element,l),this._filterScalingX=a.width/this._originalElement.width,this._filterScalingY=a.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,s=Math.min,a=Math.max,l=a(this.cropX,0),c=a(this.cropY,0),u=e.naturalWidth||e.width,h=e.naturalHeight||e.height,d=l*n,p=c*r,f=s(i*n,u-d),g=s(o*r,h-p),m=-i/2,v=-o/2,b=s(i,u/n-l),y=s(o,h/r-c);e&&t.drawImage(e,d,p,f,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,s=1,a=0,l=0,c=0,u=0,h=this.width,d=this.height,p={width:h,height:d};return!e||"none"===e.alignX&&"none"===e.alignY?(o=h/r,s=d/i):("meet"===e.meetOrSlice&&(t=(h-r*(o=s=n.util.findScaleToFit(this._element,p)))/2,"Min"===e.alignX&&(a=-t),"Max"===e.alignX&&(a=t),t=(d-i*s)/2,"Min"===e.alignY&&(l=-t),"Max"===e.alignY&&(l=t)),"slice"===e.meetOrSlice&&(t=r-h/(o=s=n.util.findScaleToCover(this._element,p)),"Mid"===e.alignX&&(c=t/2),"Max"===e.alignX&&(c=t),t=i-d/s,"Mid"===e.alignY&&(u=t/2),"Max"===e.alignY&&(u=t),r=h/o,i=d/s)),{width:r,height:i,scaleX:o,scaleY:s,offsetLeft:a,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 s=["highp","mediump","lowp"],a=0;a<3;a++)if(t(i,s[a])){n.webGlPrecision=s[a];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,s=typeof window.performance<"u";try{new ImageData(1,1),r=!0}catch{r=!1}var a=typeof ArrayBuffer<"u",l=typeof Uint8ClampedArray<"u";if(s&&r&&a&&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,p={imageBuffer:u,destinationWidth:t,destinationHeight:e,targetCanvas:c};c.width=t,c.height=e,h=window.performance.now(),i.call(p,this.gl,p),d=window.performance.now()-h,h=window.performance.now(),o.call(p,this.gl,p),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 s,a=this.gl;o&&(s=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:a,sourceTexture:this.createTexture(a,n,r,!s&&e),targetTexture:this.createTexture(a,n,r),originalTexture:s||this.createTexture(a,n,r,!s&&e),passes:t.length,webgl:!0,aPosition:this.aPosition,programCache:this.programCache,pass:0,filterBackend:this,targetCanvas:i},c=a.createFramebuffer();return a.bindFramebuffer(a.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(a,l),a.bindTexture(a.TEXTURE_2D,null),a.deleteTexture(l.sourceTexture),a.deleteTexture(l.targetTexture),a.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,i){var o=t.createTexture();return t.bindTexture(t.TEXTURE_2D,o),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,i||t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,i||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),o},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 s={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(s)}),(s.imageData.width!==n||s.imageData.height!==r)&&(i.width=s.imageData.width,i.height=s.imageData.height),o.putImageData(s.imageData,0,0),s}}}(),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 s=t.createProgram();if(t.attachShader(s,i),t.attachShader(s,o),t.linkProgram(s),!t.getProgramParameter(s,t.LINK_STATUS))throw new Error('Shader link error for "${this.type}" '+t.getProgramInfoLog(s));var a=this.getAttributeLocations(t,s),l=this.getUniformLocations(t,s)||{};return l.uStepW=t.getUniformLocation(s,"uStepW"),l.uStepH=t.getUniformLocation(s,"uStepH"),{program:s,attributeLocations:a,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,s=t.imageData.data,a=s.length,l=this.matrix,c=this.colorsOnly;for(o=0;o<a;o+=4)e=s[o],n=s[o+1],r=s[o+2],c?(s[o]=e*l[0]+n*l[1]+r*l[2]+255*l[4],s[o+1]=e*l[5]+n*l[6]+r*l[7]+255*l[9],s[o+2]=e*l[10]+n*l[11]+r*l[12]+255*l[14]):(i=s[o+3],s[o]=e*l[0]+n*l[1]+r*l[2]+i*l[3]+255*l[4],s[o+1]=e*l[5]+n*l[6]+r*l[7]+i*l[8]+255*l[9],s[o+2]=e*l[10]+n*l[11]+r*l[12]+i*l[13]+255*l[14],s[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,s,a,l,c,u,h,d,p,f=t.imageData,g=f.data,m=this.matrix,v=Math.round(Math.sqrt(m.length)),b=Math.floor(v/2),y=f.width,x=f.height,w=t.ctx.createImageData(y,x),_=w.data,C=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,p=0;p<v;p++)for(d=0;d<v;d++)s=u+d-b,!((a=h+p-b)<0||a>=x||s<0||s>=y)&&(l=4*(a*y+s),c=m[p*v+d],e+=g[l]*c,n+=g[l+1]*c,r+=g[l+2]*c,C||(i+=g[l+3]*c));_[o]=e,_[o+1]=n,_[o+2]=r,_[o+3]=C?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,s,a,l,c,u,h,d=t.imageData,p=d.data,f=d.height,g=d.width;for(n=0;n<f;n+=this.blocksize)for(r=0;r<g;r+=this.blocksize)for(i=p[e=4*n*g+4*r],o=p[e+1],s=p[e+2],a=p[e+3],u=Math.min(n+this.blocksize,f),h=Math.min(r+this.blocksize,g),l=n;l<u;l++)for(c=r;c<h;c++)p[e=4*l*g+4*c]=i,p[e+1]=o,p[e+2]=s,p[e+3]=a},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,s=t.imageData.data,a=255*this.distance,l=new e.Color(this.color).getSource(),c=[l[0]-a,l[1]-a,l[2]-a],u=[l[0]+a,l[1]+a,l[2]+a];for(n=0;n<s.length;n+=4)r=s[n],i=s[n+1],o=s[n+2],r>c[0]&&i>c[1]&&o>c[2]&&r<u[0]&&i<u[1]&&o<u[2]&&(s[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],s=[r[0]/255+i,r[1]/255+i,r[2]/255+i,1];t.uniform4fv(n.uLow,o),t.uniform4fv(n.uHigh,s)},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,s,a,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],s=c[d+1],a=c[d+2],this.mode){case"multiply":c[d]=o*n/255,c[d+1]=s*r/255,c[d+2]=a*i/255;break;case"screen":c[d]=255-(255-o)*(255-n)/255,c[d+1]=255-(255-s)*(255-r)/255,c[d+2]=255-(255-a)*(255-i)/255;break;case"add":c[d]=o+n,c[d+1]=s+r,c[d+2]=a+i;break;case"diff":case"difference":c[d]=Math.abs(o-n),c[d+1]=Math.abs(s-r),c[d+2]=Math.abs(a-i);break;case"subtract":c[d]=o-n,c[d+1]=s-r,c[d+2]=a-i;break;case"darken":c[d]=Math.min(o,n),c[d+1]=Math.min(s,r),c[d+2]=Math.min(a,i);break;case"lighten":c[d]=Math.max(o,n),c[d+1]=Math.max(s,r),c[d+2]=Math.max(a,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*s*r/255:255-2*(255-s)*(255-r)/255,c[d+2]=i<128?2*a*i/255:255-2*(255-a)*(255-i)/255;break;case"exclusion":c[d]=n+o-2*n*o/255,c[d+1]=r+s-2*r*s/255,c[d+2]=i+a-2*i*a/255;break;case"tint":c[d]=n+o*h,c[d+1]=r+s*h,c[d+2]=i+a*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,s,a,l,c,u,h,d,p=t.imageData,f=t.filterBackend.resources,g=p.data,m=g.length,v=p.width,b=p.height,y=this.image;f.blendImage||(f.blendImage=e.util.createCanvasElement()),h=(u=f.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(s=g[x],a=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]=s*n/255,g[x+1]=a*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,s=Math.round,a=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 a(e)/e*a(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,a=e.height,l=s(o*n),c=s(a*r);"sliceHack"===this.resizeType?i=this.sliceByTwo(t,o,a,l,c):"hermite"===this.resizeType?i=this.hermiteFastResize(t,o,a,l,c):"bilinear"===this.resizeType?i=this.bilinearFiltering(t,o,a,l,c):"lanczos"===this.resizeType&&(i=this.lanczosResize(t,o,a,l,c)),t.imageData=i},sliceByTwo:function(t,n,i,o,s){var a,l,c=t.imageData,u=.5,h=!1,d=!1,p=n*u,f=i*u,g=e.filterBackend.resources,m=0,v=0,b=n,y=0;for(g.sliceByTwo||(g.sliceByTwo=document.createElement("canvas")),((a=g.sliceByTwo).width<1.5*n||a.height<i)&&(a.width=1.5*n,a.height=i),(l=a.getContext("2d")).clearRect(0,0,1.5*n,i),l.putImageData(c,0,0),o=r(o),s=r(s);!h||!d;)n=p,i=f,o<r(p*u)?p=r(p*u):(p=o,h=!0),s<r(f*u)?f=r(f*u):(f=s,d=!0),l.drawImage(a,m,v,n,i,b,y,p,f),m=b,v=y,y+=f;return l.getImageData(m,v,o,s)},lanczosResize:function(t,e,s,a,c){var u=t.imageData.data,h=t.ctx.createImageData(a,c),d=h.data,p=this.lanczosCreate(this.lanczosLobes),f=this.rcpScaleX,g=this.rcpScaleY,m=2/this.rcpScaleX,v=2/this.rcpScaleY,b=l(f*this.lanczosLobes/2),y=l(g*this.lanczosLobes/2),x={},w={},_={};return function t(l){var C,S,k,T,j,O,E,M,P,A,D;for(w.x=(l+.5)*f,_.x=r(w.x),C=0;C<c;C++){for(w.y=(C+.5)*g,_.y=r(w.y),j=0,O=0,E=0,M=0,P=0,S=_.x-b;S<=_.x+b;S++)if(!(S<0||S>=e)){A=r(1e3*o(S-w.x)),x[A]||(x[A]={});for(var I=_.y-y;I<=_.y+y;I++)I<0||I>=s||(D=r(1e3*o(I-w.y)),x[A][D]||(x[A][D]=p(i(n(A*m,2)+n(D*v,2))/1e3)),(k=x[A][D])>0&&(j+=k,O+=k*u[T=4*(I*e+S)],E+=k*u[T+1],M+=k*u[T+2],P+=k*u[T+3]))}d[T=4*(C*a+l)]=O/j,d[T+1]=E/j,d[T+2]=M/j,d[T+3]=P/j}return++l<a?t(l):h}(0)},bilinearFiltering:function(t,e,n,i,o){var s,a,l,c,u,h,d,p,f,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-(s=r(m*c)),h=v*l-(a=r(v*l)),f=4*(a*e+s),d=0;d<4;d++)p=y[f+d]*(1-u)*(1-h)+y[f+4+d]*u*(1-h)+y[f+b+d]*h*(1-u)+y[f+b+4+d]*u*h,w[g++]=p;return x},hermiteFastResize:function(t,e,n,s,a){for(var c=this.rcpScaleX,u=this.rcpScaleY,h=l(c/2),d=l(u/2),p=t.imageData.data,f=t.ctx.createImageData(s,a),g=f.data,m=0;m<a;m++)for(var v=0;v<s;v++){for(var b=4*(v+m*s),y=0,x=0,w=0,_=0,C=0,S=0,k=0,T=(m+.5)*u,j=r(m*u);j<(m+1)*u;j++)for(var O=o(T-(j+.5))/d,E=(v+.5)*c,M=O*O,P=r(v*c);P<(v+1)*c;P++){var A=o(E-(P+.5))/h,D=i(M+A*A);D>1&&D<-1||(y=2*D*D*D-3*D*D+1)>0&&(k+=y*p[(A=4*(P+j*e))+3],w+=y,p[A+3]<255&&(y=y*p[A+3]/250),_+=y*p[A],C+=y*p[A+1],S+=y*p[A+2],x+=y)}g[b]=_/x,g[b+1]=C/x,g[b+2]=S/x,g[b+3]=k/w}return f},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,s=o.length,a=-this.vibrance;for(e=0;e<s;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*a,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,s=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!==s)&&(r.width=n.width=o,r.height=n.height=s);var a,l,c,u,h=n.getContext("2d"),d=r.getContext("2d"),p=15,f=.06*this.blur*.5;for(h.putImageData(t.imageData,0,0),d.clearRect(0,0,o,s),u=-p;u<=p;u++)c=f*(l=u/p)*o+(a=(Math.random()-.5)/4),d.globalAlpha=1-Math.abs(l),d.drawImage(n,c,a),h.drawImage(r,0,0),d.globalAlpha=1,d.clearRect(0,0,r.width,r.height);for(u=-p;u<=p;u++)c=f*(l=u/p)*s+(a=(Math.random()-.5)/4),d.globalAlpha=1-Math.abs(l),d.drawImage(n,a,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],s=1/r[1],a=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,s),this.bVals[e]=255*Math.pow(e/255,a);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,s=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+s/3,this.matrix[1]=i*s-o,this.matrix[2]=i*s+o,this.matrix[5]=i*s+o,this.matrix[6]=n+i*s,this.matrix[7]=i*s-o,this.matrix[10]=i*s-o,this.matrix[11]=i*s+o,this.matrix[12]=n+i*s},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,s,a=0,l=this._textLines.length;a<l;a++)if(("justify"===this.textAlign||a!==l-1&&!this.isEndOfWrapping(a))&&(r=0,i=this._textLines[a],(e=this.getLineWidth(a))<this.width&&(s=this.textLines[a].match(this._reSpacesAndTabs)))){n=s.length,t=(this.width-e)/n;for(var c=0,u=i.length;c<=u;c++)o=this.__charBounds[a][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,s,a,l=t.fillStyle,c=this._getLeftOffset(),u=this._getTopOffset(),h=0,d=0,p=this.path,f=0,g=this._textLines.length;f<g;f++)if(e=this.getHeightOfLine(f),this.textBackgroundColor||this.styleHas("textBackgroundColor",f)){r=this._textLines[f],n=this._getLineLeftOffset(f),d=0,h=0,i=this.getValueOfPropertyAt(f,0,"textBackgroundColor");for(var m=0,v=r.length;m<v;m++)o=this.__charBounds[f][m],s=this.getValueOfPropertyAt(f,m,"textBackgroundColor"),p?(t.save(),t.translate(o.renderLeft,o.renderTop),t.rotate(o.angle),t.fillStyle=s,s&&t.fillRect(-o.width/2,-e/this.lineHeight*(1-this._fontSizeFraction),o.width,e/this.lineHeight),t.restore()):s!==i?(a=c+n+h,"rtl"===this.direction&&(a=this.width-a-d),t.fillStyle=i,i&&t.fillRect(a,u,d,e/this.lineHeight),h=o.left,d=o.width,i=s):d+=o.kernedWidth;s&&!p&&(a=c+n+h,"rtl"===this.direction&&(a=this.width-a-d),t.fillStyle=s,t.fillRect(a,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,s,a,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]&&(s=l[n]),void 0!==l[t]&&(a=i=l[t]),u&&void 0!==l[c]&&(a=(o=l[c])-s),void 0===i||void 0===s||void 0===o){var d=this.getMeasuringContext();this._setTextStyles(d,e,!0)}return void 0===i&&(a=i=d.measureText(t).width,l[t]=i),void 0===s&&u&&n&&(s=d.measureText(n).width,l[n]=s),u&&void 0===o&&(o=d.measureText(c).width,l[c]=o,a=o-s),{width:i*h,kernedWidth:a*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,s,a,l=0,c=this._textLines[t],u=new Array(c.length),h=0,d=this.path,p="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(a=d.segmentsInfo[d.segmentsInfo.length-1].length,(s=e.util.getPointOnPath(d.path,0,d.segmentsInfo)).x+=d.pathOffset.x,s.y+=d.pathOffset.y,this.textAlign){case"left":h=p?a-l:0;break;case"center":h=(a-l)/2;break;case"right":h=p?0:a-l}for(h+=this.pathStartOffset*(p?-1:1),n=p?c.length-1:0;p?n>=0:n<c.length;p?n--:n++)o=u[n],h>a?h%=a:h<0&&(h+=a),this._setGraphemeOnPath(h,o,s),h+=o.kernedWidth}return{width:l,numOfSpaces:0}},_setGraphemeOnPath:function(t,n,r){var i=t+n.kernedWidth/2,o=this.path,s=e.util.getPointOnPath(o.path,i,o.segmentsInfo);n.renderLeft=s.x-r.x,n.renderTop=s.y-r.y,n.angle=s.angle+("right"===this.pathSide?Math.PI:0)},_getGraphemeBox:function(t,e,n,r,i){var o,s=this.getCompleteStyleDeclaration(e,n),a=r?this.getCompleteStyleDeclaration(e,n-1):{},l=this._measureChar(t,s,r,a),c=l.kernedWidth,u=l.width;0!==this.charSpacing&&(u+=o=this._getWidthOfCharSpacing(),c+=o);var h={width:u,left:0,height:s.fontSize,kernedWidth:c,deltaY:s.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,s=this._textLines.length;o<s;o++){var a=this.getHeightOfLine(o),l=a/this.lineHeight,c=this._getLineLeftOffset(o);this._renderTextLine(e,t,this._textLines[o],r+c,i+n+l,o),n+=a}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,s){var a,l,c,u,h,d=this.getHeightOfLine(s),p=-1!==this.textAlign.indexOf("justify"),f="",g=0,m=this.path,v=!p&&0===this.charSpacing&&this.isEmptyStyles(s)&&!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,s,0,r.join(""),i,o,d),void n.restore();for(var w=0,_=r.length-1;w<=_;w++)u=w===_||this.charSpacing||m,f+=r[w],c=this.__charBounds[s][w],0===g?(i+=y*(c.kernedWidth-c.width),g+=c.width):g+=c.kernedWidth,p&&!u&&this._reSpaceAndTab.test(r[w])&&(u=!0),u||(a=a||this.getCompleteStyleDeclaration(s,w),l=this.getCompleteStyleDeclaration(s,w+1),u=e.util.hasStyleChanged(a,l,!1)),u&&(m?(n.save(),n.translate(c.renderLeft,c.renderTop),n.rotate(c.angle),this._renderChar(t,n,s,w,f,-g/2,0,d),n.restore()):(h=i,this._renderChar(t,n,s,w,f,h,o,d)),f="",a=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,s){var a,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&&(a=this._setFillStyles(e,u)),d&&(l=this._setStrokeStyles(e,u)),e.font=this._getFontDeclaration(u),c&&c.textBackgroundColor&&this._removeShadow(e),c&&c.deltaY&&(s+=c.deltaY),h&&e.fillText(i,o-a.offsetX,s-a.offsetY),d&&e.strokeText(i,o-l.offsetX,s-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"),s={fontSize:i*n.size,deltaY:o+i*n.baseline};return this.setSelectionStyles(s,t,e),this},_getLineLeftOffset:function(t){var e=this.getLineWidth(t),n=this.width-e,r=this.textAlign,i=this.direction,o=0,s=this.isEndOfWrapping(t);return"justify"===r||"justify-center"===r&&!s||"justify-right"===r&&!s||"justify-left"===r&&!s?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,s,a,l,c,u,h,d,p,f,g,m,v,b=this._getLeftOffset(),y=this._getTopOffset(),x=this.path,w=this._getWidthOfCharSpacing(),_=this.offsets[e],C=0,S=this._textLines.length;C<S;C++)if(n=this.getHeightOfLine(C),this[e]||this.styleHas(e,C)){l=this._textLines[C],g=n/this.lineHeight,o=this._getLineLeftOffset(C),h=0,d=0,c=this.getValueOfPropertyAt(C,0,e),v=this.getValueOfPropertyAt(C,0,"fill"),u=y+g*(1-this._fontSizeFraction),r=this.getHeightOfChar(C,0),s=this.getValueOfPropertyAt(C,0,"deltaY");for(var k=0,T=l.length;k<T;k++)if(p=this.__charBounds[C][k],f=this.getValueOfPropertyAt(C,k,e),m=this.getValueOfPropertyAt(C,k,"fill"),i=this.getHeightOfChar(C,k),a=this.getValueOfPropertyAt(C,k,"deltaY"),x&&f&&m)t.save(),t.fillStyle=v,t.translate(p.renderLeft,p.renderTop),t.rotate(p.angle),t.fillRect(-p.kernedWidth/2,_*i+a,p.kernedWidth,this.fontSize/15),t.restore();else if((f!==c||m!==v||i!==r||a!==s)&&d>0){var j=b+o+h;"rtl"===this.direction&&(j=this.width-j-d),c&&v&&(t.fillStyle=v,t.fillRect(j,u+_*r+s,d,this.fontSize/15)),h=p.left,d=p.width,c=f,v=m,r=i,s=a}else d+=p.kernedWidth;j=b+o+h;"rtl"===this.direction&&(j=this.width-j-d),t.fillStyle=m,f&&m&&t.fillRect(j,u+_*r+s,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,s=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",s].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=[],s=0;s<n.length;s++)r[s]=e.util.string.graphemeSplit(n[s]),o=o.concat(r[s],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),s=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 a=o.textDecoration;-1!==a.indexOf("underline")&&(i.underline=!0),-1!==a.indexOf("overline")&&(i.overline=!0),-1!==a.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,p=u.getScaledHeight()+d,f=0;"center"===s&&(f=u.getScaledWidth()/2),"right"===s&&(f=u.getScaledWidth()),u.set({left:u.left-f,top:u.top-(p-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,s=0;for(var a in r){for(var l in e=0,r[a]){var c;i++,(c=r[a][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[a][l]}0===e&&delete r[a]}for(var u=0;u<this._textLines.length;u++)s+=this._textLines[u].length;o&&i===s&&(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,s=0,a=this.get2DCursorLocation(t);r=a.charIndex,n=a.lineIndex;for(var l=0;l<n;l++)o+=this.getHeightOfLine(l);e=this._getLineLeftOffset(n);var c=this.__charBounds[n][r];return c&&(s=c.left),0!==this.charSpacing&&r===this._textLines[n].length&&(s-=this._getWidthOfCharSpacing()),i={top:o,left:e+(s>0?s: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"),s=this.scaleX*this.canvas.getZoom(),a=this.cursorWidth/s,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-a/2,l+t.top+c,a,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),s=this.get2DCursorLocation(r),a=o.lineIndex,l=s.lineIndex,c=o.charIndex<0?0:o.charIndex,u=s.charIndex<0?0:s.charIndex,h=a;h<=l;h++){var d,p=this._getLineLeftOffset(h)||0,f=this.getHeightOfLine(h),g=0,m=0;if(h===a&&(g=this.__charBounds[a][c].left),h>=a&&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=f,(this.lineHeight<1||h===l&&this.lineHeight>1)&&(f/=this.lineHeight);var b=t.left+p+g,y=m-g,x=f,w=0;this.inCompositionMode?(e.fillStyle=this.compositionColor||"black",x=1,w=f):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 s in o.styles)for(var a in o.styles[s])t(o.styles[s][a]);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],s=n.reNonWord;!s.test(o)&&i>0&&i<r.length;)o=r[i+=e];return s.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 s=r.slice(t,e);return{selectionStart:o,selectionEnd:o+n.util.string.graphemeSplit(s).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,s=this.getValueOfPropertyAt(i,o,"fontSize")*this.lineHeight,a=e.leftOffset,l=this.calcTransformMatrix(),c={x:e.left+a,y:e.top+e.topOffset+s},u=this.canvas.getRetinaScaling(),h=this.canvas.upperCanvasEl,d=h.width/u,p=h.height/u,f=d-s,g=p-s,m=h.clientWidth/d,v=h.clientHeight/p;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>f&&(c.x=f),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:s+"px",charHeight:s}},_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),s=i.lineIndex,a=i.charIndex,l=o.lineIndex,c=o.charIndex;if(s!==l){if(this.styles[s])for(n=a;n<this._unwrappedTextLines[s].length;n++)delete this.styles[s][n];if(this.styles[l])for(n=c;n<this._unwrappedTextLines[l].length;n++)(r=this.styles[l][n])&&(this.styles[s]||(this.styles[s]={}),this.styles[s][a+n-c]=r);for(n=s+1;n<=l;n++)delete this.styles[n];this.shiftLineStyles(l,s-l)}else if(this.styles[s]){r=this.styles[s];var u,h,d=c-a;for(n=a;n<c;n++)delete r[n];for(h in this.styles[s])(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,s={},a=!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&&(a=!0,s[u-n]=this.styles[e][c],l&&0===n||delete this.styles[e][c])}var h=!1;for(a&&!l&&(this.styles[e+r]=s,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],s=o?t(o):{};for(var a in r||(r=1),s){var l=parseInt(a,10);l>=n&&(o[l+r]=s[l],s[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,s=0;s<t.length;s++)"\n"===t[s]?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(s=1;s<o;s++)i[s]>0?this.insertCharStyleObject(r.lineIndex+s,0,i[s],n):n&&this.styles[r.lineIndex+s]&&n[0]&&(this.styles[r.lineIndex+s][0]=n[0]),n=n&&n.slice(i[s]+1);i[s]>0&&this.insertCharStyleObject(r.lineIndex+s,0,i[s],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,s=0,a=0,l=0,c=this._textLines.length;l<c&&o<=n.y;l++)o+=this.getHeightOfLine(l)*this.scaleY,a=l,l>0&&(s+=this._textLines[l-1].length+this.missingNewlineOffset(l-1));i=this._getLineLeftOffset(a)*this.scaleX,e=this._textLines[a],"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[a][u].kernedWidth*this.scaleX)<=n.x);u++)s++;return this._getNewSelectionStartFromOffset(n,r,i,s,h)},_getNewSelectionStartFromOffset:function(t,e,n,r,i){var o=t.x-e,s=n-t.x,a=r+(s>o||s<0?0:1);return this.flipX&&(a=i-a),a>this._text.length&&(a=this._text.length),a}}),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-top: "+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,s,a,l=this._splitTextIntoLines(this.hiddenTextarea.value).graphemeText,c=this._text.length,u=l.length,h=u-c,d=this.selectionStart,p=this.selectionEnd,f=d!==p;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;f?(r=this._text.slice(d,p),h+=p-d):u<c&&(r=m?this._text.slice(p+h,p):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]})),f?(s=d,a=p):m?(s=p-r.length,a=p):(s=p,a=p+r.length),this.removeStyleFromTo(s,a)),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,s=this._getWidthBeforeCursor(i,o),a=this._getIndexOnLine(i+1,s);return this._textLines[i].slice(o).length+a+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,s=this._getWidthBeforeCursor(i,o),a=this._getIndexOnLine(i-1,s),l=this._textLines[i].slice(0,o),c=this.missingNewlineOffset(i-1);return-this._textLines[i-1].length+a-l.length+(1-c)},_getIndexOnLine:function(t,e){for(var n,r,i=this._textLines[t],o=this._getLineLeftOffset(t),s=0,a=0,l=i.length;a<l;a++)if((o+=n=this.__charBounds[t][a].width)>e){r=!0;var c=o-n,u=o,h=Math.abs(c-e);s=Math.abs(u-e)<h?a:a-1;break}return r||(s=i.length-1),s},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 s=0,a=this._textLines.length;s<a;s++)n=this._getLineLeftOffset(s),(this.textBackgroundColor||this.styleHas("textBackgroundColor",s))&&this._setSVGTextLineBg(i,s,e+n,o),this._setSVGTextLineText(r,s,e+n,o),o+=this.getHeightOfLine(s);return{textSpans:r,textBgRects:i}},_createTextCharSpan:function(r,i,o,s){var a=r!==r.trim()||r.match(e),l=this.getSvgSpanStyles(i,a),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(s,d),'" ',h,c,">",n.util.string.escapeXml(r),"</tspan>"].join("")},_setSVGTextLineText:function(t,e,r,i){var o,s,a,l,c,u=this.getHeightOfLine(e),h=-1!==this.textAlign.indexOf("justify"),d="",p=0,f=this._textLines[e];i+=u*(1-this._fontSizeFraction)/this.lineHeight;for(var g=0,m=f.length-1;g<=m;g++)c=g===m||this.charSpacing,d+=f[g],a=this.__charBounds[e][g],0===p?(r+=a.kernedWidth-a.width,p+=a.width):p+=a.kernedWidth,h&&!c&&this._reSpaceAndTab.test(f[g])&&(c=!0),c||(o=o||this.getCompleteStyleDeclaration(e,g),s=this.getCompleteStyleDeclaration(e,g+1),c=n.util.hasStyleChanged(o,s,!0)),c&&(l=this._getStyleDeclaration(e,g)||{},t.push(this._createTextCharSpan(d,l,r,i)),d="",o=s,r+=p,p=0)},_pushTextBgRect:function(e,r,i,o,s,a){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(s,l),'" height="',t(a,l),'"></rect>\n')},_setSVGTextLineBg:function(t,e,n,r){for(var i,o,s=this._textLines[e],a=this.getHeightOfLine(e)/this.lineHeight,l=0,c=0,u=this.getValueOfPropertyAt(e,0,"textBackgroundColor"),h=0,d=s.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,a),c=i.left,l=i.width,u=o):l+=i.kernedWidth;o&&this._pushTextBgRect(t,o,n+c,r,l,a)},_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],s=this._styleMap[t+1];for(var a in o&&(t=o.line,r=o.offset),s&&(i=s.line===t,e=s.offset),n=typeof t>"u"?this.styles:{line:this.styles[t]})for(var l in n[a])if(l>=r&&(!i||l<e))for(var c in n[a][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,s=t.length;o<s;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,s=this.splitByGrapheme,a=[],l=[],c=s?e.util.string.graphemeSplit(t):t.split(this._wordJoiners),u="",h=0,d=s?"":" ",p=0,f=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=s?c[b]:e.util.string.graphemeSplit(c[b]),p=this._measureWord(u,n,h),h+=u.length,(o+=f+p-v)>r&&!m?(a.push(l),l=[],o=p,m=!0):o+=v,!m&&!s&&l.push(d),l=l.concat(u),f=s?0:this._measureWord([d],n,h),h++,m=!1,p>g&&(g=p);return b&&a.push(l),g+i>this.dynamicMinWidth&&(this.dynamicMinWidth=g-v+i),a},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,s=t.scalingXOrSkewingY,a=t.scaleOrSkewActionName,l=n.Object.prototype.controls;if(l.ml=new n.Control({x:-.5,y:0,cursorStyleHandler:e,actionHandler:s,getActionName:a}),l.mr=new n.Control({x:.5,y:0,cursorStyleHandler:e,actionHandler:s,getActionName:a}),l.mb=new n.Control({x:0,y:.5,cursorStyleHandler:e,actionHandler:o,getActionName:a}),l.mt=new n.Control({x:0,y:-.5,cursorStyleHandler:e,actionHandler:o,getActionName:a}),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"})}}()}(ap);const cp={lockScalingFlip:!0,originY:"center",originX:"center",lockMovementX:!0,lockMovementY:!0,borderColor:"transparent"};function up(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 hp=null;function dp(t){hp=t}class pp{constructor(){c(this,"maxZoom",2),c(this,"minZoom",1),c(this,"step",.05),this.allowUserZoom&&this.bindMouseWheel(),ba.subscribe(t=>t.stageSize,()=>{setTimeout(()=>{this.fitToScreen()},1)})}get allowUserZoom(){var t,e,n;return(null==(n=null==(e=null==(t=ya().config)?void 0:t.tools)?void 0:e.zoom)?void 0:n.allowUserZoom)??!0}get currentZoom(){return ya().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=x.round(ya().original.width*t,0),r=x.round(ya().original.height*t,0);wa().setZoom(t),e&&wa().setDimensions({width:n,height:r}),ya().setZoom(t)}fitToScreen(){var t,e;if(null==(e=null==(t=ya().config.tools)?void 0:t.zoom)||!e.fitImageToScreen)return;const{width:n,height:r}=ya().stageSize,i=Math.max(r,1),o=Math.max(n,1);if(ya().original.height>i||ya().original.width>o){const t=Math.min(i/ya().original.height,o/ya().original.width);this.minZoom=Math.min(t,1)}else this.minZoom=1;this.set(this.minZoom)}bindMouseWheel(){wa().on("mouse:wheel",t=>{t.e.preventDefault(),t.e.stopPropagation(),null==hp&&(t.e.deltaY<0?this.zoomIn():this.zoomOut())})}}function fp(t){return new Promise(e=>{ap.fabric.util.loadImage(t,t=>e(new ap.fabric.Image(t)),null,ya().config.crossOrigin?"anonymous":void 0)})}function gp(){return!ya().config.image&&!ya().config.blankCanvasSize&&(!wa()||0===wa().getObjects().length)}class mp{constructor(){c(this,"minWidth",50),c(this,"minHeight",50)}resize(t,e,{applyZoom:n=!1,resizeHelper:r=!0}={}){const i=ya().zoom;wa().setWidth(t*(n?i:1)),wa().setHeight(e*(n?i:1)),ya().setOriginal(t,e),r&&xa().transform.resetStraightenAnchor()}async addMainImage(t,e="mainImage"){var n,r;ya().toggleLoading(e);const i=await fp(t);if(i)return this.clear(),i.set(Sa),i.name=ds.MainImage,wa().add(i),this.resize(i.width,i.height),i.center(),i.setCoords(),xa().zoom.fitToScreen(),ya().toggleLoading(!1),null==(r=(n=ya().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),wa().backgroundColor=n,xa().zoom.fitToScreen(),ya().toggleLoading("newCanvas"),requestAnimationFrame(()=>{ya().toggleLoading(!1)}),Promise.resolve({width:t,height:e})}getMainImage(){return wa().getObjects().find(t=>t.name===ds.MainImage)}render(){wa().requestRenderAll()}async loadInitialContent(){var t,e;const n=ya().config.image,r=ya().config.blankCanvasSize,i=ya().config.state;if(n&&n.endsWith("json")){const t=await Ca(n);await xa().import.loadState(t)}else n&&n.startsWith('{"canvas')?await xa().import.loadState(n):n?await this.addMainImage(n):i?await xa().import.loadState(i):r&&await this.openNew(r.width,r.height);return gp()&&null!=(e=null==(t=ya().config.ui)?void 0:t.openImageDialog)&&e.show&&ya().togglePanel("newImage",!0),new Promise(t=>{setTimeout(()=>{xa().history.addInitial(),t()},10)})}clear(){wa().clear(),xa().frame.remove(),xa().transform.resetStraightenAnchor()}}const vp=["fontSize","fontFamily","left","top","width","height","scaleX","scaleY","flipX","flipY","angle","src","strokeWidth"];function bp(t={}){wa().fire("object:modified",function(t){return{values:t,sizeOrPositionChanged:yp(t)}}(t))}function yp(t){return Object.keys(t).some(t=>vp.includes(t))}function xp(t){var e,n;const[r]=ja(null==(e=t.selected)?void 0:e[0]),i=r===ya().activeTool;return!(!ya().dirty||null!=(n=t.selected)&&n[0]&&i)&&(t.deselected&&xa().objects.select(t.deselected[0]),!0)}function wp(t){(null==t?void 0:t.data.id)!==ya().objects.active.id&&(ya().objects.setActive(t??null),ya().activeTool!==Qr.DRAW&&Ta())}class _p{constructor(){this.syncObjects(),ya().fabric.on("selection:created",t=>{var e;null!=(e=t.selected)&&e[0]&&!xp(t)&&wp(t.selected[0])}),ya().fabric.on("selection:updated",t=>{var e;xp(t)||wp(null==(e=t.selected)?void 0:e[0])}),ya().fabric.on("selection:cleared",()=>{wp()}),ya().fabric.on("text:editing:entered",()=>{ya().objects.setIsEditingText(!0)}),ya().fabric.on("text:editing:exited",()=>{ya().objects.setIsEditingText(!1)}),ya().fabric.on("object:added",()=>{this.syncObjects()}),ya().fabric.on("object:removed",()=>{this.syncObjects()})}getAll(){return wa().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=ya().objects.active)?void 0:e.id)===n}getActive(){return wa().getActiveObject()}has(t){return this.getAll().findIndex(e=>e.name===t)>-1}select(t){const e="string"==typeof t?this.getById(t):t;e&&(wa().setActiveObject(e),wa().requestRenderAll())}deselectActive(){wa().discardActiveObject(),wa().requestRenderAll()}setValues(t,e){if(!(e=e||this.getActive()))return;let n=!1;(function(t){return t.name===ds.Sticker&&"forEachObject"in t})(e)&&t.fill&&t.fill!==e.fill&&e.forEachObject(e=>e.set("fill",t.fill)),hs(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(()=>{wa().requestRenderAll()},50):wa().requestRenderAll(),ya().objects.setActive(e),bp(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}),xa().canvas.render())}bringToFront(t){(t=t||this.getActive())&&(t.bringToFront(),xa().canvas.render())}sendToBack(t){(t=t||this.getActive())&&(t.sendToBack(),xa().canvas.render())}flipHorizontally(t){(t=t||this.getActive())&&(this.setValues({flipX:!t.flipX}),xa().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:up(10)},name:e.name}),wa().add(t),this.select(t),xa().canvas.render()}))}delete(t){(t=t||this.getActive())&&(this.deselectActive(),wa().remove(t),wa().requestRenderAll(),xa().history.addHistoryItem({name:"deletedObject"}))}syncObjects(){const t=this.getAll().map(t=>({name:t.name,selectable:t.selectable??!1,id:t.data.id}));ba.setState({objects:{...ya().objects,all:t}})}}const Cp={frame:null,fonts:[]};function Sp(t){return t.state||(t.state=ka()),{...t.state||ka(),name:t.name,id:up(15)}}function kp(t){return!!t&&/^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(t)}function Tp(t){return t?kp(t)?t:`${ya().config.baseUrl?`${ya().config.baseUrl}/`:""}${t}`:""}function jp(t,e){return e||btoa(t.split("/").pop())}const Op=new class{constructor(){c(this,"loadedAssets",{})}loadAsset(t,e={type:"js"}){var n;t=t.startsWith("//")?`${window.location.protocol}${t}`:t;const r=null==(n=this.loadedAssets[t])?void 0:n.state;return"loaded"!==r||e.force?!r||this.loadedAssets[t].doc!==e.document||e.force&&"loaded"===r?(this.loadedAssets[t]={state:new Promise(n=>{const r={url:kp(t)?t:`assets/${t}`,id:jp(t,e.id),resolve:n,parentEl:e.parentEl,document:e.document};"css"===e.type?this.loadStyleAsset(r):this.loadScriptAsset(r)}),doc:e.document},this.loadedAssets[t].state):this.loadedAssets[t].state:new Promise(t=>t())}isLoadingOrLoaded(t){return null!=this.loadedAssets[t]}loadStyleAsset(t){var e;const n=t.document||document,r=t.parentEl||n.head,i=n.createElement("link"),o=jp(t.url,t.id);i.rel="stylesheet",i.id=o,i.href=t.url;try{r.querySelector(`#${o}`)&&(null==(e=r.querySelector(`#${o}`))||e.remove())}catch{}i.onload=()=>{this.loadedAssets[t.url].state="loaded",t.resolve()},r.appendChild(i)}loadScriptAsset(t){var e;const n=t.document||document,r=t.parentEl||n.body,i=n.createElement("script"),o=jp(t.url,t.id);i.async=!0,i.id=o,i.src=t.url;try{r.querySelector(`#${o}`)&&(null==(e=r.querySelector(`#${o}`))||e.remove())}catch{}i.onload=()=>{this.loadedAssets[t.url].state="loaded",t.resolve()},(r||r).appendChild(i)}};function Ep(t){return`be-fonts-${t}`}function Mp(t,e){const n=e.document||document,r=[],i=[];let o=[];if(t.forEach(t=>{"google"in t&&t.google?r.push(t):"src"in t&&i.push(t)}),null!=r&&r.length){const r=e.weights||[400],i=t.map(t=>`${t.family}:${r.join(",")}`).join("|"),s=Op.loadAsset(`https://fonts.googleapis.com/css?family=${i}&display=swap`,{type:"css",id:Ep(e.id),force:e.forceAssetLoad,document:n});o.push(s)}if(null!=i&&i.length){const t=i.map(async t=>{const r=Array.from(n.fonts.values()).find(e=>e.family===t.family);if(r)return r.loaded;const i=new FontFace(t.family,`url(${null!=e&&e.prefixSrc?e.prefixSrc(t.src):t.src})`,t.descriptors);return n.fonts.add(i),i.load()});o=o.concat(t)}return Promise.all(o)}class Pp{async undo(){if(this.canUndo()){const t=ya().history.items[ya().history.pointer-1];await this.load(t)}}async redo(){if(this.canRedo()){const t=ya().history.items[ya().history.pointer+1];await this.load(t)}}canUndo(){return ya().history.canUndo}canRedo(){return ya().history.canRedo}reload(){return this.load(ya().history.items[ya().history.pointer])}replaceCurrent(){const t=ya().history.items[ya().history.pointer];[...ya().history.items][ya().history.pointer]=Sp({name:t.name,state:t})}addHistoryItem(t){const e=Sp(t),n=[...ya().history.items.slice(0,ya().history.pointer+1),e];ya().history.update(n.length-1,n)}load(t){return t={...t,editor:t.editor||Cp},new Promise(e=>{Mp(function(t){const e=[];return t.forEach(t=>{var n,r,i;if(!hs(t))return;const o=null==(i=null==(r=null==(n=ya().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),{prefixSrc:Tp,id:"pixie-fonts"}).finally(()=>{wa().loadFromJSON(t.canvas,()=>{xa().zoom.set(1),t.canvasWidth&&t.canvasHeight&&xa().canvas.resize(t.canvasWidth,t.canvasHeight,{resizeHelper:!1,applyZoom:!1}),xa().frame.remove(),t.editor.frame&&xa().frame.add(t.editor.frame.name,t.editor.frame.sizePercent),xa().objects.syncObjects(),xa().objects.getAll().forEach(t=>{var e,n;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({...cp}),"i-text"===t.type&&(t.padding=null==(n=null==(e=ya().config.tools)?void 0:e.text)?void 0:n.controlsPadding)}),xa().canvas.render(),wa().calcOffset(),xa().zoom.fitToScreen(),ya().history.updatePointerById(t.id),xa().transform.resetStraightenAnchor(),e()})})})}addInitial(t){!ya().history.items.find(t=>"initial"===t.name)&&(t||!gp())&&this.addHistoryItem({name:"initial",state:t})}}class Ap{canMerge(){return xa().objects.getAll().filter(t=>t.name!==ds.MainImage).length>0}async apply(){ya().toggleLoading("merge");const t=xa().export.getDataUrl();t&&await xa().canvas.addMainImage(t,"merge")}}const Dp=[{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"}}}],Ip={grayscale:Xr("grayscale"),blackWhite:Xr("Black & White"),sharpen:Xr("Sharpen"),invert:Xr("Invert"),vintage:Xr("Vintage"),polaroid:Xr("Polaroid"),kodachrome:Xr("Kodachrome"),technicolor:Xr("Technicolor"),brownie:Xr("Brownie"),sepia:Xr("Sepia"),removeColor:Xr("Remove Color"),brightness:Xr("Brightness"),gamma:Xr("Gamma"),noise:Xr("Noise"),pixelate:Xr("Pixelate"),blur:Xr("Blur"),emboss:Xr("Emboss"),blendColor:Xr("Blend Color")},Rp={distance:Xr("distance"),color:Xr("color"),brightness:Xr("brightness"),red:Xr("red"),green:Xr("green"),blue:Xr("blue"),noise:Xr("noise"),blocksize:Xr("blocksize"),mode:Xr("mode"),alpha:Xr("alpha")};function zp(t){return t&&t.charAt(0).toUpperCase()+t.slice(1)}class Lp{constructor(){ba.subscribe(t=>t.history.pointer,()=>{this.syncState()})}apply(t){ya().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(),xa().canvas.render()}remove(t){ya().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(),xa().canvas.render()}getAll(){return Dp}getByName(t){return Dp.find(e=>e.name===t)}isApplied(t){const e=xa().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())}),xa().canvas.render()}addCustom(t,e,n,r){const i=ap.fabric.Image.filters;i[zp(t)]=ap.fabric.util.createClass(i.BaseFilter,e),i[zp(t)].fromObject=i.BaseFilter.fromObject,Dp.push({name:t,options:n,initialConfig:r})}create(t){const e=t.initialConfig||{};let n;return t.uses?(e.matrix=t.matrix,n=new(ap.fabric.Image.filters[zp(t.uses)])(e)):(Object.entries(t.options||{}).forEach(([t,n])=>{e[t]=n.current}),n=new(ap.fabric.Image.filters[zp(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)}),ba.setState({filter:{...ya().filter,applied:e}})}getByFabricFilter(t){return Dp.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 xa().objects.getAll().filter(t=>t.name===ds.Image||t.name===ds.MainImage)}}function Fp(t){var e,n;const r=(null==(n=null==(e=ya().config.tools)?void 0:e.resize)?void 0:n.minWidth)||50;return t?Math.ceil(100*r/ya().original.width):r}function Np(t){var e,n;const r=(null==(n=null==(e=ya().config.tools)?void 0:e.resize)?void 0:n.maxWidth)||2400;return t?Math.ceil(100*r/ya().original.width):r}function Bp(t){var e,n;const r=(null==(n=null==(e=ya().config.tools)?void 0:e.resize)?void 0:n.minHeight)||50;return t?Math.ceil(100*r/ya().original.height):r}function Vp(t){var e,n;const r=(null==(n=null==(e=ya().config.tools)?void 0:e.resize)?void 0:n.maxHeight)||2400;return t?Math.ceil(100*r/ya().original.height):r}function $p(t,e){if(e)return t;const n=ya().original.height/t;return Math.floor(ya().original.width/n)}function Hp(t,e){if(e)return t;const n=ya().original.width/t;return Math.floor(ya().original.height/n)}class Wp{apply(t){const{width:e,height:n,usePercentages:r}=function(t){return t.width<Fp(t.usePercentages)&&(t.width=Fp(t.usePercentages),t.maintainAspect&&(t.height=Hp(t.width,t.usePercentages))),t.width>Np(t.usePercentages)&&(t.width=Np(t.usePercentages),t.maintainAspect&&(t.height=Hp(t.width,t.usePercentages))),t.height<Bp(t.usePercentages)&&(t.height=Bp(t.usePercentages),t.maintainAspect&&(t.width=$p(t.height,t.usePercentages))),t.height>Vp(t.usePercentages)&&(t.height=Vp(t.usePercentages),t.maintainAspect&&(t.width=$p(t.height,t.usePercentages))),t}(t),i=Math.ceil(ya().original.width),o=Math.ceil(ya().original.height),s=Math.ceil(e),a=Math.ceil(n);let l,c;r?(l=e/100,c=n/100):(l=e/ya().original.width,c=n/ya().original.height),(i!==s||o!==a)&&this.resize(l,c)}resize(t,e){xa().zoom.set(1,!1);const n=Math.round(ya().original.height*e),r=Math.round(ya().original.width*t);xa().canvas.resize(r,n,{applyZoom:!1,resizeHelper:!0}),xa().objects.getAll().forEach(n=>{const r=n.scaleX||1,i=n.scaleY||1,o=n.left||0,s=n.top||0,a=r*t,l=i*e,c=o*t,u=s*e;n.scaleX=a,n.scaleY=l,n.left=c,n.top=u,n.setCoords()}),xa().zoom.fitToScreen(),wa().requestRenderAll()}}function Up(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=ya().canvasSize.width,r=ya().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 Xp(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 Yp(t){if(!t)return null;const e=t.split(":");return parseInt(e[0])/parseInt(e[1])}class Gp{constructor(){c(this,"refs",null)}apply(t){var e;const n=null==(e=xa().frame.active.config)?void 0:e.name,r=xa().frame.active.currentSizeInPercent;return xa().frame.active.hide(),xa().merge.apply().then(()=>{xa().canvas.resize(Math.round(t.width),Math.round(t.height),{applyZoom:!0,resizeHelper:!0});const e=xa().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&&xa().frame.add(n,r),xa().zoom.fitToScreen(),xa().canvas.render()})}drawZone(t){var e;null!=(e=this.refs)&&e.current&&(ya().crop.setCropzoneRect(t),Up(t,this.refs.current))}resetCropzone(t){const e=ya().canvasSize,n=Yp(t);if(!e)return;ya().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=Xp(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 qp{getShapeByName(t){var e,n;const r=null==(n=null==(e=ya().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=ya().config.objectDefaults)?void 0:e.shape)||{},s={...o,...n.options};let a;if("circle"===n.name)a=new ap.fabric.Circle({...s,radius:100});else if("ellipse"===n.name)a=new ap.fabric.Ellipse({...s,rx:100,ry:50});else if("Path"===n.type)a=new ap.fabric.Path(s.path,{displayName:n.name,...s});else{const t=n.type;a=new ap.fabric[t]({...s,width:150,height:150})}return this.addAndPositionShape(a,ds.Shape,{width:r,height:i}),a}addSticker(t,e){var n,r,i;const o=null==(i=null==(r=null==(n=ya().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=Kp(o,e);return this.addSvgSticker(t)}return this.addRegularSticker(o,e)}addRegularSticker(t,e){return new Promise(n=>{ap.fabric.util.loadImage(Kp(t,e),t=>{var e;const{width:r,height:i,...o}=(null==(e=ya().config.objectDefaults)?void 0:e.sticker)||{},s=new ap.fabric.Image(t,o);this.addAndPositionShape(s,ds.Sticker,{width:r,height:i}),n()})})}addSvgSticker(t,e=ds.Sticker){return new Promise(n=>{ap.fabric.loadSVGFromURL(t,(t,r)=>{var i;const{width:o,height:s,...a}=(null==(i=ya().config.objectDefaults)?void 0:i.sticker)||{},l=ap.fabric.util.groupSVGElements(t,r);l.set(a),this.addAndPositionShape(l,e,{width:o,height:s}),n()})})}addAndPositionShape(t,e,{width:n}){t.name=e,t.scaleX=1,t.scaleY=1,wa().add(t);const r=n||ya().original.width*ya().zoom/4;t.scaleToWidth(Math.min(150,r)),t.viewportCenter(),t.setCoords(),xa().canvas.render(),wa().setActiveObject(t)}}function Kp(t,e){return Tp(`images/stickers/${t.name}/${e}.${t.type}`)}class Zp{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 ap.fabric.StaticCanvas(null),t.canvas.add(t.img);const n=new ap.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/=wa().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()}))}),xa().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={...Sa,originX:"left",originY:"top"};ya().config.crossOrigin&&(r.crossOrigin="anonymous"),ap.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 Tp(`images/frames/${t.name}/${e}.png`)}}class Jp{constructor(t,e){this.activeFrame=t,this.patterns=e}get defaultColor(){var t,e;return null==(e=null==(t=ya().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),xa().canvas.render()}):xa().canvas.render()}createParts(t){const e={};this.activeFrame.getPartNames().forEach(n=>{const r="basic"===t.mode?this.defaultColor:void 0;e[n]=new ap.fabric.Rect({...Sa,fill:r,originX:"left",originY:"top",name:`frame.rect.${n}`,objectCaching:!1,data:{pixieInternal:!0}}),wa().add(e[n])}),this.activeFrame.parts=e}resize(t){const e=ya().original.width,n=ya().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 Qp{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})),xa().canvas.render())}show(){this.parts&&(Object.values(this.parts).forEach(t=>t.set({visible:!0})),xa().canvas.render())}remove(){this.parts&&(this.config=null,Object.values(this.parts).forEach(t=>{wa().remove(t)}),this.parts=null,xa().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)}),xa().canvas.render())}getMinSize(){var t;return(null==(t=this.config)?void 0:t.size.min)??1}getMaxSize(){var t;return(null==(t=this.config)?void 0:t.size.max)??35}}class tf{constructor(){c(this,"patterns"),c(this,"builder"),c(this,"active"),this.active=new Qp,this.patterns=new Zp(this.active),this.builder=new Jp(this.active,this.patterns),wa().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=e??n.size.default;const r=this.calcFrameSizeInPixels(this.active.currentSizeInPercent);this.builder.build(n,r),ya().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),xa().canvas.render()}changeColor(t){this.active.changeColor(t)}remove(){this.active.remove(),ya().frame.deselect()}getByName(t){var e,n;const r=null==(n=null==(e=ya().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(ya().original.width,ya().original.height);return Math.ceil(t/100*e)}}class ef{constructor(){c(this,"minWidth",250)}add(t,e={}){var n,r,i,o,s;if(!(t=t||(null==(r=null==(n=ya().config.tools)?void 0:n.text)?void 0:r.defaultText)))return;const a={...null==(i=ya().config.objectDefaults)?void 0:i.text,...e,name:ds.Text,padding:null==(s=null==(o=ya().config.tools)?void 0:o.text)?void 0:s.controlsPadding,editingBorderColor:qr.fill},l=new ap.fabric.IText(t,a);wa().add(l),null==e.left&&null==e.top&&this.autoPositionText(l),xa().objects.select(l)}autoPositionText(t){const e=wa().getWidth(),n=wa().getHeight(),r=Math.min(wa().getWidth(),this.minWidth);t.scaleToWidth(Math.max(e/3,r)),t.getScaledHeight()>n&&t.scaleToHeight(n-t.getScaledHeight()-20),t.viewportCenter(),wa().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>ya().original.height-e.getScaledHeight()&&(r=0),t.set("top",r),t.setCoords()}})}selectOrAddText(t,e={}){if(ya().objects.active.isText)return!1;const n=xa().objects.getAll().find(t=>hs(t));return n?(xa().objects.select(n),!1):(this.add(t,e),!0)}}const nf=t=>{const e=new ap.fabric.PatternBrush(t);return e.getPatternSrc=function(){const t=ap.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},rf=t=>{const e=new ap.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},of=t=>{const e=new ap.fabric.PatternBrush(t);return e.getPatternSrc=function(){const t=this.width/2,e=document.createElement("canvas"),n=new ap.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},sf=t=>{const e=new ap.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 af,lf;class cf{constructor(){c(this,"customBrushes",{VLineBrush:nf,HLineBrush:rf,DiamondBrush:of,SquareBrush:sf}),c(this,"currentBrush",{type:"PencilBrush",color:null==(lf=null==(af=ya().config.objectDefaults)?void 0:af.global)?void 0:lf.fill,width:Kr[1]}),c(this,"onPathCreated",t=>{t.path.name=ds.Drawing,t.path.set(function(){const t={...Sa};return delete t.strokeWidth,t}()),ya().setDirty(!0)})}enable(){wa().on("path:created",this.onPathCreated),wa().isDrawingMode=!0,this.setBrushType(this.currentBrush.type),this.setBrushSize(this.currentBrush.width)}disable(){wa().off("path:created",this.onPathCreated),wa().isDrawingMode=!1}getBrushType(){return this.currentBrush.type}setBrushType(t){this.currentBrush.type=t,wa().freeDrawingBrush=t in ap.fabric?new ap.fabric[t](wa()):this.customBrushes[t](wa()),this.applyBrushStyles()}applyBrushStyles(){Object.keys(this.currentBrush).forEach(t=>{wa().freeDrawingBrush[t]=this.currentBrush[t]});const t=wa().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}}async function uf(t,e=!0,n=!0){const r=await fp(t);if(r)return new Promise(t=>{r.name=ds.Image,r.opacity=0;const i=ya().original.width,o=ya().original.height;if(e&&(r.width>=i||r.height>=o)){const t=i-.1*i,e=o-.1*o,n=1/Math.min(e/r.getScaledHeight(),t/r.getScaledWidth());r.scaleX*=1/n,r.scaleY*=1/n}ya().fabric.add(r),n&&ya().fabric.setActiveObject(r),r.viewportCenter(),r.setCoords(),ya().fabric.requestRenderAll(),xa().zoom.fitToScreen(),r.animate("opacity","1",{duration:425,onChange:()=>{ya().fabric.requestRenderAll()},onComplete:()=>{t(r)}})})}function hf(t){var e;return(null==(e=/(?:\.([^.]+))?$/.exec(t))?void 0:e[1])||""}class df{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=Oa(),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",log:"text/plain"},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+=`-${pf(t.toLowerCase())}`),e&&(o+=`-${e}`),"string"==typeof r&&(o+=`-${pf(r.toLowerCase())}`),void 0!==n&&(o+=`-${n}`),void 0!==i&&(o+=`-${i}`),o}({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 pf(t){let e="";return t.replace(/[^A-Z0-9]/gi,t=>(e+=`-${function(t){return t.charCodeAt(0).toString(32)}(t)}`,"/"))+e}function ff(t={}){return new Promise(e=>{const n=function(t={}){const e=document.querySelector("#hidden-file-upload-input");e&&e.remove();const n=document.createElement("input");return n.type="file",n.multiple=t.multiple??!1,n.classList.add("hidden"),n.style.display="none",n.style.visibility="hidden",n.id="hidden-file-upload-input",n.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&&(n.webkitdirectory=!0),document.body.appendChild(n),n}(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 df(t));e(i),n.remove()},document.body.appendChild(n),n.click()})}var gf=(t=>(t.image="image/*",t.audio="audio/*",t.text="text/*",t.json="application/json",t.video="video/mp4,video/mpeg,video/x-m4v,video/*",t))(gf||{});function mf(t,e=1){if(null==t||Number.isNaN(t))return"";const n=t<0,r=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];if(n&&(t=-t),t<1)return(n?"-":"")+t+" B";const i=Math.min(Math.floor(Math.log(t)/Math.log(1024)),r.length-1);t=Number(t/Math.pow(1024,i));const o=r[i];return t>=10||t%1===0?`${(n?"-":"")+t.toFixed(0)} ${o}`:`${(n?"-":"")+t.toFixed(e)} ${o}`}function vf(t,e){this.text=t=t||"",this.hasWild=~t.indexOf("*"),this.separator=e,this.parts=t.split(e)}vf.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 s in r={},t)this.match(s)&&(r[s]=t[s]);return r};var bf=function(t,e,n){var r=new vf(t,n||/[\/\.]/);return typeof e<"u"?r.match(e):r},yf=/[\/\+\.]/,xf=function(t,e){function n(e){var n=bf(e,t,yf);return n&&n.length>=2}return e?n(e.split(";")[0]):n};const wf=$r(xf);function _f(t,e){return e.map(t=>t.split(",")).flat().some(e=>{if(e.includes("/"))return!!t.mime&&wf(t.mime.replace(/;.*?$/,""),e);const n=e.replace(".","").toLowerCase();return!(!n||!t.extension)&&t.extension.toLowerCase()===n})}class Cf{async uploadAndAddImage(t=!0){const e=await this.openUploadWindow();await this.openUploadedFile(e,t)}async uploadAndReplaceMainImage(){const t=await this.openUploadWindow();t&&await this.openBackgroundImage(t)}async uploadAndOpenStateFile(){const t=await this.openUploadWindow(Sf);t&&await this.loadState(await t.data)}async addImageFromUrl(t,e=!0){var n,r;await uf(t,(null==(r=null==(n=ya().config.tools)?void 0:n.import)?void 0:r.fitOverlayToScreen)??!0,e),xa().history.addHistoryItem({name:"overlayImage"})}async addImageFromData(t,e=!0){var n,r;await uf(t,(null==(r=null==(n=ya().config.tools)?void 0:n.import)?void 0:r.fitOverlayToScreen)??!0,e),xa().history.addHistoryItem({name:"overlayImage"})}async openUploadedFile(t,e=!0){if(!t)return;const n=await t.data;switch(t.extension){case"json":await this.loadState(n);break;case"svg":await xa().shape.addSvgSticker(n,ds.Image),xa().history.addHistoryItem({name:"overlayImage"});break;default:await this.addImageFromData(n,e)}}async loadState(t){let e;ya().toggleLoading("state"),await _a(),e="string"==typeof t?t.endsWith(".json")?await Ca(t):JSON.parse(t):t,e.history?ya().history.reset(e.history):await xa().history.addInitial(e),await xa().history.reload(),ya().toggleLoading(!1)}async openUploadWindow(t){var e,n;t=t||function(){var t,e;const n=null==(e=null==(t=ya().config.tools)?void 0:t.import)?void 0:e.validImgExtensions;return n?{extensions:n}:{types:[gf.image]}}();const r=(await ff(t))[0];return this.fileIsValid(r)?(null==(n=(e=ya().config).onFileOpen)||n.call(e,r),r):null}async openBackgroundImage(t){let e;await _a(),e=t instanceof HTMLImageElement?t.src:t instanceof df?await t.data:t;const n=await xa().canvas.addMainImage(e);return await xa().history.addInitial(),n}fileIsValid(t){var e,n,r,i;const o=(null==(n=null==(e=ya().config.tools)?void 0:e.import)?void 0:n.maxFileSize)??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"),s=function(t,e){if(!e)return;const{maxFileSize:n,allowedFileTypes:r,blockedFileTypes:i}=e;return n&&null!=t.size&&t.size>n?Xr("`:file` exceeds maximum allowed size of :size",{values:{file:t.name,size:mf(n)}}):null!=r&&r.length&&!_f(t,r)||null!=i&&i.length&&_f(t,i)?Xr("This file type is not allowed"):void 0}(t,{maxFileSize:o,allowedFileTypes:[...(null==(i=null==(r=ya().config.tools)?void 0:r.import)?void 0:i.validImgExtensions)??[],"json"]});return!s||(Aa.danger(s),!1)}}const Sf={types:[".json",gf.json]};class kf{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(),wa().add(this.watermark),xa().canvas.render()}remove(){this.watermark&&(wa().remove(this.watermark),this.watermark=null,xa().canvas.render())}createGroup(){this.watermark=new ap.fabric.Group(void 0,{...Sa,width:ya().original.width,height:ya().original.height,excludeFromExport:!0,top:0,left:0,originX:"left",originY:"top"})}addText(t){var e;const n=new ap.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(ya().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=ya().original.width/2,r=ya().original.height/2,i=100,o=e.width/4,s=new ap.fabric.Line(void 0,this.lineStyle),a=new ap.fabric.Line(void 0,this.lineStyle),l=new ap.fabric.Line(void 0,this.lineStyle),c=new ap.fabric.Line(void 0,this.lineStyle);this.watermark.add(s,a,l,c),s.set({x1:o,y1:-i,x2:n,y2:-r}),a.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 Tf={exports:{}};!function(t){!function(){function e(t,e){return typeof e>"u"?e={autoBom:!1}:"object"!=typeof e&&(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(){a(r.response,e,n)},r.onerror=function(){},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 Vr&&Vr.global===Vr?Vr:void 0,s=o.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),a=o.saveAs||("object"!=typeof window||window!==o?function(){}:"download"in HTMLAnchorElement.prototype&&!s?function(t,e,s){var a=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,s):i(l,l.target="_blank")):(l.href=a.createObjectURL(t),setTimeout(function(){a.revokeObjectURL(l.href)},4e4),setTimeout(function(){i(l)},0))}:"msSaveOrOpenBlob"in navigator?function(t,o,s){if(o=o||t.name||"download","string"!=typeof t)navigator.msSaveOrOpenBlob(e(t,s),o);else if(r(t))n(t,o,s);else{var a=document.createElement("a");a.href=t,a.target="_blank",setTimeout(function(){i(a)})}}: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 a="application/octet-stream"===t.type,l=/constructor/i.test(o.HTMLElement)||o.safari,c=/CriOS\/[\d]+/.test(navigator.userAgent);if((c||a&&l||s)&&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=a.saveAs=a,t.exports=a}()}(Tf);var jf=Tf.exports;class Of{save(t,e,n){var r,i,o;const s=null==(r=ya().config.tools)?void 0:r.export;t=t||(null==s?void 0:s.defaultName),e=this.getFormat(e),n=this.getQuality(n);const a=`${t}.${e}`;this.applyWaterMark();const l="json"===e?this.getJsonState():this.getDataUrl(e,n);if(xa().watermark.remove(),l)if(ya().config.saveUrl)fetch(ya().config.saveUrl,{method:"POST",body:JSON.stringify({data:l,filename:a,format:e})});else if(ya().config.onSave)null==(o=(i=ya().config).onSave)||o.call(i,l,a,e);else{const t=this.getCanvasBlob(e,l);jf.saveAs(t,a)}}getDataUrl(t,e){try{return"svg"===t?wa().toSVG():wa().toDataURL({format:this.getFormat(t),quality:this.getQuality(e),multiplier:Math.max(ya().original.width/wa().width,ya().original.height/wa().height)})}catch(n){n.message.toLowerCase().includes("tainted")&&Aa.danger(Xr("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 s=new Uint8Array(e);i.push(s)}return new Blob(i,{type:e})}(e=e.replace(/data:image\/([a-z]*)?;base64,/,""),n)}getJsonState(){return JSON.stringify({...ka(),history:ya().history})}applyWaterMark(){const t=ya().config.watermarkText;t&&xa().watermark.add(t)}getFormat(t){var e;const n=null==(e=ya().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=ya().config.tools)?void 0:e.export;return t=t||(null==n?void 0:n.defaultQuality)||.8}}class Ef{constructor(){c(this,"previewRect",null)}async apply(t){this.previewRect||this.showPreview(),this.updatePreview(t),wa().remove(this.previewRect),wa().clipPath=this.previewRect;const e=xa().export.getDataUrl();e&&xa().canvas.clear(),this.hidePreview(),e&&await xa().canvas.addMainImage(e),wa().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}),xa().canvas.render())}showPreview(){const t=.04*ya().original.width;this.previewRect=new ap.fabric.Rect({width:ya().original.width,height:ya().original.height,rx:t,ry:t,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}),wa().add(this.previewRect),this.previewRect.moveTo(99),this.previewRect.viewportCenter(),xa().canvas.render()}hidePreview(){this.previewRect&&(wa().remove(this.previewRect),xa().canvas.render(),this.previewRect=null)}}class Mf{get straightenAnchor(){return wa().getObjects().find(t=>t.name===ds.StraightenAnchor)}rotateLeft(){this.rotateFixed(-90)}rotateRight(){this.rotateFixed(90)}straighten(t){this.storeObjectsRelationToHelper(),xa().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";xa().objects.getAll().forEach(t=>{t[e]=!t[e]}),xa().canvas.render()}rotateFixed(t){xa().zoom.set(1,!1),xa().objects.deselectActive();const e=this.straightenAnchor.data.rotateAngle||0;t=90*Math.round(t/90);const n=e+(this.straightenAnchor.data.straightenAngle||0)+t;xa().canvas.resize(ya().original.height,ya().original.width,{applyZoom:!1,resizeHelper:!1}),this.storeObjectsRelationToHelper(),this.straightenAnchor.rotate(n),this.straightenAnchor.data.rotateAngle=e+t,this.straightenAnchor.center(),this.transformObjectsBasedOnHelper(),xa().frame.resize(xa().frame.active.currentSizeInPercent),requestAnimationFrame(()=>{xa().zoom.fitToScreen()})}getImageScale(t,e){t=ap.fabric.util.degreesToRadians(t);const n=ya().original.width/2,r=ya().original.height/2,i=e.width/2,o=e.height/2,s=Math.sqrt(n**2+r**2),a=Math.asin(r/s);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-a-Math.abs(l),u=Math.abs(a-Math.abs(l)),h=Math.cos(c)*s,d=Math.cos(u)*s;return Math.max(d/i,h/o)}storeObjectsRelationToHelper(){xa().objects.getAll().forEach(t=>{if(t!==this.straightenAnchor){const e=ap.fabric.util.multiplyTransformMatrices(ap.fabric.util.invertTransform(this.straightenAnchor.calcTransformMatrix()),t.calcTransformMatrix());t.data={...t.data,relationToCanvas:e}}})}transformObjectsBasedOnHelper(){xa().objects.getAll().forEach(t=>{if(t.data.relationToCanvas){const e=ap.fabric.util.multiplyTransformMatrices(this.straightenAnchor.calcTransformMatrix(),t.data.relationToCanvas),n=ap.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&&wa().remove(t);const e=new ap.fabric.Rect({...Sa,name:ds.StraightenAnchor,visible:!1,width:ya().original.width,height:ya().original.height,data:{pixieInternal:!0,straightenAngle:0,rotateAngle:0}});wa().add(e),e.viewportCenter()}}function Pf(t){const e=function(t){var e;const n=new ap.fabric.Canvas(t,{width:1,height:1});n.preserveObjectStacking=!0,n.selection=!1,n.renderOnAddRemove=!1;const r=ya().config.textureSize;r&&(ap.fabric.textureSize=r);const i={...null==(e=ya().config.objectDefaults)?void 0:e.global,...cp};Object.keys(i).forEach(t=>{ap.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=up(10))});const o=ap.fabric.Object.prototype.controls;return Object.keys(o).forEach(t=>{delete o[t]}),n}(t);ya().editor.fabric=e,ba.setState({fabric:e}),ya().editor.tools={canvas:new mp,objects:new _p,zoom:new pp,history:new Pp,filter:new Lp,resize:new Wp,crop:new Gp,merge:new Ap,shape:new qp,frame:new tf,text:new ef,draw:new cf,transform:new Mf,import:new Cf,watermark:new kf,export:new Of,corners:new Ef}}function Af(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 Df(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 If="flex flex-shrink-0 items-center justify-between px-12 py-[9px] w-full h-[54px]",Rf={initial:{opacity:0},animate:{opacity:1},exit:{opacity:0,position:"absolute"},transition:{type:"tween",duration:.15}};function zf(t,{padding:e,equalWidth:n,variant:r}={}){switch(t){case"2xs":return"link"===r?"text-xs":`text-xs h-24 ${n?"w-24":e||"px-10"}`;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 Lf(t){const{variant:e,shadow:n,whitespace:r="whitespace-nowrap",display:i="inline-flex"}=t,o={...t,border:t.border||"border"};let s=[];return"outline"===e?s=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"positive":return[`text-positive bg-transparent ${e} border-positive/50`,"hover:bg-positive/4 hover:border-positive",n];case"paper":return[`text bg-paper ${e}`,"hover:bg-hover",n];case"white":return["text-white bg-transparent border border-white","hover:bg-white/20","disabled:text-white/70 disabled:border-white/70 disabled:bg-transparent"];default:return[`bg-transparent ${e}`,"hover:bg-hover",n]}}(o):"text"===e?s=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];case"positive":return["text-positive bg-transparent border-transparent","hover:bg-positive/4",e];case"white":return["text-white bg-transparent border-transparent","hover:bg-white/20","disabled:text-white/70 disabled:bg-transparent"];default:return["bg-transparent border-transparent","hover:bg-hover",e]}}(o):"flat"===e||"raised"===e?s=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:border-paper/90",n];case"white":return[`text-black bg-white ${e} border-white`,"hover:bg-white",n];default:return[`bg ${e} border-background`,"hover:bg-hover",n]}}(o):"link"===e&&(s=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"]}}(o)),[...s,n||"raised"===e&&"shadow-md",r,i,e&&"align-middle flex-shrink-0 items-center transition-button duration-200","select-none appearance-none no-underline outline-none disabled:pointer-events-none disabled:cursor-default"]}function Ff(t){return t&&(e=>{e.currentTarget.contains(e.target)&&t(e)})}const Nf=(0,i.forwardRef)((t,e)=>{const{children:n,color:i=null,variant:o,radius:s,shadow:a,whitespace:l,justify:c="justify-center",className:u,href:h,form:d,border:p,elementType:f,to:g,relative:m,replace:v,end:b,display:y,type:x="button",onClick:w,onPointerDown:_,onPointerUp:C,onKeyDown:S,...k}=t,T=f||(h?"a":"button"),j="a"===T;return(0,r.jsx)(T,{ref:e,form:j?void 0:d,href:h,to:g,relative:m,type:j?void 0:x,replace:v,end:b,onPointerDown:Ff(_),onPointerUp:Ff(C),onClick:Ff(w),onKeyDown:Ff(S),className:ei("focus-visible:ring",Lf({variant:o,color:i,border:p,whitespace:l,display:y}),s,c,u),...k,children:n})}),Bf=i.forwardRef(({children:t,startIcon:e,endIcon:n,size:i="sm",sizeClassName:o,className:s,equalWidth:a=!1,radius:l="rounded-button",variant:c="text",disabled:u,elementType:h,to:d,replace:p,href:f,download:g,...m},v)=>{const b=ei("font-semibold",o||zf(i,{equalWidth:a,variant:c}),s);return(0,r.jsxs)(Nf,{className:b,ref:v,radius:l,variant:c,disabled:u,to:u?void 0:d,href:u?void 0:f,download:u?void 0:g,elementType:u?void 0:h,replace:u?void 0:p,...m,children:[e&&(0,r.jsx)(Vf,{position:"start",icon:e,size:i}),t,n&&(0,r.jsx)(Vf,{position:"end",icon:n,size:i})]})});function Vf({icon:t,position:e,size:n}){const r=ei("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})}const $f=(0,i.createContext)(null);function Hf(){return(0,i.useContext)($f)}const Wf=ii((0,r.jsx)("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z"}),"CheckOutlined"),Uf=i.forwardRef((t,e)=>{let{startIcon:n,capitalizeFirst:i,children:o,description:s,endIcon:a,endSection:l,isDisabled:c,isActive:u,isSelected:h,showCheckmark:d,elementType:p="div",radius:f,padding:g,...m}=t;!n&&d&&(n=(0,r.jsx)(Wf,{size:"sm",className:ei("text-primary",!h&&"invisible")}));const v=ei("icon-sm rounded overflow-hidden flex-shrink-0",!c&&"text-muted"),b=ei(!c&&"text-muted");return(0,r.jsxs)(p,{...m,"aria-disabled":c,className:Xf(t),ref:e,children:[n&&(0,r.jsx)("div",{className:v,children:n}),(0,r.jsxs)("div",{className:ei("min-w-auto mr-auto w-full overflow-hidden overflow-ellipsis",i&&"first-letter:capitalize"),children:[o,s&&(0,r.jsx)("div",{className:ei("mt-4 whitespace-normal text-xs",c?"text-disabled":"text-muted"),children:s})]}),(a||l)&&(0,r.jsx)("div",{className:a?v:b,children:a||l})]})});function Xf({className:t,isSelected:e,isActive:n,isDisabled:r,showCheckmark:i,endIcon:o,endSection:s,radius:a,padding:l}){let c,u="";return u=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",c=l||(i?o||s?"pl-8 pr-8 py-8":"pl-8 pr-24 py-8":"px-20 py-8"),ei("w-full select-none outline-none cursor-pointer","text-sm truncate flex items-center gap-10",!r&&"text-main",c,u,t,a)}function Yf({children:t,value:e,startIcon:n,endIcon:i,endSection:o,description:s,capitalizeFirst:a,textLabel:l,isDisabled:c,onSelected:u,onClick:h,...d}){var p;const{collection:f,showCheckmark:g,virtualFocus:m,listboxId:v,role:b,listItemsRef:y,handleItemSelection:x,state:{selectedValues:w,activeIndex:_,setActiveIndex:C}}=Hf(),S=w.includes(e),k=null==(p=f.get(e))?void 0:p.index,T=_===k;if(null==k)return null;const j=T&&!c?-1:0;return(0,r.jsx)(Uf,{...d,onFocus:()=>{m||C(k)},onPointerEnter:t=>{C(k),m||t.currentTarget.focus()},onPointerDown:t=>{m&&t.preventDefault()},onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),x(e),null==u||u())},onClick:t=>{x(e),null==u||u(),null==h||h(t)},ref:t=>y.current[k]=t,id:`${v}-${k}`,role:"menu"===b?"menuitem":"option",tabIndex:m?void 0:j,"aria-selected":T&&S,showCheckmark:g,isDisabled:c,isActive:T,isSelected:S,startIcon:n,description:s,endIcon:i,endSection:o,capitalizeFirst:a,"data-value":e,children:t})}var Gf={exports:{}};!function(t){(function(){var e=Object.assign;function n(t,n){n||(n={});var r,i,o,s=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),l=[],c=[],u=new WeakMap,h=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,d=n.equals?n.equals:function(t,e){return t===e},p=n.maxArgs,f=n.serializer;return 1!==t.length||n.equals||s?i=function(){var e=arguments.length;if(!e&&null!=r)return c[r];var n,i=p||e;for(n=l.length-1;n>=0;n--)if(p||l[n].length===i)for(var o=i-1;o>=0&&d(l[n][o],arguments[o]);o--)if(0===o)return c[n];return n=l.length-(n+1),!e&&null==r&&(r=n),!h||h(n,c,l),c[n]=t.apply(this,l[n]=arguments)}.bind(this):(i=function(e){var n,r=typeof e;if(!f&&("object"===r&&e||"function"===r))return u.get(e)||(!h||h(e,u),u.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]||(!h||h(i,a),a[i]=t.call(this,e))}.bind(this),o=1),i.clear=function(){u=new WeakMap,a=Object.create(null),l=[],c=[],r=void 0},i.keys=function(){return o?null:l.slice()},i.values=function(){return o?null:c.slice()},i.keyValues=function(){return o?{primitives:e({},a),objects:u}:null},i}"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(Vr)}(Gf);const qf=$r(Gf.exports);function Kf({children:t,label:e,index:n}){const o=(0,i.useId)();return(0,r.jsxs)("div",{role:"group",className:ei(0!==n&&"border-t my-4"),"aria-labelledby":e?`be-select-${o}`:void 0,children:[e&&(0,r.jsx)("div",{className:"block uppercase text-muted text-xs px-16 py-10",role:"presentation",id:`be-select-${o}`,"aria-hidden":"true",children:e}),t]})}const Zf=qf(({maxItems:t,children:e,items:n,inputValue:r})=>{let i=Qf({children:e,items:n}),o=Jf({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}}),Jf=qf(({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}),Qf=qf(({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 s=(t,n,i,s)=>{const a=o++,l=n?null==e?void 0:e[i].items[s]:null==e?void 0:e[a];r.set(t.props.value,{index:a,element:t,textLabel:tg(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===Kf?i.Children.forEach(t.props.children,(n,r)=>{s(n,t,e,r)}):s(t))}),r});function tg(t){var e;const n=t.props.children;return t.props.textLabel?t.props.textLabel:null!=(e=null==n?void 0:n.props)&&e.message?n.props.message:`${n}`||""}const eg=Math.min,ng=Math.max,rg=Math.round,ig=Math.floor,og=t=>({x:t,y:t}),sg={left:"right",right:"left",bottom:"top",top:"bottom"},ag={start:"end",end:"start"};function lg(t,e,n){return ng(t,eg(e,n))}function cg(t,e){return"function"==typeof t?t(e):t}function ug(t){return t.split("-")[0]}function hg(t){return t.split("-")[1]}function dg(t){return"x"===t?"y":"x"}function pg(t){return"y"===t?"height":"width"}function fg(t){return["top","bottom"].includes(ug(t))?"y":"x"}function gg(t){return dg(fg(t))}function mg(t){return t.replace(/start|end/g,t=>ag[t])}function vg(t){return t.replace(/left|right|bottom|top/g,t=>sg[t])}function bg(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 yg(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function xg(t,e,n){let{reference:r,floating:i}=t;const o=fg(e),s=gg(e),a=pg(s),l=ug(e),c="y"===o,u=r.x+r.width/2-i.width/2,h=r.y+r.height/2-i.height/2,d=r[a]/2-i[a]/2;let p;switch(l){case"top":p={x:u,y:r.y-i.height};break;case"bottom":p={x:u,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:h};break;case"left":p={x:r.x-i.width,y:h};break;default:p={x:r.x,y:r.y}}switch(hg(e)){case"start":p[s]-=d*(n&&c?-1:1);break;case"end":p[s]+=d*(n&&c?-1:1)}return p}async function wg(t,e){var n;void 0===e&&(e={});const{x:r,y:i,platform:o,rects:s,elements:a,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:d=!1,padding:p=0}=cg(e,t),f=bg(p),g=a[d?"floating"===h?"reference":"floating":h],m=yg(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(a.floating)),boundary:c,rootBoundary:u,strategy:l})),v="floating"===h?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,b=await(null==o.getOffsetParent?void 0:o.getOffsetParent(a.floating)),y=await(null==o.isElement?void 0:o.isElement(b))&&await(null==o.getScale?void 0:o.getScale(b))||{x:1,y:1},x=yg(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:b,strategy:l}):v);return{top:(m.top-x.top+f.top)/y.y,bottom:(x.bottom-m.bottom+f.bottom)/y.y,left:(m.left-x.left+f.left)/y.x,right:(x.right-m.right+f.right)/y.x}}function _g(t){return kg(t)?(t.nodeName||"").toLowerCase():"#document"}function Cg(t){var e;return(null==t||null==(e=t.ownerDocument)?void 0:e.defaultView)||window}function Sg(t){var e;return null==(e=(kg(t)?t.ownerDocument:t.document)||window.document)?void 0:e.documentElement}function kg(t){return t instanceof Node||t instanceof Cg(t).Node}function Tg(t){return t instanceof Element||t instanceof Cg(t).Element}function jg(t){return t instanceof HTMLElement||t instanceof Cg(t).HTMLElement}function Og(t){return!(typeof ShadowRoot>"u")&&(t instanceof ShadowRoot||t instanceof Cg(t).ShadowRoot)}function Eg(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=Ig(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(i)}function Mg(t){return["table","td","th"].includes(_g(t))}function Pg(t){const e=Ag(),n=Ig(t);return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!e&&!!n.backdropFilter&&"none"!==n.backdropFilter||!e&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some(t=>(n.willChange||"").includes(t))||["paint","layout","strict","content"].some(t=>(n.contain||"").includes(t))}function Ag(){return!(typeof CSS>"u"||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function Dg(t){return["html","body","#document"].includes(_g(t))}function Ig(t){return Cg(t).getComputedStyle(t)}function Rg(t){return Tg(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function zg(t){if("html"===_g(t))return t;const e=t.assignedSlot||t.parentNode||Og(t)&&t.host||Sg(t);return Og(e)?e.host:e}function Lg(t){const e=zg(t);return Dg(e)?t.ownerDocument?t.ownerDocument.body:t.body:jg(e)&&Eg(e)?e:Lg(e)}function Fg(t,e,n){var r;void 0===e&&(e=[]),void 0===n&&(n=!0);const i=Lg(t),o=i===(null==(r=t.ownerDocument)?void 0:r.body),s=Cg(i);return o?e.concat(s,s.visualViewport||[],Eg(i)?i:[],s.frameElement&&n?Fg(s.frameElement):[]):e.concat(i,Fg(i,[],n))}function Ng(t){const e=Ig(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=jg(t),o=i?t.offsetWidth:n,s=i?t.offsetHeight:r,a=rg(n)!==o||rg(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function Bg(t){return Tg(t)?t:t.contextElement}function Vg(t){const e=Bg(t);if(!jg(e))return og(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:o}=Ng(e);let s=(o?rg(n.width):n.width)/r,a=(o?rg(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const $g=og(0);function Hg(t){const e=Cg(t);return Ag()&&e.visualViewport?{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}:$g}function Wg(t,e,n,r){void 0===e&&(e=!1),void 0===n&&(n=!1);const i=t.getBoundingClientRect(),o=Bg(t);let s=og(1);e&&(r?Tg(r)&&(s=Vg(r)):s=Vg(t));const a=function(t,e,n){return void 0===e&&(e=!1),!(!n||e&&n!==Cg(t))&&e}(o,n,r)?Hg(o):og(0);let l=(i.left+a.x)/s.x,c=(i.top+a.y)/s.y,u=i.width/s.x,h=i.height/s.y;if(o){const t=Cg(o),e=r&&Tg(r)?Cg(r):r;let n=t,i=n.frameElement;for(;i&&r&&e!==n;){const t=Vg(i),e=i.getBoundingClientRect(),r=Ig(i),o=e.left+(i.clientLeft+parseFloat(r.paddingLeft))*t.x,s=e.top+(i.clientTop+parseFloat(r.paddingTop))*t.y;l*=t.x,c*=t.y,u*=t.x,h*=t.y,l+=o,c+=s,n=Cg(i),i=n.frameElement}}return yg({width:u,height:h,x:l,y:c})}const Ug=[":popover-open",":modal"];function Xg(t){return Ug.some(e=>{try{return t.matches(e)}catch{return!1}})}function Yg(t){return Wg(Sg(t)).left+Rg(t).scrollLeft}function Gg(t,e,n){let r;if("viewport"===e)r=function(t,e){const n=Cg(t),r=Sg(t),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;const t=Ag();(!t||t&&"fixed"===e)&&(a=i.offsetLeft,l=i.offsetTop)}return{width:o,height:s,x:a,y:l}}(t,n);else if("document"===e)r=function(t){const e=Sg(t),n=Rg(t),r=t.ownerDocument.body,i=ng(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=ng(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Yg(t);const a=-n.scrollTop;return"rtl"===Ig(r).direction&&(s+=ng(e.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}(Sg(t));else if(Tg(e))r=function(t,e){const n=Wg(t,!0,"fixed"===e),r=n.top+t.clientTop,i=n.left+t.clientLeft,o=jg(t)?Vg(t):og(1);return{width:t.clientWidth*o.x,height:t.clientHeight*o.y,x:i*o.x,y:r*o.y}}(e,n);else{const n=Hg(t);r={...e,x:e.x-n.x,y:e.y-n.y}}return yg(r)}function qg(t,e){const n=zg(t);return!(n===e||!Tg(n)||Dg(n))&&("fixed"===Ig(n).position||qg(n,e))}function Kg(t,e){const n=e.get(t);if(n)return n;let r=Fg(t,[],!1).filter(t=>Tg(t)&&"body"!==_g(t)),i=null;const o="fixed"===Ig(t).position;let s=o?zg(t):t;for(;Tg(s)&&!Dg(s);){const e=Ig(s),n=Pg(s);!n&&"fixed"===e.position&&(i=null),(o?!n&&!i:!n&&"static"===e.position&&i&&["absolute","fixed"].includes(i.position)||Eg(s)&&!n&&qg(t,s))?r=r.filter(t=>t!==s):i=e,s=zg(s)}return e.set(t,r),r}function Zg(t,e,n){const r=jg(e),i=Sg(e),o="fixed"===n,s=Wg(t,!0,o,e);let a={scrollLeft:0,scrollTop:0};const l=og(0);if(r||!r&&!o)if(("body"!==_g(e)||Eg(i))&&(a=Rg(e)),r){const t=Wg(e,!0,o,e);l.x=t.x+e.clientLeft,l.y=t.y+e.clientTop}else i&&(l.x=Yg(i));return{x:s.left+a.scrollLeft-l.x,y:s.top+a.scrollTop-l.y,width:s.width,height:s.height}}function Jg(t){return"static"===Ig(t).position}function Qg(t,e){return jg(t)&&"fixed"!==Ig(t).position?e?e(t):t.offsetParent:null}function tm(t,e){const n=Cg(t);if(Xg(t))return n;if(!jg(t)){let e=zg(t);for(;e&&!Dg(e);){if(Tg(e)&&!Jg(e))return e;e=zg(e)}return n}let r=Qg(t,e);for(;r&&Mg(r)&&Jg(r);)r=Qg(r,e);return r&&Dg(r)&&Jg(r)&&!Pg(r)?n:r||function(t){let e=zg(t);for(;jg(e)&&!Dg(e);){if(Pg(e))return e;e=zg(e)}return null}(t)||n}const em={convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const o="fixed"===i,s=Sg(r),a=!!e&&Xg(e.floating);if(r===s||a&&o)return n;let l={scrollLeft:0,scrollTop:0},c=og(1);const u=og(0),h=jg(r);if((h||!h&&!o)&&(("body"!==_g(r)||Eg(s))&&(l=Rg(r)),jg(r))){const t=Wg(r);c=Vg(r),u.x=t.x+r.clientLeft,u.y=t.y+r.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x,y:n.y*c.y-l.scrollTop*c.y+u.y}},getDocumentElement:Sg,getClippingRect:function(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const o=[..."clippingAncestors"===n?Xg(e)?[]:Kg(e,this._c):[].concat(n),r],s=o[0],a=o.reduce((t,n)=>{const r=Gg(e,n,i);return t.top=ng(r.top,t.top),t.right=eg(r.right,t.right),t.bottom=eg(r.bottom,t.bottom),t.left=ng(r.left,t.left),t},Gg(e,s,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:tm,getElementRects:async function(t){const e=this.getOffsetParent||tm,n=this.getDimensions,r=await n(t.floating);return{reference:Zg(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(t){return Array.from(t.getClientRects())},getDimensions:function(t){const{width:e,height:n}=Ng(t);return{width:e,height:n}},getScale:Vg,isElement:Tg,isRTL:function(t){return"rtl"===Ig(t).direction}};function nm(t,e,n,r){void 0===r&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s="function"==typeof ResizeObserver,layoutShift:a="function"==typeof IntersectionObserver,animationFrame:l=!1}=r,c=Bg(t),u=i||o?[...c?Fg(c):[],...Fg(e)]:[];u.forEach(t=>{i&&t.addEventListener("scroll",n,{passive:!0}),o&&t.addEventListener("resize",n)});const h=c&&a?function(t,e){let n,r=null;const i=Sg(t);function o(){var t;clearTimeout(n),null==(t=r)||t.disconnect(),r=null}return function s(a,l){void 0===a&&(a=!1),void 0===l&&(l=1),o();const{left:c,top:u,width:h,height:d}=t.getBoundingClientRect();if(a||e(),!h||!d)return;const p={rootMargin:-ig(u)+"px "+-ig(i.clientWidth-(c+h))+"px "+-ig(i.clientHeight-(u+d))+"px "+-ig(c)+"px",threshold:ng(0,eg(1,l))||1};let f=!0;function g(t){const e=t[0].intersectionRatio;if(e!==l){if(!f)return s();e?s(!1,e):n=setTimeout(()=>{s(!1,1e-7)},1e3)}f=!1}try{r=new IntersectionObserver(g,{...p,root:i.ownerDocument})}catch{r=new IntersectionObserver(g,p)}r.observe(t)}(!0),o}(c,n):null;let d=-1,p=null;s&&(p=new ResizeObserver(t=>{let[r]=t;r&&r.target===c&&p&&(p.unobserve(e),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var t;null==(t=p)||t.observe(e)})),n()}),c&&!l&&p.observe(c),p.observe(e));let f,g=l?Wg(t):null;return l&&function e(){const r=Wg(t);g&&(r.x!==g.x||r.y!==g.y||r.width!==g.width||r.height!==g.height)&&n(),g=r,f=requestAnimationFrame(e)}(),n(),()=>{var t;u.forEach(t=>{i&&t.removeEventListener("scroll",n),o&&t.removeEventListener("resize",n)}),null==h||h(),null==(t=p)||t.disconnect(),p=null,l&&cancelAnimationFrame(f)}}const rm=function(t){return void 0===t&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:o,placement:s,middlewareData:a}=e,l=await async function(t,e){const{placement:n,platform:r,elements:i}=t,o=await(null==r.isRTL?void 0:r.isRTL(i.floating)),s=ug(n),a=hg(n),l="y"===fg(n),c=["left","top"].includes(s)?-1:1,u=o&&l?-1:1,h=cg(e,t);let{mainAxis:d,crossAxis:p,alignmentAxis:f}="number"==typeof h?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...h};return a&&"number"==typeof f&&(p="end"===a?-1*f:f),l?{x:p*u,y:d*c}:{x:d*c,y:p*u}}(e,t);return s===(null==(n=a.offset)?void 0:n.placement)&&null!=(r=a.arrow)&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}},im=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:s=!1,limiter:a={fn:t=>{let{x:e,y:n}=t;return{x:e,y:n}}},...l}=cg(t,e),c={x:n,y:r},u=await wg(e,l),h=fg(ug(i)),d=dg(h);let p=c[d],f=c[h];if(o){const t="y"===d?"bottom":"right";p=lg(p+u["y"===d?"top":"left"],p,p-u[t])}if(s){const t="y"===h?"bottom":"right";f=lg(f+u["y"===h?"top":"left"],f,f-u[t])}const g=a.fn({...e,[d]:p,[h]:f});return{...g,data:{x:g.x-n,y:g.y-r}}}}},om=function(t){return void 0===t&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:h=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:g=!0,...m}=cg(t,e);if(null!=(n=o.arrow)&&n.alignmentOffset)return{};const v=ug(i),b=ug(a)===a,y=await(null==l.isRTL?void 0:l.isRTL(c.floating)),x=d||(b||!g?[vg(a)]:function(t){const e=vg(t);return[mg(t),e,mg(e)]}(a));!d&&"none"!==f&&x.push(...function(t,e,n,r){const i=hg(t);let o=function(t,e,n){const r=["left","right"],i=["right","left"],o=["top","bottom"],s=["bottom","top"];switch(t){case"top":case"bottom":return n?e?i:r:e?r:i;case"left":case"right":return e?o:s;default:return[]}}(ug(t),"start"===n,r);return i&&(o=o.map(t=>t+"-"+i),e&&(o=o.concat(o.map(mg)))),o}(a,g,f,y));const w=[a,...x],_=await wg(e,m),C=[];let S=(null==(r=o.flip)?void 0:r.overflows)||[];if(u&&C.push(_[v]),h){const t=function(t,e,n){void 0===n&&(n=!1);const r=hg(t),i=gg(t),o=pg(i);let s="x"===i?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return e.reference[o]>e.floating[o]&&(s=vg(s)),[s,vg(s)]}(i,s,y);C.push(_[t[0]],_[t[1]])}if(S=[...S,{placement:i,overflows:C}],!C.every(t=>t<=0)){var k,T;const t=((null==(k=o.flip)?void 0:k.index)||0)+1,e=w[t];if(e)return{data:{index:t,overflows:S},reset:{placement:e}};let n=null==(T=S.filter(t=>t.overflows[0]<=0).sort((t,e)=>t.overflows[1]-e.overflows[1])[0])?void 0:T.placement;if(!n)switch(p){case"bestFit":{var j;const t=null==(j=S.map(t=>[t.placement,t.overflows.filter(t=>t>0).reduce((t,e)=>t+e,0)]).sort((t,e)=>t[1]-e[1])[0])?void 0:j[0];t&&(n=t);break}case"initialPlacement":n=a}if(i!==n)return{reset:{placement:n}}}return{}}}},sm=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:s=()=>{},...a}=cg(t,e),l=await wg(e,a),c=ug(n),u=hg(n),h="y"===fg(n),{width:d,height:p}=r.floating;let f,g;"top"===c||"bottom"===c?(f=c,g=u===(await(null==i.isRTL?void 0:i.isRTL(o.floating))?"start":"end")?"left":"right"):(g=c,f="end"===u?"top":"bottom");const m=p-l.top-l.bottom,v=d-l.left-l.right,b=eg(p-l[f],m),y=eg(d-l[g],v),x=!e.middlewareData.shift;let w=b,_=y;if(h?_=u||x?eg(y,v):v:w=u||x?eg(b,m):m,x&&!u){const t=ng(l.left,0),e=ng(l.right,0),n=ng(l.top,0),r=ng(l.bottom,0);h?_=d-2*(0!==t||0!==e?t+e:ng(l.left,l.right)):w=p-2*(0!==n||0!==r?n+r:ng(l.top,l.bottom))}await s({...e,availableWidth:_,availableHeight:w});const C=await i.getDimensions(o.floating);return d!==C.width||p!==C.height?{reset:{rects:!0}}:{}}}},am=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:o,platform:s,elements:a,middlewareData:l}=e,{element:c,padding:u=0}=cg(t,e)||{};if(null==c)return{};const h=bg(u),d={x:n,y:r},p=gg(i),f=pg(p),g=await s.getDimensions(c),m="y"===p,v=m?"top":"left",b=m?"bottom":"right",y=m?"clientHeight":"clientWidth",x=o.reference[f]+o.reference[p]-d[p]-o.floating[f],w=d[p]-o.reference[p],_=await(null==s.getOffsetParent?void 0:s.getOffsetParent(c));let C=_?_[y]:0;(!C||!await(null==s.isElement?void 0:s.isElement(_)))&&(C=a.floating[y]||o.floating[f]);const S=x/2-w/2,k=C/2-g[f]/2-1,T=eg(h[v],k),j=eg(h[b],k),O=T,E=C-g[f]-j,M=C/2-g[f]/2+S,P=lg(O,M,E),A=!l.arrow&&null!=hg(i)&&M!==P&&o.reference[f]/2-(M<O?T:j)-g[f]/2<0,D=A?M<O?M-O:M-E:0;return{[p]:d[p]+D,data:{[p]:P,centerOffset:M-P-D,...A&&{alignmentOffset:D}},reset:A}}}),lm=(t,e,n)=>{const r=new Map,i={platform:em,...n},o={...i.platform,_c:r};return(async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=o.filter(Boolean),l=await(null==s.isRTL?void 0:s.isRTL(e));let c=await s.getElementRects({reference:t,floating:e,strategy:i}),{x:u,y:h}=xg(c,r,l),d=r,p={},f=0;for(let g=0;g<a.length;g++){const{name:n,fn:o}=a[g],{x:m,y:v,data:b,reset:y}=await o({x:u,y:h,initialPlacement:r,placement:d,strategy:i,middlewareData:p,rects:c,platform:s,elements:{reference:t,floating:e}});u=m??u,h=v??h,p={...p,[n]:{...p[n],...b}},y&&f<=50&&(f++,"object"==typeof y&&(y.placement&&(d=y.placement),y.rects&&(c=!0===y.rects?await s.getElementRects({reference:t,floating:e,strategy:i}):y.rects),({x:u,y:h}=xg(c,d,l))),g=-1)}return{x:u,y:h,placement:d,strategy:i,middlewareData:p}})(t,e,{...i,platform:o})};var cm=typeof document<"u"?i.useLayoutEffect:i.useEffect;function um(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(!um(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(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=n;0!==r--;){const n=i[r];if(("_owner"!==n||!t.$$typeof)&&!um(t[n],e[n]))return!1}return!0}return t!==t&&e!==e}function hm(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function dm(t,e){const n=hm(t);return Math.round(e*n)/n}function pm(t){const e=i.useRef(t);return cm(()=>{e.current=t}),e}function fm({floatingWidth:t,ref:e,disablePositioning:n=!1,placement:r="bottom",offset:o=2,showArrow:a=!1,maxHeight:l,shiftCrossAxis:c=!0,fallbackPlacements:u}){const h=(0,i.useRef)(null),d={placement:r,strategy:"fixed"};n||(d.whileElementsMounted=nm,d.middleware=[rm(o),im({padding:16,crossAxis:c,mainAxis:!0}),om({padding:16,fallbackPlacements:u}),sm({apply({rects:e,availableHeight:n,availableWidth:r,elements:i}){"matchTrigger"===t&&null!=l?Object.assign(i.floating.style,{width:`${e.reference.width}px`,maxWidth:`${r}`,maxHeight:`${Math.min(n,l)}px`}):null!=l&&Object.assign(i.floating.style,{maxHeight:`${Math.min(n,l)}px`})},padding:16})],a&&d.middleware.push((t=>({name:"arrow",options:t,fn(e){const{element:n,padding:r}="function"==typeof t?t(e):t;return n&&function(t){return{}.hasOwnProperty.call(t,"current")}(n)?null!=n.current?am({element:n.current,padding:r}).fn(e):{}:n?am({element:n,padding:r}).fn(e):{}}}))({element:h})));const p=function(t){void 0===t&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:a,floating:l}={},transform:c=!0,whileElementsMounted:u,open:h}=t,[d,p]=i.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[f,g]=i.useState(r);um(f,r)||g(r);const[m,v]=i.useState(null),[b,y]=i.useState(null),x=i.useCallback(t=>{t!=S.current&&(S.current=t,v(t))},[v]),w=i.useCallback(t=>{t!==k.current&&(k.current=t,y(t))},[y]),_=a||m,C=l||b,S=i.useRef(null),k=i.useRef(null),T=i.useRef(d),j=pm(u),O=pm(o),E=i.useCallback(()=>{if(!S.current||!k.current)return;const t={placement:e,strategy:n,middleware:f};O.current&&(t.platform=O.current),lm(S.current,k.current,t).then(t=>{const e={...t,isPositioned:!0};M.current&&!um(T.current,e)&&(T.current=e,s.flushSync(()=>{p(e)}))})},[f,e,n,O]);cm(()=>{!1===h&&T.current.isPositioned&&(T.current.isPositioned=!1,p(t=>({...t,isPositioned:!1})))},[h]);const M=i.useRef(!1);cm(()=>(M.current=!0,()=>{M.current=!1}),[]),cm(()=>{if(_&&(S.current=_),C&&(k.current=C),_&&C){if(j.current)return j.current(_,C,E);E()}},[_,C,E,j]);const P=i.useMemo(()=>({reference:S,floating:k,setReference:x,setFloating:w}),[x,w]),A=i.useMemo(()=>({reference:_,floating:C}),[_,C]),D=i.useMemo(()=>{const t={position:n,left:0,top:0};if(!A.floating)return t;const e=dm(A.floating,d.x),r=dm(A.floating,d.y);return c?{...t,transform:"translate("+e+"px, "+r+"px)",...hm(A.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:e,top:r}},[n,c,A.floating,d.x,d.y]);return i.useMemo(()=>({...d,update:E,refs:P,elements:A,floatingStyles:D}),[d,E,P,A,D])}(d),f=(0,i.useMemo)(()=>function(t){return e=>{t.forEach(t=>{"function"==typeof t?t(e):null!=t&&(t.current=e)})}}([e,p.refs.setReference]),[p.refs.setReference,e]),{x:g,y:m}=p.middlewareData.arrow||{},v={top:"bottom",right:"left",bottom:"top",left:"right"}[p.placement.split("-")[0]],b={left:g,top:m,right:"",bottom:"",[v]:"-4px"};return{...p,reference:f,arrowRef:h,arrowStyle:b}}function gm(t,e){const{children:n,items:r,role:o="listbox",virtualFocus:s,focusLoopingMode:a="stay",autoFocusFirstItem:l=!0,onItemSelected:c,clearInputOnItemSelection:u,blurReferenceOnItemSelection:h,floatingWidth:d="matchTrigger",floatingMinWidth:p,floatingMaxHeight:f,offset:g,placement:m,showCheckmark:v,showEmptyMessage:b,maxItems:y,isAsync:x,allowCustomValue:w,clearSelectionOnInputClear:_}=t,C=t.selectionMode||"none",S=`${(0,i.useId)()}-listbox`,[k,T]=rp(t.inputValue,t.defaultInputValue||"",t.onInputValueChange),[j,O]=(0,i.useState)("all"),E=Zf({children:n,items:r,inputValue:x?void 0:k,maxItems:y}),M="all"===j?E.collection:E.filteredCollection,P=(0,i.useRef)([]),A=(0,i.useMemo)(()=>[...M.values()].map(t=>t.isDisabled?null:t.textLabel),[M]),{selectedValues:D,selectValues:I}=function(t){const{selectionMode:e,allowEmptySelection:n}=t,r="single"===e||"multiple"===e,[o,s]=rp(r?t.selectedValue:void 0,r?t.defaultSelectedValue:void 0,r?t.onSelectionChange:void 0),a=(0,i.useMemo)(()=>typeof o>"u"?[]:Array.isArray(o)?o:[o],[o]),l=(0,i.useCallback)(t=>{const r=Array.isArray(t)?t:[t];"single"===e?s(r[0]):r.forEach(t=>{const e=a.indexOf(t);-1===e?(a.push(t),s([...a])):(a.length>1||n)&&(a.splice(e,1),s([...a]))})},[n,a,e,s]);return{selectedValues:a,selectValues:l}}(t),[R,z]=rp(t.isOpen,t.defaultIsOpen,t.onOpenChange),[L,F]=(0,i.useState)(null),N=fm({floatingWidth:d,ref:e,placement:m,offset:g,maxHeight:f??420,shiftCrossAxis:!s}),{refs:B,strategy:V,x:$,y:H}=N,W="none"===C?void 0:M.get(D[0]),U="none"===C||null==W?void 0:W.index,X=(0,i.useCallback)((t,e)=>{var n,r;const i=[...M.values()],o=!i.find(t=>!t.isDisabled),l=M.size-1;null==e||!M.size||e>l||e<0||o?F(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("loop"!==n)return"stay"===n?e-1:null;e=0}}else if(--e<0){if("loop"!==n)return"stay"===n?e+1:null;e=o}return e}(i,e,a,t),F(e),null!=e&&(s?null==(n=P.current[e])||n.scrollIntoView({block:"nearest"}):null==(r=P.current[e])||r.focus()))},[M,s,a]);return{handleItemSelection:t=>{const e=B.reference.current;"none"!==C?I(t):e&&"focus"in e&&e.focus(),s&&(T(u?"":`${t}`),h&&e&&"blur"in e&&e.blur()),O("all"),z(!1),null==c||c(t),F(null)},onInputChange:(0,i.useCallback)(t=>{T(t.target.value),O(t.target.value.trim()?"filtered":"all"),t.target.value?z(!0):_&&I(""),l&&null==L?X("increment",0):F(null)},[T,z,O,I,_,X,l,L]),focusLoopingMode:a,floatingWidth:d,floatingMinWidth:p,floatingMaxHeight:f,showCheckmark:v,collection:M,collections:E,virtualFocus:s,focusItem:X,showEmptyMessage:b&&!!k,allowCustomValue:w,refs:B,reference:N.reference,floating:B.setFloating,positionStyle:{position:V,top:H??"",left:$??""},listContent:A,listItemsRef:P,listboxId:S,role:o,state:{activeIndex:L,setActiveIndex:F,selectedIndex:U,setSelectedIndex:t=>{if("none"!==C){const e=[...M.values()][t];e&&I(e.value)}},selectionMode:C,selectedValues:D,selectValues:I,inputValue:k,setInputValue:T,isOpen:R,setIsOpen:z,setActiveCollection:O}}}function mm(){return Nd()||typeof window>"u"?fa.getState().data.is_mobile_device??!1:window.screen.width<=768}let vm=null,bm=new Set,ym=new Map,xm=!1,wm=!1;function _m(t,e){for(let n of bm)n(t,e)}function Cm(t){xm=!0,function(t){return!(t.metaKey||!Gd()&&t.altKey||t.ctrlKey||"Control"===t.key||"Shift"===t.key||"Meta"===t.key)}(t)&&(vm="keyboard",_m("keyboard",t))}function Sm(t){vm="pointer",("mousedown"===t.type||"pointerdown"===t.type)&&(xm=!0,_m("pointer",t))}function km(t){(function(t){return!(0!==t.mozInputSource||!t.isTrusted)||(qd()&&t.pointerType?"click"===t.type&&1===t.buttons:0===t.detail&&!t.pointerType)})(t)&&(xm=!0,vm="virtual")}function Tm(t){t.target===window||t.target===document||(!xm&&!wm&&(vm="virtual",_m("virtual",t)),xm=!1,wm=!1)}function jm(){xm=!1,wm=!0}function Om(t){if(typeof window>"u"||ym.get(Wd(t)))return;const e=Wd(t),n=Hd(t);let r=e.HTMLElement.prototype.focus;e.HTMLElement.prototype.focus=function(){xm=!0,r.apply(this,arguments)},n.addEventListener("keydown",Cm,!0),n.addEventListener("keyup",Cm,!0),n.addEventListener("click",km,!0),e.addEventListener("focus",Tm,!0),e.addEventListener("blur",jm,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",Sm,!0),n.addEventListener("pointermove",Sm,!0),n.addEventListener("pointerup",Sm,!0)):(n.addEventListener("mousedown",Sm,!0),n.addEventListener("mousemove",Sm,!0),n.addEventListener("mouseup",Sm,!0)),e.addEventListener("beforeunload",()=>{Em(t)},{once:!0}),ym.set(e,{focus:r})}const Em=(t,e)=>{const n=Wd(t),r=Hd(t);e&&r.removeEventListener("DOMContentLoaded",e),ym.has(n)&&(n.HTMLElement.prototype.focus=ym.get(n).focus,r.removeEventListener("keydown",Cm,!0),r.removeEventListener("keyup",Cm,!0),r.removeEventListener("click",km,!0),n.removeEventListener("focus",Tm,!0),n.removeEventListener("blur",jm,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",Sm,!0),r.removeEventListener("pointermove",Sm,!0),r.removeEventListener("pointerup",Sm,!0)):(r.removeEventListener("mousedown",Sm,!0),r.removeEventListener("mousemove",Sm,!0),r.removeEventListener("mouseup",Sm,!0)),ym.delete(n))};function Mm(t){const e=Hd(t);if("virtual"===vm){let n=e.activeElement;!function(t){requestAnimationFrame(()=>{0===Kd.size?t():Zd.add(t)})}(()=>{e.activeElement===n&&t.isConnected&&Xd(t)})}else Xd(t)}function Pm(t,e){return"#comment"!==t.nodeName&&function(t){const e=Wd(t);if(!(t instanceof e.HTMLElement)&&!(t instanceof e.SVGElement))return!1;let{display:n,visibility:r}=t.style,i="none"!==n&&"hidden"!==r&&"collapse"!==r;if(i){const{getComputedStyle:e}=t.ownerDocument.defaultView;let{display:n,visibility:r}=e(t);i="none"!==n&&"hidden"!==r&&"collapse"!==r}return i}(t)&&function(t,e){return!t.hasAttribute("hidden")&&!t.hasAttribute("data-react-aria-prevent-focus")&&("DETAILS"!==t.nodeName||!e||"SUMMARY"===e.nodeName||t.hasAttribute("open"))}(t,e)&&(!t.parentElement||Pm(t.parentElement,t))}typeof document<"u"&&function(t){const e=Hd(t);let n;"loading"!==e.readyState?Om(t):(n=()=>{Om(t)},e.addEventListener("DOMContentLoaded",n))}();const Am=i.createContext(null);let Dm=null;function Im(t){let{children:e,contain:n,restoreFocus:r,autoFocus:o}=t,s=(0,i.useRef)(null),a=(0,i.useRef)(null),l=(0,i.useRef)([]),{parentNode:c}=(0,i.useContext)(Am)||{},u=(0,i.useMemo)(()=>new Gm({scopeRef:l}),[l]);Id(()=>{let t=c||qm.root;if(qm.getTreeNode(t.scopeRef)&&Dm&&!Hm(Dm,t.scopeRef)){let e=qm.getTreeNode(Dm);e&&(t=e)}t.addChild(u),qm.addNode(u)},[u,c]),Id(()=>{let t=qm.getTreeNode(l);t&&(t.contain=!!n)},[n]),Id(()=>{var t;let e=null===(t=s.current)||void 0===t?void 0:t.nextSibling,n=[];for(;e&&e!==a.current;)n.push(e),e=e.nextSibling;l.current=n},[e]),function(t,e,n){Id(()=>{if(e||n)return;let r=t.current;const i=Hd(r?r[0]:void 0);let o=e=>{let n=e.target;Vm(n,t.current)?Dm=t:Bm(n)||(Dm=null)};return i.addEventListener("focusin",o,!1),null==r||r.forEach(t=>t.addEventListener("focusin",o,!1)),()=>{i.removeEventListener("focusin",o,!1),null==r||r.forEach(t=>t.removeEventListener("focusin",o,!1))}},[t,e,n])}(l,r,n),function(t,e){let n=(0,i.useRef)(),r=(0,i.useRef)();Id(()=>{let i=t.current;if(!e)return void(r.current&&(cancelAnimationFrame(r.current),r.current=void 0));const o=Hd(i?i[0]:void 0);let s=e=>{if("Tab"!==e.key||e.altKey||e.ctrlKey||e.metaKey||!Nm(t)||e.isComposing)return;let n=o.activeElement,r=t.current;if(!r||!Vm(n,r))return;let i=Xm(Fm(r),{tabbable:!0},r);if(!n)return;i.currentNode=n;let s=e.shiftKey?i.previousNode():i.nextNode();s||(i.currentNode=e.shiftKey?r[r.length-1].nextElementSibling:r[0].previousElementSibling,s=e.shiftKey?i.previousNode():i.nextNode()),e.preventDefault(),s&&Wm(s,!0)},a=e=>{Dm&&!Hm(Dm,t)||!Vm(e.target,t.current)?Nm(t)&&!$m(e.target,t)?n.current?n.current.focus():Dm&&Dm.current&&Um(Dm.current):Nm(t)&&(n.current=e.target):(Dm=t,n.current=e.target)},l=e=>{r.current&&cancelAnimationFrame(r.current),r.current=requestAnimationFrame(()=>{if(o.activeElement&&Nm(t)&&!$m(o.activeElement,t))if(Dm=t,o.body.contains(e.target)){var r;n.current=e.target,null===(r=n.current)||void 0===r||r.focus()}else Dm.current&&Um(Dm.current)})};return o.addEventListener("keydown",s,!1),o.addEventListener("focusin",a,!1),null==i||i.forEach(t=>t.addEventListener("focusin",a,!1)),null==i||i.forEach(t=>t.addEventListener("focusout",l,!1)),()=>{o.removeEventListener("keydown",s,!1),o.removeEventListener("focusin",a,!1),null==i||i.forEach(t=>t.removeEventListener("focusin",a,!1)),null==i||i.forEach(t=>t.removeEventListener("focusout",l,!1))}},[t,e]),Id(()=>()=>{r.current&&cancelAnimationFrame(r.current)},[r])}(l,n),function(t,e,n){const r=(0,i.useRef)(typeof document<"u"?Hd(t.current?t.current[0]:void 0).activeElement:null);Id(()=>{let r=t.current;const i=Hd(r?r[0]:void 0);if(!e||n)return;let o=()=>{(!Dm||Hm(Dm,t))&&Vm(i.activeElement,t.current)&&(Dm=t)};return i.addEventListener("focusin",o,!1),null==r||r.forEach(t=>t.addEventListener("focusin",o,!1)),()=>{i.removeEventListener("focusin",o,!1),null==r||r.forEach(t=>t.removeEventListener("focusin",o,!1))}},[t,n]),Id(()=>{const r=Hd(t.current?t.current[0]:void 0);if(!e)return;let i=e=>{if("Tab"!==e.key||e.altKey||e.ctrlKey||e.metaKey||!Nm(t)||e.isComposing)return;let n=r.activeElement;if(!Vm(n,t.current))return;let i=qm.getTreeNode(t);if(!i)return;let o=i.nodeToRestore,s=Xm(r.body,{tabbable:!0});s.currentNode=n;let a=e.shiftKey?s.previousNode():s.nextNode();if((!o||!r.body.contains(o)||o===r.body)&&(o=void 0,i.nodeToRestore=void 0),(!a||!Vm(a,t.current))&&o){s.currentNode=o;do{a=e.shiftKey?s.previousNode():s.nextNode()}while(Vm(a,t.current));e.preventDefault(),e.stopPropagation(),a?Wm(a,!0):Bm(o)?Wm(o,!0):n.blur()}};return n||r.addEventListener("keydown",i,!0),()=>{n||r.removeEventListener("keydown",i,!0)}},[t,e,n]),Id(()=>{const n=Hd(t.current?t.current[0]:void 0);if(!e)return;let i=qm.getTreeNode(t);var o;return i?(i.nodeToRestore=null!==(o=r.current)&&void 0!==o?o:void 0,()=>{let r=qm.getTreeNode(t);if(!r)return;let i=r.nodeToRestore;if(e&&i&&(Vm(n.activeElement,t.current)||n.activeElement===n.body&&function(t){let e=qm.getTreeNode(Dm);for(;e&&e.scopeRef!==t;){if(e.nodeToRestore)return!1;e=e.parent}return(null==e?void 0:e.scopeRef)===t}(t))){let e=qm.clone();requestAnimationFrame(()=>{if(n.activeElement===n.body){let n=e.getTreeNode(t);for(;n;){if(n.nodeToRestore&&n.nodeToRestore.isConnected)return void Wm(n.nodeToRestore);n=n.parent}for(n=e.getTreeNode(t);n;){if(n.scopeRef&&n.scopeRef.current&&qm.getTreeNode(n.scopeRef))return void Um(n.scopeRef.current,!0);n=n.parent}}})}}):void 0},[t,e])}(l,r,n),function(t,e){const n=i.useRef(e);(0,i.useEffect)(()=>{if(n.current){Dm=t;!Vm(Hd(t.current?t.current[0]:void 0).activeElement,Dm.current)&&t.current&&Um(t.current)}n.current=!1},[t])}(l,o),(0,i.useEffect)(()=>{const t=Hd(l.current?l.current[0]:void 0).activeElement;let e=null;if(Vm(t,l.current)){for(let n of qm.traverse())n.scopeRef&&Vm(t,n.scopeRef.current)&&(e=n);e===qm.getTreeNode(l)&&(Dm=e.scopeRef)}},[l]),Id(()=>()=>{var t,e,n;let r=null!==(n=null===(e=qm.getTreeNode(l))||void 0===e||null===(t=e.parent)||void 0===t?void 0:t.scopeRef)&&void 0!==n?n:null;(l===Dm||Hm(l,Dm))&&(!r||qm.getTreeNode(r))&&(Dm=r),qm.removeTreeNode(l)},[l]);let h=(0,i.useMemo)(()=>function(t){return{focusNext(e={}){let n=t.current,{from:r,tabbable:i,wrap:o,accept:s}=e,a=r||Hd(n[0]).activeElement,l=n[0].previousElementSibling,c=Xm(Fm(n),{tabbable:i,accept:s},n);c.currentNode=Vm(a,n)?a:l;let u=c.nextNode();return!u&&o&&(c.currentNode=l,u=c.nextNode()),u&&Wm(u,!0),u},focusPrevious(e={}){let n=t.current,{from:r,tabbable:i,wrap:o,accept:s}=e,a=r||Hd(n[0]).activeElement,l=n[n.length-1].nextElementSibling,c=Xm(Fm(n),{tabbable:i,accept:s},n);c.currentNode=Vm(a,n)?a:l;let u=c.previousNode();return!u&&o&&(c.currentNode=l,u=c.previousNode()),u&&Wm(u,!0),u},focusFirst(e={}){let n=t.current,{tabbable:r,accept:i}=e,o=Xm(Fm(n),{tabbable:r,accept:i},n);o.currentNode=n[0].previousElementSibling;let s=o.nextNode();return s&&Wm(s,!0),s},focusLast(e={}){let n=t.current,{tabbable:r,accept:i}=e,o=Xm(Fm(n),{tabbable:r,accept:i},n);o.currentNode=n[n.length-1].nextElementSibling;let s=o.previousNode();return s&&Wm(s,!0),s}}}(l),[]),d=(0,i.useMemo)(()=>({focusManager:h,parentNode:u}),[u,h]);return i.createElement(Am.Provider,{value:d},i.createElement("span",{"data-focus-scope-start":!0,hidden:!0,ref:s}),e,i.createElement("span",{"data-focus-scope-end":!0,hidden:!0,ref:a}))}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]"],zm=Rm.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";Rm.push('[tabindex]:not([tabindex="-1"]):not([disabled])');const Lm=Rm.join(':not([hidden]):not([tabindex="-1"]),');function Fm(t){return t[0].parentElement}function Nm(t){let e=qm.getTreeNode(Dm);for(;e&&e.scopeRef!==t;){if(e.contain)return!1;e=e.parent}return!0}function Bm(t){return $m(t)}function Vm(t,e){return!(!t||!e)&&e.some(e=>e.contains(t))}function $m(t,e=null){if(t instanceof Element&&t.closest("[data-react-aria-top-layer]"))return!0;for(let{scopeRef:n}of qm.traverse(qm.getTreeNode(e)))if(n&&Vm(t,n.current))return!0;return!1}function Hm(t,e){var n;let r=null===(n=qm.getTreeNode(e))||void 0===n?void 0:n.parent;for(;r;){if(r.scopeRef===t)return!0;r=r.parent}return!1}function Wm(t,e=!1){if(null==t||e){if(null!=t)try{t.focus()}catch{}}else try{Mm(t)}catch{}}function Um(t,e=!0){let n=t[0].previousElementSibling,r=Fm(t),i=Xm(r,{tabbable:e},t);i.currentNode=n;let o=i.nextNode();e&&!o&&(r=Fm(t),i=Xm(r,{tabbable:!1},t),i.currentNode=n,o=i.nextNode()),Wm(o)}function Xm(t,e,n){let r=null!=e&&e.tabbable?Lm:zm,i=Hd(t).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)||!Pm(t)||n&&!Vm(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}class Ym{get size(){return this.fastMap.size}getTreeNode(t){return this.fastMap.get(t)}addTreeNode(t,e,n){let r=this.fastMap.get(e??null);if(!r)return;let i=new Gm({scopeRef:t});r.addChild(i),i.parent=r,this.fastMap.set(t,i),n&&(i.nodeToRestore=n)}addNode(t){this.fastMap.set(t.scopeRef,t)}removeTreeNode(t){if(null===t)return;let e=this.fastMap.get(t);if(!e)return;let n=e.parent;for(let i of this.traverse())i!==e&&e.nodeToRestore&&i.nodeToRestore&&e.scopeRef&&e.scopeRef.current&&Vm(i.nodeToRestore,e.scopeRef.current)&&(i.nodeToRestore=e.nodeToRestore);let r=e.children;n&&(n.removeChild(e),r.size>0&&r.forEach(t=>n&&n.addChild(t))),this.fastMap.delete(e.scopeRef)}*traverse(t=this.root){if(null!=t.scopeRef&&(yield t),t.children.size>0)for(let e of t.children)yield*this.traverse(e)}clone(){var t;let e=new Ym;var n;for(let r of this.traverse())e.addTreeNode(r.scopeRef,null!==(n=null===(t=r.parent)||void 0===t?void 0:t.scopeRef)&&void 0!==n?n:null,r.nodeToRestore);return e}constructor(){this.fastMap=new Map,this.root=new Gm({scopeRef:null}),this.fastMap.set(null,this.root)}}class Gm{addChild(t){this.children.add(t),t.parent=this}removeChild(t){this.children.delete(t),t.parent=void 0}constructor(t){this.children=new Set,this.contain=!1,this.scopeRef=t.scopeRef}}let qm=new Ym;function Km(){const{width:t,height:e}=function(){let t=Nd(),[e,n]=(0,i.useState)(()=>t?{width:0,height:0}:np());return(0,i.useEffect)(()=>{let t=()=>{n(t=>{let e=np();return e.width===t.width&&e.height===t.height?t:e})};return ep?ep.addEventListener("resize",t):window.addEventListener("resize",t),()=>{ep?ep.removeEventListener("resize",t):window.removeEventListener("resize",t)}},[]),e}();return{"--be-viewport-height":`${e}px`,"--be-viewport-width":`${t}px`}}const Zm={initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},transition:{type:"tween",duration:.125}},Jm=(0,i.forwardRef)(({children:t,style:e,autoFocus:n=!1,restoreFocus:o=!0,isDismissable:s,isContextMenu:a,isOpen:l,onClose:c,triggerRef:u,arrowRef:h,arrowStyle:d,onPointerLeave:p,onPointerEnter:f},g)=>{const m=Km(),v=tp(g),{domProps:b}=function({onClose:t,isDismissable:e=!0,triggerRef:n,isContextMenu:r=!1},o){const s=(0,i.useRef)({isPointerDown:!1,isContextMenu:r,onClose:t}),a=s.current;a.isContextMenu=r,a.onClose=t;const l=(0,i.useCallback)(t=>{const e=t.target;if(e){const t=e.ownerDocument;if(!t||!t.documentElement.contains(e))return!1}return o.current&&!o.current.contains(e)},[o]),c=(0,i.useCallback)(()=>Qm[Qm.length-1]===o,[o]),u=(0,i.useCallback)(()=>{c()&&a.onClose()},[c,a]),h=(0,i.useCallback)(t=>{var e,r;return!(!n.current||!("contains"in n.current))&&(null==(r=(e=n.current).contains)?void 0:r.call(e,t))},[n]),d=(0,i.useCallback)(t=>{h(t.target)||c()&&(t.stopPropagation(),t.preventDefault())},[h,c]),p=(0,i.useCallback)(t=>{h(t.target)||(c()&&(t.stopPropagation(),t.preventDefault()),(!a.isContextMenu||2!==t.button)&&u())},[h,u,a,c]);return(0,i.useEffect)(()=>{Qm.push(o);const t=t=>{l(t)&&(d(t),s.current.isPointerDown=!0)},e=t=>{s.current.isPointerDown&&l(t)&&(s.current.isPointerDown=!1,p(t))},r=t=>{t.preventDefault(),l(t)&&u()},i=t=>{if(!n.current)return;const e=t.target;let r;n.current instanceof Node?r=n.current:"contextElement"in n.current&&(r=n.current.contextElement),(!(e instanceof Node)||!r||e.contains(r))&&a.onClose()};return document.addEventListener("pointerdown",t,!0),document.addEventListener("pointerup",e,!0),document.addEventListener("contextmenu",r,!0),document.addEventListener("scroll",i,!0),()=>{const n=Qm.indexOf(o);n>=0&&Qm.splice(n,1),document.removeEventListener("pointerdown",t,!0),document.removeEventListener("pointerup",e,!0),document.removeEventListener("contextmenu",r,!0),document.removeEventListener("scroll",i,!0)}},[o,l,a,p,d,n,h,u]),{domProps:{onKeyDown:t=>{"Escape"===t.key&&(t.stopPropagation(),t.preventDefault(),u())}}}}({isDismissable:s,isOpen:l,onClose:c,triggerRef:u,isContextMenu:a},v);return(0,r.jsx)(Cd.div,{className:"isolate z-popover",role:"presentation",ref:v,style:{...m,...e,position:"fixed"},...Zm,...Ud(b,{onPointerLeave:p,onPointerEnter:f}),children:(0,r.jsx)(Im,{restoreFocus:o,autoFocus:n,contain:!1,children:t})})}),Qm=[];const tv={initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2}};function ev({position:t="absolute",className:e,isTransparent:n=!1,disableInitialTransition:i,...o}){return(0,r.jsx)(Cd.div,{...o,className:ei(e,!n&&"bg-background/80","inset-0 z-10 h-full w-full",t,"backdrop-blur-sm"),"aria-hidden":!0,initial:i?void 0:{opacity:0},animate:{opacity:1},exit:{opacity:0},...tv,transition:{duration:.15}})}const nv=(0,i.forwardRef)(({children:t,autoFocus:e=!1,restoreFocus:n=!0,isDismissable:i,isOpen:o,onClose:s},a)=>{const l=Km(),c=tp(a);return(0,r.jsxs)("div",{className:"fixed inset-0 isolate z-tray",style:l,children:[(0,r.jsx)(ev,{onClick:()=>{i&&s()}},"tray-underlay"),(0,r.jsx)(Cd.div,{ref:c,className:"absolute bottom-0 left-0 right-0 z-20 mx-auto max-h-tray w-full max-w-375 overflow-hidden rounded-t pb-safe-area",role:"presentation",initial:{opacity:0,y:"100%"},animate:{opacity:1,y:0},exit:{opacity:0,y:"100%"},transition:{type:"tween",duration:.2},children:(0,r.jsx)(Im,{restoreFocus:n,autoFocus:e,contain:!0,children:t})})]})});function rv(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}function iv(){const{i18n:t}=fa(t=>t.data);return{locale:t,localeCode:(null==t?void 0:t.language)||"en",lines:null==t?void 0:t.lines}}function ov(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,s=o.split("|");if(!s.length)return e;const a=sv(t).select(i);let l=s.find(t=>t.startsWith(a));l||(l=s[0]);const c=l.substring(l.indexOf(" ")+1);return e.replace(n,c)}return e}const sv=qf(t=>new Intl.PluralRules(t));function av(t,e){return null!=t&&(void 0!==Object.hasOwn?Object.hasOwn(t,e):Object.hasOwnProperty(e))}const lv=(0,i.memo)(t=>{const{message:e,values:n}=t,{lines:o,localeCode:s}=iv();let a;if(a=av(o,e)?null==o?void 0:o[e]:av(o,null==e?void 0:e.toLowerCase())?null==o?void 0:o[null==e?void 0:e.toLowerCase()]:e,!n||!a)return(0,r.jsx)(i.Fragment,{children:a});a=ov(s,{message:a,values:n});const l=[],c=[];if(Object.entries(n).forEach(([t,e])=>{"function"==typeof e?c.push(t):(0,i.isValidElement)(e)?l.push(t):null!=e&&(a=null==a?void 0:a.replace(`:${t}`,`${e}`))}),c.length||l.length){const t=[];if(c.length){const e=c.join("");t.push(`(<[${e}]>.+?<\\/[${e}]>)`)}if(l.length){const e=l.join("|");t.push(`(:(?:${e}))`)}const e=new RegExp(t.join("|"),"gm"),o=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,s=null==n?void 0:n[t];if("function"==typeof s){const t=s(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(0,r.jsx)(i.Fragment,{children:o})}return(0,r.jsx)(i.Fragment,{children:a})},function(t,e){const{values:n,...r}=t,{values:i,...o}=e;return rv(i,n)&&rv(r,o)});function cv({listbox:t,children:e,isLoading:n,mobileOverlay:o=nv,searchField:a,onClose:l,prepend:c,className:u,...h}){const d=mm(),{floatingWidth:p,floatingMinWidth:f="min-w-180",collection:g,showEmptyMessage:m,state:{isOpen:v,setIsOpen:b},positionStyle:y,floating:x,refs:w}=t,_=!c&&d?o:Jm,C=ei("text-base sm:text-sm outline-none bg max-h-inherit flex flex-col",!c&&"shadow-xl border py-4",u,_===Jm&&"rounded-panel",_===Jm&&"auto"===p?`max-w-288 ${f}`:""),S=(0,i.useMemo)(()=>{let t=0;const e=[];return[...g.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},[])},[g]),k=S.length>0||m&&!n,T=k?(0,r.jsxs)("div",{className:C,role:"presentation",children:[a,(0,r.jsx)(uv,{isLoading:n,...h,children:S})]}):null;return(0,r.jsxs)($f.Provider,{value:t,children:[e,c?T:ha&&(0,s.createPortal)((0,r.jsx)(Md,{children:v&&k&&(0,r.jsx)(_,{triggerRef:w.reference,restoreFocus:!0,isOpen:v,onClose:()=>{null==l||l(),b(!1)},isDismissable:!0,style:y,ref:x,children:T})}),ha)]})}function uv({className:t,children:e,isLoading:n,...o}){const{role:s,listboxId:a,virtualFocus:l,focusItem:c,state:{activeIndex:u,setActiveIndex:h,selectedIndex:d}}=Hf(),p=(0,i.useRef)(!0),f=(0,i.useRef)(null);return(0,i.useEffect)(()=>()=>h(null),[h]),(0,i.useEffect)(()=>{if(p.current){const t=u??d;null!=t||l?null!=t&&requestAnimationFrame(()=>{c("increment",t)}):requestAnimationFrame(()=>{var t;null==(t=f.current)||t.focus({preventScroll:!0})})}p.current=!1},[u,d,c,l]),(0,r.jsx)("div",{tabIndex:l?void 0:-1,role:s,id:a,className:"flex-auto overflow-y-auto overscroll-contain outline-none",ref:f,...o,children:e.length?e:(0,r.jsx)(hv,{})})}function hv(){return(0,r.jsx)("div",{className:"px-8 py-4 text-sm italic text-muted",children:(0,r.jsx)(lv,{message:"There are no items matching your query"})})}function dv({state:{isOpen:t,setIsOpen:e,selectedIndex:n,activeIndex:r,setInputValue:i,setActiveIndex:o},focusLoopingMode:s,collection:a,focusItem:l,handleItemSelection:c,allowCustomValue:u}){const h=r=>{if(!t&&r.currentTarget.contains(r.target)){if("ArrowDown"===r.key)return r.preventDefault(),e(!0),l("increment",n??0),!0;if("ArrowUp"===r.key)return r.preventDefault(),e(!0),l("decrement",n??a.size-1),!0;if("Enter"===r.key||"Space"===r.key)return r.preventDefault(),e(!0),l("increment",n??0),!0}},d=n=>{const i=Math.max(0,a.size-1);if(t&&n.currentTarget.contains(n.target))switch(n.key){case"ArrowDown":return n.preventDefault(),null==r?l("increment",0):r>=i?"loop"===s?l("increment",0):"deselect"===s&&o(null):l("increment",r+1),!0;case"ArrowUp":return n.preventDefault(),null==r?l("decrement",i):r<=0?"loop"===s?l("decrement",i):"deselect"===s&&o(null):l("decrement",r-1),!0;case"Home":return n.preventDefault(),l("increment",0),!0;case"End":return n.preventDefault(),l("decrement",i),!0;case"Tab":return e(!1),!0}};return{handleTriggerKeyDown:h,handleListboxKeyboardNavigation:d,handleListboxSearchFieldKeydown:n=>{var o,s;if("Enter"===n.key&&null!=r&&a.size){n.preventDefault();const[t,e]=[...a.entries()][r];return void(t&&(c(t),null==(s=(o=e.element.props).onSelected)||s.call(o)))}"Escape"===n.key&&t&&(e(!1),u||i("")),h(n)||d(n)}}}const pv=new Map;function fv(){const t=function(t){const{localeCode:e}=iv(),n=e+(t?Object.entries(t).sort((t,e)=>t[0]<e[0]?-1:1).join():"");if(pv.has(n))return pv.get(n);const r=new Intl.Collator(e,t);return pv.set(n,r),r}({usage:"search",sensitivity:"base"}),e=(0,i.useRef)({search:"",timeout:void 0}).current,n=(n,r)=>{let i=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 s=n(r,i);return null==s&&(s=n(r,0)),clearTimeout(e.timeout),e.timeout=setTimeout(()=>{e.search=""},500),s??null}}}function gv(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 mv=ii((0,r.jsx)("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}),"SearchOutlined");var vv=t=>null==t;var bv=t=>!vv(t)&&!Array.isArray(t)&&(t=>"object"==typeof t)(t)&&!(t=>t instanceof Date)(t),yv=t=>bv(t)&&t.target?(t=>"checkbox"===t.type)(t.target)?t.target.checked:t.target.value:t,xv=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function wv(t){let e;const n=Array.isArray(t);if(t instanceof Date)e=new Date(t);else if(t instanceof Set)e=new Set(t);else{if(xv&&(t instanceof Blob||t instanceof FileList)||!n&&!bv(t))return t;if(e=n?[]:{},n||(t=>{const e=t.constructor&&t.constructor.prototype;return bv(e)&&e.hasOwnProperty("isPrototypeOf")})(t))for(const n in t)t.hasOwnProperty(n)&&(e[n]=wv(t[n]));else e=t}return e}var _v=t=>Array.isArray(t)?t.filter(Boolean):[],Cv=t=>void 0===t,Sv=(t,e,n)=>{if(!e||!bv(t))return n;const r=_v(e.split(/[,[\].]+?/)).reduce((t,e)=>vv(t)?t:t[e],t);return Cv(r)||r===t?Cv(t[e])?n:t[e]:r},kv=t=>"boolean"==typeof t,Tv=(t,e,n)=>{let r=-1;const i=(t=>/^\w*$/.test(t))(e)?[e]:(t=>_v(t.replace(/["|']|\]/g,"").split(/\.|\[/)))(e),o=i.length,s=o-1;for(;++r<o;){const e=i[r];let o=n;if(r!==s){const n=t[e];o=bv(n)||Array.isArray(n)?n:isNaN(+i[r+1])?{}:[]}if("__proto__"===e)return;t[e]=o,t=t[e]}return t};const jv="blur",Ov="change",Ev="all",Mv=i.createContext(null),Pv=()=>i.useContext(Mv);var Av=(t,e,n,r)=>{n(t);const{name:i,...o}=t;return(t=>bv(t)&&!Object.keys(t).length)(o)||Object.keys(o).length>=Object.keys(e).length||Object.keys(o).find(t=>e[t]===(!r||Ev))},Dv=(t,e,n)=>!t||!e||t===e||(t=>Array.isArray(t)?t:[t])(t).some(t=>t&&(n?t===e:t.startsWith(e)||e.startsWith(t)));function Iv(t){const e=i.useRef(t);e.current=t,i.useEffect(()=>{const n=!t.disabled&&e.current.subject&&e.current.subject.subscribe({next:e.current.next});return()=>{n&&n.unsubscribe()}},[t.disabled])}function Rv(t){const e=Pv(),{control:n=e.control,disabled:r,name:o,exact:s}=t||{},[a,l]=i.useState(n._formState),c=i.useRef(!0),u=i.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),h=i.useRef(o);return h.current=o,Iv({disabled:r,next:t=>c.current&&Dv(h.current,t.name,s)&&Av(t,u.current,n._updateFormState)&&l({...n._formState,...t}),subject:n._subjects.state}),i.useEffect(()=>(c.current=!0,u.current.isValid&&n._updateValid(!0),()=>{c.current=!1}),[n]),((t,e,n,r=!0)=>{const i={defaultValues:e._defaultValues};for(const o in t)Object.defineProperty(i,o,{get:()=>{const i=o;return e._proxyFormState[i]!==Ev&&(e._proxyFormState[i]=!r||Ev),n&&(n[i]=!0),t[i]}});return i})(a,n,u.current,!1)}function zv(t){const e=Pv(),{control:n=e.control,name:r,defaultValue:o,disabled:s,exact:a}=t||{},l=i.useRef(r);l.current=r,Iv({disabled:s,subject:n._subjects.values,next:t=>{Dv(l.current,t.name,a)&&u(wv(((t,e,n,r,i)=>(t=>"string"==typeof t)(t)?(r&&e.watch.add(t),Sv(n,t,i)):Array.isArray(t)?t.map(t=>(r&&e.watch.add(t),Sv(n,t))):(r&&(e.watchAll=!0),n))(l.current,n._names,t.values||n._formValues,!1,o)))}});const[c,u]=i.useState(n._getWatch(r,o));return i.useEffect(()=>n._removeUnmounted()),c}function Lv(t={}){const{size:e="md",startAppend:n,endAppend:r,className:i,labelPosition:o,labelDisplay:s="block",inputClassName:a,inputWrapperClassName:l,unstyled:c,invalid:u,disabled:h,background:d="bg-transparent",flexibleHeight:p,inputShadow:f="shadow-sm",descriptionPosition:g="bottom",inputRing:m,inputFontSize:v,labelSuffix:b}={...t};if(c)return{label:"",input:a||"",wrapper:i||"",inputWrapper:l||"",adornment:"",append:{size:"",radius:""},size:{font:"",height:""},description:"",error:""};const y=function({size:t,flexibleHeight:e}){switch(t){case"2xs":return{font:"text-xs",height:e?"min-h-24":"h-24"};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-md md: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:p});v&&(y.font=v);const x=n||r,w=m||"focus:ring "+(u?"focus:ring-danger/focus focus:border-danger/60":"focus:ring-primary/focus focus:border-primary/60"),_=function(t){const{startAppend:e,endAppend:n,inputRadius:r}=t,i=e||n;return"rounded-full"===r?{input:ei(!i&&"rounded-full",e&&"rounded-r-full rounded-l-none",n&&"rounded-l-full rounded-r-none"),append:e?"rounded-l-full":"rounded-r-full"}:"rounded-none"===r?{input:"",append:""}:r?{input:r,append:r}:{input:ei(!i&&"rounded-input",e&&"rounded-r-input rounded-l-none",n&&"rounded-l-input rounded-r-none"),append:e?"rounded-l-input":"rounded-r-input"}}(t);return{label:ei(s,"first-letter:capitalize text-left whitespace-nowrap",h&&"text-disabled",y.font,b?"":"side"===o?"mr-16":"mb-4"),input:ei("block text-left relative w-full appearance-none transition-shadow text",d,_.input,Fv(t),!h&&`${w} focus:outline-none ${f}`,h&&"text-disabled cursor-not-allowed",a,y.font,y.height,Nv(t)),adornment:Bv(e),append:{size:zf(e),radius:_.append},wrapper:ei(i,y.font,{"flex items-center":"side"===o}),inputWrapper:ei("isolate relative",l,x&&"flex items-stretch"),size:y,description:`text-muted ${"bottom"===g?"pt-10":"pb-10"} text-xs`,error:"text-danger pt-10 text-xs"}}function Fv({startAppend:t,endAppend:e,inputBorder:n,invalid:r}){if(n)return n;const i=r?"border-danger":"border-divider";return t||e?t?`${i} border-y border-r`:`${i} border-y border-l`:`${i} border`}function Nv({startAdornment:t,endAdornment:e,inputRadius:n}){return"rounded-full"===n?ei(t?"pl-54":"pl-28",e?"pr-54":"pr-28"):ei(t?"pl-46":"pl-12",e?"pr-46":"pr-12")}function Bv(t){switch(t){case"2xs":return"icon-2xs";case"xs":return"icon-xs";case"sm":case"md":return"icon-sm";case"lg":return"icon-lg";case"xl":return"icon-xl";default:return""}}function Vv({children:t,direction:e,className:n,position:i=("start"===e?"left-0":"right-0")}){return t?(0,r.jsx)("div",{className:ei("pointer-events-none absolute top-0 z-10 flex h-full min-w-42 items-center justify-center text-muted",i,n),children:t}):null}function $v(t,e){const n=(null==e?void 0:e.copy)??!0,r=n?{...t}:t;return Object.keys(r).forEach(t=>{const n=t;null!=e&&e.arrays&&Array.isArray(r[n])&&0===r[n].length?delete r[n]:null!=e&&e.deep&&r[n]&&"object"==typeof r[n]?(r[n]=$v(r[n],e),0===Object.keys(r[n]).length&&delete r[n]):(null==r[n]||""===r[n])&&delete r[n]}),n?r:t}const Hv=i.forwardRef((t,e)=>{const{children:n,description:i,errorMessage:o,descriptionProps:s={},errorMessageProps:a={},startAdornment:l,endAdornment:c,adornmentPosition:u,startAppend:h,endAppend:d,fieldClassNames:p,disabled:f,wrapperProps:g}=t;return(0,r.jsxs)("div",{className:p.wrapper,ref:e,...g,children:[(0,r.jsx)(Wv,{...t}),(0,r.jsxs)("div",{className:p.inputWrapper,children:[(0,r.jsx)(Vv,{direction:"start",className:p.adornment,position:u,children:l}),h&&(0,r.jsx)(Uv,{style:p.append,disabled:f,children:h}),n,d&&(0,r.jsx)(Uv,{style:p.append,disabled:f,children:d}),(0,r.jsx)(Vv,{direction:"end",className:p.adornment,position:u,children:c})]}),i&&!o&&(0,r.jsx)("div",{className:p.description,...s,children:i}),o&&(0,r.jsx)("div",{className:p.error,...a,children:o})]})});function Wv({labelElementType:t,fieldClassNames:e,labelProps:n,label:i,labelSuffix:o,labelSuffixPosition:s="spaced",required:a}){if(!i)return null;const l=(0,r.jsxs)(t||"label",{className:e.label,...n,children:[i,a&&(0,r.jsx)("span",{className:"text-danger",children:" *"})]});return o?(0,r.jsxs)("div",{className:ei("mb-4 flex w-full gap-4","spaced"===s?"items-end":"items-center"),children:[l,(0,r.jsx)("div",{className:ei("text-xs text-muted","spaced"===s?"ml-auto":""),children:o})]}):l}function Uv({children:t,style:e,disabled:n}){return i.cloneElement(t,{...t.props,disabled:t.props.disabled||n,...$v(e)})}function Xv({autoFocus:t,autoSelectText:e},n){const r=(0,i.useRef)(t);(0,i.useEffect)(()=>{r.current&&n.current&&requestAnimationFrame(()=>{var t,r;null==(t=n.current)||t.focus(),e&&"input"===(null==(r=n.current)?void 0:r.nodeName.toLowerCase())&&n.current.select()}),r.current=!1},[n,e])}function Yv(t){const{focusRef:e,labelElementType:n="label",label:r,labelSuffix:o,labelSuffixPosition:s,autoFocus:a,autoSelectText:l,labelPosition:c,descriptionPosition:u,size:h,errorMessage:d,description:p,flexibleHeight:f,startAdornment:g,endAdornment:m,startAppend:v,adornmentPosition:b,endAppend:y,className:x,inputClassName:w,inputWrapperClassName:_,unstyled:C,background:S,invalid:k,disabled:T,id:j,inputRadius:O,inputBorder:E,inputShadow:M,inputRing:P,inputFontSize:A,...D}=t;Xv(t,e);const I=(0,i.useId)(),R=j||I,z={id:`${R}-label`,htmlFor:"label"===n?R:void 0},L={id:`${R}-description`},F={id:`${R}-error`},N={"aria-label":t.label||t["aria-label"]||!t.placeholder?t["aria-label"]:t.placeholder,"aria-invalid":k||void 0,id:R,disabled:T,...D},B=[];r&&B.push(z.id),N["aria-labelledby"]&&B.push(N["aria-labelledby"]),N["aria-labelledby"]=B.length?B.join(" "):void 0;const V=[];return p&&V.push(L.id),d&&V.push(F.id),N["aria-describedby"]&&V.push(N["aria-describedby"]),N["aria-describedby"]=V.length?V.join(" "):void 0,{fieldProps:{errorMessageProps:F,descriptionProps:L,labelProps:z,disabled:T,label:r,labelSuffix:o,labelSuffixPosition:s,autoFocus:a,autoSelectText:l,labelPosition:c,descriptionPosition:u,size:h,errorMessage:d,description:p,flexibleHeight:f,startAdornment:g,endAdornment:m,startAppend:v,adornmentPosition:b,endAppend:y,className:x,inputClassName:w,inputWrapperClassName:_,unstyled:C,background:S,invalid:k},inputProps:N}}const Gv=(0,i.forwardRef)(({inputElementType:t="input",flexibleHeight:e,inputRef:n,inputTestId:i,...o},s)=>{const a=tp(n),{fieldProps:l,inputProps:c}=Yv({...o,focusRef:a}),u="textarea"===t,h=u?"textarea":"input",d=Lv({...o,flexibleHeight:e||"textarea"===t});return"textarea"===t&&!o.unstyled&&(d.input=`${d.input} py-12`),(0,r.jsx)(Hv,{ref:s,fieldClassNames:d,...l,children:(0,r.jsx)(h,{"data-testid":i,ref:a,...c,rows:u?c.rows||4:void 0,className:d.input})})});i.forwardRef(({name:t,...e},n)=>{const{field:{onChange:o,onBlur:s,value:a="",ref:l},fieldState:{invalid:c,error:u}}=function(t){const e=Pv(),{name:n,disabled:r,control:o=e.control,shouldUnregister:s}=t,a=((t,e)=>t.has((t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t)(e)))(o._names.array,n),l=zv({control:o,name:n,defaultValue:Sv(o._formValues,n,Sv(o._defaultValues,n,t.defaultValue)),exact:!0}),c=Rv({control:o,name:n}),u=i.useRef(o.register(n,{...t.rules,value:l,...kv(t.disabled)?{disabled:t.disabled}:{}}));return i.useEffect(()=>{const t=o._options.shouldUnregister||s,e=(t,e)=>{const n=Sv(o._fields,t);n&&(n._f.mount=e)};if(e(n,!0),t){const t=wv(Sv(o._options.defaultValues,n));Tv(o._defaultValues,n,t),Cv(Sv(o._formValues,n))&&Tv(o._formValues,n,t)}return()=>{(a?t&&!o._state.action:t)?o.unregister(n):e(n,!1)}},[n,o,a,s]),i.useEffect(()=>{Sv(o._fields,n)&&o._updateDisabledField({disabled:r,fields:o._fields,name:n,value:Sv(o._fields,n)._f.value})},[r,n,o]),{field:{name:n,value:l,...kv(r)||c.disabled?{disabled:c.disabled||r}:{},onChange:i.useCallback(t=>u.current.onChange({target:{value:yv(t),name:n},type:Ov}),[n]),onBlur:i.useCallback(()=>u.current.onBlur({target:{value:Sv(o._formValues,n),name:n},type:jv}),[n,o]),ref:t=>{const e=Sv(o._fields,n);e&&t&&(e._f.ref={focus:()=>t.focus(),select:()=>t.select(),setCustomValidity:e=>t.setCustomValidity(e),reportValidity:()=>t.reportValidity()})}},formState:c,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Sv(c.errors,n)},isDirty:{enumerable:!0,get:()=>!!Sv(c.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!Sv(c.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!Sv(c.validatingFields,n)},error:{enumerable:!0,get:()=>Sv(c.errors,n)}})}}({name:t}),h={onChange:o,onBlur:s,value:a??"",invalid:c,errorMessage:null==u?void 0:u.message,inputRef:l,name:t};return(0,r.jsx)(Gv,{ref:n,...Ud(h,e)})});const qv=(0,i.forwardRef)((t,e)=>{const{searchPlaceholder:n,showSearchField:o,children:[s,a],floatingWidth:l="auto",isLoading:c}=t,u=(0,i.useId)(),h=gv(),d=gm({...t,clearInputOnItemSelection:!0,showEmptyMessage:o,floatingWidth:h?"auto":l,virtualFocus:o,role:o?"listbox":"menu",focusLoopingMode:o?"stay":"loop",children:a.props.children},e),{state:{isOpen:p,setIsOpen:f,activeIndex:g,inputValue:m,setInputValue:v},listboxId:b,focusItem:y,listContent:x,reference:w,onInputChange:_}=d,{handleTriggerKeyDown:C,handleListboxKeyboardNavigation:S,handleListboxSearchFieldKeydown:k}=dv(d),{findMatchingItem:T}=fv();return(0,r.jsx)(cv,{onClick:t=>t.stopPropagation(),listbox:d,onKeyDownCapture:o?void 0:t=>{if(!p)return;const e=T(t,x,g);null!=e&&y("increment",e)},onKeyDown:S,onClose:o?()=>v(""):void 0,"aria-labelledby":u,isLoading:c,searchField:o?(0,r.jsx)(Gv,{size:"sm",placeholder:n,startAdornment:(0,r.jsx)(mv,{}),className:"flex-shrink-0 px-8 pb-8 pt-4",autoFocus:!0,"aria-expanded":p?"true":"false","aria-haspopup":"listbox","aria-controls":p?b:void 0,"aria-autocomplete":"list",autoComplete:"off",autoCorrect:"off",spellCheck:"false",value:m,onChange:_,onKeyDown:t=>{k(t)}}):null,children:(0,i.cloneElement)(s,{id:u,"aria-expanded":p?"true":"false","aria-haspopup":"menu","aria-controls":p?b:void 0,ref:w,onKeyDown:C,onClick:Ff(t=>{var e,n;null==(n=null==(e=s.props)?void 0:e.onClick)||n.call(e,t),f(!p)})})})});function Kv({children:t}){return t}function Zv({item:t,button:e}){return(0,r.jsxs)(qv,{children:[e,(0,r.jsx)(Kv,{children:(t.menuItems||[]).map(t=>(0,r.jsx)(Yf,{value:t.label,onSelected:()=>{t.action(ya().editor)},children:t.label},t.label))})]})}const Jv=(0,i.forwardRef)(({children:t,size:e="md",iconSize:n=(e&&e.length<=3?e:"md"),variant:o="text",radius:s="rounded-button",className:a,padding:l,equalWidth:c=!0,badge:u,...h},d)=>{const p=ei(zf(e,{padding:l,equalWidth:c,variant:o}),a,u&&"relative");return(0,r.jsxs)(Nf,{...h,ref:d,radius:s,variant:o,className:p,children:[(0,i.cloneElement)(t,{size:n}),u]})});const Qv=i.memo(function({icon:t,className:e,size:n}){let o;return o=i.isValidElement(t)?i.cloneElement(t,{className:"svg-iconEl"}):"string"==typeof t?(0,r.jsx)("img",{className:"w-font h-font",src:t,alt:""}):Array.isArray(t)?i.createElement(oi(t),{size:n}):i.createElement(t,{size:n}),(0,r.jsx)("span",{className:ei(e,"leading-none"),children:o})});function tb({value:t}){return t?"string"==typeof t?(0,r.jsx)(lv,{message:t}):(0,r.jsx)(lv,{...t}):null}function eb({item:t}){const e=t.label?(0,r.jsx)(rb,{item:t}):(0,r.jsx)(nb,{item:t});return t.menuItems?(0,r.jsx)(Zv,{item:t,button:e}):i.cloneElement(e,{onClick:()=>{var e;null==(e=t.action)||e.call(t,ya().editor)}})}const nb=(0,i.forwardRef)(({item:t,...e},n)=>(0,r.jsx)(Jv,{ref:n,radius:"rounded-full",size:"sm",...e,children:(0,r.jsx)(Qv,{icon:t.icon})})),rb=(0,i.forwardRef)(({item:t,...e},n)=>(0,r.jsx)(Bf,{ref:n,radius:"rounded-full",size:"xs",color:t.buttonColor||"primary",variant:t.buttonVariant||"flat",startIcon:t.icon&&(0,r.jsx)(Qv,{icon:t.icon}),...e,children:(0,r.jsx)(tb,{value:t.label})}));function ib({children:t,color:e,variant:n,radius:o="rounded-button",size:s,className:a,value:l,onChange:c,multiple:u,disabled:h}){const d=i.Children.map(t,(r,a)=>{if(i.isValidElement(r)){const d=(t=>void 0!==l&&(u?l.includes(t):t===l))(r.props.value),p=d?"primary":e;return i.cloneElement(r,{color:d?"primary":e,variant:n,size:s,radius:null,disabled:r.props.disabled||h,...r.props,onClick:t=>{r.props.onClick&&r.props.onClick(t),c&&(u?null==c||c((t=>{const e=[...l],n=l.indexOf(t);return n>-1?e.splice(n,1):e.push(t),e})(r.props.value)):null==c||c(r.props.value))},className:ei(r.props.className,d?"z-20":"z-10",ob(a,t,o,p))})}});return(0,r.jsx)("div",{className:ei(o,"isolate inline-flex",a),children:d})}function ob(t,e,n,r){return 0===t?ei(n,"rounded-tr-none rounded-br-none",!r&&"border-r-transparent disabled:border-r-transparent"):t===e.length-1?ei(n,"rounded-tl-none rounded-bl-none -ml-1"):ei("rounded-none -ml-1",!r&&"border-r-transparent disabled:border-r-transparent")}const sb=ii((0,r.jsx)("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"),ab=ii((0,r.jsx)("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 lb(){const t=ba(t=>t.history.canUndo),e=ba(t=>t.history.canRedo);return(0,r.jsxs)(ib,{variant:"outline",children:[(0,r.jsx)(Jv,{equalWidth:!1,size:"xs",padding:"pl-12 pr-10",radius:"rounded-full",disabled:!t,onClick:()=>{xa().history.undo()},children:(0,r.jsx)(sb,{})},"undo"),(0,r.jsx)(Jv,{equalWidth:!1,padding:"pl-10 pr-12",size:"xs",radius:"rounded-full",disabled:!e,onClick:()=>{xa().history.redo()},children:(0,r.jsx)(ab,{})},"redo")]})}const cb=ii((0,r.jsx)("path",{d:"M19 13H5v-2h14v2z"}),"RemoveOutlined"),ub=ii((0,r.jsx)("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"}),"AddOutlined");function hb(){var t,e;const n=ba(t=>t.zoom)||1;return ba(t=>{var e,n;return null==(n=null==(e=t.config.tools)?void 0:e.zoom)?void 0:n.allowUserZoom})??1?(0,r.jsxs)("div",{className:"flex items-center select-none",children:[(0,r.jsx)(Jv,{size:"sm",disabled:!(null!=(t=xa().zoom)&&t.canZoomOut()),onClick:()=>{xa().zoom.zoomOut(xa().zoom.step)},children:(0,r.jsx)(cb,{})}),(0,r.jsxs)("div",{className:"w-[4ch] text-sm text-center",children:[Math.round(100*n),"%"]}),(0,r.jsx)(Jv,{size:"sm",disabled:!(null!=(e=xa().zoom)&&e.canZoomIn()),onClick:()=>{xa().zoom.zoomIn(xa().zoom.step)},children:(0,r.jsx)(ub,{})})]}):null}function db({item:t}){switch(t.type){case"undoWidget":return(0,r.jsx)(lb,{});case"zoomWidget":return(0,r.jsx)(hb,{});case"button":return(0,r.jsx)(eb,{item:t});case"image":return(0,r.jsx)("img",{className:"h-30 object-cover",src:Tp(t.src),alt:""});default:return null}}const pb=ii((0,r.jsx)("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 fb(){var t;let e=ba(t=>{var e;return(null==(e=t.config.ui)?void 0:e.mode)===Wr.OVERLAY});const{width:n}=ba(t=>t.stageSize),r=n<=700;return r&&null!=(t=ya().config.ui)&&t.forceOverlayModeOnMobile&&(e=!0),{isModal:e,isMobile:r}}function gb(){const{isModal:t,isMobile:e}=fb(),n=ba(t=>{var e;return null==(e=t.config.ui)?void 0:e.allowEditorClose})??!0,o=ba(t=>{var e,n;return null==(n=null==(e=t.config.ui)?void 0:e.menubar)?void 0:n.items}),{left:s,center:a,right:l}=(0,i.useMemo)(()=>function(t,e){const n={left:[],center:[],right:[]};(t||[]).filter(t=>!e&&!t.mobileOnly||e&&!t.desktopOnly).forEach(t=>{"left"===t.align?n.left.push({...t,position:t.position??1}):"right"===t.align?n.right.push({...t,position:t.position??1}):n.center.push({...t,position:t.position??1})});const r=Object.entries(n).map(([t,e])=>[t,e.sort((t,e)=>(t.position??0)-(e.position??0))]);return Object.fromEntries(r)}(o||[],e),[o,e]),c=t&&e&&n&&(0,r.jsx)(Jv,{size:"sm",className:"ml-10",onClick:()=>{ya().editor.close()},children:(0,r.jsx)(pb,{})});return(0,r.jsxs)(Cd.div,{className:If,...Rf,children:[(0,r.jsx)("div",{className:"mr-auto flex items-center gap-8",children:s.map((t,e)=>(0,r.jsx)(db,{item:t},e))}),(0,r.jsx)("div",{className:"flex items-center gap-10",children:a.map((t,e)=>(0,r.jsx)(db,{item:t},e))}),(0,r.jsx)("div",{className:"ml-auto flex items-center gap-8",children:l.map((t,e)=>(0,r.jsx)(db,{item:t},e))}),c]})}function mb(){const t=ba(t=>{var e;return null==(e=t.crop.zoneRect)?void 0:e.width})||1,e=ba(t=>{var e;return null==(e=t.crop.zoneRect)?void 0:e.height})||1;return(0,r.jsx)("div",{className:"text-sm",children:`${t}x${e}`})}function vb(){const t=ba(t=>t.activeTool);return(0,r.jsxs)(Cd.div,{className:If,...Rf,children:[(0,r.jsx)(bb,{}),yb(t),(0,r.jsx)(xb,{})]})}function bb(){const{isMobile:t}=fb(),e=ba(t=>t.dirty);return t?(0,r.jsx)(Jv,{size:"sm",onClick:()=>{ya().cancelChanges()},children:(0,r.jsx)(pb,{})}):(0,r.jsx)(Bf,{variant:"outline",size:"xs",startIcon:(0,r.jsx)(pb,{}),radius:"rounded-full",className:"min-w-92",onClick:()=>{ya().cancelChanges()},children:e?(0,r.jsx)(lv,{message:"Cancel"}):(0,r.jsx)(lv,{message:"Close"})})}function yb(t){var e,n;if(!t)return null;const i=(0,r.jsx)("div",{className:"capitalize text-sm",children:(0,r.jsx)(lv,{message:t})});return t===Qr.CROP&&((null==(n=null==(e=ya().config.tools)?void 0:e.crop)?void 0:n.allowCustomRatio)??1)?(0,r.jsx)(mb,{}):i}function xb(){const{isMobile:t}=fb(),e=ba(t=>t.dirty);return t?(0,r.jsx)(Jv,{size:"sm",disabled:!e,onClick:()=>{ya().applyChanges()},children:(0,r.jsx)(Wf,{})}):(0,r.jsx)(Bf,{variant:"flat",color:"primary",size:"xs",disabled:!e,startIcon:(0,r.jsx)(Wf,{}),radius:"rounded-full",onClick:()=>{ya().applyChanges()},children:(0,r.jsx)(lv,{message:"Apply"})})}function wb(){const t=ba(t=>t.activeTool);return(0,r.jsx)(Md,{initial:!1,children:t?(0,r.jsx)(vb,{},"activeToolbar"):(0,r.jsx)(gb,{},"mainToolbar")})}const _b={newCanvas:Xr("Loading Canvas"),mainImage:Xr("Loading Image"),state:Xr("Loading State"),merge:Xr("Processing Image")};function Cb(){const[t,e]=(0,i.useState)(!1);return(0,i.useEffect)(()=>{ba.subscribe(t=>t.loading,t=>{t&&e(t)})},[]),(0,r.jsx)(Md,{children:t&&(0,r.jsx)(Cd.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:(0,r.jsx)(lv,{..._b[t]})})})}const Sb={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 kb(t,e,n){return 0===e||Math.abs(e)===1/0?Math.pow(t,5*n):t*e*n/(e+n*t)}function Tb(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?-kb(e-t,n-e,r)+e:t>n?+kb(t-n,n-e,r)+n:t}function jb(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}function Ob(t,e,n){return(e=jb(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Eb(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 Mb(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Eb(Object(n),!0).forEach(function(e){Ob(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Eb(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}const Pb={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 Ab(t){return t?t[0].toUpperCase()+t.slice(1):""}const Db=["enter","leave"];function Ib(t,e="",n=!1){const r=Pb[t],i=r&&r[e]||e;return"on"+Ab(t)+Ab(i)+(function(t=!1,e){return t&&!Db.includes(e)}(n,i)?"Capture":"")}const Rb=["gotpointercapture","lostpointercapture"];function zb(t){let e=t.substring(2).toLowerCase();const n=!!~e.indexOf("passive");n&&(e=e.replace("passive",""));const r=Rb.includes(e)?"capturecapture":"capture",i=!!~e.indexOf(r);return i&&(e=e.replace("capture","")),{device:e,capture:i,passive:n}}function Lb(t){return"touches"in t}function Fb(t){return Lb(t)?"touch":"pointerType"in t?t.pointerType:"mouse"}function Nb(t){return Lb(t)?function(t){return"touchend"===t.type||"touchcancel"===t.type?t.changedTouches:t.targetTouches}(t)[0]:t}function Bb(t,e){try{const n=e.clientX-t.clientX,r=e.clientY-t.clientY,i=(e.clientX+t.clientX)/2,o=(e.clientY+t.clientY)/2,s=Math.hypot(n,r);return{angle:-180*Math.atan2(n,r)/Math.PI,distance:s,origin:[i,o]}}catch{}return null}function Vb(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 $b(t,e){const[n,r]=Array.from(t.touches).filter(t=>e.includes(t.identifier));return Bb(n,r)}function Hb(t){const e=Nb(t);return Lb(t)?e.identifier:e.pointerId}function Wb(t){const e=Nb(t);return[e.clientX,e.clientY]}function Ub(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 Xb(t,...e){return"function"==typeof t?t(...e):t}function Yb(){}function Gb(...t){return 0===t.length?Yb:1===t.length?t[0]:function(){let e;for(const n of t)e=n.apply(this,arguments)||e;return e}}function qb(t,e){return Object.assign({},e,t||{})}class Kb{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=t.timeDelta=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?Xb(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);Sb.addTo(e._distance,t)}this.axisIntent&&this.axisIntent(t);const[o,s]=e._movement,[a,l]=n.threshold,{_step:c,values:u}=e;if(n.hasCustomTransform?(!1===c[0]&&(c[0]=Math.abs(o)>=a&&u[0]),!1===c[1]&&(c[1]=Math.abs(s)>=l&&u[1])):(!1===c[0]&&(c[0]=Math.abs(o)>=a&&Math.sign(o)*a),!1===c[1]&&(c[1]=Math.abs(s)>=l&&Math.sign(s)*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]?s-c[1]:0;this.restrictToAxis&&!e._blocked&&this.restrictToAxis(h);const d=e.offset,p=e._active&&!e._blocked||e.active;p&&(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=Xb(n.bounds,e)),this.setup&&this.setup()),e.movement=h,this.computeOffset()));const[f,g]=e.offset,[[m,v],[b,y]]=e._bounds;e.overflow=[f<m?-1:f>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,s],[a,l]]=t;return[Tb(e,o,s,r),Tb(n,a,l,i)]}(e._bounds,e.offset,x),e.delta=Sb.sub(e.offset,d),this.computeMovement(),p&&(!e.last||i>32)){e.delta=Sb.sub(e.offset,d);const t=e.delta.map(Math.abs);Sb.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],e.timeDelta=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(Mb(Mb(Mb({},e),t),{},{[this.aliasKey]:t.values}));void 0!==r&&(t.memo=r)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}class Zb extends Kb{constructor(...t){super(...t),Ob(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=Sb.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=Sb.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[Fb(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 Jb=t=>t,Qb={enabled:(t=!0)=>t,eventOptions:(t,e,n)=>Mb(Mb({},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 Sb.toVector(t)}},from:t=>"function"==typeof t?t:null!=t?Sb.toVector(t):void 0,transform(t,e,n){const r=t||n.shared.transform;return this.hasCustomTransform=!!r,r||Jb},threshold:t=>Sb.toVector(t,0)},ty=Mb(Mb({},Qb),{},{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=>ty.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]]}}),ey={ArrowRight:(t,e=1)=>[t*e,0],ArrowLeft:(t,e=1)=>[-1*t*e,0],ArrowUp:(t,e=1)=>[0,-1*t*e],ArrowDown:(t,e=1)=>[0,t*e]};const ny=typeof window<"u"&&window.document&&window.document.createElement;function ry(){return ny&&"ontouchstart"in window}const iy={isBrowser:ny,gesture:function(){try{return"constructor"in GestureEvent}catch{return!1}}(),touch:ry(),touchscreen:ry()||ny&&window.navigator.maxTouchPoints>1,pointer:ny&&"onpointerdown"in window,pointerLock:ny&&"exitPointerLock"in window.document},oy={mouse:0,touch:0,pen:8},sy=Mb(Mb({},ty),{},{device(t,e,{pointer:{touch:n=!1,lock:r=!1,mouse:i=!1}={}}){return this.pointerLock=r&&iy.pointerLock,iy.touch&&n?"touch":this.pointerLock?"mouse":iy.pointer&&!i?"pointer":iy.touch?"touch":"mouse"},preventScrollAxis(t,e,{preventScroll:n}){if(this.preventScrollDelay="number"==typeof n?n:n||void 0===n&&t?250:void 0,iy.touchscreen&&!1!==n)return t||(void 0!==n?"y":void 0)},pointerCapture(t,e,{pointer:{capture:n=!0,buttons:r=1,keys:i=!0}={}}){return this.pointerButtons=r,this.keys=i,!this.pointerLock&&"pointer"===this.device&&n},threshold(t,e,{filterTaps:n=!1,tapsThreshold:r=3,axis:i}){const o=Sb.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(Sb.toVector(t)),distance:this.transform(Sb.toVector(e)),duration:n}},delay(t=0){switch(t){case!0:return 180;case!1:return 0;default:return t}},axisThreshold:t=>t?Mb(Mb({},oy),t):oy,keyboardDisplacement:(t=10)=>t});const ay=Mb(Mb({},Qb),{},{device(t,e,{shared:n,pointer:{touch:r=!1}={}}){if(n.target&&!iy.touch&&iy.gesture)return"gesture";if(iy.touch&&r)return"touch";if(iy.touchscreen){if(iy.pointer)return"pointer";if(iy.touch)return"touch"}},bounds(t,e,{scaleBounds:n={},angleBounds:r={}}){const i=t=>{const e=qb(Xb(n,t),{min:-1/0,max:1/0});return[e.min,e.max]},o=t=>{const e=qb(Xb(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,Sb.toVector(t,this.lockDirection?[.1,3]:0)},modifierKey:t=>void 0===t?"ctrlKey":t,pinchOnWheel:(t=!0)=>t});Mb(Mb({},ty),{},{mouseOnly:(t=!0)=>t}),Mb(Mb({},ty),{},{mouseOnly:(t=!0)=>t});const ly=new Map,cy=new Map;function uy(t){ly.set(t.key,t.engine),cy.set(t.key,t.resolver)}const hy={key:"drag",engine:class extends Zb{constructor(...t){super(...t),Ob(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=ty.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=Hb(t),n._pointerActive=!0,this.computeValues(Wb(t)),this.computeInitial(),e.preventScrollAxis&&"mouse"!==Fb(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)return;const r=Hb(t);if(void 0!==e._pointerId&&r!==e._pointerId)return;const i=Wb(t);return document.pointerLockElement===t.target?e._delta=[t.movementX,t.movementY]:(e._delta=Sb.sub(i,e._values),this.computeValues(i)),Sb.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=Hb(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._delta,[i,o]=e._movement,[s,a]=n.swipe.velocity,[l,c]=n.swipe.distance,u=n.swipe.duration;if(e.elapsedTime<u){const n=Math.abs(t/e.timeDelta),u=Math.abs(r/e.timeDelta);n>s&&Math.abs(i)>l&&(e.swipe[0]=Math.sign(t)),u>a&&Math.abs(o)>c&&(e.swipe[1]=Math.sign(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=ey[t.key];if(e){const n=this.state,r=t.shiftKey?10:t.altKey?.1:1;this.start(t),n._delta=e(this.config.keyboardDisplacement,r),n._keyboardActive=!0,Sb.addTo(n._movement,n._delta),this.compute(t),this.emit()}}keyUp(t){t.key in ey&&(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:sy},dy={key:"pinch",engine:class extends Kb{constructor(...t){super(...t),Ob(this,"ingKey","pinching"),Ob(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?Sb.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=$b(t,e._touchIds);r&&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=Bb(...Array.from(n.values()));i&&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=$b(t,this.state._touchIds);e&&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=Bb(...Array.from(e.values()));n&&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=Sb.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&&(Array.isArray(e)?!e.find(e=>t[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=[-Ub(t)[1]/100*e.offset[0],0],Sb.addTo(e._movement,e._delta),function(t){const[e,n]=t.overflow,[r,i]=t._delta,[o,s]=t._direction;(e<0&&r>0&&o<0||e>0&&r<0&&o>0)&&(t._movement[0]=t._movementBound[0]),(n<0&&i>0&&s<0||n>0&&i<0&&s>0)&&(t._movement[1]=t._movementBound[1])}(e),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("lostPointerCapture","",this[e+"End"].bind(this))),this.config.pinchOnWheel&&t("wheel","",this.wheel.bind(this),{passive:!1})}},resolver:ay};function py(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 fy={target(t){if(t)return()=>"current"in t?t.current:t},enabled:(t=!0)=>t,window:(t=(iy.isBrowser?window:void 0))=>t,eventOptions:({passive:t=!0,capture:e=!1}={})=>({passive:t,capture:e}),transform:t=>t},gy=["target","eventOptions","window","enabled","transform"];function my(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]=my(t[r],i);break;case"boolean":i&&(n[r]=t[r])}return n}class vy{constructor(t,e){Ob(this,"_listeners",new Set),this._ctrl=t,this._gestureKey=e}add(t,e,n,r,i){const o=this._listeners,s=function(t,e=""){const n=Pb[t];return t+(n&&n[e]||e)}(e,n),a=Mb(Mb({},this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{}),i);t.addEventListener(s,r,a);const l=()=>{t.removeEventListener(s,r,a),o.delete(l)};return o.add(l),l}clean(){this._listeners.forEach(t=>t()),this._listeners.clear()}}class by{constructor(){Ob(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 yy{constructor(t){Ob(this,"gestures",new Set),Ob(this,"_targetEventStore",new vy(this)),Ob(this,"gestureEventStores",{}),Ob(this,"gestureTimeoutStores",{}),Ob(this,"handlers",{}),Ob(this,"config",{}),Ob(this,"pointerIds",new Set),Ob(this,"touchIds",new Set),Ob(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),function(t,e){e.drag&&xy(t,"drag"),e.wheel&&xy(t,"wheel"),e.scroll&&xy(t,"scroll"),e.move&&xy(t,"move"),e.pinch&&xy(t,"pinch"),e.hover&&xy(t,"hover")}(this,t)}setEventIds(t){return Lb(t)?(this.touchIds=new Set(Vb(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:s,enabled:a,transform:l}=r,c=py(r,gy);if(n.shared=my({target:i,eventOptions:o,window:s,enabled:a,transform:l},fy),e){const t=cy.get(e);n[e]=my(Mb({shared:n.shared},c),t)}else for(const u in c){const t=cy.get(u);t&&(n[u]=my(Mb({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=wy(n,i.eventOptions,!!r);if(i.enabled){new(ly.get(e))(this,t,e).bind(o)}}const i=wy(n,e.eventOptions,!!r);for(const e in this.nativeHandlers)i(e,"",n=>this.nativeHandlers[e](Mb(Mb({},this.state.shared),{},{event:n,args:t})),void 0,!0)}for(const t in n)n[t]=Gb(...n[t]);if(!r)return n;for(const t in n){const{device:e,capture:i,passive:o}=zb(t);this._targetEventStore.add(r,e,"",n[t],{capture:i,passive:o})}}}}function xy(t,e){t.gestures.add(e),t.gestureEventStores[e]=new vy(t,e),t.gestureTimeoutStores[e]=new by}const wy=(t,e,n)=>(r,i,o,s={},a=!1)=>{var l,c;const u=null!==(l=s.capture)&&void 0!==l?l:e.capture,h=null!==(c=s.passive)&&void 0!==c?c:e.passive;let d=a?r:Ib(r,i,u);n&&h&&(d+="Passive"),t[d]=t[d]||[],t[d].push(o)},_y=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function Cy(t,e,n,r,i,o){if(!t.has(n)||!ly.has(r))return;const s=n+"Start",a=n+"End";i[r]=t=>{let r;return t.first&&s in e&&e[s](t),n in e&&(r=e[n](t)),t.last&&a in e&&e[a](t),r},o[r]=o[r]||{}}function Sy(t,e){const[n,r,i]=function(t){const e={},n={},r=new Set;for(let i in t)_y.test(i)?(r.add(RegExp.lastMatch),n[i]=t[i]):e[i]=t[i];return[n,e,r]}(t),o={};return Cy(i,n,"onDrag","drag",o,e),Cy(i,n,"onWheel","wheel",o,e),Cy(i,n,"onScroll","scroll",o,e),Cy(i,n,"onPinch","pinch",o,e),Cy(i,n,"onMove","move",o,e),Cy(i,n,"onHover","hover",o,e),{handlers:o,config:e,nativeHandlers:r}}function ky({e:t,rect:e,deltaX:n,deltaY:r}){return{rect:e,x:t.clientX,y:t.clientY,deltaX:n??0,deltaY:r??0,nativeEvent:t}}function Ty({onMoveStart:t,onMove:e,onMoveEnd:n,minimumMovement:r=0,preventDefault:o,stopPropagation:s=!0,onPress:a,onLongPress:l,...c}){const u=(0,i.useRef)({lastPosition:{x:0,y:0},started:!1,longPressTriggered:!1}).current,{addGlobalListener:h,removeGlobalListener:d}=Qd(),p=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})}},f=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==a||a(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",p,!1),d(window,"pointerup",f,!1),d(window,"pointercancel",f,!1)}};return{domProps:{onPointerDown:Ff(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;s&&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",p,!1),h(window,"pointerup",f,!1),h(window,"pointercancel",f,!1)}})}}}function jy(t){return{left:t.left,top:t.top,width:t.width,height:t.height}}var Oy=(t=>(t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t))(Oy||{});let Ey={};const My=(t={})=>{dp(null),Ey=t};function Py({aspectRatio:t,boundaryRef:e,boundaryRect:n,restrictWithinBoundary:r=!0,minWidth:i=50,minHeight:o=50,...s}){const a={onMoveStart:(t,r)=>{var i;const o=t.target;if(!o.dataset.resizeHandle||hp||(My({currentRect:jy(r.getBoundingClientRect()),resizeDir:o.dataset.resizeHandle}),!Ey.currentRect))return!1;dp("resize"),n?Ey.boundaryRect=n:null!=e&&e.current&&(Ey.boundaryRect=jy(e.current.getBoundingClientRect())),Ey.currentRect&&Ey.boundaryRect&&(Ey.currentRect.left-=Ey.boundaryRect.left,Ey.currentRect.top-=Ey.boundaryRect.top),Ey.initialAspectRatio=Ey.currentRect.width/Ey.currentRect.height,null==(i=s.onResizeStart)||i.call(s,ky({rect:Ey.currentRect,e:t}))},onMove:(e,n,r)=>{var a;if(!Ey.resizeDir||!Ey.currentRect)return;const l="initial"===t?Ey.initialAspectRatio:t,c=function(t,e,n,r){const i={...t},o={...t};return"topRight"===Ey.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"===Ey.resizeDir?(o.width=Math.floor(o.width+e),o.height=r?Math.floor(o.width/r):Math.floor(o.height+n)):"topLeft"===Ey.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"===Ey.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}(Ey.currentRect,n,r,l),u=function(t,e,n,r){const i="bottomLeft"===Ey.resizeDir||"topLeft"===Ey.resizeDir,o="topRight"===Ey.resizeDir||"topLeft"===Ey.resizeDir;let s={...t};s.width=Math.max(e,t.width),s.height=Math.max(n,t.height);const a=s.width-t.width;i&&a>0&&(s.left-=a);const l=s.height-t.height;if(o&&l>0&&(s.top-=l),Ey.boundaryRect&&(s=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}(s,Ey.boundaryRect)),r){const t=s.width,e=s.height,n=Xp(r,s.width,s.height);s.width=n.width,s.height=n.height,o&&(s.top+=e-s.height),i&&(s.left+=t-s.width)}return s}(c,i,o,l);null==(a=s.onResize)||a.call(s,ky({rect:u,e:e,deltaX:n,deltaY:r})),Ey.currentRect=c},onMoveEnd:t=>{var e;Ey.currentRect&&(null==(e=s.onResizeEnd)||e.call(s,ky({rect:Ey.currentRect,e:t}))),My()}},{domProps:l}=Ty(a);return{resizeProps:l}}function Ay({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 Oy.topLeft:return`${n} ${r} border-l-4 border-t-4 cursor-nwse-resize`;case Oy.topRight:return`${o} ${r} border-r-4 border-t-4 cursor-nesw-resize`;case Oy.bottomRight:return`${o} ${i} border-r-4 border-b-4 cursor-se-resize`;case Oy.bottomLeft:return`${n} ${i} border-l-4 border-b-4 cursor-sw-resize`;default:return""}}(t,e);return(0,r.jsx)("div",{"data-resize-handle":t,className:`border-white absolute w-20 h-20 ${n}`})}var Dy=(t=>(t.top="maskTop",t.right="maskRight",t.bottom="maskBottom",t.left="maskLeft",t))(Dy||{});function Iy({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(0,r.jsx)("div",{className:`cropzone-transition bg-black/50 bottom absolute ${n}`,ref:n=>e.current[t]=n})}function Ry({name:t,refs:e}){const n=ei("cropzone-transition pointer-events-none absolute left-0 top-0 bg-white/50",t.startsWith("lineHor")?"h-px":"w-px");return(0,r.jsx)("div",{className:n,ref:n=>{e.current[t]=n}})}function zy(t,e,n){return Math.min(Math.max(t,e),n)}let Ly={};function Fy({boundaryRef:t,boundaryRect:e,minimumMovement:n,restrictWithinBoundary:r=!0,...i}){const o={minimumMovement:n,onMoveStart:(n,r)=>{var o;if(hp)return!1;Ly={currentRect:jy(r.getBoundingClientRect())},dp("move"),e?Ly.boundaryRect=e:null!=t&&t.current&&(Ly.boundaryRect=jy(t.current.getBoundingClientRect())),Ly.currentRect&&Ly.boundaryRect&&(Ly.currentRect.left-=Ly.boundaryRect.left,Ly.currentRect.top-=Ly.boundaryRect.top),null==(o=i.onMoveStart)||o.call(i,ky({rect:Ly.currentRect,e:n}))},onMove:(t,e,n)=>{var o;if(!Ly.currentRect)return;const s={...Ly.currentRect,left:Ly.currentRect.left+e,top:Ly.currentRect.top+n},a={...s};Ly.boundaryRect&&r&&(a.left=zy(s.left,0,Ly.boundaryRect.width-s.width),a.top=zy(s.top,0,Ly.boundaryRect.height-s.height)),null==(o=i.onMove)||o.call(i,ky({rect:a,e:t,deltaX:e,deltaY:n})),Ly.currentRect=s},onMoveEnd:t=>{var e;Ly.currentRect&&(null==(e=i.onMoveEnd)||e.call(i,ky({rect:Ly.currentRect,e:t})),dp(null),Ly={})}},{domProps:s}=Ty(o);return{moveProps:s}}function Ny(){const t=(0,i.useRef)({}),[e,n]=(0,i.useState)(!0),o=ba(t=>t.canvasSize),s=ba(t=>{var e,n;return null==(n=null==(e=t.config.tools)?void 0:e.crop)?void 0:n.cropzone}),a=ba(t=>{var e,n;return null==(n=null==(e=t.config.tools)?void 0:e.crop)?void 0:n.defaultRatio})||null,l=ba(t=>t.crop.selectedAspectRatio)||null,{moveProps:c}=Fy({boundaryRect:o,onMoveStart:()=>n(!0),onMove:t=>xa().crop.drawZone(t.rect),onMoveEnd:()=>n(!1)}),{resizeProps:u}=Py({boundaryRect:o,minHeight:50,minWidth:50,aspectRatio:Yp(l),onResizeStart:()=>n(!0),onResize:t=>xa().crop.drawZone(t.rect),onResizeEnd:()=>n(!1)});(0,i.useLayoutEffect)(()=>{xa().crop.registerRefs(t),xa().crop.resetCropzone(a)},[a,o]);const h=ei("cropzone absolute z-cropzone isolate left-0 top-0 w-full h-full overflow-hidden",e&&"moving");return(0,r.jsxs)("div",{className:h,onPointerDown:t=>{t.stopPropagation(),t.preventDefault()},children:[(0,r.jsxs)("div",{className:"cropzone-transition border-white/50 absolute z-10 left-0 top-0 border",...Ud(u,c),ref:e=>t.current.innerZone=e,children:[!(null!=s&&s.hideTopLeft)&&(0,r.jsx)(Ay,{position:Oy.topLeft,inset:!0}),!(null!=s&&s.hideTopRight)&&(0,r.jsx)(Ay,{position:Oy.topRight,inset:!0}),!(null!=s&&s.hideBottomLeft)&&(0,r.jsx)(Ay,{position:Oy.bottomLeft,inset:!0}),!(null!=s&&s.hideBottomRight)&&(0,r.jsx)(Ay,{position:Oy.bottomRight,inset:!0}),(0,r.jsx)(Ry,{name:"lineVer1",refs:t}),(0,r.jsx)(Ry,{name:"lineVer2",refs:t}),(0,r.jsx)(Ry,{name:"lineHor1",refs:t}),(0,r.jsx)(Ry,{name:"lineHor2",refs:t})]}),(0,r.jsx)(Iy,{refs:t,position:Dy.top}),(0,r.jsx)(Iy,{refs:t,position:Dy.left}),(0,r.jsx)(Iy,{refs:t,position:Dy.right}),(0,r.jsx)(Iy,{refs:t,position:Dy.bottom})]})}const By=ii((0,r.jsx)("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"})),Vy=ii((0,r.jsx)("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"})),$y=ii((0,r.jsx)("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"})),Hy=ii((0,r.jsx)("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"})),Wy={width:120,height:30},Uy=[{name:"Duplicate",icon:By,onClick:()=>{xa().objects.duplicate()}},{name:"Flip",icon:Vy,onClick:()=>{xa().objects.flipHorizontally()}},{name:"Bring to front",icon:$y,onClick:()=>{xa().objects.bringToFront()}},{name:"Delete",icon:Hy,onClick:()=>{xa().objects.delete()}}],Xy=i.forwardRef((t,e)=>{const n=ba(t=>t.objects.active.isMoving)?"opacity-0":"opacity-100";return(0,r.jsx)("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:Uy.map(t=>{const e=t.icon;return(0,r.jsx)(Jv,{size:"sm",className:"w-30 h-30 hover:bg-white/hover",radius:"rounded-none",onClick:t.onClick,children:(0,r.jsx)(e,{})},t.name)})})});function Yy(t,e){const n=xa().objects.getActive();if(!n||!t.current)return;const r=t.current,i=ap.fabric.util.degreesToRadians(n.angle??0);let o=Math.round(n.getScaledWidth()*ya().zoom),s=Math.round(n.getScaledHeight()*ya().zoom),a=Math.round((n.left??0)*ya().zoom),l=Math.round((n.top??0)*ya().zoom);const c="center"===n.originX?o/2:0,u="center"===n.originY?s/2:0;n.padding&&(o+=2*n.padding,s+=2*n.padding,a-=n.padding,l-=n.padding),r.style.width=`${o}px`,r.style.height=`${s}px`,r.style.transform=`translate(${a-c}px, ${l-u}px) rotate(${i}rad)`,xa().canvas.render(),function(t,e){if(!e)return;const n=t.angle||0,r=n>168&&n<188?-30:-15,i=ya().canvasSize,o=ya().stageSize,s=Wy,a=i.top-o.top,l=i.left-o.left,c=o.width-(l+i.width),u=o.height-(a+i.height),h=-a,d=-(i.left-o.left),p=i.width-s.width+c,f=i.height-s.height+u,g=t.getBoundingRect();let m=g.top-s.height+r,v=g.left+g.width/2-s.width/2;m=Math.min(f,Math.max(h,m)),v=Math.min(p,Math.max(d,v)),e.style.transform=`translate(${v}px, ${m}px) rotate(0deg)`}(n,e.current)}function Gy(){return(0,r.jsx)("div",{className:"absolute -bottom-20 left-1/2 w-2 h-20 bg-white cursor-default -translate-x-1/2",children:(0,r.jsx)("div",{"data-rotate-handle":!0,className:"w-18 h-18 absolute -bottom-10 -left-8 bg-white rounded-full cursor-move"})})}let qy={};function Ky(t){const e=qy.centerX||0,n=qy.centerY||0;return Math.atan2(n-t.pageY,e-t.pageX)-(qy.startAngle||0)}const Zy=(t={})=>{dp(null),qy=t};function Jy(){const t=(0,i.useRef)(null),e=(0,i.useRef)(null),n=ba(t=>t.objects.active.id),o=ba(t=>t.objects.isEditingText),s=ba(t=>t.zoom),a=function(){const t=xa().objects.getActive();if(!t||!t.name)return{};const e=ya().config.objectControls||{},n=t.name;return{...e.global,...e[n]}}(),l=(0,i.useRef)(null),c=(0,i.useCallback)(()=>{l.current?(clearTimeout(l.current),l.current=null,function(){var t;const e=xa().objects.getActive();hs(e)&&(e.enterEditing(),null==(t=e.hiddenTextarea)||t.focus())}()):l.current=setTimeout(()=>{l.current=null},300)},[]);let{moveProps:u}=Fy({boundaryRef:ya().canvasRef,restrictWithinBoundary:!1,onMoveEnd:()=>{ya().objects.setActiveIsMoving(!1)},onMove:t=>{ya().objects.setActiveIsMoving(!0),function(t){const e=t.rect.width/2,n=t.rect.height/2;xa().objects.setValues({left:(t.rect.left+e)/ya().zoom,top:(t.rect.top+n)/ya().zoom})}(t)}});a.lockMovement&&(u={});const{resizeProps:h}=Py({minWidth:50,minHeight:50,aspectRatio:a.unlockAspectRatio?null:"initial",boundaryRef:a.containWithinCanvas?ya().canvasRef:void 0,restrictWithinBoundary:!1,onResizeEnd:()=>{ya().objects.setActiveIsMoving(!1)},onResize:t=>{ya().objects.setActiveIsMoving(!0),function(t){const e=xa().objects.getActive();if(!e)return;const n={};hs(e)?(t.deltaX>0||e.getScaledHeight()>=20&&e.getScaledWidth()>=20)&&(n.fontSize=(e.fontSize||1)+t.deltaX):(e.width&&(n.scaleX=t.rect.width/ya().zoom/e.width),e.height&&(n.scaleY=t.rect.height/ya().zoom/e.height)),xa().objects.setValues(n)}(t)}}),{rotateProps:d}=function(t){const e={onMoveStart:(e,n)=>{var r,i;if(!e.target.dataset.rotateHandle||hp)return!1;const o=jy(n.getBoundingClientRect());if(!o)return!1;const s=null==(r=n.style.transform.match(/rotate\((.+?)\)/))?void 0:r[1],[a="0"]=s?s.split(","):[];Zy({currentRect:o,centerX:o.left+o.width/2,centerY:o.top+o.height/2,startAngle:parseFloat(a)}),dp("rotate"),qy.startAngle=Ky(e),null==(i=t.onRotateStart)||i.call(t,ky({rect:o,e:e}))},onMove:(e,n,r)=>{var i;if(!qy.currentRect)return;const o={...qy.currentRect};o.angle=Ky(e),o.left+=n,o.top+=r,null==(i=t.onRotate)||i.call(t,ky({rect:o,e:e,deltaX:n,deltaY:r})),qy.currentRect=o},onMoveEnd:e=>{var n;qy.currentRect&&(null==(n=t.onRotateEnd)||n.call(t,ky({rect:qy.currentRect,e:e}))),Zy()}},{domProps:n}=Ty(e);return{rotateProps:n}}({boundaryRef:ya().canvasRef,onRotateEnd:()=>{ya().objects.setActiveIsMoving(!1)},onRotate:t=>{ya().objects.setActiveIsMoving(!0),function(t){const e=xa().objects.getActive();if(!e||!t.rect.angle)return;const n=ap.fabric.util.radiansToDegrees(t.rect.angle);n!==e.angle&&xa().objects.setValues({angle:n})}(t)}});return(0,i.useEffect)(()=>{wa()&&ya().editor.on("object:modified",n=>{n.sizeOrPositionChanged&&Yy(t,e)})},[]),(0,i.useEffect)(()=>{Yy(t,e)},[n,s,o]),(0,r.jsxs)("div",{className:n&&!o?"block":"hidden",children:[(0,r.jsxs)("div",{ref:t,...Ud(d,h,u),onClick:c,className:"absolute z-obj-box border-2 border-white shadow-md cursor-move",children:[!a.hideTopLeft&&(0,r.jsx)(Ay,{position:Oy.topLeft}),!a.hideTopRight&&(0,r.jsx)(Ay,{position:Oy.topRight}),!a.hideBottomLeft&&(0,r.jsx)(Ay,{position:Oy.bottomLeft}),!a.hideBottomRight&&(0,r.jsx)(Ay,{position:Oy.bottomRight}),!a.hideRotatingPoint&&(0,r.jsx)(Gy,{})]}),(0,r.jsx)(Xy,{ref:e})]})}function Qy(){const t=ba(t=>t.activeTool===Qr.CROP),e=ba(t=>t.objects.active.id);return(0,r.jsxs)("div",{children:[t&&(0,r.jsx)(Ny,{}),e&&(0,r.jsx)(Jy,{})]})}const tx=function(t){return t.forEach(uy),function(t,e){const{handlers:n,nativeHandlers:r,config:o}=Sy(t,e||{});return function(t,e={},n,r){const o=i.useMemo(()=>new yy(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)}}([hy,dy]),ex=i.forwardRef((t,e)=>{const[n,o]=(0,i.useState)(!1);(0,i.useEffect)(()=>ba.subscribe(t=>t.loading,t=>{o(!t)}),[]);return(0,r.jsx)(nx,{children:(0,r.jsxs)(Cd.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 w-max",style:{backgroundImage:`url(${Tp("images/empty-canvas-bg.png")})`},children:[(0,r.jsx)(Qy,{}),(0,r.jsx)("canvas",{ref:e})]})})});function nx({children:t}){const e=(0,i.useRef)(null),n=tx({onPinch:t=>{if(!xa().zoom.allowUserZoom||!rx(t))return t.cancel();1===t.direction[0]?xa().zoom.zoomIn(.01):xa().zoom.zoomOut(.01),t.event.stopPropagation(),t.event.preventDefault()},onDrag:t=>{if(t.pinching||!rx(t))return t.cancel();e.current.scrollLeft-=t.delta[0],e.current.scrollTop-=t.delta[1]}});return(0,r.jsx)("div",{ref:e,className:"w-full h-full overflow-hidden touch-none flex",...n(),children:t})}function rx(t){return!(wa().findTarget(t.event,!1)||wa().isDrawingMode)}function ix({actionBtn:t,children:e,className:n}){return(0,r.jsxs)("div",{className:ei(n,"flex gap-16 items-center h-full"),children:[t&&(0,r.jsx)("div",{className:"flex-shrink-0",children:t}),(0,r.jsx)("div",{className:"w-full flex-auto",children:e}),t&&(0,r.jsx)("div",{className:"w-96"})]})}function ox(){return(ox=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 sx(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 ax(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 lx=function(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=1),t>n?n:t<e?e:t},cx=function(t){return"touches"in t},ux=function(t){return t&&t.ownerDocument.defaultView||self},hx=function(t,e,n){var r=t.getBoundingClientRect(),i=cx(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:lx((i.pageX-(r.left+ux(t).pageXOffset))/r.width),top:lx((i.pageY-(r.top+ux(t).pageYOffset))/r.height)}},dx=function(t){!cx(t)&&t.preventDefault()},px=i.memo(function(t){var e=t.onMove,n=t.onKey,r=sx(t,["onMove","onKey"]),o=(0,i.useRef)(null),s=ax(e),a=ax(n),l=(0,i.useRef)(null),c=(0,i.useRef)(!1),u=(0,i.useMemo)(function(){var t=function(t){dx(t),(cx(t)?t.touches.length>0:t.buttons>0)&&o.current?s(hx(o.current,t,l.current)):n(!1)},e=function(){return n(!1)};function n(n){var r=c.current,i=ux(o.current),s=n?i.addEventListener:i.removeEventListener;s(r?"touchmove":"mousemove",t),s(r?"touchend":"mouseup",e)}return[function(t){var e,r=t.nativeEvent,i=o.current;if(i&&(dx(r),e=r,(!c.current||cx(e))&&i)){if(cx(r)){c.current=!0;var a=r.changedTouches||[];a.length&&(l.current=a[0].identifier)}i.focus(),s(hx(i,r,l.current)),n(!0)}},function(t){var e=t.which||t.keyCode;e<37||e>40||(t.preventDefault(),a({left:39===e?.05:37===e?-.05:0,top:40===e?.05:38===e?-.05:0}))},n]},[a,s]),h=u[0],d=u[1],p=u[2];return(0,i.useEffect)(function(){return p},[p]),i.createElement("div",ox({},r,{onTouchStart:h,onMouseDown:h,className:"react-colorful__interactive",ref:o,onKeyDown:d,tabIndex:0,role:"slider"}))}),fx=function(t){return t.filter(Boolean).join(" ")},gx=function(t){var e=t.color,n=t.left,r=t.top,o=void 0===r?.5:r,s=fx(["react-colorful__pointer",t.className]);return i.createElement("div",{className:s,style:{top:100*o+"%",left:100*n+"%"}},i.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:e}}))},mx=function(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=Math.pow(10,e)),Math.round(n*t)/n},vx=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?mx(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?mx(parseInt(t.substring(6,8),16)/255,2):1}},bx=function(t){var e=function(t){var e=t.s,n=t.v,r=t.a,i=(200-e)*n/100;return{h:mx(t.h),s:mx(i>0&&i<200?e*n/100/(i<=100?i:200-i)*100:0),l:mx(i/2),a:mx(r,2)}}(t);return"hsl("+e.h+", "+e.s+"%, "+e.l+"%)"},yx=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),s=r*(1-n),a=r*(1-(e-o)*n),l=r*(1-(1-e+o)*n),c=o%6;return{r:mx(255*[r,a,s,s,l,r][c]),g:mx(255*[l,r,r,a,s,s][c]),b:mx(255*[s,s,l,r,r,a][c]),a:mx(i,2)}},xx=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},wx=function(t){var e=t.r,n=t.g,r=t.b,i=t.a,o=i<1?xx(mx(255*i)):"";return"#"+xx(e)+xx(n)+xx(r)+o},_x=function(t){var e=t.r,n=t.g,r=t.b,i=t.a,o=Math.max(e,n,r),s=o-Math.min(e,n,r),a=s?o===e?(n-r)/s:o===n?2+(r-e)/s:4+(e-n)/s:0;return{h:mx(60*(a<0?a+6:a)),s:mx(o?s/o*100:0),v:mx(o/255*100),a:i}},Cx=i.memo(function(t){var e=t.hue,n=t.onChange,r=fx(["react-colorful__hue",t.className]);return i.createElement("div",{className:r},i.createElement(px,{onMove:function(t){n({h:360*t.left})},onKey:function(t){n({h:lx(e+360*t.left,0,360)})},"aria-label":"Hue","aria-valuenow":mx(e),"aria-valuemax":"360","aria-valuemin":"0"},i.createElement(gx,{className:"react-colorful__hue-pointer",left:e/360,color:bx({h:e,s:100,v:100,a:1})})))}),Sx=i.memo(function(t){var e=t.hsva,n=t.onChange,r={backgroundColor:bx({h:e.h,s:100,v:100,a:1})};return i.createElement("div",{className:"react-colorful__saturation",style:r},i.createElement(px,{onMove:function(t){n({s:100*t.left,v:100-100*t.top})},onKey:function(t){n({s:lx(e.s+100*t.left,0,100),v:lx(e.v-100*t.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+mx(e.s)+"%, Brightness "+mx(e.v)+"%"},i.createElement(gx,{className:"react-colorful__saturation-pointer",top:1-e.v/100,left:e.s/100,color:bx(e)})))}),kx=function(t,e){if(t===e)return!0;for(var n in t)if(t[n]!==e[n])return!1;return!0};var Tx,jx=typeof window<"u"?i.useLayoutEffect:i.useEffect,Ox=new Map,Ex=function(t){jx(function(){var e=t.current?t.current.ownerDocument:document;if(void 0!==e&&!Ox.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}',Ox.set(e,r);var i=n.nc;i&&r.setAttribute("nonce",i),e.head.appendChild(r)}},[])},Mx=function(t){var e=t.className,n=t.colorModel,r=t.color,o=void 0===r?n.defaultColor:r,s=t.onChange,a=sx(t,["className","colorModel","color","onChange"]),l=(0,i.useRef)(null);Ex(l);var c=function(t,e,n){var r=ax(n),o=(0,i.useState)(function(){return t.toHsva(e)}),s=o[0],a=o[1],l=(0,i.useRef)({color:e,hsva:s});(0,i.useEffect)(function(){if(!t.equal(e,l.current.color)){var n=t.toHsva(e);l.current={hsva:n,color:e},a(n)}},[e,t]),(0,i.useEffect)(function(){var e;kx(s,l.current.hsva)||t.equal(e=t.fromHsva(s),l.current.color)||(l.current={hsva:s,color:e},r(e))},[s,t,r]);var c=(0,i.useCallback)(function(t){a(function(e){return Object.assign({},e,t)})},[]);return[s,c]}(n,o,s),u=c[0],h=c[1],d=fx(["react-colorful",e]);return i.createElement("div",ox({},a,{ref:l,className:d}),i.createElement(Sx,{hsva:u,onChange:h}),i.createElement(Cx,{hue:u.h,onChange:h,className:"react-colorful__last-control"}))},Px={defaultColor:"000",toHsva:function(t){return _x(vx(t))},fromHsva:function(t){return function(t){return wx(yx(t))}({h:t.h,s:t.s,v:t.v,a:1})},equal:function(t,e){return t.toLowerCase()===e.toLowerCase()||kx(vx(t),vx(e))}},Ax=function(t){return i.createElement(Mx,ox({},t,{colorModel:Px}))},Dx=/^#?([0-9A-F]{3,8})$/i,Ix=function(t){var e=t.color,n=void 0===e?"":e,r=t.onChange,o=t.onBlur,s=t.escape,a=t.validate,l=t.format,c=t.process,u=sx(t,["color","onChange","onBlur","escape","validate","format","process"]),h=(0,i.useState)(function(){return s(n)}),d=h[0],p=h[1],f=ax(r),g=ax(o),m=(0,i.useCallback)(function(t){var e=s(t.target.value);p(e),a(e)&&f(c?c(e):e)},[s,c,a,f]),v=(0,i.useCallback)(function(t){a(t.target.value)||p(s(n)),g(t)},[n,s,a,g]);return(0,i.useEffect)(function(){p(s(n))},[n,s]),i.createElement("input",ox({},u,{value:l?l(d):d,spellCheck:"false",onChange:m,onBlur:v}))},Rx=function(t){return"#"+t},zx=function(t){var e=t.prefixed,n=t.alpha,r=sx(t,["prefixed","alpha"]),o=(0,i.useCallback)(function(t){return t.replace(/([^0-9A-F]+)/gi,"").substring(0,n?8:6)},[n]),s=(0,i.useCallback)(function(t){return function(t,e){var n=Dx.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(Ix,ox({},r,{escape:o,format:e?Rx:void 0,process:Rx,validate:s}))};Tx={alpha:"\u0623\u0644\u0641\u0627",black:"\u0623\u0633\u0648\u062f",blue:"\u0623\u0632\u0631\u0642","blue purple":"\u0623\u0631\u062c\u0648\u0627\u0646\u064a \u0645\u0632\u0631\u0642",brightness:"\u0627\u0644\u0633\u0637\u0648\u0639",brown:"\u0628\u0646\u064a","brown yellow":"\u0623\u0635\u0641\u0631 \u0628\u0646\u064a",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"\u0633\u0645\u0627\u0648\u064a","cyan blue":"\u0623\u0632\u0631\u0642 \u0633\u0645\u0627\u0648\u064a",dark:"\u062f\u0627\u0643\u0646",gray:"\u0631\u0645\u0627\u062f\u064a",grayish:"\u0645\u0627\u0626\u0644 \u0644\u0644\u0631\u0645\u0627\u062f\u064a",green:"\u0623\u062e\u0636\u0631","green cyan":"\u0633\u0645\u0627\u0648\u064a \u0645\u062e\u0636\u0631",hue:"\u062f\u0631\u062c\u0629 \u0627\u0644\u0644\u0648\u0646",light:"\u0641\u0627\u062a\u062d",lightness:"\u0627\u0644\u0625\u0636\u0627\u0621\u0629",magenta:"\u0623\u0631\u062c\u0648\u0627\u0646\u064a","magenta pink":"\u0623\u0631\u062c\u0648\u0627\u0646\u064a \u0648\u0631\u062f\u064a",orange:"\u0628\u0631\u062a\u0642\u0627\u0644\u064a","orange yellow":"\u0623\u0635\u0641\u0631 \u0628\u0631\u062a\u0642\u0627\u0644\u064a",pale:"\u0628\u0627\u0647\u062a",pink:"\u0648\u0631\u062f\u064a","pink red":"\u0623\u062d\u0645\u0631 \u0648\u0631\u062f\u064a",purple:"\u0623\u0631\u062c\u0648\u0627\u0646\u064a","purple magenta":"\u0628\u0646\u0641\u0633\u062c\u064a",red:"\u0623\u062d\u0645\u0631","red orange":"\u0628\u0631\u062a\u0642\u0627\u0644\u064a \u0645\u062d\u0645\u0631",saturation:"\u0627\u0644\u062a\u0634\u0628\u0639",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} \u0634\u0641\u0627\u0641`,"very dark":"\u062f\u0627\u0643\u0646 \u062c\u062f\u064b\u0627","very light":"\u0641\u0627\u062a\u062d \u062c\u062f\u064b\u0627",vibrant:"\u0633\u0627\u0637\u0639",white:"\u0623\u0628\u064a\u0636",yellow:"\u0623\u0635\u0641\u0631","yellow green":"\u0623\u062e\u0636\u0631 \u0645\u0635\u0641\u0631"};var Lx;Lx={alpha:"\u0410\u043b\u0444\u0430",black:"\u0447\u0435\u0440\u043d\u043e",blue:"\u0421\u0438\u043d\u044c\u043e","blue purple":"\u0441\u0438\u043d\u044c\u043e \u043b\u0438\u043b\u0430\u0432\u043e",brightness:"\u042f\u0440\u043a\u043e\u0441\u0442",brown:"\u043a\u0430\u0444\u044f\u0432\u043e","brown yellow":"\u043a\u0430\u0444\u044f\u0432\u043e \u0436\u044a\u043b\u0442\u043e",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"\u0446\u0438\u0430\u043d","cyan blue":"\u0446\u0438\u0430\u043d \u0441\u0438\u043d\u044c\u043e",dark:"\u0442\u044a\u043c\u043d\u043e",gray:"\u0441\u0438\u0432\u043e",grayish:"\u0441\u0438\u0432\u043a\u0430\u0432",green:"\u0417\u0435\u043b\u0435\u043d\u043e","green cyan":"\u0437\u0435\u043b\u0435\u043d \u0446\u0438\u0430\u043d",hue:"\u041e\u0442\u0442\u0435\u043d\u044a\u043a",light:"\u0441\u0432\u0435\u0442\u043b\u043e",lightness:"\u041b\u0435\u043a\u043e\u0442\u0430",magenta:"\u043c\u0430\u0433\u0435\u043d\u0442\u0430","magenta pink":"\u043c\u0430\u0433\u0435\u043d\u0442\u0430 \u0440\u043e\u0437\u043e\u0432\u043e",orange:"\u043e\u0440\u0430\u043d\u0436\u0435\u0432\u043e","orange yellow":"\u043e\u0440\u0430\u043d\u0436\u0435\u0432\u043e \u0436\u044a\u043b\u0442\u043e",pale:"\u0431\u043b\u0435\u0434\u043e",pink:"\u0440\u043e\u0437\u043e\u0432\u043e","pink red":"\u0440\u043e\u0437\u043e\u0432\u043e \u0447\u0435\u0440\u0432\u0435\u043d\u043e",purple:"\u043b\u0438\u043b\u0430\u0432\u043e","purple magenta":"\u043b\u0438\u043b\u0430\u0432\u043e \u043c\u0430\u0433\u0435\u043d\u0442\u0430",red:"\u0427\u0435\u0440\u0432\u0435\u043d\u043e","red orange":"\u0447\u0435\u0440\u0432\u0435\u043d \u043f\u043e\u0440\u0442\u043e\u043a\u0430\u043b",saturation:"\u041d\u0430\u0441\u0438\u0442\u0435\u043d\u043e\u0441\u0442",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u0435\u043d`,"very dark":"\u043c\u043d\u043e\u0433\u043e \u0442\u044a\u043c\u043d\u043e","very light":"\u043c\u043d\u043e\u0433\u043e \u0441\u0432\u0435\u0442\u043b\u043e",vibrant:" \u044f\u0440\u043a\u043e",white:"\u0431\u044f\u043b\u043e",yellow:"\u0436\u044a\u043b\u0442\u043e","yellow green":"\u0436\u044a\u043b\u0442\u043e \u0437\u0435\u043b\u0435\u043d"};var Fx;Fx={alpha:"Alfa",black:"\u010dern\xe1",blue:"Modr\xe1","blue purple":"modrofialov\xe1",brightness:"Jas",brown:"hn\u011bd\xe1","brown yellow":"hn\u011bdo\u017elut\xe1",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"tyrkysov\xe1","cyan blue":"tyrkysovomodr\xe1",dark:"tmav\xe1",gray:"\u0161ed\xe1",grayish:"na\u0161edl\xe1",green:"Zelen\xe1","green cyan":"zelenotyrkysov\xe1",hue:"Odst\xedn",light:"sv\u011btl\xe1",lightness:"Sv\u011btlost",magenta:"purpurov\xe1","magenta pink":"purpurov\u011b r\u016f\u017eov\xe1",orange:"oran\u017eov\xe1","orange yellow":"oran\u017eovo\u017elut\xe1",pale:"bled\xe1",pink:"r\u016f\u017eov\xe1","pink red":"r\u016f\u017eovo\u010derven\xe1",purple:"fialov\xe1","purple magenta":"fialov\u011b purpurov\xe1",red:"\u010cerven\xe1","red orange":"\u010dervenooran\u017eov\xe1",saturation:"Sytost",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} pr\u016fhledn\xe9`,"very dark":"velmi tmav\xe1","very light":"velmi sv\u011btl\xe1",vibrant:"z\xe1\u0159iv\xe1",white:"b\xedl\xe1",yellow:"\u017elut\xe1","yellow green":"\u017elutozelen\xe1"};var Nx;Nx={alpha:"Alfa",black:"sort",blue:"Bl\xe5","blue purple":"bl\xe5lilla",brightness:"Lysstyrke",brown:"brun","brown yellow":"brungul",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"cyan","cyan blue":"cyan bl\xe5",dark:"m\xf8rk",gray:"gr\xe5",grayish:"gr\xe5lig",green:"Gr\xf8n","green cyan":"gr\xf8n cyan",hue:"Tone",light:"lys",lightness:"Lyshed",magenta:"magenta","magenta pink":"magenta pink",orange:"orange","orange yellow":"orangegul",pale:"bleg",pink:"lyser\xf8d","pink red":"lyser\xf8dlig r\xf8d",purple:"lilla","purple magenta":"lilla magenta",red:"R\xf8d","red orange":"r\xf8dorange",saturation:"Farvem\xe6tning",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} gennemsigtig`,"very dark":"meget m\xf8rk","very light":"meget lys",vibrant:"klar",white:"hvid",yellow:"gul","yellow green":"gulgr\xf8n"};var Bx;Bx={alpha:"Alpha",black:"Schwarz",blue:"Blau","blue purple":"Blaulila",brightness:"Helligkeit",brown:"Braun","brown yellow":"Braungelb",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"Cyan","cyan blue":"Cyanblau",dark:"dunkles",gray:"Grau",grayish:"gr\xe4uliches",green:"Gr\xfcn","green cyan":"Gr\xfcncyan",hue:"Farbton",light:"helles",lightness:"Leuchtkraft",magenta:"Magenta","magenta pink":"Magentarosa",orange:"Orange","orange yellow":"Orangegelb",pale:"blasses",pink:"Rosa","pink red":"Rosarot",purple:"Lila","purple magenta":"Lilamagenta",red:"Rot","red orange":"Rotorange",saturation:"S\xe4ttigung",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, zu ${t.percentTransparent} transparent`,"very dark":"sehr dunkles","very light":"sehr helles",vibrant:"lebhaftes",white:"Wei\xdf",yellow:"Gelb","yellow green":"Gelbgr\xfcn"};var Vx;Vx={alpha:"\u0386\u03bb\u03c6\u03b1",black:"\u03bc\u03b1\u03cd\u03c1\u03bf",blue:"\u039c\u03c0\u03bb\u03b5","blue purple":"\u03bc\u03c0\u03bb\u03b5 \u03bc\u03c9\u03b2",brightness:"\u03a6\u03c9\u03c4\u03b5\u03b9\u03bd\u03cc\u03c4\u03b7\u03c4\u03b1",brown:"\u03ba\u03b1\u03c6\u03ad","brown yellow":"\u03ba\u03b1\u03c6\u03ad \u03ba\u03af\u03c4\u03c1\u03b9\u03bd\u03bf",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"\u03ba\u03c5\u03b1\u03bd\u03cc","cyan blue":"\u03ba\u03c5\u03b1\u03bd\u03cc \u03bc\u03c0\u03bb\u03b5",dark:"\u03c3\u03ba\u03bf\u03cd\u03c1\u03bf",gray:"\u03b3\u03ba\u03c1\u03b9",grayish:"\u03b3\u03ba\u03c1\u03b9\u03b6\u03c9\u03c0\u03cc",green:"\u03a0\u03c1\u03ac\u03c3\u03b9\u03bd\u03bf","green cyan":"\u03c0\u03c1\u03ac\u03c3\u03b9\u03bd\u03bf \u03ba\u03c5\u03b1\u03bd\u03cc",hue:"\u03a4\u03cc\u03bd\u03bf\u03c2",light:"\u03b1\u03bd\u03bf\u03b9\u03c7\u03c4\u03cc",lightness:"\u03a6\u03c9\u03c4\u03b5\u03b9\u03bd\u03cc\u03c4\u03b7\u03c4\u03b1",magenta:"\u03bc\u03b1\u03c4\u03b6\u03ad\u03bd\u03c4\u03b1","magenta pink":"\u03bc\u03b1\u03c4\u03b6\u03ad\u03bd\u03c4\u03b1 \u03c1\u03bf\u03b6",orange:"\u03c0\u03bf\u03c1\u03c4\u03bf\u03ba\u03b1\u03bb\u03af","orange yellow":"\u03c0\u03bf\u03c1\u03c4\u03bf\u03ba\u03b1\u03bb\u03af \u03ba\u03af\u03c4\u03c1\u03b9\u03bd\u03bf",pale:"\u03b1\u03bd\u03bf\u03b9\u03c7\u03c4\u03cc",pink:"\u03c1\u03bf\u03b6","pink red":"\u03c1\u03bf\u03b6 \u03ba\u03cc\u03ba\u03ba\u03b9\u03bd\u03bf",purple:"\u03bc\u03c9\u03b2","purple magenta":"\u03bc\u03c9\u03b2 \u03bc\u03b1\u03c4\u03b6\u03ad\u03bd\u03c4\u03b1",red:"\u039a\u03cc\u03ba\u03ba\u03b9\u03bd\u03bf","red orange":"\u03ba\u03cc\u03ba\u03ba\u03b9\u03bd\u03bf \u03c0\u03bf\u03c1\u03c4\u03bf\u03ba\u03b1\u03bb\u03af",saturation:"\u039a\u03bf\u03c1\u03b5\u03c3\u03bc\u03cc\u03c2",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} \u03b4\u03b9\u03b1\u03c6\u03b1\u03bd\u03ad\u03c2`,"very dark":"\u03c0\u03bf\u03bb\u03cd \u03c3\u03ba\u03bf\u03cd\u03c1\u03bf","very light":"\u03c0\u03bf\u03bb\u03cd \u03b1\u03bd\u03bf\u03b9\u03c7\u03c4\u03cc",vibrant:"\u03ad\u03bd\u03c4\u03bf\u03bd\u03bf",white:"\u03bb\u03b5\u03c5\u03ba\u03cc",yellow:"\u03ba\u03af\u03c4\u03c1\u03b9\u03bd\u03bf","yellow green":"\u03ba\u03af\u03c4\u03c1\u03b9\u03bd\u03bf \u03c0\u03c1\u03ac\u03c3\u03b9\u03bd\u03bf"};var $x;$x={hue:"Hue",saturation:"Saturation",lightness:"Lightness",brightness:"Brightness",red:"Red",green:"Green",blue:"Blue",alpha:"Alpha",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} transparent`,"very dark":"very dark",dark:"dark",light:"light","very light":"very light",pale:"pale",grayish:"grayish",vibrant:"vibrant",black:"black",white:"white",gray:"gray",pink:"pink","pink red":"pink red","red orange":"red orange",brown:"brown",orange:"orange","orange yellow":"orange yellow","brown yellow":"brown yellow",yellow:"yellow","yellow green":"yellow green","green cyan":"green cyan",cyan:"cyan","cyan blue":"cyan blue","blue purple":"blue purple",purple:"purple","purple magenta":"purple magenta",magenta:"magenta","magenta pink":"magenta pink"};var Hx;Hx={alpha:"Alpha",black:"negro",blue:"Azul","blue purple":"p\xfarpura azulado",brightness:"Brillo",brown:"marr\xf3n","brown yellow":"amarillo amarronado",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"cian","cyan blue":"azul cian",dark:"oscuro",gray:"gris",grayish:"gris\xe1ceo",green:"Verde","green cyan":"cian verdoso",hue:"Tono",light:"claro",lightness:"Luminosidad",magenta:"magenta","magenta pink":"rosa magenta",orange:"naranja","orange yellow":"amarillo anaranjado",pale:"p\xe1lido",pink:"rosa","pink red":"rojo rosado",purple:"morado","purple magenta":"magenta viol\xe1ceo",red:"Rojo","red orange":"naranja rojizo",saturation:"Saturaci\xf3n",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} transparente`,"very dark":"muy oscuro","very light":"muy claro",vibrant:"intenso",white:"blanco",yellow:"amarillo","yellow green":"verde amarillento"};var Wx;Wx={alpha:"Alfa",black:"must",blue:"Sinine","blue purple":"sinakaslilla",brightness:"Heledus",brown:"pruun","brown yellow":"pruunikaskollane",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"ts\xfcaan","cyan blue":"ts\xfcaansinine",dark:"tume",gray:"hall",grayish:"hallikas",green:"Roheline","green cyan":"ts\xfcaanroheline",hue:"V\xe4rv",light:"valgus",lightness:"Valgus",magenta:"magentapunane","magenta pink":"magentaroosa",orange:"oran\u017e","orange yellow":"oran\u017eikaskollane",pale:"kahvatu",pink:"roosa","pink red":"vaarikapunane",purple:"lilla","purple magenta":"purpurne magenta",red:"Punane","red orange":"punakasoran\u017e",saturation:"K\xfcllastus",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} l\xe4bipaistev`,"very dark":"v\xe4ga tume","very light":"v\xe4ga hele",vibrant:"ere",white:"valge",yellow:"kollane","yellow green":"kollakasroheline"};var Ux;Ux={alpha:"Alpha",black:"musta",blue:"Sininen","blue purple":"sinivioletti",brightness:"Kirkkaus",brown:"ruskea","brown yellow":"ruskeankeltainen",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"syaani","cyan blue":"syaaninsininen",dark:"tumma",gray:"harmaa",grayish:"harmahtava",green:"Vihre\xe4","green cyan":"vihre\xe4nsyaani",hue:"S\xe4vy",light:"vaalea",lightness:"Valom\xe4\xe4r\xe4",magenta:"magenta","magenta pink":"magentapinkki",orange:"oranssi","orange yellow":"oranssinkeltainen",pale:"vaalea",pink:"pinkki","pink red":"vaaleanpunainen",purple:"violetti","purple magenta":"violettimagenta",red:"Punainen","red orange":"punaoranssi",saturation:"V\xe4rikyll\xe4isyys",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} l\xe4pin\xe4kyv\xe4`,"very dark":"hyvin tumma","very light":"eritt\xe4in vaalea",vibrant:"eloisa",white:"valkea",yellow:"keltainen","yellow green":"keltavihre\xe4"};var Xx;Xx={alpha:"Alpha",black:"Noir",blue:"Bleu","blue purple":"Violet bleu",brightness:"Luminosit\xe9",brown:"Brun","brown yellow":"Jaune brun",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"Cyan","cyan blue":"Bleu cyan",dark:"Sombre",gray:"Gris",grayish:"Gris\xe2tre",green:"Vert","green cyan":"Cyan vert",hue:"Teinte",light:"Clair",lightness:"Luminosit\xe9",magenta:"Magenta","magenta pink":"Rose magenta",orange:"Orange","orange yellow":"Jaune orang\xe9",pale:"P\xe2le",pink:"Rose","pink red":"Rouge ros\xe9",purple:"Violet","purple magenta":"Magenta violet",red:"Rouge","red orange":"Orange rouge",saturation:"Saturation",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} transparent`,"very dark":"Tr\xe8s sombre","very light":"Tr\xe8s clair",vibrant:"Vif",white:"Blanc",yellow:"Jaune","yellow green":"Vert jaune"};var Yx;Yx={alpha:"\u05d0\u05dc\u05e4\u05d0",black:"\u05e9\u05d7\u05d5\u05e8",blue:"\u05db\u05d7\u05d5\u05dc","blue purple":"\u05db\u05d7\u05d5\u05dc \u05e1\u05d2\u05d5\u05dc",brightness:"\u05d1\u05d4\u05d9\u05e8\u05d5\u05ea",brown:"\u05d7\u05d5\u05dd","brown yellow":"\u05d7\u05d5\u05dd \u05e6\u05d4\u05d5\u05d1",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"\u05d8\u05d5\u05e8\u05e7\u05d9\u05d6","cyan blue":"\u05db\u05d7\u05d5\u05dc \u05e6\u05d9\u05d0\u05df",dark:"\u05db\u05d4\u05d4",gray:"\u05d0\u05e4\u05d5\u05e8",grayish:"\u05d0\u05e4\u05e8\u05e4\u05e8",green:"\u05d9\u05e8\u05d5\u05e7","green cyan":"\u05e6\u05d9\u05d0\u05df \u05d9\u05e8\u05d5\u05e7",hue:"\u05d2\u05d5\u05d5\u05df",light:"\u05d0\u05d5\u05e8",lightness:"\u05db\u05de\u05d5\u05ea \u05d0\u05d5\u05e8",magenta:"\u05de\u05d2'\u05e0\u05d8\u05d4","magenta pink":"\u05d5\u05e8\u05d5\u05d3 \u05de\u05d2'\u05e0\u05d8\u05d4",orange:"\u05db\u05ea\u05d5\u05dd","orange yellow":"\u05db\u05ea\u05d5\u05dd \u05e6\u05d4\u05d5\u05d1",pale:"\u05d7\u05d9\u05d5\u05d5\u05e8",pink:"\u05d5\u05e8\u05d5\u05d3","pink red":"\u05d5\u05e8\u05d5\u05d3 \u05d0\u05d3\u05d5\u05dd",purple:"\u05e1\u05d2\u05d5\u05dc","purple magenta":"\u05de\u05d2'\u05e0\u05d8\u05d4 \u05e1\u05d2\u05d5\u05dc",red:"\u05d0\u05d3\u05d5\u05dd","red orange":"\u05db\u05ea\u05d5\u05dd \u05d0\u05d3\u05d5\u05dd",saturation:"\u05e8\u05d5\u05d5\u05d9\u05d4",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} \u05e9\u05e7\u05d5\u05e3`,"very dark":"\u05db\u05d4\u05d4 \u05de\u05d0\u05d5\u05d3","very light":"\u05d1\u05d4\u05d9\u05e8 \u05de\u05d0\u05d5\u05d3",vibrant:"\u05ea\u05d5\u05e1\u05e1",white:"\u05dc\u05d1\u05df",yellow:"\u05e6\u05d4\u05d5\u05d1","yellow green":"\u05e6\u05d4\u05d5\u05d1 \u05d9\u05e8\u05d5\u05e7"};var Gx;Gx={alpha:"Alfa",black:"crno",blue:"Plava","blue purple":"plavo ljubi\u010dasta",brightness:"Svjetlina",brown:"sme\u0111a","brown yellow":"sme\u0111e \u017euta",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"cijan","cyan blue":"cijan plava",dark:"tamno",gray:"siva",grayish:"sivkasto",green:"Zelena","green cyan":"zelena cijan",hue:"Nijansa",light:"svjetlo",lightness:"Osvijetljenost",magenta:"magenta","magenta pink":"magentno ru\u017ei\u010dasta",orange:"naran\u010dasta","orange yellow":"naran\u010dasto \u017euta",pale:"blijeda",pink:"ru\u017ei\u010dasta","pink red":"ru\u017ei\u010dasto crvena",purple:"ljubi\u010dasta","purple magenta":"ljubi\u010dasta magenta",red:"Crvena","red orange":"crveno naran\u010dasta",saturation:"Zasi\u0107enost",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} prozirnosti`,"very dark":"jako tamna","very light":"vrlo svijetlo",vibrant:"vibrantna",white:"bijela",yellow:"\u017euto","yellow green":"\u017euto zelena"};var qx;qx={alpha:"Alfa",black:"fekete",blue:"K\xe9k","blue purple":"k\xe9k lila",brightness:"F\xe9nyess\xe9g",brown:"barna","brown yellow":"barna s\xe1rga",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"ci\xe1nk\xe9k","cyan blue":"ci\xe1nk\xe9k",dark:"s\xf6t\xe9t",gray:"sz\xfcrke",grayish:"sz\xfcrk\xe9s",green:"Z\xf6ld","green cyan":"z\xf6ld ci\xe1nk\xe9k",hue:"Sz\xedn\xe1rnyalat",light:"vil\xe1gos",lightness:"Vil\xe1goss\xe1g",magenta:"b\xedbor","magenta pink":"b\xedbor r\xf3zsasz\xedn",orange:"narancs","orange yellow":"narancss\xe1rga",pale:"halv\xe1ny",pink:"r\xf3zsasz\xedn","pink red":"r\xf3zsasz\xedn piros",purple:"lila","purple magenta":"lila b\xedbor",red:"Piros","red orange":"piros narancs",saturation:"Tel\xedtetts\xe9g",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} \xe1tl\xe1tsz\xf3`,"very dark":"nagyon s\xf6t\xe9t","very light":"nagyon vil\xe1gos",vibrant:"\xe9l\xe9nk",white:"feh\xe9r",yellow:"s\xe1rga","yellow green":"s\xe1rga z\xf6ld"};var Kx;Kx={alpha:"Alfa",black:"nero",blue:"Blu","blue purple":"blu viola",brightness:"Luminosit\xe0",brown:"marrone","brown yellow":"giallo bruno",colorName:t=>`${t.hue} ${t.chroma} ${t.lightness}`,cyan:"ciano","cyan blue":"blu ciano",dark:"scuro",gray:"grigio",grayish:"grigiastro",green:"Verde","green cyan":"verde ciano",hue:"Tonalit\xe0",light:"chiaro",lightness:"Luminosit\xe0",magenta:"magenta","magenta pink":"rosa magenta",orange:"arancio","orange yellow":"giallo arancio",pale:"tenue",pink:"rosa","pink red":"rosa rosso",purple:"viola","purple magenta":"viola magenta",red:"Rosso","red orange":"rosso arancio",saturation:"Saturazione",transparentColorName:t=>`${t.hue} ${t.chroma} ${t.lightness}, trasparenza ${t.percentTransparent}`,"very dark":"molto scuro","very light":"molto chiaro",vibrant:"vivace",white:"bianco",yellow:"giallo","yellow green":"giallo verde"};var Zx;Zx={alpha:"\u30a2\u30eb\u30d5\u30a1",black:"\u30d6\u30e9\u30c3\u30af",blue:"\u9752","blue purple":"\u30d6\u30eb\u30fc\u30d1\u30fc\u30d7\u30eb",brightness:"\u660e\u308b\u3055",brown:"\u30d6\u30e9\u30a6\u30f3","brown yellow":"\u30d6\u30e9\u30a6\u30f3\u30a4\u30a8\u30ed\u30fc",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"\u30b7\u30a2\u30f3","cyan blue":"\u30b7\u30a2\u30f3\u30d6\u30eb\u30fc",dark:"\u30c0\u30fc\u30af",gray:"\u30b0\u30ec\u30fc",grayish:"\u30b0\u30ec\u30a4\u30c3\u30b7\u30e5",green:"\u7dd1","green cyan":"\u30b0\u30ea\u30fc\u30f3\u30b7\u30a2\u30f3",hue:"\u8272\u76f8",light:"\u30e9\u30a4\u30c8",lightness:"\u660e\u5ea6",magenta:"\u30de\u30bc\u30f3\u30bf","magenta pink":"\u30de\u30bc\u30f3\u30bf\u30d4\u30f3\u30af",orange:"\u30aa\u30ec\u30f3\u30b8","orange yellow":"\u30aa\u30ec\u30f3\u30b8\u30a4\u30a8\u30ed\u30fc",pale:"\u30da\u30fc\u30eb",pink:"\u30d4\u30f3\u30af","pink red":"\u30d4\u30f3\u30af\u30ec\u30c3\u30c9",purple:"\u30d1\u30fc\u30d7\u30eb","purple magenta":"\u30d1\u30fc\u30d7\u30eb\u30de\u30bc\u30f3\u30bf",red:"\u8d64","red orange":"\u30ec\u30c3\u30c9\u30aa\u30ec\u30f3\u30b8",saturation:"\u5f69\u5ea6",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} \u900f\u660e`,"very dark":"\u6700\u3082\u6697\u3044","very light":"\u30d9\u30ea\u30fc\u30e9\u30a4\u30c8",vibrant:"\u9bae\u3084\u304b",white:"\u30db\u30ef\u30a4\u30c8",yellow:"\u30a4\u30a8\u30ed\u30fc","yellow green":"\u30a4\u30a8\u30ed\u30fc\u30b0\u30ea\u30fc\u30f3"};var Jx;Jx={alpha:"\uc54c\ud30c",black:"\uac80\uc740\uc0c9",blue:"\ud30c\ub791","blue purple":"\uccad\uc790\uc0c9",brightness:"\uba85\ub3c4",brown:"\uac08\uc0c9","brown yellow":"\ud669\uac08\uc0c9",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"\uccad\ub85d\uc0c9","cyan blue":"\uccad\ub85d\uc0c9",dark:"\ub2e4\ud06c",gray:"\ud68c\uc0c9",grayish:"\ud68c\uac08\uc0c9",green:"\ucd08\ub85d","green cyan":"\uccad\ub85d\uc0c9",hue:"\uc0c9\uc870",light:"\ub77c\uc774\ud2b8",lightness:"\ubc1d\uae30",magenta:"\uc790\ud64d\uc0c9","magenta pink":"\ub9c8\uc820\ud0c0 \ud551\ud06c",orange:"\uc8fc\ud669\uc0c9","orange yellow":"\ubd88\uadf8\uc2a4\ub984\ud55c \ub178\ub791",pale:"\ud759\uc0c9",pink:"\ubd84\ud64d\uc0c9","pink red":"\ud551\ud06c \ub808\ub4dc",purple:"\uc790\uc8fc\uc0c9","purple magenta":"\ubcf4\ub77c\ube5b \uc790\ud64d\uc0c9",red:"\ube68\uac15","red orange":"\ubd89\uc740 \uc8fc\ud669\uc0c9",saturation:"\ucc44\ub3c4",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} \ud22c\uba85\ub3c4`,"very dark":"\ub9e4\uc6b0 \uc5b4\ub450\uc6b4","very light":"\ub9e4\uc6b0 \uc5f0\ud568",vibrant:"\uac15\ub82c\ud55c",white:"\ud770\uc0c9",yellow:"\ub178\ub780\uc0c9","yellow green":"\uc5f0\ub450\uc0c9"};var Qx;Qx={alpha:"Alfa",black:"juoda",blue:"M\u0117lyna","blue purple":"melsvai violetin\u0117",brightness:"Ry\u0161kumas",brown:"ruda","brown yellow":"rusvai geltona",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"\u017ealsvai m\u0117lyna","cyan blue":"\u017ealsvai m\u0117lyna",dark:"tamsi",gray:"pilka",grayish:"pilk\u0161va",green:"\u017dalia","green cyan":"\u017ealsvai m\u0117lyna",hue:"Atspalvis",light:"\u0161viesi",lightness:"\u0160viesumas",magenta:"rausvai raudona","magenta pink":"purpurin\u0117",orange:"oran\u017ein\u0117","orange yellow":"oran\u017einio atspalvio geltona",pale:"bly\u0161ki",pink:"ro\u017ein\u0117","pink red":"ro\u017ein\u0117 raudona",purple:"violetin\u0117","purple magenta":"purpurin\u0117 rausvai raudona",red:"Raudona","red orange":"rausvai oran\u017ein\u0117",saturation:"\u012esotinimas",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} skaidri`,"very dark":"labai tamsi","very light":"labai \u0161viesi",vibrant:"ry\u0161ki",white:"balta",yellow:"geltona","yellow green":"gelsvai \u017ealia"};var tw;tw={alpha:"Alfa",black:"melns",blue:"Zila","blue purple":"zili violets",brightness:"Spilgtums",brown:"br\u016bns","brown yellow":"br\u016bni dzeltens",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"ci\u0101ns","cyan blue":"ci\u0101na zils",dark:"tum\u0161s",gray:"pel\u0113ks",grayish:"pel\u0113c\u012bgs",green:"Za\u013ca","green cyan":"za\u013c\u0161 ci\u0101ns",hue:"Nokr\u0101sa",light:"gai\u0161s",lightness:"Gai\u0161ums",magenta:"fuksiju","magenta pink":"fuksiju roz\u0101",orange:"oran\u017es","orange yellow":"oran\u017ei dzeltens",pale:"b\u0101ls",pink:"roz\u0101","pink red":"roz\u012bgi sarkans",purple:"violets","purple magenta":"violets fuksiju",red:"Sarkana","red orange":"sarkan\u012bgi oran\u017es",saturation:"Pies\u0101tin\u0101jums",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} caursp\u012bd\u012bgs`,"very dark":"\u013coti tum\u0161s","very light":"\u013coti gai\u0161s",vibrant:"ko\u0161s",white:"balts",yellow:"dzeltens","yellow green":"dzelteni za\u013c\u0161"};var ew;ew={alpha:"Alfa",black:"svart",blue:"Bl\xe5","blue purple":"bl\xe5lilla",brightness:"Lysstyrke",brown:"brun","brown yellow":"brungul",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"cyan","cyan blue":"cyanbl\xe5",dark:"m\xf8rk",gray:"gr\xe5",grayish:"gr\xe5aktig",green:"Gr\xf8nn","green cyan":"gr\xf8nncyan",hue:"Fargetone",light:"lys",lightness:"Lyshet",magenta:"magenta","magenta pink":"magentarosa",orange:"oransje","orange yellow":"oransjegul",pale:"blek",pink:"rosa","pink red":"rosar\xf8d",purple:"lilla","purple magenta":"lillamagenta",red:"R\xf8d","red orange":"r\xf8doransje",saturation:"Metning",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} gjennomsiktig`,"very dark":"sv\xe6rt m\xf8rk","very light":"sv\xe6rt lys",vibrant:"levende",white:"hvit",yellow:"gul","yellow green":"gulgr\xf8nn"};var nw;nw={alpha:"Alfa",black:"zwart",blue:"Blauw","blue purple":"paarsblauw",brightness:"Helderheid",brown:"bruin","brown yellow":"bruingeel",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"cyaan","cyan blue":"cyaanblauw",dark:"donker",gray:"grijs",grayish:"grijsachtig",green:"Groen","green cyan":"cyaangroen",hue:"Kleurtoon",light:"licht",lightness:"Lichtsterkte",magenta:"magenta","magenta pink":"magentaroze",orange:"oranje","orange yellow":"oranjegeel",pale:"bleek",pink:"roze","pink red":"rozerood",purple:"paars","purple magenta":"magentapaars",red:"Rood","red orange":"roodoranje",saturation:"Verzadiging",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} transparant`,"very dark":"heel donker","very light":"heel licht",vibrant:"levendig",white:"wit",yellow:"geel","yellow green":"geelgroen"};var rw;rw={alpha:"Alfa",black:"czarny",blue:"Niebieski","blue purple":"niebiesko-fioletowy",brightness:"Jasno\u015b\u0107",brown:"br\u0105zowy","brown yellow":"br\u0105zowo-\u017c\xf3\u0142ty",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"cyjanowy","cyan blue":"cyjanowo-niebieski",dark:"ciemny",gray:"szary",grayish:"szarawy",green:"Zielony","green cyan":"zielono-cyjanowy",hue:"Odcie\u0144",light:"jasny",lightness:"Jaskrawo\u015b\u0107",magenta:"purpurowy","magenta pink":"purpurowo-r\xf3\u017cowy",orange:"pomara\u0144czowy","orange yellow":"pomara\u0144czowo-\u017c\xf3\u0142ty",pale:"blady",pink:"r\xf3\u017cowy","pink red":"r\xf3\u017cowo-czerwony",purple:"fioletowy","purple magenta":"fioletowo-purpurowy",red:"Czerwony","red orange":"czerwono-pomara\u0144czowy",saturation:"Nasycenie",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} przezroczysto\u015bci`,"very dark":"bardzo ciemny","very light":"bardzo jasny",vibrant:"intensywny",white:"bia\u0142y",yellow:"\u017c\xf3\u0142ty","yellow green":"\u017c\xf3\u0142to-zielony"};var iw;iw={alpha:"Alfa",black:"preto",blue:"Azul","blue purple":"roxo azulado",brightness:"Brilho",brown:"marrom","brown yellow":"marrom amarelado",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"ciano","cyan blue":"azul-ciano",dark:"escuro",gray:"cinza",grayish:"acinzentado",green:"Verde","green cyan":"verde-ciano",hue:"Matiz",light:"claro",lightness:"Luminosidade",magenta:"magenta","magenta pink":"rosa-magenta",orange:"laranja","orange yellow":"amarelo alaranjado",pale:"p\xe1lido",pink:"rosa","pink red":"rosa avermelhado",purple:"roxo","purple magenta":"roxo-magenta",red:"Vermelho","red orange":"laranja avermelhado",saturation:"Satura\xe7\xe3o",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} transparente`,"very dark":"muito escuro","very light":"muito claro",vibrant:"vibrante",white:"branco",yellow:"amarelo","yellow green":"verde amarelado"};var ow;ow={alpha:"Alfa",black:"preto",blue:"Azul","blue purple":"azul-p\xfarpura",brightness:"Luminosidade",brown:"castanho","brown yellow":"amarelo-castanho",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"ciano","cyan blue":"azul-ciano",dark:"escuro",gray:"cinzento",grayish:"acinzentado",green:"Verde","green cyan":"verde-ciano",hue:"Tonalidade",light:"claro",lightness:"Claridade",magenta:"magenta","magenta pink":"rosa-magenta",orange:"laranja","orange yellow":"amarelo-laranja",pale:"p\xe1lido",pink:"cor-de-rosa","pink red":"vermelho-rosa",purple:"p\xfarpura","purple magenta":"p\xfarpura-magenta",red:"Vermelho","red orange":"laranja-vermelho",saturation:"Satura\xe7\xe3o",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} transparente`,"very dark":"muito escuro","very light":"muito claro",vibrant:"vibrante",white:"branco",yellow:"amarelo","yellow green":"verde-amarelo"};var sw;sw={alpha:"Alfa",black:"negru",blue:"Albastru","blue purple":"albastru-violet",brightness:"Luminozitate",brown:"maro","brown yellow":"galben maro",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"bleu","cyan blue":"albastru-bleu",dark:"\xeenchis",gray:"gri",grayish:"cenu\u0219iu",green:"Verde","green cyan":"verde bleu",hue:"Nuan\u021b\u0103",light:"deschis",lightness:"Luminozitate",magenta:"fucsia","magenta pink":"roz-fucsia",orange:"portocaliu","orange yellow":"galben-portocaliu",pale:"pal",pink:"roz","pink red":"roz-ro\u0219u",purple:"violet","purple magenta":"violet-fucsia",red:"Ro\u0219u","red orange":"portocaliu-ro\u0219u",saturation:"Satura\u021bie",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} transparent`,"very dark":"foarte \xeenchis","very light":"foarte deschis",vibrant:"plin de via\u021b\u0103",white:"alb",yellow:"galben","yellow green":"galben-verde"};var aw;aw={alpha:"\u0410\u043b\u044c\u0444\u0430",black:"\u0447\u0435\u0440\u043d\u044b\u0439",blue:"\u0421\u0438\u043d\u0438\u0439","blue purple":"\u0441\u0438\u043d\u0435-\u0444\u0438\u043e\u043b\u0435\u0442\u043e\u0432\u044b\u0439",brightness:"\u042f\u0440\u043a\u043e\u0441\u0442\u044c",brown:"\u043a\u043e\u0440\u0438\u0447\u043d\u0435\u0432\u044b\u0439","brown yellow":"\u043a\u043e\u0440\u0438\u0447\u043d\u0435\u0432\u043e-\u0436\u0435\u043b\u0442\u044b\u0439",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"\u0433\u043e\u043b\u0443\u0431\u043e\u0439","cyan blue":"\u0446\u0432\u0435\u0442 \u043c\u043e\u0440\u0441\u043a\u043e\u0439 \u0432\u043e\u043b\u043d\u044b",dark:"\u0442\u0435\u043c\u043d\u044b\u0439",gray:"\u0441\u0435\u0440\u044b\u0439",grayish:"\u0441\u0435\u0440\u043e\u0432\u0430\u0442\u044b\u0439",green:"\u0417\u0435\u043b\u0435\u043d\u044b\u0439","green cyan":"\u0441\u0438\u043d\u0435-\u0437\u0435\u043b\u0435\u043d\u044b\u0439",hue:"\u041e\u0442\u0442\u0435\u043d\u043e\u043a",light:"\u0441\u0432\u0435\u0442\u043b\u044b\u0439",lightness:"\u041e\u0441\u0432\u0435\u0449\u0435\u043d\u043d\u043e\u0441\u0442\u044c",magenta:"\u043f\u0443\u0440\u043f\u0443\u0440\u043d\u044b\u0439","magenta pink":"\u043f\u0443\u0440\u043f\u0443\u0440\u043d\u043e-\u0440\u043e\u0437\u043e\u0432\u044b\u0439",orange:"\u043e\u0440\u0430\u043d\u0436\u0435\u0432\u044b\u0439","orange yellow":"\u043e\u0440\u0430\u043d\u0436\u0435\u0432\u043e-\u0436\u0435\u043b\u0442\u044b\u0439",pale:"\u0431\u043b\u0435\u0434\u043d\u044b\u0439",pink:"\u0440\u043e\u0437\u043e\u0432\u044b\u0439","pink red":"\u0440\u043e\u0437\u043e\u0432\u043e-\u043a\u0440\u0430\u0441\u043d\u044b\u0439",purple:"\u0444\u0438\u043e\u043b\u0435\u0442\u043e\u0432\u044b\u0439","purple magenta":"\u0444\u0438\u043e\u043b\u0435\u0442\u043e\u0432\u043e-\u043f\u0443\u0440\u043f\u0443\u0440\u043d\u044b\u0439",red:"\u041a\u0440\u0430\u0441\u043d\u044b\u0439","red orange":"\u043a\u0440\u0430\u0441\u043d\u043e-\u043e\u0440\u0430\u043d\u0436\u0435\u0432\u044b\u0439",saturation:"\u041d\u0430\u0441\u044b\u0449\u0435\u043d\u043d\u043e\u0441\u0442\u044c",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u044b\u0439 \u043d\u0430 ${t.percentTransparent}`,"very dark":"\u043e\u0447\u0435\u043d\u044c \u0442\u0435\u043c\u043d\u044b\u0439","very light":"\u043e\u0447\u0435\u043d\u044c \u0441\u0432\u0435\u0442\u043b\u044b\u0439",vibrant:"\u044f\u0440\u043a\u0438\u0439",white:"\u0431\u0435\u043b\u044b\u0439",yellow:"\u0436\u0435\u043b\u0442\u044b\u0439","yellow green":"\u0436\u0435\u043b\u0442\u043e-\u0437\u0435\u043b\u0435\u043d\u044b\u0439"};var lw;lw={alpha:"Alfa",black:"\u010dierna",blue:"Modr\xe1","blue purple":"modrofialov\xe1",brightness:"Jas",brown:"hned\xe1","brown yellow":"hnedo\u017elt\xe1",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"az\xfarov\xe1","cyan blue":"az\xfarov\xe1 modr\xe1",dark:"tmav\xe1",gray:"siv\xe1",grayish:"sivast\xe1",green:"Zelen\xe1","green cyan":"zelen\xe1 az\xfarov\xe1",hue:"Odtie\u0148",light:"svetl\xe1",lightness:"Svetlos\u0165",magenta:"purpurov\xe1","magenta pink":"ru\u017eov\xe1 purpurov\xe1",orange:"oran\u017eov\xe1","orange yellow":"oran\u017eovo\u017elt\xe1",pale:"bled\xe1",pink:"ru\u017eov\xe1","pink red":"ru\u017eovo\u010derven\xe1",purple:"fialov\xe1","purple magenta":"fialov\xe1 purpurov\xe1",red:"\u010cerven\xe1","red orange":"\u010dervenooran\u017eov\xe1",saturation:"S\xfdtos\u0165",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} prieh\u013eadn\xe1`,"very dark":"ve\u013emi tmav\xe1","very light":"ve\u013emi svetl\xe1",vibrant:"energick\xe1",white:"biela",yellow:"\u017elt\xe1","yellow green":"\u017eltozelen\xe1"};var cw;cw={alpha:"Alfa",black:"\u010drna",blue:"Modra","blue purple":"modro vijoli\u010dna",brightness:"Svetlost",brown:"rjava","brown yellow":"rjavo rumena",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"cian","cyan blue":"cian modra",dark:"temna",gray:"siva",grayish:"sivkasta",green:"Zelena","green cyan":"zelena cian",hue:"Barva",light:"svetla",lightness:"Lahkost",magenta:"\u0161krlatna","magenta pink":"\u0161krlatno roza",orange:"oran\u017ena","orange yellow":"oran\u017eno rumena",pale:"bleda",pink:"roza","pink red":"roza rde\u010da",purple:"vijoli\u010dna","purple magenta":"vijoli\u010dno \u0161krlatna",red:"Rde\u010da","red orange":"rde\u010de oran\u017ena",saturation:"Nasi\u010denost",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} prozorna`,"very dark":"zelo temna","very light":"zelo svetla",vibrant:"\u017eivahna",white:"bela",yellow:"rumena","yellow green":"rumeno zelena"};var uw;uw={alpha:"Alfa",black:"crno",blue:"Plava","blue purple":"plavoljubi\u010dasta",brightness:"Osvetljenost",brown:"sme\u0111a","brown yellow":"sme\u0111e\u017euta",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"cijan","cyan blue":"cijan plava",dark:"tamno",gray:"siva",grayish:"sivkasta",green:"Zelena","green cyan":"zeleno cijan",hue:"Nijansa",light:"svetla",lightness:"Osvetljenje",magenta:"purpurnocrvena","magenta pink":"magenta ru\u017ei\u010dasta",orange:"narand\u017easta","orange yellow":"narand\u017easto\u017euta",pale:"bledo",pink:"ru\u017ei\u010dasta","pink red":"ru\u017ei\u010dastocrvena",purple:"ljubi\u010dasta","purple magenta":"ljubi\u010dasta magenta",red:"Crvena","red orange":"crvenonarand\u017easta",saturation:"Zasi\u0107enje",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} prozirna`,"very dark":"veoma tamno","very light":"vrlo svetlo",vibrant:"\u017eivopisna",white:"bela",yellow:"\u017euto","yellow green":"\u017eutozelena"};var hw;hw={alpha:"Alfa",black:"svart",blue:"Bl\xe5tt","blue purple":"bl\xe5lila",brightness:"Ljusstyrka",brown:"brun","brown yellow":"brungul",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"cyan","cyan blue":"cyanbl\xe5",dark:"m\xf6rk",gray:"gr\xe5",grayish:"gr\xe5aktig",green:"Gr\xf6nt","green cyan":"gr\xf6n cyan",hue:"Nyans",light:"ljus",lightness:"Ljushet",magenta:"magenta","magenta pink":"magentarosa",orange:"orange","orange yellow":"orangegul",pale:"blek",pink:"rosa","pink red":"rosar\xf6d",purple:"lila","purple magenta":"lila magenta",red:"R\xf6tt","red orange":"r\xf6dorange",saturation:"M\xe4ttnad",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} genomskinlig`,"very dark":"mycket m\xf6rk","very light":"mycket ljus",vibrant:"livfull",white:"vit",yellow:"gul","yellow green":"gulgr\xf6n"};var dw;dw={alpha:"Alfa",black:"siyah",blue:"Mavi","blue purple":"mavi mor",brightness:"Parlakl\u0131k",brown:"kahverengi","brown yellow":"kahverengi sar\u0131",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"camg\xf6be\u011fi","cyan blue":"camg\xf6be\u011fi mavi",dark:"koyu",gray:"gri",grayish:"grimsi",green:"Ye\u015fil","green cyan":"ye\u015fil camg\xf6be\u011fi",hue:"Ton",light:"a\xe7\u0131k",lightness:"Canl\u0131l\u0131k",magenta:"eflatun","magenta pink":"eflatun pembe",orange:"turuncu","orange yellow":"turuncu sar\u0131",pale:"solgun",pink:"pembe","pink red":"pembe k\u0131rm\u0131z\u0131",purple:"mor","purple magenta":"mor eflatun",red:"K\u0131rm\u0131z\u0131","red orange":"k\u0131rm\u0131z\u0131 portakal",saturation:"Doygunluk",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} saydam`,"very dark":"\xe7ok koyu","very light":"\xe7ok a\xe7\u0131k",vibrant:"canl\u0131",white:"beyaz",yellow:"sar\u0131","yellow green":"sar\u0131 ye\u015fil"};var pw;pw={alpha:"\u0410\u043b\u044c\u0444\u0430",black:"\u0447\u043e\u0440\u043d\u0438\u0439",blue:"\u0421\u0438\u043d\u0456\u0439","blue purple":"\u0441\u0438\u043d\u044c\u043e-\u0444\u0456\u043e\u043b\u0435\u0442\u043e\u0432\u0438\u0439",brightness:"\u042f\u0441\u043a\u0440\u0430\u0432\u0456\u0441\u0442\u044c",brown:"\u043a\u043e\u0440\u0438\u0447\u043d\u0435\u0432\u0438\u0439","brown yellow":"\u043a\u043e\u0440\u0438\u0447\u043d\u0435\u0432\u043e-\u0436\u043e\u0432\u0442\u0438\u0439",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"\u0431\u043b\u0430\u043a\u0438\u0442\u043d\u0438\u0439","cyan blue":"\u0441\u0438\u043d\u044c\u043e-\u0431\u043b\u0430\u043a\u0438\u0442\u043d\u0438\u0439",dark:"\u0442\u0435\u043c\u043d\u0438\u0439",gray:"\u0441\u0456\u0440\u0438\u0439",grayish:"\u0441\u0456\u0440\u0443\u0432\u0430\u0442\u0438\u0439",green:"\u0417\u0435\u043b\u0435\u043d\u0438\u0439","green cyan":"\u0437\u0435\u043b\u0435\u043d\u043e-\u0431\u043b\u0430\u043a\u0438\u0442\u043d\u0438\u0439",hue:"\u0422\u043e\u043d",light:"\u0441\u0432\u0456\u0442\u043b\u0438\u0439",lightness:"\u041e\u0441\u0432\u0456\u0442\u043b\u0435\u043d\u0456\u0441\u0442\u044c",magenta:"\u043f\u0443\u0440\u043f\u0443\u0440\u043e\u0432\u0438\u0439","magenta pink":"\u043f\u0443\u0440\u043f\u0443\u0440\u043e\u0432\u043e-\u0440\u043e\u0436\u0435\u0432\u0438\u0439",orange:"\u043f\u043e\u043c\u0430\u0440\u0430\u043d\u0447\u0435\u0432\u0438\u0439","orange yellow":"\u043f\u043e\u043c\u0430\u0440\u0430\u043d\u0447\u0435\u0432\u043e-\u0436\u043e\u0432\u0442\u0438\u0439",pale:"\u0431\u043b\u0456\u0434\u0438\u0439",pink:"\u0440\u043e\u0436\u0435\u0432\u0438\u0439","pink red":"\u0440\u043e\u0436\u0435\u0432\u043e-\u0447\u0435\u0440\u0432\u043e\u043d\u0438\u0439",purple:"\u0444\u0456\u043e\u043b\u0435\u0442\u043e\u0432\u0438\u0439","purple magenta":"\u0444\u0456\u043e\u043b\u0435\u0442\u043e\u0432\u043e-\u043f\u0443\u0440\u043f\u0443\u0440\u043e\u0432\u0438\u0439",red:"\u0427\u0435\u0440\u0432\u043e\u043d\u0438\u0439","red orange":"\u0447\u0435\u0440\u0432\u043e\u043d\u043e-\u043f\u043e\u043c\u0430\u0440\u0430\u043d\u0447\u0435\u0432\u0438\u0439",saturation:"\u041d\u0430\u0441\u0438\u0447\u0435\u043d\u0456\u0441\u0442\u044c",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, \u043f\u0440\u043e\u0437\u043e\u0440\u0438\u0439 \u043d\u0430 ${t.percentTransparent}`,"very dark":"\u0434\u0443\u0436\u0435 \u0442\u0435\u043c\u043d\u0438\u0439","very light":"\u0434\u0443\u0436\u0435 \u0441\u0432\u0456\u0442\u043b\u0438\u0439",vibrant:"\u044f\u0441\u043a\u0440\u0430\u0432\u0438\u0439",white:"\u0431\u0456\u043b\u0438\u0439",yellow:"\u0436\u043e\u0432\u0442\u0438\u0439","yellow green":"\u0436\u043e\u0432\u0442\u043e-\u0437\u0435\u043b\u0435\u043d\u0438\u0439"};var fw;fw={alpha:"Alpha",black:"\u9ed1\u8272",blue:"\u84dd\u8272","blue purple":"\u84dd\u7d2b\u8272",brightness:"\u4eae\u5ea6",brown:"\u68d5\u8272\u7684","brown yellow":"\u68d5\u9ec4\u8272",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"\u84dd\u7eff\u8272","cyan blue":"\u9752\u84dd\u8272",dark:"\u6df1\u8272",gray:"\u7070\u8272",grayish:"\u6d45\u7070\u8272\u7684",green:"\u7eff\u8272","green cyan":"\u7eff\u9752\u8272",hue:"\u8272\u76f8",light:"\u6d45\u8272",lightness:"\u660e\u4eae\u5ea6",magenta:"\u7d2b\u7ea2\u8272","magenta pink":"\u7d2b\u7c89\u8272",orange:"\u6a59\u8272","orange yellow":"\u6a59\u9ec4\u8272",pale:"\u82cd\u767d\u7684",pink:"\u7c89\u8272","pink red":"\u7c89\u7ea2\u8272",purple:"\u7d2b\u8272","purple magenta":"\u7d2b\u6d0b\u7ea2\u8272",red:"\u7ea2\u8272","red orange":"\u7ea2\u6a59\u8272",saturation:"\u9971\u548c\u5ea6",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} \u900f\u660e`,"very dark":"\u5f88\u6697","very light":"\u5f88\u6d45",vibrant:"\u751f\u673a\u52c3\u52c3",white:"\u767d\u8272",yellow:"\u9ec4\u8272","yellow green":"\u9ec4\u8272/\u7eff\u8272"};var gw;gw={alpha:"Alpha",black:"\u9ed1",blue:"\u85cd\u8272","blue purple":"\u85cd\u7d2b",brightness:"\u4eae\u5ea6",brown:"\u68d5","brown yellow":"\u68d5\u9ec3",colorName:t=>`${t.lightness} ${t.chroma} ${t.hue}`,cyan:"\u9752","cyan blue":"\u9752\u85cd",dark:"\u6697",gray:"\u7070",grayish:"\u504f\u7070",green:"\u7da0\u8272","green cyan":"\u9752\u7da0",hue:"\u8272\u76f8",light:"\u6dfa",lightness:"\u660e\u4eae",magenta:"\u6d0b\u7d05","magenta pink":"\u6dfa\u6d0b\u7d05",orange:"\u6a59","orange yellow":"\u6a59\u9ec3",pale:"\u6de1",pink:"\u7c89\u7d05","pink red":"\u7c89\u7d05",purple:"\u7d2b","purple magenta":"\u7d2b\u6d0b\u7d05",red:"\u7d05\u8272","red orange":"\u6a59\u7d05",saturation:"\u98fd\u548c\u5ea6",transparentColorName:t=>`${t.lightness} ${t.chroma} ${t.hue}, ${t.percentTransparent} \u900f\u660e`,"very dark":"\u5f88\u6697","very light":"\u5f88\u6dfa",vibrant:"\u9bae\u8c54",white:"\u767d",yellow:"\u9ec3","yellow green":"\u9ec3\u7da0"};var mw;mw={"ar-AE":Tx,"bg-BG":Lx,"cs-CZ":Fx,"da-DK":Nx,"de-DE":Bx,"el-GR":Vx,"en-US":$x,"es-ES":Hx,"et-EE":Wx,"fi-FI":Ux,"fr-FR":Xx,"he-IL":Yx,"hr-HR":Gx,"hu-HU":qx,"it-IT":Kx,"ja-JP":Zx,"ko-KR":Jx,"lt-LT":Qx,"lv-LV":tw,"nb-NO":ew,"nl-NL":nw,"pl-PL":rw,"pt-BR":iw,"pt-PT":ow,"ro-RO":sw,"ru-RU":aw,"sk-SK":lw,"sl-SI":cw,"sr-SP":uw,"sv-SE":hw,"tr-TR":dw,"uk-UA":pw,"zh-CN":fw,"zh-TW":gw};const vw=Symbol.for("react-aria.i18n.locale"),bw=Symbol.for("react-aria.i18n.strings");let yw;class xw{getStringForLocale(t,e){let n=this.getStringsForLocale(e)[t];if(!n)throw new Error(`Could not find intl message ${t} in ${e} locale`);return n}getStringsForLocale(t){let e=this.strings[t];return e||(e=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]}(t,this.strings,this.defaultLocale),this.strings[t]=e),e}static getGlobalDictionaryForPackage(t){if(typeof window>"u")return null;let e=window[vw];if(void 0===yw){let t=window[bw];if(!t)return null;yw={};for(let n in t)yw[n]=new xw({[e]:t[n]},e)}let n=null==yw?void 0:yw[t];if(!n)throw new Error(`Strings for package "${t}" were not included by LocalizedStringProvider. Please add it to the list passed to createLocalizedStringDictionary.`);return n}constructor(t,e="en-US"){this.strings=Object.fromEntries(Object.entries(t).filter(([,t])=>t)),this.defaultLocale=e}}const ww=new Map,_w=new Map;class Cw{format(t,e){let n=this.strings.getStringForLocale(t,this.locale);return"function"==typeof n?n(e,this):n}plural(t,e,n="cardinal"){let r=e["="+t];if(r)return"function"==typeof r?r():r;let i=this.locale+":"+n,o=ww.get(i);return o||(o=new Intl.PluralRules(this.locale,{type:n}),ww.set(i,o)),r=e[o.select(t)]||e.other,"function"==typeof r?r():r}number(t){let e=_w.get(this.locale);return e||(e=new Intl.NumberFormat(this.locale),_w.set(this.locale,e)),e.format(t)}select(t,e){let n=t[e]||t.other;return"function"==typeof n?n():n}constructor(t,e){this.locale=t,this.strings=e}}let Sw=new Map,kw=!1;try{kw="exceptZero"===new Intl.NumberFormat("de-DE",{signDisplay:"exceptZero"}).resolvedOptions().signDisplay}catch{}let Tw=!1;try{Tw="unit"===new Intl.NumberFormat("de-DE",{style:"unit",unit:"degree"}).resolvedOptions().style}catch{}const jw={degree:{narrow:{default:"\xb0","ja-JP":" \u5ea6","zh-TW":"\u5ea6","sl-SI":" \xb0"}}};class Ow{format(t){let e="";if(e=kw||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 e.replace(r,"!!!").replace(i,"+").replace("!!!",r)}return t.format(n)}}(this.numberFormatter,this.options.signDisplay,t),"unit"===this.options.style&&!Tw){var n;let{unit:t,unitDisplay:r="short",locale:i}=this.resolvedOptions();if(!t)return e;let o=null===(n=jw[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!kw&&null!=this.options.signDisplay&&(t={...t,signDisplay:this.options.signDisplay}),!Tw&&"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&&t.includes("-nu-")&&(t.includes("-u-")||(t+="-u-"),t+=`-nu-${n}`),"unit"===e.style&&!Tw){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=jw[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(Sw.has(i))return Sw.get(i);let o=new Intl.NumberFormat(t,e);return Sw.set(i,o),o}(t,e),this.options=e}}let Ew=new xw(function(t){return t&&t.__esModule?t.default:t}(mw));const Mw=[[0,"pink"],[15,"red"],[48,"orange"],[94,"yellow"],[135,"green"],[175,"cyan"],[264,"blue"],[284,"purple"],[320,"magenta"],[349,"pink"]];class Pw{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(xw.getGlobalDictionaryForPackage("@react-stately/color")||Ew).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}}getColorName(t){let e,[n,r,i]=Fw(this),o=xw.getGlobalDictionaryForPackage("@react-stately/color")||Ew;if(n>.999)return o.getStringForLocale("white",t);if(n<.001)return o.getStringForLocale("black",t);[e,n]=this.getOklchHue(n,r,i,t);let s="",a="";r<=.1&&r>=.001?a=n>=.7?"pale":"grayish":r>=.15&&(a="vibrant"),n<.3?s="very dark":n<.55?s="dark":n<.7||(s=n<.85?"light":"very light"),a&&(a=o.getStringForLocale(a,t)),s&&(s=o.getStringForLocale(s,t));let l=this.getChannelValue("alpha"),c=new Cw(t,o);if(l<1){let n=new Ow(t,{style:"percent"}).format(1-l);return c.format("transparentColorName",{lightness:s,chroma:a,hue:e,percentTransparent:n}).replace(/\s+/g," ").trim()}return c.format("colorName",{lightness:s,chroma:a,hue:e}).replace(/\s+/g," ").trim()}getOklchHue(t,e,n,r){let i=xw.getGlobalDictionaryForPackage("@react-stately/color")||Ew;if(e<.001)return[i.getStringForLocale("gray",r),t];for(let o=0;o<Mw.length;o++){let[e,s]=Mw[o],[a,l]=Mw[o+1]||[360,"pink"];if(n>=e&&n<a)return"orange"===s&&(t<.68?s="brown":t=t-.68+.55),n>e+(a-e)/2&&s!==l?s=`${s} ${l}`:"yellow"===s&&t<.85&&(s="yellow green"),[i.getStringForLocale(s,r).toLocaleLowerCase(r),t]}throw new Error("Unexpected hue")}getHueName(t){let[e,n,r]=Fw(this),[i]=this.getOklchHue(e,n,r,t);return i}}class Aw extends Pw{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)=>ip(t,0,e<3?255:1))),e.length<3?void 0:new Aw(e[0],e[1],e[2],null!==(r=e[3])&&void 0!==r?r:1)}toString(t="css"){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,s=0===i?0:o/i;let a=0;if(0!==o){switch(i){case t:a=(e-n)/o+(e<n?6:0);break;case e:a=(n-t)/o+2;break;case n:a=(t-e)/o+4}a/=6}return new Iw(sp(360*a,2),sp(100*s,2),sp(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,s=i-r;let a,l;if(0===s)a=l=0;else{switch(l=s/(o<.5?i+r:2-i-r),i){case t:a=(e-n)/s+(e<n?6:0);break;case e:a=(n-t)/s+2;break;case n:a=(t-e)/s+4}a/=6}return new Lw(sp(360*a,2),sp(100*l,2),sp(100*o,2),this.alpha)}clone(){return new Aw(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)}}getChannelFormatOptions(t){switch(t){case"red":case"green":case"blue":return{style:"decimal"};case"alpha":return{style:"percent"};default:throw new Error("Unknown color channel: "+t)}}formatChannelValue(t,e){let n=this.getChannelFormatOptions(t),r=this.getChannelValue(t);return new Ow(e,n).format(r)}getColorSpace(){return"rgb"}getColorChannels(){return Aw.colorChannels}constructor(t,e,n,r){super(),this.red=t,this.green=e,this.blue=n,this.alpha=r}}Aw.colorChannels=["red","green","blue"];const Dw=/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 Iw extends Pw{static parse(t){let e;if(e=t.match(Dw)){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 Iw(zw(t,360),ip(r,0,100),ip(i,0,100),ip(o??1,0,1))}}toString(t="css"){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}, ${sp(this.saturation,2)}%, ${sp(this.brightness,2)}%)`;case"hsba":return`hsba(${this.hue}, ${sp(this.saturation,2)}%, ${sp(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 Lw(sp(this.hue,2),sp(100*t,2),sp(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 Aw(Math.round(255*r(5)),Math.round(255*r(3)),Math.round(255*r(1)),this.alpha)}clone(){return new Iw(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)}}getChannelFormatOptions(t){switch(t){case"hue":return{style:"unit",unit:"degree",unitDisplay:"narrow"};case"saturation":case"brightness":case"alpha":return{style:"percent"};default:throw new Error("Unknown color channel: "+t)}}formatChannelValue(t,e){let n=this.getChannelFormatOptions(t),r=this.getChannelValue(t);return("saturation"===t||"brightness"===t)&&(r/=100),new Ow(e,n).format(r)}getColorSpace(){return"hsb"}getColorChannels(){return Iw.colorChannels}constructor(t,e,n,r){super(),this.hue=t,this.saturation=e,this.brightness=n,this.alpha=r}}Iw.colorChannels=["hue","saturation","brightness"];const Rw=/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 zw(t,e){return(t%e+e)%e}class Lw extends Pw{static parse(t){let e;if(e=t.match(Rw)){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 Lw(zw(t,360),ip(r,0,100),ip(i,0,100),ip(o??1,0,1))}}toString(t="css"){switch(t){case"hex":return this.toRGB().toString("hex");case"hexa":return this.toRGB().toString("hexa");case"hsl":return`hsl(${this.hue}, ${sp(this.saturation,2)}%, ${sp(this.lightness,2)}%)`;case"css":case"hsla":return`hsla(${this.hue}, ${sp(this.saturation,2)}%, ${sp(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 Iw(sp(this.hue,2),sp(100*t,2),sp(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 Aw(Math.round(255*i(0)),Math.round(255*i(8)),Math.round(255*i(4)),this.alpha)}clone(){return new Lw(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)}}getChannelFormatOptions(t){switch(t){case"hue":return{style:"unit",unit:"degree",unitDisplay:"narrow"};case"saturation":case"lightness":case"alpha":return{style:"percent"};default:throw new Error("Unknown color channel: "+t)}}formatChannelValue(t,e){let n=this.getChannelFormatOptions(t),r=this.getChannelValue(t);return("saturation"===t||"lightness"===t)&&(r/=100),new Ow(e,n).format(r)}getColorSpace(){return"hsl"}getColorChannels(){return Lw.colorChannels}constructor(t,e,n,r){super(),this.hue=t,this.saturation=e,this.lightness=n,this.alpha=r}}function Fw(t){let e=t.toFormat("rgb"),n=e.getChannelValue("red")/255,r=e.getChannelValue("green")/255,i=e.getChannelValue("blue")/255;[n,r,i]=function(t,e,n){return[Nw(t),Nw(e),Nw(n)]}(n,r,i);let[o,s,a]=function(t,e,n){return Bw([.4123907992659595,.35758433938387796,.1804807884018343,.21263900587151036,.7151686787677559,.07219231536073371,.01933081871559185,.11919477979462599,.9505321522496606],t,e,n)}(n,r,i),[l,c,u]=function(t,e,n){const r=[.819022437996703,.3619062600528904,-.1288737815209879,.0329836539323885,.9292868615863434,.0361446663506424,.0481771893596242,.2642395317527308,.6335478284694309],i=[.210454268309314,.7936177747023054,-.0040720430116193,1.9779985324311684,-2.42859224204858,.450593709617411,.0259040424655478,.7827717124575296,-.8086757549230774];let[o,s,a]=Bw(r,t,e,n);return Bw(i,Math.cbrt(o),Math.cbrt(s),Math.cbrt(a))}(o,s,a);return function(t,e,n){var r=180*Math.atan2(n,e)/Math.PI;return[t,Math.sqrt(e**2+n**2),r>=0?r:r+360]}(l,c,u)}function Nw(t){let e=t<0?-1:1,n=Math.abs(t);return n<=.04045?t/12.92:e*Math.pow((n+.055)/1.055,2.4)}function Bw(t,e,n,r){return[t[0]*e+t[1]*n+t[2]*r,t[3]*e+t[4]*n+t[5]*r,t[6]*e+t[7]*n+t[8]*r]}Lw.colorChannels=["hue","saturation","lightness"];function Vw({onChange:t,value:e,colors:n}){const i=n.map(n=>{const i=e===n;return(0,r.jsx)(Nf,{onClick:()=>{null==t||t(n)},className:ei("relative block flex-shrink-0 w-26 h-26 border rounded",i&&"shadow-md"),style:{backgroundColor:n},children:i&&(0,r.jsx)("span",{className:"absolute inset-0 m-auto rounded-full w-8 h-8 bg-white"})},n)});return(0,r.jsx)("div",{className:"flex flex-wrap gap-6",children:i})}const $w=[{color:"rgb(255, 255, 255)",name:Xr("White")},{color:"rgb(239,245,245)",name:Xr("Solitude")},{color:"rgb(245,213,174)",name:Xr("Wheat")},{color:"rgb(253,227,167)",name:Xr("Cape Honey")},{color:"rgb(242,222,186)",name:Xr("Milk punch")},{color:"rgb(97,118,75)",name:Xr("Dingy"),foreground:"rgb(255, 255, 255)"},{color:"rgb(4, 147, 114)",name:Xr("Aquamarine"),foreground:"rgb(255, 255, 255)"},{color:"rgb(222,245,229)",name:Xr("Cosmic Latte")},{color:"rgb(233,119,119)",name:Xr("Geraldine"),foreground:"rgb(90,14,14)"},{color:"rgb(247,164,164)",name:Xr("Sundown")},{color:"rgb(30,139,195)",name:Xr("Pelorous"),foreground:"rgb(255, 255, 255)"},{color:"rgb(142,68,173)",name:Xr("Deep Lilac"),foreground:"rgb(255, 255, 255)"},{color:"rgb(108,74,182)",name:Xr("Blue marguerite"),foreground:"rgb(255, 255, 255)"},{color:"rgb(139,126,116)",name:Xr("Americano"),foreground:"rgb(255, 255, 255)"},{color:"rgb(0,0,0)",name:Xr("Black"),foreground:"rgb(255, 255, 255)"},{color:"rgb(64,66,88)",name:Xr("Blue zodiac"),foreground:"rgb(255, 255, 255)"},{color:"rgb(101,100,124)",name:Xr("Comet"),foreground:"rgb(255, 255, 255)"}].map(({color:t})=>t).slice(0,14);function Hw({defaultValue:t,onChange:e,colorPresets:n,showInput:o}){const[s,a]=(0,i.useState)(t),l=n||$w,c=Lv({size:"sm"});return(0,r.jsxs)("div",{children:[(0,r.jsx)(Ax,{className:"!w-auto",color:s,onChange:t=>{null==e||e(t),a(t)}}),(0,r.jsxs)("div",{className:"px-12 py-20",children:[l&&(0,r.jsx)(Vw,{colors:l,onChange:t=>{if(t){const n=function(t){let e=Aw.parse(t)||Iw.parse(t)||Lw.parse(t);if(e)return e;throw new Error("Invalid color value: "+t)}(t).toString("hex");null==e||e(n),a(n)}},value:s}),o&&(0,r.jsx)("div",{className:"pt-20",children:(0,r.jsx)(zx,{autoComplete:"off",role:"textbox",autoCorrect:"off",spellCheck:"false",required:!0,"aria-label":"Hex color",prefixed:!0,className:c.input,color:s,onChange:t=>{null==e||e(t),a(t)}})})]})]})}const Ww=i.createContext(null);function Uw(){return(0,i.useContext)(Ww)}function Xw(){const{lines:t,localeCode:e}=iv();return{trans:(0,i.useCallback)(n=>Yw({...n,lines:t,localeCode:e}),[t,e])}}const Yw=qf(t=>{let{lines:e,message:n,values:r,localeCode:i}=t;return null==n?"":(n=(null==e?void 0:e[n])||(null==e?void 0:e[n.toLowerCase()])||n,r&&(n=ov(i,t),Object.entries(r).forEach(([t,e])=>{n=n.replace(`:${t}`,`${e}`)})),n)},{equals:rv,callTimeout:0});function Gw({onDismiss:t}){const{trans:e}=Xw();return(0,r.jsx)("button",{className:"sr-only","aria-label":e(Xr("Dismiss")),tabIndex:-1,onClick:()=>{t&&t()}})}function qw(t){const{type:e="modal",dialogProps:n,...o}=(0,i.useContext)(Ww),{children:s,className:a,size:l="md",background:c,radius:u="rounded",maxWidth:h="max-w-dialog",...d}=t;let p=null;("popover"===e||"tray"===e)&&(p=(0,r.jsx)(Gw,{onDismiss:o.close}));const f="fullscreenTakeover"===l||"tray"===e,g=ei("mx-auto pointer-events-auto outline-none flex flex-col overflow-hidden",c||"bg","tray"!==e&&function(t){switch(t){case"2xs":return"w-256";case"xs":return"w-320";case"sm":return"w-384";case"md":return"w-440";case"lg":return"w-620";case"xl":return"w-780";case"2xl":return"w-850";case"fullscreen":return"w-1280";case"fullscreenTakeover":return"w-full h-full";default:return t}}(l),"tray"===e&&"rounded-t border-b-bg","fullscreenTakeover"!==l&&"shadow-2xl border max-h-dialog",!f&&`${u} ${h}`,a);return(0,r.jsxs)("div",{...Ud({role:"dialog",tabIndex:-1},n,d),style:{...t.style,"--be-dialog-padding":"24px"},"aria-modal":!0,className:g,children:[i.Children.toArray(s).map(t=>(0,i.isValidElement)(t)?(0,i.cloneElement)(t,{size:t.props.size??l}):t),p]})}const Kw=ii((0,r.jsx)("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"}),"KeyboardArrowDownOutlined"),Zw=(0,i.forwardRef)(({children:t,autoFocus:e=!1,restoreFocus:n=!0,isDismissable:i=!0,isOpen:o=!1,placement:s="center",onClose:a},l)=>{const c=Km(),u=tp(l);return(0,r.jsxs)("div",{className:"fixed inset-0 isolate z-modal",style:c,onKeyDown:t=>{"Escape"===t.key&&(t.stopPropagation(),t.preventDefault(),a())},children:[(0,r.jsx)(ev,{onClick:()=>{i&&a()}},"modal-underlay"),(0,r.jsx)(Cd.div,{ref:u,className:ei("pointer-events-none absolute inset-0 z-20 flex h-full w-full","center"===s&&"items-center justify-center","top"===s&&"items-start justify-center pt-40"),role:"presentation",initial:{opacity:0,scale:"top"===s?1:.7},animate:{opacity:1,scale:1},exit:{opacity:0,scale:1},transition:{duration:.1},children:(0,r.jsx)(Im,{restoreFocus:n,autoFocus:e,contain:!0,children:t})})]})});function Jw(t){let{children:e,type:n,disableInitialTransition:o,isDismissable:a=!0,moveFocusToDialog:l=!0,returnFocusToTrigger:c=!0,triggerOnHover:u=!1,triggerOnContextMenu:h=!1,usePortal:d=!0,mobileType:p,alwaysReturnCurrentValueOnClose:f}=t;const g=(0,i.useRef)(null),m=h&&!t.triggerRef?g:t.triggerRef,v=(0,i.useRef)(t.value),[b,y]=rp(t.isOpen,t.defaultIsOpen,t.onOpenChange),[x,w]=rp(t.value,t.defaultValue,t.onValueChange);gv()&&"popover"===n&&(n=p||"modal");const _=(0,i.useRef)(null),{x:C,y:S,reference:k,strategy:T,refs:j}=fm({...t,disablePositioning:"modal"===n}),O="popover"===n?{position:T,top:S??"",left:C??""}:{},E=(0,i.useId)(),M=`${E}-label`,P=`${E}-description`,A=`${E}-form`,D=function(t){const e=(0,i.useRef)(t);return(0,i.useEffect)(()=>{e.current=t}),(0,i.useMemo)(()=>(...t)=>{var n;return null==(n=e.current)?void 0:n.call(e,...t)},[])}(t.onClose),I=(0,i.useCallback)(t=>{typeof t>"u"&&f&&(t=x);const e=typeof t<"u"?t:v.current;null==D||D(e,{initialValue:v.current,valueChanged:e!==v.current}),y(!1)},[D,y,x,f]),R=(0,i.useCallback)(()=>{y(!0),v.current=t.value},[t.value,y]);Id(()=>{null!=m&&m.current&&j.reference.current!==m.current&&k(m.current)},[k,null==m?void 0:m.current,j]);const z=(0,i.useMemo)(()=>({"aria-labelledby":M,"aria-describedby":P}),[M,P]);let L;L="modal"===n?Zw:"tray"===n?nv:Jm;const F=(0,i.useMemo)(()=>({dialogProps:z,type:n,labelId:M,descriptionId:P,isDismissable:a,close:I,value:x,initialValue:v.current,setValue:w,formId:A}),[I,P,z,A,M,n,a,x,w]);u=u&&"popover"===n;const N={onPointerEnter:Ff(t=>{R()}),onPointerLeave:Ff(t=>{_.current=setTimeout(()=>{I()},150)})},B={onPointerEnter:Ff(t=>{_.current&&clearTimeout(_.current)}),onPointerLeave:Ff(t=>{I()})},V={onContextMenu:Ff(t=>{t.preventDefault(),g.current=function({x:t,y:e},n){return{getBoundingClientRect:()=>({x:t,y:e,width:0,height:0,top:e,right:t,bottom:e,left:t}),contextElement:n}}({x:t.clientX,y:t.clientY},t.currentTarget),R()})},$={onClick:Ff(t=>{t.stopPropagation(),b?I():R()})},{dialogTrigger:H,dialog:W}=function(t,e){const n=Array.isArray(t)?t:i.Children.toArray(t);let r=2===n.length?n[1]:n[0];return r="function"==typeof r?r(e):r,2===n.length?{dialogTrigger:n[0],dialog:r}:{dialog:r}}(e,F),U=(0,r.jsx)(Md,{initial:!o,children:b&&(0,r.jsx)(Ww.Provider,{value:F,children:(0,r.jsx)(L,{...u?B:{},ref:j.setFloating,triggerRef:j.reference,style:O,restoreFocus:c,autoFocus:l,isOpen:b,onClose:I,isDismissable:a,isContextMenu:h,placement:t.placement,children:W})})});return(0,r.jsxs)(i.Fragment,{children:[H&&(0,i.cloneElement)(H,Ud({...m||h?{}:{ref:k},...h?{}:$,...u?N:{},...h?V:{}},{...H.props})),d?ha&&(0,s.createPortal)(U,ha):U]})}function Qw(t){const{label:e,className:n,value:o,onChange:s,size:a,width:l="w-max"}=t,c=ba(t=>{var e,n;return null==(n=null==(e=t.config.ui)?void 0:e.colorPresets)?void 0:n.items})||[],u=Lv({size:a}),[h,d]=(0,i.useState)(o),[p,f]=(0,i.useState)(!1);return(0,r.jsxs)("div",{className:ei(n,l),children:[e&&(0,r.jsx)("span",{className:u.label,children:e}),(0,r.jsxs)(Jw,{type:"popover",isOpen:p,onOpenChange:f,children:[(0,r.jsxs)(Nf,{className:ei(u.input,"inline-flex items-center"),"aria-label":t["aria-label"],children:[(0,r.jsx)("span",{className:"block flex-shrink-0 mr-5 border rounded h-2/4 aspect-square",style:{backgroundColor:h}}),(0,r.jsx)(t_,{isActive:p,className:u.adornment})]}),(0,r.jsx)(qw,{size:"auto",children:(0,r.jsx)(Hw,{onChange:t=>{d(t),null==s||s(t)},defaultValue:h,colorPresets:c})})]})]})}function t_({isActive:t,className:e}){return(0,r.jsx)(Kw,{size:"sm",className:`transition-transform ml-auto flex-shrink-0 ${t?"rotate-180":"rotate-0"} ${e}`})}function e_(t){const{size:e="md",inline:n,label:i,showValueLabel:o=!!i,className:s,width:a="w-full",slider:l,children:c,trackColor:u="primary",fillColor:h="primary"}=t,{domProps:d,trackRef:p,getThumbPercent:f,getThumbValueLabel:g,labelId:m,groupId:v,thumbIds:b,isDisabled:y,numberFormatter:x,minValue:w,maxValue:_,step:C,values:S,getValueLabel:k}=l;let T="",j=Math.max([...x.format(w)].length,[...x.format(_)].length,[...x.format(C)].length);k?T=k(S[0]):1===S.length?T=g(0):2===S.length&&(T=`${g(0)} \u2013 ${g(1)}`,j=3+2*Math.max(j,[...x.format(w)].length,[...x.format(_)].length));const O=Lv({size:e,disabled:y,labelDisplay:"flex"}),E=ei("touch-none",s,a,{"flex items-center":n});return(0,r.jsxs)("div",{className:E,role:"group",id:v,children:[(i||o)&&(0,r.jsxs)("div",{className:ei(O.label,"select-none"),children:[i&&(0,r.jsx)("label",{onClick:()=>{var t;null==(t=document.getElementById(b[0]))||t.focus()},id:m,htmlFor:v,children:i}),o&&(0,r.jsx)("output",{htmlFor:b[0],className:"ml-auto text-right","aria-live":"off",style:j?{width:`${j}ch`,minWidth:`${j}ch`}:void 0,children:T})]}),(0,r.jsxs)("div",{ref:p,className:ei("relative",n_(t)),...d,role:"presentation",children:[(0,r.jsx)("div",{className:ei("absolute inset-0 m-auto rounded",i_(u,y),r_(e))}),(0,r.jsx)("div",{className:ei("absolute inset-0 my-auto rounded",o_(h,y),r_(e)),style:{width:`${Math.max(100*f(0),0)}%`}}),c]})]})}function n_({size:t,wrapperHeight:e}){if(e)return e;switch(t){case"xs":return"h-14";case"sm":return"h-20";default:return"h-30"}}function r_(t){switch(t){case"xs":return"h-2";case"sm":return"h-3";default:return"h-4"}}function i_(t,e){switch(e&&(t="disabled"),t){case"disabled":return"bg-slider-disabled/60";case"primary":return"bg-primary-light";case"neutral":return"bg-divider";default:return t}}function o_(t,e){switch(e&&(t="disabled"),t){case"disabled":return"bg-slider-disabled";case"primary":return"bg-primary";default:return t}}function s_(t={}){const{localeCode:e}=iv();return(0,i.useMemo)(()=>new Ow(e,t),[e,t])}function a_({minValue:t=0,maxValue:e=100,isDisabled:n=!1,step:r=1,formatOptions:o,onChangeEnd:s,onPointerDown:a,label:l,getValueLabel:c,showThumbOnHoverOnly:u,thumbSize:h,onPointerMove:d,...p}){const[f,g]=(0,i.useState)(!1),m=s_(o),{addGlobalListener:v,removeGlobalListener:b}=Qd(),y=(0,i.useRef)(null),[x,w]=rp(p.value?p.value:void 0,p.defaultValue??[t],p.onChange),_=(0,i.useRef)(null);_.current=x;const[C,S]=(0,i.useState)(new Array(x.length).fill(!1)),k=(0,i.useRef)(null);k.current=C;const T=e=>0===e?t:x[e-1],j=t=>t===x.length-1?e:x[t+1],O=(t,e)=>{if(n||!R(t)||!_.current)return;e=function(t,e,n,r){e=Number(e),n=Number(n);let i=(t-(isNaN(e)?0:e))%r,o=op(2*Math.abs(i)>=r?t+Math.sign(i)*(r-Math.abs(i)):t-i,r);return isNaN(e)?!isNaN(n)&&o>n&&(o=Math.floor(op(n/r,r))*r):o<e?o=e:!isNaN(n)&&o>n&&(o=e+Math.floor(op((n-e)/r,r))*r),o=op(o,r),o}(e,T(t),j(t),r),_.current=l_(_.current,t,e),w(_.current)},E=(t,e)=>{var r;if(n||!R(t))return;const i=null==(r=k.current)?void 0:r[t];k.current=l_(k.current||[],t,e),S(k.current),s&&i&&!k.current.some(Boolean)&&s(_.current||[])},[M,P]=(0,i.useState)(void 0),A=n=>(n=>{const r=Math.min(1,(n-t)/(e-t));return isNaN(r)?0:r})(_.current[n]),D=n=>zy((e=>Math.round((e-t)/r)*r+t)(n*(e-t)+t),t,e),I=(0,i.useRef)(new Array(x.length).fill(!0)),R=t=>I.current[t],z=(0,i.useRef)(null),L=(0,i.useRef)(void 0),F=(0,i.useRef)(null),{domProps:N}=Ty({onPointerDown:t=>{if(("mouse"!==t.pointerType||!(0!==t.button||t.altKey||t.ctrlKey||t.metaKey))&&(null==a||a(),y.current&&!n&&x.every((t,e)=>!C[e]))){const e=y.current.offsetWidth,n=y.current.getBoundingClientRect().left,r=(t.clientX-n)/e,i=D(r);let o;const s=x.findIndex(t=>i-t<0);if(0===s)o=s;else if(-1===s)o=x.length-1;else{const t=x[s-1],e=x[s];o=Math.abs(t-i)<Math.abs(e-i)?s-1:s}o>=0&&R(o)?(t.preventDefault(),z.current=o,P(o),L.current=t.pointerId,E(z.current,!0),O(o,i),v(window,"pointerup",V,!1)):z.current=null}},onMoveStart(){F.current=null},onMove(t,e){var n;const r=(null==(n=y.current)?void 0:n.offsetWidth)||0;if(null==F.current&&(F.current=A(z.current||0)*r),F.current+=e,null!=z.current&&y.current){const t=zy(F.current/r,0,1);((t,e)=>{O(t,D(e))})(z.current,t)}},onMoveEnd(){null!=z.current&&(E(z.current,!1),z.current=null)}}),B=Ud(N,{onPointerEnter:()=>{g(!0)},onPointerLeave:()=>{g(!1)},onPointerMove:t=>{null==d||d(t)}}),V=t=>{t.pointerId===L.current&&(null!=z.current&&(E(z.current,!1),z.current=null),b(window,"pointerup",V,!1))},$=(0,i.useId)(),H=l?`${$}-label`:void 0,W=`${$}-group`,U=[...Array(x.length)].map((t,e)=>`${$}-thumb-${e}`);return{domProps:B,trackRef:y,isDisabled:n,step:r,values:x,minValue:t,maxValue:e,focusedThumb:M,labelId:H,groupId:W,thumbIds:U,numberFormatter:m,getThumbPercent:A,getThumbMinValue:T,getThumbMaxValue:j,getThumbValueLabel:t=>function(t){return m.format(t)}(x[t]),isThumbDragging:t=>{var e;return(null==(e=k.current)?void 0:e[t])||!1},setThumbValue:O,updateDraggedThumbs:E,setThumbEditable:(t,e)=>{I.current[t]=e},setFocusedThumb:P,getValueLabel:c,isPointerOver:f,showThumbOnHoverOnly:u,thumbSize:h}}function l_(t,e,n){return t[e]===n?t:[...t.slice(0,e),n,...t.slice(e+1)]}function c_({index:t,slider:e,isDisabled:n,ariaLabel:o,inputRef:s,onBlur:a,fillColor:l="primary"}){const c=tp(s),{addGlobalListener:u,removeGlobalListener:h}=Qd(),{step:d,values:p,focusedThumb:f,labelId:g,thumbIds:m,isDisabled:v,getThumbPercent:b,getThumbMinValue:y,getThumbMaxValue:x,getThumbValueLabel:w,setThumbValue:_,updateDraggedThumbs:C,isThumbDragging:S,setThumbEditable:k,setFocusedThumb:T,isPointerOver:j,showThumbOnHoverOnly:O,thumbSize:E="w-18 h-18"}=e,M=S(t),P=p[t];k(t,!n);const A=n||v,D=(0,i.useCallback)(()=>{c.current&&c.current.focus({preventScroll:!0})},[c]),I=f===t;(0,i.useEffect)(()=>{I&&D()},[I,D]);const R=(0,i.useRef)(void 0),z=e=>{e.pointerId===R.current&&(D(),C(t,!1),h(window,"pointerup",z,!1))},L=ei("outline-none rounded-full top-1/2 -translate-y-1/2 -translate-x-1/2 absolute inset-0 transition-button duration-200",E,!A&&"shadow-md",function({isDisabled:t,isDragging:e,fillColor:n}){return t?"bg-slider-disabled cursor-default":n&&"primary"!==n?n:ei("hover:bg-primary-dark",e?"bg-primary-dark":"bg-primary")}({fillColor:l,isDisabled:A,isDragging:M}),!O||O&&M||j?"visible":"invisible");return(0,r.jsx)("div",{role:"presentation",className:L,style:{left:`${Math.max(100*b(t),0)}%`},onPointerDown:e=>{0!==e.button||e.altKey||e.ctrlKey||e.metaKey||(D(),R.current=e.pointerId,C(t,!0),u(window,"pointerup",z,!1))},children:(0,r.jsx)("input",{id:m[t],onKeyDown:Ff(()=>{C(t,!0)}),onKeyUp:Ff(()=>{C(t,!1)}),ref:c,tabIndex:A?void 0:0,min:y(t),max:x(t),step:d,value:P,disabled:A,"aria-label":o,"aria-labelledby":g,"aria-orientation":"horizontal","aria-valuetext":w(t),onFocus:()=>{T(t)},onBlur:e=>{T(void 0),C(t,!1),null==a||a(e)},onChange:e=>{_(t,parseFloat(e.target.value))},type:"range",className:"sr-only"})})}function u_({inputRef:t,onBlur:e,...n}){const{onChange:i,onChangeEnd:o,value:s,defaultValue:a,...l}=n,c={...l,value:null!=s?[s]:void 0,defaultValue:null!=a?[a]:void 0,onChange:t=>{null==i||i(t[0])},onChangeEnd:t=>{null==o||o(t[0])}},u=a_(c);return(0,r.jsx)(e_,{...c,slider:u,children:(0,r.jsx)(c_,{fillColor:n.fillColor,index:0,slider:u,inputRef:t,onBlur:e})})}const h_=i.forwardRef((t,e)=>{let{value:n=0,minValue:i=0,maxValue:o=100,size:s="md",isIndeterminate:a=!1,className:l,position:c="relative",trackColor:u,fillColor:h="border-primary",...d}=t;n=zy(n,i,o);const p=function(t){switch(t){case"xs":return"w-20 h-20";case"sm":return"w-24 h-24";case"md":return"w-32 h-32";case"lg":return"w-42 h-42";default:return t}}(s),f=(n-i)/(o-i),g=s_({style:"percent"});let m="";!a&&!m&&(m=g.format(f));const v={},b={};if(!a){const t=(n-i)/(o-i)*100;let e;t>0&&t<=50?(e=t/50*180-180,v.transform=`rotate(${e}deg)`,b.transform="rotate(-180deg)"):t>50&&(e=(t-50)/50*180-180,v.transform="rotate(0deg)",b.transform=`rotate(${e}deg)`)}return(0,r.jsxs)("div",{...d,"aria-valuenow":a?void 0:n,"aria-valuemin":i,"aria-valuemax":o,"aria-valuetext":a?void 0:m,role:"progressbar",ref:e,className:ei("progress-circle",c,p,a&&"indeterminate",l),children:[(0,r.jsx)("div",{className:ei(p,u,"rounded-full border-4")}),(0,r.jsxs)("div",{className:ei("fills absolute left-0 top-0 h-full w-full",a&&"progress-circle-fills-animate"),children:[(0,r.jsx)(d_,{circleSize:p,subMaskStyle:v,isIndeterminate:a,className:"rotate-180",fillColor:h,subMaskClassName:ei(a&&"progress-circle-fill-submask-1-animate")}),(0,r.jsx)(d_,{circleSize:p,subMaskStyle:b,isIndeterminate:a,fillColor:h,subMaskClassName:ei(a&&"progress-circle-fill-submask-2-animate")})]})]})});function d_({subMaskStyle:t,subMaskClassName:e,className:n,circleSize:i,isIndeterminate:o,fillColor:s}){return(0,r.jsx)("div",{className:ei("absolute h-full w-1/2 origin-[100%] overflow-hidden",n),children:(0,r.jsx)("div",{className:ei("h-full w-full origin-[100%] rotate-180 overflow-hidden",!o&&"transition-transform duration-100",e),style:t,children:(0,r.jsx)("div",{className:ei(i,s,"rounded-full border-4")})})})}function p_({isLoading:t,icon:e}){const n=(0,i.useRef)(null),{trans:o}=Xw(),[s,a]=(0,i.useState)(!1),{state:{isOpen:l,inputValue:c}}=Hf(),u=(0,i.useRef)(c);return(0,i.useEffect)(()=>{t&&!s?(null===n.current&&(n.current=setTimeout(()=>{a(!0)},500)),c!==u.current&&(clearTimeout(n.current),n.current=setTimeout(()=>{a(!0)},500))):t||(a(!1),clearTimeout(n.current),n.current=null),u.current=c},[t,s,c]),s&&(l||t)?(0,r.jsx)(h_,{"aria-label":o({message:"Loading"}),size:"sm",isIndeterminate:!0}):e||(0,r.jsx)(Kw,{})}const f_=i.forwardRef(function(t,e){const n=gv(),{hideCaret:i,placeholder:o=(0,r.jsx)(lv,{message:"Select an option..."}),selectedValue:s,onItemSelected:a,onOpenChange:l,onInputValueChange:c,onSelectionChange:u,selectionMode:h,minWidth:d="min-w-128",children:p,searchPlaceholder:f,showEmptyMessage:g,showSearchField:m,defaultInputValue:v,inputValue:b,isLoading:y,isAsync:x,valueClassName:w,floatingWidth:_=(n?"auto":"matchTrigger"),...C}=t,S=gm({...t,clearInputOnItemSelection:!0,showEmptyMessage:g||m,floatingWidth:_,selectionMode:"single",role:"listbox",virtualFocus:m},e),{state:{selectedValues:k,isOpen:T,setIsOpen:j,activeIndex:O,setSelectedIndex:E,inputValue:M,setInputValue:P},collections:A,focusItem:D,listboxId:I,reference:R,refs:z,listContent:L,onInputChange:F}=S,{fieldProps:N,inputProps:B}=Yv({...C,focusRef:z.reference}),V=A.collection.get(k[0]),$=V?(0,r.jsxs)("span",{className:"flex items-center gap-10",children:[V.element.props.startIcon,(0,r.jsx)("span",{className:ei("overflow-hidden overflow-ellipsis whitespace-nowrap",w),children:V.element.props.children})]}):(0,r.jsx)("span",{className:"italic",children:o}),H=Lv({...t,endAdornment:!0}),{handleTriggerKeyDown:W,handleListboxKeyboardNavigation:U,handleListboxSearchFieldKeydown:X}=dv(S),{findMatchingItem:Y}=fv();return(0,r.jsx)(cv,{listbox:S,onKeyDownCapture:m?void 0:t=>{if(!T)return;const e=Y(t,L,O);null!=e&&D("increment",e)},onKeyDown:U,onClose:m?()=>P(""):void 0,isLoading:y,searchField:m&&(0,r.jsx)(Gv,{size:"xs"===t.size||"sm"===t.size?"xs":"sm",placeholder:f,startAdornment:(0,r.jsx)(mv,{}),className:"flex-shrink-0 px-8 pb-8 pt-4",autoFocus:!0,"aria-expanded":T?"true":"false","aria-haspopup":"listbox","aria-controls":T?I:void 0,"aria-autocomplete":"list",autoComplete:"off",autoCorrect:"off",spellCheck:"false",value:M,onChange:F,onKeyDown:t=>{X(t)}}),children:(0,r.jsx)(Hv,{fieldClassNames:H,...N,endAdornment:!i&&(0,r.jsx)(p_,{isLoading:y}),children:(0,r.jsx)("button",{...B,type:"button","data-selected-value":null==V?void 0:V.value,"aria-expanded":T?"true":"false","aria-haspopup":"listbox","aria-controls":T?I:void 0,ref:R,onKeyDown:W,onKeyDownCapture:m?void 0:t=>{if(T)return;const e=Y(t,L,O);null!=e&&E(e)},disabled:C.disabled,onClick:()=>{j(!T)},className:ei(H.input,!N.unstyled&&d),children:$})})})});function g_(){const t=ba(t=>t.filter.selected);if(!t)return null;const e=xa().filter.getByName(t).options,n=(e,n)=>{var r;null==(r=xa().filter)||r.applyValue(t,e,n),ya().setDirty(!0)},i=xa().canvas.getMainImage().filters,o=xa().filter.findFilterIndex(t,i),s=null==i?void 0:i[o];if(e){const t=Object.entries(e).map(([t,e])=>{let i;const o=s?s[t]:e.current;return"slider"===e.type?i=(0,r.jsx)(u_,{label:(0,r.jsx)("span",{className:"capitalize",children:(0,r.jsx)(lv,{...Rp[t]})}),minValue:e.min,maxValue:e.max,step:e.step,defaultValue:o,formatOptions:{style:"percent"},size:"sm",onChange:e=>{n(t,e)}}):"colorPicker"===e.type?i=(0,r.jsx)(Qw,{label:(0,r.jsx)(lv,{...Rp[t]}),size:"sm",width:"w-full",value:o,onChange:e=>{n(t,e)}}):"select"===e.type&&(i=(0,r.jsx)(f_,{selectionMode:"single",size:"sm",label:(0,r.jsx)(lv,{...Rp[t]}),defaultValue:o,onSelectionChange:e=>{n(t,e)},children:e.available.map(t=>(0,r.jsx)(Yf,{value:t.key,children:(0,r.jsx)("span",{className:"capitalize",children:(0,r.jsx)(lv,{message:t.key})})},t.key))})),(0,r.jsx)("div",{className:"pb-10",children:i},t)});return(0,r.jsx)(ix,{children:(0,r.jsx)("div",{className:"max-w-240 pt-10 mx-auto",children:t})})}return null}function m_(){const t=ba(t=>t.frame.active),e="basic"===(null==t?void 0:t.mode),n=(0,i.useCallback)(t=>`${t}%`,[]);return(0,r.jsx)(ix,{className:"pb-18 pt-6",children:(0,r.jsxs)("div",{className:"max-w-288 m-auto",children:[e&&(0,r.jsx)(Qw,{className:"mb-20",width:"w-full",size:"sm",label:(0,r.jsx)(lv,{message:"Color"}),value:xa().frame.builder.defaultColor,onChange:t=>{xa().frame.active.changeColor(t)}}),(0,r.jsx)(u_,{size:"sm",label:(0,r.jsx)(lv,{message:"Size"}),step:1,minValue:xa().frame.active.getMinSize(),maxValue:xa().frame.active.getMaxSize(),defaultValue:xa().frame.active.currentSizeInPercent,getValueLabel:n,onChange:t=>{xa().frame.resize(t)}})]})})}const v_=i.createContext(null);function b_(){const{tabsRef:t,selectedTab:e}=(0,i.useContext)(v_),[n,o]=(0,i.useState)({width:void 0,transform:void 0,className:void 0});return Id(()=>{if(null!=e&&t.current){const n=t.current[e];if(!n)return;o(t=>({width:`${n.offsetWidth}px`,transform:`translateX(${n.offsetLeft}px)`,className:void 0===t.width?"":"transition-all"}))}},[o,e,t]),(0,r.jsx)("div",{className:ei("absolute bottom-0 left-0 h-2 bg-primary",n.className),role:"presentation",style:{width:n.width,transform:n.transform}})}function y_({children:t,center:e,expand:n,className:o}){const s=i.Children.toArray(t);return(0,r.jsx)(Im,{children:(0,r.jsxs)("div",{className:ei("flex relative max-w-full overflow-auto border-b max-sm:hidden-scrollbar md:compact-scrollbar",o),role:"tablist","aria-orientation":"horizontal",children:[s.map((t,r)=>(0,i.isValidElement)(t)?(0,i.cloneElement)(t,{index:r,className:ei(t.props.className,n&&"flex-auto",e&&0===r&&"ml-auto",e&&r===s.length-1&&"mr-auto")}):null),(0,r.jsx)(b_,{})]})})}function x_(t){const{size:e="md",children:n,className:o,isLazy:s,overflow:a="overflow-hidden"}=t,l=(0,i.useRef)([]),c=(0,i.useId)(),[u,h]=rp(t.selectedTab,t.defaultSelectedTab||0,t.onTabChange),d=(0,i.useMemo)(()=>({selectedTab:u,setSelectedTab:h,tabsRef:l,size:e,isLazy:s,id:c}),[u,c,s,h,e]);return(0,r.jsx)(v_.Provider,{value:d,children:(0,r.jsx)("div",{className:ei(o,a,"max-w-full"),children:n})})}const w_=ii((0,r.jsx)("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"),__=ii((0,r.jsx)("path",{d:"M10 19h4v-3h-4v3zM5 4v3h5v3h4V7h5V4H5zM3 14h18v-2H3v2z"}),"FormatStrikethroughOutlined"),C_=ii((0,r.jsx)("path",{d:"M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4h-8z"}),"FormatItalicOutlined"),S_=ii((0,r.jsx)("path",{d:"M3 21h18v-2H3v2zm6-4h12v-2H9v2zm-6-4h18v-2H3v2zm6-4h12V7H9v2zM3 3v2h18V3H3z"}),"FormatAlignRightOutlined"),k_=ii((0,r.jsx)("path",{d:"M15 15H3v2h12v-2zm0-8H3v2h12V7zM3 13h18v-2H3v2zm0 8h18v-2H3v2zM3 3v2h18V3H3z"}),"FormatAlignLeftOutlined"),T_=ii((0,r.jsx)("path",{d:"M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z"}),"FormatAlignCenterOutlined");function j_(){return(0,r.jsxs)("div",{className:"flex gap-20 justify-center",children:[(0,r.jsx)(O_,{}),(0,r.jsx)(E_,{}),(0,r.jsx)(M_,{})]})}function O_(){const t=ba(t=>t.objects.active.editableProps.fontSize)??40,{trans:e}=Xw();return(0,r.jsx)(Gv,{type:"number",size:"xs","aria-label":e({message:"Font Size"}),min:1,max:300,className:"w-64 flex-shrink-0",value:t,onChange:t=>{xa().objects.setValues({fontSize:t.target.valueAsNumber}),ya().setDirty(!0)}})}function E_(){const t=ba(t=>t.objects.active.editableProps.fontStyle),e=ba(t=>t.objects.active.editableProps.underline),n=ba(t=>t.objects.active.editableProps.linethrough),[o,s]=(0,i.useState)([t,e&&"underline",n&&"linethrough"]);return(0,r.jsxs)(ib,{size:"xs",variant:"outline",radius:"rounded",value:o,multiple:!0,onChange:t=>{s(t),xa().objects.setValues({underline:t.includes("underline"),linethrough:t.includes("linethrough"),fontStyle:t.includes("italic")?"italic":""}),ya().setDirty(!0)},children:[(0,r.jsx)(Jv,{value:"underline",children:(0,r.jsx)(w_,{})}),(0,r.jsx)(Jv,{value:"linethrough",children:(0,r.jsx)(__,{})}),(0,r.jsx)(Jv,{value:"italic",children:(0,r.jsx)(C_,{})})]})}function M_(){const t=ba(t=>t.objects.active.editableProps.textAlign);return(0,r.jsxs)(ib,{size:"xs",variant:"outline",radius:"rounded",value:t,onChange:t=>{xa().objects.setValues({textAlign:t}),ya().setDirty(!0)},children:[(0,r.jsx)(Jv,{value:"left",children:(0,r.jsx)(k_,{})}),(0,r.jsx)(Jv,{value:"center",children:(0,r.jsx)(T_,{})}),(0,r.jsx)(Jv,{value:"right",children:(0,r.jsx)(S_,{})})]})}function P_({children:t,className:e}){const{selectedTab:n,isLazy:o}=(0,i.useContext)(v_),s=i.Children.toArray(t).filter(t=>!!t);let a;if(o){const t=s[n];a=(0,i.isValidElement)(t)?(0,i.cloneElement)(s[n],{index:n}):null}else a=s.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:ei(t.props.className,"hidden")})}return null});return(0,r.jsx)("div",{className:e,children:a})}function A_({className:t,children:e,index:n,...o}){const{id:s}=(0,i.useContext)(v_),[a,l]=(0,i.useState)(0),c=(0,i.useRef)(null);return Id(()=>{if(null!=c&&c.current){const t=()=>{const t=Xm(c.current,{tabbable:!0});l(t.nextNode()?void 0:0)};t();const e=new MutationObserver(t);return e.observe(c.current,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["tabIndex","disabled"]}),()=>{e.disconnect()}}},[c]),(0,r.jsx)("div",{tabIndex:a,ref:c,id:`${s}-${n}-tabpanel`,"aria-labelledby":`${s}-${n}-tab`,className:ei(t,"focus-visible:outline-primary-light"),role:"tabpanel",...o,children:e})}const D_=[{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)"}]}],I_=ii((0,r.jsx)("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"),R_=ii((0,r.jsx)("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"),z_=ii((0,r.jsx)("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 L_({property:t}){const{trans:e}=Xw(),n=ba(e=>e.objects.active.editableProps[t]);return(0,r.jsxs)("div",{className:"flex items-center justify-center gap-14",children:[(0,r.jsx)(Qw,{className:"flex-shrink-0",size:"xs","aria-label":e({message:"Color"}),value:"string"==typeof n?n:qr.fill,onChange:e=>{xa().objects.setValues({[t]:e}),ya().setDirty(!0)}}),(0,r.jsx)(F_,{type:"gradient",property:t}),(0,r.jsx)(F_,{type:"texture",property:t})]})}function F_({type:t,property:e}){const n="texture"===t?(0,r.jsx)(I_,{}):(0,r.jsx)(R_,{});return(0,r.jsx)(i.Fragment,{children:(0,r.jsxs)(Jw,{type:"popover",children:[(0,r.jsx)(Bf,{className:"flex-shrink-0",id:`${t}-panel-trigger`,variant:"outline",size:"xs",startIcon:n,endIcon:(0,r.jsx)(Kw,{}),children:(0,r.jsx)("span",{className:"capitalize",children:"gradient"===t?(0,r.jsx)(lv,{message:"Gradient"}):(0,r.jsx)(lv,{message:"Texture"})})}),(0,r.jsx)(qw,{size:"auto",children:(0,r.jsx)("div",{className:"grid gap-8 grid-cols-5-min-content p-10 bg-paper rounded shadow-md",children:(0,r.jsx)(N_,{property:e,type:t})})})]})})}function N_({type:t,property:e}){const{close:n}=Uw(),o=Array.from(Array("gradient"===t?D_.length:28).keys()),s="w-56 h-56 bg border shadow-sm hover:scale-110",a=o.map(i=>{const o=Tp(`images/${t}s/${i}.png`);return(0,r.jsx)(Nf,{radius:"rounded",className:s,style:{backgroundImage:`url(${o})`},"aria-label":`Select ${t} #${i}`,onClick:async()=>{n();const r="gradient"===t?new ap.fabric.Gradient(D_[i]):await V_(o);xa().objects.setValues({[e]:r}),ya().setDirty(!0)}},i)});return"texture"===t&&a.unshift((0,r.jsx)(B_,{property:e,className:s},"upload-btn")),(0,r.jsx)(i.Fragment,{children:a})}function B_({className:t,property:e}){const{close:n}=Uw();return(0,r.jsx)(Nf,{radius:"rounded",className:t,"aria-label":"Upload an image",onClick:async()=>{const t=await xa().import.openUploadWindow();if(n(),t){const n=await V_(await t.data);xa().objects.setValues({[e]:n})}},children:(0,r.jsx)(z_,{className:"icon-md"})})}function V_(t){return new Promise(e=>{ap.fabric.util.loadImage(t,t=>{const n=new ap.fabric.Pattern({source:t,repeat:"repeat"});e(n)})})}function $_(){const t=ba(t=>t.objects.active.editableProps.opacity);return(0,r.jsx)(u_,{className:"max-w-240 w-full mx-auto","aria-label":"Opacity",value:t,minValue:.1,step:.1,maxValue:1,onChange:t=>{xa().objects.setValues({opacity:t}),ya().setDirty(!0)}})}function H_(){const{trans:t}=Xw(),e=ba(t=>t.objects.active.editableProps.stroke),n=ba(t=>t.objects.active.editableProps.strokeWidth);return(0,r.jsxs)("div",{className:"flex items-center gap-40",children:[(0,r.jsx)(Qw,{className:"ml-auto flex-shrink-0",size:"xs",value:e,"aria-label":t({message:"Outline Color"}),onChange:t=>{xa().objects.setValues({stroke:t}),ya().setDirty(!0)}}),(0,r.jsx)(u_,{"aria-label":"Outline Width",className:"max-w-240 mr-auto flex-shrink-0",value:n,onChange:t=>{xa().objects.setValues({strokeWidth:t}),ya().setDirty(!0)}})]})}const W_=ii((0,r.jsx)("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 U_(){return(0,r.jsx)("div",{className:"flex justify-center",children:(0,r.jsx)(Bf,{type:"button",variant:"outline",size:"xs",startIcon:(0,r.jsx)(W_,{}),radius:"rounded-full",onClick:async()=>{const t=await xa().import.openUploadWindow();if(t){const e=xa().objects.getActive();if(e&&"setSrc"in e){const n=await t.data;e.setSrc(n,()=>{bp({src:n}),xa().canvas.render()})}}},children:(0,r.jsx)(lv,{message:"Replace Image"})})})}const X_={color:"rgba(0, 0, 0, 0.6)",blur:3,offsetX:-1,offsetY:0};function Y_(){const{trans:t}=Xw(),e=ba(t=>t.objects.active.editableProps.shadow)||X_;return(0,r.jsxs)("div",{className:"flex items-center gap-40",children:[(0,r.jsx)(Qw,{className:"ml-auto flex-shrink-0",value:e.color,size:"xs","aria-label":t({message:"Shadow Color"}),onChange:t=>{xa().objects.setValues({shadow:G_({color:t})}),ya().setDirty(!0)}}),(0,r.jsx)(u_,{"aria-label":"Shadow Blur",className:"max-w-240 mr-auto flex-shrink-0",defaultValue:e.blur,onChange:t=>{xa().objects.setValues({shadow:G_({blur:t})}),ya().setDirty(!0)}})]})}function G_(t){var e;const n=null==(e=xa().objects.getActive())?void 0:e.shadow;return n?(Object.entries(t).forEach(([t,e])=>{n[t]=e}),n):new ap.fabric.Shadow({...X_,...t})}function q_({index:t,className:e,isDisabled:n,children:o,padding:s,elementType:a="button",to:l,relative:c,width:u="min-w-min"}){const{selectedTab:h,setSelectedTab:d,tabsRef:p,size:f="md",id:g}=(0,i.useContext)(v_),m=t===h,v=function(){var t;return null===(t=(0,i.useContext)(Am))||void 0===t?void 0:t.focusManager}(),b=s||("sm"===f?"px-12":"px-18"),y=ei("tracking-wide overflow-hidden capitalize text-sm flex items-center justify-center outline-none transition-colors","focus-visible:ring focus-visible:ring-2 ring-inset rounded whitespace-nowrap cursor-pointer",u,function({isDisabled:t,isSelected:e}){return t?"text-disabled cursor-default":e?"text-primary":"text-muted hover:text-main"}({isDisabled:n,isSelected:m}),e,"md"===f&&`${b} h-48`,"sm"===f&&`${b} h-32`,n&&"pointer-events-none"),x=m?0:-1;return(0,r.jsx)(a,{disabled:n,id:`${g}-${t}-tab`,"aria-controls":`${g}-${t}-tabpanel`,type:"button",role:"tab","aria-selected":m,tabIndex:n?void 0:x,onKeyDown:t=>{switch(t.key){case"ArrowLeft":null==v||v.focusPrevious();break;case"ArrowRight":null==v||v.focusNext();break;case"Home":null==v||v.focusFirst();break;case"End":null==v||v.focusLast()}},onClick:()=>{d(t)},to:l,relative:c,className:y,ref:e=>{p.current&&e&&(p.current[t]=e)},children:o})}function K_(){const t=ba(t=>t.objects.active);return(0,r.jsxs)(x_,{size:"sm",className:"pb-18 pt-6",children:[(0,r.jsxs)(y_,{center:!0,children:[t.isText&&(0,r.jsx)(q_,{children:(0,r.jsx)(lv,{message:"Font"})}),!t.isImage&&(0,r.jsx)(q_,{children:(0,r.jsx)(lv,{message:"Color"})}),!t.isImage&&(0,r.jsx)(q_,{children:(0,r.jsx)(lv,{message:"Background"})}),t.isImage&&(0,r.jsx)(q_,{children:(0,r.jsx)(lv,{message:"Image"})}),(0,r.jsx)(q_,{children:(0,r.jsx)(lv,{message:"Opacity"})}),(0,r.jsx)(q_,{children:(0,r.jsx)(lv,{message:"Outline"})}),(0,r.jsx)(q_,{children:(0,r.jsx)(lv,{message:"Shadow"})})]}),(0,r.jsxs)(P_,{className:"pt-16 h-50",children:[t.isText&&(0,r.jsx)(A_,{children:(0,r.jsx)(j_,{})},"font"),!t.isImage&&(0,r.jsx)(A_,{children:(0,r.jsx)(L_,{property:"fill"})}),!t.isImage&&(0,r.jsx)(A_,{children:(0,r.jsx)(L_,{property:"backgroundColor"})}),t.isImage&&(0,r.jsx)(A_,{children:(0,r.jsx)(U_,{})}),(0,r.jsx)(A_,{children:(0,r.jsx)($_,{})}),(0,r.jsx)(A_,{children:(0,r.jsx)(H_,{})}),(0,r.jsx)(A_,{children:(0,r.jsx)(Y_,{})})]})]})}function Z_(){const t=!gv()&&(0,r.jsx)(Bf,{size:"sm",color:"primary",variant:"outline",onClick:()=>{xa().text.add(),ya().setDirty(!0)},children:(0,r.jsx)(lv,{message:"New Text"})});return(0,r.jsx)(ix,{actionBtn:t,children:(0,r.jsx)(K_,{})})}const J_=ii((0,r.jsx)("path",{d:"m20 12-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"}),"ArrowDownwardOutlined"),Q_={};let tC=!1,eC=null,nC=null;const rC=t=>{var e;for(const n in Q_)n!==t&&(null==(e=Q_[n])||e.call(Q_,!0),delete Q_[n])},iC=(0,i.forwardRef)(({children:t,label:e,placement:n="top",offset:o=10,variant:a="neutral",delay:l=1500,isDisabled:c,usePortal:u=!0,...h},d)=>{const{x:p,y:f,reference:g,strategy:m,arrowRef:v,arrowStyle:b,refs:y}=fm({placement:n,offset:o,ref:d,showArrow:!0}),[x,w]=(0,i.useState)(!1),_=(0,i.useId)(),C=(0,i.useRef)(),S=()=>{clearTimeout(C.current),C.current=void 0,rC(_),Q_[_]=k,tC=!0,w(!0),eC&&(clearTimeout(eC),eC=null),nC&&(clearTimeout(nC),nC=null)},k=(0,i.useCallback)(t=>{t?(clearTimeout(C.current),C.current=void 0,w(!1)):C.current||(C.current=setTimeout(()=>{C.current=void 0,w(!1)},500)),eC&&(clearTimeout(eC),eC=null),tC&&(nC&&clearTimeout(nC),nC=setTimeout(()=>{delete Q_[_],nC=null,tC=!1},500))},[_]),T=t=>{!t&&l>0&&!C.current?(rC(_),Q_[_]=k,x||eC||tC?x||S():eC=setTimeout(()=>{eC=null,tC=!0,S()},l)):S()};(0,i.useEffect)(()=>()=>{clearTimeout(C.current),Q_[_]&&delete Q_[_]},[_]),(0,i.useEffect)(()=>{const t=t=>{"Escape"===t.key&&k(!0)};if(x)return document.addEventListener("keydown",t,!0),()=>{document.removeEventListener("keydown",t,!0)}},[x,k]);const j=(0,r.jsx)(Md,{children:x&&(0,r.jsxs)(Cd.div,{...Zm,ref:y.setFloating,id:_,role:"tooltip",onPointerEnter:()=>{T(!0)},onPointerLeave:()=>{k()},className:ei("z-tooltip my-4 max-w-240 break-words rounded px-8 py-4 text-xs text-white shadow","positive"===a&&"bg-positive","danger"===a&&"bg-danger","neutral"===a&&"bg-toast"),style:{position:m,top:f??"",left:p??""},children:[(0,r.jsx)("div",{ref:v,className:"absolute h-8 w-8 rotate-45 bg-inherit",style:b}),e]})});return(0,r.jsxs)(i.Fragment,{children:[(0,i.cloneElement)(t,Ud({"aria-describedby":x?_:void 0,ref:g,onPointerEnter:t=>{"mouse"===t.pointerType&&T()},onFocus:t=>{t.target.matches(":focus-visible")&&T(!0)},onPointerLeave:t=>{"mouse"===t.pointerType&&k()},onPointerDown:()=>{k(!0)},onBlur:()=>{k()},"aria-label":"string"==typeof e?e:e.props.message},h)),u?ha&&(0,s.createPortal)(j,ha):j]})});function oC(){const t=function(t,e){switch(t){case ss.Filter:return(0,r.jsx)(g_,{});case ss.Frame:return(0,r.jsx)(m_,{});case ss.Text:return e&&(0,r.jsx)(Z_,{});case ss.ActiveObject:return e&&(0,r.jsx)(K_,{});default:return null}}(ba(t=>t.activeToolOverlay),ba(t=>t.objects.active.id)),[e,n]=(0,i.useState)(!0);return(0,r.jsxs)("div",{className:"relative z-tool-overlay text-sm",children:[t&&(0,r.jsx)("div",{className:ei("absolute right-16 text-muted z-50 transition-all",!e&&"rotate-180",e?"-top-144":"-top-40"),children:(0,r.jsx)(iC,{label:e?(0,r.jsx)(lv,{message:"Hide options"}):(0,r.jsx)(lv,{message:"Show options"}),children:(0,r.jsx)(Jv,{variant:"outline",radius:"rounded-lg",size:"xs",onClick:()=>{n(!e)},children:(0,r.jsx)(J_,{})})})}),(0,r.jsx)(Md,{children:t&&e&&(0,r.jsx)(Cd.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 sC=ii((0,r.jsx)("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 aC({filter:t}){const e=ba(e=>e.filter.applied.includes(t)),n=xa().filter.hasOptions(t),o=ei("block flex-shrink-0 rounded",{"text-primary border-primary":e}),s=Ip[t],a=(0,r.jsxs)(i.Fragment,{children:[(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)(lC,{filter:t}),e&&(0,r.jsx)(cC,{filter:t,hasOptions:n})]}),(0,r.jsx)("div",{className:"mt-4 text-center text-xs capitalize",children:s?(0,r.jsx)(lv,{...s}):t})]});return e&&n?(0,r.jsx)("div",{className:o,children:a}):(0,r.jsx)(Nf,{className:o,onClick:()=>{e?xa().filter.remove(t):xa().filter.apply(t)},children:a})}function lC({filter:t}){const e=ei("m-auto w-96 h-56 border rounded object-cover",{shadow:ba(e=>e.filter.selected===t)});return(0,r.jsx)("img",{src:Tp(`images/filter/${t}.jpg`),className:e,alt:""})}function cC({filter:t,hasOptions:e}){return(0,r.jsxs)("div",{className:"flex items-center justify-center bg-background/70 absolute inset-0 border-2 border-primary rounded",children:[e?(0,r.jsx)(Jv,{color:"primary",size:"md",onClick:()=>{xa().filter.remove(t)},children:(0,r.jsx)(sC,{})}):(0,r.jsx)(sC,{className:"svg-icon icon-md"}),e&&(0,r.jsx)(uC,{filter:t,hasOptions:e})]})}function uC({filter:t,hasOptions:e}){return(0,r.jsx)(Jv,{color:"primary",size:"md",onClick:()=>{ya().activeToolOverlay===ss.Filter&&ya().filter.selected===t?ya().setActiveTool(ya().activeTool,null):ya().filter.select(t,e)},children:(0,r.jsx)(ai,{})})}const hC=(0,i.forwardRef)(({children:t,className:e,gap:n="gap-10"},o)=>{const s=i.Children.map(t,(e,n)=>i.isValidElement(e)?i.cloneElement(e,{isFirst:0===n,isLast:i.Children.count(t)===n+1}):e);return(0,r.jsx)("div",{ref:o,className:ei("tiny-scrollbar pb-4 overflow-x-auto relative flex items-center",n,e),children:s})});function dC({isFirst:t,isLast:e,children:n,className:i}){const o=ei(i,"flex-shrink-0",{"ml-auto":t,"mr-auto":e});return(0,r.jsx)("div",{className:o,children:n})}function pC(){const t=ba(t=>{var e,n;return null==(n=null==(e=t.config.tools)?void 0:e.filter)?void 0:n.items})||[];(0,i.useEffect)(()=>{xa().filter.syncState()},[]);const e=t.map(t=>(0,r.jsx)(dC,{children:(0,r.jsx)(aC,{filter:t})},t));return(0,r.jsx)(hC,{children:e})}const fC=ii((0,r.jsx)("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"),gC=ii((0,r.jsx)("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"),mC=ii((0,r.jsx)("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"),vC=ii((0,r.jsx)("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"),bC=ii((0,r.jsx)("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"),yC=(0,i.forwardRef)((t,e)=>{const{size:n="md",children:o,className:s,icon:a,checkedIcon:l,disabled:c,isIndeterminate:u,errorMessage:h,invalid:d,orientation:p="horizontal",onChange:f,autoFocus:g,required:m,value:v,name:b,inputTestId:y}=t,x=Lv({...t,label:o}),w=a||mC,_=l||(u?bC:vC),C=tp(e);Xv({autoFocus:g},C),(0,i.useEffect)(()=>{C.current&&(C.current.indeterminate=u||!1)});const[S,k]=rp(t.checked,t.defaultChecked||!1),T=(0,i.useCallback)(t=>{null==f||f(t),k(t.target.checked)},[f,k]),j=ei("select-none",s,d&&"text-danger",!d&&c&&"text-disabled");let O,E=d?"text-danger":null;return u?(O=bC,E=E||"text-primary"):S?(O=_,E=E||"text-primary"):(O=w,E=E||"text-muted"),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:j,children:(0,r.jsxs)("div",{className:ei("relative flex items-center","vertical"===p&&"flex-col flex-col-reverse"),children:[(0,r.jsx)("input",{className:"absolute left-0 top-0 h-24 w-24 appearance-none overflow-hidden rounded outline-none ring-inset transition-shadow focus-visible:ring",type:"checkbox","aria-checked":u?"mixed":S,"aria-invalid":d||void 0,onChange:T,ref:C,required:m,disabled:c,value:v,name:b,"data-testid":y}),(0,r.jsx)(O,{size:n,className:ei("pointer-events-none",c?"text-disabled":E)}),o&&(0,r.jsx)("div",{className:ei("first-letter:capitalize",x.size.font,"vertical"===p?"mb-6":"ml-6"),children:o})]})}),h&&(0,r.jsx)("div",{className:x.error,children:h})]})});function xC(){const{trans:t}=Xw(),{minWidth:e=50,minHeight:n=50,maxHeight:o=2400,maxWidth:s=2400}=ba(t=>{var e;return null==(e=t.config.tools)?void 0:e.resize})||{},a=ba(t=>t.original),l=ba(t=>t.resize.formValue);(0,i.useEffect)(()=>{ya().resize.setFormValue({...a})},[a]),(0,i.useEffect)(()=>{ya().setDirty(!0)},[]);return(0,r.jsxs)("form",{className:"flex items-center justify-center gap-16 w-full",onSubmit:t=>{t.preventDefault(),ya().applyChanges()},children:[(0,r.jsx)(Gv,{type:"number",min:e,max:s,size:"sm",className:"w-full max-w-112",label:(0,r.jsx)(lv,{message:"Width"}),value:l.width,onChange:t=>{(t=>{const e={...l,width:t};l.maintainAspect&&(e.height=Hp(t,l.usePercentages)),ya().resize.setFormValue(e)})(t.target.valueAsNumber)}}),(0,r.jsx)("div",{className:"mt-24",children:(0,r.jsx)(yC,{size:"md",checked:l.maintainAspect,onChange:t=>{(t=>{const e={...l,maintainAspect:t};t&&(e.height=Hp(e.width,e.usePercentages)),ya().resize.setFormValue(e)})(!l.maintainAspect)},"aria-label":t({message:"Maintain aspect ratio"}),checkedIcon:fC,icon:gC})}),(0,r.jsx)(Gv,{type:"number",min:n,max:o,size:"sm",className:"w-full max-w-112",label:(0,r.jsx)(lv,{message:"Height"}),value:l.height,onChange:t=>{(t=>{const e={...l,height:t};t&&l.maintainAspect&&(e.width=$p(t,l.usePercentages)),ya().resize.setFormValue(e)})(t.target.valueAsNumber)}}),(0,r.jsx)("button",{type:"submit",className:"hidden",children:(0,r.jsx)(lv,{message:"Resize"})})]})}function wC(){const t=ba(t=>{var e,n;return null==(n=null==(e=t.config.tools)?void 0:e.crop)?void 0:n.presets})||[],e=ba(t=>t.crop.selectedAspectRatio),n=ba(t=>{var e,n;return null==(n=null==(e=t.config.tools)?void 0:e.crop)?void 0:n.allowCustomRatio})??!0,i=t.filter(t=>t.ratio||!t.ratio&&n).map(t=>(0,r.jsx)(dC,{children:(0,r.jsxs)(Nf,{onClick:()=>xa().crop.resetCropzone(t.ratio),className:"flex flex-col items-center justify-between cursor-pointer h-56",children:[(0,r.jsx)(_C,{preset:t,selectedRatio:e}),(0,r.jsx)(CC,{preset:t,selectedRatio:e})]})},t.ratio||t.name));return(0,r.jsx)(hC,{gap:"gap-18",children:i})}function _C({preset:t,selectedRatio:e}){let n=40,i=30;if(t.ratio){const e=Yp(t.ratio);({width:n,height:i}=Xp(e,n,i))}const o=ei("border-2",{"border-dotted":null===t.ratio,"border-primary":e===t.ratio});return(0,r.jsx)("div",{style:{width:`${n}px`,height:`${i}px`},className:o})}function CC({preset:t,selectedRatio:e}){const n=ei("mt-4 text-center text-xs",{"text-primary":e===t.ratio});return(0,r.jsx)("div",{className:n,children:t.name?(0,r.jsx)(lv,{message:t.name}):t.ratio})}const SC=ii((0,r.jsx)("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 kC(){return(0,r.jsxs)("div",{children:[(0,r.jsx)(Jv,{size:"sm",onClick:()=>{xa().transform.flip("vertical"),ya().setDirty(!0)},children:(0,r.jsx)(SC,{})}),(0,r.jsx)(Jv,{size:"sm",onClick:()=>{xa().transform.flip("horizontal"),ya().setDirty(!0)},children:(0,r.jsx)(SC,{className:"rotate-90"})})]})}const TC=ii((0,r.jsx)("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"),jC=ii((0,r.jsx)("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 OC(){return(0,r.jsxs)("div",{children:[(0,r.jsx)(Jv,{size:"sm",onClick:()=>{xa().transform.rotateLeft(),ya().setDirty(!0)},children:(0,r.jsx)(TC,{})}),(0,r.jsx)(Jv,{size:"sm",onClick:()=>{xa().transform.rotateRight(),ya().setDirty(!0)},children:(0,r.jsx)(jC,{})})]})}function EC(){return(0,r.jsxs)("div",{className:"flex items-center justify-center gap-16",children:[(0,r.jsx)(kC,{}),(0,r.jsx)(MC,{}),(0,r.jsx)(OC,{})]})}function MC(){const t=(0,i.useRef)(null),{domProps:e,groupId:n,thumbIds:o,trackRef:s,getThumbValueLabel:a}=a_({minValue:-45,maxValue:45,step:1,defaultValue:[ya().crop.straightenAngle],onChange:e=>{const n=e[0];xa().transform.straighten(n),ya().crop.setTransformAngle(n),ya().setDirty(!0),t.current.style.transform=`translateX(${n}px)`}});return(0,r.jsx)("div",{id:n,role:"group",className:"flex-auto flex-shrink-0 max-w-320 touch-none isolate",children:(0,r.jsxs)("div",{...e,ref:s,className:"h-36 relative",children:[(0,r.jsxs)("output",{htmlFor:o[0],"aria-live":"off",className:"absolute left-1/2 top-1/2 w-40 text-center bg -translate-x-1/2 -translate-y-1/2 z-10",children:[a(0),"\xb0"]}),(0,r.jsx)(PC,{ref:t})]})})}const PC=i.forwardRef((t,e)=>{const n=[...Array(80).keys()],i=n.map(t=>(0,r.jsx)("circle",{cx:2+10*t,cy:"20",r:t%5?.75:2},t));return(0,r.jsx)("div",{className:"relative h-full cursor-pointer overflow-hidden",children:(0,r.jsx)("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:i})})});function AC(){return(0,i.useEffect)(()=>(ya().setDirty(!0),xa().frame.active.hide(),()=>{xa().frame.active.show()}),[]),(0,r.jsxs)("div",{className:"pb-16",children:[(0,r.jsx)("div",{className:"mb-10",children:(0,r.jsx)(EC,{})}),(0,r.jsx)(wC,{})]})}const DC=ii((0,r.jsx)("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 "})),IC=ii((0,r.jsx)("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 "})),RC=ii((0,r.jsx)("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 "})),zC=ii((0,r.jsx)("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 LC(){const t=(ba(t=>{var e,n;return null==(n=null==(e=t.config.tools)?void 0:e.shapes)?void 0:n.items})||[]).map(t=>(0,r.jsx)(dC,{children:(0,r.jsx)(Jv,{variant:"outline",radius:"rounded-2xl",size:"xl",onClick:()=>{xa().shape.addBasicShape(t.name),ya().setDirty(!0)},children:(0,r.jsx)(FC,{shape:t})})},t.name));return(0,r.jsx)(hC,{children:t})}function FC({shape:t}){var e;return"Path"===t.type?(0,r.jsx)("svg",{className:"m-auto w-36 h-36",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 -100 512 700",children:(0,r.jsx)("path",{className:"fill-transparent stroke-current",d:null==(e=t.options)?void 0:e.path,strokeWidth:25})}):i.cloneElement(NC[t.name],{className:"w-30 h-30"})}const NC={circle:(0,r.jsx)(IC,{viewBox:"0 0 32 32"}),square:(0,r.jsx)(RC,{viewBox:"0 0 32 32"}),triangle:(0,r.jsx)(zC,{viewBox:"0 0 32 32"}),ellipse:(0,r.jsx)(DC,{viewBox:"0 0 32 32"})};function BC(t,e,n){let r,i=n.initialDeps??[];return()=>{var o,s,a,l;let c;n.key&&null!=(o=n.debug)&&o.call(n)&&(c=Date.now());const u=t();if(u.length===i.length&&!u.some((t,e)=>i[e]!==t))return r;let h;if(i=u,n.key&&null!=(s=n.debug)&&s.call(n)&&(h=Date.now()),r=e(...u),n.key&&null!=(a=n.debug)&&a.call(n)){Math.round(100*(Date.now()-c)),Math.round(100*(Date.now()-h))}return null==(l=null==n?void 0:n.onChange)||l.call(n,r),r}}function VC(t,e){if(void 0===t)throw new Error("Unexpected undefined"+(e?`: ${e}`:""));return t}const $C=(t,e,n)=>{let r;return function(...i){t.clearTimeout(r),r=t.setTimeout(()=>e.apply(this,i),n)}},HC=t=>t,WC=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},UC=(t,e)=>{const n=t.scrollElement;if(!n)return;const r=t.targetWindow;if(!r)return;const i=t=>{const{width:n,height:r}=t;e({width:Math.round(n),height:Math.round(r)})};if(i(n.getBoundingClientRect()),!r.ResizeObserver)return()=>{};const o=new r.ResizeObserver(t=>{const e=t[0];if(null!=e&&e.borderBoxSize){const t=e.borderBoxSize[0];if(t)return void i({width:t.inlineSize,height:t.blockSize})}i(n.getBoundingClientRect())});return o.observe(n,{box:"border-box"}),()=>{o.unobserve(n)}},XC={passive:!0},YC=typeof window>"u"||"onscrollend"in window,GC=(t,e)=>{const n=t.scrollElement;if(!n)return;const r=t.targetWindow;if(!r)return;let i=0;const o=YC?()=>{}:$C(r,()=>{e(i,!1)},t.options.isScrollingResetDelay),s=r=>()=>{i=n[t.options.horizontal?"scrollLeft":"scrollTop"],o(),e(i,r)},a=s(!0),l=s(!1);return l(),n.addEventListener("scroll",a,XC),n.addEventListener("scrollend",l,XC),()=>{n.removeEventListener("scroll",a),n.removeEventListener("scrollend",l)}},qC=(t,e,n)=>{if(null!=e&&e.borderBoxSize){const t=e.borderBoxSize[0];if(t)return Math.round(t[n.options.horizontal?"inlineSize":"blockSize"])}return Math.round(t.getBoundingClientRect()[n.options.horizontal?"width":"height"])},KC=(t,{adjustments:e=0,behavior:n},r)=>{var i,o;const s=t+e;null==(o=null==(i=r.scrollElement)?void 0:i.scrollTo)||o.call(i,{[r.options.horizontal?"left":"top"]:s,behavior:n})};class ZC{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollDirection=null,this.scrollAdjustments=0,this.measureElementCache=new Map,this.observer=(()=>{let t=null;const e=()=>t||(this.targetWindow&&this.targetWindow.ResizeObserver?t=new this.targetWindow.ResizeObserver(t=>{t.forEach(t=>{this._measureElement(t.target,t)})}):null);return{disconnect:()=>{var t;return null==(t=e())?void 0:t.disconnect()},observe:t=>{var n;return null==(n=e())?void 0:n.observe(t,{box:"border-box"})},unobserve:t=>{var n;return null==(n=e())?void 0:n.unobserve(t)}}})(),this.range=null,this.setOptions=t=>{Object.entries(t).forEach(([e,n])=>{typeof n>"u"&&delete t[e]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:HC,rangeExtractor:WC,onChange:()=>{},measureElement:qC,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,...t}},this.notify=(t,e)=>{var n,r;const{startIndex:i,endIndex:o}=this.range??{startIndex:void 0,endIndex:void 0},s=this.calculateRange();(t||i!==(null==s?void 0:s.startIndex)||o!==(null==s?void 0:s.endIndex))&&(null==(r=(n=this.options).onChange)||r.call(n,this,e))},this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.scrollElement=null},this._didMount=()=>(this.measureElementCache.forEach(this.observer.observe),()=>{this.observer.disconnect(),this.cleanup()}),this._willUpdate=()=>{var t;const e=this.options.getScrollElement();this.scrollElement!==e&&(this.cleanup(),this.scrollElement=e,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=(null==(t=this.scrollElement)?void 0:t.window)??null,this._scrollToOffset(this.scrollOffset,{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,t=>{this.scrollRect=t,this.notify(!1,!1)})),this.unsubs.push(this.options.observeElementOffset(this,(t,e)=>{this.scrollAdjustments=0,this.scrollDirection=e?this.scrollOffset<t?"forward":"backward":null,this.scrollOffset=t;const n=this.isScrolling;this.isScrolling=e,this.notify(n!==e,e)})))},this.getSize=()=>this.scrollRect[this.options.horizontal?"width":"height"],this.getMeasurementOptions=BC(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey],(t,e,n,r)=>(this.pendingMeasuredCacheIndexes=[],{count:t,paddingStart:e,scrollMargin:n,getItemKey:r}),{key:!1}),this.getFurthestMeasurement=(t,e)=>{const n=new Map,r=new Map;for(let i=e-1;i>=0;i--){const e=t[i];if(n.has(e.lane))continue;const o=r.get(e.lane);if(null==o||e.end>o.end?r.set(e.lane,e):e.end<o.end&&n.set(e.lane,!0),n.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort((t,e)=>t.end===e.end?t.index-e.index:t.end-e.end)[0]:void 0},this.getMeasurements=BC(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:e,scrollMargin:n,getItemKey:r},i)=>{const o=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const s=this.measurementsCache.slice(0,o);for(let a=o;a<t;a++){const t=r(a),o=1===this.options.lanes?s[a-1]:this.getFurthestMeasurement(s,a),l=o?o.end+this.options.gap:e+n,c=i.get(t),u="number"==typeof c?c:this.options.estimateSize(a),h=l+u,d=o?o.lane:a%this.options.lanes;s[a]={index:a,start:l,size:u,end:h,key:t,lane:d}}return this.measurementsCache=s,s},{key:!1,debug:()=>this.options.debug}),this.calculateRange=BC(()=>[this.getMeasurements(),this.getSize(),this.scrollOffset],(t,e,n)=>this.range=t.length>0&&e>0?function({measurements:t,outerSize:e,scrollOffset:n}){const r=t.length-1,i=JC(0,r,e=>t[e].start,n);let o=i;for(;o<r&&t[o].end<n+e;)o++;return{startIndex:i,endIndex:o}}({measurements:t,outerSize:e,scrollOffset:n}):null,{key:!1,debug:()=>this.options.debug}),this.getIndexes=BC(()=>[this.options.rangeExtractor,this.calculateRange(),this.options.overscan,this.options.count],(t,e,n,r)=>null===e?[]:t({startIndex:e.startIndex,endIndex:e.endIndex,overscan:n,count:r}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const e=this.options.indexAttribute,n=t.getAttribute(e);return n?parseInt(n,10):-1},this._measureElement=(t,e)=>{const n=this.measurementsCache[this.indexFromElement(t)];if(!n||!t.isConnected)return void this.measureElementCache.forEach((e,n)=>{e===t&&(this.observer.unobserve(t),this.measureElementCache.delete(n))});const r=this.measureElementCache.get(n.key);r!==t&&(r&&this.observer.unobserve(r),this.observer.observe(t),this.measureElementCache.set(n.key,t));const i=this.options.measureElement(t,e,this);this.resizeItem(n,i)},this.resizeItem=(t,e)=>{const n=e-(this.itemSizeCache.get(t.key)??t.size);0!==n&&((void 0!==this.shouldAdjustScrollPositionOnItemSizeChange?this.shouldAdjustScrollPositionOnItemSizeChange(t,n,this):t.start<this.scrollOffset+this.scrollAdjustments)&&this._scrollToOffset(this.scrollOffset,{adjustments:this.scrollAdjustments+=n,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(t.index),this.itemSizeCache=new Map(this.itemSizeCache.set(t.key,e)),this.notify(!0,!1))},this.measureElement=t=>{t&&this._measureElement(t,void 0)},this.getVirtualItems=BC(()=>[this.getIndexes(),this.getMeasurements()],(t,e)=>{const n=[];for(let r=0,i=t.length;r<i;r++){const i=e[t[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const e=this.getMeasurements();return VC(e[JC(0,e.length-1,t=>VC(e[t]).start,t)])},this.getOffsetForAlignment=(t,e)=>{const n=this.getSize();"auto"===e&&(e=t<=this.scrollOffset?"start":t>=this.scrollOffset+n?"end":"start"),"start"===e||("end"===e?t-=n:"center"===e&&(t-=n/2));const r=this.options.horizontal?"scrollWidth":"scrollHeight",i=(this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[r]:this.scrollElement[r]:0)-this.getSize();return Math.max(Math.min(i,t),0)},this.getOffsetForIndex=(t,e="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const n=VC(this.getMeasurements()[t]);if("auto"===e)if(n.end>=this.scrollOffset+this.getSize()-this.options.scrollPaddingEnd)e="end";else{if(!(n.start<=this.scrollOffset+this.options.scrollPaddingStart))return[this.scrollOffset,e];e="start"}const r="end"===e?n.end+this.options.scrollPaddingEnd:n.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(r,e),e]},this.isDynamicMode=()=>this.measureElementCache.size>0,this.cancelScrollToIndex=()=>{null!==this.scrollToIndexTimeoutId&&this.targetWindow&&(this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId),this.scrollToIndexTimeoutId=null)},this.scrollToOffset=(t,{align:e="start",behavior:n}={})=>{this.cancelScrollToIndex(),"smooth"===n&&this.isDynamicMode(),this._scrollToOffset(this.getOffsetForAlignment(t,e),{adjustments:void 0,behavior:n})},this.scrollToIndex=(t,{align:e="auto",behavior:n}={})=>{t=Math.max(0,Math.min(t,this.options.count-1)),this.cancelScrollToIndex(),"smooth"===n&&this.isDynamicMode();const[r,i]=this.getOffsetForIndex(t,e);this._scrollToOffset(r,{adjustments:void 0,behavior:n}),"smooth"!==n&&this.isDynamicMode()&&this.targetWindow&&(this.scrollToIndexTimeoutId=this.targetWindow.setTimeout(()=>{if(this.scrollToIndexTimeoutId=null,this.measureElementCache.has(this.options.getItemKey(t))){const[e]=this.getOffsetForIndex(t,i);((t,e)=>Math.abs(t-e)<1)(e,this.scrollOffset)||this.scrollToIndex(t,{align:i,behavior:n})}else this.scrollToIndex(t,{align:i,behavior:n})}))},this.scrollBy=(t,{behavior:e}={})=>{this.cancelScrollToIndex(),"smooth"===e&&this.isDynamicMode(),this._scrollToOffset(this.scrollOffset+t,{adjustments:void 0,behavior:e})},this.getTotalSize=()=>{var t;const e=this.getMeasurements();let n;return n=0===e.length?this.options.paddingStart:1===this.options.lanes?(null==(t=e[e.length-1])?void 0:t.end)??0:Math.max(...e.slice(-this.options.lanes).map(t=>t.end)),n-this.options.scrollMargin+this.options.paddingEnd},this._scrollToOffset=(t,{adjustments:e,behavior:n})=>{this.options.scrollToFn(t,{behavior:n,adjustments:e},this)},this.measure=()=>{var t,e;this.itemSizeCache=new Map,null==(e=(t=this.options).onChange)||e.call(t,this,!1)},this.setOptions(t),this.scrollRect=this.options.initialRect,this.scrollOffset="function"==typeof this.options.initialOffset?this.options.initialOffset():this.options.initialOffset,this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(t=>{this.itemSizeCache.set(t.key,t.size)}),this.notify(!1,!1)}}const JC=(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 QC=typeof document<"u"?i.useLayoutEffect:i.useEffect;function tS(t){return function(t){const e=i.useReducer(()=>({}),{})[1],n={...t,onChange:(n,r)=>{var i;r?(0,s.flushSync)(e):e(),null==(i=t.onChange)||i.call(t,n,r)}},[r]=i.useState(()=>new ZC(n));return r.setOptions(n),i.useEffect(()=>r._didMount(),[]),QC(()=>r._willUpdate()),r}({observeElementRect:UC,observeElementOffset:GC,scrollToFn:KC,...t})}function eS(){const t=ba(t=>{var e;return null==(e=t.config.ui)?void 0:e.activeTheme});return ba(e=>{var n;return((null==(n=e.config.ui)?void 0:n.themes)||[]).find(e=>e.name===t)})}function nS({category:t}){const e=eS(),n=t.name,o=t.list?t.list:Array.from(Array(t.items).keys()),s=(0,i.useRef)(null),a=tS({horizontal:!0,count:o.length,getScrollElement:()=>s.current,estimateSize:(0,i.useCallback)(()=>52,[]),overscan:5});return(0,i.useEffect)(()=>{a.scrollToIndex(0)},[n]),(0,r.jsx)(i.Fragment,{children:(0,r.jsx)("div",{ref:s,className:"tiny-scrollbar overflow-x-auto overflow-y-hidden",style:{height:"52px"},children:(0,r.jsx)("div",{className:"h-full relative mx-auto",style:{width:`${a.getTotalSize()}px`},children:a.getVirtualItems().map(n=>{const i=`${o[n.index]}`;return(0,r.jsx)("div",{className:"absolute top-0 left-0 h-full",style:{width:`${n.size}px`,transform:`translateX(${n.start}px)`},children:(0,r.jsx)(Bf,{variant:"outline",radius:"rounded-xl",size:"md",equalWidth:!0,onClick:async()=>{await xa().shape.addSticker(t.name,i),ya().setDirty(!0)},children:(0,r.jsx)("img",{className:ei("m-auto m-auto w-28 h-28",t.invertPreview&&(null==e?void 0:e.isDark)&&"invert"),src:Kp(t,i),alt:i})})},n.index)})})})})}function rS(){const t=ba(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]),o=t.map(t=>{const n=e===t,i=Gr[t.name];return(0,r.jsx)(Bf,{size:"xs",color:n?"primary":null,value:t,children:(0,r.jsx)("span",{className:"capitalize",children:i?(0,r.jsx)(lv,{...i}):t.name})},t.name)});return(0,r.jsxs)("div",{className:"h-92",children:[(0,r.jsx)("div",{className:"mb-10 w-full hide-scrollbar overflow-x-auto overflow-y-hidden flex",children:(0,r.jsx)(ib,{value:e,onChange:t=>n(t),variant:"outline",radius:"rounded-full",className:"mx-auto",children:o})}),e&&(0,r.jsx)(nS,{category:e})]})}function iS(){const t=ba(t=>{var e,n;return null==(n=null==(e=t.config.tools)?void 0:e.frame)?void 0:n.items})||[],e=ba(t=>t.frame.active);(0,i.useEffect)(()=>{ya().frame.active&&ya().frame.showOptionsPanel()},[]);const n=t.map(t=>{const n=Tp(`images/frames/${t.name}/thumbnail.png`),i=(null==e?void 0:e.name)===t.name;return(0,r.jsx)(dC,{children:(0,r.jsxs)("button",{type:"button",className:"border-2 overflow-hidden relative rounded border cursor-pointer "+(i?"border-primary":""),onClick:()=>{ya().setDirty(!0),i?xa().frame.remove():xa().frame.add(t.name)},children:[i&&(0,r.jsx)(oS,{}),(0,r.jsx)("img",{draggable:"false",className:"w-64 h-64",src:n,alt:t.name})]})},t.name)});return(0,r.jsx)(hC,{children:n})}function oS(){return(0,r.jsx)("span",{className:"bg-background/70 absolute inset-0 text-primary",children:(0,r.jsx)(sC,{className:"svg-icon icon-md absolute inset-0 block m-auto"})})}function sS(){const t=ba(t=>{var e,n;return null==(n=null==(e=t.config.tools)?void 0:e.text)?void 0:n.items});(0,i.useEffect)(()=>{t&&Mp(t,{prefixSrc:Tp,id:"pixie-fonts"}).catch(()=>{})},[t]),(0,i.useEffect)(()=>{xa().text.selectOrAddText()&&ya().setDirty(!0)},[]);const e=(t||[]).map(t=>(0,r.jsx)(dC,{children:(0,r.jsx)(aS,{fontConfig:t})},t.family));return(0,r.jsx)(hC,{className:"pt-6",children:e})}function aS({fontConfig:t}){var e;const n=ba(t=>t.objects.active.editableProps.fontFamily),i=ei("block px-6 w-110 h-68 text-sm bg border rounded-2xl",{"border-primary":n===t.family,"text-primary":n===t.family});return(0,r.jsx)("button",{type:"button",className:i,style:{fontFamily:t.family.includes('"')?t.family:`"${t.family}"`,fontWeight:(null==(e=t.descriptors)?void 0:e.weight)||"normal"},onClick:async()=>{xa().text.selectOrAddText(),ya().setDirty(!0),xa().objects.setValues({fontFamily:t.family})},children:t.family})}const lS=ii((0,r.jsx)("path",{d:"M290.7 57.4L57.4 290.7c-25 25-25 65.5 0 90.5l80 80c12 12 28.3 18.7 45.3 18.7H288h9.4H512c17.7 0 32-14.3 32-32s-14.3-32-32-32H387.9L518.6 285.3c25-25 25-65.5 0-90.5L381.3 57.4c-25-25-65.5-25-90.5 0zM297.4 416H288l-105.4 0-80-80L227.3 211.3 364.7 348.7 297.4 416z"}),"EraserFA","0 0 576 512");function cS(){return(0,i.useEffect)(()=>(xa().draw.enable(),()=>{xa().draw.disable()}),[]),(0,r.jsxs)(hC,{gap:"gap-16",children:[(0,r.jsx)(dC,{children:(0,r.jsx)(Qw,{size:"sm",label:(0,r.jsx)(lv,{message:"Brush Color"}),value:xa().draw.currentBrush.color,onChange:t=>{xa().draw.setBrushColor(t)}})}),(0,r.jsx)(dC,{children:(0,r.jsx)(hS,{})}),(0,r.jsx)(dC,{children:(0,r.jsx)(uS,{})})]})}function uS(){const t=ba(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)(xa().draw.currentBrush.width);return(0,r.jsx)(f_,{selectionMode:"single",selectedValue:e,onSelectionChange:t=>{n(t),xa().draw.setBrushSize(t)},size:"sm",label:(0,r.jsx)(lv,{message:"Brush Size"}),children:t.map(t=>(0,r.jsx)(Yf,{value:t,children:(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("div",{className:"flex-shrink-0 mr-8 border-[3px] rounded-full",style:{width:`${t}px`,height:`${t}px`}}),t]})},t))})}function hS(){const t=ba(t=>{var e,n;return null==(n=null==(e=t.config.tools)?void 0:e.draw)?void 0:n.brushTypes})||[],e=eS(),[n,o]=(0,i.useState)(xa().draw.currentBrush.type);return(0,r.jsx)(f_,{selectionMode:"single",selectedValue:n,onSelectionChange:t=>{o(t),xa().draw.setBrushType(t)},size:"sm",label:(0,r.jsx)(lv,{message:"Brush Type"}),children:t.map(t=>(0,r.jsx)(Yf,{value:t,children:(0,r.jsxs)("div",{className:"flex items-center",children:["EraserBrush"===t?(0,r.jsx)(lS,{className:"mr-8"}):(0,r.jsx)("img",{className:"flex-shrink-0 mr-8 w-24 h-24",src:dS(t,null==e?void 0:e.isDark),alt:""}),(0,r.jsx)(lv,{message:t.replace(/([A-Z])/g," $1").trim()})]})},t))})}function dS(t,e=!1){return Tp(`images/brushes/${e?"white":"black"}/${t.replace("Brush","").toLowerCase()}.png`)}function pS(){const{trans:t}=Xw(),e=ba(t=>t.corners.radius);return(0,i.useEffect)(()=>(ya().setDirty(!0),xa().corners.showPreview(),()=>xa().corners.hidePreview()),[]),(0,r.jsx)("div",{className:"max-w-320 mx-auto",children:(0,r.jsx)(u_,{minValue:1,maxValue:300,label:t({message:"Radius"}),getValueLabel:t=>`${t}px`,onChange:t=>{xa().corners.updatePreview(t),ya().corners.setRadius(t)},value:e})})}const fS={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 gS({activeTool:t}){const e=function(t){switch(t){case Qr.FILTER:return(0,r.jsx)(pC,{});case Qr.RESIZE:return(0,r.jsx)(xC,{});case Qr.CROP:return(0,r.jsx)(AC,{});case Qr.DRAW:return(0,r.jsx)(cS,{});case Qr.TEXT:return(0,r.jsx)(sS,{});case Qr.SHAPES:return(0,r.jsx)(LC,{});case Qr.STICKERS:return(0,r.jsx)(rS,{});case Qr.FRAME:return(0,r.jsx)(iS,{});case Qr.CORNERS:return(0,r.jsx)(pS,{});default:return null}}(t);return(0,r.jsx)(Cd.div,{className:"relative h-full w-full text-sm bg select-none overflow-hidden",...fS,children:e})}function mS({className:t}){const e=ba(t=>t.activeTool);return(0,r.jsx)("nav",{className:ei("z-navbar min-h-86 flex-shrink-0 px-16 relative overflow-hidden",t),children:(0,r.jsx)(Md,{initial:!1,children:e?(0,r.jsx)(gS,{activeTool:e},"tool-controls"):(0,r.jsx)(vS,{},"nav-items")})})}function vS(){const t=ba(t=>{var e,n;return null==(n=null==(e=t.config.ui)?void 0:e.nav)?void 0:n.items})||[];return(0,r.jsx)(Cd.div,{className:"w-full h-full bg-inherit",...fS,children:(0,r.jsx)(hC,{children:t.map(t=>(0,r.jsx)(dC,{children:(0,r.jsx)(bS,{item:t})},t.name))})})}function bS({item:t}){const e=Si[t.name];return(0,r.jsxs)(Nf,{variant:"outline",color:"paper",className:"flex-col flex-shrink-0 w-68 h-68",radius:"rounded-2xl",onClick:()=>{"string"==typeof t.action?Ta(t.action):"function"==typeof t.action&&t.action(ya().editor)},children:[(0,r.jsx)("div",{className:"mb-1",children:(0,r.jsx)(Qv,{className:"icon-md",icon:t.icon})}),(0,r.jsx)("div",{className:"mt-6 text-xs capitalize max-w-[90%] overflow-hidden overflow-ellipsis",children:e?(0,r.jsx)(lv,{...e}):t.name})]})}function yS(){const t=ba(t=>t.history.items),e=ba(t=>t.history.pointer);return(0,r.jsxs)(Cd.div,{...Zm,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:[(0,r.jsxs)("div",{className:"px-10 py-2 mb-4 font-medium text-sm border-b flex items-center",children:[(0,r.jsx)(lv,{message:"History"}),(0,r.jsx)(Jv,{size:"xs",className:"ml-auto flex-shrink-0",onClick:()=>{ya().togglePanel("history",!1)},children:(0,r.jsx)(pb,{})})]}),(0,r.jsx)("div",{className:"p-10",children:t.map(n=>{const o=n.id===t[e].id,s=_i[n.name],a=s.icon&&i.createElement(s.icon,{className:"icon-sm"});return(0,r.jsx)(Bf,{onClick:()=>{o||xa().history.load(n)},variant:"outline",color:o?"primary":null,size:"sm",className:ei("w-full mb-8",o&&"pointer-events-none"),justify:"justify-start",startIcon:a,children:(0,r.jsx)(lv,{...s.name})},n.id)})})]})}function xS(t){const{children:e,className:n,color:o,onDismiss:s,leftAdornment:a,rightAdornment:l,hideDismissButton:c=!1,size:u,showDivider:h,justify:d="justify-between",titleFontWeight:p="font-semibold",titleTextSize:f=("xs"===u?"text-xs":"text-sm"),closeButtonSize:g=("xs"===u?"xs":"sm"),actions:m}=t,{labelId:v,isDismissable:b,close:y}=(0,i.useContext)(Ww);return(0,r.jsxs)("div",{className:ei(n,"flex flex-shrink-0 items-center gap-10",p,h&&"border-b",wS(t),o||"text-main",d),children:[a,(0,r.jsx)("h3",{id:v,className:ei(f,"mr-auto leading-5 opacity-90"),children:e}),l,m,b&&!c&&(0,r.jsx)(Jv,{"aria-label":"Dismiss",onClick:()=>{s?s():y()},size:g,className:ei("-mr-8 text-muted",l&&"sr-only"),children:(0,r.jsx)(pb,{})})]})}function wS({size:t,padding:e}){if(e)return e;switch(t){case"2xs":case"xs":return"px-14 py-4";case"sm":return"px-18 py-4";default:return"px-24 py-6"}}const _S=(0,i.forwardRef)((t,e)=>{const{children:n,className:i,padding:o,size:s,...a}=t;return(0,r.jsx)("div",{...a,ref:e,className:ei(i,CS(t),"overflow-y-auto overflow-x-hidden overscroll-contain text-sm flex-auto"),children:n})});function CS({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 SS(){const t=ba(t=>t.openPanels.newImage);return(0,r.jsx)(Jw,{isOpen:t,disableInitialTransition:!0,type:"modal",isDismissable:!1,children:(0,r.jsx)(kS,{})})}function kS(){const[t,e]=(0,i.useState)("default");return(0,r.jsxs)(qw,{className:"text-center max-w-max text-main",size:"auto",children:[(0,r.jsx)(xS,{padding:"px-24 pt-24 pb-12",showDivider:!1,children:(0,r.jsx)(lv,{message:"Open a photo or design to get started"})}),(0,r.jsx)(_S,{children:"default"===t?(0,r.jsx)(TS,{setActivePanel:e}):(0,r.jsx)(OS,{setActivePanel:e})})]})}function TS({setActivePanel:t}){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(Bf,{className:"mr-20",size:"sm",variant:"raised",color:"primary",onClick:()=>{xa().import.uploadAndReplaceMainImage()},children:(0,r.jsx)(lv,{message:"Open Photo"})}),(0,r.jsx)(Bf,{variant:"outline",size:"sm",color:"primary",onClick:()=>{t("newCanvas")},children:(0,r.jsx)(lv,{message:"Create New"})}),(0,r.jsx)(jS,{})]})}function jS(){const t=ba(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?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"relative py-20 text-main",children:[(0,r.jsx)("hr",{className:"absolute h-1 border-none bg-divider w-full top inset-0 m-auto"}),(0,r.jsx)("span",{className:"text-sm bg px-6 relative",children:(0,r.jsx)(lv,{message:"or use sample"})})]}),(0,r.jsx)("ul",{className:"flex items-center gap-16",children:t.map(t=>(0,r.jsx)("li",{className:"shrink-0",children:(0,r.jsx)("button",{type:"button",onClick:async()=>{"function"==typeof t.action?t.action():t.url.endsWith(".json")?(await Ca(Tp(t.url)),ya().togglePanel("newImage",!1)):(await xa().import.openBackgroundImage(Tp(t.url)),ya().togglePanel("newImage",!1))},children:(0,r.jsx)("img",{className:"w-80 h-80 rounded overflow-hidden transition-shadow hover:shadow-md",src:Tp(t.thumbnail),alt:""})})},t.url||t.thumbnail))})]}):null}function OS({setActivePanel:t}){const[e,n]=(0,i.useState)({width:800,height:600,bgColor:"transparent"});return(0,r.jsxs)("form",{onSubmit:t=>{t.preventDefault();const{width:n,height:r,bgColor:i}=e;n&&r&&(ya().setConfig({blankCanvasSize:{width:n,height:r}}),xa().canvas.openNew(n,r,i),ya().togglePanel("newImage",!1),xa().history.addInitial())},children:[(0,r.jsx)(Gv,{type:"number",label:(0,r.jsx)(lv,{message:"Width"}),value:e.width,min:1,required:!0,className:"mb-16",onChange:t=>{n({...e,width:t.target.valueAsNumber})}}),(0,r.jsx)(Gv,{type:"number",label:(0,r.jsx)(lv,{message:"Height"}),value:e.height,min:1,required:!0,className:"mb-16",onChange:t=>{n({...e,height:t.target.valueAsNumber})}}),(0,r.jsx)(Qw,{onChange:t=>{n({...e,bgColor:t})},className:"mb-16",value:e.bgColor,label:(0,r.jsx)(lv,{message:"Background color"})}),(0,r.jsxs)("div",{className:"text-right",children:[(0,r.jsx)(Bf,{size:"sm",variant:"text",className:"mr-10",onClick:()=>{t("default")},children:(0,r.jsx)(lv,{message:"Cancel"})}),(0,r.jsx)(Bf,{size:"sm",type:"submit",variant:"raised",color:"primary",children:(0,r.jsx)(lv,{message:"Create"})})]})]})}const ES=(0,i.forwardRef)((t,e)=>{const n=Lv(t),{label:o,children:s,size:a,className:l,orientation:c="horizontal",disabled:u,required:h,invalid:d,errorMessage:p,description:f}=t,g=(0,i.useId)(),m=t.name||g;return(0,r.jsxs)("fieldset",{"aria-describedby":f?`${g}-description`:void 0,ref:e,className:ei("text-left",l),children:[o&&(0,r.jsx)("legend",{className:n.label,children:o}),(0,r.jsx)("div",{className:ei("flex",o?"mt-6":"mt-0","vertical"===c?"flex-col gap-10":"flex-row gap-16"),children:i.Children.map(s,t=>{if((0,i.isValidElement)(t))return(0,i.cloneElement)(t,{name:m,size:a,invalid:t.props.invalid||d||void 0,disabled:t.props.disabled||u,required:t.props.required||h})})}),f&&!p&&(0,r.jsx)("div",{className:n.description,id:`${g}-description`,children:f}),p&&(0,r.jsx)("div",{className:n.error,children:p})]})}),MS=(0,i.forwardRef)((t,e)=>{const{children:n,autoFocus:i,size:o,invalid:s,isFirst:a,...l}=t,c=tp(e);Xv({autoFocus:i},c);const u=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"}}}(o);return(0,r.jsxs)("label",{className:ei("inline-flex gap-8 select-none items-center whitespace-nowrap align-middle",u.label,t.disabled&&"text-disabled pointer-events-none",t.invalid&&"text-danger"),children:[(0,r.jsx)("input",{type:"radio",className:ei("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",u.circle),ref:c,...l}),n&&(0,r.jsx)("span",{children:n})]})});function PS(){const t=ba(t=>t.openPanels.export);return(0,r.jsx)(Jw,{isOpen:t,onOpenChange:t=>{t||ya().togglePanel("export",!1)},type:"modal",children:(0,r.jsx)(AS,{})})}function AS(){const[t,e]=(0,i.useState)(()=>{var t,e,n,r,i,o;return{filename:(null==(e=null==(t=ya().config.tools)?void 0:t.export)?void 0:e.defaultName)||"image",format:(null==(r=null==(n=ya().config.tools)?void 0:n.export)?void 0:r.defaultFormat)||"jpeg",quality:(null==(o=null==(i=ya().config.tools)?void 0:i.export)?void 0:o.defaultQuality)||.8}});return(0,r.jsx)(qw,{className:"text-center max-w-max text-main",size:"auto",children:(0,r.jsx)(_S,{children:(0,r.jsxs)("form",{onSubmit:e=>{e.preventDefault(),xa().export.save(t.filename,t.format,t.quality),ya().togglePanel("export",!1)},children:[(0,r.jsx)(Gv,{required:!0,size:"sm",label:(0,r.jsx)(lv,{message:"Save As"}),value:t.filename,onChange:n=>{e({...t,filename:n.target.value})}}),(0,r.jsxs)(ES,{size:"sm",className:"my-20","aria-label":"Image format",children:[(0,r.jsx)(MS,{value:"jpeg",checked:"jpeg"===t.format,onChange:n=>{e({...t,format:n.target.value})},children:"JPEG"}),(0,r.jsx)(MS,{value:"png",checked:"png"===t.format,onChange:n=>{e({...t,format:n.target.value})},children:"PNG"}),(0,r.jsx)(MS,{value:"json",checked:"json"===t.format,onChange:n=>{e({...t,format:n.target.value})},children:"JSON"})]}),(0,r.jsx)(u_,{size:"sm",minValue:.1,step:.1,maxValue:1,value:t.quality,onChange:n=>{e({...t,quality:n})},formatOptions:{style:"percent"},label:(0,r.jsx)(lv,{message:"Quality"})}),(0,r.jsx)(Bf,{variant:"raised",color:"primary",type:"submit",className:"mt-20 w-full",size:"sm",children:(0,r.jsx)(lv,{message:"Save"})})]})})})}function DS(){const t=ba(t=>t.objects.all),e=ba(t=>t.objects.active.id);return(0,r.jsxs)(Cd.div,{...Zm,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:[(0,r.jsxs)("div",{className:"px-10 py-2 mb-4 font-medium text-sm border-b flex items-center",children:[(0,r.jsx)(lv,{message:"Objects"}),(0,r.jsx)(Jv,{size:"xs",className:"ml-auto flex-shrink-0",onClick:()=>{ya().togglePanel("objects",!1)},children:(0,r.jsx)(pb,{})})]}),(0,r.jsx)("div",{className:"p-8",children:t.map(t=>{const n=t.id===e,o=t.name;if(!o)return null;const s=ps[o],a=s.icon&&i.createElement(s.icon,{className:"icon-sm"});return(0,r.jsx)(Bf,{onClick:()=>{n||!t.selectable||xa().objects.select(t.id)},variant:"outline",color:n?"primary":null,size:"sm",className:ei("w-full mb-8",(n||!t.selectable)&&"pointer-events-none"),justify:"justify-start",startIcon:a,children:(0,r.jsx)(lv,{...s.name})},t.id)})})]})}function IS(){const t=ba(t=>t.openPanels.history),e=ba(t=>t.openPanels.objects);return(0,r.jsxs)("div",{className:"z-modal",children:[(0,r.jsxs)(Md,{children:[t&&(0,r.jsx)(yS,{},"historyPanel"),e&&(0,r.jsx)(DS,{},"objListPanel")]}),(0,r.jsx)(SS,{}),(0,r.jsx)(PS,{})]})}function RS(){return RS=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},RS.apply(this,arguments)}var zS,LS;function FS(t,e){if(!1===t||null===t||typeof t>"u")throw new Error(e)}function NS(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 BS(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 VS(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 $S(t,e,n,r){return"Cannot include a '"+t+"' character in a manually specified `to."+e+"` field ["+JSON.stringify(r)+"]. Please separate it out to the `to."+n+'` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.'}function HS(t,e){let n=function(t){return t.filter((t,e)=>0===e||t.route.path&&t.route.path.length>0)}(t);return e?n.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase):n.map(t=>t.pathnameBase)}function WS(t,e,n,r){let i;void 0===r&&(r=!1),"string"==typeof t?i=BS(t):(i=RS({},t),FS(!i.pathname||!i.pathname.includes("?"),$S("?","pathname","search",i)),FS(!i.pathname||!i.pathname.includes("#"),$S("#","pathname","hash",i)),FS(!i.search||!i.search.includes("#"),$S("#","search","hash",i)));let o,s=""===t||""===i.pathname,a=s?"/":i.pathname;if(null==a)o=n;else{let t=e.length-1;if(!r&&a.startsWith("..")){let e=a.split("/");for(;".."===e[0];)e.shift(),t-=1;i.pathname=e.join("/")}o=t>=0?e[t]:"/"}let l=function(t,e){void 0===e&&(e="/");let{pathname:n,search:r="",hash:i=""}="string"==typeof t?BS(t):t;return{pathname:n?n.startsWith("/")?n:VS(n,e):e,search:XS(r),hash:YS(i)}}(i,o),c=a&&"/"!==a&&a.endsWith("/"),u=(s||"."===a)&&n.endsWith("/");return!l.pathname.endsWith("/")&&(c||u)&&(l.pathname+="/"),l}!function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"}(zS||(zS={})),function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"}(LS||(LS={}));const US=t=>t.join("/").replace(/\/\/+/g,"/"),XS=t=>t&&"?"!==t?t.startsWith("?")?t:"?"+t:"",YS=t=>t&&"#"!==t?t.startsWith("#")?t:"#"+t:"",GS=["post","put","patch","delete"];new Set(GS);const qS=["get",...GS];function KS(){return KS=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},KS.apply(this,arguments)}new Set(qS);const ZS=i.createContext(null),JS=i.createContext(null),QS=i.createContext(null),tk=i.createContext({outlet:null,matches:[],isDataRoute:!1});function ek(){return null!=i.useContext(QS)}function nk(){return ek()||FS(!1),i.useContext(QS).location}function rk(t){i.useContext(JS).static||i.useLayoutEffect(t)}function ik(){let{isDataRoute:t}=i.useContext(tk);return t?function(){let{router:t}=function(){let t=i.useContext(ZS);return t||FS(!1),t}(sk.UseNavigateStable),e=function(){let t=function(){let t=i.useContext(tk);return t||FS(!1),t}(),e=t.matches[t.matches.length-1];return e.route.id||FS(!1),e.route.id}(ak.UseNavigateStable),n=i.useRef(!1);return rk(()=>{n.current=!0}),i.useCallback(function(r,i){void 0===i&&(i={}),n.current&&("number"==typeof r?t.navigate(r):t.navigate(r,KS({fromRouteId:e},i)))},[t,e])}():function(){ek()||FS(!1);let t=i.useContext(ZS),{basename:e,future:n,navigator:r}=i.useContext(JS),{matches:o}=i.useContext(tk),{pathname:s}=nk(),a=JSON.stringify(HS(o,n.v7_relativeSplatPath)),l=i.useRef(!1);return rk(()=>{l.current=!0}),i.useCallback(function(n,i){if(void 0===i&&(i={}),!l.current)return;if("number"==typeof n)return void r.go(n);let o=WS(n,JSON.parse(a),s,"path"===i.relative);null==t&&"/"!==e&&(o.pathname="/"===o.pathname?e:US([e,o.pathname])),(i.replace?r.replace:r.push)(o,i.state,i)},[e,r,a,s,t])}()}function ok(t,e){let{relative:n}=void 0===e?{}:e,{future:r}=i.useContext(JS),{matches:o}=i.useContext(tk),{pathname:s}=nk(),a=JSON.stringify(HS(o,r.v7_relativeSplatPath));return i.useMemo(()=>WS(t,JSON.parse(a),s,"path"===n),[t,a,s,n])}var sk=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(sk||{}),ak=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(ak||{});function lk(){return lk=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},lk.apply(this,arguments)}new Promise(()=>{});const ck=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"];try{window.__reactRouterVersion="6"}catch{}const uk=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",hk=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,dk=i.forwardRef(function(t,e){let n,{onClick:r,relative:o,reloadDocument:s,replace:a,state:l,target:c,to:u,preventScrollReset:h,unstable_viewTransition:d}=t,p=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,ck),{basename:f}=i.useContext(JS),g=!1;if("string"==typeof u&&hk.test(u)&&(n=u,uk))try{let t=new URL(window.location.href),e=u.startsWith("//")?new URL(t.protocol+u):new URL(u),n=function(t,e){if("/"===e)return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&"/"!==r?null:t.slice(n)||"/"}(e.pathname,f);e.origin===t.origin&&null!=n?u=n+e.search+e.hash:g=!0}catch{}let m=function(t,e){let{relative:n}=void 0===e?{}:e;ek()||FS(!1);let{basename:r,navigator:o}=i.useContext(JS),{hash:s,pathname:a,search:l}=ok(t,{relative:n}),c=a;return"/"!==r&&(c="/"===a?r:US([r,a])),o.createHref({pathname:c,search:l,hash:s})}(u,{relative:o}),v=function(t,e){let{target:n,replace:r,state:o,preventScrollReset:s,relative:a,unstable_viewTransition:l}=void 0===e?{}:e,c=ik(),u=nk(),h=ok(t,{relative:a});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:NS(u)===NS(h);c(t,{replace:n,state:o,preventScrollReset:s,relative:a,unstable_viewTransition:l})}},[u,c,h,r,o,n,t,s,a,l])}(u,{replace:a,state:l,target:c,preventScrollReset:h,relative:o,unstable_viewTransition:d});return i.createElement("a",lk({},p,{href:n||m,onClick:g||s?r:function(t){r&&r(t),t.defaultPrevented||v(t)},ref:e,target:c}))});var pk,fk;!function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"}(pk||(pk={})),function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"}(fk||(fk={}));const gk=ii((0,r.jsx)("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"),mk=ii((0,r.jsx)("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"),vk={opacity:0,y:50,scale:.3},bk={opacity:1,y:0,scale:1},yk={opacity:0,scale:.5};function xk(){const t=Ma(t=>t.toasts);return(0,r.jsx)("div",{className:"pointer-events-none relative",children:(0,r.jsx)(Md,{initial:!1,children:t.map(t=>(0,r.jsx)("div",{className:ei("fixed z-toast mx-auto p-20","bottom-center"===t.position?"bottom-0 left-0 right-0":"bottom-0 right-0"),children:(0,r.jsxs)(Cd.div,{initial:t.disableEnterAnimation?void 0:vk,animate:t.disableEnterAnimation?void 0:bk,exit:t.disableExitAnimation?void 0:yk,className:ei("pointer-events-auto mx-auto flex max-h-100 min-h-50 w-min min-w-288 max-w-500 items-center gap-10 rounded-lg border bg-paper bg-paper py-6 pl-16 pr-6 text-sm text-main shadow-lg"),onPointerEnter:()=>{var e;return null==(e=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&&(0,r.jsx)(gk,{className:"flex-shrink-0 text-danger",size:"md"}),"loading"===t.type&&(0,r.jsx)(h_,{size:"sm",className:"flex-shrink-0",isIndeterminate:!0}),"positive"===t.type&&(0,r.jsx)(mk,{className:"flex-shrink-0 text-positive",size:"md"}),(0,r.jsx)("div",{className:"mr-auto w-max overflow-hidden overflow-ellipsis","data-testid":"toast-message",children:(0,r.jsx)(tb,{value:t.message})}),t.action&&(0,r.jsx)(Bf,{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:()=>Pa().remove(t.id),elementType:dk,to:t.action.action,children:(0,r.jsx)(tb,{value:t.action.label})}),"loading"!==t.type&&(0,r.jsx)(Jv,{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:()=>{Pa().remove(t.id)},size:"sm",children:(0,r.jsx)(pb,{})})]})},t.id))})})}function wk(t){return Gd()?t.metaKey:t.ctrlKey}function _k(t){switch(t.key){case"z":wk(t)&&(t.preventDefault(),t.stopPropagation(),t.shiftKey?xa().history.redo():xa().history.undo());break;case"ArrowUp":t.preventDefault(),t.stopPropagation(),xa().objects.move("up");break;case"ArrowRight":t.preventDefault(),t.stopPropagation(),xa().objects.move("right");break;case"ArrowDown":t.preventDefault(),t.stopPropagation(),xa().objects.move("down");break;case"ArrowLeft":t.preventDefault(),t.stopPropagation(),xa().objects.move("left");break;case"Delete":t.preventDefault(),t.stopPropagation(),xa().objects.delete();break;case"v":wk(t)&&(t.preventDefault(),t.stopPropagation(),async function(){try{const t=await navigator.clipboard.read();for(const e of t)for(const t of e.types)if(t.startsWith("image/")){const n=await e.getType(t),r=new FileReader;return r.onload=t=>{var e;null!=(e=t.target)&&e.result&&xa().import.addImageFromData(t.target.result)},void r.readAsDataURL(n)}}catch(t){}}())}}const Ck=new Map,Sk=new Map,kk={status:"inactive"};async function*Tk(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 jk(t);yield new df(e,t.fullPath)}else t.isDirectory&&(yield*Tk(t))}while(n.length>0)}function jk(t){return new Promise((e,n)=>t.file(e,n))}function Ok(t){return null!=kk.dragTargetId?Ck.get(kk.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){const e=[];for(const n of t.items)if("file"===n.kind){const t=n.webkitGetAsEntry();t&&e.push(t)}for(const n of e)if(n.isFile){if(".DS_Store"===n.name)continue;const t=await jk(n);yield new df(t,n.fullPath)}else n.isDirectory&&(yield*Tk(n))}(t.dataTransfer))}:void 0}function Ek(){const t=ba(t=>{var e;return null==(e=t.config.ui)?void 0:e.visible})??!0,e=ba(t=>{var e,n;return null==(n=null==(e=t.config.ui)?void 0:e.nav)?void 0:n.position})??"bottom",n=ba(t=>{var e,n;return null==(n=null==(e=t.config.ui)?void 0:e.menubar)?void 0:n.position})??"top",o=ba(t=>{var e;return null==(e=t.config.ui)?void 0:e.allowEditorClose})??!0,s=(0,i.useRef)(null),a=(0,i.useRef)(null),{isModal:l,isMobile:c}=fb(),u=(0,i.useCallback)(async t=>{var e,n;if(ya().activeTool||ya().dirty||"nativeFile"!==t.type)return;const r=await t.getData();xa().import.fileIsValid(r[0])&&((null==(n=null==(e=ya().config.tools)?void 0:e.import)?void 0:n.openDroppedImageAsBackground)?await xa().import.openBackgroundImage(r[0]):await xa().import.openUploadedFile(r[0]))},[]),{droppableProps:h}=function({id:t,disabled:e,ref:n,...r}){const o=(0,i.useRef)({dragOverElements:new Set,dropActivateTimer:void 0}).current,s=(0,i.useRef)(r);s.current=r,(0,i.useLayoutEffect)(()=>(Sk.set(t,{...Sk.get(t),disabled:e,id:t,ref:n}),()=>{Sk.delete(t)}),[t,s,e,n]);const a=t=>{var e;const r=s.current,i=r.allowDragEventsFromItself||n.current!==(null==(e=t.ref)?void 0:e.current);return!(!(null!=t&&t.type&&i&&r.types.includes(t.type))||r.acceptsDrop&&!r.acceptsDrop(t))},l=t=>{var e,n;const r=Ok(t);r&&(null==(n=(e=s.current).onDragLeave)||n.call(e,r))};return{droppableProps:e?{}:{onDragOver:t=>{var e,n;t.preventDefault(),t.stopPropagation();const r=Ok(t);r&&a(r)&&(null==(n=(e=s.current).onDragOver)||n.call(e,r,t))},onDragEnter:t=>{var e,n;if(t.stopPropagation(),o.dragOverElements.add(t.target),o.dragOverElements.size>1)return;const r=Ok(t);r&&a(r)&&(null==(n=(e=s.current).onDragEnter)||n.call(e,r),clearTimeout(o.dropActivateTimer),"function"==typeof s.current.onDropActivate&&(o.dropActivateTimer=setTimeout(()=>{var t,e;r&&(null==(e=(t=s.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=Ok(t);e&&a(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=Ok(t);c&&(null==(n=(e=s.current).onDragLeave)||n.call(e,c),a(c)&&(null==(i=(r=s.current).onDrop)||i.call(r,c)))}}}}({id:"pixie-root",ref:a,types:["nativeFile"],onDrop:u});(0,i.useEffect)(()=>{var t,e;ya().fabric||(ba.setState({canvasRef:s}),Pf(s.current),null!=(t=ya().config.ui)&&t.defaultTool&&ya().setActiveTool(null==(e=ya().config.ui)?void 0:e.defaultTool,null),xa().canvas.loadInitialContent().then(()=>{var t,e;null==(e=(t=ya().config).onLoad)||e.call(t,ya().editor)}));const n=Af(a,()=>{ya().setStageSize(Df(a.current))}),r=Af(s,()=>{ya().setCanvasSize(Df(s.current))});return()=>{n(),r()}},[a]);const d=ei("pixie-root flex flex-col overflow-hidden bg-background text-main no-tap-highlight w-full h-full",{relative:!l,"fixed inset-0 w-full h-full z-20":l,"shadow-lg border rounded-md m-auto max-h-[calc(100vh-90px)] max-w-[calc(100vw-90px)]":l&&!c});return(0,r.jsxs)(Pd,{features:Dd,strict:!0,children:[l&&t&&!c&&o&&(0,r.jsx)(Jv,{className:"z-20 fixed right-2 top-2 text-white",size:"lg",onClick:()=>{ya().editor.close()},children:(0,r.jsx)(pb,{})}),l&&t&&(0,r.jsx)(ev,{position:"fixed",disableInitialTransition:!0}),(0,r.jsxs)(Cd.div,{initial:!1,variants:{visible:{opacity:1,scale:1,display:"flex"},hidden:{opacity:0,transitionEnd:{display:"none"}}},animate:t?"visible":"hidden",className:d,children:["top"===n&&(0,r.jsx)(wb,{}),"top"===e&&(0,r.jsx)(mS,{className:"pt-14"}),(0,r.jsxs)("main",{className:"relative flex-auto my-20 overflow-hidden outline-none",tabIndex:-1,...Ud(h,{onKeyDownCapture:_k}),ref:a,children:[(0,r.jsx)(Cb,{}),(0,r.jsx)(ex,{ref:s})]}),(0,r.jsx)(oC,{}),"bottom"===e&&(0,r.jsx)(mS,{}),"bottom"===n&&(0,r.jsx)(wb,{}),(0,r.jsx)(IS,{}),(0,r.jsx)(xk,{})]})]})}!function(){fabric.Object.ENLIVEN_PROPS.push("eraser");var t=fabric.Object.prototype._drawClipPath,e=fabric.Object.prototype.needsItsOwnCache,n=fabric.Object.prototype.toObject,r=fabric.Object.prototype.getSvgCommons,i=fabric.Object.prototype._createBaseClipPathSVGMarkup,o=fabric.Object.prototype._createBaseSVGMarkup;fabric.Object.prototype.cacheProperties.push("eraser"),fabric.Object.prototype.stateProperties.push("eraser"),fabric.util.object.extend(fabric.Object.prototype,{erasable:!0,eraser:void 0,needsItsOwnCache:function(){return e.call(this)||!!this.eraser},_drawClipPath:function(e,n){if(t.call(this,e,n),this.eraser){var r=this._getNonTransformedDimensions();this.eraser.isType("eraser")&&this.eraser.set({width:r.x,height:r.y}),t.call(this,e,this.eraser)}},toObject:function(t){var e=n.call(this,["erasable"].concat(t));return this.eraser&&!this.eraser.excludeFromExport&&(e.eraser=this.eraser.toObject(t)),e},getSvgCommons:function(){return r.call(this)+(this.eraser?'mask="url(#'+this.eraser.clipPathId+')" ':"")},_createEraserSVGMarkup:function(t){return this.eraser?(this.eraser.clipPathId="MASK_"+fabric.Object.__uid++,['<mask id="',this.eraser.clipPathId,'" >',this.eraser.toSVG(t),"</mask>","\n"].join("")):""},_createBaseClipPathSVGMarkup:function(t,e){return[this._createEraserSVGMarkup(e&&e.reviver),i.call(this,t,e)].join("")},_createBaseSVGMarkup:function(t,e){return[this._createEraserSVGMarkup(e&&e.reviver),o.call(this,t,e)].join("")}});var s=fabric.Group.prototype._restoreObjectsState;fabric.util.object.extend(fabric.Group.prototype,{_addEraserPathToObjects:function(t){this._objects.forEach(function(e){fabric.EraserBrush.prototype._addPathToObjectEraser.call(fabric.EraserBrush.prototype,e,t)})},applyEraserToObjects:function(){var t=this,e=this.eraser;if(e){delete this.eraser;var n=t.calcTransformMatrix();e.clone(function(e){var r=t.clipPath;e.getObjects("path").forEach(function(e){var i=fabric.util.multiplyTransformMatrices(n,e.calcTransformMatrix());fabric.util.applyTransformToObject(e,i),r?r.clone(function(r){var i=fabric.EraserBrush.prototype.applyClipPathToPath.call(fabric.EraserBrush.prototype,e,r,n);t._addEraserPathToObjects(i)},["absolutePositioned","inverted"]):t._addEraserPathToObjects(e)})})}},_restoreObjectsState:function(){return!0===this.erasable&&this.applyEraserToObjects(),s.call(this)}}),fabric.Eraser=fabric.util.createClass(fabric.Group,{type:"eraser",originX:"center",originY:"center",drawObject:function(t){t.save(),t.fillStyle="black",t.fillRect(-this.width/2,-this.height/2,this.width,this.height),t.restore(),this.callSuper("drawObject",t)},_getBounds:function(){},_toSVG:function(t){var e=["<g ","COMMON_PARTS"," >\n"],n=["<rect ",'fill="white" ','x="',-this.width/2,'" y="',-this.height/2,'" width="',this.width,'" height="',this.height,'" />\n'].join("");e.push("\t\t",n);for(var r=0,i=this._objects.length;r<i;r++)e.push("\t\t",this._objects[r].toSVG(t));return e.push("</g>\n"),e}}),fabric.Eraser.fromObject=function(t,e){var n=t.objects;fabric.util.enlivenObjects(n,function(n){var r=fabric.util.object.clone(t,!0);delete r.objects,fabric.util.enlivenObjectEnlivables(t,r,function(){e&&e(new fabric.Eraser(n,r,!0))})})};var a=fabric.Canvas.prototype._renderOverlay;fabric.util.object.extend(fabric.Canvas.prototype,{isErasing:function(){return this.isDrawingMode&&this.freeDrawingBrush&&"eraser"===this.freeDrawingBrush.type&&this.freeDrawingBrush._isErasing},_renderOverlay:function(t){a.call(this,t),this.isErasing()&&!this.freeDrawingBrush.inverted&&this.freeDrawingBrush._render()}}),fabric.EraserBrush=fabric.util.createClass(fabric.PencilBrush,{type:"eraser",inverted:!1,_isErasing:!1,_isErasable:function(t){return!1!==t.erasable},_prepareCollectionTraversal:function(t,e,n){t.forEachObject(function(r){r.forEachObject&&"deep"===r.erasable?this._prepareCollectionTraversal(r,e,n):!this.inverted&&r.erasable&&r.visible?(r.visible=!1,t.dirty=!0,n.visibility.push(r),n.collection.push(t)):this.inverted&&r.visible&&(r.erasable&&r.eraser?(r.eraser.inverted=!0,r.dirty=!0,t.dirty=!0,n.eraser.push(r),n.collection.push(t)):(r.visible=!1,t.dirty=!0,n.visibility.push(r),n.collection.push(t)))},this)},preparePattern:function(){this._patternCanvas||(this._patternCanvas=fabric.util.createCanvasElement());var t=this._patternCanvas;t.width=this.canvas.width,t.height=this.canvas.height;var e=t.getContext("2d");if(this.canvas._isRetinaScaling()){var n=this.canvas.getRetinaScaling();this.canvas.__initRetinaScaling(n,t,e)}var r=this.canvas.backgroundImage,i=r&&this._isErasable(r),o=this.canvas.overlayImage,s=o&&this._isErasable(o);if(!this.inverted&&(r&&!i||this.canvas.backgroundColor))i&&(this.canvas.backgroundImage=void 0),this.canvas._renderBackground(e),i&&(this.canvas.backgroundImage=r);else if(this.inverted&&r&&i){var l=this.canvas.backgroundColor;this.canvas.backgroundColor=void 0,this.canvas._renderBackground(e),this.canvas.backgroundColor=l}e.save(),e.transform.apply(e,this.canvas.viewportTransform);var c={visibility:[],eraser:[],collection:[]};if(this._prepareCollectionTraversal(this.canvas,e,c),this.canvas._renderObjects(e,this.canvas._objects),c.visibility.forEach(function(t){t.visible=!0}),c.eraser.forEach(function(t){t.eraser.inverted=!1,t.dirty=!0}),c.collection.forEach(function(t){t.dirty=!0}),e.restore(),!this.inverted&&(o&&!s||this.canvas.overlayColor))s&&(this.canvas.overlayImage=void 0),a.call(this.canvas,e),s&&(this.canvas.overlayImage=o);else if(this.inverted&&o&&s){l=this.canvas.overlayColor;this.canvas.overlayColor=void 0,a.call(this.canvas,e),this.canvas.overlayColor=l}},_setBrushStyles:function(t){this.callSuper("_setBrushStyles",t),t.strokeStyle="black"},_saveAndTransform:function(t){this.callSuper("_saveAndTransform",t),this._setBrushStyles(t),t.globalCompositeOperation=t===this.canvas.getContext()?"destination-out":"source-over"},needsFullRender:function(){return!0},onMouseDown:function(t,e){this.canvas._isMainEvent(e.e)&&(this._prepareForDrawing(t),this._captureDrawingPath(t),this.preparePattern(),this._isErasing=!0,this.canvas.fire("erasing:start"),this._render())},_render:function(){var t;this.inverted||(t=this.canvas.getContext(),this.callSuper("_render",t)),t=this.canvas.contextTop,this.canvas.clearContext(t),this.callSuper("_render",t),t.save();var e=1/this.canvas.getRetinaScaling();t.scale(e,e),t.globalCompositeOperation="source-in",t.drawImage(this._patternCanvas,0,0),t.restore()},createPath:function(t){var e=this.callSuper("createPath",t);return e.globalCompositeOperation=this.inverted?"source-over":"destination-out",e.stroke=this.inverted?"white":"black",e},applyClipPathToPath:function(t,e,n){var r=fabric.util.invertTransform(t.calcTransformMatrix()),i=e.calcTransformMatrix(),o=e.absolutePositioned?r:fabric.util.multiplyTransformMatrices(r,n);return e.absolutePositioned=!1,fabric.util.applyTransformToObject(e,fabric.util.multiplyTransformMatrices(o,i)),t.clipPath=t.clipPath?fabric.util.mergeClipPaths(e,t.clipPath):e,t},clonePathWithClipPath:function(t,e,n){var r=e.calcTransformMatrix(),i=e.clipPath,o=this;t.clone(function(t){i.clone(function(e){n(o.applyClipPathToPath(t,e,r))},["absolutePositioned","inverted"])})},_addPathToObjectEraser:function(t,e){var n=this;if(t.forEachObject&&"deep"===t.erasable){var r=t._objects.filter(function(t){return t.erasable});r.length>0&&t.clipPath?this.clonePathWithClipPath(e,t,function(t){r.forEach(function(e){n._addPathToObjectEraser(e,t)})}):r.length>0&&r.forEach(function(t){n._addPathToObjectEraser(t,e)})}else{var i=t.eraser;i||(i=new fabric.Eraser,t.eraser=i),e.clone(function(e){var r=fabric.util.multiplyTransformMatrices(fabric.util.invertTransform(t.calcTransformMatrix()),e.calcTransformMatrix());fabric.util.applyTransformToObject(e,r),i.addWithUpdate(e),t.set("dirty",!0),t.fire("erasing:end",{path:e}),t.group&&Array.isArray(n.__subTargets)&&n.__subTargets.push(t)})}},applyEraserToCanvas:function(t){var e=this.canvas,n={};return["backgroundImage","overlayImage"].forEach(function(r){var i=e[r];i&&i.erasable&&(this._addPathToObjectEraser(i,t),n[r]=i)},this),n},_finalizeAndAddPath:function(){var t=this.canvas.contextTop,e=this.canvas;t.closePath(),this.decimate&&(this._points=this.decimatePoints(this._points,this.decimate)),e.clearContext(e.contextTop),this._isErasing=!1;var n=this._points&&this._points.length>1?this.convertPointsToSVGPath(this._points):null;if(!n||this._isEmptySVGPath(n))return e.fire("erasing:end"),void e.requestRenderAll();var r=this.createPath(n);r.setCoords(),e.fire("before:path:created",{path:r});var i=this.applyEraserToCanvas(r),o=this;this.__subTargets=[];var s=[];e.forEachObject(function(t){t.erasable&&t.intersectsWithObject(r,!0,!0)&&(o._addPathToObjectEraser(t,r),s.push(t))}),e.fire("erasing:end",{path:r,targets:s,subTargets:this.__subTargets,drawables:i}),delete this.__subTargets,e.requestRenderAll(),this._resetShadow(),e.fire("path:created",{path:r})}})}(),x.enableBoundaryChecking(!1);const Mk=class t{constructor(t){if(c(this,"tools",{}),c(this,"fabric",null),t.sentryDsn&&function(t){const e={...t};En(e,"react"),Br(e)}({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.3.2 | MIT License | https://tailwindcss.com*/.pi *,.pi :after,.pi :before{border-color:rgb(var(--be-foreground-base)/var(--be-divider-opacity));border-style:solid;border-width:0;box-sizing:border-box}.pi :after,.pi :before{--tw-content:""}.pi hr{border-top-width:1px;color:inherit;height:0}.pi abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.pi h1,.pi h2,.pi h3,.pi h4,.pi h5,.pi h6{font-size:inherit;font-weight:inherit}.pi a{color:inherit;text-decoration:inherit}.pi b,.pi strong{font-weight:bolder}.pi code,.pi kbd,.pi pre,.pi samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}.pi small{font-size:80%}.pi sub,.pi sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}.pi sub{bottom:-.25em}.pi sup{top:-.5em}.pi table{border-collapse:collapse;border-color:inherit;text-indent:0}.pi button,.pi input,.pi optgroup,.pi select,.pi textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}.pi button,.pi select{text-transform:none}.pi [type=button],.pi [type=reset],.pi [type=submit],.pi button{-webkit-appearance:button;background-color:transparent;background-image:none}.pi :-moz-focusring{outline:auto}.pi :-moz-ui-invalid{box-shadow:none}.pi progress{vertical-align:baseline}.pi ::-webkit-inner-spin-button,.pi ::-webkit-outer-spin-button{height:auto}.pi [type=search]{-webkit-appearance:textfield;outline-offset:-2px}.pi ::-webkit-search-decoration{-webkit-appearance:none}.pi ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}.pi summary{display:list-item}.pi blockquote,.pi dd,.pi dl,.pi figure,.pi h1,.pi h2,.pi h3,.pi h4,.pi h5,.pi h6,.pi hr,.pi p,.pi pre{margin:0}.pi fieldset{margin:0;padding:0}.pi legend{padding:0}.pi menu,.pi ol,.pi ul{list-style:none;margin:0;padding:0}.pi textarea{resize:vertical}.pi input::-moz-placeholder,.pi textarea::-moz-placeholder{color:#9ca3af;opacity:1}.pi input::placeholder,.pi textarea::placeholder{color:#9ca3af;opacity:1}.pi [role=button],.pi button{cursor:pointer}.pi :disabled{cursor:default}.pi audio,.pi canvas,.pi embed,.pi iframe,.pi img,.pi object,.pi svg,.pi video{display:block;vertical-align:middle}.pi img,.pi video{height:auto;max-width:100%}.pi [hidden]{display:none}.pi *,.pi :after,.pi :before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.pi ::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.pi .\\!container{width:100%!important}.pi .container{width:100%}@media (min-width:640px){.pi .\\!container{max-width:640px!important}.pi .container{max-width:640px}}@media (min-width:768px){.pi .\\!container{max-width:768px!important}.pi .container{max-width:768px}}@media (min-width:1024px){.pi .\\!container{max-width:1024px!important}.pi .container{max-width:1024px}}@media (min-width:1280px){.pi .\\!container{max-width:1280px!important}.pi .container{max-width:1280px}}@media (min-width:1536px){.pi .\\!container{max-width:1536px!important}.pi .container{max-width:1536px}}.pi .sr-only{height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;clip:rect(0,0,0,0);border-width:0;white-space:nowrap}.pi .pointer-events-none{pointer-events:none}.pi .pointer-events-auto{pointer-events:auto}.pi .\\!visible{visibility:visible!important}.pi .visible{visibility:visible}.pi .invisible{visibility:hidden}.pi .collapse{visibility:collapse}.pi .static{position:static}.pi .fixed{position:fixed}.pi .absolute{position:absolute}.pi .relative{position:relative}.pi .inset-0{top:0;right:0;bottom:0;left:0}.pi .inset-x-0{left:0;right:0}.pi .-bottom-10{bottom:-10px}.pi .-bottom-20{bottom:-20px}.pi .-bottom-5{bottom:-5px}.pi .-left-5{left:-5px}.pi .-left-8{left:-8px}.pi .-left-80{left:-80px}.pi .-right-5{right:-5px}.pi .-top-144{top:-144px}.pi .-top-40{top:-40px}.pi .-top-5{top:-5px}.pi .bottom-0{bottom:0}.pi .bottom-20{bottom:20px}.pi .left-0{left:0}.pi .left-1\\/2{left:50%}.pi .left-20{left:20px}.pi .right-0{right:0}.pi .right-16{right:16px}.pi .right-2{right:2px}.pi .right-20{right:20px}.pi .right-4{right:4px}.pi .top-0{top:0}.pi .top-1\\/2{top:50%}.pi .top-2{top:2px}.pi .isolate{isolation:isolate}.pi .z-10{z-index:10}.pi .z-20{z-index:20}.pi .z-50{z-index:50}.pi .z-cropzone{z-index:10}.pi .z-loading-indicator{z-index:50}.pi .z-modal{z-index:110}.pi .z-navbar{z-index:40}.pi .z-obj-box{z-index:20}.pi .z-popover{z-index:130}.pi .z-toast{z-index:160}.pi .z-tool-overlay{z-index:30}.pi .z-tooltip{z-index:150}.pi .z-tray{z-index:120}.pi .m-auto{margin:auto}.pi .mx-20{margin-left:20px;margin-right:20px}.pi .mx-8{margin-left:8px;margin-right:8px}.pi .mx-auto{margin-left:auto;margin-right:auto}.pi .my-20{margin-bottom:20px;margin-top:20px}.pi .my-4{margin-bottom:4px;margin-top:4px}.pi .my-6{margin-bottom:6px;margin-top:6px}.pi .my-8{margin-bottom:8px;margin-top:8px}.pi .my-auto{margin-bottom:auto;margin-top:auto}.pi .-ml-1{margin-left:-1px}.pi .-ml-10{margin-left:-10px}.pi .-ml-12{margin-left:-12px}.pi .-ml-3{margin-left:-3px}.pi .-ml-4{margin-left:-4px}.pi .-ml-6{margin-left:-6px}.pi .-mr-4{margin-right:-4px}.pi .-mr-8{margin-right:-8px}.pi .mb-1{margin-bottom:1px}.pi .mb-10{margin-bottom:10px}.pi .mb-16{margin-bottom:16px}.pi .mb-2{margin-bottom:2px}.pi .mb-20{margin-bottom:20px}.pi .mb-24{margin-bottom:24px}.pi .mb-4{margin-bottom:4px}.pi .mb-6{margin-bottom:6px}.pi .mb-8{margin-bottom:8px}.pi .ml-10{margin-left:10px}.pi .ml-12{margin-left:12px}.pi .ml-4{margin-left:4px}.pi .ml-6{margin-left:6px}.pi .ml-8{margin-left:8px}.pi .ml-auto{margin-left:auto}.pi .mr-10{margin-right:10px}.pi .mr-16{margin-right:16px}.pi .mr-20{margin-right:20px}.pi .mr-4{margin-right:4px}.pi .mr-5{margin-right:5px}.pi .mr-6{margin-right:6px}.pi .mr-8{margin-right:8px}.pi .mr-auto{margin-right:auto}.pi .mt-0{margin-top:0}.pi .mt-10{margin-top:10px}.pi .mt-14{margin-top:14px}.pi .mt-20{margin-top:20px}.pi .mt-24{margin-top:24px}.pi .mt-4{margin-top:4px}.pi .mt-6{margin-top:6px}.pi .box-content{box-sizing:content-box}.pi .block{display:block}.pi .inline-block{display:inline-block}.pi .inline{display:inline}.pi .flex{display:flex}.pi .inline-flex{display:inline-flex}.pi .grid{display:grid}.pi .contents{display:contents}.pi .hidden{display:none}.pi .aspect-square{aspect-ratio:1/1}.pi .h-1{height:1px}.pi .h-12{height:12px}.pi .h-128{height:128px}.pi .h-14{height:14px}.pi .h-16{height:16px}.pi .h-18{height:18px}.pi .h-2{height:2px}.pi .h-2\\/4{height:50%}.pi .h-20{height:20px}.pi .h-22{height:22px}.pi .h-24{height:24px}.pi .h-26{height:26px}.pi .h-28{height:28px}.pi .h-3{height:3px}.pi .h-30{height:30px}.pi .h-32{height:32px}.pi .h-36{height:36px}.pi .h-38{height:2.375rem}.pi .h-4{height:4px}.pi .h-40{height:40px}.pi .h-42{height:42px}.pi .h-48{height:48px}.pi .h-50{height:50px}.pi .h-56{height:56px}.pi .h-6{height:6px}.pi .h-60{height:60px}.pi .h-64{height:64px}.pi .h-68{height:68px}.pi .h-8{height:8px}.pi .h-80{height:80px}.pi .h-84{height:84px}.pi .h-92{height:92px}.pi .h-\\[54px\\]{height:54px}.pi .h-font{height:1em}.pi .h-full{height:100%}.pi .h-px{height:1px}.pi .h-screen{height:100dvh}.pi .max-h-100{max-height:6.25rem}.pi .max-h-\\[calc\\(100\\%-40px\\)\\]{max-height:calc(100% - 40px)}.pi .max-h-\\[calc\\(100vh-90px\\)\\]{max-height:calc(100vh - 90px)}.pi .max-h-dialog{max-height:calc(var(--be-viewport-height, 100vh)*.9)}.pi .max-h-full{max-height:100%}.pi .max-h-inherit{max-height:inherit}.pi .max-h-tray{max-height:calc(var(--be-viewport-height, 100vh)*.9)}.pi .min-h-24{min-height:24px}.pi .min-h-30{min-height:30px}.pi .min-h-36{min-height:36px}.pi .min-h-42{min-height:42px}.pi .min-h-50{min-height:50px}.pi .min-h-60{min-height:60px}.pi .min-h-86{min-height:86px}.pi .\\!w-auto{width:auto!important}.pi .w-1\\/2{width:50%}.pi .w-110{width:110px}.pi .w-12{width:12px}.pi .w-1280{width:80rem}.pi .w-14{width:14px}.pi .w-144{width:144px}.pi .w-16{width:16px}.pi .w-18{width:18px}.pi .w-2{width:2px}.pi .w-20{width:20px}.pi .w-22{width:22px}.pi .w-224{width:224px}.pi .w-24{width:24px}.pi .w-256{width:256px}.pi .w-26{width:26px}.pi .w-28{width:28px}.pi .w-280{width:17.5rem}.pi .w-30{width:30px}.pi .w-32{width:32px}.pi .w-320{width:320px}.pi .w-36{width:36px}.pi .w-38{width:2.375rem}.pi .w-384{width:384px}.pi .w-40{width:40px}.pi .w-42{width:42px}.pi .w-440{width:27.5rem}.pi .w-46{width:2.875rem}.pi .w-50{width:50px}.pi .w-56{width:56px}.pi .w-60{width:60px}.pi .w-620{width:38.75rem}.pi .w-64{width:64px}.pi .w-68{width:68px}.pi .w-780{width:48.75rem}.pi .w-8{width:8px}.pi .w-80{width:80px}.pi .w-850{width:53.125rem}.pi .w-96{width:96px}.pi .w-\\[4ch\\]{width:4ch}.pi .w-auto{width:auto}.pi .w-font{width:1em}.pi .w-full{width:100%}.pi .w-max{width:-moz-max-content;width:max-content}.pi .w-min{width:-moz-min-content;width:min-content}.pi .w-px{width:1px}.pi .w-screen{width:100vw}.pi .min-w-0{min-width:0}.pi .min-w-128{min-width:128px}.pi .min-w-180{min-width:11.25rem}.pi .min-w-192{min-width:192px}.pi .min-w-288{min-width:288px}.pi .min-w-30{min-width:30px}.pi .min-w-4{min-width:4px}.pi .min-w-42{min-width:42px}.pi .min-w-92{min-width:92px}.pi .min-w-min{min-width:-moz-min-content;min-width:min-content}.pi .max-w-112{max-width:112px}.pi .max-w-240{max-width:240px}.pi .max-w-288{max-width:288px}.pi .max-w-320{max-width:320px}.pi .max-w-375{max-width:375px}.pi .max-w-500{max-width:31.25rem}.pi .max-w-\\[90\\%\\]{max-width:90%}.pi .max-w-\\[calc\\(100\\%-40px\\)\\]{max-width:calc(100% - 40px)}.pi .max-w-\\[calc\\(100vw-90px\\)\\]{max-width:calc(100vw - 90px)}.pi .max-w-dialog{max-width:calc(var(--be-viewport-width, 100vw)*.9)}.pi .max-w-full{max-width:100%}.pi .max-w-max{max-width:-moz-max-content;max-width:max-content}.pi .flex-\\[1_1_60px\\]{flex:1 1 60px}.pi .flex-auto{flex:1 1 auto}.pi .flex-shrink-0,.pi .shrink-0{flex-shrink:0}.pi .origin-\\[0_55\\%\\]{transform-origin:0 55%}.pi .origin-\\[100\\%\\]{transform-origin:100%}.pi .-translate-x-1\\/2{--tw-translate-x:-50%}.pi .-translate-x-1\\/2,.pi .-translate-y-1\\/2{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .-translate-y-1\\/2{--tw-translate-y:-50%}.pi .rotate-0{--tw-rotate:0deg}.pi .rotate-0,.pi .rotate-180{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .rotate-180{--tw-rotate:180deg}.pi .rotate-45{--tw-rotate:45deg}.pi .rotate-45,.pi .rotate-90{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .rotate-90{--tw-rotate:90deg}.pi .scale-y-\\[0\\.6\\]{--tw-scale-y:.6}.pi .scale-y-\\[0\\.6\\],.pi .transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .cursor-default{cursor:default}.pi .cursor-move{cursor:move}.pi .cursor-nesw-resize{cursor:nesw-resize}.pi .cursor-not-allowed{cursor:not-allowed}.pi .cursor-nwse-resize{cursor:nwse-resize}.pi .cursor-pointer{cursor:pointer}.pi .cursor-se-resize{cursor:se-resize}.pi .cursor-sw-resize{cursor:sw-resize}.pi .touch-none{touch-action:none}.pi .select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.pi .resize{resize:both}.pi .appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.pi .grid-cols-5-min-content{grid-template-columns:repeat(5,min-content)}.pi .flex-row{flex-direction:row}.pi .flex-col{flex-direction:column}.pi .flex-col-reverse{flex-direction:column-reverse}.pi .flex-wrap{flex-wrap:wrap}.pi .flex-nowrap{flex-wrap:nowrap}.pi .items-start{align-items:flex-start}.pi .items-end{align-items:flex-end}.pi .items-center{align-items:center}.pi .items-stretch{align-items:stretch}.pi .justify-start{justify-content:flex-start}.pi .justify-center{justify-content:center}.pi .justify-between{justify-content:space-between}.pi .gap-10{gap:10px}.pi .gap-14{gap:14px}.pi .gap-16{gap:16px}.pi .gap-18{gap:18px}.pi .gap-20{gap:20px}.pi .gap-36{gap:36px}.pi .gap-4{gap:4px}.pi .gap-40{gap:40px}.pi .gap-6{gap:6px}.pi .gap-8{gap:8px}.pi .space-y-10>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(10px*var(--tw-space-y-reverse));margin-top:calc(10px*(1 - var(--tw-space-y-reverse)))}.pi .overflow-auto{overflow:auto}.pi .overflow-hidden{overflow:hidden}.pi .overflow-x-auto{overflow-x:auto}.pi .overflow-y-auto{overflow-y:auto}.pi .overflow-x-hidden{overflow-x:hidden}.pi .overflow-y-hidden{overflow-y:hidden}.pi .overscroll-contain{overscroll-behavior:contain}.pi .truncate{overflow:hidden;white-space:nowrap}.pi .overflow-ellipsis,.pi .text-ellipsis,.pi .truncate{text-overflow:ellipsis}.pi .whitespace-normal{white-space:normal}.pi .whitespace-nowrap{white-space:nowrap}.pi .break-words{overflow-wrap:break-word}.pi .rounded{border-radius:4px}.pi .rounded-2xl{border-radius:16px}.pi .rounded-3xl{border-radius:24px}.pi .rounded-button{border-radius:var(--be-button-radius,.25rem)}.pi .rounded-full{border-radius:9999px}.pi .rounded-input{border-radius:var(--be-input-radius,.25rem)}.pi .rounded-lg{border-radius:8px}.pi .rounded-md{border-radius:6px}.pi .rounded-none{border-radius:0}.pi .rounded-panel{border-radius:var(--be-panel-radius,.25rem)}.pi .rounded-xl{border-radius:12px}.pi .rounded-l{border-bottom-left-radius:4px;border-top-left-radius:4px}.pi .rounded-l-full{border-bottom-left-radius:9999px;border-top-left-radius:9999px}.pi .rounded-l-input{border-bottom-left-radius:var(--be-input-radius,.25rem);border-top-left-radius:var(--be-input-radius,.25rem)}.pi .rounded-l-none{border-bottom-left-radius:0;border-top-left-radius:0}.pi .rounded-r-full{border-bottom-right-radius:9999px;border-top-right-radius:9999px}.pi .rounded-r-input{border-bottom-right-radius:var(--be-input-radius,.25rem);border-top-right-radius:var(--be-input-radius,.25rem)}.pi .rounded-r-none{border-bottom-right-radius:0;border-top-right-radius:0}.pi .rounded-t{border-top-left-radius:4px;border-top-right-radius:4px}.pi .rounded-bl-none{border-bottom-left-radius:0}.pi .rounded-br-none{border-bottom-right-radius:0}.pi .rounded-tl-none{border-top-left-radius:0}.pi .rounded-tr-none{border-top-right-radius:0}.pi .border{border-width:1px}.pi .border-2{border-width:2px}.pi .border-4{border-width:4px}.pi .border-\\[3px\\]{border-width:3px}.pi .border-y{border-top-width:1px}.pi .border-b,.pi .border-y{border-bottom-width:1px}.pi .border-b-4{border-bottom-width:4px}.pi .border-l{border-left-width:1px}.pi .border-l-4{border-left-width:4px}.pi .border-r{border-right-width:1px}.pi .border-r-4{border-right-width:4px}.pi .border-t{border-top-width:1px}.pi .border-t-4{border-top-width:4px}.pi .border-dotted{border-style:dotted}.pi .border-none{border-style:none}.pi .border-background{--tw-border-opacity:1;border-color:rgb(var(--be-background)/var(--tw-border-opacity))}.pi .border-bg-alt{--tw-border-opacity:1;border-color:rgb(var(--be-background-alt)/var(--tw-border-opacity))}.pi .border-chip{--tw-border-opacity:1;border-color:rgb(var(--be-background-chip)/var(--tw-border-opacity))}.pi .border-danger{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity))}.pi .border-danger\\/50{border-color:#ef444480}.pi .border-divider{border-color:rgb(var(--be-foreground-base)/var(--be-divider-opacity))}.pi .border-paper{--tw-border-opacity:1;border-color:rgb(var(--be-paper)/var(--tw-border-opacity))}.pi .border-positive\\/50{border-color:#22c55e80}.pi .border-primary{--tw-border-opacity:1;border-color:rgb(var(--be-primary)/var(--tw-border-opacity))}.pi .border-primary\\/50{border-color:rgb(var(--be-primary)/.5)}.pi .border-text-muted{border-color:rgb(var(--be-foreground-base)/var(--be-text-muted-opacity))}.pi .border-transparent{border-color:transparent}.pi .border-white{--tw-border-opacity:1;border-color:rgb(255 255 255/var(--tw-border-opacity))}.pi .border-white\\/50{border-color:#ffffff80}.pi .border-b-bg{--tw-border-opacity:1;border-bottom-color:rgb(var(--be-background)/var(--tw-border-opacity))}.pi .border-b-transparent{border-bottom-color:transparent}.pi .border-r-transparent{border-right-color:transparent}.pi .bg{--tw-bg-opacity:1;background-color:rgb(var(--be-background)/var(--tw-bg-opacity))}.pi .bg-alt{--tw-bg-opacity:1;background-color:rgb(var(--be-background-alt)/var(--tw-bg-opacity))}.pi .bg-background{--tw-bg-opacity:1;background-color:rgb(var(--be-background)/var(--tw-bg-opacity))}.pi .bg-background\\/70{background-color:rgb(var(--be-background)/.7)}.pi .bg-background\\/80{background-color:rgb(var(--be-background)/.8)}.pi .bg-black\\/50{background-color:#00000080}.pi .bg-black\\/80{background-color:#000c}.pi .bg-chip{--tw-bg-opacity:1;background-color:rgb(var(--be-background-chip)/var(--tw-bg-opacity))}.pi .bg-controls{--tw-bg-opacity:1;background-color:rgb(50 50 50/var(--tw-bg-opacity))}.pi .bg-danger{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity))}.pi .bg-danger-lighter{--tw-bg-opacity:1;background-color:rgb(254 202 202/var(--tw-bg-opacity))}.pi .bg-divider{background-color:rgb(var(--be-foreground-base)/var(--be-divider-opacity))}.pi .bg-fg-base\\/4{background-color:rgb(var(--be-foreground-base)/4%)}.pi .bg-focus{background-color:rgb(var(--be-foreground-base)/var(--be-focus-opacity))}.pi .bg-inherit{background-color:inherit}.pi .bg-paper{--tw-bg-opacity:1;background-color:rgb(var(--be-paper)/var(--tw-bg-opacity))}.pi .bg-positive{--tw-bg-opacity:1;background-color:rgb(34 197 94/var(--tw-bg-opacity))}.pi .bg-positive-lighter{--tw-bg-opacity:1;background-color:rgb(187 247 208/var(--tw-bg-opacity))}.pi .bg-primary{--tw-bg-opacity:1;background-color:rgb(var(--be-primary)/var(--tw-bg-opacity))}.pi .bg-primary-dark{--tw-bg-opacity:1;background-color:rgb(var(--be-primary-dark)/var(--tw-bg-opacity))}.pi .bg-primary-light{--tw-bg-opacity:1;background-color:rgb(var(--be-primary-light)/var(--tw-bg-opacity))}.pi .bg-primary\\/focus{background-color:rgb(var(--be-primary)/var(--be-focus-opacity))}.pi .bg-primary\\/selected{background-color:rgb(var(--be-primary)/var(--be-selected-opacity))}.pi .bg-slider-disabled{--tw-bg-opacity:1;background-color:rgb(189 189 189/var(--tw-bg-opacity))}.pi .bg-slider-disabled\\/60{background-color:#bdbdbd99}.pi .bg-toast{--tw-bg-opacity:1;background-color:rgb(50 50 50/var(--tw-bg-opacity))}.pi .bg-transparent{background-color:transparent}.pi .bg-warning{--tw-bg-opacity:1;background-color:rgb(243 164 50/var(--tw-bg-opacity))}.pi .bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.pi .bg-white\\/50{background-color:#ffffff80}.pi .bg-opacity-95{--tw-bg-opacity:.95}.pi .bg-no-repeat{background-repeat:no-repeat}.pi .fill-current{fill:currentColor}.pi .fill-transparent{fill:transparent}.pi .stroke-current{stroke:currentColor}.pi .object-contain{-o-object-fit:contain;object-fit:contain}.pi .object-cover{-o-object-fit:cover;object-fit:cover}.pi .p-0{padding:0}.pi .p-10{padding:10px}.pi .p-14{padding:14px}.pi .p-16{padding:16px}.pi .p-18{padding:18px}.pi .p-2{padding:2px}.pi .p-20{padding:20px}.pi .p-4{padding:4px}.pi .p-40{padding:40px}.pi .p-6{padding:6px}.pi .p-8{padding:8px}.pi .px-10{padding-left:10px;padding-right:10px}.pi .px-12{padding-left:12px;padding-right:12px}.pi .px-14{padding-left:14px;padding-right:14px}.pi .px-16{padding-left:16px;padding-right:16px}.pi .px-18{padding-left:18px;padding-right:18px}.pi .px-20{padding-left:20px;padding-right:20px}.pi .px-22{padding-left:22px;padding-right:22px}.pi .px-24{padding-left:24px;padding-right:24px}.pi .px-26{padding-left:26px;padding-right:26px}.pi .px-32{padding-left:32px;padding-right:32px}.pi .px-4{padding-left:4px;padding-right:4px}.pi .px-5vw{padding-left:5vw;padding-right:5vw}.pi .px-6{padding-left:6px;padding-right:6px}.pi .px-8{padding-left:8px;padding-right:8px}.pi .py-10{padding-bottom:10px;padding-top:10px}.pi .py-12{padding-bottom:12px;padding-top:12px}.pi .py-14{padding-bottom:14px;padding-top:14px}.pi .py-2{padding-bottom:2px;padding-top:2px}.pi .py-20{padding-bottom:20px;padding-top:20px}.pi .py-3{padding-bottom:3px;padding-top:3px}.pi .py-4{padding-bottom:4px;padding-top:4px}.pi .py-5{padding-bottom:5px;padding-top:5px}.pi .py-6{padding-bottom:6px;padding-top:6px}.pi .py-8{padding-bottom:8px;padding-top:8px}.pi .py-\\[9px\\]{padding-bottom:9px;padding-top:9px}.pi .pb-10{padding-bottom:10px}.pi .pb-12{padding-bottom:12px}.pi .pb-14{padding-bottom:14px}.pi .pb-16{padding-bottom:16px}.pi .pb-18{padding-bottom:18px}.pi .pb-20{padding-bottom:20px}.pi .pb-4{padding-bottom:4px}.pi .pb-8{padding-bottom:8px}.pi .pb-safe-area{padding-bottom:env(safe-area-inset-bottom)}.pi .pl-10{padding-left:10px}.pi .pl-12{padding-left:12px}.pi .pl-14{padding-left:14px}.pi .pl-16{padding-left:16px}.pi .pl-18{padding-left:18px}.pi .pl-28{padding-left:28px}.pi .pl-46{padding-left:2.875rem}.pi .pl-54{padding-left:3.375rem}.pi .pl-8{padding-left:8px}.pi .pr-10{padding-right:10px}.pi .pr-12{padding-right:12px}.pi .pr-18{padding-right:18px}.pi .pr-24{padding-right:24px}.pi .pr-28{padding-right:28px}.pi .pr-46{padding-right:2.875rem}.pi .pr-54{padding-right:3.375rem}.pi .pr-6{padding-right:6px}.pi .pr-8{padding-right:8px}.pi .pt-10{padding-top:10px}.pi .pt-12{padding-top:12px}.pi .pt-14{padding-top:14px}.pi .pt-16{padding-top:16px}.pi .pt-20{padding-top:20px}.pi .pt-24{padding-top:24px}.pi .pt-4{padding-top:4px}.pi .pt-40{padding-top:40px}.pi .pt-6{padding-top:6px}.pi .text-left{text-align:left}.pi .text-center{text-align:center}.pi .text-right{text-align:right}.pi .align-middle{vertical-align:middle}.pi .text-base{font-size:16px;line-height:24px}.pi .text-lg{font-size:18px;line-height:28px}.pi .text-sm{font-size:14px;line-height:20px}.pi .text-xl{font-size:20px;line-height:28px}.pi .text-xs{font-size:12px;line-height:16px}.pi .font-bold{font-weight:700}.pi .font-medium{font-weight:500}.pi .font-semibold{font-weight:600}.pi .uppercase{text-transform:uppercase}.pi .capitalize{text-transform:capitalize}.pi .italic{font-style:italic}.pi .tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.pi .leading-5{line-height:1.25rem}.pi .leading-none{line-height:1}.pi .tracking-wide{letter-spacing:.025em}.pi .\\!text{color:rgb(var(--be-foreground-base)/var(--be-text-main-opacity))!important}.pi .text{color:rgb(var(--be-foreground-base)/var(--be-text-main-opacity))}.pi .text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity))}.pi .text-black\\/30{color:#0000004d}.pi .text-danger{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity))}.pi .text-danger-darker{--tw-text-opacity:1;color:rgb(153 27 27/var(--tw-text-opacity))}.pi .text-disabled{color:rgb(var(--be-foreground-base)/var(--be-disabled-fg-opacity))}.pi .text-link{--tw-text-opacity:1;color:rgb(var(--be-link-color,var(--be-primary))/var(--tw-text-opacity))}.pi .text-main{color:rgb(var(--be-foreground-base)/var(--be-text-main-opacity))}.pi .text-muted{color:rgb(var(--be-foreground-base)/var(--be-text-muted-opacity))}.pi .text-on-primary{--tw-text-opacity:1;color:rgb(var(--be-on-primary)/var(--tw-text-opacity))}.pi .text-positive{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity))}.pi .text-positive-darker{--tw-text-opacity:1;color:rgb(22 101 52/var(--tw-text-opacity))}.pi .text-primary{--tw-text-opacity:1;color:rgb(var(--be-primary)/var(--tw-text-opacity))}.pi .text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.pi .underline{text-decoration-line:underline}.pi .no-underline{text-decoration-line:none}.pi .caret-transparent{caret-color:transparent}.pi .opacity-0{opacity:0}.pi .opacity-100{opacity:1}.pi .opacity-70{opacity:.7}.pi .opacity-80{opacity:.8}.pi .opacity-90{opacity:.9}.pi .shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.pi .shadow,.pi .shadow-2xl{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.pi .shadow-2xl{--tw-shadow:0 25px 50px -12px rgba(0,0,0,.25);--tw-shadow-colored:0 25px 50px -12px var(--tw-shadow-color)}.pi .shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.pi .shadow-lg,.pi .shadow-md{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.pi .shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.pi .shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.pi .shadow-sm,.pi .shadow-xl{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.pi .shadow-xl{--tw-shadow:0 20px 25px -5px rgba(0,0,0,.1),0 8px 10px -6px rgba(0,0,0,.1);--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color),0 8px 10px -6px var(--tw-shadow-color)}.pi .outline-none{outline:2px solid transparent;outline-offset:2px}.pi .outline{outline-color:rgb(var(--be-primary-lighter)/1);outline-style:solid;outline-width:2px}.pi .ring{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .ring-inset{--tw-ring-inset:inset}.pi .blur{--tw-blur:blur(8px)}.pi .blur,.pi .grayscale{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.pi .grayscale{--tw-grayscale:grayscale(100%)}.pi .invert{--tw-invert:invert(100%)}.pi .invert,.pi .sepia{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.pi .sepia{--tw-sepia:sepia(100%)}.pi .filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.pi .backdrop-blur-sm{--tw-backdrop-blur:blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.pi .transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-button{transition-duration:.15s;transition-property:background-color,box-shadow,border-color,color;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-shadow{transition-duration:.15s;transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-transform{transition-duration:.15s;transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-width{transition-duration:.15s;transition-property:width;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .duration-100{transition-duration:.1s}.pi .duration-200{transition-duration:.2s}.pi .will-change-transform{will-change:transform}.pi .icon-2xs{font-size:.75rem}.pi .icon-xs{font-size:1rem}.pi .icon-sm{font-size:1.25rem}.pi .icon-md{font-size:1.5rem}.pi .icon-lg{font-size:2.1875rem}.pi .icon-xl{font-size:2.6875rem}.pi .no-tap-highlight{-webkit-tap-highlight-color:transparent}@media only screen and (min-device-width:768px){.pi .tiny-scrollbar{scrollbar-color:rgba(0,0,0,.2) transparent;scrollbar-width:thin}.pi .tiny-scrollbar::-webkit-scrollbar{background-color:transparent;height:6px;width:6px}.pi .tiny-scrollbar::-webkit-scrollbar-thumb{background-color:rgb(var(--be-foreground-base)/.2);border-radius:10px}.pi .tiny-scrollbar::-webkit-scrollbar-track-piece:start{background:transparent}.pi .tiny-scrollbar::-webkit-scrollbar-track-piece:end{background:transparent}}.pi .hide-scrollbar{-ms-overflow-style:none;scrollbar-width:none}.pi .hide-scrollbar::-webkit-scrollbar{background:transparent;display:none;height:0;width:0}.pi .svg-icon{display:inline-block;flex-shrink:0;-webkit-user-select:none;-moz-user-select:none;user-select:none;fill:currentColor;transition-duration:.15s;transition-property:transform,fill;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .cropzone:not(.moving) .cropzone-transition{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .first-letter\\:capitalize:first-letter{text-transform:capitalize}.pi .file\\:mr-10::file-selector-button{margin-right:10px}.pi .file\\:h-24::file-selector-button{height:24px}.pi .file\\:rounded::file-selector-button{border-radius:4px}.pi .file\\:border-none::file-selector-button{border-style:none}.pi .file\\:bg-primary::file-selector-button{--tw-bg-opacity:1;background-color:rgb(var(--be-primary)/var(--tw-bg-opacity))}.pi .file\\:px-10::file-selector-button{padding-left:10px;padding-right:10px}.pi .file\\:text-sm::file-selector-button{font-size:14px;line-height:20px}.pi .file\\:font-semibold::file-selector-button{font-weight:600}.pi .file\\:text-on-primary::file-selector-button{--tw-text-opacity:1;color:rgb(var(--be-on-primary)/var(--tw-text-opacity))}.pi .before\\:z-10:before{content:var(--tw-content);z-index:10}.pi .before\\:block:before{content:var(--tw-content);display:block}.pi .before\\:h-12:before{content:var(--tw-content);height:12px}.pi .before\\:h-14:before{content:var(--tw-content);height:14px}.pi .before\\:h-18:before{content:var(--tw-content);height:18px}.pi .before\\:h-22:before{content:var(--tw-content);height:22px}.pi .before\\:h-28:before{content:var(--tw-content);height:28px}.pi .before\\:h-full:before{content:var(--tw-content);height:100%}.pi .before\\:w-12:before{content:var(--tw-content);width:12px}.pi .before\\:w-14:before{content:var(--tw-content);width:14px}.pi .before\\:w-18:before{content:var(--tw-content);width:18px}.pi .before\\:w-22:before{content:var(--tw-content);width:22px}.pi .before\\:w-28:before{content:var(--tw-content);width:28px}.pi .before\\:w-full:before{content:var(--tw-content);width:100%}.pi .before\\:translate-x-2:before{--tw-translate-x:2px}.pi .before\\:scale-10:before,.pi .before\\:translate-x-2:before{content:var(--tw-content);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .before\\:scale-10:before{--tw-scale-x:.1;--tw-scale-y:.1}.pi .before\\:rounded-3xl:before{border-radius:24px;content:var(--tw-content)}.pi .before\\:rounded-full:before{border-radius:9999px;content:var(--tw-content)}.pi .before\\:border:before{border-width:1px;content:var(--tw-content)}.pi .before\\:bg-primary:before{content:var(--tw-content);--tw-bg-opacity:1;background-color:rgb(var(--be-primary)/var(--tw-bg-opacity))}.pi .before\\:bg-white:before{content:var(--tw-content);--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.pi .before\\:opacity-0:before{content:var(--tw-content);opacity:0}.pi .before\\:transition:before{content:var(--tw-content);transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .before\\:transition-transform:before{content:var(--tw-content);transition-duration:.15s;transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .before\\:duration-200:before{content:var(--tw-content);transition-duration:.2s}.pi .after\\:pointer-events-none:after{content:var(--tw-content);pointer-events:none}.pi .after\\:absolute:after{content:var(--tw-content);position:absolute}.pi .after\\:inset-0:after{content:var(--tw-content);top:0;right:0;bottom:0;left:0}.pi .checked\\:border-danger:checked{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity))}.pi .checked\\:border-primary:checked{--tw-border-opacity:1;border-color:rgb(var(--be-primary)/var(--tw-border-opacity))}.pi .checked\\:bg-danger:checked{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity))}.pi .checked\\:bg-primary:checked{--tw-bg-opacity:1;background-color:rgb(var(--be-primary)/var(--tw-bg-opacity))}.pi .checked\\:before\\:translate-x-14:checked:before{--tw-translate-x:14px}.pi .checked\\:before\\:translate-x-14:checked:before,.pi .checked\\:before\\:translate-x-20:checked:before{content:var(--tw-content);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .checked\\:before\\:translate-x-20:checked:before{--tw-translate-x:20px}.pi .checked\\:before\\:translate-x-24:checked:before{--tw-translate-x:24px}.pi .checked\\:before\\:translate-x-24:checked:before,.pi .checked\\:before\\:translate-x-30:checked:before{content:var(--tw-content);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .checked\\:before\\:translate-x-30:checked:before{--tw-translate-x:30px}.pi .checked\\:before\\:translate-x-36:checked:before{--tw-translate-x:36px}.pi .checked\\:before\\:scale-\\[\\.65\\]:checked:before,.pi .checked\\:before\\:translate-x-36:checked:before{content:var(--tw-content);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .checked\\:before\\:scale-\\[\\.65\\]:checked:before{--tw-scale-x:.65;--tw-scale-y:.65}.pi .checked\\:before\\:border-white:checked:before{content:var(--tw-content);--tw-border-opacity:1;border-color:rgb(255 255 255/var(--tw-border-opacity))}.pi .checked\\:before\\:opacity-100:checked:before{content:var(--tw-content);opacity:1}.pi .focus-within\\:border-primary\\/60:focus-within{border-color:rgb(var(--be-primary)/.6)}.pi .focus-within\\:ring:focus-within{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .focus-within\\:ring-primary\\/focus:focus-within{--tw-ring-color:rgb(var(--be-primary)/var(--be-focus-opacity))}.pi .hover\\:scale-110:hover{--tw-scale-x:1.1;--tw-scale-y:1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .hover\\:border-chip\\/90:hover{border-color:rgb(var(--be-background-chip)/.9)}.pi .hover\\:border-danger:hover{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity))}.pi .hover\\:border-danger\\/90:hover{border-color:#ef4444e6}.pi .hover\\:border-paper\\/90:hover{border-color:rgb(var(--be-paper)/.9)}.pi .hover\\:border-positive:hover{--tw-border-opacity:1;border-color:rgb(34 197 94/var(--tw-border-opacity))}.pi .hover\\:border-primary:hover{--tw-border-opacity:1;border-color:rgb(var(--be-primary)/var(--tw-border-opacity))}.pi .hover\\:border-primary-dark:hover{--tw-border-opacity:1;border-color:rgb(var(--be-primary-dark)/var(--tw-border-opacity))}.pi .hover\\:bg-chip\\/90:hover{background-color:rgb(var(--be-background-chip)/.9)}.pi .hover\\:bg-danger\\/4:hover{background-color:#ef44440a}.pi .hover\\:bg-danger\\/90:hover{background-color:#ef4444e6}.pi .hover\\:bg-fg-base\\/15:hover{background-color:rgb(var(--be-foreground-base)/15%)}.pi .hover\\:bg-hover:hover{background-color:rgb(var(--be-foreground-base)/var(--be-hover-opacity))}.pi .hover\\:bg-paper\\/90:hover{background-color:rgb(var(--be-paper)/.9)}.pi .hover\\:bg-positive\\/4:hover{background-color:#22c55e0a}.pi .hover\\:bg-primary-dark:hover{--tw-bg-opacity:1;background-color:rgb(var(--be-primary-dark)/var(--tw-bg-opacity))}.pi .hover\\:bg-primary\\/4:hover{background-color:rgb(var(--be-primary)/4%)}.pi .hover\\:bg-primary\\/focus:hover{background-color:rgb(var(--be-primary)/var(--be-focus-opacity))}.pi .hover\\:bg-primary\\/hover:hover{background-color:rgb(var(--be-primary)/var(--be-hover-opacity))}.pi .hover\\:bg-white:hover{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.pi .hover\\:bg-white\\/20:hover{background-color:#fff3}.pi .hover\\:bg-white\\/hover:hover{background-color:rgb(255 255 255/var(--be-hover-opacity))}.pi .hover\\:text-main:hover{color:rgb(var(--be-foreground-base)/var(--be-text-main-opacity))}.pi .hover\\:text-primary-dark:hover{--tw-text-opacity:1;color:rgb(var(--be-primary-dark)/var(--tw-text-opacity))}.pi .hover\\:underline:hover{text-decoration-line:underline}.pi .hover\\:shadow-md:hover{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.pi .before\\:hover\\:bg-primary-dark:hover:before{content:var(--tw-content);--tw-bg-opacity:1;background-color:rgb(var(--be-primary-dark)/var(--tw-bg-opacity))}.pi .hover\\:after\\:bg-black\\/5:hover:after{background-color:#0000000d;content:var(--tw-content)}.pi .checked\\:hover\\:border-primary-dark:hover:checked{--tw-border-opacity:1;border-color:rgb(var(--be-primary-dark)/var(--tw-border-opacity))}.pi .focus\\:border-danger\\/60:focus{border-color:#ef444499}.pi .focus\\:border-primary\\/60:focus{border-color:rgb(var(--be-primary)/.6)}.pi .focus\\:bg-primary:focus{--tw-bg-opacity:1;background-color:rgb(var(--be-primary)/var(--tw-bg-opacity))}.pi .focus\\:text-on-primary:focus{--tw-text-opacity:1;color:rgb(var(--be-on-primary)/var(--tw-text-opacity))}.pi .focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.pi .focus\\:ring:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .focus\\:ring-danger\\/focus:focus{--tw-ring-color:rgb(239 68 68/var(--be-focus-opacity))}.pi .focus\\:ring-primary\\/focus:focus{--tw-ring-color:rgb(var(--be-primary)/var(--be-focus-opacity))}.pi .focus\\:after\\:bg-black\\/10:focus:after{background-color:#0000001a;content:var(--tw-content)}.pi .focus-visible\\:bg-primary\\/focus:focus-visible{background-color:rgb(var(--be-primary)/var(--be-focus-opacity))}.pi .focus-visible\\:outline:focus-visible{outline-color:rgb(var(--be-primary-lighter)/1);outline-style:solid;outline-width:2px}.pi .focus-visible\\:outline-primary-light:focus-visible{outline-color:rgb(var(--be-primary-light)/1)}.pi .focus-visible\\:ring:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .focus-visible\\:ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .focus-visible\\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px}.pi .disabled\\:pointer-events-none:disabled{pointer-events:none}.pi .disabled\\:cursor-default:disabled{cursor:default}.pi .disabled\\:border-disabled-bg:disabled{border-color:rgb(var(--be-foreground-base)/var(--be-disabled-bg-opacity))}.pi .disabled\\:border-disabled-fg:disabled{border-color:rgb(var(--be-foreground-base)/var(--be-disabled-fg-opacity))}.pi .disabled\\:border-transparent:disabled{border-color:transparent}.pi .disabled\\:border-white\\/70:disabled{border-color:#ffffffb3}.pi .disabled\\:border-r-transparent:disabled{border-right-color:transparent}.pi .disabled\\:bg-disabled:disabled{background-color:rgb(var(--be-foreground-base)/var(--be-disabled-bg-opacity))}.pi .disabled\\:bg-transparent:disabled{background-color:transparent}.pi .disabled\\:text-disabled:disabled{color:rgb(var(--be-foreground-base)/var(--be-disabled-fg-opacity))}.pi .disabled\\:text-white\\/70:disabled{color:#ffffffb3}.pi .disabled\\:shadow-none:disabled{--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.pi .disabled\\:before\\:bg-disabled-fg:disabled:before{background-color:rgb(var(--be-foreground-base)/var(--be-disabled-fg-opacity));content:var(--tw-content)}.pi :is(.dark .dark\\:bg-chip){--tw-bg-opacity:1;background-color:rgb(var(--be-background-chip)/var(--tw-bg-opacity))}.pi :is(.dark .dark\\:text-white\\/50){color:#ffffff80}.pi :is(.dark .dark\\:checked\\:border-primary-dark:checked){--tw-border-opacity:1;border-color:rgb(var(--be-primary-dark)/var(--tw-border-opacity))}.pi :is(.dark .dark\\:checked\\:bg-primary-dark:checked){--tw-bg-opacity:1;background-color:rgb(var(--be-primary-dark)/var(--tw-bg-opacity))}@media (min-width:640px){.pi .sm\\:text-sm{font-size:14px;line-height:20px}}@media (min-width:768px){.pi .md\\:text-lg{font-size:18px;line-height:28px}}.pi .\\[\\&\\>\\.tree-label\\]\\:focus-visible\\:ring:focus-visible>.tree-label{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .\\[\\&\\>\\.tree-label\\]\\:focus-visible\\:ring-2:focus-visible>.tree-label{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .\\[\\&\\>\\.tree-label\\]\\:focus-visible\\:ring-inset:focus-visible>.tree-label{--tw-ring-inset:inset}\n'),!t.selector)throw new Error('Pixie required "selector" option.');const e=document.querySelector(t.selector);e&&(e.classList.add("pi"),function(t){ha=t,da=t}(e),this.setConfig(t),ba.setState({editor:this}),(0,o.H)(e).render((0,r.jsx)(i.StrictMode,{children:(0,r.jsx)(Ek,{})})))}get state(){return ya()}get defaultConfig(){return t.defaultConfig}open(t={}){return new Promise(async e=>{var n;Object.keys(t).length?await this.resetEditor({...es(t,{ui:{visible:!0},image:t.image||ya().config.image,state:t.state||ya().config.state,blankCanvasSize:t.blankCanvasSize||ya().config.blankCanvasSize})}):null!=(n=ya().config.ui)&&n.visible||ya().setConfig({ui:{visible:!0}}),e()})}close(){var t,e,n;null!=(t=ya().config.ui)&&t.visible&&(this.setConfig({ui:{visible:!1}}),null==(n=(e=ya().config).onClose)||n.call(e))}setConfig(t){ya().setConfig(t)}uploadAndAddImage(){return xa().import.uploadAndAddImage()}uploadAndReplaceMainImage(){return xa().import.uploadAndReplaceMainImage()}uploadAndOpenStateFile(){return xa().import.uploadAndOpenStateFile()}newCanvas(t,e,n){return xa().canvas.openNew(t,e,n)}getState(t){return JSON.stringify(ka(t))}setState(t){return xa().import.loadState(t)}async setStateFromUrl(t){const e=await Ca(t);return xa().import.loadState(e)}openTool(t){Ta(t)}applyChanges(){ya().applyChanges()}cancelChanges(){ya().cancelChanges()}async resetEditor(t){await _a(t),await xa().canvas.loadInitialContent()}togglePanel(t,e){"objects"===t&&ya().togglePanel("history",!1),"history"===t&&ya().togglePanel("objects",!1),ya().togglePanel(t,e)}on(t,e){var n;null==(n=this.fabric)||n.on(t,e)}isDirty(){return ya().dirty}get(t){return this.tools[t]}notify(t){return Aa(t)}static init(t){return new Promise(e=>{const n=t.onLoad;t.onLoad=t=>{null==n||n(t),e(t)},new this(t)})}};c(Mk,"defaultConfig",ji),c(Mk,"version",Ti);let Pk=Mk}}]);
|