@signalwire/cfb 0.1.0-dev.202305101347.2829d3e.0 → 0.1.0-dev.202305171602.e314aff.0

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/dist/main.js CHANGED
@@ -1,5 +1,5 @@
1
1
  (function(Lr,Do){typeof exports=="object"&&typeof module<"u"?Do(exports):typeof define=="function"&&define.amd?define(["exports"],Do):(Lr=typeof globalThis<"u"?globalThis:Lr||self,Do(Lr.CFB={}))})(this,function(Lr){"use strict";/**
2
- * Visual Builder v0.0.0 [2829d3e] (https://signalwire.com)
2
+ * Visual Builder v0.0.0 [e314aff] (https://signalwire.com)
3
3
  * Copyright 2018-2023 SignalWire.
4
4
  */
5
5
  function Do(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in e)){const i=Object.getOwnPropertyDescriptor(r,o);i&&Object.defineProperty(e,o,i.get?i:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function dd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ko={},Y0={get exports(){return ko},set exports(e){ko=e}},cs={},N={},K0={get exports(){return N},set exports(e){N=e}},J={};/**
@@ -58,12 +58,12 @@ Error generating stack: `+i.message+`
58
58
  * This source code is licensed under the MIT license found in the
59
59
  * LICENSE file in the root directory of this source tree.
60
60
  */var xl=N,tw=Mc;function nw(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var rw=typeof Object.is=="function"?Object.is:nw,ow=tw.useSyncExternalStore,iw=xl.useRef,sw=xl.useEffect,lw=xl.useMemo,aw=xl.useDebugValue;Ug.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var i=iw(null);if(i.current===null){var s={hasValue:!1,value:null};i.current=s}else s=i.current;i=lw(function(){function a(h){if(!u){if(u=!0,c=h,h=r(h),o!==void 0&&s.hasValue){var v=s.value;if(o(v,h))return f=v}return f=h}if(v=f,rw(c,h))return v;var m=r(h);return o!==void 0&&o(v,m)?v:(c=h,f=m)}var u=!1,c,f,p=n===void 0?null:n;return[function(){return a(t())},p===null?void 0:function(){return a(p())}]},[t,n,r,o]);var l=ow(e,i[0],i[1]);return sw(function(){s.hasValue=!0,s.value=l},[l]),aw(l),l},function(e){e.exports=Ug}(j_);const uw=dd(Pc),{useSyncExternalStoreWithSelector:cw}=uw;function Vg(e,t=e.getState,n){const r=cw(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return N.useDebugValue(r),r}const Bg=e=>{var t;((t={VITE_BASE_URL:"",VITE_BASIC_AUTH:"signalwire:1aG93uXk",VITE_DEFAULT_STYLE_HREF:"https://cdn.swire.io/npm/@signalwire/cfb@dev/dist/style.css",BASE_URL:"/cfb/",MODE:"staging",DEV:!1,PROD:!0,SSR:!1})==null?void 0:t.MODE)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const n=typeof e=="function"?Mg(e):e,r=(o,i)=>Vg(n,o,i);return Object.assign(r,n),r},Tl=e=>e?Bg(e):Bg;function Xe(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}var fw={value:()=>{}};function Il(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Cl(n)}function Cl(e){this._=e}function dw(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",o=n.indexOf(".");if(o>=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Cl.prototype=Il.prototype={constructor:Cl,on:function(e,t){var n=this._,r=dw(e+"",n),o,i=-1,s=r.length;if(arguments.length<2){for(;++i<s;)if((o=(e=r[i]).type)&&(o=pw(n[o],e.name)))return o;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(o=(e=r[i]).type)n[o]=$g(n[o],e.name,t);else if(t==null)for(o in n)n[o]=$g(n[o],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Cl(e)},call:function(e,t){if((o=arguments.length-2)>0)for(var n=new Array(o),r=0,o,i;r<o;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,o=i.length;r<o;++r)i[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],o=0,i=r.length;o<i;++o)r[o].value.apply(t,n)}};function pw(e,t){for(var n=0,r=e.length,o;n<r;++n)if((o=e[n]).name===t)return o.value}function $g(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=fw,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Fc="http://www.w3.org/1999/xhtml";const zg={svg:"http://www.w3.org/2000/svg",xhtml:Fc,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Al(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),zg.hasOwnProperty(t)?{space:zg[t],local:e}:e}function hw(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Fc&&t.documentElement.namespaceURI===Fc?t.createElement(e):t.createElementNS(n,e)}}function gw(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Hg(e){var t=Al(e);return(t.local?gw:hw)(t)}function mw(){}function Vc(e){return e==null?mw:function(){return this.querySelector(e)}}function vw(e){typeof e!="function"&&(e=Vc(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,l=r[o]=new Array(s),a,u,c=0;c<s;++c)(a=i[c])&&(u=e.call(a,a.__data__,c,i))&&("__data__"in a&&(u.__data__=a.__data__),l[c]=u);return new lt(r,this._parents)}function yw(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Ew(){return[]}function jg(e){return e==null?Ew:function(){return this.querySelectorAll(e)}}function Sw(e){return function(){return yw(e.apply(this,arguments))}}function _w(e){typeof e=="function"?e=Sw(e):e=jg(e);for(var t=this._groups,n=t.length,r=[],o=[],i=0;i<n;++i)for(var s=t[i],l=s.length,a,u=0;u<l;++u)(a=s[u])&&(r.push(e.call(a,a.__data__,u,s)),o.push(a));return new lt(r,o)}function Wg(e){return function(){return this.matches(e)}}function Gg(e){return function(t){return t.matches(e)}}var ww=Array.prototype.find;function Rw(e){return function(){return ww.call(this.children,e)}}function Nw(){return this.firstElementChild}function Ow(e){return this.select(e==null?Nw:Rw(typeof e=="function"?e:Gg(e)))}var xw=Array.prototype.filter;function Tw(){return Array.from(this.children)}function Iw(e){return function(){return xw.call(this.children,e)}}function Cw(e){return this.selectAll(e==null?Tw:Iw(typeof e=="function"?e:Gg(e)))}function Aw(e){typeof e!="function"&&(e=Wg(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,l=r[o]=[],a,u=0;u<s;++u)(a=i[u])&&e.call(a,a.__data__,u,i)&&l.push(a);return new lt(r,this._parents)}function Yg(e){return new Array(e.length)}function bw(){return new lt(this._enter||this._groups.map(Yg),this._parents)}function bl(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}bl.prototype={constructor:bl,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Lw(e){return function(){return e}}function Dw(e,t,n,r,o,i){for(var s=0,l,a=t.length,u=i.length;s<u;++s)(l=t[s])?(l.__data__=i[s],r[s]=l):n[s]=new bl(e,i[s]);for(;s<a;++s)(l=t[s])&&(o[s]=l)}function kw(e,t,n,r,o,i,s){var l,a,u=new Map,c=t.length,f=i.length,p=new Array(c),h;for(l=0;l<c;++l)(a=t[l])&&(p[l]=h=s.call(a,a.__data__,l,t)+"",u.has(h)?o[l]=a:u.set(h,a));for(l=0;l<f;++l)h=s.call(e,i[l],l,i)+"",(a=u.get(h))?(r[l]=a,a.__data__=i[l],u.delete(h)):n[l]=new bl(e,i[l]);for(l=0;l<c;++l)(a=t[l])&&u.get(p[l])===a&&(o[l]=a)}function Pw(e){return e.__data__}function Mw(e,t){if(!arguments.length)return Array.from(this,Pw);var n=t?kw:Dw,r=this._parents,o=this._groups;typeof e!="function"&&(e=Lw(e));for(var i=o.length,s=new Array(i),l=new Array(i),a=new Array(i),u=0;u<i;++u){var c=r[u],f=o[u],p=f.length,h=Uw(e.call(c,c&&c.__data__,u,r)),v=h.length,m=l[u]=new Array(v),E=s[u]=new Array(v),d=a[u]=new Array(p);n(c,f,m,E,d,h,t);for(var g=0,y=0,S,w;g<v;++g)if(S=m[g]){for(g>=y&&(y=g+1);!(w=E[y])&&++y<v;);S._next=w||null}}return s=new lt(s,r),s._enter=l,s._exit=a,s}function Uw(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Fw(){return new lt(this._exit||this._groups.map(Yg),this._parents)}function Vw(e,t,n){var r=this.enter(),o=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(o=t(o),o&&(o=o.selection())),n==null?i.remove():n(i),r&&o?r.merge(o).order():o}function Bw(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,o=n.length,i=r.length,s=Math.min(o,i),l=new Array(o),a=0;a<s;++a)for(var u=n[a],c=r[a],f=u.length,p=l[a]=new Array(f),h,v=0;v<f;++v)(h=u[v]||c[v])&&(p[v]=h);for(;a<o;++a)l[a]=n[a];return new lt(l,this._parents)}function $w(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],o=r.length-1,i=r[o],s;--o>=0;)(s=r[o])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function zw(e){e||(e=Hw);function t(f,p){return f&&p?e(f.__data__,p.__data__):!f-!p}for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i){for(var s=n[i],l=s.length,a=o[i]=new Array(l),u,c=0;c<l;++c)(u=s[c])&&(a[c]=u);a.sort(t)}return new lt(o,this._parents).order()}function Hw(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function jw(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Ww(){return Array.from(this)}function Gw(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length;o<i;++o){var s=r[o];if(s)return s}return null}function Yw(){let e=0;for(const t of this)++e;return e}function Kw(){return!this.node()}function Qw(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var o=t[n],i=0,s=o.length,l;i<s;++i)(l=o[i])&&e.call(l,l.__data__,i,o);return this}function Xw(e){return function(){this.removeAttribute(e)}}function qw(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Zw(e,t){return function(){this.setAttribute(e,t)}}function Jw(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function e1(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function t1(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function n1(e,t){var n=Al(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?qw:Xw:typeof t=="function"?n.local?t1:e1:n.local?Jw:Zw)(n,t))}function Kg(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function r1(e){return function(){this.style.removeProperty(e)}}function o1(e,t,n){return function(){this.style.setProperty(e,t,n)}}function i1(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function s1(e,t,n){return arguments.length>1?this.each((t==null?r1:typeof t=="function"?i1:o1)(e,t,n??"")):co(this.node(),e)}function co(e,t){return e.style.getPropertyValue(t)||Kg(e).getComputedStyle(e,null).getPropertyValue(t)}function l1(e){return function(){delete this[e]}}function a1(e,t){return function(){this[e]=t}}function u1(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function c1(e,t){return arguments.length>1?this.each((t==null?l1:typeof t=="function"?u1:a1)(e,t)):this.node()[e]}function Qg(e){return e.trim().split(/^|\s+/)}function Bc(e){return e.classList||new Xg(e)}function Xg(e){this._node=e,this._names=Qg(e.getAttribute("class")||"")}Xg.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function qg(e,t){for(var n=Bc(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function Zg(e,t){for(var n=Bc(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function f1(e){return function(){qg(this,e)}}function d1(e){return function(){Zg(this,e)}}function p1(e,t){return function(){(t.apply(this,arguments)?qg:Zg)(this,e)}}function h1(e,t){var n=Qg(e+"");if(arguments.length<2){for(var r=Bc(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof t=="function"?p1:t?f1:d1)(n,t))}function g1(){this.textContent=""}function m1(e){return function(){this.textContent=e}}function v1(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function y1(e){return arguments.length?this.each(e==null?g1:(typeof e=="function"?v1:m1)(e)):this.node().textContent}function E1(){this.innerHTML=""}function S1(e){return function(){this.innerHTML=e}}function _1(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function w1(e){return arguments.length?this.each(e==null?E1:(typeof e=="function"?_1:S1)(e)):this.node().innerHTML}function R1(){this.nextSibling&&this.parentNode.appendChild(this)}function N1(){return this.each(R1)}function O1(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function x1(){return this.each(O1)}function T1(e){var t=typeof e=="function"?e:Hg(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function I1(){return null}function C1(e,t){var n=typeof e=="function"?e:Hg(e),r=t==null?I1:typeof t=="function"?t:Vc(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function A1(){var e=this.parentNode;e&&e.removeChild(this)}function b1(){return this.each(A1)}function L1(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function D1(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function k1(e){return this.select(e?D1:L1)}function P1(e){return arguments.length?this.property("__data__",e):this.node().__data__}function M1(e){return function(t){e.call(this,t,this.__data__)}}function U1(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function F1(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,o=t.length,i;n<o;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function V1(e,t,n){return function(){var r=this.__on,o,i=M1(t);if(r){for(var s=0,l=r.length;s<l;++s)if((o=r[s]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),o.value=t;return}}this.addEventListener(e.type,i,n),o={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(o):this.__on=[o]}}function B1(e,t,n){var r=U1(e+""),o,i=r.length,s;if(arguments.length<2){var l=this.node().__on;if(l){for(var a=0,u=l.length,c;a<u;++a)for(o=0,c=l[a];o<i;++o)if((s=r[o]).type===c.type&&s.name===c.name)return c.value}return}for(l=t?V1:F1,o=0;o<i;++o)this.each(l(r[o],t,n));return this}function Jg(e,t,n){var r=Kg(e),o=r.CustomEvent;typeof o=="function"?o=new o(t,n):(o=r.document.createEvent("Event"),n?(o.initEvent(t,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}function $1(e,t){return function(){return Jg(this,e,t)}}function z1(e,t){return function(){return Jg(this,e,t.apply(this,arguments))}}function H1(e,t){return this.each((typeof t=="function"?z1:$1)(e,t))}function*j1(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length,s;o<i;++o)(s=r[o])&&(yield s)}var em=[null];function lt(e,t){this._groups=e,this._parents=t}function xi(){return new lt([[document.documentElement]],em)}function W1(){return this}lt.prototype=xi.prototype={constructor:lt,select:vw,selectAll:_w,selectChild:Ow,selectChildren:Cw,filter:Aw,data:Mw,enter:bw,exit:Fw,join:Vw,merge:Bw,selection:W1,order:$w,sort:zw,call:jw,nodes:Ww,node:Gw,size:Yw,empty:Kw,each:Qw,attr:n1,style:s1,property:c1,classed:h1,text:y1,html:w1,raise:N1,lower:x1,append:T1,insert:C1,remove:b1,clone:k1,datum:P1,on:B1,dispatch:H1,[Symbol.iterator]:j1};function At(e){return typeof e=="string"?new lt([[document.querySelector(e)]],[document.documentElement]):new lt([[e]],em)}function G1(e){let t;for(;t=e.sourceEvent;)e=t;return e}function zt(e,t){if(e=G1(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}const Y1={passive:!1},Ti={capture:!0,passive:!1};function $c(e){e.stopImmediatePropagation()}function fo(e){e.preventDefault(),e.stopImmediatePropagation()}function tm(e){var t=e.document.documentElement,n=At(e).on("dragstart.drag",fo,Ti);"onselectstart"in t?n.on("selectstart.drag",fo,Ti):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function nm(e,t){var n=e.document.documentElement,r=At(e).on("dragstart.drag",null);t&&(r.on("click.drag",fo,Ti),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Ll=e=>()=>e;function zc(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:i,x:s,y:l,dx:a,dy:u,dispatch:c}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:a,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:c}})}zc.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function K1(e){return!e.ctrlKey&&!e.button}function Q1(){return this.parentNode}function X1(e,t){return t??{x:e.x,y:e.y}}function q1(){return navigator.maxTouchPoints||"ontouchstart"in this}function Z1(){var e=K1,t=Q1,n=X1,r=q1,o={},i=Il("start","drag","end"),s=0,l,a,u,c,f=0;function p(S){S.on("mousedown.drag",h).filter(r).on("touchstart.drag",E).on("touchmove.drag",d,Y1).on("touchend.drag touchcancel.drag",g).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(S,w){if(!(c||!e.call(this,S,w))){var O=y(this,t.call(this,S,w),S,w,"mouse");O&&(At(S.view).on("mousemove.drag",v,Ti).on("mouseup.drag",m,Ti),tm(S.view),$c(S),u=!1,l=S.clientX,a=S.clientY,O("start",S))}}function v(S){if(fo(S),!u){var w=S.clientX-l,O=S.clientY-a;u=w*w+O*O>f}o.mouse("drag",S)}function m(S){At(S.view).on("mousemove.drag mouseup.drag",null),nm(S.view,u),fo(S),o.mouse("end",S)}function E(S,w){if(e.call(this,S,w)){var O=S.changedTouches,T=t.call(this,S,w),b=O.length,P,k;for(P=0;P<b;++P)(k=y(this,T,S,w,O[P].identifier,O[P]))&&($c(S),k("start",S,O[P]))}}function d(S){var w=S.changedTouches,O=w.length,T,b;for(T=0;T<O;++T)(b=o[w[T].identifier])&&(fo(S),b("drag",S,w[T]))}function g(S){var w=S.changedTouches,O=w.length,T,b;for(c&&clearTimeout(c),c=setTimeout(function(){c=null},500),T=0;T<O;++T)(b=o[w[T].identifier])&&($c(S),b("end",S,w[T]))}function y(S,w,O,T,b,P){var k=i.copy(),B=zt(P||O,w),$,F,R;if((R=n.call(S,new zc("beforestart",{sourceEvent:O,target:p,identifier:b,active:s,x:B[0],y:B[1],dx:0,dy:0,dispatch:k}),T))!=null)return $=R.x-B[0]||0,F=R.y-B[1]||0,function D(A,C,x){var L=B,U;switch(A){case"start":o[b]=D,U=s++;break;case"end":delete o[b],--s;case"drag":B=zt(x||C,w),U=s;break}k.call(A,S,new zc(A,{sourceEvent:C,subject:R,target:p,identifier:b,active:U,x:B[0]+$,y:B[1]+F,dx:B[0]-L[0],dy:B[1]-L[1],dispatch:k}),T)}}return p.filter=function(S){return arguments.length?(e=typeof S=="function"?S:Ll(!!S),p):e},p.container=function(S){return arguments.length?(t=typeof S=="function"?S:Ll(S),p):t},p.subject=function(S){return arguments.length?(n=typeof S=="function"?S:Ll(S),p):n},p.touchable=function(S){return arguments.length?(r=typeof S=="function"?S:Ll(!!S),p):r},p.on=function(){var S=i.on.apply(i,arguments);return S===i?p:S},p.clickDistance=function(S){return arguments.length?(f=(S=+S)*S,p):Math.sqrt(f)},p}function Hc(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function rm(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Ii(){}var Ci=.7,Dl=1/Ci,po="\\s*([+-]?\\d+)\\s*",Ai="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ht="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",J1=/^#([0-9a-f]{3,8})$/,eR=new RegExp(`^rgb\\(${po},${po},${po}\\)$`),tR=new RegExp(`^rgb\\(${Ht},${Ht},${Ht}\\)$`),nR=new RegExp(`^rgba\\(${po},${po},${po},${Ai}\\)$`),rR=new RegExp(`^rgba\\(${Ht},${Ht},${Ht},${Ai}\\)$`),oR=new RegExp(`^hsl\\(${Ai},${Ht},${Ht}\\)$`),iR=new RegExp(`^hsla\\(${Ai},${Ht},${Ht},${Ai}\\)$`),om={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Hc(Ii,bi,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:im,formatHex:im,formatHex8:sR,formatHsl:lR,formatRgb:sm,toString:sm});function im(){return this.rgb().formatHex()}function sR(){return this.rgb().formatHex8()}function lR(){return fm(this).formatHsl()}function sm(){return this.rgb().formatRgb()}function bi(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=J1.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?lm(t):n===3?new qe(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?kl(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?kl(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=eR.exec(e))?new qe(t[1],t[2],t[3],1):(t=tR.exec(e))?new qe(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=nR.exec(e))?kl(t[1],t[2],t[3],t[4]):(t=rR.exec(e))?kl(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=oR.exec(e))?cm(t[1],t[2]/100,t[3]/100,1):(t=iR.exec(e))?cm(t[1],t[2]/100,t[3]/100,t[4]):om.hasOwnProperty(e)?lm(om[e]):e==="transparent"?new qe(NaN,NaN,NaN,0):null}function lm(e){return new qe(e>>16&255,e>>8&255,e&255,1)}function kl(e,t,n,r){return r<=0&&(e=t=n=NaN),new qe(e,t,n,r)}function aR(e){return e instanceof Ii||(e=bi(e)),e?(e=e.rgb(),new qe(e.r,e.g,e.b,e.opacity)):new qe}function jc(e,t,n,r){return arguments.length===1?aR(e):new qe(e,t,n,r??1)}function qe(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Hc(qe,jc,rm(Ii,{brighter(e){return e=e==null?Dl:Math.pow(Dl,e),new qe(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ci:Math.pow(Ci,e),new qe(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new qe(pr(this.r),pr(this.g),pr(this.b),Pl(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:am,formatHex:am,formatHex8:uR,formatRgb:um,toString:um}));function am(){return`#${hr(this.r)}${hr(this.g)}${hr(this.b)}`}function uR(){return`#${hr(this.r)}${hr(this.g)}${hr(this.b)}${hr((isNaN(this.opacity)?1:this.opacity)*255)}`}function um(){const e=Pl(this.opacity);return`${e===1?"rgb(":"rgba("}${pr(this.r)}, ${pr(this.g)}, ${pr(this.b)}${e===1?")":`, ${e})`}`}function Pl(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function pr(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function hr(e){return e=pr(e),(e<16?"0":"")+e.toString(16)}function cm(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new bt(e,t,n,r)}function fm(e){if(e instanceof bt)return new bt(e.h,e.s,e.l,e.opacity);if(e instanceof Ii||(e=bi(e)),!e)return new bt;if(e instanceof bt)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),i=Math.max(t,n,r),s=NaN,l=i-o,a=(i+o)/2;return l?(t===i?s=(n-r)/l+(n<r)*6:n===i?s=(r-t)/l+2:s=(t-n)/l+4,l/=a<.5?i+o:2-i-o,s*=60):l=a>0&&a<1?0:s,new bt(s,l,a,e.opacity)}function cR(e,t,n,r){return arguments.length===1?fm(e):new bt(e,t,n,r??1)}function bt(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Hc(bt,cR,rm(Ii,{brighter(e){return e=e==null?Dl:Math.pow(Dl,e),new bt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ci:Math.pow(Ci,e),new bt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,o=2*n-r;return new qe(Wc(e>=240?e-240:e+120,o,r),Wc(e,o,r),Wc(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new bt(dm(this.h),Ml(this.s),Ml(this.l),Pl(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Pl(this.opacity);return`${e===1?"hsl(":"hsla("}${dm(this.h)}, ${Ml(this.s)*100}%, ${Ml(this.l)*100}%${e===1?")":`, ${e})`}`}}));function dm(e){return e=(e||0)%360,e<0?e+360:e}function Ml(e){return Math.max(0,Math.min(1,e||0))}function Wc(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const pm=e=>()=>e;function fR(e,t){return function(n){return e+n*t}}function dR(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function pR(e){return(e=+e)==1?hm:function(t,n){return n-t?dR(t,n,e):pm(isNaN(t)?n:t)}}function hm(e,t){var n=t-e;return n?fR(e,n):pm(isNaN(e)?t:e)}const gm=function e(t){var n=pR(t);function r(o,i){var s=n((o=jc(o)).r,(i=jc(i)).r),l=n(o.g,i.g),a=n(o.b,i.b),u=hm(o.opacity,i.opacity);return function(c){return o.r=s(c),o.g=l(c),o.b=a(c),o.opacity=u(c),o+""}}return r.gamma=e,r}(1);function Mn(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Gc=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Yc=new RegExp(Gc.source,"g");function hR(e){return function(){return e}}function gR(e){return function(t){return e(t)+""}}function mR(e,t){var n=Gc.lastIndex=Yc.lastIndex=0,r,o,i,s=-1,l=[],a=[];for(e=e+"",t=t+"";(r=Gc.exec(e))&&(o=Yc.exec(t));)(i=o.index)>n&&(i=t.slice(n,i),l[s]?l[s]+=i:l[++s]=i),(r=r[0])===(o=o[0])?l[s]?l[s]+=o:l[++s]=o:(l[++s]=null,a.push({i:s,x:Mn(r,o)})),n=Yc.lastIndex;return n<t.length&&(i=t.slice(n),l[s]?l[s]+=i:l[++s]=i),l.length<2?a[0]?gR(a[0].x):hR(t):(t=a.length,function(u){for(var c=0,f;c<t;++c)l[(f=a[c]).i]=f.x(u);return l.join("")})}var mm=180/Math.PI,Kc={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function vm(e,t,n,r,o,i){var s,l,a;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(a=e*n+t*r)&&(n-=e*a,r-=t*a),(l=Math.sqrt(n*n+r*r))&&(n/=l,r/=l,a/=l),e*r<t*n&&(e=-e,t=-t,a=-a,s=-s),{translateX:o,translateY:i,rotate:Math.atan2(t,e)*mm,skewX:Math.atan(a)*mm,scaleX:s,scaleY:l}}var Ul;function vR(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Kc:vm(t.a,t.b,t.c,t.d,t.e,t.f)}function yR(e){return e==null||(Ul||(Ul=document.createElementNS("http://www.w3.org/2000/svg","g")),Ul.setAttribute("transform",e),!(e=Ul.transform.baseVal.consolidate()))?Kc:(e=e.matrix,vm(e.a,e.b,e.c,e.d,e.e,e.f))}function ym(e,t,n,r){function o(u){return u.length?u.pop()+" ":""}function i(u,c,f,p,h,v){if(u!==f||c!==p){var m=h.push("translate(",null,t,null,n);v.push({i:m-4,x:Mn(u,f)},{i:m-2,x:Mn(c,p)})}else(f||p)&&h.push("translate("+f+t+p+n)}function s(u,c,f,p){u!==c?(u-c>180?c+=360:c-u>180&&(u+=360),p.push({i:f.push(o(f)+"rotate(",null,r)-2,x:Mn(u,c)})):c&&f.push(o(f)+"rotate("+c+r)}function l(u,c,f,p){u!==c?p.push({i:f.push(o(f)+"skewX(",null,r)-2,x:Mn(u,c)}):c&&f.push(o(f)+"skewX("+c+r)}function a(u,c,f,p,h,v){if(u!==f||c!==p){var m=h.push(o(h)+"scale(",null,",",null,")");v.push({i:m-4,x:Mn(u,f)},{i:m-2,x:Mn(c,p)})}else(f!==1||p!==1)&&h.push(o(h)+"scale("+f+","+p+")")}return function(u,c){var f=[],p=[];return u=e(u),c=e(c),i(u.translateX,u.translateY,c.translateX,c.translateY,f,p),s(u.rotate,c.rotate,f,p),l(u.skewX,c.skewX,f,p),a(u.scaleX,u.scaleY,c.scaleX,c.scaleY,f,p),u=c=null,function(h){for(var v=-1,m=p.length,E;++v<m;)f[(E=p[v]).i]=E.x(h);return f.join("")}}}var ER=ym(vR,"px, ","px)","deg)"),SR=ym(yR,", ",")",")"),_R=1e-12;function Em(e){return((e=Math.exp(e))+1/e)/2}function wR(e){return((e=Math.exp(e))-1/e)/2}function RR(e){return((e=Math.exp(2*e))-1)/(e+1)}const NR=function e(t,n,r){function o(i,s){var l=i[0],a=i[1],u=i[2],c=s[0],f=s[1],p=s[2],h=c-l,v=f-a,m=h*h+v*v,E,d;if(m<_R)d=Math.log(p/u)/t,E=function(T){return[l+T*h,a+T*v,u*Math.exp(t*T*d)]};else{var g=Math.sqrt(m),y=(p*p-u*u+r*m)/(2*u*n*g),S=(p*p-u*u-r*m)/(2*p*n*g),w=Math.log(Math.sqrt(y*y+1)-y),O=Math.log(Math.sqrt(S*S+1)-S);d=(O-w)/t,E=function(T){var b=T*d,P=Em(w),k=u/(n*g)*(P*RR(t*b+w)-wR(w));return[l+k*h,a+k*v,u*P/Em(t*b+w)]}}return E.duration=d*1e3*t/Math.SQRT2,E}return o.rho=function(i){var s=Math.max(.001,+i),l=s*s,a=l*l;return e(s,l,a)},o}(Math.SQRT2,2,4);var ho=0,Li=0,Di=0,Sm=1e3,Fl,ki,Vl=0,gr=0,Bl=0,Pi=typeof performance=="object"&&performance.now?performance:Date,_m=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Qc(){return gr||(_m(OR),gr=Pi.now()+Bl)}function OR(){gr=0}function $l(){this._call=this._time=this._next=null}$l.prototype=wm.prototype={constructor:$l,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Qc():+n)+(t==null?0:+t),!this._next&&ki!==this&&(ki?ki._next=this:Fl=this,ki=this),this._call=e,this._time=n,Xc()},stop:function(){this._call&&(this._call=null,this._time=1/0,Xc())}};function wm(e,t,n){var r=new $l;return r.restart(e,t,n),r}function xR(){Qc(),++ho;for(var e=Fl,t;e;)(t=gr-e._time)>=0&&e._call.call(void 0,t),e=e._next;--ho}function Rm(){gr=(Vl=Pi.now())+Bl,ho=Li=0;try{xR()}finally{ho=0,IR(),gr=0}}function TR(){var e=Pi.now(),t=e-Vl;t>Sm&&(Bl-=t,Vl=e)}function IR(){for(var e,t=Fl,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Fl=n);ki=e,Xc(r)}function Xc(e){if(!ho){Li&&(Li=clearTimeout(Li));var t=e-gr;t>24?(e<1/0&&(Li=setTimeout(Rm,e-Pi.now()-Bl)),Di&&(Di=clearInterval(Di))):(Di||(Vl=Pi.now(),Di=setInterval(TR,Sm)),ho=1,_m(Rm))}}function Nm(e,t,n){var r=new $l;return t=t==null?0:+t,r.restart(o=>{r.stop(),e(o+t)},t,n),r}var CR=Il("start","end","cancel","interrupt"),AR=[],Om=0,xm=1,qc=2,zl=3,Tm=4,Zc=5,Hl=6;function jl(e,t,n,r,o,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;bR(e,n,{name:t,index:r,group:o,on:CR,tween:AR,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Om})}function Jc(e,t){var n=Lt(e,t);if(n.state>Om)throw new Error("too late; already scheduled");return n}function jt(e,t){var n=Lt(e,t);if(n.state>zl)throw new Error("too late; already running");return n}function Lt(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function bR(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=wm(i,0,n.time);function i(u){n.state=xm,n.timer.restart(s,n.delay,n.time),n.delay<=u&&s(u-n.delay)}function s(u){var c,f,p,h;if(n.state!==xm)return a();for(c in r)if(h=r[c],h.name===n.name){if(h.state===zl)return Nm(s);h.state===Tm?(h.state=Hl,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[c]):+c<t&&(h.state=Hl,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[c])}if(Nm(function(){n.state===zl&&(n.state=Tm,n.timer.restart(l,n.delay,n.time),l(u))}),n.state=qc,n.on.call("start",e,e.__data__,n.index,n.group),n.state===qc){for(n.state=zl,o=new Array(p=n.tween.length),c=0,f=-1;c<p;++c)(h=n.tween[c].value.call(e,e.__data__,n.index,n.group))&&(o[++f]=h);o.length=f+1}}function l(u){for(var c=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(a),n.state=Zc,1),f=-1,p=o.length;++f<p;)o[f].call(e,c);n.state===Zc&&(n.on.call("end",e,e.__data__,n.index,n.group),a())}function a(){n.state=Hl,n.timer.stop(),delete r[t];for(var u in r)return;delete e.__transition}}function Wl(e,t){var n=e.__transition,r,o,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((r=n[s]).name!==t){i=!1;continue}o=r.state>qc&&r.state<Zc,r.state=Hl,r.timer.stop(),r.on.call(o?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[s]}i&&delete e.__transition}}function LR(e){return this.each(function(){Wl(this,e)})}function DR(e,t){var n,r;return function(){var o=jt(this,e),i=o.tween;if(i!==n){r=n=i;for(var s=0,l=r.length;s<l;++s)if(r[s].name===t){r=r.slice(),r.splice(s,1);break}}o.tween=r}}function kR(e,t,n){var r,o;if(typeof n!="function")throw new Error;return function(){var i=jt(this,e),s=i.tween;if(s!==r){o=(r=s).slice();for(var l={name:t,value:n},a=0,u=o.length;a<u;++a)if(o[a].name===t){o[a]=l;break}a===u&&o.push(l)}i.tween=o}}function PR(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Lt(this.node(),n).tween,o=0,i=r.length,s;o<i;++o)if((s=r[o]).name===e)return s.value;return null}return this.each((t==null?DR:kR)(n,e,t))}function ef(e,t,n){var r=e._id;return e.each(function(){var o=jt(this,r);(o.value||(o.value={}))[t]=n.apply(this,arguments)}),function(o){return Lt(o,r).value[t]}}function Im(e,t){var n;return(typeof t=="number"?Mn:t instanceof bi?gm:(n=bi(t))?(t=n,gm):mR)(e,t)}function MR(e){return function(){this.removeAttribute(e)}}function UR(e){return function(){this.removeAttributeNS(e.space,e.local)}}function FR(e,t,n){var r,o=n+"",i;return function(){var s=this.getAttribute(e);return s===o?null:s===r?i:i=t(r=s,n)}}function VR(e,t,n){var r,o=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===o?null:s===r?i:i=t(r=s,n)}}function BR(e,t,n){var r,o,i;return function(){var s,l=n(this),a;return l==null?void this.removeAttribute(e):(s=this.getAttribute(e),a=l+"",s===a?null:s===r&&a===o?i:(o=a,i=t(r=s,l)))}}function $R(e,t,n){var r,o,i;return function(){var s,l=n(this),a;return l==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),a=l+"",s===a?null:s===r&&a===o?i:(o=a,i=t(r=s,l)))}}function zR(e,t){var n=Al(e),r=n==="transform"?SR:Im;return this.attrTween(e,typeof t=="function"?(n.local?$R:BR)(n,r,ef(this,"attr."+e,t)):t==null?(n.local?UR:MR)(n):(n.local?VR:FR)(n,r,t))}function HR(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function jR(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function WR(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&jR(e,i)),n}return o._value=t,o}function GR(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&HR(e,i)),n}return o._value=t,o}function YR(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=Al(e);return this.tween(n,(r.local?WR:GR)(r,t))}function KR(e,t){return function(){Jc(this,e).delay=+t.apply(this,arguments)}}function QR(e,t){return t=+t,function(){Jc(this,e).delay=t}}function XR(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?KR:QR)(t,e)):Lt(this.node(),t).delay}function qR(e,t){return function(){jt(this,e).duration=+t.apply(this,arguments)}}function ZR(e,t){return t=+t,function(){jt(this,e).duration=t}}function JR(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?qR:ZR)(t,e)):Lt(this.node(),t).duration}function eN(e,t){if(typeof t!="function")throw new Error;return function(){jt(this,e).ease=t}}function tN(e){var t=this._id;return arguments.length?this.each(eN(t,e)):Lt(this.node(),t).ease}function nN(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;jt(this,e).ease=n}}function rN(e){if(typeof e!="function")throw new Error;return this.each(nN(this._id,e))}function oN(e){typeof e!="function"&&(e=Wg(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,l=r[o]=[],a,u=0;u<s;++u)(a=i[u])&&e.call(a,a.__data__,u,i)&&l.push(a);return new cn(r,this._parents,this._name,this._id)}function iN(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,o=n.length,i=Math.min(r,o),s=new Array(r),l=0;l<i;++l)for(var a=t[l],u=n[l],c=a.length,f=s[l]=new Array(c),p,h=0;h<c;++h)(p=a[h]||u[h])&&(f[h]=p);for(;l<r;++l)s[l]=t[l];return new cn(s,this._parents,this._name,this._id)}function sN(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function lN(e,t,n){var r,o,i=sN(t)?Jc:jt;return function(){var s=i(this,e),l=s.on;l!==r&&(o=(r=l).copy()).on(t,n),s.on=o}}function aN(e,t){var n=this._id;return arguments.length<2?Lt(this.node(),n).on.on(e):this.each(lN(n,e,t))}function uN(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function cN(){return this.on("end.remove",uN(this._id))}function fN(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Vc(e));for(var r=this._groups,o=r.length,i=new Array(o),s=0;s<o;++s)for(var l=r[s],a=l.length,u=i[s]=new Array(a),c,f,p=0;p<a;++p)(c=l[p])&&(f=e.call(c,c.__data__,p,l))&&("__data__"in c&&(f.__data__=c.__data__),u[p]=f,jl(u[p],t,n,p,u,Lt(c,n)));return new cn(i,this._parents,t,n)}function dN(e){var t=this._name,n=this._id;typeof e!="function"&&(e=jg(e));for(var r=this._groups,o=r.length,i=[],s=[],l=0;l<o;++l)for(var a=r[l],u=a.length,c,f=0;f<u;++f)if(c=a[f]){for(var p=e.call(c,c.__data__,f,a),h,v=Lt(c,n),m=0,E=p.length;m<E;++m)(h=p[m])&&jl(h,t,n,m,p,v);i.push(p),s.push(c)}return new cn(i,s,t,n)}var pN=xi.prototype.constructor;function hN(){return new pN(this._groups,this._parents)}function gN(e,t){var n,r,o;return function(){var i=co(this,e),s=(this.style.removeProperty(e),co(this,e));return i===s?null:i===n&&s===r?o:o=t(n=i,r=s)}}function Cm(e){return function(){this.style.removeProperty(e)}}function mN(e,t,n){var r,o=n+"",i;return function(){var s=co(this,e);return s===o?null:s===r?i:i=t(r=s,n)}}function vN(e,t,n){var r,o,i;return function(){var s=co(this,e),l=n(this),a=l+"";return l==null&&(a=l=(this.style.removeProperty(e),co(this,e))),s===a?null:s===r&&a===o?i:(o=a,i=t(r=s,l))}}function yN(e,t){var n,r,o,i="style."+t,s="end."+i,l;return function(){var a=jt(this,e),u=a.on,c=a.value[i]==null?l||(l=Cm(t)):void 0;(u!==n||o!==c)&&(r=(n=u).copy()).on(s,o=c),a.on=r}}function EN(e,t,n){var r=(e+="")=="transform"?ER:Im;return t==null?this.styleTween(e,gN(e,r)).on("end.style."+e,Cm(e)):typeof t=="function"?this.styleTween(e,vN(e,r,ef(this,"style."+e,t))).each(yN(this._id,e)):this.styleTween(e,mN(e,r,t),n).on("end.style."+e,null)}function SN(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function _N(e,t,n){var r,o;function i(){var s=t.apply(this,arguments);return s!==o&&(r=(o=s)&&SN(e,s,n)),r}return i._value=t,i}function wN(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,_N(e,t,n??""))}function RN(e){return function(){this.textContent=e}}function NN(e){return function(){var t=e(this);this.textContent=t??""}}function ON(e){return this.tween("text",typeof e=="function"?NN(ef(this,"text",e)):RN(e==null?"":e+""))}function xN(e){return function(t){this.textContent=e.call(this,t)}}function TN(e){var t,n;function r(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&xN(o)),t}return r._value=e,r}function IN(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,TN(e))}function CN(){for(var e=this._name,t=this._id,n=Am(),r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],l=s.length,a,u=0;u<l;++u)if(a=s[u]){var c=Lt(a,t);jl(a,e,n,u,s,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new cn(r,this._parents,e,n)}function AN(){var e,t,n=this,r=n._id,o=n.size();return new Promise(function(i,s){var l={value:s},a={value:function(){--o===0&&i()}};n.each(function(){var u=jt(this,r),c=u.on;c!==e&&(t=(e=c).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(a)),u.on=t}),o===0&&i()})}var bN=0;function cn(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function Am(){return++bN}var fn=xi.prototype;cn.prototype={constructor:cn,select:fN,selectAll:dN,selectChild:fn.selectChild,selectChildren:fn.selectChildren,filter:oN,merge:iN,selection:hN,transition:CN,call:fn.call,nodes:fn.nodes,node:fn.node,size:fn.size,empty:fn.empty,each:fn.each,on:aN,attr:zR,attrTween:YR,style:EN,styleTween:wN,text:ON,textTween:IN,remove:cN,tween:PR,delay:XR,duration:JR,ease:tN,easeVarying:rN,end:AN,[Symbol.iterator]:fn[Symbol.iterator]};function LN(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var DN={time:null,delay:0,duration:250,ease:LN};function kN(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function PN(e){var t,n;e instanceof cn?(t=e._id,e=e._name):(t=Am(),(n=DN).time=Qc(),e=e==null?null:e+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],l=s.length,a,u=0;u<l;++u)(a=s[u])&&jl(a,e,t,u,s,n||kN(a,t));return new cn(r,this._parents,e,t)}xi.prototype.interrupt=LR,xi.prototype.transition=PN;const Gl=e=>()=>e;function MN(e,{sourceEvent:t,target:n,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function dn(e,t,n){this.k=e,this.x=t,this.y=n}dn.prototype={constructor:dn,scale:function(e){return e===1?this:new dn(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new dn(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Un=new dn(1,0,0);dn.prototype;function tf(e){e.stopImmediatePropagation()}function Mi(e){e.preventDefault(),e.stopImmediatePropagation()}function UN(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function FN(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function bm(){return this.__zoom||Un}function VN(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function BN(){return navigator.maxTouchPoints||"ontouchstart"in this}function $N(e,t,n){var r=e.invertX(t[0][0])-n[0][0],o=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function zN(){var e=UN,t=FN,n=$N,r=VN,o=BN,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],l=250,a=NR,u=Il("start","zoom","end"),c,f,p,h=500,v=150,m=0,E=10;function d(R){R.property("__zoom",bm).on("wheel.zoom",b,{passive:!1}).on("mousedown.zoom",P).on("dblclick.zoom",k).filter(o).on("touchstart.zoom",B).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",F).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}d.transform=function(R,D,A,C){var x=R.selection?R.selection():R;x.property("__zoom",bm),R!==x?w(R,D,A,C):x.interrupt().each(function(){O(this,arguments).event(C).start().zoom(null,typeof D=="function"?D.apply(this,arguments):D).end()})},d.scaleBy=function(R,D,A,C){d.scaleTo(R,function(){var x=this.__zoom.k,L=typeof D=="function"?D.apply(this,arguments):D;return x*L},A,C)},d.scaleTo=function(R,D,A,C){d.transform(R,function(){var x=t.apply(this,arguments),L=this.__zoom,U=A==null?S(x):typeof A=="function"?A.apply(this,arguments):A,z=L.invert(U),j=typeof D=="function"?D.apply(this,arguments):D;return n(y(g(L,j),U,z),x,s)},A,C)},d.translateBy=function(R,D,A,C){d.transform(R,function(){return n(this.__zoom.translate(typeof D=="function"?D.apply(this,arguments):D,typeof A=="function"?A.apply(this,arguments):A),t.apply(this,arguments),s)},null,C)},d.translateTo=function(R,D,A,C,x){d.transform(R,function(){var L=t.apply(this,arguments),U=this.__zoom,z=C==null?S(L):typeof C=="function"?C.apply(this,arguments):C;return n(Un.translate(z[0],z[1]).scale(U.k).translate(typeof D=="function"?-D.apply(this,arguments):-D,typeof A=="function"?-A.apply(this,arguments):-A),L,s)},C,x)};function g(R,D){return D=Math.max(i[0],Math.min(i[1],D)),D===R.k?R:new dn(D,R.x,R.y)}function y(R,D,A){var C=D[0]-A[0]*R.k,x=D[1]-A[1]*R.k;return C===R.x&&x===R.y?R:new dn(R.k,C,x)}function S(R){return[(+R[0][0]+ +R[1][0])/2,(+R[0][1]+ +R[1][1])/2]}function w(R,D,A,C){R.on("start.zoom",function(){O(this,arguments).event(C).start()}).on("interrupt.zoom end.zoom",function(){O(this,arguments).event(C).end()}).tween("zoom",function(){var x=this,L=arguments,U=O(x,L).event(C),z=t.apply(x,L),j=A==null?S(z):typeof A=="function"?A.apply(x,L):A,K=Math.max(z[1][0]-z[0][0],z[1][1]-z[0][1]),Y=x.__zoom,Z=typeof D=="function"?D.apply(x,L):D,X=a(Y.invert(j).concat(K/Y.k),Z.invert(j).concat(K/Z.k));return function(ee){if(ee===1)ee=Z;else{var oe=X(ee),ge=K/oe[2];ee=new dn(ge,j[0]-oe[0]*ge,j[1]-oe[1]*ge)}U.zoom(null,ee)}})}function O(R,D,A){return!A&&R.__zooming||new T(R,D)}function T(R,D){this.that=R,this.args=D,this.active=0,this.sourceEvent=null,this.extent=t.apply(R,D),this.taps=0}T.prototype={event:function(R){return R&&(this.sourceEvent=R),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(R,D){return this.mouse&&R!=="mouse"&&(this.mouse[1]=D.invert(this.mouse[0])),this.touch0&&R!=="touch"&&(this.touch0[1]=D.invert(this.touch0[0])),this.touch1&&R!=="touch"&&(this.touch1[1]=D.invert(this.touch1[0])),this.that.__zoom=D,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(R){var D=At(this.that).datum();u.call(R,this.that,new MN(R,{sourceEvent:this.sourceEvent,target:d,type:R,transform:this.that.__zoom,dispatch:u}),D)}};function b(R,...D){if(!e.apply(this,arguments))return;var A=O(this,D).event(R),C=this.__zoom,x=Math.max(i[0],Math.min(i[1],C.k*Math.pow(2,r.apply(this,arguments)))),L=zt(R);if(A.wheel)(A.mouse[0][0]!==L[0]||A.mouse[0][1]!==L[1])&&(A.mouse[1]=C.invert(A.mouse[0]=L)),clearTimeout(A.wheel);else{if(C.k===x)return;A.mouse=[L,C.invert(L)],Wl(this),A.start()}Mi(R),A.wheel=setTimeout(U,v),A.zoom("mouse",n(y(g(C,x),A.mouse[0],A.mouse[1]),A.extent,s));function U(){A.wheel=null,A.end()}}function P(R,...D){if(p||!e.apply(this,arguments))return;var A=R.currentTarget,C=O(this,D,!0).event(R),x=At(R.view).on("mousemove.zoom",j,!0).on("mouseup.zoom",K,!0),L=zt(R,A),U=R.clientX,z=R.clientY;tm(R.view),tf(R),C.mouse=[L,this.__zoom.invert(L)],Wl(this),C.start();function j(Y){if(Mi(Y),!C.moved){var Z=Y.clientX-U,X=Y.clientY-z;C.moved=Z*Z+X*X>m}C.event(Y).zoom("mouse",n(y(C.that.__zoom,C.mouse[0]=zt(Y,A),C.mouse[1]),C.extent,s))}function K(Y){x.on("mousemove.zoom mouseup.zoom",null),nm(Y.view,C.moved),Mi(Y),C.event(Y).end()}}function k(R,...D){if(e.apply(this,arguments)){var A=this.__zoom,C=zt(R.changedTouches?R.changedTouches[0]:R,this),x=A.invert(C),L=A.k*(R.shiftKey?.5:2),U=n(y(g(A,L),C,x),t.apply(this,D),s);Mi(R),l>0?At(this).transition().duration(l).call(w,U,C,R):At(this).call(d.transform,U,C,R)}}function B(R,...D){if(e.apply(this,arguments)){var A=R.touches,C=A.length,x=O(this,D,R.changedTouches.length===C).event(R),L,U,z,j;for(tf(R),U=0;U<C;++U)z=A[U],j=zt(z,this),j=[j,this.__zoom.invert(j),z.identifier],x.touch0?!x.touch1&&x.touch0[2]!==j[2]&&(x.touch1=j,x.taps=0):(x.touch0=j,L=!0,x.taps=1+!!c);c&&(c=clearTimeout(c)),L&&(x.taps<2&&(f=j[0],c=setTimeout(function(){c=null},h)),Wl(this),x.start())}}function $(R,...D){if(this.__zooming){var A=O(this,D).event(R),C=R.changedTouches,x=C.length,L,U,z,j;for(Mi(R),L=0;L<x;++L)U=C[L],z=zt(U,this),A.touch0&&A.touch0[2]===U.identifier?A.touch0[0]=z:A.touch1&&A.touch1[2]===U.identifier&&(A.touch1[0]=z);if(U=A.that.__zoom,A.touch1){var K=A.touch0[0],Y=A.touch0[1],Z=A.touch1[0],X=A.touch1[1],ee=(ee=Z[0]-K[0])*ee+(ee=Z[1]-K[1])*ee,oe=(oe=X[0]-Y[0])*oe+(oe=X[1]-Y[1])*oe;U=g(U,Math.sqrt(ee/oe)),z=[(K[0]+Z[0])/2,(K[1]+Z[1])/2],j=[(Y[0]+X[0])/2,(Y[1]+X[1])/2]}else if(A.touch0)z=A.touch0[0],j=A.touch0[1];else return;A.zoom("touch",n(y(U,z,j),A.extent,s))}}function F(R,...D){if(this.__zooming){var A=O(this,D).event(R),C=R.changedTouches,x=C.length,L,U;for(tf(R),p&&clearTimeout(p),p=setTimeout(function(){p=null},h),L=0;L<x;++L)U=C[L],A.touch0&&A.touch0[2]===U.identifier?delete A.touch0:A.touch1&&A.touch1[2]===U.identifier&&delete A.touch1;if(A.touch1&&!A.touch0&&(A.touch0=A.touch1,delete A.touch1),A.touch0)A.touch0[1]=this.__zoom.invert(A.touch0[0]);else if(A.end(),A.taps===2&&(U=zt(U,this),Math.hypot(f[0]-U[0],f[1]-U[1])<E)){var z=At(this).on("dblclick.zoom");z&&z.apply(this,arguments)}}}return d.wheelDelta=function(R){return arguments.length?(r=typeof R=="function"?R:Gl(+R),d):r},d.filter=function(R){return arguments.length?(e=typeof R=="function"?R:Gl(!!R),d):e},d.touchable=function(R){return arguments.length?(o=typeof R=="function"?R:Gl(!!R),d):o},d.extent=function(R){return arguments.length?(t=typeof R=="function"?R:Gl([[+R[0][0],+R[0][1]],[+R[1][0],+R[1][1]]]),d):t},d.scaleExtent=function(R){return arguments.length?(i[0]=+R[0],i[1]=+R[1],d):[i[0],i[1]]},d.translateExtent=function(R){return arguments.length?(s[0][0]=+R[0][0],s[1][0]=+R[1][0],s[0][1]=+R[0][1],s[1][1]=+R[1][1],d):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},d.constrain=function(R){return arguments.length?(n=R,d):n},d.duration=function(R){return arguments.length?(l=+R,d):l},d.interpolate=function(R){return arguments.length?(a=R,d):a},d.on=function(){var R=u.on.apply(u,arguments);return R===u?d:R},d.clickDistance=function(R){return arguments.length?(m=(R=+R)*R,d):Math.sqrt(m)},d.tapDistance=function(R){return arguments.length?(E=+R,d):E},d}const Yl=N.createContext(null),HN=Yl.Provider,Fn={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`},Lm=Fn.error001();function ae(e,t){const n=N.useContext(Yl);if(n===null)throw new Error(Lm);return Vg(n,e,t)}const Re=()=>{const e=N.useContext(Yl);if(e===null)throw new Error(Lm);return N.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},jN=e=>e.userSelectionActive?"none":"all";function nf({position:e,children:t,className:n,style:r,...o}){const i=ae(jN),s=`${e}`.split("-");return _("div",{className:Qe(["react-flow__panel",n,...s]),style:{...r,pointerEvents:i},...o,children:t})}function WN({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:_(nf,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:_("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const GN=({x:e,y:t,label:n,labelStyle:r={},labelShowBg:o=!0,labelBgStyle:i={},labelBgPadding:s=[2,4],labelBgBorderRadius:l=2,children:a,className:u,...c})=>{const f=N.useRef(null),[p,h]=N.useState({x:0,y:0,width:0,height:0}),v=Qe(["react-flow__edge-textwrapper",u]);return N.useEffect(()=>{if(f.current){const m=f.current.getBBox();h({x:m.x,y:m.y,width:m.width,height:m.height})}},[n]),typeof n>"u"||!n?null:V("g",{transform:`translate(${e-p.width/2} ${t-p.height/2})`,className:v,visibility:p.width?"visible":"hidden",...c,children:[o&&_("rect",{width:p.width+2*s[0],x:-s[0],y:-s[1],height:p.height+2*s[1],className:"react-flow__edge-textbg",style:i,rx:l,ry:l}),_("text",{className:"react-flow__edge-text",y:p.height/2,dy:"0.3em",ref:f,style:r,children:n}),a]})};var YN=N.memo(GN);const rf=e=>({width:e.offsetWidth,height:e.offsetHeight}),go=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),of=(e={x:0,y:0},t)=>({x:go(e.x,t[0][0],t[1][0]),y:go(e.y,t[0][1],t[1][1])}),Dm=(e,t,n)=>e<t?go(Math.abs(e-t),1,50)/50:e>n?-go(Math.abs(e-n),1,50)/50:0,km=(e,t)=>{const n=Dm(e.x,35,t.width-35)*20,r=Dm(e.y,35,t.height-35)*20;return[n,r]},Pm=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},KN=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Mm=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),QN=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Um=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),sf=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},XN=e=>mt(e.width)&&mt(e.height)&&mt(e.x)&&mt(e.y),mt=e=>!isNaN(e)&&isFinite(e),Se=Symbol.for("internals"),Fm=["Enter"," ","Escape"],qN=(e,t)=>{},ZN=e=>"nativeEvent"in e;function lf(e){var o,i;const t=ZN(e)?e.nativeEvent:e,n=((i=(o=t.composedPath)==null?void 0:o.call(t))==null?void 0:i[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const Vm=e=>"clientX"in e,Vn=(e,t)=>{var i,s;const n=Vm(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,o=n?e.clientY:(s=e.touches)==null?void 0:s[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:o-((t==null?void 0:t.top)??0)}},mo=({path:e,labelX:t,labelY:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:a,style:u,markerEnd:c,markerStart:f,interactionWidth:p=20})=>V(be,{children:[_("path",{style:u,d:e,fill:"none",className:"react-flow__edge-path",markerEnd:c,markerStart:f}),p&&_("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:p,className:"react-flow__edge-interaction"}),r&&mt(t)&&mt(n)?_(YN,{x:t,y:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:a}):null]});mo.displayName="BaseEdge";function Ui(e,t,n){return n===void 0?n:r=>{const o=t().edges.find(i=>i.id===e);o&&n(r,{...o})}}function Bm({sourceX:e,sourceY:t,targetX:n,targetY:r}){const o=Math.abs(n-e)/2,i=n<e?n+o:n-o,s=Math.abs(r-t)/2,l=r<t?r+s:r-s;return[i,l,o,s]}function $m({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:o,sourceControlY:i,targetControlX:s,targetControlY:l}){const a=e*.125+o*.375+s*.375+n*.125,u=t*.125+i*.375+l*.375+r*.125,c=Math.abs(a-e),f=Math.abs(u-t);return[a,u,c,f]}var Bn;(function(e){e.Strict="strict",e.Loose="loose"})(Bn||(Bn={}));var vo;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(vo||(vo={}));var Fi;(function(e){e.Partial="partial",e.Full="full"})(Fi||(Fi={}));var $n;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})($n||($n={}));var Vi;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Vi||(Vi={}));var G;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(G||(G={}));function zm({pos:e,x1:t,y1:n,x2:r,y2:o}){return e===G.Left||e===G.Right?[.5*(t+r),n]:[t,.5*(n+o)]}function Hm({sourceX:e,sourceY:t,sourcePosition:n=G.Bottom,targetX:r,targetY:o,targetPosition:i=G.Top}){const[s,l]=zm({pos:n,x1:e,y1:t,x2:r,y2:o}),[a,u]=zm({pos:i,x1:r,y1:o,x2:e,y2:t}),[c,f,p,h]=$m({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:s,sourceControlY:l,targetControlX:a,targetControlY:u});return[`M${e},${t} C${s},${l} ${a},${u} ${r},${o}`,c,f,p,h]}const af=N.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:o=G.Bottom,targetPosition:i=G.Top,label:s,labelStyle:l,labelShowBg:a,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:f,style:p,markerEnd:h,markerStart:v,interactionWidth:m})=>{const[E,d,g]=Hm({sourceX:e,sourceY:t,sourcePosition:o,targetX:n,targetY:r,targetPosition:i});return _(mo,{path:E,labelX:d,labelY:g,label:s,labelStyle:l,labelShowBg:a,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:f,style:p,markerEnd:h,markerStart:v,interactionWidth:m})});af.displayName="SimpleBezierEdge";const jm={[G.Left]:{x:-1,y:0},[G.Right]:{x:1,y:0},[G.Top]:{x:0,y:-1},[G.Bottom]:{x:0,y:1}},JN=({source:e,sourcePosition:t=G.Bottom,target:n})=>t===G.Left||t===G.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Wm=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function eO({source:e,sourcePosition:t=G.Bottom,target:n,targetPosition:r=G.Top,center:o,offset:i}){const s=jm[t],l=jm[r],a={x:e.x+s.x*i,y:e.y+s.y*i},u={x:n.x+l.x*i,y:n.y+l.y*i},c=JN({source:a,sourcePosition:t,target:u}),f=c.x!==0?"x":"y",p=c[f];let h=[],v,m;const[E,d,g,y]=Bm({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*l[f]===-1){v=o.x||E,m=o.y||d;const w=[{x:v,y:a.y},{x:v,y:u.y}],O=[{x:a.x,y:m},{x:u.x,y:m}];s[f]===p?h=f==="x"?w:O:h=f==="x"?O:w}else{const w=[{x:a.x,y:u.y}],O=[{x:u.x,y:a.y}];if(f==="x"?h=s.x===p?O:w:h=s.y===p?w:O,t!==r){const T=f==="x"?"y":"x",b=s[f]===l[T],P=a[T]>u[T],k=a[T]<u[T];(s[f]===1&&(!b&&P||b&&k)||s[f]!==1&&(!b&&k||b&&P))&&(h=f==="x"?w:O)}v=h[0].x,m=h[0].y}return[[e,a,...h,u,n],v,m,g,y]}function tO(e,t,n,r){const o=Math.min(Wm(e,t)/2,Wm(t,n)/2,r),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const u=e.x<n.x?-1:1,c=e.y<n.y?1:-1;return`L ${i+o*u},${s}Q ${i},${s} ${i},${s+o*c}`}const l=e.x<n.x?1:-1,a=e.y<n.y?-1:1;return`L ${i},${s+o*a}Q ${i},${s} ${i+o*l},${s}`}function Bi({sourceX:e,sourceY:t,sourcePosition:n=G.Bottom,targetX:r,targetY:o,targetPosition:i=G.Top,borderRadius:s=5,centerX:l,centerY:a,offset:u=20}){const[c,f,p,h,v]=eO({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:o},targetPosition:i,center:{x:l,y:a},offset:u});return[c.reduce((E,d,g)=>{let y="";return g>0&&g<c.length-1?y=tO(c[g-1],d,c[g+1],s):y=`${g===0?"M":"L"}${d.x} ${d.y}`,E+=y,E},""),f,p,h,v]}const Kl=N.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:o,labelStyle:i,labelShowBg:s,labelBgStyle:l,labelBgPadding:a,labelBgBorderRadius:u,style:c,sourcePosition:f=G.Bottom,targetPosition:p=G.Top,markerEnd:h,markerStart:v,pathOptions:m,interactionWidth:E})=>{const[d,g,y]=Bi({sourceX:e,sourceY:t,sourcePosition:f,targetX:n,targetY:r,targetPosition:p,borderRadius:m==null?void 0:m.borderRadius,offset:m==null?void 0:m.offset});return _(mo,{path:d,labelX:g,labelY:y,label:o,labelStyle:i,labelShowBg:s,labelBgStyle:l,labelBgPadding:a,labelBgBorderRadius:u,style:c,markerEnd:h,markerStart:v,interactionWidth:E})});Kl.displayName="SmoothStepEdge";const uf=N.memo(e=>{var t;return _(Kl,{...e,pathOptions:N.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});uf.displayName="StepEdge";function nO({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,i,s,l]=Bm({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,i,s,l]}const cf=N.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:o,labelStyle:i,labelShowBg:s,labelBgStyle:l,labelBgPadding:a,labelBgBorderRadius:u,style:c,markerEnd:f,markerStart:p,interactionWidth:h})=>{const[v,m,E]=nO({sourceX:e,sourceY:t,targetX:n,targetY:r});return _(mo,{path:v,labelX:m,labelY:E,label:o,labelStyle:i,labelShowBg:s,labelBgStyle:l,labelBgPadding:a,labelBgBorderRadius:u,style:c,markerEnd:f,markerStart:p,interactionWidth:h})});cf.displayName="StraightEdge";function Ql(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Gm({pos:e,x1:t,y1:n,x2:r,y2:o,c:i}){switch(e){case G.Left:return[t-Ql(t-r,i),n];case G.Right:return[t+Ql(r-t,i),n];case G.Top:return[t,n-Ql(n-o,i)];case G.Bottom:return[t,n+Ql(o-n,i)]}}function Ym({sourceX:e,sourceY:t,sourcePosition:n=G.Bottom,targetX:r,targetY:o,targetPosition:i=G.Top,curvature:s=.25}){const[l,a]=Gm({pos:n,x1:e,y1:t,x2:r,y2:o,c:s}),[u,c]=Gm({pos:i,x1:r,y1:o,x2:e,y2:t,c:s}),[f,p,h,v]=$m({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:l,sourceControlY:a,targetControlX:u,targetControlY:c});return[`M${e},${t} C${l},${a} ${u},${c} ${r},${o}`,f,p,h,v]}const Xl=N.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:o=G.Bottom,targetPosition:i=G.Top,label:s,labelStyle:l,labelShowBg:a,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:f,style:p,markerEnd:h,markerStart:v,pathOptions:m,interactionWidth:E})=>{const[d,g,y]=Ym({sourceX:e,sourceY:t,sourcePosition:o,targetX:n,targetY:r,targetPosition:i,curvature:m==null?void 0:m.curvature});return _(mo,{path:d,labelX:g,labelY:y,label:s,labelStyle:l,labelShowBg:a,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:f,style:p,markerEnd:h,markerStart:v,interactionWidth:E})});Xl.displayName="BezierEdge";const ff=N.createContext(null),rO=ff.Provider;ff.Consumer;const oO=()=>N.useContext(ff),iO=e=>"id"in e&&"source"in e&&"target"in e,Km=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`reactflow__edge-${e}${t||""}-${n}${r||""}`,df=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`,sO=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Qm=(e,t)=>{if(!e.source||!e.target)return t;let n;return iO(e)?n={...e}:n={...e,id:Km(e)},sO(n,t)?t:t.concat(n)},lO=(e,t,n,r={shouldReplaceId:!0})=>{const{id:o,...i}=e;if(!t.source||!t.target||!n.find(a=>a.id===o))return n;const l={...i,id:r.shouldReplaceId?Km(t):o,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle};return n.filter(a=>a.id!==o).concat(l)},Xm=({x:e,y:t},[n,r,o],i,[s,l])=>{const a={x:(e-n)/o,y:(t-r)/o};return i?{x:s*Math.round(a.x/s),y:l*Math.round(a.y/l)}:a},aO=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r}),yo=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],r=(e.height??0)*t[1],o={x:e.position.x-n,y:e.position.y-r};return{...o,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-r}:o}},qm=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,o)=>{const{x:i,y:s}=yo(o,t).positionAbsolute;return KN(r,Mm({x:i,y:s,width:o.width||0,height:o.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return QN(n)},Zm=(e,t,[n,r,o]=[0,0,1],i=!1,s=!1,l=[0,0])=>{const a={x:(t.x-n)/o,y:(t.y-r)/o,width:t.width/o,height:t.height/o},u=[];return e.forEach(c=>{const{width:f,height:p,selectable:h=!0,hidden:v=!1}=c;if(s&&!h||v)return!1;const{positionAbsolute:m}=yo(c,l),E={x:m.x,y:m.y,width:f||0,height:p||0},d=sf(a,E),g=typeof f>"u"||typeof p>"u"||f===null||p===null,y=i&&d>0,S=(f||0)*(p||0);(g||y||d>=S||c.dragging)&&u.push(c)}),u},Jm=(e,t)=>{const n=e.map(r=>r.id);return t.filter(r=>n.includes(r.source)||n.includes(r.target))},ev=(e,t,n,r,o,i=.1)=>{const s=t/(e.width*(1+i)),l=n/(e.height*(1+i)),a=Math.min(s,l),u=go(a,r,o),c=e.x+e.width/2,f=e.y+e.height/2,p=t/2-c*u,h=n/2-f*u;return[p,h,u]},mr=(e,t=0)=>e.transition().duration(t);function tv(e,t,n,r){return(t[n]||[]).reduce((o,i)=>{var s,l;return`${e.id}-${i.id}-${n}`!==r&&o.push({id:i.id||null,type:n,nodeId:e.id,x:(((s=e.positionAbsolute)==null?void 0:s.x)??0)+i.x+i.width/2,y:(((l=e.positionAbsolute)==null?void 0:l.y)??0)+i.y+i.height/2}),o},[])}function uO(e,t,n){let r=null,o=1/0;return n.forEach(i=>{const s=Math.sqrt(Math.pow(i.x-e.x,2)+Math.pow(i.y-e.y,2));s<=t&&s<o&&(o=s,r=i)}),r}const cO={source:null,target:null,sourceHandle:null,targetHandle:null};function nv(e,t,n,r,o,i,s,l){const a=i==="target",u=l.querySelector(`.react-flow__handle[data-id="${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`),{x:c,y:f}=Vn(e),p=l.elementFromPoint(c,f),h=p!=null&&p.classList.contains("react-flow__handle")?p:u,v={handleDomNode:h,isValid:!1,connection:cO,endHandle:null};if(h){const m=rv(void 0,h),E=h.getAttribute("data-nodeid"),d=h.getAttribute("data-handleid"),g=h.classList.contains("connectable"),y=h.classList.contains("connectableend"),S={source:a?E:r,sourceHandle:a?d:o,target:a?r:E,targetHandle:a?o:d};v.connection=S,g&&y&&(n===Bn.Strict?a&&m==="source"||!a&&m==="target":E!==r||d!==o)&&(v.endHandle={nodeId:E,handleId:d,type:m},v.isValid=s(S))}return v}function fO({nodes:e,nodeId:t,handleId:n,handleType:r}){return e.reduce((o,i)=>{if(i[Se]){const{handleBounds:s}=i[Se];let l=[],a=[];s&&(l=tv(i,s,"source",`${t}-${n}-${r}`),a=tv(i,s,"target",`${t}-${n}-${r}`)),o.push(...l,...a)}return o},[])}function rv(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function pf(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function dO(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function ov({event:e,handleId:t,nodeId:n,onConnect:r,isTarget:o,getState:i,setState:s,isValidConnection:l,edgeUpdaterType:a,onEdgeUpdateEnd:u}){const c=Pm(e.target),{connectionMode:f,domNode:p,autoPanOnConnect:h,connectionRadius:v,onConnectStart:m,panBy:E,getNodes:d,cancelConnection:g}=i();let y=0,S;const{x:w,y:O}=Vn(e),T=c==null?void 0:c.elementFromPoint(w,O),b=rv(a,T),P=p==null?void 0:p.getBoundingClientRect();if(!P||!b)return;let k,B=Vn(e,P),$=!1,F=null,R=!1,D=null;const A=fO({nodes:d(),nodeId:n,handleId:t,handleType:b}),C=()=>{if(!h)return;const[U,z]=km(B,P);E({x:U,y:z}),y=requestAnimationFrame(C)};s({connectionPosition:B,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:b,connectionStartHandle:{nodeId:n,handleId:t,type:b},connectionEndHandle:null}),m==null||m(e,{nodeId:n,handleId:t,handleType:b});function x(U){const{transform:z}=i();B=Vn(U,P),S=uO(Xm(B,z,!1,[1,1]),v,A),$||(C(),$=!0);const j=nv(U,S,f,n,t,o?"target":"source",l,c);if(D=j.handleDomNode,F=j.connection,R=j.isValid,s({connectionPosition:S&&R?aO({x:S.x,y:S.y},z):B,connectionStatus:dO(!!S,R),connectionEndHandle:j.endHandle}),!S&&!R&&!D)return pf(k);F.source!==F.target&&D&&(pf(k),k=D,D.classList.add("connecting","react-flow__handle-connecting"),D.classList.toggle("valid",R),D.classList.toggle("react-flow__handle-valid",R))}function L(U){var z,j;(S||D)&&F&&R&&(r==null||r(F)),(j=(z=i()).onConnectEnd)==null||j.call(z,U),a&&(u==null||u(U)),pf(k),g(),cancelAnimationFrame(y),$=!1,R=!1,F=null,D=null,c.removeEventListener("mousemove",x),c.removeEventListener("mouseup",L),c.removeEventListener("touchmove",x),c.removeEventListener("touchend",L)}c.addEventListener("mousemove",x),c.addEventListener("mouseup",L),c.addEventListener("touchmove",x),c.addEventListener("touchend",L)}const iv=()=>!0,pO=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),hO=(e,t,n)=>r=>{const{connectionStartHandle:o,connectionEndHandle:i,connectionClickStartHandle:s}=r;return{connecting:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.handleId)===t&&(o==null?void 0:o.type)===n||(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.handleId)===t&&(s==null?void 0:s.type)===n}},sv=N.forwardRef(({type:e="source",position:t=G.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:o=!0,isConnectableEnd:i=!0,id:s,onConnect:l,children:a,className:u,onMouseDown:c,onTouchStart:f,...p},h)=>{var P,k;const v=s||null,m=e==="target",E=Re(),d=oO(),{connectOnClick:g,noPanClassName:y}=ae(pO,Xe),{connecting:S,clickConnecting:w}=ae(hO(d,v,e));d||(k=(P=E.getState()).onError)==null||k.call(P,"010",Fn.error010());const O=B=>{const{defaultEdgeOptions:$,onConnect:F,hasDefaultEdges:R}=E.getState(),D={...$,...B};if(R){const{edges:A,setEdges:C}=E.getState();C(Qm(D,A))}F==null||F(D),l==null||l(D)},T=B=>{if(!d)return;const $=Vm(B);o&&($&&B.button===0||!$)&&ov({event:B,handleId:v,nodeId:d,onConnect:O,isTarget:m,getState:E.getState,setState:E.setState,isValidConnection:n||E.getState().isValidConnection||iv}),$?c==null||c(B):f==null||f(B)},b=B=>{const{onClickConnectStart:$,onClickConnectEnd:F,connectionClickStartHandle:R,connectionMode:D,isValidConnection:A}=E.getState();if(!d||!R&&!o)return;if(!R){$==null||$(B,{nodeId:d,handleId:v,handleType:e}),E.setState({connectionClickStartHandle:{nodeId:d,type:e,handleId:v}});return}const C=Pm(B.target),x=n||A||iv,{connection:L,isValid:U}=nv(B,{nodeId:d,id:v,type:e},D,R.nodeId,R.handleId||null,R.type,x,C);U&&O(L),F==null||F(B),E.setState({connectionClickStartHandle:null})};return _("div",{"data-handleid":v,"data-nodeid":d,"data-handlepos":t,"data-id":`${d}-${v}-${e}`,className:Qe(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",y,u,{source:!m,target:m,connectable:r,connectablestart:o,connectableend:i,connecting:w,connectionindicator:r&&(o&&!S||i&&S)}]),onMouseDown:T,onTouchStart:T,onClick:g?b:void 0,ref:h,...p,children:a})});sv.displayName="Handle";var Eo=N.memo(sv);const lv=({data:e,isConnectable:t,targetPosition:n=G.Top,sourcePosition:r=G.Bottom})=>V(be,{children:[_(Eo,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,_(Eo,{type:"source",position:r,isConnectable:t})]});lv.displayName="DefaultNode";var hf=N.memo(lv);const av=({data:e,isConnectable:t,sourcePosition:n=G.Bottom})=>V(be,{children:[e==null?void 0:e.label,_(Eo,{type:"source",position:n,isConnectable:t})]});av.displayName="InputNode";var uv=N.memo(av);const cv=({data:e,isConnectable:t,targetPosition:n=G.Top})=>V(be,{children:[_(Eo,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]});cv.displayName="OutputNode";var fv=N.memo(cv);const gf=()=>null;gf.displayName="GroupNode";const gO=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected)}),ql=e=>e.id;function mO(e,t){return Xe(e.selectedNodes.map(ql),t.selectedNodes.map(ql))&&Xe(e.selectedEdges.map(ql),t.selectedEdges.map(ql))}const dv=N.memo(({onSelectionChange:e})=>{const t=Re(),{selectedNodes:n,selectedEdges:r}=ae(gO,mO);return N.useEffect(()=>{var i,s;const o={nodes:n,edges:r};e==null||e(o),(s=(i=t.getState()).onSelectionChange)==null||s.call(i,o)},[n,r,e]),null});dv.displayName="SelectionListener";const vO=e=>!!e.onSelectionChange;function yO({onSelectionChange:e}){const t=ae(vO);return e||t?_(dv,{onSelectionChange:e}):null}const EO=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function So(e,t){N.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function q(e,t,n){N.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const SO=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:o,onConnectStart:i,onConnectEnd:s,onClickConnectStart:l,onClickConnectEnd:a,nodesDraggable:u,nodesConnectable:c,nodesFocusable:f,edgesFocusable:p,edgesUpdatable:h,elevateNodesOnSelect:v,minZoom:m,maxZoom:E,nodeExtent:d,onNodesChange:g,onEdgesChange:y,elementsSelectable:S,connectionMode:w,snapGrid:O,snapToGrid:T,translateExtent:b,connectOnClick:P,defaultEdgeOptions:k,fitView:B,fitViewOptions:$,onNodesDelete:F,onEdgesDelete:R,onNodeDrag:D,onNodeDragStart:A,onNodeDragStop:C,onSelectionDrag:x,onSelectionDragStart:L,onSelectionDragStop:U,noPanClassName:z,nodeOrigin:j,rfId:K,autoPanOnConnect:Y,autoPanOnNodeDrag:Z,onError:X,connectionRadius:ee,isValidConnection:oe})=>{const{setNodes:ge,setEdges:ue,setDefaultNodesAndEdges:Ne,setMinZoom:He,setMaxZoom:ut,setTranslateExtent:me,setNodeExtent:fe,reset:Je}=ae(EO,Xe),Q=Re();return N.useEffect(()=>{const Xn=r==null?void 0:r.map(Nr=>({...Nr,...k}));return Ne(n,Xn),()=>{Je()}},[]),q("defaultEdgeOptions",k,Q.setState),q("connectionMode",w,Q.setState),q("onConnect",o,Q.setState),q("onConnectStart",i,Q.setState),q("onConnectEnd",s,Q.setState),q("onClickConnectStart",l,Q.setState),q("onClickConnectEnd",a,Q.setState),q("nodesDraggable",u,Q.setState),q("nodesConnectable",c,Q.setState),q("nodesFocusable",f,Q.setState),q("edgesFocusable",p,Q.setState),q("edgesUpdatable",h,Q.setState),q("elementsSelectable",S,Q.setState),q("elevateNodesOnSelect",v,Q.setState),q("snapToGrid",T,Q.setState),q("snapGrid",O,Q.setState),q("onNodesChange",g,Q.setState),q("onEdgesChange",y,Q.setState),q("connectOnClick",P,Q.setState),q("fitViewOnInit",B,Q.setState),q("fitViewOnInitOptions",$,Q.setState),q("onNodesDelete",F,Q.setState),q("onEdgesDelete",R,Q.setState),q("onNodeDrag",D,Q.setState),q("onNodeDragStart",A,Q.setState),q("onNodeDragStop",C,Q.setState),q("onSelectionDrag",x,Q.setState),q("onSelectionDragStart",L,Q.setState),q("onSelectionDragStop",U,Q.setState),q("noPanClassName",z,Q.setState),q("nodeOrigin",j,Q.setState),q("rfId",K,Q.setState),q("autoPanOnConnect",Y,Q.setState),q("autoPanOnNodeDrag",Z,Q.setState),q("onError",X,Q.setState),q("connectionRadius",ee,Q.setState),q("isValidConnection",oe,Q.setState),So(e,ge),So(t,ue),So(m,He),So(E,ut),So(b,me),So(d,fe),null},pv={display:"none"},_O={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},hv="react-flow__node-desc",gv="react-flow__edge-desc",wO="react-flow__aria-live",RO=e=>e.ariaLiveMessage;function NO({rfId:e}){const t=ae(RO);return _("div",{id:`${wO}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:_O,children:t})}function OO({rfId:e,disableKeyboardA11y:t}){return V(be,{children:[V("div",{id:`${hv}-${e}`,style:pv,children:["Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "]}),_("div",{id:`${gv}-${e}`,style:pv,children:"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."}),!t&&_(NO,{rfId:e})]})}const xO=(e,t,n)=>n===G.Left?e-t:n===G.Right?e+t:e,TO=(e,t,n)=>n===G.Top?e-t:n===G.Bottom?e+t:e,mv="react-flow__edgeupdater",vv=({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:o,onMouseEnter:i,onMouseOut:s,type:l})=>_("circle",{onMouseDown:o,onMouseEnter:i,onMouseOut:s,className:Qe([mv,`${mv}-${l}`]),cx:xO(t,r,e),cy:TO(n,r,e),r,stroke:"transparent",fill:"transparent"}),IO=()=>!0;var _o=e=>{const t=({id:n,className:r,type:o,data:i,onClick:s,onEdgeDoubleClick:l,selected:a,animated:u,label:c,labelStyle:f,labelShowBg:p,labelBgStyle:h,labelBgPadding:v,labelBgBorderRadius:m,style:E,source:d,target:g,sourceX:y,sourceY:S,targetX:w,targetY:O,sourcePosition:T,targetPosition:b,elementsSelectable:P,hidden:k,sourceHandleId:B,targetHandleId:$,onContextMenu:F,onMouseEnter:R,onMouseMove:D,onMouseLeave:A,edgeUpdaterRadius:C,onEdgeUpdate:x,onEdgeUpdateStart:L,onEdgeUpdateEnd:U,markerEnd:z,markerStart:j,rfId:K,ariaLabel:Y,isFocusable:Z,isUpdatable:X,pathOptions:ee,interactionWidth:oe})=>{const ge=N.useRef(null),[ue,Ne]=N.useState(!1),[He,ut]=N.useState(!1),me=Re(),fe=N.useMemo(()=>`url(#${df(j,K)})`,[j,K]),Je=N.useMemo(()=>`url(#${df(z,K)})`,[z,K]);if(k)return null;const Q=et=>{const{edges:Mt,addSelectedEdges:Tr}=me.getState();if(P&&(me.setState({nodesSelectionActive:!1}),Tr([n])),s){const Ir=Mt.find(Cr=>Cr.id===n);s(et,Ir)}},Xn=Ui(n,me.getState,l),Nr=Ui(n,me.getState,F),ss=Ui(n,me.getState,R),ls=Ui(n,me.getState,D),Ao=Ui(n,me.getState,A),Or=(et,Mt)=>{if(et.button!==0)return;const{edges:Tr,isValidConnection:Ir}=me.getState(),Cr=Mt?g:d,ya=(Mt?$:B)||null,Ar=Mt?"target":"source",ad=Ir||IO,ud=Mt,us=Tr.find(br=>br.id===n);ut(!0),L==null||L(et,us,Ar);const cd=br=>{ut(!1),U==null||U(br,us,Ar)};ov({event:et,handleId:ya,nodeId:Cr,onConnect:br=>x==null?void 0:x(us,br),isTarget:ud,getState:me.getState,setState:me.setState,isValidConnection:ad,edgeUpdaterType:Ar,onEdgeUpdateEnd:cd})},qn=et=>Or(et,!0),bo=et=>Or(et,!1),Zn=()=>Ne(!0),xr=()=>Ne(!1),as=!P&&!s,Lo=et=>{var Mt;if(Fm.includes(et.key)&&P){const{unselectNodesAndEdges:Tr,addSelectedEdges:Ir,edges:Cr}=me.getState();et.key==="Escape"?((Mt=ge.current)==null||Mt.blur(),Tr({edges:[Cr.find(Ar=>Ar.id===n)]})):Ir([n])}};return V("g",{className:Qe(["react-flow__edge",`react-flow__edge-${o}`,r,{selected:a,animated:u,inactive:as,updating:ue}]),onClick:Q,onDoubleClick:Xn,onContextMenu:Nr,onMouseEnter:ss,onMouseMove:ls,onMouseLeave:Ao,onKeyDown:Z?Lo:void 0,tabIndex:Z?0:void 0,role:Z?"button":void 0,"data-testid":`rf__edge-${n}`,"aria-label":Y===null?void 0:Y||`Edge from ${d} to ${g}`,"aria-describedby":Z?`${gv}-${K}`:void 0,ref:ge,children:[!He&&_(e,{id:n,source:d,target:g,selected:a,animated:u,label:c,labelStyle:f,labelShowBg:p,labelBgStyle:h,labelBgPadding:v,labelBgBorderRadius:m,data:i,style:E,sourceX:y,sourceY:S,targetX:w,targetY:O,sourcePosition:T,targetPosition:b,sourceHandleId:B,targetHandleId:$,markerStart:fe,markerEnd:Je,pathOptions:ee,interactionWidth:oe}),X&&V(be,{children:[(X==="source"||X===!0)&&_(vv,{position:T,centerX:y,centerY:S,radius:C,onMouseDown:qn,onMouseEnter:Zn,onMouseOut:xr,type:"source"}),(X==="target"||X===!0)&&_(vv,{position:b,centerX:w,centerY:O,radius:C,onMouseDown:bo,onMouseEnter:Zn,onMouseOut:xr,type:"target"})]})]})};return t.displayName="EdgeWrapper",N.memo(t)};function CO(e){const t={default:_o(e.default||Xl),straight:_o(e.bezier||cf),step:_o(e.step||uf),smoothstep:_o(e.step||Kl),simplebezier:_o(e.simplebezier||af)},n={},r=Object.keys(e).filter(o=>!["default","bezier"].includes(o)).reduce((o,i)=>(o[i]=_o(e[i]||Xl),o),n);return{...t,...r}}function yv(e,t,n=null){const r=((n==null?void 0:n.x)||0)+t.x,o=((n==null?void 0:n.y)||0)+t.y,i=(n==null?void 0:n.width)||t.width,s=(n==null?void 0:n.height)||t.height;switch(e){case G.Top:return{x:r+i/2,y:o};case G.Right:return{x:r+i,y:o+s/2};case G.Bottom:return{x:r+i/2,y:o+s};case G.Left:return{x:r,y:o+s/2}}}function Ev(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const AO=(e,t,n,r,o,i)=>{const s=yv(n,e,t),l=yv(i,r,o);return{sourceX:s.x,sourceY:s.y,targetX:l.x,targetY:l.y}};function bO({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:r,targetWidth:o,targetHeight:i,width:s,height:l,transform:a}){const u={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+o),y2:Math.max(e.y+r,t.y+i)};u.x===u.x2&&(u.x2+=1),u.y===u.y2&&(u.y2+=1);const c=Mm({x:(0-a[0])/a[2],y:(0-a[1])/a[2],width:s/a[2],height:l/a[2]}),f=Math.max(0,Math.min(c.x2,u.x2)-Math.max(c.x,u.x)),p=Math.max(0,Math.min(c.y2,u.y2)-Math.max(c.y,u.y));return Math.ceil(f*p)>0}function Sv(e){var r,o,i,s,l;const t=((r=e==null?void 0:e[Se])==null?void 0:r.handleBounds)||null,n=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((o=e==null?void 0:e.positionAbsolute)==null?void 0:o.x)<"u"&&typeof((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.y)<"u";return[{x:((s=e==null?void 0:e.positionAbsolute)==null?void 0:s.x)||0,y:((l=e==null?void 0:e.positionAbsolute)==null?void 0:l.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}function _v(e,t){if(!e.parentNode)return!1;const n=t.get(e.parentNode);return n?n.selected?!0:_v(n,t):!1}function wv(e,t,n){let r=e;do{if(r!=null&&r.matches(t))return!0;if(r===n.current)return!1;r=r.parentElement}while(r);return!1}function LO(e,t,n,r){return Array.from(e.values()).filter(o=>(o.selected||o.id===r)&&(!o.parentNode||!_v(o,e))&&(o.draggable||t&&typeof o.draggable>"u")).map(o=>{var i,s;return{id:o.id,position:o.position||{x:0,y:0},positionAbsolute:o.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((i=o.positionAbsolute)==null?void 0:i.x)??0),y:n.y-(((s=o.positionAbsolute)==null?void 0:s.y)??0)},delta:{x:0,y:0},extent:o.extent,parentNode:o.parentNode,width:o.width,height:o.height}})}function Rv(e,t,n,r,o=[0,0],i){let s=e.extent||r;if(e.extent==="parent")if(e.parentNode&&e.width&&e.height){const u=n.get(e.parentNode),{x:c,y:f}=yo(u,o).positionAbsolute;s=u&&mt(c)&&mt(f)&&mt(u.width)&&mt(u.height)?[[c+e.width*o[0],f+e.height*o[1]],[c+u.width-e.width+e.width*o[0],f+u.height-e.height+e.height*o[1]]]:s}else i==null||i("005",Fn.error005()),s=r;else if(e.extent&&e.parentNode){const u=n.get(e.parentNode),{x:c,y:f}=yo(u,o).positionAbsolute;s=[[e.extent[0][0]+c,e.extent[0][1]+f],[e.extent[1][0]+c,e.extent[1][1]+f]]}let l={x:0,y:0};if(e.parentNode){const u=n.get(e.parentNode);l=yo(u,o).positionAbsolute}const a=s?of(t,s):t;return{position:{x:a.x-l.x,y:a.y-l.y},positionAbsolute:a}}function mf({nodeId:e,dragItems:t,nodeInternals:n}){const r=t.map(o=>({...n.get(o.id),position:o.position,positionAbsolute:o.positionAbsolute}));return[e?r.find(o=>o.id===e):r[0],r]}const Nv=(e,t,n,r)=>{const o=t.querySelectorAll(e);if(!o||!o.length)return null;const i=Array.from(o),s=t.getBoundingClientRect(),l={x:s.width*r[0],y:s.height*r[1]};return i.map(a=>{const u=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),position:a.getAttribute("data-handlepos"),x:(u.left-s.left-l.x)/n,y:(u.top-s.top-l.y)/n,...rf(a)}})};function $i(e,t,n){return n===void 0?n:r=>{const o=t().nodeInternals.get(e);n(r,{...o})}}function vf({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:o,unselectNodesAndEdges:i,multiSelectionActive:s,nodeInternals:l}=t.getState(),a=l.get(e);t.setState({nodesSelectionActive:!1}),a.selected?(n||a.selected&&s)&&(i({nodes:[a]}),requestAnimationFrame(()=>{var u;return(u=r==null?void 0:r.current)==null?void 0:u.blur()})):o([e])}function DO(){const e=Re();return N.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:o,snapToGrid:i}=e.getState(),s=n.touches?n.touches[0].clientX:n.clientX,l=n.touches?n.touches[0].clientY:n.clientY,a={x:(s-r[0])/r[2],y:(l-r[1])/r[2]};return{xSnapped:i?o[0]*Math.round(a.x/o[0]):a.x,ySnapped:i?o[1]*Math.round(a.y/o[1]):a.y,...a}},[])}function yf(e){return(t,n,r)=>e==null?void 0:e(t,r)}function Ov({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:o,isSelectable:i,selectNodesOnDrag:s}){const l=Re(),[a,u]=N.useState(!1),c=N.useRef([]),f=N.useRef({x:null,y:null}),p=N.useRef(0),h=N.useRef(null),v=N.useRef({x:0,y:0}),m=N.useRef(null),E=N.useRef(!1),d=DO();return N.useEffect(()=>{if(e!=null&&e.current){const g=At(e.current),y=({x:w,y:O})=>{const{nodeInternals:T,onNodeDrag:b,onSelectionDrag:P,updateNodePositions:k,nodeExtent:B,snapGrid:$,snapToGrid:F,nodeOrigin:R,onError:D}=l.getState();f.current={x:w,y:O};let A=!1;if(c.current=c.current.map(x=>{const L={x:w-x.distance.x,y:O-x.distance.y};F&&(L.x=$[0]*Math.round(L.x/$[0]),L.y=$[1]*Math.round(L.y/$[1]));const U=Rv(x,L,T,B,R,D);return A=A||x.position.x!==U.position.x||x.position.y!==U.position.y,x.position=U.position,x.positionAbsolute=U.positionAbsolute,x}),!A)return;k(c.current,!0,!0),u(!0);const C=o?b:yf(P);if(C&&m.current){const[x,L]=mf({nodeId:o,dragItems:c.current,nodeInternals:T});C(m.current,x,L)}},S=()=>{if(!h.current)return;const[w,O]=km(v.current,h.current);if(w!==0||O!==0){const{transform:T,panBy:b}=l.getState();f.current.x=(f.current.x??0)-w/T[2],f.current.y=(f.current.y??0)-O/T[2],y(f.current),b({x:w,y:O})}p.current=requestAnimationFrame(S)};if(t)g.on(".drag",null);else{const w=Z1().on("start",O=>{var A;const{nodeInternals:T,multiSelectionActive:b,domNode:P,nodesDraggable:k,unselectNodesAndEdges:B,onNodeDragStart:$,onSelectionDragStart:F}=l.getState(),R=o?$:yf(F);!s&&!b&&o&&((A=T.get(o))!=null&&A.selected||B()),o&&i&&s&&vf({id:o,store:l,nodeRef:e});const D=d(O);if(f.current=D,c.current=LO(T,k,D,o),R&&c.current){const[C,x]=mf({nodeId:o,dragItems:c.current,nodeInternals:T});R(O.sourceEvent,C,x)}h.current=(P==null?void 0:P.getBoundingClientRect())||null,v.current=Vn(O.sourceEvent,h.current)}).on("drag",O=>{const T=d(O),{autoPanOnNodeDrag:b}=l.getState();!E.current&&b&&(E.current=!0,S()),(f.current.x!==T.xSnapped||f.current.y!==T.ySnapped)&&c.current&&(m.current=O.sourceEvent,v.current=Vn(O.sourceEvent,h.current),y(T))}).on("end",O=>{if(u(!1),E.current=!1,cancelAnimationFrame(p.current),c.current){const{updateNodePositions:T,nodeInternals:b,onNodeDragStop:P,onSelectionDragStop:k}=l.getState(),B=o?P:yf(k);if(T(c.current,!1,!1),B){const[$,F]=mf({nodeId:o,dragItems:c.current,nodeInternals:b});B(O.sourceEvent,$,F)}}}).filter(O=>{const T=O.target;return!O.button&&(!n||!wv(T,`.${n}`,e))&&(!r||wv(T,r,e))});return g.call(w),()=>{g.on(".drag",null)}}}},[e,t,n,r,i,l,o,s,d]),a}function xv(){const e=Re();return N.useCallback(n=>{const{nodeInternals:r,nodeExtent:o,updateNodePositions:i,getNodes:s,snapToGrid:l,snapGrid:a,onError:u,nodesDraggable:c}=e.getState(),f=s().filter(g=>g.selected&&(g.draggable||c&&typeof g.draggable>"u")),p=l?a[0]:5,h=l?a[1]:5,v=n.isShiftPressed?4:1,m=n.x*p*v,E=n.y*h*v,d=f.map(g=>{if(g.positionAbsolute){const y={x:g.positionAbsolute.x+m,y:g.positionAbsolute.y+E};l&&(y.x=a[0]*Math.round(y.x/a[0]),y.y=a[1]*Math.round(y.y/a[1]));const{positionAbsolute:S,position:w}=Rv(g,y,r,o,void 0,u);g.position=w,g.positionAbsolute=S}return g});i(d,!0,!1)},[])}const wo={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var zi=e=>{const t=({id:n,type:r,data:o,xPos:i,yPos:s,xPosOrigin:l,yPosOrigin:a,selected:u,onClick:c,onMouseEnter:f,onMouseMove:p,onMouseLeave:h,onContextMenu:v,onDoubleClick:m,style:E,className:d,isDraggable:g,isSelectable:y,isConnectable:S,isFocusable:w,selectNodesOnDrag:O,sourcePosition:T,targetPosition:b,hidden:P,resizeObserver:k,dragHandle:B,zIndex:$,isParent:F,noDragClassName:R,noPanClassName:D,initialized:A,disableKeyboardA11y:C,ariaLabel:x,rfId:L})=>{const U=Re(),z=N.useRef(null),j=N.useRef(T),K=N.useRef(b),Y=N.useRef(r),Z=y||g||c||f||p||h,X=xv(),ee=$i(n,U.getState,f),oe=$i(n,U.getState,p),ge=$i(n,U.getState,h),ue=$i(n,U.getState,v),Ne=$i(n,U.getState,m),He=fe=>{if(y&&(!O||!g)&&vf({id:n,store:U,nodeRef:z}),c){const Je=U.getState().nodeInternals.get(n);c(fe,{...Je})}},ut=fe=>{if(!lf(fe))if(Fm.includes(fe.key)&&y){const Je=fe.key==="Escape";vf({id:n,store:U,unselect:Je,nodeRef:z})}else!C&&g&&u&&Object.prototype.hasOwnProperty.call(wo,fe.key)&&(U.setState({ariaLiveMessage:`Moved selected node ${fe.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~i}, y: ${~~s}`}),X({x:wo[fe.key].x,y:wo[fe.key].y,isShiftPressed:fe.shiftKey}))};N.useEffect(()=>{if(z.current&&!P){const fe=z.current;return k==null||k.observe(fe),()=>k==null?void 0:k.unobserve(fe)}},[P]),N.useEffect(()=>{const fe=Y.current!==r,Je=j.current!==T,Q=K.current!==b;z.current&&(fe||Je||Q)&&(fe&&(Y.current=r),Je&&(j.current=T),Q&&(K.current=b),U.getState().updateNodeDimensions([{id:n,nodeElement:z.current,forceUpdate:!0}]))},[n,r,T,b]);const me=Ov({nodeRef:z,disabled:P||!g,noDragClassName:R,handleSelector:B,nodeId:n,isSelectable:y,selectNodesOnDrag:O});return P?null:_("div",{className:Qe(["react-flow__node",`react-flow__node-${r}`,{[D]:g},d,{selected:u,selectable:y,parent:F,dragging:me}]),ref:z,style:{zIndex:$,transform:`translate(${l}px,${a}px)`,pointerEvents:Z?"all":"none",visibility:A?"visible":"hidden",...E},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:ee,onMouseMove:oe,onMouseLeave:ge,onContextMenu:ue,onClick:He,onDoubleClick:Ne,onKeyDown:w?ut:void 0,tabIndex:w?0:void 0,role:w?"button":void 0,"aria-describedby":C?void 0:`${hv}-${L}`,"aria-label":x,children:_(rO,{value:n,children:_(e,{id:n,data:o,type:r,xPos:i,yPos:s,selected:u,isConnectable:S,sourcePosition:T,targetPosition:b,dragging:me,dragHandle:B,zIndex:$})})})};return t.displayName="NodeWrapper",N.memo(t)};function kO(e){const t={input:zi(e.input||uv),default:zi(e.default||hf),output:zi(e.output||fv),group:zi(e.group||gf)},n={},r=Object.keys(e).filter(o=>!["input","default","output","group"].includes(o)).reduce((o,i)=>(o[i]=zi(e[i]||hf),o),n);return{...t,...r}}const PO=({x:e,y:t,width:n,height:r,origin:o})=>!n||!r?{x:e,y:t}:o[0]<0||o[1]<0||o[0]>1||o[1]>1?{x:e,y:t}:{x:e-n*o[0],y:t-r*o[1]},MO=typeof document<"u"?document:null;var Hi=(e=null,t={target:MO})=>{const[n,r]=N.useState(!1),o=N.useRef(!1),i=N.useRef(new Set([])),[s,l]=N.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.split("+")),c=u.reduce((f,p)=>f.concat(...p),[]);return[u,c]}return[[],[]]},[e]);return N.useEffect(()=>{var a,u;if(e!==null){const c=h=>{if(o.current=h.ctrlKey||h.metaKey||h.shiftKey,!o.current&&lf(h))return!1;const v=Iv(h.code,l);i.current.add(h[v]),Tv(s,i.current,!1)&&(h.preventDefault(),r(!0))},f=h=>{if(!o.current&&lf(h))return!1;const v=Iv(h.code,l);Tv(s,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(h[v]),o.current=!1},p=()=>{i.current.clear(),r(!1)};return(a=t==null?void 0:t.target)==null||a.addEventListener("keydown",c),(u=t==null?void 0:t.target)==null||u.addEventListener("keyup",f),window.addEventListener("blur",p),()=>{var h,v;(h=t==null?void 0:t.target)==null||h.removeEventListener("keydown",c),(v=t==null?void 0:t.target)==null||v.removeEventListener("keyup",f),window.removeEventListener("blur",p)}}},[e,r]),n};function Tv(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(o=>t.has(o)))}function Iv(e,t){return t.includes(e)?"code":"key"}function Cv(e,t,n,r){var s,l;if(!e.parentNode)return n;const o=t.get(e.parentNode),i=yo(o,r);return Cv(o,t,{x:(n.x??0)+i.x,y:(n.y??0)+i.y,z:(((s=o[Se])==null?void 0:s.z)??0)>(n.z??0)?((l=o[Se])==null?void 0:l.z)??0:n.z??0},r)}function Av(e,t,n){e.forEach(r=>{var o;if(r.parentNode&&!e.has(r.parentNode))throw new Error(`Parent node ${r.parentNode} not found`);if(r.parentNode||n!=null&&n[r.id]){const{x:i,y:s,z:l}=Cv(r,e,{...r.position,z:((o=r[Se])==null?void 0:o.z)??0},t);r.positionAbsolute={x:i,y:s},r[Se].z=l,n!=null&&n[r.id]&&(r[Se].isParent=!0)}})}function Ef(e,t,n,r){const o=new Map,i={},s=r?1e3:0;return e.forEach(l=>{var f;const a=(mt(l.zIndex)?l.zIndex:0)+(l.selected?s:0),u=t.get(l.id),c={width:u==null?void 0:u.width,height:u==null?void 0:u.height,...l,positionAbsolute:{x:l.position.x,y:l.position.y}};l.parentNode&&(c.parentNode=l.parentNode,i[l.parentNode]=!0),Object.defineProperty(c,Se,{enumerable:!1,value:{handleBounds:(f=u==null?void 0:u[Se])==null?void 0:f.handleBounds,z:a}}),o.set(l.id,c)}),Av(o,n,i),o}function bv(e,t={}){const{getNodes:n,width:r,height:o,minZoom:i,maxZoom:s,d3Zoom:l,d3Selection:a,fitViewOnInitDone:u,fitViewOnInit:c,nodeOrigin:f}=e(),p=t.initial&&!u&&c;if(l&&a&&(p||!t.initial)){const v=n().filter(E=>{var g;const d=t.includeHiddenNodes?E.width&&E.height:!E.hidden;return(g=t.nodes)!=null&&g.length?d&&t.nodes.some(y=>y.id===E.id):d}),m=v.every(E=>E.width&&E.height);if(v.length>0&&m){const E=qm(v,f),[d,g,y]=ev(E,r,o,t.minZoom??i,t.maxZoom??s,t.padding??.1),S=Un.translate(d,g).scale(y);return typeof t.duration=="number"&&t.duration>0?l.transform(mr(a,t.duration),S):l.transform(a,S),!0}}return!1}function UO(e,t){return e.forEach(n=>{const r=t.get(n.id);r&&t.set(r.id,{...r,[Se]:r[Se],selected:n.selected})}),new Map(t)}function FO(e,t){return t.map(n=>{const r=e.find(o=>o.id===n.id);return r&&(n.selected=r.selected),n})}function Zl({changedNodes:e,changedEdges:t,get:n,set:r}){const{nodeInternals:o,edges:i,onNodesChange:s,onEdgesChange:l,hasDefaultNodes:a,hasDefaultEdges:u}=n();e!=null&&e.length&&(a&&r({nodeInternals:UO(e,o)}),s==null||s(e)),t!=null&&t.length&&(u&&r({edges:FO(t,i)}),l==null||l(t))}const Ro=()=>{},VO={zoomIn:Ro,zoomOut:Ro,zoomTo:Ro,getZoom:()=>1,setViewport:Ro,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Ro,fitBounds:Ro,project:e=>e,viewportInitialized:!1},BO=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),$O=()=>{const e=Re(),{d3Zoom:t,d3Selection:n}=ae(BO,Xe);return N.useMemo(()=>n&&t?{zoomIn:o=>t.scaleBy(mr(n,o==null?void 0:o.duration),1.2),zoomOut:o=>t.scaleBy(mr(n,o==null?void 0:o.duration),1/1.2),zoomTo:(o,i)=>t.scaleTo(mr(n,i==null?void 0:i.duration),o),getZoom:()=>e.getState().transform[2],setViewport:(o,i)=>{const[s,l,a]=e.getState().transform,u=Un.translate(o.x??s,o.y??l).scale(o.zoom??a);t.transform(mr(n,i==null?void 0:i.duration),u)},getViewport:()=>{const[o,i,s]=e.getState().transform;return{x:o,y:i,zoom:s}},fitView:o=>bv(e.getState,o),setCenter:(o,i,s)=>{const{width:l,height:a,maxZoom:u}=e.getState(),c=typeof(s==null?void 0:s.zoom)<"u"?s.zoom:u,f=l/2-o*c,p=a/2-i*c,h=Un.translate(f,p).scale(c);t.transform(mr(n,s==null?void 0:s.duration),h)},fitBounds:(o,i)=>{const{width:s,height:l,minZoom:a,maxZoom:u}=e.getState(),[c,f,p]=ev(o,s,l,a,u,(i==null?void 0:i.padding)??.1),h=Un.translate(c,f).scale(p);t.transform(mr(n,i==null?void 0:i.duration),h)},project:o=>{const{transform:i,snapToGrid:s,snapGrid:l}=e.getState();return Xm(o,i,s,l)},viewportInitialized:!0}:VO,[t,n])};function Sf(){const e=$O(),t=Re(),n=N.useCallback(()=>t.getState().getNodes().map(m=>({...m})),[]),r=N.useCallback(m=>t.getState().nodeInternals.get(m),[]),o=N.useCallback(()=>{const{edges:m=[]}=t.getState();return m.map(E=>({...E}))},[]),i=N.useCallback(m=>{const{edges:E=[]}=t.getState();return E.find(d=>d.id===m)},[]),s=N.useCallback(m=>{const{getNodes:E,setNodes:d,hasDefaultNodes:g,onNodesChange:y}=t.getState(),S=E(),w=typeof m=="function"?m(S):m;if(g)d(w);else if(y){const O=w.length===0?S.map(T=>({type:"remove",id:T.id})):w.map(T=>({item:T,type:"reset"}));y(O)}},[]),l=N.useCallback(m=>{const{edges:E=[],setEdges:d,hasDefaultEdges:g,onEdgesChange:y}=t.getState(),S=typeof m=="function"?m(E):m;if(g)d(S);else if(y){const w=S.length===0?E.map(O=>({type:"remove",id:O.id})):S.map(O=>({item:O,type:"reset"}));y(w)}},[]),a=N.useCallback(m=>{const E=Array.isArray(m)?m:[m],{getNodes:d,setNodes:g,hasDefaultNodes:y,onNodesChange:S}=t.getState();if(y){const O=[...d(),...E];g(O)}else if(S){const w=E.map(O=>({item:O,type:"add"}));S(w)}},[]),u=N.useCallback(m=>{const E=Array.isArray(m)?m:[m],{edges:d=[],setEdges:g,hasDefaultEdges:y,onEdgesChange:S}=t.getState();if(y)g([...d,...E]);else if(S){const w=E.map(O=>({item:O,type:"add"}));S(w)}},[]),c=N.useCallback(()=>{const{getNodes:m,edges:E=[],transform:d}=t.getState(),[g,y,S]=d;return{nodes:m().map(w=>({...w})),edges:E.map(w=>({...w})),viewport:{x:g,y,zoom:S}}},[]),f=N.useCallback(({nodes:m,edges:E})=>{const{nodeInternals:d,getNodes:g,edges:y,hasDefaultNodes:S,hasDefaultEdges:w,onNodesDelete:O,onEdgesDelete:T,onNodesChange:b,onEdgesChange:P}=t.getState(),k=(m||[]).map(D=>D.id),B=(E||[]).map(D=>D.id),$=g().reduce((D,A)=>{const C=!k.includes(A.id)&&A.parentNode&&D.find(L=>L.id===A.parentNode);return(typeof A.deletable=="boolean"?A.deletable:!0)&&(k.includes(A.id)||C)&&D.push(A),D},[]),F=y.filter(D=>typeof D.deletable=="boolean"?D.deletable:!0),R=F.filter(D=>B.includes(D.id));if($||R){const D=Jm($,F),A=[...R,...D],C=A.reduce((x,L)=>(x.includes(L.id)||x.push(L.id),x),[]);if((w||S)&&(w&&t.setState({edges:y.filter(x=>!C.includes(x.id))}),S&&($.forEach(x=>{d.delete(x.id)}),t.setState({nodeInternals:new Map(d)}))),C.length>0&&(T==null||T(A),P&&P(C.map(x=>({id:x,type:"remove"})))),$.length>0&&(O==null||O($),b)){const x=$.map(L=>({id:L.id,type:"remove"}));b(x)}}},[]),p=N.useCallback(m=>{const E=XN(m),d=E?null:t.getState().nodeInternals.get(m.id);return[E?m:Um(d),d,E]},[]),h=N.useCallback((m,E=!0,d)=>{const[g,y,S]=p(m);return g?(d||t.getState().getNodes()).filter(w=>{if(!S&&(w.id===y.id||!w.positionAbsolute))return!1;const O=Um(w),T=sf(O,g);return E&&T>0||T>=m.width*m.height}):[]},[]),v=N.useCallback((m,E,d=!0)=>{const[g]=p(m);if(!g)return!1;const y=sf(g,E);return d&&y>0||y>=m.width*m.height},[]);return N.useMemo(()=>({...e,getNodes:n,getNode:r,getEdges:o,getEdge:i,setNodes:s,setEdges:l,addNodes:a,addEdges:u,toObject:c,deleteElements:f,getIntersectingNodes:h,isNodeIntersecting:v}),[e,n,r,o,i,s,l,a,u,c,f,h,v])}var zO=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=Re(),{deleteElements:r}=Sf(),o=Hi(e),i=Hi(t);N.useEffect(()=>{if(o){const{edges:s,getNodes:l}=n.getState(),a=l().filter(c=>c.selected),u=s.filter(c=>c.selected);r({nodes:a,edges:u}),n.setState({nodesSelectionActive:!1})}},[o]),N.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])};function HO(e){const t=Re();N.useEffect(()=>{let n;const r=()=>{var i,s;if(!e.current)return;const o=rf(e.current);(o.height===0||o.width===0)&&((s=(i=t.getState()).onError)==null||s.call(i,"004",Fn.error004())),t.setState({width:o.width||500,height:o.height||500})};return r(),window.addEventListener("resize",r),e.current&&(n=new ResizeObserver(()=>r()),n.observe(e.current)),()=>{window.removeEventListener("resize",r),n&&e.current&&n.unobserve(e.current)}},[])}const _f={position:"absolute",width:"100%",height:"100%",top:0,left:0},jO=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,wf=e=>({x:e.x,y:e.y,zoom:e.k}),No=(e,t)=>e.target.closest(`.${t}`),Lv=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),WO=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),GO=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:o=!0,zoomOnPinch:i=!0,panOnScroll:s=!1,panOnScrollSpeed:l=.5,panOnScrollMode:a=vo.Free,zoomOnDoubleClick:u=!0,elementsSelectable:c,panOnDrag:f=!0,defaultViewport:p,translateExtent:h,minZoom:v,maxZoom:m,zoomActivationKeyCode:E,preventScrolling:d=!0,children:g,noWheelClassName:y,noPanClassName:S})=>{const w=N.useRef(),O=Re(),T=N.useRef(!1),b=N.useRef(!1),P=N.useRef(null),k=N.useRef({x:0,y:0,zoom:0}),{d3Zoom:B,d3Selection:$,d3ZoomHandler:F,userSelectionActive:R}=ae(WO,Xe),D=Hi(E),A=N.useRef(0);return HO(P),N.useEffect(()=>{if(P.current){const C=P.current.getBoundingClientRect(),x=zN().scaleExtent([v,m]).translateExtent(h),L=At(P.current).call(x),U=Un.translate(p.x,p.y).scale(go(p.zoom,v,m)),z=[[0,0],[C.width,C.height]],j=x.constrain()(U,z,h);x.transform(L,j),O.setState({d3Zoom:x,d3Selection:L,d3ZoomHandler:L.on("wheel.zoom"),transform:[j.x,j.y,j.k],domNode:P.current.closest(".react-flow")})}},[]),N.useEffect(()=>{$&&B&&(s&&!D&&!R?$.on("wheel.zoom",C=>{if(No(C,y))return!1;C.preventDefault(),C.stopImmediatePropagation();const x=$.property("__zoom").k||1;if(C.ctrlKey&&i){const j=zt(C),K=-C.deltaY*(C.deltaMode===1?.05:C.deltaMode?1:.002)*10,Y=x*Math.pow(2,K);B.scaleTo($,Y,j);return}const L=C.deltaMode===1?20:1,U=a===vo.Vertical?0:C.deltaX*L,z=a===vo.Horizontal?0:C.deltaY*L;B.translateBy($,-(U/x)*l,-(z/x)*l)},{passive:!1}):typeof F<"u"&&$.on("wheel.zoom",function(C,x){if(!d||No(C,y))return null;C.preventDefault(),F.call(this,C,x)},{passive:!1}))},[R,s,a,$,B,F,D,i,d,y]),N.useEffect(()=>{B&&B.on("start",C=>{var L;if(!C.sourceEvent)return null;A.current=C.sourceEvent.button;const{onViewportChangeStart:x}=O.getState();if(T.current=!0,((L=C.sourceEvent)==null?void 0:L.type)==="mousedown"&&O.setState({paneDragging:!0}),t||x){const U=wf(C.transform);k.current=U,x==null||x(U),t==null||t(C.sourceEvent,U)}})},[B,t]),N.useEffect(()=>{B&&(R&&!T.current?B.on("zoom",null):R||B.on("zoom",C=>{const{onViewportChange:x}=O.getState();if(O.setState({transform:[C.transform.x,C.transform.y,C.transform.k]}),b.current=!!(r&&Lv(f,A.current??0)),e||x){const L=wf(C.transform);x==null||x(L),e==null||e(C.sourceEvent,L)}}))},[R,B,e,f,r]),N.useEffect(()=>{B&&B.on("end",C=>{if(!C.sourceEvent)return null;const{onViewportChangeEnd:x}=O.getState();if(T.current=!1,O.setState({paneDragging:!1}),r&&Lv(f,A.current??0)&&!b.current&&r(C.sourceEvent),b.current=!1,(n||x)&&jO(k.current,C.transform)){const L=wf(C.transform);k.current=L,clearTimeout(w.current),w.current=setTimeout(()=>{x==null||x(L),n==null||n(C.sourceEvent,L)},s?150:0)}})},[B,s,f,n,r]),N.useEffect(()=>{B&&B.filter(C=>{const x=D||o,L=i&&C.ctrlKey;if(C.button===1&&C.type==="mousedown"&&(No(C,"react-flow__node")||No(C,"react-flow__edge")))return!0;if(!f&&!x&&!s&&!u&&!i||R||!u&&C.type==="dblclick"||No(C,y)&&C.type==="wheel"||No(C,S)&&C.type!=="wheel"||!i&&C.ctrlKey&&C.type==="wheel"||!x&&!s&&!L&&C.type==="wheel"||!f&&(C.type==="mousedown"||C.type==="touchstart")||Array.isArray(f)&&!f.includes(C.button)&&(C.type==="mousedown"||C.type==="touchstart"))return!1;const U=Array.isArray(f)&&f.includes(C.button)||!C.button||C.button<=1;return(!C.ctrlKey||C.type==="wheel")&&U})},[R,B,o,i,s,u,f,c,D]),_("div",{className:"react-flow__renderer",ref:P,style:_f,children:g})},YO=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function KO(){const{userSelectionActive:e,userSelectionRect:t}=ae(YO,Xe);return e&&t?_("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function Dv(e,t){const n=e.find(r=>r.id===t.parentNode);if(n){const r=t.position.x+t.width-n.width,o=t.position.y+t.height-n.height;if(r>0||o>0||t.position.x<0||t.position.y<0){if(n.style={...n.style},n.style.width=n.style.width??n.width,n.style.height=n.style.height??n.height,r>0&&(n.style.width+=r),o>0&&(n.style.height+=o),t.position.x<0){const i=Math.abs(t.position.x);n.position.x=n.position.x-i,n.style.width+=i,t.position.x=0}if(t.position.y<0){const i=Math.abs(t.position.y);n.position.y=n.position.y-i,n.style.height+=i,t.position.y=0}n.width=n.style.width,n.height=n.style.height}}}function kv(e,t){if(e.some(r=>r.type==="reset"))return e.filter(r=>r.type==="reset").map(r=>r.item);const n=e.filter(r=>r.type==="add").map(r=>r.item);return t.reduce((r,o)=>{const i=e.filter(l=>l.id===o.id);if(i.length===0)return r.push(o),r;const s={...o};for(const l of i)if(l)switch(l.type){case"select":{s.selected=l.selected;break}case"position":{typeof l.position<"u"&&(s.position=l.position),typeof l.positionAbsolute<"u"&&(s.positionAbsolute=l.positionAbsolute),typeof l.dragging<"u"&&(s.dragging=l.dragging),s.expandParent&&Dv(r,s);break}case"dimensions":{typeof l.dimensions<"u"&&(s.width=l.dimensions.width,s.height=l.dimensions.height),typeof l.updateStyle<"u"&&(s.style={...s.style||{},...l.dimensions}),typeof l.resizing=="boolean"&&(s.resizing=l.resizing),s.expandParent&&Dv(r,s);break}case"remove":return r}return r.push(s),r},n)}function Pv(e,t){return kv(e,t)}function QO(e,t){return kv(e,t)}const zn=(e,t)=>({id:e,type:"select",selected:t});function Oo(e,t){return e.reduce((n,r)=>{const o=t.includes(r.id);return!r.selected&&o?(r.selected=!0,n.push(zn(r.id,!0))):r.selected&&!o&&(r.selected=!1,n.push(zn(r.id,!1))),n},[])}const Rf=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},XO=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),Mv=N.memo(({isSelecting:e,selectionMode:t=Fi.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:o,onPaneClick:i,onPaneContextMenu:s,onPaneScroll:l,onPaneMouseEnter:a,onPaneMouseMove:u,onPaneMouseLeave:c,children:f})=>{const p=N.useRef(null),h=Re(),v=N.useRef(0),m=N.useRef(0),E=N.useRef(),{userSelectionActive:d,elementsSelectable:g,dragging:y}=ae(XO,Xe),S=()=>{h.setState({userSelectionActive:!1,userSelectionRect:null}),v.current=0,m.current=0},w=F=>{i==null||i(F),h.getState().resetSelectedElements(),h.setState({nodesSelectionActive:!1})},O=F=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){F.preventDefault();return}s==null||s(F)},T=l?F=>l(F):void 0,b=F=>{const{resetSelectedElements:R,domNode:D}=h.getState();if(E.current=D==null?void 0:D.getBoundingClientRect(),!g||!e||F.button!==0||F.target!==p.current||!E.current)return;const{x:A,y:C}=Vn(F,E.current);R(),h.setState({userSelectionRect:{width:0,height:0,startX:A,startY:C,x:A,y:C}}),r==null||r(F)},P=F=>{const{userSelectionRect:R,nodeInternals:D,edges:A,transform:C,onNodesChange:x,onEdgesChange:L,nodeOrigin:U,getNodes:z}=h.getState();if(!e||!E.current||!R)return;h.setState({userSelectionActive:!0,nodesSelectionActive:!1});const j=Vn(F,E.current),K=R.startX??0,Y=R.startY??0,Z={...R,x:j.x<K?j.x:K,y:j.y<Y?j.y:Y,width:Math.abs(j.x-K),height:Math.abs(j.y-Y)},X=z(),ee=Zm(D,Z,C,t===Fi.Partial,!0,U),oe=Jm(ee,A).map(ue=>ue.id),ge=ee.map(ue=>ue.id);if(v.current!==ge.length){v.current=ge.length;const ue=Oo(X,ge);ue.length&&(x==null||x(ue))}if(m.current!==oe.length){m.current=oe.length;const ue=Oo(A,oe);ue.length&&(L==null||L(ue))}h.setState({userSelectionRect:Z})},k=F=>{if(F.button!==0)return;const{userSelectionRect:R}=h.getState();!d&&R&&F.target===p.current&&(w==null||w(F)),h.setState({nodesSelectionActive:v.current>0}),S(),o==null||o(F)},B=F=>{d&&(h.setState({nodesSelectionActive:v.current>0}),o==null||o(F)),S()},$=g&&(e||d);return V("div",{className:Qe(["react-flow__pane",{dragging:y,selection:e}]),onClick:$?void 0:Rf(w,p),onContextMenu:Rf(O,p),onWheel:Rf(T,p),onMouseEnter:$?void 0:a,onMouseDown:$?b:void 0,onMouseMove:$?P:u,onMouseUp:$?k:void 0,onMouseLeave:$?B:c,ref:p,style:_f,children:[f,_(KO,{})]})});Mv.displayName="Pane";const qO=e=>{const t=e.getNodes().filter(n=>n.selected);return{...qm(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function ZO({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Re(),{width:o,height:i,x:s,y:l,transformString:a,userSelectionActive:u}=ae(qO,Xe),c=xv(),f=N.useRef(null);if(N.useEffect(()=>{var v;n||(v=f.current)==null||v.focus({preventScroll:!0})},[n]),Ov({nodeRef:f}),u||!o||!i)return null;const p=e?v=>{const m=r.getState().getNodes().filter(E=>E.selected);e(v,m)}:void 0,h=v=>{Object.prototype.hasOwnProperty.call(wo,v.key)&&c({x:wo[v.key].x,y:wo[v.key].y,isShiftPressed:v.shiftKey})};return _("div",{className:Qe(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:_("div",{ref:f,className:"react-flow__nodesselection-rect",onContextMenu:p,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:o,height:i,top:l,left:s}})})}var JO=N.memo(ZO);const ex=e=>e.nodesSelectionActive,Uv=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:s,deleteKeyCode:l,onMove:a,onMoveStart:u,onMoveEnd:c,selectionKeyCode:f,selectionOnDrag:p,selectionMode:h,onSelectionStart:v,onSelectionEnd:m,multiSelectionKeyCode:E,panActivationKeyCode:d,zoomActivationKeyCode:g,elementsSelectable:y,zoomOnScroll:S,zoomOnPinch:w,panOnScroll:O,panOnScrollSpeed:T,panOnScrollMode:b,zoomOnDoubleClick:P,panOnDrag:k,defaultViewport:B,translateExtent:$,minZoom:F,maxZoom:R,preventScrolling:D,onSelectionContextMenu:A,noWheelClassName:C,noPanClassName:x,disableKeyboardA11y:L})=>{const U=ae(ex),z=Hi(f),K=Hi(d)||k,Y=z||p&&K!==!0;return zO({deleteKeyCode:l,multiSelectionKeyCode:E}),_(GO,{onMove:a,onMoveStart:u,onMoveEnd:c,onPaneContextMenu:i,elementsSelectable:y,zoomOnScroll:S,zoomOnPinch:w,panOnScroll:O,panOnScrollSpeed:T,panOnScrollMode:b,zoomOnDoubleClick:P,panOnDrag:!z&&K,defaultViewport:B,translateExtent:$,minZoom:F,maxZoom:R,zoomActivationKeyCode:g,preventScrolling:D,noWheelClassName:C,noPanClassName:x,children:V(Mv,{onSelectionStart:v,onSelectionEnd:m,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:K,isSelecting:!!Y,selectionMode:h,children:[e,U&&_(JO,{onSelectionContextMenu:A,noPanClassName:x,disableKeyboardA11y:L})]})})};Uv.displayName="FlowRenderer";var tx=N.memo(Uv);function nx(e){return ae(N.useCallback(n=>e?Zm(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}const rx=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),Fv=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,updateNodeDimensions:i,onError:s}=ae(rx,Xe),l=nx(e.onlyRenderVisibleElements),a=N.useRef(),u=N.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const c=new ResizeObserver(f=>{const p=f.map(h=>({id:h.target.getAttribute("data-id"),nodeElement:h.target,forceUpdate:!0}));i(p)});return a.current=c,c},[]);return N.useEffect(()=>()=>{var c;(c=a==null?void 0:a.current)==null||c.disconnect()},[]),_("div",{className:"react-flow__nodes",style:_f,children:l.map(c=>{var w,O;let f=c.type||"default";e.nodeTypes[f]||(s==null||s("003",Fn.error003(f)),f="default");const p=e.nodeTypes[f]||e.nodeTypes.default,h=!!(c.draggable||t&&typeof c.draggable>"u"),v=!!(c.selectable||o&&typeof c.selectable>"u"),m=!!(c.connectable||n&&typeof c.connectable>"u"),E=!!(c.focusable||r&&typeof c.focusable>"u"),d=e.nodeExtent?of(c.positionAbsolute,e.nodeExtent):c.positionAbsolute,g=(d==null?void 0:d.x)??0,y=(d==null?void 0:d.y)??0,S=PO({x:g,y,width:c.width??0,height:c.height??0,origin:e.nodeOrigin});return _(p,{id:c.id,className:c.className,style:c.style,type:f,data:c.data,sourcePosition:c.sourcePosition||G.Bottom,targetPosition:c.targetPosition||G.Top,hidden:c.hidden,xPos:g,yPos:y,xPosOrigin:S.x,yPosOrigin:S.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!c.selected,isDraggable:h,isSelectable:v,isConnectable:m,isFocusable:E,resizeObserver:u,dragHandle:c.dragHandle,zIndex:((w=c[Se])==null?void 0:w.z)??0,isParent:!!((O=c[Se])!=null&&O.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!c.width&&!!c.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:c.ariaLabel},c.id)})})};Fv.displayName="NodeRenderer";var ox=N.memo(Fv);const ix=[{level:0,isMaxLevel:!0,edges:[]}];function sx(e,t,n=!1){let r=-1;const o=e.reduce((s,l)=>{var c,f,p,h;const a=mt(l.zIndex);let u=a?l.zIndex:0;return n&&(u=a?l.zIndex:Math.max(((f=(c=t.get(l.source))==null?void 0:c[Se])==null?void 0:f.z)||0,((h=(p=t.get(l.target))==null?void 0:p[Se])==null?void 0:h.z)||0)),s[u]?s[u].push(l):s[u]=[l],r=u>r?u:r,s},{}),i=Object.entries(o).map(([s,l])=>{const a=+s;return{edges:l,level:a,isMaxLevel:a===r}});return i.length===0?ix:i}function lx(e,t,n){const r=ae(N.useCallback(o=>e?o.edges.filter(i=>{const s=t.get(i.source),l=t.get(i.target);return(s==null?void 0:s.width)&&(s==null?void 0:s.height)&&(l==null?void 0:l.width)&&(l==null?void 0:l.height)&&bO({sourcePos:s.positionAbsolute||{x:0,y:0},targetPos:l.positionAbsolute||{x:0,y:0},sourceWidth:s.width,sourceHeight:s.height,targetWidth:l.width,targetHeight:l.height,width:o.width,height:o.height,transform:o.transform})}):o.edges,[e,t]));return sx(r,t,n)}const ax=({color:e="none",strokeWidth:t=1})=>_("polyline",{stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:t,fill:"none",points:"-5,-4 0,0 -5,4"}),ux=({color:e="none",strokeWidth:t=1})=>_("polyline",{stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:t,fill:e,points:"-5,-4 0,0 -5,4 -5,-4"}),Vv={[Vi.Arrow]:ax,[Vi.ArrowClosed]:ux};function cx(e){const t=Re();return N.useMemo(()=>{var o,i;return Object.prototype.hasOwnProperty.call(Vv,e)?Vv[e]:((i=(o=t.getState()).onError)==null||i.call(o,"009",Fn.error009(e)),null)},[e])}const fx=({id:e,type:t,color:n,width:r=12.5,height:o=12.5,markerUnits:i="strokeWidth",strokeWidth:s,orient:l="auto-start-reverse"})=>{const a=cx(t);return a?_("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:l,refX:"0",refY:"0",children:_(a,{color:n,strokeWidth:s})}):null},dx=({defaultColor:e,rfId:t})=>n=>{const r=[];return n.edges.reduce((o,i)=>([i.markerStart,i.markerEnd].forEach(s=>{if(s&&typeof s=="object"){const l=df(s,t);r.includes(l)||(o.push({id:l,color:s.color||e,...s}),r.push(l))}}),o),[]).sort((o,i)=>o.id.localeCompare(i.id))},Bv=({defaultColor:e,rfId:t})=>{const n=ae(N.useCallback(dx({defaultColor:e,rfId:t}),[e,t]),(r,o)=>!(r.length!==o.length||r.some((i,s)=>i.id!==o[s].id)));return _("defs",{children:n.map(r=>_(fx,{id:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient},r.id))})};Bv.displayName="MarkerDefinitions";var px=N.memo(Bv);const hx=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),$v=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:r,edgeTypes:o,noPanClassName:i,onEdgeUpdate:s,onEdgeContextMenu:l,onEdgeMouseEnter:a,onEdgeMouseMove:u,onEdgeMouseLeave:c,onEdgeClick:f,edgeUpdaterRadius:p,onEdgeDoubleClick:h,onEdgeUpdateStart:v,onEdgeUpdateEnd:m,children:E})=>{const{edgesFocusable:d,edgesUpdatable:g,elementsSelectable:y,width:S,height:w,connectionMode:O,nodeInternals:T,onError:b}=ae(hx,Xe),P=lx(t,T,n);return S?V(be,{children:[P.map(({level:k,edges:B,isMaxLevel:$})=>V("svg",{style:{zIndex:k},width:S,height:w,className:"react-flow__edges react-flow__container",children:[$&&_(px,{defaultColor:e,rfId:r}),_("g",{children:B.map(F=>{const[R,D,A]=Sv(T.get(F.source)),[C,x,L]=Sv(T.get(F.target));if(!A||!L)return null;let U=F.type||"default";o[U]||(b==null||b("011",Fn.error011(U)),U="default");const z=o[U]||o.default,j=O===Bn.Strict?x.target:(x.target??[]).concat(x.source??[]),K=Ev(D.source,F.sourceHandle),Y=Ev(j,F.targetHandle),Z=(K==null?void 0:K.position)||G.Bottom,X=(Y==null?void 0:Y.position)||G.Top,ee=!!(F.focusable||d&&typeof F.focusable>"u"),oe=typeof s<"u"&&(F.updatable||g&&typeof F.updatable>"u");if(!K||!Y)return b==null||b("008",Fn.error008(K,F)),null;const{sourceX:ge,sourceY:ue,targetX:Ne,targetY:He}=AO(R,K,Z,C,Y,X);return _(z,{id:F.id,className:Qe([F.className,i]),type:U,data:F.data,selected:!!F.selected,animated:!!F.animated,hidden:!!F.hidden,label:F.label,labelStyle:F.labelStyle,labelShowBg:F.labelShowBg,labelBgStyle:F.labelBgStyle,labelBgPadding:F.labelBgPadding,labelBgBorderRadius:F.labelBgBorderRadius,style:F.style,source:F.source,target:F.target,sourceHandleId:F.sourceHandle,targetHandleId:F.targetHandle,markerEnd:F.markerEnd,markerStart:F.markerStart,sourceX:ge,sourceY:ue,targetX:Ne,targetY:He,sourcePosition:Z,targetPosition:X,elementsSelectable:y,onEdgeUpdate:s,onContextMenu:l,onMouseEnter:a,onMouseMove:u,onMouseLeave:c,onClick:f,edgeUpdaterRadius:p,onEdgeDoubleClick:h,onEdgeUpdateStart:v,onEdgeUpdateEnd:m,rfId:r,ariaLabel:F.ariaLabel,isFocusable:ee,isUpdatable:oe,pathOptions:"pathOptions"in F?F.pathOptions:void 0,interactionWidth:F.interactionWidth},F.id)})})]},k)),E]}):null};$v.displayName="EdgeRenderer";var gx=N.memo($v);const mx=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function vx({children:e}){const t=ae(mx);return _("div",{className:"react-flow__viewport react-flow__container",style:{transform:t},children:e})}function yx(e){const t=Sf(),n=N.useRef(!1);N.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const Ex={[G.Left]:G.Right,[G.Right]:G.Left,[G.Top]:G.Bottom,[G.Bottom]:G.Top},zv=({nodeId:e,handleType:t,style:n,type:r=$n.Bezier,CustomComponent:o,connectionStatus:i})=>{var O,T,b;const{fromNode:s,handleId:l,toX:a,toY:u,connectionMode:c}=ae(N.useCallback(P=>({fromNode:P.nodeInternals.get(e),handleId:P.connectionHandleId,toX:(P.connectionPosition.x-P.transform[0])/P.transform[2],toY:(P.connectionPosition.y-P.transform[1])/P.transform[2],connectionMode:P.connectionMode}),[e]),Xe),f=(O=s==null?void 0:s[Se])==null?void 0:O.handleBounds;let p=f==null?void 0:f[t];if(c===Bn.Loose&&(p=p||(f==null?void 0:f[t==="source"?"target":"source"])),!s||!p)return null;const h=l?p.find(P=>P.id===l):p[0],v=h?h.x+h.width/2:(s.width??0)/2,m=h?h.y+h.height/2:s.height??0,E=(((T=s.positionAbsolute)==null?void 0:T.x)??0)+v,d=(((b=s.positionAbsolute)==null?void 0:b.y)??0)+m,g=h==null?void 0:h.position,y=g?Ex[g]:null;if(!g||!y)return null;if(o)return _(o,{connectionLineType:r,connectionLineStyle:n,fromNode:s,fromHandle:h,fromX:E,fromY:d,toX:a,toY:u,fromPosition:g,toPosition:y,connectionStatus:i});let S="";const w={sourceX:E,sourceY:d,sourcePosition:g,targetX:a,targetY:u,targetPosition:y};return r===$n.Bezier?[S]=Ym(w):r===$n.Step?[S]=Bi({...w,borderRadius:0}):r===$n.SmoothStep?[S]=Bi(w):r===$n.SimpleBezier?[S]=Hm(w):S=`M${E},${d} ${a},${u}`,_("path",{d:S,fill:"none",className:"react-flow__connection-path",style:n})};zv.displayName="ConnectionLine";const Sx=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function _x({containerStyle:e,style:t,type:n,component:r}){const{nodeId:o,handleType:i,nodesConnectable:s,width:l,height:a,connectionStatus:u}=ae(Sx,Xe);return!(o&&i&&l&&s)?null:_("svg",{style:e,width:l,height:a,className:"react-flow__edges react-flow__connectionline react-flow__container",children:_("g",{className:Qe(["react-flow__connection",u]),children:_(zv,{nodeId:o,handleType:i,style:t,type:n,CustomComponent:r,connectionStatus:u})})})}const Hv=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:r,onMoveEnd:o,onInit:i,onNodeClick:s,onEdgeClick:l,onNodeDoubleClick:a,onEdgeDoubleClick:u,onNodeMouseEnter:c,onNodeMouseMove:f,onNodeMouseLeave:p,onNodeContextMenu:h,onSelectionContextMenu:v,onSelectionStart:m,onSelectionEnd:E,connectionLineType:d,connectionLineStyle:g,connectionLineComponent:y,connectionLineContainerStyle:S,selectionKeyCode:w,selectionOnDrag:O,selectionMode:T,multiSelectionKeyCode:b,panActivationKeyCode:P,zoomActivationKeyCode:k,deleteKeyCode:B,onlyRenderVisibleElements:$,elementsSelectable:F,selectNodesOnDrag:R,defaultViewport:D,translateExtent:A,minZoom:C,maxZoom:x,preventScrolling:L,defaultMarkerColor:U,zoomOnScroll:z,zoomOnPinch:j,panOnScroll:K,panOnScrollSpeed:Y,panOnScrollMode:Z,zoomOnDoubleClick:X,panOnDrag:ee,onPaneClick:oe,onPaneMouseEnter:ge,onPaneMouseMove:ue,onPaneMouseLeave:Ne,onPaneScroll:He,onPaneContextMenu:ut,onEdgeUpdate:me,onEdgeContextMenu:fe,onEdgeMouseEnter:Je,onEdgeMouseMove:Q,onEdgeMouseLeave:Xn,edgeUpdaterRadius:Nr,onEdgeUpdateStart:ss,onEdgeUpdateEnd:ls,noDragClassName:Ao,noWheelClassName:Or,noPanClassName:qn,elevateEdgesOnSelect:bo,disableKeyboardA11y:Zn,nodeOrigin:xr,nodeExtent:as,rfId:Lo})=>(yx(i),_(tx,{onPaneClick:oe,onPaneMouseEnter:ge,onPaneMouseMove:ue,onPaneMouseLeave:Ne,onPaneContextMenu:ut,onPaneScroll:He,deleteKeyCode:B,selectionKeyCode:w,selectionOnDrag:O,selectionMode:T,onSelectionStart:m,onSelectionEnd:E,multiSelectionKeyCode:b,panActivationKeyCode:P,zoomActivationKeyCode:k,elementsSelectable:F,onMove:n,onMoveStart:r,onMoveEnd:o,zoomOnScroll:z,zoomOnPinch:j,zoomOnDoubleClick:X,panOnScroll:K,panOnScrollSpeed:Y,panOnScrollMode:Z,panOnDrag:ee,defaultViewport:D,translateExtent:A,minZoom:C,maxZoom:x,onSelectionContextMenu:v,preventScrolling:L,noDragClassName:Ao,noWheelClassName:Or,noPanClassName:qn,disableKeyboardA11y:Zn,children:V(vx,{children:[_(gx,{edgeTypes:t,onEdgeClick:l,onEdgeDoubleClick:u,onEdgeUpdate:me,onlyRenderVisibleElements:$,onEdgeContextMenu:fe,onEdgeMouseEnter:Je,onEdgeMouseMove:Q,onEdgeMouseLeave:Xn,onEdgeUpdateStart:ss,onEdgeUpdateEnd:ls,edgeUpdaterRadius:Nr,defaultMarkerColor:U,noPanClassName:qn,elevateEdgesOnSelect:!!bo,disableKeyboardA11y:Zn,rfId:Lo,children:_(_x,{style:g,type:d,component:y,containerStyle:S})}),_("div",{className:"react-flow__edgelabel-renderer"}),_(ox,{nodeTypes:e,onNodeClick:s,onNodeDoubleClick:a,onNodeMouseEnter:c,onNodeMouseMove:f,onNodeMouseLeave:p,onNodeContextMenu:h,selectNodesOnDrag:R,onlyRenderVisibleElements:$,noPanClassName:qn,noDragClassName:Ao,disableKeyboardA11y:Zn,nodeOrigin:xr,nodeExtent:as,rfId:Lo})]})}));Hv.displayName="GraphView";var wx=N.memo(Hv);const Nf=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Hn={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:Nf,nodeExtent:Nf,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Bn.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:qN,isValidConnection:void 0},Rx=()=>Mg((e,t)=>({...Hn,setNodes:n=>{const{nodeInternals:r,nodeOrigin:o,elevateNodesOnSelect:i}=t();e({nodeInternals:Ef(n,r,o,i)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:r={}}=t();e({edges:n.map(o=>({...r,...o}))})},setDefaultNodesAndEdges:(n,r)=>{const o=typeof n<"u",i=typeof r<"u",s=o?Ef(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:s,edges:i?r:[],hasDefaultNodes:o,hasDefaultEdges:i})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:o,fitViewOnInit:i,fitViewOnInitDone:s,fitViewOnInitOptions:l,domNode:a,nodeOrigin:u}=t(),c=a==null?void 0:a.querySelector(".react-flow__viewport");if(!c)return;const f=window.getComputedStyle(c),{m22:p}=new window.DOMMatrixReadOnly(f.transform),h=n.reduce((m,E)=>{const d=o.get(E.id);if(d){const g=rf(E.nodeElement);!!(g.width&&g.height&&(d.width!==g.width||d.height!==g.height||E.forceUpdate))&&(o.set(d.id,{...d,[Se]:{...d[Se],handleBounds:{source:Nv(".source",E.nodeElement,p,u),target:Nv(".target",E.nodeElement,p,u)}},...g}),m.push({id:d.id,type:"dimensions",dimensions:g}))}return m},[]);Av(o,u);const v=s||i&&!s&&bv(t,{initial:!0,...l});e({nodeInternals:new Map(o),fitViewOnInitDone:v}),(h==null?void 0:h.length)>0&&(r==null||r(h))},updateNodePositions:(n,r=!0,o=!1)=>{const{triggerNodeChanges:i}=t(),s=n.map(l=>{const a={id:l.id,type:"position",dragging:o};return r&&(a.positionAbsolute=l.positionAbsolute,a.position=l.position),a});i(s)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:o,hasDefaultNodes:i,nodeOrigin:s,getNodes:l,elevateNodesOnSelect:a}=t();if(n!=null&&n.length){if(i){const u=Pv(n,l()),c=Ef(u,o,s,a);e({nodeInternals:c})}r==null||r(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:o,getNodes:i}=t();let s,l=null;r?s=n.map(a=>zn(a,!0)):(s=Oo(i(),n),l=Oo(o,[])),Zl({changedNodes:s,changedEdges:l,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:o,getNodes:i}=t();let s,l=null;r?s=n.map(a=>zn(a,!0)):(s=Oo(o,n),l=Oo(i(),[])),Zl({changedNodes:l,changedEdges:s,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:o,getNodes:i}=t(),s=n||i(),l=r||o,a=s.map(c=>(c.selected=!1,zn(c.id,!1))),u=l.map(c=>zn(c.id,!1));Zl({changedNodes:a,changedEdges:u,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:r,maxZoom:o}=t();r==null||r.scaleExtent([n,o]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:r,minZoom:o}=t();r==null||r.scaleExtent([o,n]),e({maxZoom:n})},setTranslateExtent:n=>{var r;(r=t().d3Zoom)==null||r.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:r}=t(),i=r().filter(l=>l.selected).map(l=>zn(l.id,!1)),s=n.filter(l=>l.selected).map(l=>zn(l.id,!1));Zl({changedNodes:i,changedEdges:s,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:r}=t();r.forEach(o=>{o.positionAbsolute=of(o.position,n)}),e({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:o,height:i,d3Zoom:s,d3Selection:l,translateExtent:a}=t();if(!s||!l||!n.x&&!n.y)return;const u=Un.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),c=[[0,0],[o,i]],f=s==null?void 0:s.constrain()(u,c,a);s.transform(l,f)},cancelConnection:()=>e({connectionNodeId:Hn.connectionNodeId,connectionHandleId:Hn.connectionHandleId,connectionHandleType:Hn.connectionHandleType,connectionStatus:Hn.connectionStatus,connectionStartHandle:Hn.connectionStartHandle,connectionEndHandle:Hn.connectionEndHandle}),reset:()=>e({...Hn})})),jv=({children:e})=>{const t=N.useRef(null);return t.current||(t.current=Rx()),_(HN,{value:t.current,children:e})};jv.displayName="ReactFlowProvider";const Wv=({children:e})=>N.useContext(Yl)?_(be,{children:e}):_(jv,{children:e});Wv.displayName="ReactFlowWrapper";function Gv(e,t){return N.useRef(null),N.useMemo(()=>t(e),[e])}const Nx={input:uv,default:hf,output:fv,group:gf},Ox={default:Xl,straight:cf,step:uf,smoothstep:Kl,simplebezier:af},xx=[0,0],Tx=[15,15],Ix={x:0,y:0,zoom:1},Cx={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},Yv=N.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:o,nodeTypes:i=Nx,edgeTypes:s=Ox,onNodeClick:l,onEdgeClick:a,onInit:u,onMove:c,onMoveStart:f,onMoveEnd:p,onConnect:h,onConnectStart:v,onConnectEnd:m,onClickConnectStart:E,onClickConnectEnd:d,onNodeMouseEnter:g,onNodeMouseMove:y,onNodeMouseLeave:S,onNodeContextMenu:w,onNodeDoubleClick:O,onNodeDragStart:T,onNodeDrag:b,onNodeDragStop:P,onNodesDelete:k,onEdgesDelete:B,onSelectionChange:$,onSelectionDragStart:F,onSelectionDrag:R,onSelectionDragStop:D,onSelectionContextMenu:A,onSelectionStart:C,onSelectionEnd:x,connectionMode:L=Bn.Strict,connectionLineType:U=$n.Bezier,connectionLineStyle:z,connectionLineComponent:j,connectionLineContainerStyle:K,deleteKeyCode:Y="Backspace",selectionKeyCode:Z="Shift",selectionOnDrag:X=!1,selectionMode:ee=Fi.Full,panActivationKeyCode:oe="Space",multiSelectionKeyCode:ge="Meta",zoomActivationKeyCode:ue="Meta",snapToGrid:Ne=!1,snapGrid:He=Tx,onlyRenderVisibleElements:ut=!1,selectNodesOnDrag:me=!0,nodesDraggable:fe,nodesConnectable:Je,nodesFocusable:Q,nodeOrigin:Xn=xx,edgesFocusable:Nr,edgesUpdatable:ss,elementsSelectable:ls,defaultViewport:Ao=Ix,minZoom:Or=.5,maxZoom:qn=2,translateExtent:bo=Nf,preventScrolling:Zn=!0,nodeExtent:xr,defaultMarkerColor:as="#b1b1b7",zoomOnScroll:Lo=!0,zoomOnPinch:et=!0,panOnScroll:Mt=!1,panOnScrollSpeed:Tr=.5,panOnScrollMode:Ir=vo.Free,zoomOnDoubleClick:Cr=!0,panOnDrag:ya=!0,onPaneClick:Ar,onPaneMouseEnter:ad,onPaneMouseMove:ud,onPaneMouseLeave:us,onPaneScroll:cd,onPaneContextMenu:H0,children:br,onEdgeUpdate:cb,onEdgeContextMenu:fb,onEdgeDoubleClick:db,onEdgeMouseEnter:pb,onEdgeMouseMove:hb,onEdgeMouseLeave:gb,onEdgeUpdateStart:mb,onEdgeUpdateEnd:vb,edgeUpdaterRadius:yb=10,onNodesChange:Eb,onEdgesChange:Sb,noDragClassName:_b="nodrag",noWheelClassName:wb="nowheel",noPanClassName:j0="nopan",fitView:Rb=!1,fitViewOptions:Nb,connectOnClick:Ob=!0,attributionPosition:xb,proOptions:Tb,defaultEdgeOptions:Ib,elevateNodesOnSelect:Cb=!0,elevateEdgesOnSelect:Ab=!1,disableKeyboardA11y:W0=!1,autoPanOnConnect:bb=!0,autoPanOnNodeDrag:Lb=!0,connectionRadius:Db=20,isValidConnection:kb,onError:Pb,style:Mb,id:G0,...Ub},Fb)=>{const Vb=Gv(i,kO),Bb=Gv(s,CO),fd=G0||"1";return _("div",{...Ub,style:{...Mb,...Cx},ref:Fb,className:Qe(["react-flow",o]),"data-testid":"rf__wrapper",id:G0,children:V(Wv,{children:[_(wx,{onInit:u,onMove:c,onMoveStart:f,onMoveEnd:p,onNodeClick:l,onEdgeClick:a,onNodeMouseEnter:g,onNodeMouseMove:y,onNodeMouseLeave:S,onNodeContextMenu:w,onNodeDoubleClick:O,nodeTypes:Vb,edgeTypes:Bb,connectionLineType:U,connectionLineStyle:z,connectionLineComponent:j,connectionLineContainerStyle:K,selectionKeyCode:Z,selectionOnDrag:X,selectionMode:ee,deleteKeyCode:Y,multiSelectionKeyCode:ge,panActivationKeyCode:oe,zoomActivationKeyCode:ue,onlyRenderVisibleElements:ut,selectNodesOnDrag:me,defaultViewport:Ao,translateExtent:bo,minZoom:Or,maxZoom:qn,preventScrolling:Zn,zoomOnScroll:Lo,zoomOnPinch:et,zoomOnDoubleClick:Cr,panOnScroll:Mt,panOnScrollSpeed:Tr,panOnScrollMode:Ir,panOnDrag:ya,onPaneClick:Ar,onPaneMouseEnter:ad,onPaneMouseMove:ud,onPaneMouseLeave:us,onPaneScroll:cd,onPaneContextMenu:H0,onSelectionContextMenu:A,onSelectionStart:C,onSelectionEnd:x,onEdgeUpdate:cb,onEdgeContextMenu:fb,onEdgeDoubleClick:db,onEdgeMouseEnter:pb,onEdgeMouseMove:hb,onEdgeMouseLeave:gb,onEdgeUpdateStart:mb,onEdgeUpdateEnd:vb,edgeUpdaterRadius:yb,defaultMarkerColor:as,noDragClassName:_b,noWheelClassName:wb,noPanClassName:j0,elevateEdgesOnSelect:Ab,rfId:fd,disableKeyboardA11y:W0,nodeOrigin:Xn,nodeExtent:xr}),_(SO,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:v,onConnectEnd:m,onClickConnectStart:E,onClickConnectEnd:d,nodesDraggable:fe,nodesConnectable:Je,nodesFocusable:Q,edgesFocusable:Nr,edgesUpdatable:ss,elementsSelectable:ls,elevateNodesOnSelect:Cb,minZoom:Or,maxZoom:qn,nodeExtent:xr,onNodesChange:Eb,onEdgesChange:Sb,snapToGrid:Ne,snapGrid:He,connectionMode:L,translateExtent:bo,connectOnClick:Ob,defaultEdgeOptions:Ib,fitView:Rb,fitViewOptions:Nb,onNodesDelete:k,onEdgesDelete:B,onNodeDragStart:T,onNodeDrag:b,onNodeDragStop:P,onSelectionDrag:R,onSelectionDragStart:F,onSelectionDragStop:D,noPanClassName:j0,nodeOrigin:Xn,rfId:fd,autoPanOnConnect:bb,autoPanOnNodeDrag:Lb,onError:Pb,connectionRadius:Db,isValidConnection:kb}),_(yO,{onSelectionChange:$}),br,_(WN,{proOptions:Tb,position:xb}),_(OO,{rfId:fd,disableKeyboardA11y:W0})]})})});Yv.displayName="ReactFlow";function Ax(){const e=Re();return N.useCallback(t=>{const{domNode:n,updateNodeDimensions:r}=e.getState(),o=n==null?void 0:n.querySelector(`.react-flow__node[data-id="${t}"]`);o&&requestAnimationFrame(()=>r([{id:t,nodeElement:o,forceUpdate:!0}]))},[])}const bx=e=>t=>t.nodeInternals.size===0?!1:t.getNodes().filter(n=>e.includeHiddenNodes?!0:!n.hidden).every(n=>{var r;return((r=n[Se])==null?void 0:r.handleBounds)!==void 0}),Lx={includeHiddenNodes:!1};function Dx(e=Lx){return ae(bx(e))}function kx(){return _("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:_("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function Px(){return _("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:_("path",{d:"M0 0h32v4.2H0z"})})}function Mx(){return _("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:_("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function Ux(){return _("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:_("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function Fx(){return _("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:_("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}const ji=({children:e,className:t,...n})=>_("button",{type:"button",className:Qe(["react-flow__controls-button",t]),...n,children:e});ji.displayName="ControlButton";const Vx=e=>e.nodesDraggable&&e.nodesConnectable&&e.elementsSelectable,Kv=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:o,onZoomIn:i,onZoomOut:s,onFitView:l,onInteractiveChange:a,className:u,children:c,position:f="bottom-left"})=>{const p=Re(),[h,v]=N.useState(!1),m=ae(Vx),{zoomIn:E,zoomOut:d,fitView:g}=Sf();if(N.useEffect(()=>{v(!0)},[]),!h)return null;const y=()=>{E(),i==null||i()},S=()=>{d(),s==null||s()},w=()=>{g(o),l==null||l()},O=()=>{p.setState({nodesDraggable:!m,nodesConnectable:!m,elementsSelectable:!m}),a==null||a(!m)};return V(nf,{className:Qe(["react-flow__controls",u]),position:f,style:e,"data-testid":"rf__controls",children:[t&&V(be,{children:[_(ji,{onClick:y,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",children:_(kx,{})}),_(ji,{onClick:S,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",children:_(Px,{})})]}),n&&_(ji,{className:"react-flow__controls-fitview",onClick:w,title:"fit view","aria-label":"fit view",children:_(Mx,{})}),r&&_(ji,{className:"react-flow__controls-interactive",onClick:O,title:"toggle interactivity","aria-label":"toggle interactivity",children:m?_(Fx,{}):_(Ux,{})}),c]})};Kv.displayName="Controls";var Bx=N.memo(Kv);let $x=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((t,n)=>(n&=63,n<36?t+=n.toString(36):n<62?t+=(n-26).toString(36).toUpperCase():n>62?t+="-":t+="_",t),"");const zx=!1,Qv="0.0.0",Xv="0.0.0",qv=640,Zv={type:"floating",markerEnd:{type:Vi.Arrow,width:20,height:20,color:"#c2c8d1"},style:{stroke:"#c2c8d1",strokeWidth:1.5}},Me=()=>$x(),Hx=()=>{const e={},t=document.querySelector('meta[name="csrf-token"]');return t&&(e["X-CSRF-Token"]=t==null?void 0:t.content),e},jx=(e,t)=>{var i;const n=new Blob([JSON.stringify({nodes:e,edges:t},null,2)],{type:"application/json"}),r=window.URL.createObjectURL(n),o=window.open();(i=o==null?void 0:o.location)!=null&&i.href&&(o.location.href=r)},Wx=e=>e.map(t=>typeof t=="string"?t.trim():t).filter(Boolean).join(),Of=e=>e.split(",").map(t=>t.trim()).filter(Boolean),Gx=e=>({...e,...Zv}),Yx=e=>e.type==="handleCall"?{...e,deletable:!1}:e,Jv=e=>e==="success"?"positive":"negative",Kx=e=>e.toLowerCase().replace(/ /g,"-"),xf=()=>[{result:"success",id:Me()},{result:"noAnswer",id:Me()},{result:"busy",id:Me()},{result:"decline",id:Me()},{result:"error",id:Me()}],ey={answer:()=>({}),forwardAddress:()=>({destinations:[],destinationType:"address",options:xf(),sessionTimeout:void 0,type:"single"}),forwardPhone:()=>({destinations:[],destinationType:"phone",options:xf(),sessionTimeout:void 0,type:"single"}),forwardResource:()=>({destinations:[],destinationType:"resource",options:xf(),sessionTimeout:void 0,type:"single"}),hangup:()=>({}),play:()=>({selected:"",text:"",url:""}),promptPlay:()=>({initialTimeout:5,options:[],results:[{id:Me(),result:"no_match"},{id:Me(),result:"no_input"}],selected:"",text:"",url:""}),record:()=>({beep:!1,format:"wav",stereo:!1,terminators:""}),recordCallStart:()=>({beep:!1,controlId:Me(),format:"wav",label:"",stereo:!1,terminators:""}),recordCallStop:()=>({controlId:""}),sendSms:()=>({body:"",fromNumber:"",media:[],region:"",tags:[],toNumber:""}),set:()=>({variables:[]}),unset:()=>({variables:[]}),request:()=>({url:"",method:"POST",headers:{},body:"",options:[{id:Me(),result:"success"},{id:Me(),result:"failed"}]}),cond:()=>({options:[],fallback:Me()})};function Dt(e){return Dt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Dt(e)}function vt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Qx(e,t){if(Dt(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Dt(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ty(e){var t=Qx(e,"string");return Dt(t)==="symbol"?t:String(t)}function ny(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,ty(r.key),r)}}function yt(e,t,n){return t&&ny(e.prototype,t),n&&ny(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function jn(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Tf(e,t){return Tf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},Tf(e,t)}function Jl(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Tf(e,t)}function Wi(e,t){if(t&&(Dt(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return jn(e)}function Wt(e){return Wt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Wt(e)}function pn(e,t,n){return t=ty(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Xx(e){if(Array.isArray(e))return e}function qx(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function ry(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Zx(e,t){if(e){if(typeof e=="string")return ry(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ry(e,t)}}function Jx(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
61
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function eT(e){return Xx(e)||qx(e)||Zx(e)||Jx()}function oy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function iy(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?oy(Object(n),!0).forEach(function(r){pn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oy(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var tT={type:"logger",log:function(t){this.output("log",t)},warn:function(t){this.output("warn",t)},error:function(t){this.output("error",t)},output:function(t,n){console&&console[t]&&console[t].apply(console,n)}},nT=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};vt(this,e),this.init(t,n)}return yt(e,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=r.prefix||"i18next:",this.logger=n||tT,this.options=r,this.debug=r.debug}},{key:"setDebug",value:function(n){this.debug=n}},{key:"log",value:function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return this.forward(r,"log","",!0)}},{key:"warn",value:function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return this.forward(r,"warn","",!0)}},{key:"error",value:function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return this.forward(r,"error","")}},{key:"deprecate",value:function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return this.forward(r,"warn","WARNING DEPRECATED: ",!0)}},{key:"forward",value:function(n,r,o,i){return i&&!this.debug?null:(typeof n[0]=="string"&&(n[0]="".concat(o).concat(this.prefix," ").concat(n[0])),this.logger[r](n))}},{key:"create",value:function(n){return new e(this.logger,iy(iy({},{prefix:"".concat(this.prefix,":").concat(n,":")}),this.options))}},{key:"clone",value:function(n){return n=n||this.options,n.prefix=n.prefix||this.prefix,new e(this.logger,n)}}]),e}(),Gt=new nT,Wn=function(){function e(){vt(this,e),this.observers={}}return yt(e,[{key:"on",value:function(n,r){var o=this;return n.split(" ").forEach(function(i){o.observers[i]=o.observers[i]||[],o.observers[i].push(r)}),this}},{key:"off",value:function(n,r){if(this.observers[n]){if(!r){delete this.observers[n];return}this.observers[n]=this.observers[n].filter(function(o){return o!==r})}}},{key:"emit",value:function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];if(this.observers[n]){var s=[].concat(this.observers[n]);s.forEach(function(a){a.apply(void 0,o)})}if(this.observers["*"]){var l=[].concat(this.observers["*"]);l.forEach(function(a){a.apply(a,[n].concat(o))})}}}]),e}();function Gi(){var e,t,n=new Promise(function(r,o){e=r,t=o});return n.resolve=e,n.reject=t,n}function sy(e){return e==null?"":""+e}function rT(e,t,n){e.forEach(function(r){t[r]&&(n[r]=t[r])})}function If(e,t,n){function r(l){return l&&l.indexOf("###")>-1?l.replace(/###/g,"."):l}function o(){return!e||typeof e=="string"}for(var i=typeof t!="string"?[].concat(t):t.split(".");i.length>1;){if(o())return{};var s=r(i.shift());!e[s]&&n&&(e[s]=new n),Object.prototype.hasOwnProperty.call(e,s)?e=e[s]:e={}}return o()?{}:{obj:e,k:r(i.shift())}}function ly(e,t,n){var r=If(e,t,Object),o=r.obj,i=r.k;o[i]=n}function oT(e,t,n,r){var o=If(e,t,Object),i=o.obj,s=o.k;i[s]=i[s]||[],r&&(i[s]=i[s].concat(n)),r||i[s].push(n)}function ea(e,t){var n=If(e,t),r=n.obj,o=n.k;if(r)return r[o]}function ay(e,t,n){var r=ea(e,n);return r!==void 0?r:ea(t,n)}function uy(e,t,n){for(var r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?typeof e[r]=="string"||e[r]instanceof String||typeof t[r]=="string"||t[r]instanceof String?n&&(e[r]=t[r]):uy(e[r],t[r],n):e[r]=t[r]);return e}function xo(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var iT={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};function sT(e){return typeof e=="string"?e.replace(/[&<>"'\/]/g,function(t){return iT[t]}):e}var ta=typeof window<"u"&&window.navigator&&typeof window.navigator.userAgentData>"u"&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,lT=[" ",",","?","!",";"];function aT(e,t,n){t=t||"",n=n||"";var r=lT.filter(function(l){return t.indexOf(l)<0&&n.indexOf(l)<0});if(r.length===0)return!0;var o=new RegExp("(".concat(r.map(function(l){return l==="?"?"\\?":l}).join("|"),")")),i=!o.test(e);if(!i){var s=e.indexOf(n);s>0&&!o.test(e.substring(0,s))&&(i=!0)}return i}function cy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function na(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?cy(Object(n),!0).forEach(function(r){pn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cy(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function uT(e){var t=cT();return function(){var r=Wt(e),o;if(t){var i=Wt(this).constructor;o=Reflect.construct(r,arguments,i)}else o=r.apply(this,arguments);return Wi(this,o)}}function cT(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function fy(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(e){if(e[t])return e[t];for(var r=t.split(n),o=e,i=0;i<r.length;++i){if(!o||typeof o[r[i]]=="string"&&i+1<r.length)return;if(o[r[i]]===void 0){for(var s=2,l=r.slice(i,i+s).join(n),a=o[l];a===void 0&&r.length>i+s;)s++,l=r.slice(i,i+s).join(n),a=o[l];if(a===void 0)return;if(a===null)return null;if(t.endsWith(l)){if(typeof a=="string")return a;if(l&&typeof a[l]=="string")return a[l]}var u=r.slice(i+s).join(n);return u?fy(a,u,n):void 0}o=o[r[i]]}return o}}var fT=function(e){Jl(n,e);var t=uT(n);function n(r){var o,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};return vt(this,n),o=t.call(this),ta&&Wn.call(jn(o)),o.data=r||{},o.options=i,o.options.keySeparator===void 0&&(o.options.keySeparator="."),o.options.ignoreJSONStructure===void 0&&(o.options.ignoreJSONStructure=!0),o}return yt(n,[{key:"addNamespaces",value:function(o){this.options.ns.indexOf(o)<0&&this.options.ns.push(o)}},{key:"removeNamespaces",value:function(o){var i=this.options.ns.indexOf(o);i>-1&&this.options.ns.splice(i,1)}},{key:"getResource",value:function(o,i,s){var l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},a=l.keySeparator!==void 0?l.keySeparator:this.options.keySeparator,u=l.ignoreJSONStructure!==void 0?l.ignoreJSONStructure:this.options.ignoreJSONStructure,c=[o,i];s&&typeof s!="string"&&(c=c.concat(s)),s&&typeof s=="string"&&(c=c.concat(a?s.split(a):s)),o.indexOf(".")>-1&&(c=o.split("."));var f=ea(this.data,c);return f||!u||typeof s!="string"?f:fy(this.data&&this.data[o]&&this.data[o][i],s,a)}},{key:"addResource",value:function(o,i,s,l){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1},u=this.options.keySeparator;u===void 0&&(u=".");var c=[o,i];s&&(c=c.concat(u?s.split(u):s)),o.indexOf(".")>-1&&(c=o.split("."),l=i,i=c[1]),this.addNamespaces(i),ly(this.data,c,l),a.silent||this.emit("added",o,i,s,l)}},{key:"addResources",value:function(o,i,s){var l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(var a in s)(typeof s[a]=="string"||Object.prototype.toString.apply(s[a])==="[object Array]")&&this.addResource(o,i,a,s[a],{silent:!0});l.silent||this.emit("added",o,i,s)}},{key:"addResourceBundle",value:function(o,i,s,l,a){var u=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},c=[o,i];o.indexOf(".")>-1&&(c=o.split("."),l=s,s=i,i=c[1]),this.addNamespaces(i);var f=ea(this.data,c)||{};l?uy(f,s,a):f=na(na({},f),s),ly(this.data,c,f),u.silent||this.emit("added",o,i,s)}},{key:"removeResourceBundle",value:function(o,i){this.hasResourceBundle(o,i)&&delete this.data[o][i],this.removeNamespaces(i),this.emit("removed",o,i)}},{key:"hasResourceBundle",value:function(o,i){return this.getResource(o,i)!==void 0}},{key:"getResourceBundle",value:function(o,i){return i||(i=this.options.defaultNS),this.options.compatibilityAPI==="v1"?na(na({},{}),this.getResource(o,i)):this.getResource(o,i)}},{key:"getDataByLanguage",value:function(o){return this.data[o]}},{key:"hasLanguageSomeTranslations",value:function(o){var i=this.getDataByLanguage(o),s=i&&Object.keys(i)||[];return!!s.find(function(l){return i[l]&&Object.keys(i[l]).length>0})}},{key:"toJSON",value:function(){return this.data}}]),n}(Wn),dy={processors:{},addPostProcessor:function(t){this.processors[t.name]=t},handle:function(t,n,r,o,i){var s=this;return t.forEach(function(l){s.processors[l]&&(n=s.processors[l].process(n,r,o,i))}),n}};function py(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function $e(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?py(Object(n),!0).forEach(function(r){pn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):py(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function dT(e){var t=pT();return function(){var r=Wt(e),o;if(t){var i=Wt(this).constructor;o=Reflect.construct(r,arguments,i)}else o=r.apply(this,arguments);return Wi(this,o)}}function pT(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var hy={},gy=function(e){Jl(n,e);var t=dT(n);function n(r){var o,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return vt(this,n),o=t.call(this),ta&&Wn.call(jn(o)),rT(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],r,jn(o)),o.options=i,o.options.keySeparator===void 0&&(o.options.keySeparator="."),o.logger=Gt.create("translator"),o}return yt(n,[{key:"changeLanguage",value:function(o){o&&(this.language=o)}},{key:"exists",value:function(o){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(o==null)return!1;var s=this.resolve(o,i);return s&&s.res!==void 0}},{key:"extractFromKey",value:function(o,i){var s=i.nsSeparator!==void 0?i.nsSeparator:this.options.nsSeparator;s===void 0&&(s=":");var l=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,a=i.ns||this.options.defaultNS||[],u=s&&o.indexOf(s)>-1,c=!this.options.userDefinedKeySeparator&&!i.keySeparator&&!this.options.userDefinedNsSeparator&&!i.nsSeparator&&!aT(o,s,l);if(u&&!c){var f=o.match(this.interpolator.nestingRegexp);if(f&&f.length>0)return{key:o,namespaces:a};var p=o.split(s);(s!==l||s===l&&this.options.ns.indexOf(p[0])>-1)&&(a=p.shift()),o=p.join(l)}return typeof a=="string"&&(a=[a]),{key:o,namespaces:a}}},{key:"translate",value:function(o,i,s){var l=this;if(Dt(i)!=="object"&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),i||(i={}),o==null)return"";Array.isArray(o)||(o=[String(o)]);var a=i.returnDetails!==void 0?i.returnDetails:this.options.returnDetails,u=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,c=this.extractFromKey(o[o.length-1],i),f=c.key,p=c.namespaces,h=p[p.length-1],v=i.lng||this.language,m=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(v&&v.toLowerCase()==="cimode"){if(m){var E=i.nsSeparator||this.options.nsSeparator;return a?{res:"".concat(h).concat(E).concat(f),usedKey:f,exactUsedKey:f,usedLng:v,usedNS:h}:"".concat(h).concat(E).concat(f)}return a?{res:f,usedKey:f,exactUsedKey:f,usedLng:v,usedNS:h}:f}var d=this.resolve(o,i),g=d&&d.res,y=d&&d.usedKey||f,S=d&&d.exactUsedKey||f,w=Object.prototype.toString.apply(g),O=["[object Number]","[object Function]","[object RegExp]"],T=i.joinArrays!==void 0?i.joinArrays:this.options.joinArrays,b=!this.i18nFormat||this.i18nFormat.handleAsObject,P=typeof g!="string"&&typeof g!="boolean"&&typeof g!="number";if(b&&g&&P&&O.indexOf(w)<0&&!(typeof T=="string"&&w==="[object Array]")){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var k=this.options.returnedObjectHandler?this.options.returnedObjectHandler(y,g,$e($e({},i),{},{ns:p})):"key '".concat(f," (").concat(this.language,")' returned an object instead of string.");return a?(d.res=k,d):k}if(u){var B=w==="[object Array]",$=B?[]:{},F=B?S:y;for(var R in g)if(Object.prototype.hasOwnProperty.call(g,R)){var D="".concat(F).concat(u).concat(R);$[R]=this.translate(D,$e($e({},i),{joinArrays:!1,ns:p})),$[R]===D&&($[R]=g[R])}g=$}}else if(b&&typeof T=="string"&&w==="[object Array]")g=g.join(T),g&&(g=this.extendTranslation(g,o,i,s));else{var A=!1,C=!1,x=i.count!==void 0&&typeof i.count!="string",L=n.hasDefaultValue(i),U=x?this.pluralResolver.getSuffix(v,i.count,i):"",z=i["defaultValue".concat(U)]||i.defaultValue;!this.isValidLookup(g)&&L&&(A=!0,g=z),this.isValidLookup(g)||(C=!0,g=f);var j=i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,K=j&&C?void 0:g,Y=L&&z!==g&&this.options.updateMissing;if(C||A||Y){if(this.logger.log(Y?"updateKey":"missingKey",v,h,f,Y?z:g),u){var Z=this.resolve(f,$e($e({},i),{},{keySeparator:!1}));Z&&Z.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var X=[],ee=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ee&&ee[0])for(var oe=0;oe<ee.length;oe++)X.push(ee[oe]);else this.options.saveMissingTo==="all"?X=this.languageUtils.toResolveHierarchy(i.lng||this.language):X.push(i.lng||this.language);var ge=function(Ne,He,ut){var me=L&&ut!==g?ut:K;l.options.missingKeyHandler?l.options.missingKeyHandler(Ne,h,He,me,Y,i):l.backendConnector&&l.backendConnector.saveMissing&&l.backendConnector.saveMissing(Ne,h,He,me,Y,i),l.emit("missingKey",Ne,h,He,g)};this.options.saveMissing&&(this.options.saveMissingPlurals&&x?X.forEach(function(ue){l.pluralResolver.getSuffixes(ue,i).forEach(function(Ne){ge([ue],f+Ne,i["defaultValue".concat(Ne)]||z)})}):ge(X,f,z))}g=this.extendTranslation(g,o,i,d,s),C&&g===f&&this.options.appendNamespaceToMissingKey&&(g="".concat(h,":").concat(f)),(C||A)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?g=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?"".concat(h,":").concat(f):f,A?g:void 0):g=this.options.parseMissingKeyHandler(g))}return a?(d.res=g,d):g}},{key:"extendTranslation",value:function(o,i,s,l,a){var u=this;if(this.i18nFormat&&this.i18nFormat.parse)o=this.i18nFormat.parse(o,$e($e({},this.options.interpolation.defaultVariables),s),l.usedLng,l.usedNS,l.usedKey,{resolved:l});else if(!s.skipInterpolation){s.interpolation&&this.interpolator.init($e($e({},s),{interpolation:$e($e({},this.options.interpolation),s.interpolation)}));var c=typeof o=="string"&&(s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables),f;if(c){var p=o.match(this.interpolator.nestingRegexp);f=p&&p.length}var h=s.replace&&typeof s.replace!="string"?s.replace:s;if(this.options.interpolation.defaultVariables&&(h=$e($e({},this.options.interpolation.defaultVariables),h)),o=this.interpolator.interpolate(o,h,s.lng||this.language,s),c){var v=o.match(this.interpolator.nestingRegexp),m=v&&v.length;f<m&&(s.nest=!1)}s.nest!==!1&&(o=this.interpolator.nest(o,function(){for(var g=arguments.length,y=new Array(g),S=0;S<g;S++)y[S]=arguments[S];return a&&a[0]===y[0]&&!s.context?(u.logger.warn("It seems you are nesting recursively key: ".concat(y[0]," in key: ").concat(i[0])),null):u.translate.apply(u,y.concat([i]))},s)),s.interpolation&&this.interpolator.reset()}var E=s.postProcess||this.options.postProcess,d=typeof E=="string"?[E]:E;return o!=null&&d&&d.length&&s.applyPostProcessor!==!1&&(o=dy.handle(d,o,i,this.options&&this.options.postProcessPassResolved?$e({i18nResolved:l},s):s,this)),o}},{key:"resolve",value:function(o){var i=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},l,a,u,c,f;return typeof o=="string"&&(o=[o]),o.forEach(function(p){if(!i.isValidLookup(l)){var h=i.extractFromKey(p,s),v=h.key;a=v;var m=h.namespaces;i.options.fallbackNS&&(m=m.concat(i.options.fallbackNS));var E=s.count!==void 0&&typeof s.count!="string",d=E&&!s.ordinal&&s.count===0&&i.pluralResolver.shouldUseIntlApi(),g=s.context!==void 0&&(typeof s.context=="string"||typeof s.context=="number")&&s.context!=="",y=s.lngs?s.lngs:i.languageUtils.toResolveHierarchy(s.lng||i.language,s.fallbackLng);m.forEach(function(S){i.isValidLookup(l)||(f=S,!hy["".concat(y[0],"-").concat(S)]&&i.utils&&i.utils.hasLoadedNamespace&&!i.utils.hasLoadedNamespace(f)&&(hy["".concat(y[0],"-").concat(S)]=!0,i.logger.warn('key "'.concat(a,'" for languages "').concat(y.join(", "),`" won't get resolved as namespace "`).concat(f,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),y.forEach(function(w){if(!i.isValidLookup(l)){c=w;var O=[v];if(i.i18nFormat&&i.i18nFormat.addLookupKeys)i.i18nFormat.addLookupKeys(O,v,w,S,s);else{var T;E&&(T=i.pluralResolver.getSuffix(w,s.count,s));var b="".concat(i.options.pluralSeparator,"zero");if(E&&(O.push(v+T),d&&O.push(v+b)),g){var P="".concat(v).concat(i.options.contextSeparator).concat(s.context);O.push(P),E&&(O.push(P+T),d&&O.push(P+b))}}for(var k;k=O.pop();)i.isValidLookup(l)||(u=k,l=i.getResource(w,S,k,s))}}))})}}),{res:l,usedKey:a,exactUsedKey:u,usedLng:c,usedNS:f}}},{key:"isValidLookup",value:function(o){return o!==void 0&&!(!this.options.returnNull&&o===null)&&!(!this.options.returnEmptyString&&o==="")}},{key:"getResource",value:function(o,i,s){var l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(o,i,s,l):this.resourceStore.getResource(o,i,s,l)}}],[{key:"hasDefaultValue",value:function(o){var i="defaultValue";for(var s in o)if(Object.prototype.hasOwnProperty.call(o,s)&&i===s.substring(0,i.length)&&o[s]!==void 0)return!0;return!1}}]),n}(Wn);function Cf(e){return e.charAt(0).toUpperCase()+e.slice(1)}var my=function(){function e(t){vt(this,e),this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Gt.create("languageUtils")}return yt(e,[{key:"getScriptPartFromCode",value:function(n){if(!n||n.indexOf("-")<0)return null;var r=n.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}},{key:"getLanguagePartFromCode",value:function(n){if(!n||n.indexOf("-")<0)return n;var r=n.split("-");return this.formatLanguageCode(r[0])}},{key:"formatLanguageCode",value:function(n){if(typeof n=="string"&&n.indexOf("-")>-1){var r=["hans","hant","latn","cyrl","cans","mong","arab"],o=n.split("-");return this.options.lowerCaseLng?o=o.map(function(i){return i.toLowerCase()}):o.length===2?(o[0]=o[0].toLowerCase(),o[1]=o[1].toUpperCase(),r.indexOf(o[1].toLowerCase())>-1&&(o[1]=Cf(o[1].toLowerCase()))):o.length===3&&(o[0]=o[0].toLowerCase(),o[1].length===2&&(o[1]=o[1].toUpperCase()),o[0]!=="sgn"&&o[2].length===2&&(o[2]=o[2].toUpperCase()),r.indexOf(o[1].toLowerCase())>-1&&(o[1]=Cf(o[1].toLowerCase())),r.indexOf(o[2].toLowerCase())>-1&&(o[2]=Cf(o[2].toLowerCase()))),o.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?n.toLowerCase():n}},{key:"isSupportedCode",value:function(n){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(n=this.getLanguagePartFromCode(n)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(n)>-1}},{key:"getBestMatchFromCodes",value:function(n){var r=this;if(!n)return null;var o;return n.forEach(function(i){if(!o){var s=r.formatLanguageCode(i);(!r.options.supportedLngs||r.isSupportedCode(s))&&(o=s)}}),!o&&this.options.supportedLngs&&n.forEach(function(i){if(!o){var s=r.getLanguagePartFromCode(i);if(r.isSupportedCode(s))return o=s;o=r.options.supportedLngs.find(function(l){if(l.indexOf(s)===0)return l})}}),o||(o=this.getFallbackCodes(this.options.fallbackLng)[0]),o}},{key:"getFallbackCodes",value:function(n,r){if(!n)return[];if(typeof n=="function"&&(n=n(r)),typeof n=="string"&&(n=[n]),Object.prototype.toString.apply(n)==="[object Array]")return n;if(!r)return n.default||[];var o=n[r];return o||(o=n[this.getScriptPartFromCode(r)]),o||(o=n[this.formatLanguageCode(r)]),o||(o=n[this.getLanguagePartFromCode(r)]),o||(o=n.default),o||[]}},{key:"toResolveHierarchy",value:function(n,r){var o=this,i=this.getFallbackCodes(r||this.options.fallbackLng||[],n),s=[],l=function(u){u&&(o.isSupportedCode(u)?s.push(u):o.logger.warn("rejecting language code not found in supportedLngs: ".concat(u)))};return typeof n=="string"&&n.indexOf("-")>-1?(this.options.load!=="languageOnly"&&l(this.formatLanguageCode(n)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&l(this.getScriptPartFromCode(n)),this.options.load!=="currentOnly"&&l(this.getLanguagePartFromCode(n))):typeof n=="string"&&l(this.formatLanguageCode(n)),i.forEach(function(a){s.indexOf(a)<0&&l(o.formatLanguageCode(a))}),s}}]),e}(),hT=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],gT={1:function(t){return Number(t>1)},2:function(t){return Number(t!=1)},3:function(t){return 0},4:function(t){return Number(t%10==1&&t%100!=11?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2)},5:function(t){return Number(t==0?0:t==1?1:t==2?2:t%100>=3&&t%100<=10?3:t%100>=11?4:5)},6:function(t){return Number(t==1?0:t>=2&&t<=4?1:2)},7:function(t){return Number(t==1?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2)},8:function(t){return Number(t==1?0:t==2?1:t!=8&&t!=11?2:3)},9:function(t){return Number(t>=2)},10:function(t){return Number(t==1?0:t==2?1:t<7?2:t<11?3:4)},11:function(t){return Number(t==1||t==11?0:t==2||t==12?1:t>2&&t<20?2:3)},12:function(t){return Number(t%10!=1||t%100==11)},13:function(t){return Number(t!==0)},14:function(t){return Number(t==1?0:t==2?1:t==3?2:3)},15:function(t){return Number(t%10==1&&t%100!=11?0:t%10>=2&&(t%100<10||t%100>=20)?1:2)},16:function(t){return Number(t%10==1&&t%100!=11?0:t!==0?1:2)},17:function(t){return Number(t==1||t%10==1&&t%100!=11?0:1)},18:function(t){return Number(t==0?0:t==1?1:2)},19:function(t){return Number(t==1?0:t==0||t%100>1&&t%100<11?1:t%100>10&&t%100<20?2:3)},20:function(t){return Number(t==1?0:t==0||t%100>0&&t%100<20?1:2)},21:function(t){return Number(t%100==1?1:t%100==2?2:t%100==3||t%100==4?3:0)},22:function(t){return Number(t==1?0:t==2?1:(t<0||t>10)&&t%10==0?2:3)}},mT=["v1","v2","v3"],vy={zero:0,one:1,two:2,few:3,many:4,other:5};function vT(){var e={};return hT.forEach(function(t){t.lngs.forEach(function(n){e[n]={numbers:t.nr,plurals:gT[t.fc]}})}),e}var yT=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};vt(this,e),this.languageUtils=t,this.options=n,this.logger=Gt.create("pluralResolver"),(!this.options.compatibilityJSON||this.options.compatibilityJSON==="v4")&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=vT()}return yt(e,[{key:"addRule",value:function(n,r){this.rules[n]=r}},{key:"getRule",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(n,{type:r.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[n]||this.rules[this.languageUtils.getLanguagePartFromCode(n)]}},{key:"needsPlural",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=this.getRule(n,r);return this.shouldUseIntlApi()?o&&o.resolvedOptions().pluralCategories.length>1:o&&o.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(n,r){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(n,o).map(function(i){return"".concat(r).concat(i)})}},{key:"getSuffixes",value:function(n){var r=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=this.getRule(n,o);return i?this.shouldUseIntlApi()?i.resolvedOptions().pluralCategories.sort(function(s,l){return vy[s]-vy[l]}).map(function(s){return"".concat(r.options.prepend).concat(s)}):i.numbers.map(function(s){return r.getSuffix(n,s,o)}):[]}},{key:"getSuffix",value:function(n,r){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=this.getRule(n,o);return i?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(i.select(r)):this.getSuffixRetroCompatible(i,r):(this.logger.warn("no plural rule found for: ".concat(n)),"")}},{key:"getSuffixRetroCompatible",value:function(n,r){var o=this,i=n.noAbs?n.plurals(r):n.plurals(Math.abs(r)),s=n.numbers[i];this.options.simplifyPluralSuffix&&n.numbers.length===2&&n.numbers[0]===1&&(s===2?s="plural":s===1&&(s=""));var l=function(){return o.options.prepend&&s.toString()?o.options.prepend+s.toString():s.toString()};return this.options.compatibilityJSON==="v1"?s===1?"":typeof s=="number"?"_plural_".concat(s.toString()):l():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&n.numbers.length===2&&n.numbers[0]===1?l():this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString()}},{key:"shouldUseIntlApi",value:function(){return!mT.includes(this.options.compatibilityJSON)}}]),e}();function yy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function kt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?yy(Object(n),!0).forEach(function(r){pn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yy(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ET=function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};vt(this,e),this.logger=Gt.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(n){return n},this.init(t)}return yt(e,[{key:"init",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};n.interpolation||(n.interpolation={escapeValue:!0});var r=n.interpolation;this.escape=r.escape!==void 0?r.escape:sT,this.escapeValue=r.escapeValue!==void 0?r.escapeValue:!0,this.useRawValueToEscape=r.useRawValueToEscape!==void 0?r.useRawValueToEscape:!1,this.prefix=r.prefix?xo(r.prefix):r.prefixEscaped||"{{",this.suffix=r.suffix?xo(r.suffix):r.suffixEscaped||"}}",this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||",",this.unescapePrefix=r.unescapeSuffix?"":r.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":r.unescapeSuffix||"",this.nestingPrefix=r.nestingPrefix?xo(r.nestingPrefix):r.nestingPrefixEscaped||xo("$t("),this.nestingSuffix=r.nestingSuffix?xo(r.nestingSuffix):r.nestingSuffixEscaped||xo(")"),this.nestingOptionsSeparator=r.nestingOptionsSeparator?r.nestingOptionsSeparator:r.nestingOptionsSeparator||",",this.maxReplaces=r.maxReplaces?r.maxReplaces:1e3,this.alwaysFormat=r.alwaysFormat!==void 0?r.alwaysFormat:!1,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var n="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(n,"g");var r="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(r,"g");var o="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(o,"g")}},{key:"interpolate",value:function(n,r,o,i){var s=this,l,a,u,c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function f(E){return E.replace(/\$/g,"$$$$")}var p=function(d){if(d.indexOf(s.formatSeparator)<0){var g=ay(r,c,d);return s.alwaysFormat?s.format(g,void 0,o,kt(kt(kt({},i),r),{},{interpolationkey:d})):g}var y=d.split(s.formatSeparator),S=y.shift().trim(),w=y.join(s.formatSeparator).trim();return s.format(ay(r,c,S),w,o,kt(kt(kt({},i),r),{},{interpolationkey:S}))};this.resetRegExp();var h=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,v=i&&i.interpolation&&i.interpolation.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables,m=[{regex:this.regexpUnescape,safeValue:function(d){return f(d)}},{regex:this.regexp,safeValue:function(d){return s.escapeValue?f(s.escape(d)):f(d)}}];return m.forEach(function(E){for(u=0;l=E.regex.exec(n);){var d=l[1].trim();if(a=p(d),a===void 0)if(typeof h=="function"){var g=h(n,l,i);a=typeof g=="string"?g:""}else if(i&&Object.prototype.hasOwnProperty.call(i,d))a="";else if(v){a=l[0];continue}else s.logger.warn("missed to pass in variable ".concat(d," for interpolating ").concat(n)),a="";else typeof a!="string"&&!s.useRawValueToEscape&&(a=sy(a));var y=E.safeValue(a);if(n=n.replace(l[0],y),v?(E.regex.lastIndex+=a.length,E.regex.lastIndex-=l[0].length):E.regex.lastIndex=0,u++,u>=s.maxReplaces)break}}),n}},{key:"nest",value:function(n,r){var o=this,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s,l,a;function u(h,v){var m=this.nestingOptionsSeparator;if(h.indexOf(m)<0)return h;var E=h.split(new RegExp("".concat(m,"[ ]*{"))),d="{".concat(E[1]);h=E[0],d=this.interpolate(d,a);var g=d.match(/'/g),y=d.match(/"/g);(g&&g.length%2===0&&!y||y.length%2!==0)&&(d=d.replace(/'/g,'"'));try{a=JSON.parse(d),v&&(a=kt(kt({},v),a))}catch(S){return this.logger.warn("failed parsing options string in nesting for key ".concat(h),S),"".concat(h).concat(m).concat(d)}return delete a.defaultValue,h}for(;s=this.nestingRegexp.exec(n);){var c=[];a=kt({},i),a=a.replace&&typeof a.replace!="string"?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;var f=!1;if(s[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(s[1])){var p=s[1].split(this.formatSeparator).map(function(h){return h.trim()});s[1]=p.shift(),c=p,f=!0}if(l=r(u.call(this,s[1].trim(),a),a),l&&s[0]===n&&typeof l!="string")return l;typeof l!="string"&&(l=sy(l)),l||(this.logger.warn("missed to resolve ".concat(s[1]," for nesting ").concat(n)),l=""),f&&(l=c.reduce(function(h,v){return o.format(h,v,i.lng,kt(kt({},i),{},{interpolationkey:s[1].trim()}))},l.trim())),n=n.replace(s[0],l),this.regexp.lastIndex=0}return n}}]),e}();function Ey(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function hn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ey(Object(n),!0).forEach(function(r){pn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ey(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ST(e){var t=e.toLowerCase().trim(),n={};if(e.indexOf("(")>-1){var r=e.split("(");t=r[0].toLowerCase().trim();var o=r[1].substring(0,r[1].length-1);if(t==="currency"&&o.indexOf(":")<0)n.currency||(n.currency=o.trim());else if(t==="relativetime"&&o.indexOf(":")<0)n.range||(n.range=o.trim());else{var i=o.split(";");i.forEach(function(s){if(s){var l=s.split(":"),a=eT(l),u=a[0],c=a.slice(1),f=c.join(":").trim().replace(/^'+|'+$/g,"");n[u.trim()]||(n[u.trim()]=f),f==="false"&&(n[u.trim()]=!1),f==="true"&&(n[u.trim()]=!0),isNaN(f)||(n[u.trim()]=parseInt(f,10))}})}}return{formatName:t,formatOptions:n}}function To(e){var t={};return function(r,o,i){var s=o+JSON.stringify(i),l=t[s];return l||(l=e(o,i),t[s]=l),l(r)}}var _T=function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};vt(this,e),this.logger=Gt.create("formatter"),this.options=t,this.formats={number:To(function(n,r){var o=new Intl.NumberFormat(n,hn({},r));return function(i){return o.format(i)}}),currency:To(function(n,r){var o=new Intl.NumberFormat(n,hn(hn({},r),{},{style:"currency"}));return function(i){return o.format(i)}}),datetime:To(function(n,r){var o=new Intl.DateTimeFormat(n,hn({},r));return function(i){return o.format(i)}}),relativetime:To(function(n,r){var o=new Intl.RelativeTimeFormat(n,hn({},r));return function(i){return o.format(i,r.range||"day")}}),list:To(function(n,r){var o=new Intl.ListFormat(n,hn({},r));return function(i){return o.format(i)}})},this.init(t)}return yt(e,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}},o=r.interpolation;this.formatSeparator=o.formatSeparator?o.formatSeparator:o.formatSeparator||","}},{key:"add",value:function(n,r){this.formats[n.toLowerCase().trim()]=r}},{key:"addCached",value:function(n,r){this.formats[n.toLowerCase().trim()]=To(r)}},{key:"format",value:function(n,r,o){var i=this,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},l=r.split(this.formatSeparator),a=l.reduce(function(u,c){var f=ST(c),p=f.formatName,h=f.formatOptions;if(i.formats[p]){var v=u;try{var m=s&&s.formatParams&&s.formatParams[s.interpolationkey]||{},E=m.locale||m.lng||s.locale||s.lng||o;v=i.formats[p](u,E,hn(hn(hn({},h),s),m))}catch(d){i.logger.warn(d)}return v}else i.logger.warn("there was no format function for ".concat(p));return u},n);return a}}]),e}();function Sy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function _y(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Sy(Object(n),!0).forEach(function(r){pn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Sy(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function wT(e){var t=RT();return function(){var r=Wt(e),o;if(t){var i=Wt(this).constructor;o=Reflect.construct(r,arguments,i)}else o=r.apply(this,arguments);return Wi(this,o)}}function RT(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function NT(e,t){e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)}var OT=function(e){Jl(n,e);var t=wT(n);function n(r,o,i){var s,l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return vt(this,n),s=t.call(this),ta&&Wn.call(jn(s)),s.backend=r,s.store=o,s.services=i,s.languageUtils=i.languageUtils,s.options=l,s.logger=Gt.create("backendConnector"),s.waitingReads=[],s.maxParallelReads=l.maxParallelReads||10,s.readingCalls=0,s.maxRetries=l.maxRetries>=0?l.maxRetries:5,s.retryTimeout=l.retryTimeout>=1?l.retryTimeout:350,s.state={},s.queue=[],s.backend&&s.backend.init&&s.backend.init(i,l.backend,l),s}return yt(n,[{key:"queueLoad",value:function(o,i,s,l){var a=this,u={},c={},f={},p={};return o.forEach(function(h){var v=!0;i.forEach(function(m){var E="".concat(h,"|").concat(m);!s.reload&&a.store.hasResourceBundle(h,m)?a.state[E]=2:a.state[E]<0||(a.state[E]===1?c[E]===void 0&&(c[E]=!0):(a.state[E]=1,v=!1,c[E]===void 0&&(c[E]=!0),u[E]===void 0&&(u[E]=!0),p[m]===void 0&&(p[m]=!0)))}),v||(f[h]=!0)}),(Object.keys(u).length||Object.keys(c).length)&&this.queue.push({pending:c,pendingCount:Object.keys(c).length,loaded:{},errors:[],callback:l}),{toLoad:Object.keys(u),pending:Object.keys(c),toLoadLanguages:Object.keys(f),toLoadNamespaces:Object.keys(p)}}},{key:"loaded",value:function(o,i,s){var l=o.split("|"),a=l[0],u=l[1];i&&this.emit("failedLoading",a,u,i),s&&this.store.addResourceBundle(a,u,s),this.state[o]=i?-1:2;var c={};this.queue.forEach(function(f){oT(f.loaded,[a],u),NT(f,o),i&&f.errors.push(i),f.pendingCount===0&&!f.done&&(Object.keys(f.loaded).forEach(function(p){c[p]||(c[p]={});var h=f.loaded[p];h.length&&h.forEach(function(v){c[p][v]===void 0&&(c[p][v]=!0)})}),f.done=!0,f.errors.length?f.callback(f.errors):f.callback())}),this.emit("loaded",c),this.queue=this.queue.filter(function(f){return!f.done})}},{key:"read",value:function(o,i,s){var l=this,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,u=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,c=arguments.length>5?arguments[5]:void 0;if(!o.length)return c(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:o,ns:i,fcName:s,tried:a,wait:u,callback:c});return}this.readingCalls++;var f=function(m,E){if(l.readingCalls--,l.waitingReads.length>0){var d=l.waitingReads.shift();l.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(m&&E&&a<l.maxRetries){setTimeout(function(){l.read.call(l,o,i,s,a+1,u*2,c)},u);return}c(m,E)},p=this.backend[s].bind(this.backend);if(p.length===2){try{var h=p(o,i);h&&typeof h.then=="function"?h.then(function(v){return f(null,v)}).catch(f):f(null,h)}catch(v){f(v)}return}return p(o,i,f)}},{key:"prepareLoading",value:function(o,i){var s=this,l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),a&&a();typeof o=="string"&&(o=this.languageUtils.toResolveHierarchy(o)),typeof i=="string"&&(i=[i]);var u=this.queueLoad(o,i,l,a);if(!u.toLoad.length)return u.pending.length||a(),null;u.toLoad.forEach(function(c){s.loadOne(c)})}},{key:"load",value:function(o,i,s){this.prepareLoading(o,i,{},s)}},{key:"reload",value:function(o,i,s){this.prepareLoading(o,i,{reload:!0},s)}},{key:"loadOne",value:function(o){var i=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",l=o.split("|"),a=l[0],u=l[1];this.read(a,u,"read",void 0,void 0,function(c,f){c&&i.logger.warn("".concat(s,"loading namespace ").concat(u," for language ").concat(a," failed"),c),!c&&f&&i.logger.log("".concat(s,"loaded namespace ").concat(u," for language ").concat(a),f),i.loaded(o,c,f)})}},{key:"saveMissing",value:function(o,i,s,l,a){var u=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},c=arguments.length>6&&arguments[6]!==void 0?arguments[6]:function(){};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(i)){this.logger.warn('did not save key "'.concat(s,'" as the namespace "').concat(i,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(s==null||s==="")){if(this.backend&&this.backend.create){var f=_y(_y({},u),{},{isUpdate:a}),p=this.backend.create.bind(this.backend);if(p.length<6)try{var h;p.length===5?h=p(o,i,s,l,f):h=p(o,i,s,l),h&&typeof h.then=="function"?h.then(function(v){return c(null,v)}).catch(c):c(null,h)}catch(v){c(v)}else p(o,i,s,l,c,f)}!o||!o[0]||this.store.addResource(o[0],i,s,l)}}}]),n}(Wn);function wy(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(t){var n={};if(Dt(t[1])==="object"&&(n=t[1]),typeof t[1]=="string"&&(n.defaultValue=t[1]),typeof t[2]=="string"&&(n.tDescription=t[2]),Dt(t[2])==="object"||Dt(t[3])==="object"){var r=t[3]||t[2];Object.keys(r).forEach(function(o){n[o]=r[o]})}return n},interpolation:{escapeValue:!0,format:function(t,n,r,o){return t},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function Ry(e){return typeof e.ns=="string"&&(e.ns=[e.ns]),typeof e.fallbackLng=="string"&&(e.fallbackLng=[e.fallbackLng]),typeof e.fallbackNS=="string"&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function Ny(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Yt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ny(Object(n),!0).forEach(function(r){pn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ny(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function xT(e){var t=TT();return function(){var r=Wt(e),o;if(t){var i=Wt(this).constructor;o=Reflect.construct(r,arguments,i)}else o=r.apply(this,arguments);return Wi(this,o)}}function TT(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ra(){}function IT(e){var t=Object.getOwnPropertyNames(Object.getPrototypeOf(e));t.forEach(function(n){typeof e[n]=="function"&&(e[n]=e[n].bind(e))})}var oa=function(e){Jl(n,e);var t=xT(n);function n(){var r,o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;if(vt(this,n),r=t.call(this),ta&&Wn.call(jn(r)),r.options=Ry(o),r.services={},r.logger=Gt,r.modules={external:[]},IT(jn(r)),i&&!r.isInitialized&&!o.isClone){if(!r.options.initImmediate)return r.init(o,i),Wi(r,jn(r));setTimeout(function(){r.init(o,i)},0)}return r}return yt(n,[{key:"init",value:function(){var o=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;typeof i=="function"&&(s=i,i={}),!i.defaultNS&&i.defaultNS!==!1&&i.ns&&(typeof i.ns=="string"?i.defaultNS=i.ns:i.ns.indexOf("translation")<0&&(i.defaultNS=i.ns[0]));var l=wy();this.options=Yt(Yt(Yt({},l),this.options),Ry(i)),this.options.compatibilityAPI!=="v1"&&(this.options.interpolation=Yt(Yt({},l.interpolation),this.options.interpolation)),i.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=i.keySeparator),i.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=i.nsSeparator);function a(d){return d?typeof d=="function"?new d:d:null}if(!this.options.isClone){this.modules.logger?Gt.init(a(this.modules.logger),this.options):Gt.init(null,this.options);var u;this.modules.formatter?u=this.modules.formatter:typeof Intl<"u"&&(u=_T);var c=new my(this.options);this.store=new fT(this.options.resources,this.options);var f=this.services;f.logger=Gt,f.resourceStore=this.store,f.languageUtils=c,f.pluralResolver=new yT(c,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),u&&(!this.options.interpolation.format||this.options.interpolation.format===l.interpolation.format)&&(f.formatter=a(u),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new ET(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new OT(a(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(d){for(var g=arguments.length,y=new Array(g>1?g-1:0),S=1;S<g;S++)y[S-1]=arguments[S];o.emit.apply(o,[d].concat(y))}),this.modules.languageDetector&&(f.languageDetector=a(this.modules.languageDetector),f.languageDetector.init&&f.languageDetector.init(f,this.options.detection,this.options)),this.modules.i18nFormat&&(f.i18nFormat=a(this.modules.i18nFormat),f.i18nFormat.init&&f.i18nFormat.init(this)),this.translator=new gy(this.services,this.options),this.translator.on("*",function(d){for(var g=arguments.length,y=new Array(g>1?g-1:0),S=1;S<g;S++)y[S-1]=arguments[S];o.emit.apply(o,[d].concat(y))}),this.modules.external.forEach(function(d){d.init&&d.init(o)})}if(this.format=this.options.interpolation.format,s||(s=ra),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){var p=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);p.length>0&&p[0]!=="dev"&&(this.options.lng=p[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined");var h=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];h.forEach(function(d){o[d]=function(){var g;return(g=o.store)[d].apply(g,arguments)}});var v=["addResource","addResources","addResourceBundle","removeResourceBundle"];v.forEach(function(d){o[d]=function(){var g;return(g=o.store)[d].apply(g,arguments),o}});var m=Gi(),E=function(){var g=function(S,w){o.isInitialized&&!o.initializedStoreOnce&&o.logger.warn("init: i18next is already initialized. You should call init just once!"),o.isInitialized=!0,o.options.isClone||o.logger.log("initialized",o.options),o.emit("initialized",o.options),m.resolve(w),s(S,w)};if(o.languages&&o.options.compatibilityAPI!=="v1"&&!o.isInitialized)return g(null,o.t.bind(o));o.changeLanguage(o.options.lng,g)};return this.options.resources||!this.options.initImmediate?E():setTimeout(E,0),m}},{key:"loadResources",value:function(o){var i=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ra,l=s,a=typeof o=="string"?o:this.language;if(typeof o=="function"&&(l=o),!this.options.resources||this.options.partialBundledLanguages){if(a&&a.toLowerCase()==="cimode")return l();var u=[],c=function(h){if(h){var v=i.services.languageUtils.toResolveHierarchy(h);v.forEach(function(m){u.indexOf(m)<0&&u.push(m)})}};if(a)c(a);else{var f=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);f.forEach(function(p){return c(p)})}this.options.preload&&this.options.preload.forEach(function(p){return c(p)}),this.services.backendConnector.load(u,this.options.ns,function(p){!p&&!i.resolvedLanguage&&i.language&&i.setResolvedLanguage(i.language),l(p)})}else l(null)}},{key:"reloadResources",value:function(o,i,s){var l=Gi();return o||(o=this.languages),i||(i=this.options.ns),s||(s=ra),this.services.backendConnector.reload(o,i,function(a){l.resolve(),s(a)}),l}},{key:"use",value:function(o){if(!o)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!o.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return o.type==="backend"&&(this.modules.backend=o),(o.type==="logger"||o.log&&o.warn&&o.error)&&(this.modules.logger=o),o.type==="languageDetector"&&(this.modules.languageDetector=o),o.type==="i18nFormat"&&(this.modules.i18nFormat=o),o.type==="postProcessor"&&dy.addPostProcessor(o),o.type==="formatter"&&(this.modules.formatter=o),o.type==="3rdParty"&&this.modules.external.push(o),this}},{key:"setResolvedLanguage",value:function(o){if(!(!o||!this.languages)&&!(["cimode","dev"].indexOf(o)>-1))for(var i=0;i<this.languages.length;i++){var s=this.languages[i];if(!(["cimode","dev"].indexOf(s)>-1)&&this.store.hasLanguageSomeTranslations(s)){this.resolvedLanguage=s;break}}}},{key:"changeLanguage",value:function(o,i){var s=this;this.isLanguageChangingTo=o;var l=Gi();this.emit("languageChanging",o);var a=function(p){s.language=p,s.languages=s.services.languageUtils.toResolveHierarchy(p),s.resolvedLanguage=void 0,s.setResolvedLanguage(p)},u=function(p,h){h?(a(h),s.translator.changeLanguage(h),s.isLanguageChangingTo=void 0,s.emit("languageChanged",h),s.logger.log("languageChanged",h)):s.isLanguageChangingTo=void 0,l.resolve(function(){return s.t.apply(s,arguments)}),i&&i(p,function(){return s.t.apply(s,arguments)})},c=function(p){!o&&!p&&s.services.languageDetector&&(p=[]);var h=typeof p=="string"?p:s.services.languageUtils.getBestMatchFromCodes(p);h&&(s.language||a(h),s.translator.language||s.translator.changeLanguage(h),s.services.languageDetector&&s.services.languageDetector.cacheUserLanguage&&s.services.languageDetector.cacheUserLanguage(h)),s.loadResources(h,function(v){u(v,h)})};return!o&&this.services.languageDetector&&!this.services.languageDetector.async?c(this.services.languageDetector.detect()):!o&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(c):this.services.languageDetector.detect(c):c(o),l}},{key:"getFixedT",value:function(o,i,s){var l=this,a=function u(c,f){var p;if(Dt(f)!=="object"){for(var h=arguments.length,v=new Array(h>2?h-2:0),m=2;m<h;m++)v[m-2]=arguments[m];p=l.options.overloadTranslationOptionHandler([c,f].concat(v))}else p=Yt({},f);p.lng=p.lng||u.lng,p.lngs=p.lngs||u.lngs,p.ns=p.ns||u.ns,p.keyPrefix=p.keyPrefix||s||u.keyPrefix;var E=l.options.keySeparator||".",d;return p.keyPrefix&&Array.isArray(c)?d=c.map(function(g){return"".concat(p.keyPrefix).concat(E).concat(g)}):d=p.keyPrefix?"".concat(p.keyPrefix).concat(E).concat(c):c,l.t(d,p)};return typeof o=="string"?a.lng=o:a.lngs=o,a.ns=i,a.keyPrefix=s,a}},{key:"t",value:function(){var o;return this.translator&&(o=this.translator).translate.apply(o,arguments)}},{key:"exists",value:function(){var o;return this.translator&&(o=this.translator).exists.apply(o,arguments)}},{key:"setDefaultNamespace",value:function(o){this.options.defaultNS=o}},{key:"hasLoadedNamespace",value:function(o){var i=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var l=this.resolvedLanguage||this.languages[0],a=this.options?this.options.fallbackLng:!1,u=this.languages[this.languages.length-1];if(l.toLowerCase()==="cimode")return!0;var c=function(h,v){var m=i.services.backendConnector.state["".concat(h,"|").concat(v)];return m===-1||m===2};if(s.precheck){var f=s.precheck(this,c);if(f!==void 0)return f}return!!(this.hasResourceBundle(l,o)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||c(l,o)&&(!a||c(u,o)))}},{key:"loadNamespaces",value:function(o,i){var s=this,l=Gi();return this.options.ns?(typeof o=="string"&&(o=[o]),o.forEach(function(a){s.options.ns.indexOf(a)<0&&s.options.ns.push(a)}),this.loadResources(function(a){l.resolve(),i&&i(a)}),l):(i&&i(),Promise.resolve())}},{key:"loadLanguages",value:function(o,i){var s=Gi();typeof o=="string"&&(o=[o]);var l=this.options.preload||[],a=o.filter(function(u){return l.indexOf(u)<0});return a.length?(this.options.preload=l.concat(a),this.loadResources(function(u){s.resolve(),i&&i(u)}),s):(i&&i(),Promise.resolve())}},{key:"dir",value:function(o){if(o||(o=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!o)return"rtl";var i=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],s=this.services&&this.services.languageUtils||new my(wy());return i.indexOf(s.getLanguagePartFromCode(o))>-1||o.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var o=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ra,l=Yt(Yt(Yt({},this.options),i),{isClone:!0}),a=new n(l);(i.debug!==void 0||i.prefix!==void 0)&&(a.logger=a.logger.clone(i));var u=["store","services","language"];return u.forEach(function(c){a[c]=o[c]}),a.services=Yt({},this.services),a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a.translator=new gy(a.services,a.options),a.translator.on("*",function(c){for(var f=arguments.length,p=new Array(f>1?f-1:0),h=1;h<f;h++)p[h-1]=arguments[h];a.emit.apply(a,[c].concat(p))}),a.init(l,s),a.translator.options=a.options,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}},{key:"toJSON",value:function(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}]),n}(Wn);pn(oa,"createInstance",function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return new oa(e,t)});var Te=oa.createInstance();Te.createInstance=oa.createInstance,Te.createInstance,Te.dir,Te.init,Te.loadResources,Te.reloadResources,Te.use,Te.changeLanguage,Te.getFixedT,Te.t,Te.exists,Te.setDefaultNamespace,Te.hasLoadedNamespace,Te.loadNamespaces,Te.loadLanguages;var Oy=[],CT=Oy.forEach,AT=Oy.slice;function bT(e){return CT.call(AT.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e}var xy=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,LT=function(t,n,r){var o=r||{};o.path=o.path||"/";var i=encodeURIComponent(n),s="".concat(t,"=").concat(i);if(o.maxAge>0){var l=o.maxAge-0;if(Number.isNaN(l))throw new Error("maxAge should be a Number");s+="; Max-Age=".concat(Math.floor(l))}if(o.domain){if(!xy.test(o.domain))throw new TypeError("option domain is invalid");s+="; Domain=".concat(o.domain)}if(o.path){if(!xy.test(o.path))throw new TypeError("option path is invalid");s+="; Path=".concat(o.path)}if(o.expires){if(typeof o.expires.toUTCString!="function")throw new TypeError("option expires is invalid");s+="; Expires=".concat(o.expires.toUTCString())}if(o.httpOnly&&(s+="; HttpOnly"),o.secure&&(s+="; Secure"),o.sameSite){var a=typeof o.sameSite=="string"?o.sameSite.toLowerCase():o.sameSite;switch(a){case!0:s+="; SameSite=Strict";break;case"lax":s+="; SameSite=Lax";break;case"strict":s+="; SameSite=Strict";break;case"none":s+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return s},Ty={create:function(t,n,r,o){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(i.expires=new Date,i.expires.setTime(i.expires.getTime()+r*60*1e3)),o&&(i.domain=o),document.cookie=LT(t,encodeURIComponent(n),i)},read:function(t){for(var n="".concat(t,"="),r=document.cookie.split(";"),o=0;o<r.length;o++){for(var i=r[o];i.charAt(0)===" ";)i=i.substring(1,i.length);if(i.indexOf(n)===0)return i.substring(n.length,i.length)}return null},remove:function(t){this.create(t,"",-1)}},DT={name:"cookie",lookup:function(t){var n;if(t.lookupCookie&&typeof document<"u"){var r=Ty.read(t.lookupCookie);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupCookie&&typeof document<"u"&&Ty.create(n.lookupCookie,t,n.cookieMinutes,n.cookieDomain,n.cookieOptions)}},kT={name:"querystring",lookup:function(t){var n;if(typeof window<"u"){var r=window.location.search;!window.location.search&&window.location.hash&&window.location.hash.indexOf("?")>-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));for(var o=r.substring(1),i=o.split("&"),s=0;s<i.length;s++){var l=i[s].indexOf("=");if(l>0){var a=i[s].substring(0,l);a===t.lookupQuerystring&&(n=i[s].substring(l+1))}}}return n}},Yi=null,Iy=function(){if(Yi!==null)return Yi;try{Yi=window!=="undefined"&&window.localStorage!==null;var t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{Yi=!1}return Yi},PT={name:"localStorage",lookup:function(t){var n;if(t.lookupLocalStorage&&Iy()){var r=window.localStorage.getItem(t.lookupLocalStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupLocalStorage&&Iy()&&window.localStorage.setItem(n.lookupLocalStorage,t)}},Ki=null,Cy=function(){if(Ki!==null)return Ki;try{Ki=window!=="undefined"&&window.sessionStorage!==null;var t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{Ki=!1}return Ki},MT={name:"sessionStorage",lookup:function(t){var n;if(t.lookupSessionStorage&&Cy()){var r=window.sessionStorage.getItem(t.lookupSessionStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupSessionStorage&&Cy()&&window.sessionStorage.setItem(n.lookupSessionStorage,t)}},UT={name:"navigator",lookup:function(t){var n=[];if(typeof navigator<"u"){if(navigator.languages)for(var r=0;r<navigator.languages.length;r++)n.push(navigator.languages[r]);navigator.userLanguage&&n.push(navigator.userLanguage),navigator.language&&n.push(navigator.language)}return n.length>0?n:void 0}},FT={name:"htmlTag",lookup:function(t){var n,r=t.htmlTag||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(n=r.getAttribute("lang")),n}},VT={name:"path",lookup:function(t){var n;if(typeof window<"u"){var r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(r instanceof Array)if(typeof t.lookupFromPathIndex=="number"){if(typeof r[t.lookupFromPathIndex]!="string")return;n=r[t.lookupFromPathIndex].replace("/","")}else n=r[0].replace("/","")}return n}},BT={name:"subdomain",lookup:function(t){var n=typeof t.lookupFromSubdomainIndex=="number"?t.lookupFromSubdomainIndex+1:1,r=typeof window<"u"&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(r)return r[n]}};function $T(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"]}}var Ay=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};vt(this,e),this.type="languageDetector",this.detectors={},this.init(t,n)}return yt(e,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n,this.options=bT(r,this.options||{},$T()),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=o,this.addDetector(DT),this.addDetector(kT),this.addDetector(PT),this.addDetector(MT),this.addDetector(UT),this.addDetector(FT),this.addDetector(VT),this.addDetector(BT)}},{key:"addDetector",value:function(n){this.detectors[n.name]=n}},{key:"detect",value:function(n){var r=this;n||(n=this.options.order);var o=[];return n.forEach(function(i){if(r.detectors[i]){var s=r.detectors[i].lookup(r.options);s&&typeof s=="string"&&(s=[s]),s&&(o=o.concat(s))}}),this.services.languageUtils.getBestMatchFromCodes?o:o.length>0?o[0]:null}},{key:"cacheUserLanguage",value:function(n,r){var o=this;r||(r=this.options.caches),r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(n)>-1||r.forEach(function(i){o.detectors[i]&&o.detectors[i].cacheUserLanguage(n,o.options)}))}}]),e}();Ay.type="languageDetector";var zT=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,HT={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},jT=function(t){return HT[t]},WT=function(t){return t.replace(zT,jT)};function by(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Ly(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?by(Object(n),!0).forEach(function(r){pn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):by(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Dy={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:WT};function GT(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Dy=Ly(Ly({},Dy),e)}var YT={type:"3rdParty",init:function(t){GT(t.options.react)}};N.createContext(),function(){function e(){vt(this,e),this.usedNamespaces={}}return yt(e,[{key:"addUsedNamespaces",value:function(n){var r=this;n.forEach(function(o){r.usedNamespaces[o]||(r.usedNamespaces[o]=!0)})}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}]),e}();const KT={ABOUT:"About",ACTION:"Action",ADD_CONDITION:"Add Condition",ADD_OPTION:"Add Option",ADD_VARIABLE:"Add Variable",ANSWER_CALL:"Answer Call",ANSWERED:"Answered",API_VERSION:"API Version",APP_VERSION:"App Version",BEEP_SUBTITLE:"Play a beep before recording",BEEP:"Beep",BUILDER_VERSION:"Builder Version",BUSY:"Busy",CALL_ADDRESSES:"Call Addresses",CALL_NUMBERS:"Call Numbers",CALL_RESOURCES:"Call Resources",CALLER_PRESSES:"Caller Presses",CHOOSE_OPTION_SINGLE_MULTIPLE:"Choose single or multiple",CHOOSE_OPTION_TTS_AUDIO:"Choose how to play the message",CLOSE:"Close",COND_NUMBER:"Cond {{index}}",CONDITION_NUMBER:"Condition {{index}}",CONDITIONS:"Conditions",DECISION:"Decision",DECLINE:"Decline",DISCONNECT_CALL_AFTER_RINGING:"Disconnect call after ringing",ELSE:"Else",ENTER_URL:"Enter URL",ERROR_ADD_RECORDING_FIRST:"Please add a Start Call Recording node first.",ERROR_DUPLICATE_RECORDING_LABEL:"This entry already exists. Please use a unique label.",ERROR_DUPLICATE_VARIABLE_KEY:"This variable already exists. Please use a unique key.",ERROR_INVALID_JSON:"Invalid JSON",ERROR_NUMBER_IS_REQUIRED:"A number is required.",ERROR_NUMBER_MIN_MAX_IS_REQUIRED:"A number between {{min}} and {{max}} is required.",ERROR_RECORDING_LABEL_REQUIRED:"A value is required. Maximum 20 characters.",ERROR_STRING_VALUE_REQUIRED:"Invalid character. String value is required.",ERROR_TELEPHONE_KEY_REQUIRED:"A value of 0-9, *, or # is required.",ERROR_TERMINATORS:"This value should contain only 0-9, *, or #.",ERROR_TEXT_IS_REQUIRED:"A text value is required.",ERROR_URL_IS_REQUIRED:"A valid URL is required.",ERROR_VALUE_IS_REQUIRED:"A value is required.",ERROR_VARIABLE_KEY_REQUIRED:"Valid characters are lowercase letters, digits, or underscore. Maximum 20 characters.",ERROR:"Error",FAILED:"Failed",FAILURE:"Failure",FORMAT:"Format",FORWARD_TO_ADDRESS:"Forward to Address",FORWARD_TO_PHONE:"Forward to Phone",FORWARD_TO_RESOURCE:"Forward to Resource",FORWARD:"Forward",FROM_PHONE_NUMBER:"From Phone Number",FROM:"From",GATHER_INPUT:"Gather Input",HANDLE_CALL:"Handle Call",HANG_UP_CALL:"Hang Up Call",HANG_UP:"Hang Up",INFO_NODE_ANSWER:"This is the info text for the Answer node.",INFO_NODE_COND:"This is the info text for the Conditions node.",INFO_NODE_FORWARD_TO_ADDRESS:"This is the info text for the Forward to Address node.",INFO_NODE_FORWARD_TO_PHONE:"This is the info text for the Forward to Phone node.",INFO_NODE_FORWARD_TO_RESOURCE:"This is the info text for the Forward to Resource node.",INFO_NODE_GATHER_INPUT:"This is the info text for the Gather Input node.",INFO_NODE_HANG_UP:"This is the info text for the Hang Up node.",INFO_NODE_OPTION_REMOVE:"Are you sure? Removing this option will delete the flow connection and move back the following option, if there is one.",INFO_NODE_PLAY_AUDIO_FILE:"This is the info text for the Play Audio File node.",INFO_NODE_PLAY:"This is the info text for the Play node.",INFO_NODE_RECORD_CALL_START:"This is the info text for the Record Call Start node.",INFO_NODE_RECORD_CALL_STOP:"This is the info text for the Record Call Stop node.",INFO_NODE_RECORD:"This is the info text for the Record node.",INFO_NODE_REQUEST:"This is the info text for the Request node.",INFO_NODE_SEND_SMS:"This is the info text for the Send SMS node.",INFO_NODE_SET_VARIABLES_OPTION:"Are you sure you want to remove this variable?",INFO_NODE_SET_VARIABLES:"This is the info text for the Set Variables node.",INFO_NODE_TEXT_TO_SPEECH:"This is the info text for the Text to Speech node.",INFO_NODE_UNSET_VARIABLES:"This is the info text for the Unset Variables node.",INFO_STATUS_ERROR:"An error occurred while loading or saving the flow.",INPUT:"Input",KEY:"Key",METHOD:"Method",MORE_INFO_STATUS_ERROR:"More info on Flow document error",MORE_INFO_TITLE:"More info {{title}}",MULTIPLE_ADDRESSES:"Multiple Addresses",MULTIPLE_NUMBERS:"Multiple Numbers",MULTIPLE_RESOURCES:"Multiple Resources",NAVIGATE_BACK:"Navigate Back",NO_ANSWER:"No Answer",NO_INPUT:"No Input",NO_VARIABLES_SET:"Please set variables first",NUMBER_OF_VARIABLES_SELECTED_one:"{{count}} variable selected",NUMBER_OF_VARIABLES_SELECTED_other:"{{count}} variables selected",OFF:"Off",ON:"On",OPT_NUMBER:"Opt {{index}}",OPTION_NUMBER:"Option {{index}}",OPTIONAL:"optional",OR_SAYS:"Or says",PHONE_NUMBER:"Phone Number",PLAY_AUDIO_FILE:"Play Audio File",PLAY_AUDIO_TTS:"Play Audio or TTS",PROMPT_TEXT_TO_SPEECH:"Prompt Text to Speech",REASON:"Reason",RECORD_CALL_START:"Start Call Recording",RECORD_CALL_STOP:"Stop Call Recording",RECORD:"Record",RECORDING_NAME_DEFAULT:"Recording {{index}}",RECORDING_NAME:"Recording Name",RECORDING:"Recording",RELAYML_VERSION:"RelayML Version",REMOVE_CONDITION:"Remove Condition {{index}}",REMOVE_EDGE:"Remove Edge",REMOVE_NODE:"Remove Node {{title}}",REMOVE_OPTION:"Remove Option {{index}}",REMOVE_VARIABLE:"Remove Variable {{index}}",REQUEST_BODY:"Body",REQUEST_HEADERS:"Headers (JSON)",REQUEST:"Request",SAVE_VARIABLES_SUBTITLE:"Store the response as variables",SAVE_VARIABLES:"Save Variables",SECONDS:"seconds",SELECT_VARIABLES_TO_UNSET:"Select Variables to Unset",SELECT_VARIABLES:"Select Variables",SELECT:"Select",SEND_SMS:"Send SMS",SEQUENTIALLY:"Sequentially",SET_VARIABLES:"Set Variables",SETTINGS:"Settings",SIMULTANEOUSLY:"Simultaneously",SINGLE_ADDRESS:"Single Address",SINGLE_NUMBER:"Single Number",SINGLE_RESOURCE:"Single Resource",SMS_TEXT:"SMS Text",STATUS_ERROR:"Error",STATUS_LOADING:"Loading...",STATUS_SAVED:"Saved",STATUS_SAVING:"Saving...",STEREO_SUBTITLE:"Enable stereo audio",STEREO:"Stereo",SUCCESS:"Success",TERMINATORS:"Terminators",TEXT_TO_SPEECH:"Text to Speech",TEXT:"Text",TO_PHONE_NUMBER:"To Phone Number",TO:"To",UNKNOWN:"Unknown",UNSET_VARIABLES:"Unset Variables",URL:"URL",VALUE:"Value",VARIABLE_KEY:"Variable {{key}}",VOICEMAIL_RECORDING:"Voicemail Recording",WAIT_FOR_INPUT:"Wait for Input",WRITE_SOMETHING:"Write something"},I={ABOUT:"ABOUT",ACTION:"ACTION",ADD_CONDITION:"ADD_CONDITION",ADD_OPTION:"ADD_OPTION",ADD_VARIABLE:"ADD_VARIABLE",ANSWER_CALL:"ANSWER_CALL",ANSWERED:"ANSWERED",API_VERSION:"API_VERSION",APP_VERSION:"APP_VERSION",BEEP_SUBTITLE:"BEEP_SUBTITLE",BEEP:"BEEP",BUILDER_VERSION:"BUILDER_VERSION",BUSY:"BUSY",CALL_ADDRESSES:"CALL_ADDRESSES",CALL_NUMBERS:"CALL_NUMBERS",CALL_RESOURCES:"CALL_RESOURCES",CALLER_PRESSES:"CALLER_PRESSES",CHOOSE_OPTION_SINGLE_MULTIPLE:"CHOOSE_OPTION_SINGLE_MULTIPLE",CHOOSE_OPTION_TTS_AUDIO:"CHOOSE_OPTION_TTS_AUDIO",CLOSE:"CLOSE",COND_NUMBER:"COND_NUMBER",CONDITION_NUMBER:"CONDITION_NUMBER",CONDITIONS:"CONDITIONS",DECISION:"DECISION",DECLINE:"DECLINE",DISCONNECT_CALL_AFTER_RINGING:"DISCONNECT_CALL_AFTER_RINGING",ELSE:"ELSE",ENTER_URL:"ENTER_URL",ERROR_ADD_RECORDING_FIRST:"ERROR_ADD_RECORDING_FIRST",ERROR_DUPLICATE_RECORDING_LABEL:"ERROR_DUPLICATE_RECORDING_LABEL",ERROR_DUPLICATE_VARIABLE_KEY:"ERROR_DUPLICATE_VARIABLE_KEY",ERROR_INVALID_JSON:"ERROR_INVALID_JSON",ERROR_NUMBER_IS_REQUIRED:"ERROR_NUMBER_IS_REQUIRED",ERROR_NUMBER_MIN_MAX_IS_REQUIRED:"ERROR_NUMBER_MIN_MAX_IS_REQUIRED",ERROR_RECORDING_LABEL_REQUIRED:"ERROR_RECORDING_LABEL_REQUIRED",ERROR_STRING_VALUE_REQUIRED:"ERROR_STRING_VALUE_REQUIRED",ERROR_TELEPHONE_KEY_REQUIRED:"ERROR_TELEPHONE_KEY_REQUIRED",ERROR_TERMINATORS:"ERROR_TERMINATORS",ERROR_TEXT_IS_REQUIRED:"ERROR_TEXT_IS_REQUIRED",ERROR_URL_IS_REQUIRED:"ERROR_URL_IS_REQUIRED",ERROR_VALUE_IS_REQUIRED:"ERROR_VALUE_IS_REQUIRED",ERROR_VARIABLE_KEY_REQUIRED:"ERROR_VARIABLE_KEY_REQUIRED",ERROR:"ERROR",FAILED:"FAILED",FAILURE:"FAILURE",FORMAT:"FORMAT",FORWARD_TO_ADDRESS:"FORWARD_TO_ADDRESS",FORWARD_TO_PHONE:"FORWARD_TO_PHONE",FORWARD_TO_RESOURCE:"FORWARD_TO_RESOURCE",FORWARD:"FORWARD",FROM_PHONE_NUMBER:"FROM_PHONE_NUMBER",FROM:"FROM",GATHER_INPUT:"GATHER_INPUT",HANDLE_CALL:"HANDLE_CALL",HANG_UP_CALL:"HANG_UP_CALL",HANG_UP:"HANG_UP",INFO_NODE_ANSWER:"INFO_NODE_ANSWER",INFO_NODE_COND:"INFO_NODE_COND",INFO_NODE_FORWARD_TO_ADDRESS:"INFO_NODE_FORWARD_TO_ADDRESS",INFO_NODE_FORWARD_TO_PHONE:"INFO_NODE_FORWARD_TO_PHONE",INFO_NODE_FORWARD_TO_RESOURCE:"INFO_NODE_FORWARD_TO_RESOURCE",INFO_NODE_GATHER_INPUT:"INFO_NODE_GATHER_INPUT",INFO_NODE_HANG_UP:"INFO_NODE_HANG_UP",INFO_NODE_OPTION_REMOVE:"INFO_NODE_OPTION_REMOVE",INFO_NODE_PLAY_AUDIO_FILE:"INFO_NODE_PLAY_AUDIO_FILE",INFO_NODE_PLAY:"INFO_NODE_PLAY",INFO_NODE_RECORD_CALL_START:"INFO_NODE_RECORD_CALL_START",INFO_NODE_RECORD_CALL_STOP:"INFO_NODE_RECORD_CALL_STOP",INFO_NODE_RECORD:"INFO_NODE_RECORD",INFO_NODE_REQUEST:"INFO_NODE_REQUEST",INFO_NODE_SEND_SMS:"INFO_NODE_SEND_SMS",INFO_NODE_SET_VARIABLES_OPTION:"INFO_NODE_SET_VARIABLES_OPTION",INFO_NODE_SET_VARIABLES:"INFO_NODE_SET_VARIABLES",INFO_NODE_TEXT_TO_SPEECH:"INFO_NODE_TEXT_TO_SPEECH",INFO_NODE_UNSET_VARIABLES:"INFO_NODE_UNSET_VARIABLES",INFO_STATUS_ERROR:"INFO_STATUS_ERROR",INPUT:"INPUT",KEY:"KEY",METHOD:"METHOD",MORE_INFO_STATUS_ERROR:"MORE_INFO_STATUS_ERROR",MORE_INFO_TITLE:"MORE_INFO_TITLE",MULTIPLE_ADDRESSES:"MULTIPLE_ADDRESSES",MULTIPLE_NUMBERS:"MULTIPLE_NUMBERS",MULTIPLE_RESOURCES:"MULTIPLE_RESOURCES",NAVIGATE_BACK:"NAVIGATE_BACK",NO_ANSWER:"NO_ANSWER",NO_INPUT:"NO_INPUT",NO_VARIABLES_SET:"NO_VARIABLES_SET",NUMBER_OF_VARIABLES_SELECTED:"NUMBER_OF_VARIABLES_SELECTED",OFF:"OFF",ON:"ON",OPT_NUMBER:"OPT_NUMBER",OPTION_NUMBER:"OPTION_NUMBER",OPTIONAL:"OPTIONAL",OR_SAYS:"OR_SAYS",PHONE_NUMBER:"PHONE_NUMBER",PLAY_AUDIO_FILE:"PLAY_AUDIO_FILE",PLAY_AUDIO_TTS:"PLAY_AUDIO_TTS",PROMPT_TEXT_TO_SPEECH:"PROMPT_TEXT_TO_SPEECH",REASON:"REASON",RECORD_CALL_START:"RECORD_CALL_START",RECORD_CALL_STOP:"RECORD_CALL_STOP",RECORD:"RECORD",RECORDING_NAME_DEFAULT:"RECORDING_NAME_DEFAULT",RECORDING_NAME:"RECORDING_NAME",RECORDING:"RECORDING",RELAYML_VERSION:"RELAYML_VERSION",REMOVE_CONDITION:"REMOVE_CONDITION",REMOVE_EDGE:"REMOVE_EDGE",REMOVE_NODE:"REMOVE_NODE",REMOVE_OPTION:"REMOVE_OPTION",REMOVE_VARIABLE:"REMOVE_VARIABLE",REQUEST_BODY:"REQUEST_BODY",REQUEST_HEADERS:"REQUEST_HEADERS",REQUEST:"REQUEST",SAVE_VARIABLES_SUBTITLE:"SAVE_VARIABLES_SUBTITLE",SAVE_VARIABLES:"SAVE_VARIABLES",SECONDS:"SECONDS",SELECT_VARIABLES_TO_UNSET:"SELECT_VARIABLES_TO_UNSET",SELECT_VARIABLES:"SELECT_VARIABLES",SELECT:"SELECT",SEND_SMS:"SEND_SMS",SEQUENTIALLY:"SEQUENTIALLY",SET_VARIABLES:"SET_VARIABLES",SETTINGS:"SETTINGS",SIMULTANEOUSLY:"SIMULTANEOUSLY",SINGLE_ADDRESS:"SINGLE_ADDRESS",SINGLE_NUMBER:"SINGLE_NUMBER",SINGLE_RESOURCE:"SINGLE_RESOURCE",SMS_TEXT:"SMS_TEXT",STATUS_ERROR:"STATUS_ERROR",STATUS_LOADING:"STATUS_LOADING",STATUS_SAVED:"STATUS_SAVED",STATUS_SAVING:"STATUS_SAVING",STEREO_SUBTITLE:"STEREO_SUBTITLE",STEREO:"STEREO",SUCCESS:"SUCCESS",TERMINATORS:"TERMINATORS",TEXT_TO_SPEECH:"TEXT_TO_SPEECH",TEXT:"TEXT",TO_PHONE_NUMBER:"TO_PHONE_NUMBER",TO:"TO",UNKNOWN:"UNKNOWN",UNSET_VARIABLES:"UNSET_VARIABLES",URL:"URL",VALUE:"VALUE",VARIABLE_KEY:"VARIABLE_KEY",VOICEMAIL_RECORDING:"VOICEMAIL_RECORDING",WAIT_FOR_INPUT:"WAIT_FOR_INPUT",WRITE_SOMETHING:"WRITE_SOMETHING"},QT={order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag","path","subdomain"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage","cookie"],excludeCacheFor:["cimode"]},XT={"en-US":{translation:KT}},qT=()=>{Te.use(Ay).use(YT).init({debug:zx,detection:QT,fallbackLng:"en-US",interpolation:{escapeValue:!1},keySeparator:!1,resources:XT})};function M(e,t){return t?Te.t(e,t):Te.t(e)}const ZT={entries:[],nextLabelIndex:0},Gn=Tl((e,t)=>({...ZT,getEntries(){return t().entries},getEntryValue(n){var r;return(r=t().entries.find(o=>o.controlId===n))==null?void 0:r.label},getGeneratedLabel(){let n="";do this.nextLabelIndex++,n=M(I.RECORDING_NAME_DEFAULT,{index:this.nextLabelIndex});while(this.isValueDuplicate(n));return n},isKeyDuplicate(n){return t().entries.some(r=>r.controlId===n)},isValueDuplicate(n,r){const o=t().entries.reduce((i,s)=>{const{label:l,controlId:a}=s;return l!==""&&l===n&&(!r||a!==r)?[...i,s]:i},[]);return Boolean(o.length)},removeEntry(n){e(r=>({entries:r.entries.filter(o=>o.controlId!==n)}))},upsertEntry:n=>{e(r=>{let o=[...r.entries];const i=Boolean(n.label.trim());return(r.isKeyDuplicate(n.controlId)||!i)&&(o=o.filter(s=>s.controlId!==n.controlId)),i&&o.push({...n}),{entries:o}})}})),JT=e=>{const t=[];e.forEach(n=>{n.type==="recordCallStart"&&n.data.controlId&&n.data.label&&t.push({controlId:n.data.controlId,label:n.data.label})}),Gn.setState({entries:t,nextLabelIndex:t.length})},eI=(e,t)=>{const n=[];return t.forEach(r=>{r.type==="recordCallStart"&&r.data.controlId&&(n.push(r.data.controlId),Gn.getState().removeEntry(r.data.controlId))}),n.length?e.reduce((r,o)=>o.type==="recordCallStop"&&n.includes(o.data.controlId)?[...r,{...o,data:{...o.data,controlId:"",missingRequiredParams:!0}}]:r,[]):[]},ky={recordCallStart:e=>{const t=Gn.getState().getGeneratedLabel();return Gn.getState().upsertEntry({controlId:e.data.controlId,label:t}),{...e,data:{...e.data,label:t}}}},tI=e=>ey[e]!==void 0,nI=e=>typeof e=="object"&&e!==null&&Object.keys(e).length>0,rI=e=>ky[e.type]!==void 0,Py=(e,t={})=>{const{deletable:n=!0,position:r={x:300,y:250},selected:o=!0}=t,i=()=>({id:Me(),type:e,position:r,deletable:n,data:{missingRequiredParams:!1},selected:o}),s=(a,u)=>({...a,data:{...a.data,...u,missingRequiredParams:!0}});let l=i();if(tI(e)){const a=ey[e]();nI(a)&&(l=s(l,a))}return rI(l)&&(l=ky[l.type](l)),l},ia={apiVersion:void 0,builderVersion:Xv,cfbAppVersion:Qv,relayMLVersion:void 0},oI=e=>{const t={...ia,...e};ia.apiVersion=t.apiVersion,ia.builderVersion=t.builderVersion,ia.relayMLVersion=t.relayMLVersion},Af=()=>({apiVersion:void 0,builderVersion:Xv,cfbAppVersion:Qv,relayMLVersion:void 0}),My=1e3,bf=Ct(),iI=e=>(t,n,r)=>{let o,i;const s=async()=>{const{httpService:l,nodes:a,edges:u,documentVersion:c}=n(),{builderVersion:f}=Af();bf.debug("Saving data to server"),t({dataHandlingStatus:"saving",saveFlowStatus:"saving"}),clearTimeout(i);try{if(!l)throw new Error("Missing httpService");const h={documentVersion:(await l.putFlow({documentVersion:c,builderVersion:f,nodes:a,edges:u})).document_version};switch(n().dataHandlingStatus){case"saving":t({...h,dataHandlingStatus:"queueing",saveFlowStatus:"saved"});break;case"holding":t({...h,saveFlowStatus:"awaiting-save"}),bf.debug("Setting up a new save for held changes"),i=setTimeout(()=>{s()},My);break;default:bf.debug("Saving data to server - invalid state")}}catch(p){console.error("Put Flow",p),t({dataHandlingStatus:"queueing",saveFlowStatus:"error"})}};return r.setState=(l,a,...u)=>{const{dataHandlingStatus:c,initializing:f}=n(),p=typeof l=="function"?l(n()):l;!f&&(p.nodes||p.edges)?c==="queueing"?(p.saveFlowStatus="awaiting-save",t(p,a,...u),clearTimeout(o),o=setTimeout(()=>{s()},My)):(p.dataHandlingStatus="holding",t(p,a,...u)):"initializing"in p&&p.initializing!==f?(p.dataHandlingStatus="queueing",p.saveFlowStatus="saved",t(p,a,...u)):t(p,a,...u)},e(r.setState,n,r)},sI={variables:new Map,keyToIdMap:new Map},vr=Tl((e,t)=>({...sI,_dedupeKey(n,r){const o=Array.from(r.values()).find(i=>i.key===n);o&&r.delete(o.id)},isKeyDuplicate(n,r){const o=t().keyToIdMap.get(n);return o?o!==r:!1},removeVariable(n){e(r=>{const o=new Map(r.variables),i=new Map(r.keyToIdMap),s=o.get(n);return s&&(o.delete(n),i.delete(s.key)),{keyToIdMap:i,variables:o}})},setVariables:n=>{e(()=>{const r=new Map,o=new Map;return n.forEach(i=>{const s=o.get(i.key);s&&r.delete(s),r.set(i.id,i),o.set(i.key,i.id)}),{keyToIdMap:o,variables:r}})},upsertVariable:n=>{e(r=>{const o=new Map(r.variables),i=new Map(r.keyToIdMap),s=o.get(n.id),l=i.get(n.key);return l&&o.delete(l),s&&i.delete(s.key),o.set(n.id,n),i.set(n.key,n.id),{keyToIdMap:i,variables:o}})}})),lI=e=>{const t=[];e.forEach(n=>{n.type==="set"&&n.data.variables&&t.push(...n.data.variables)}),vr.getState().setVariables(t)},aI=e=>{if(e!=null&&e.length){const{removeVariable:t}=vr.getState();e.forEach(n=>{n.type==="set"&&n.data.variables&&n.data.variables.forEach(o=>t(o.id))})}},ze=Ct(),uI=Py("handleCall",{position:{x:300,y:100},deletable:!1}),Qi={backButtonHref:void 0,colorMode:"light",dataHandlingStatus:"queueing",documentVersion:0,edges:[],flowId:"",flowInteractive:!0,flowTitle:"",getFlowURL:"",httpService:void 0,initializing:!0,isDraggingNode:!1,isEdgeConnecting:!1,isEdgeUpdateSuccessful:!1,nodes:[],reactFlowInstance:void 0,rootAppHeight:void 0,rootAppWidth:void 0,rootElementId:"",saveFlowStatus:"initial",selectedNode:void 0,updateFlowURL:"",updatingSourceHandleId:void 0},ne=Tl()(iI((e,t)=>({...Qi,reset:()=>{ze.debug("Reset!"),e({nodes:[...Qi.nodes],edges:[...Qi.edges]})},exportStoreData:()=>{const{nodes:n,edges:r}=t();jx(n,r)},addNode:n=>{ze.debug("Add Node",n);const{nodes:r,reactFlowInstance:o}=t();if(!o)throw new Error("ReactFlowInstance not found");const i=150,s=150,l=o.project({x:i,y:s}),a=Py(n,{position:l}),u=r.map(c=>({...c,selected:!1}));u.push(a),e({nodes:u,selectedNode:a})},getNodeEdges:n=>t().edges.filter(r=>r.source===n),getTargetEdges:n=>t().edges.filter(r=>r.target===n),partialUpdateNodeData:(n,r)=>{var s;ze.debug("partialUpdateNodeData",n,r);const o=[],i=t().nodes.map(l=>{if(l.id===n){if("options"in r&&"options"in l.data){const a=l.data.options.map(c=>c.id),u=r.options.map(c=>c.id);o.push(...a.filter(c=>!u.includes(c)))}return{...l,data:{...l.data,...r}}}return l});if(o.length){const l=t().edges.filter(a=>a.sourceHandle&&o.includes(a.sourceHandle));ze.debug("Remove orphaned edges",{sourceHandleDeleted:o,edgesToDelete:l}),(s=t().reactFlowInstance)==null||s.deleteElements({edges:l})}e({nodes:i})},removeNode:n=>{ze.debug("removeNode",n);const r=t().reactFlowInstance;r&&r.deleteElements({nodes:[{id:n}]})},removeEdge:n=>{ze.debug("removeEdge",n);const r=t().reactFlowInstance;r&&r.deleteElements({edges:[{id:n}]})},onInit:async n=>{const{getFlowURL:r,updateFlowURL:o}=t();ze.log("onInit",{getFlowURL:r,updateFlowURL:o});const i=H_({getFlowURL:r,updateFlowURL:o,headers:Hx()}),s=Af(),{id:l,title:a,document_version:u,flow_data:c}=await i.getFlow();let f=c;f||(f={apiVersion:s.apiVersion,builderVersion:s.builderVersion,relayMLVersion:s.relayMLVersion,edges:Qi.edges,nodes:Qi.nodes.concat([uI])}),e({httpService:i,reactFlowInstance:n,flowId:l,flowTitle:a,documentVersion:u,nodes:f.nodes.map(Yx),edges:f.edges.map(Gx)}),oI({apiVersion:f.apiVersion,builderVersion:f.builderVersion,relayMLVersion:f.relayMLVersion}),lI(f.nodes),JT(f.nodes)},onNodeDragStart:()=>{e({isDraggingNode:!0})},onNodeDragStop:()=>{e({isDraggingNode:!1})},onNodesChange:n=>{e({nodes:Pv(n,t().nodes)})},onNodesDelete:n=>{ze.debug("onNodesDelete"),aI(n),eI(t().nodes,n).forEach(o=>{ne.getState().partialUpdateNodeData(o.id,o.data)})},onEdgesChange:n=>{e({edges:QO(n,t().edges)})},onEdgesDelete:n=>{ze.debug("onEdgesDelete [noop]",n)},onConnect:n=>{ze.debug("onConnect"),e({edges:Qm(n,t().edges)})},onConnectStart:()=>{ze.debug("onConnectStart"),e({isEdgeConnecting:!0})},onConnectEnd:()=>{ze.debug("onConnectEnd"),e({isEdgeConnecting:!1})},onEdgeUpdateStart:(n,r)=>{ze.debug("onEdgeUpdateStart"),e({isEdgeUpdateSuccessful:!1,updatingSourceHandleId:r.sourceHandle??void 0})},onEdgeUpdate:(n,r)=>{ze.debug("onEdgeUpdate"),e({edges:lO(n,r,t().edges),isEdgeUpdateSuccessful:!0})},onEdgeUpdateEnd:(n,r)=>{var o;ze.debug("onEdgeUpdateEnd"),t().isEdgeUpdateSuccessful?e({isEdgeUpdateSuccessful:!0}):(o=t().reactFlowInstance)==null||o.deleteElements({edges:[{id:r.id}]}),e({updatingSourceHandleId:void 0})},onSelectionChange:({nodes:n})=>{e({selectedNode:n.find(r=>r.selected)})},setColorMode:n=>{e({colorMode:n})}})));window.__useRFStore=ne;const b2="";function cI({fromNode:e,fromPosition:t,fromX:n,fromY:r,toX:o,toY:i}){if(!e)return null;const[s]=Bi({borderRadius:20,sourceX:n,sourceY:r,sourcePosition:t,targetPosition:G.Top,targetX:o,targetY:i});return V("g",{children:[_("path",{fill:"none",stroke:"#222",strokeWidth:1.5,className:"animated",d:s}),_("circle",{cx:o,cy:i,fill:"#fff",r:3,stroke:"#222",strokeWidth:1.5})]})}const Xi=40;function fI(e,t,n,r=0,o=!1){const{width:i,height:s,position:l}=n,a=i??0,u=s??0,c=a/2,f=u/2;if(o)return{tx:l.x,ty:l.y+f};const p=l.x+c,h=l.y+f,v=e,m=t,E=(v-p)/a-(m-h)/u,d=(v-p)/u+(m-h)/u,g=1/(Math.abs(E)+Math.abs(d)),y=g*E,S=g*d,w=c*(y+S)+p;return{tx:Math.min(Math.max(w,l.x+r),l.x+a-r),ty:l.y}}const dI=({isCircular:e,sourceX:t,labelX:n,sourceY:r,labelY:o})=>e?{x:t-Xi*1.5,y:r}:{x:n-Xi/2,y:o-Xi/2};function pI(e){const{id:t,source:n,target:r,sourcePosition:o,sourceX:i,sourceY:s}=e,l=ne(d=>d.removeEdge),a=ae(N.useCallback(d=>d.nodeInternals.get(n),[n])),u=ae(N.useCallback(d=>d.nodeInternals.get(r),[r]));if(!a||!u)return null;const c=n===r,{tx:f,ty:p}=fI(i,s,u,20,c),[h,v,m]=Bi({borderRadius:20,sourceX:i,sourceY:s,sourcePosition:o,targetPosition:c?G.Left:G.Top,targetX:f,targetY:p}),E=(d,g)=>{d.stopPropagation(),l(g)};return V("g",{className:"group",children:[_(mo,{path:h,...e}),_("foreignObject",{width:Xi,height:Xi,className:"hidden group-hover:block",requiredExtensions:"http://www.w3.org/1999/xhtml",...dI({isCircular:c,sourceX:i,labelX:v,sourceY:s,labelY:m}),children:_("div",{className:"h-10 w-10",children:V("button",{className:"flex h-10 w-10 cursor-pointer items-center justify-center rounded-full border border-foreground/10 bg-backgroundAlt",onClick:d=>E(d,t),children:[_(Et,{tag:"trash-can",className:"text-negative"}),_("span",{className:"sr-only",children:M(I.REMOVE_EDGE)})]})})})]})}var hI={prefix:"fas",iconName:"trash-can",icon:[448,512,[61460,"trash-alt"],"f2ed","M135.2 17.7C140.6 6.8 151.7 0 163.8 0H284.2c12.1 0 23.2 6.8 28.6 17.7L320 32h96c17.7 0 32 14.3 32 32s-14.3 32-32 32H32C14.3 96 0 81.7 0 64S14.3 32 32 32h96l7.2-14.3zM32 128H416V448c0 35.3-28.7 64-64 64H96c-35.3 0-64-28.7-64-64V128zm96 64c-8.8 0-16 7.2-16 16V432c0 8.8 7.2 16 16 16s16-7.2 16-16V208c0-8.8-7.2-16-16-16zm96 0c-8.8 0-16 7.2-16 16V432c0 8.8 7.2 16 16 16s16-7.2 16-16V208c0-8.8-7.2-16-16-16zm96 0c-8.8 0-16 7.2-16 16V432c0 8.8 7.2 16 16 16s16-7.2 16-16V208c0-8.8-7.2-16-16-16z"]},gI={prefix:"fas",iconName:"circle-exclamation",icon:[512,512,["exclamation-circle"],"f06a","M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm0-384c13.3 0 24 10.7 24 24V264c0 13.3-10.7 24-24 24s-24-10.7-24-24V152c0-13.3 10.7-24 24-24zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z"]},mI={prefix:"fas",iconName:"arrow-left",icon:[448,512,[8592],"f060","M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.2 288 416 288c17.7 0 32-14.3 32-32s-14.3-32-32-32l-306.7 0L214.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160z"]},vI={prefix:"fas",iconName:"circle-info",icon:[512,512,["info-circle"],"f05a","M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM216 336h24V272H216c-13.3 0-24-10.7-24-24s10.7-24 24-24h48c13.3 0 24 10.7 24 24v88h8c13.3 0 24 10.7 24 24s-10.7 24-24 24H216c-13.3 0-24-10.7-24-24s10.7-24 24-24zm40-208a32 32 0 1 1 0 64 32 32 0 1 1 0-64z"]},yI={prefix:"fas",iconName:"xmark",icon:[320,512,[128473,10005,10006,10060,215,"close","multiply","remove","times"],"f00d","M310.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L160 210.7 54.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L114.7 256 9.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L160 301.3 265.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L205.3 256 310.6 150.6z"]};const EI={"arrow-left":mI,"circle-exclamation":gI,"circle-info":vI,"trash-can":hI,xmark:yI},Et=N.forwardRef(function({className:t="",size:n="",tag:r},o){const i=EI[r];return i?_("svg",{"aria-hidden":"true","data-prefix":i.prefix,"data-icon":r,className:`svg-inline--fa fa-${r} ${n?`fa-${n}`:""} ${t}`,focusable:"false",ref:o,role:"img",viewBox:`0 0 ${i.icon[0]} ${i.icon[1]}`,xmlns:"http://www.w3.org/2000/svg",children:_("path",{d:i.icon[4],fill:"currentColor"})}):(Ct().debug(`Unknown icon: ${r}`),null)}),SI=({isSelected:e,nodeId:t,nodeTitle:n,showDelete:r})=>{const o=ne(a=>a.removeNode),i=ne(a=>a.isEdgeConnecting);return V("div",{className:"flex w-full items-center justify-between p-4",children:[_("h2",{className:`text-lg font-semibold leading-6 ${e?"text-primary":""}`,children:n}),r&&!i&&V("button",{className:"opacity-0 transition-opacity group-hover/node-wrapper:opacity-100",onClick:()=>{o(t)},children:[_(Et,{tag:"trash-can",className:"text-negative"}),_("span",{className:"sr-only",children:M(I.REMOVE_NODE,{title:n})})]})]})},_I=({id:e,missingRequiredEntry:t})=>{const n=ne(i=>i.getTargetEdges),[r,o]=N.useState(!1);return N.useEffect(()=>{const i=()=>n(e).length===0;o(i());const s=ne.subscribe((l,a)=>{l.edges.length!==a.edges.length&&o(i()),l.nodes.length!==a.nodes.length&&o(i()),l.isEdgeUpdateSuccessful!==a.isEdgeUpdateSuccessful&&o(i())});return()=>s()},[e,n]),r||t?V("div",{className:"flex flex-col gap-y-6 px-4 pb-4 text-sm italic leading-4",children:[r&&_("p",{children:"Not Connected to Flow"}),t&&_("p",{children:"Missing Required Entry"})]}):null},wI=({id:e,isConnectable:t})=>{if(!e)throw new Error("TargetHandle: id is required");return _(Eo,{type:"target",id:`target-${e}`,position:G.Top,isConnectable:t,className:"mt-1 h-4 w-full rounded-none rounded-t-md border-none bg-primary opacity-0 transition-opacity hover:opacity-100"})},Ze=({children:e,id:t,isConnectable:n=!0,missingRequiredEntry:r,nodeTitle:o,selected:i,showDelete:s,showValidation:l=!0,target:a=!0})=>V("section",{className:`${i?"shadow-xl":""} group/node-wrapper min-w-[300px] rounded-lg border border-foreground/10 bg-background transition-[visibility]`,children:[a&&t&&_(wI,{id:t,isConnectable:n}),_(SI,{nodeId:t,isSelected:i,nodeTitle:o,showDelete:s}),l&&_(_I,{id:t,missingRequiredEntry:r??!1}),e]}),RI=({children:e,handleClick:t,...n})=>_("li",{role:"presentation",children:V("div",{className:"flex items-center gap-2 rounded-lg bg-secondary p-2 pr-1",role:"option","aria-selected":"true",tabIndex:0,children:[_("span",{className:"text-sm text-foreground",children:e}),V("button",{className:" px-1",onClick:t,onKeyDown:o=>{(o.key==="Backspace"||o.key==="Delete")&&(o.stopPropagation(),t==null||t())},type:"button",...n,children:[_("span",{className:"sr-only",children:"Remove"}),_(Et,{tag:"xmark",size:"xs"})]})]})}),yr=e=>_("div",{className:"relative after:absolute after:right-3 after:top-3 after:h-[7px] after:w-[7px] after:rotate-45 after:border-r after:border-b after:border-foreground after:content-['']",children:_("select",{className:"pr-8",...e,children:e.children})}),NI={disabled:"border-disabled cursor-not-allowed",negative:"border-negative hover:bg-negative",positive:"border-positive hover:bg-positive"},Kt=({color:e="positive",enabled:t=!0,id:n,isConnectable:r,position:o=G.Bottom,positionClasses:i="-bottom-2.5"})=>{if(!n)throw new Error("SourceHandle: id is required");const s=t?e:"disabled",l=ne(p=>p.updatingSourceHandleId),c=!ne(p=>p.edges.some(h=>h.sourceHandle===n))||l===n;return _("div",{className:`absolute top-auto left-1/2 h-5 w-5 -translate-x-1/2 rounded-full ${i} ${c&&r&&t?"":"nodrag cursor-not-allowed"}`,children:_(Eo,{className:`bottom-0 h-full w-full border-[3px] bg-background transition-colors ${NI[s]??""}`,id:n,isConnectable:c&&r&&t,position:o,type:"source"})})},sa=({children:e})=>_("div",{className:"divide-foreground/10 flex w-full items-center divide-x",children:e}),Io=({color:e="positive",enabled:t=!0,id:n,isConnectable:r,optionText:o,position:i=G.Bottom,positionClasses:s="-bottom-2.5"})=>V("div",{className:"relative w-full min-w-[104px] whitespace-nowrap border-t border-foreground/10 py-4",children:[_("div",{className:"flex flex-col items-center justify-center",children:_("p",{className:`${t?"":"text-disabled"} min-h-[1rem] text-sm leading-4`,children:o})}),_(Kt,{color:e,enabled:t,id:n,isConnectable:r,position:i,positionClasses:s})]}),OI=({checked:e=!1,name:t,onClick:n})=>V("button",{name:t,onClick:n,type:"button",className:`${e?"bg-primary":"bg-secondary"} relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out`,role:"switch","aria-checked":e?"true":"false",children:[_("span",{className:"sr-only",children:M(e?I.ON:I.OFF)}),_("span",{className:`pointer-events-none inline-block h-5 w-5 ${e?"translate-x-5":"translate-x-0"} transform rounded-full bg-white shadow transition duration-200 ease-in-out`})]}),Uy=({checked:e,clickHandler:t,name:n,subtitle:r,title:o})=>V("div",{className:"mb-2 flex items-center justify-between",children:[V("div",{className:"flex flex-grow flex-col",children:[_("span",{className:"text-base font-medium leading-6 text-foreground",children:o}),r&&_("span",{className:"text-xs text-foreground/50",children:r})]}),_(OI,{checked:e,name:n,onClick:t})]}),qi=({errorText:e,label:t,name:n,onChange:r,required:o,valid:i,value:s,...l})=>V("label",{children:[_("span",{className:"sr-only",children:t}),_("textarea",{"aria-invalid":i?void 0:"true",className:`peer min-h-[77px] w-full resize-none ${i?"":"invalid"}`,inputMode:"text",minLength:1,name:n,onChange:r,required:o,value:s,...l}),_("p",{className:"requirements",role:"alert",children:e})]}),xI=({dragging:e,id:t,isConnectable:n,selected:r})=>_(Ze,{id:t,isConnectable:n,missingRequiredEntry:!1,nodeTitle:"Answer Call",selected:r,showDelete:!e,children:_(Kt,{id:t,isConnectable:n,color:"positive"})}),TI={success:I.SUCCESS,noAnswer:I.NO_ANSWER,busy:I.BUSY,decline:I.DECLINE,error:I.ERROR},II={address:I.FORWARD_TO_ADDRESS,phone:I.FORWARD_TO_PHONE,resource:I.FORWARD_TO_RESOURCE},Lf=({id:e,data:t,dragging:n,isConnectable:r,selected:o})=>V(Ze,{id:e,isConnectable:r,missingRequiredEntry:t.missingRequiredParams,nodeTitle:M(II[t.destinationType]),selected:o,showDelete:!n,children:[t.destinations.length>0?_("section",{className:"p-4 pt-2",children:_("ul",{className:"space-y-2",children:t.destinations.map((i,s)=>_("li",{className:"text-sm",children:i},`node-${i}-${s}`))})}):null,_(sa,{children:t.options.map(i=>_(Io,{id:i.id,optionText:M(TI[i.result]),color:Jv(i.result),isConnectable:r},i.id))})]}),CI=({id:e,data:t,dragging:n,isConnectable:r,selected:o})=>_(Ze,{id:e,isConnectable:r,missingRequiredEntry:t.missingRequiredParams,nodeTitle:"Gather Input",selected:o,showDelete:!n,children:V(sa,{children:[t.options.map((i,s)=>{const l=Boolean(i.command||i.digit);return _(Io,{color:"positive",enabled:l,id:i.id,isConnectable:r,optionText:M(I.OPT_NUMBER,{index:s+1})},i.id)}),t.results.map(i=>_(Io,{color:"negative",id:i.id,isConnectable:r,optionText:i.result==="no_input"?M(I.NO_INPUT):M(I.UNKNOWN)},i.id))]})}),AI=({id:e,isConnectable:t,selected:n})=>_(Ze,{allowDelete:!1,id:e,isConnectable:t,nodeTitle:M(I.HANDLE_CALL),selected:n,showDelete:!1,showValidation:!1,target:!1,children:_(Kt,{id:e,color:"positive",isConnectable:t})}),Df={busy:I.BUSY,decline:I.DECLINE,hangup:I.HANG_UP},bI=({data:e,dragging:t,id:n,isConnectable:r,selected:o})=>_(Ze,{id:n,isConnectable:r,missingRequiredEntry:!1,nodeTitle:M(I.HANG_UP_CALL),selected:o,showDelete:!t,children:e.reason&&_("section",{className:"p-4 pt-2",children:_("p",{children:M(Df[e.reason])})})}),LI=e=>{try{return new URL(e).pathname.split("/").at(-1)}catch{return""}},DI=({data:e,dragging:t,id:n,isConnectable:r,selected:o})=>{let i=e.selected&&e[e.selected];return i&&e.selected==="url"&&(i=LI(i)||"Play Audio"),V(Ze,{id:n,isConnectable:r,missingRequiredEntry:e.missingRequiredParams,nodeTitle:M(I.PLAY_AUDIO_TTS),selected:o,showDelete:!t,children:[i&&_("div",{className:"max-w-[300px] p-4 pt-0",children:e.selected==="url"?_("a",{className:"break-words text-primary underline line-clamp-3",href:e.url,target:"_blank",rel:"noopener noreferrer",children:i}):_("p",{className:"break-words line-clamp-3",children:i})}),_(Kt,{id:n,isConnectable:r})]})},kI=({id:e,data:t,dragging:n,isConnectable:r,selected:o})=>V(Ze,{id:e,isConnectable:r,missingRequiredEntry:t.missingRequiredParams,nodeTitle:M(I.SET_VARIABLES),selected:o,showDelete:!n,children:[t.variables.length>0&&_("div",{className:"flow-root",children:_("div",{className:"inline-block p-4 pt-0 align-middle",children:V("table",{className:"w-80 table-fixed divide-y divide-foreground/10",children:[_("thead",{children:V("tr",{children:[_("th",{scope:"col",className:"py-3.5 text-left text-sm font-semibold",children:M(I.KEY)}),_("th",{scope:"col",className:"px-2 py-3.5 text-left text-sm font-semibold",children:M(I.VALUE)})]})}),_("tbody",{className:"divide-y divide-foreground/10 bg-background text-sm",children:t.variables.map(i=>i.key?V("tr",{children:[_("td",{className:"overflow-hidden text-ellipsis whitespace-nowrap py-2 text-sm",children:i.key}),_("td",{className:"overflow-hidden text-ellipsis whitespace-nowrap break-all px-2 py-2 text-sm",children:i.value})]},i.id):null)})]})})}),_(Kt,{id:e,isConnectable:r,color:"positive"})]}),PI=({id:e,data:t,dragging:n,isConnectable:r,selected:o})=>{const i=ne(s=>s.partialUpdateNodeData);return N.useEffect(()=>{const s=vr.subscribe(l=>{const u=Array.from(l.variables.values()).reduce((c,f)=>{const p=t.variables.find(h=>h.setId===f.id);return p&&c.push({...p,key:f.key}),c},[]);i(e,{variables:u,missingRequiredParams:u.length===0})});return()=>s()},[i,e,t.variables]),_(Ze,{id:e,isConnectable:r,missingRequiredEntry:t.missingRequiredParams,nodeTitle:M(I.UNSET_VARIABLES),selected:o,showDelete:!n,children:_(Kt,{id:e,isConnectable:r,color:"positive"})})},MI=({data:e,dragging:t,id:n,isConnectable:r,selected:o})=>_(Ze,{id:n,isConnectable:r,missingRequiredEntry:e.missingRequiredParams,nodeTitle:M(I.VOICEMAIL_RECORDING),selected:o,showDelete:!t,children:_(Kt,{id:n,isConnectable:r,color:"positive"})}),UI=({data:e,dragging:t,id:n,isConnectable:r,selected:o})=>{const{label:i,missingRequiredParams:s}=e;return V(Ze,{id:n,isConnectable:r,missingRequiredEntry:s,nodeTitle:M(I.RECORD_CALL_START),selected:o,showDelete:!t,children:[i&&_("section",{className:"whitespace-nowrap px-4 pb-4 text-sm",children:i}),_(Kt,{id:n,isConnectable:r,color:"positive"})]})},FI=({data:e,dragging:t,id:n,isConnectable:r,selected:o})=>{var l;const i=(l=Gn(a=>a.entries))==null?void 0:l.find(a=>a.controlId===e.controlId),s=i==null?void 0:i.label;return V(Ze,{id:n,isConnectable:r,missingRequiredEntry:!s,nodeTitle:M(I.RECORD_CALL_STOP),selected:o,showDelete:!t,children:[s&&_("section",{className:"whitespace-nowrap px-4 pb-4 text-sm",children:s}),_(Kt,{id:n,color:"positive",isConnectable:r})]})},VI=({data:e,dragging:t,id:n,isConnectable:r,selected:o})=>V(Ze,{id:n,isConnectable:r,missingRequiredEntry:e.missingRequiredParams,nodeTitle:M(I.SEND_SMS),selected:o,showDelete:!t,children:[(e.body||e.toNumber)&&V("div",{className:"max-w-[300px] p-4 pt-0",children:[e.fromNumber&&V("p",{className:`whitespace-nowrap ${e.body?"pb-2":""}`,children:[M(I.FROM),": ",e.fromNumber]}),e.toNumber&&V("p",{className:`whitespace-nowrap ${e.body?"pb-2":""}`,children:[M(I.TO),": ",e.toNumber]}),e.body&&_("p",{className:"break-words pt-1 line-clamp-3",children:e.body})]}),_(Kt,{id:n,isConnectable:r})]}),BI={success:I.SUCCESS,failed:I.FAILED},$I={answer:xI,forwardAddress:Lf,forwardPhone:Lf,forwardResource:Lf,handleCall:AI,hangup:bI,play:DI,promptPlay:CI,record:MI,recordCallStart:UI,recordCallStop:FI,sendSms:VI,set:kI,unset:PI,request:({data:e,dragging:t,id:n,isConnectable:r,selected:o})=>{var i;return _(Ze,{id:n,isConnectable:r,missingRequiredEntry:e.missingRequiredParams,nodeTitle:M(I.REQUEST),selected:o,showDelete:!t,children:_(sa,{children:(i=e==null?void 0:e.options)==null?void 0:i.map(s=>_(Io,{id:s.id,optionText:M(BI[s.result]),color:Jv(s.result),isConnectable:r},s.id))})})},cond:({id:e,data:t,dragging:n,isConnectable:r,selected:o})=>_(Ze,{id:e,isConnectable:r,missingRequiredEntry:t.missingRequiredParams,nodeTitle:M(I.CONDITIONS),selected:o,showDelete:!n,children:V(sa,{children:[t.options.map((i,s)=>{const l=Boolean(i.value);return _(Io,{color:"positive",enabled:l,id:i.id,isConnectable:r,optionText:M(I.COND_NUMBER,{index:s+1})},i.id)}),_(Io,{color:"negative",id:t.fallback,isConnectable:r,optionText:M(I.ELSE)},t.fallback)]})})},zI={floating:pI},HI={duration:1e3,includeHiddenNodes:!0,padding:.3},jI=e=>({edges:e.edges,nodes:e.nodes,onConnect:e.onConnect,onConnectEnd:e.onConnectEnd,onConnectStart:e.onConnectStart,onEdgesChange:e.onEdgesChange,onEdgesDelete:e.onEdgesDelete,onEdgeUpdate:e.onEdgeUpdate,onEdgeUpdateEnd:e.onEdgeUpdateEnd,onEdgeUpdateStart:e.onEdgeUpdateStart,onInit:e.onInit,onNodeDragStart:e.onNodeDragStart,onNodeDragStop:e.onNodeDragStop,onNodesChange:e.onNodesChange,onNodesDelete:e.onNodesDelete,onSelectionChange:e.onSelectionChange}),WI=({children:e})=>{const{edges:t,nodes:n,onConnect:r,onConnectEnd:o,onConnectStart:i,onEdgesChange:s,onEdgesDelete:l,onEdgeUpdate:a,onEdgeUpdateEnd:u,onEdgeUpdateStart:c,onInit:f,onNodeDragStart:p,onNodeDragStop:h,onNodesChange:v,onNodesDelete:m,onSelectionChange:E}=ne(jI,Xe);return _(Yv,{className:"bg-sw-white !h-auto",connectionLineComponent:cI,connectionMode:Bn.Strict,defaultEdgeOptions:Zv,edges:t,edgeTypes:zI,fitView:!0,fitViewOptions:HI,nodes:n,nodeTypes:$I,onConnect:r,onConnectEnd:o,onConnectStart:i,onEdgesChange:s,onEdgesDelete:l,onEdgeUpdate:a,onEdgeUpdateEnd:u,onEdgeUpdateStart:c,onInit:f,onNodeDragStart:p,onNodeDragStop:h,onNodesChange:v,onNodesDelete:m,onSelectionChange:E,children:e})},GI=1e3,YI=e=>ne.setState({initializing:e}),KI=()=>{const e=ne(i=>i.initializing),t=ne(i=>i.flowInteractive),n=Re(),r=Dx(),o=N.useCallback(i=>{n.setState({nodesDraggable:i,nodesConnectable:i,elementsSelectable:i})},[n]);N.useEffect(()=>{let i;e&&(r?(i&&clearTimeout(i),i=setTimeout(()=>{o(!0),YI(!1)},GI)):o(!1))},[e,r,o]),N.useEffect(()=>{e||o(t)},[e,t,o])};/*!
61
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function eT(e){return Xx(e)||qx(e)||Zx(e)||Jx()}function oy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function iy(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?oy(Object(n),!0).forEach(function(r){pn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oy(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var tT={type:"logger",log:function(t){this.output("log",t)},warn:function(t){this.output("warn",t)},error:function(t){this.output("error",t)},output:function(t,n){console&&console[t]&&console[t].apply(console,n)}},nT=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};vt(this,e),this.init(t,n)}return yt(e,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=r.prefix||"i18next:",this.logger=n||tT,this.options=r,this.debug=r.debug}},{key:"setDebug",value:function(n){this.debug=n}},{key:"log",value:function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return this.forward(r,"log","",!0)}},{key:"warn",value:function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return this.forward(r,"warn","",!0)}},{key:"error",value:function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return this.forward(r,"error","")}},{key:"deprecate",value:function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return this.forward(r,"warn","WARNING DEPRECATED: ",!0)}},{key:"forward",value:function(n,r,o,i){return i&&!this.debug?null:(typeof n[0]=="string"&&(n[0]="".concat(o).concat(this.prefix," ").concat(n[0])),this.logger[r](n))}},{key:"create",value:function(n){return new e(this.logger,iy(iy({},{prefix:"".concat(this.prefix,":").concat(n,":")}),this.options))}},{key:"clone",value:function(n){return n=n||this.options,n.prefix=n.prefix||this.prefix,new e(this.logger,n)}}]),e}(),Gt=new nT,Wn=function(){function e(){vt(this,e),this.observers={}}return yt(e,[{key:"on",value:function(n,r){var o=this;return n.split(" ").forEach(function(i){o.observers[i]=o.observers[i]||[],o.observers[i].push(r)}),this}},{key:"off",value:function(n,r){if(this.observers[n]){if(!r){delete this.observers[n];return}this.observers[n]=this.observers[n].filter(function(o){return o!==r})}}},{key:"emit",value:function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];if(this.observers[n]){var s=[].concat(this.observers[n]);s.forEach(function(a){a.apply(void 0,o)})}if(this.observers["*"]){var l=[].concat(this.observers["*"]);l.forEach(function(a){a.apply(a,[n].concat(o))})}}}]),e}();function Gi(){var e,t,n=new Promise(function(r,o){e=r,t=o});return n.resolve=e,n.reject=t,n}function sy(e){return e==null?"":""+e}function rT(e,t,n){e.forEach(function(r){t[r]&&(n[r]=t[r])})}function If(e,t,n){function r(l){return l&&l.indexOf("###")>-1?l.replace(/###/g,"."):l}function o(){return!e||typeof e=="string"}for(var i=typeof t!="string"?[].concat(t):t.split(".");i.length>1;){if(o())return{};var s=r(i.shift());!e[s]&&n&&(e[s]=new n),Object.prototype.hasOwnProperty.call(e,s)?e=e[s]:e={}}return o()?{}:{obj:e,k:r(i.shift())}}function ly(e,t,n){var r=If(e,t,Object),o=r.obj,i=r.k;o[i]=n}function oT(e,t,n,r){var o=If(e,t,Object),i=o.obj,s=o.k;i[s]=i[s]||[],r&&(i[s]=i[s].concat(n)),r||i[s].push(n)}function ea(e,t){var n=If(e,t),r=n.obj,o=n.k;if(r)return r[o]}function ay(e,t,n){var r=ea(e,n);return r!==void 0?r:ea(t,n)}function uy(e,t,n){for(var r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?typeof e[r]=="string"||e[r]instanceof String||typeof t[r]=="string"||t[r]instanceof String?n&&(e[r]=t[r]):uy(e[r],t[r],n):e[r]=t[r]);return e}function xo(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var iT={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};function sT(e){return typeof e=="string"?e.replace(/[&<>"'\/]/g,function(t){return iT[t]}):e}var ta=typeof window<"u"&&window.navigator&&typeof window.navigator.userAgentData>"u"&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,lT=[" ",",","?","!",";"];function aT(e,t,n){t=t||"",n=n||"";var r=lT.filter(function(l){return t.indexOf(l)<0&&n.indexOf(l)<0});if(r.length===0)return!0;var o=new RegExp("(".concat(r.map(function(l){return l==="?"?"\\?":l}).join("|"),")")),i=!o.test(e);if(!i){var s=e.indexOf(n);s>0&&!o.test(e.substring(0,s))&&(i=!0)}return i}function cy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function na(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?cy(Object(n),!0).forEach(function(r){pn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cy(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function uT(e){var t=cT();return function(){var r=Wt(e),o;if(t){var i=Wt(this).constructor;o=Reflect.construct(r,arguments,i)}else o=r.apply(this,arguments);return Wi(this,o)}}function cT(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function fy(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(e){if(e[t])return e[t];for(var r=t.split(n),o=e,i=0;i<r.length;++i){if(!o||typeof o[r[i]]=="string"&&i+1<r.length)return;if(o[r[i]]===void 0){for(var s=2,l=r.slice(i,i+s).join(n),a=o[l];a===void 0&&r.length>i+s;)s++,l=r.slice(i,i+s).join(n),a=o[l];if(a===void 0)return;if(a===null)return null;if(t.endsWith(l)){if(typeof a=="string")return a;if(l&&typeof a[l]=="string")return a[l]}var u=r.slice(i+s).join(n);return u?fy(a,u,n):void 0}o=o[r[i]]}return o}}var fT=function(e){Jl(n,e);var t=uT(n);function n(r){var o,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};return vt(this,n),o=t.call(this),ta&&Wn.call(jn(o)),o.data=r||{},o.options=i,o.options.keySeparator===void 0&&(o.options.keySeparator="."),o.options.ignoreJSONStructure===void 0&&(o.options.ignoreJSONStructure=!0),o}return yt(n,[{key:"addNamespaces",value:function(o){this.options.ns.indexOf(o)<0&&this.options.ns.push(o)}},{key:"removeNamespaces",value:function(o){var i=this.options.ns.indexOf(o);i>-1&&this.options.ns.splice(i,1)}},{key:"getResource",value:function(o,i,s){var l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},a=l.keySeparator!==void 0?l.keySeparator:this.options.keySeparator,u=l.ignoreJSONStructure!==void 0?l.ignoreJSONStructure:this.options.ignoreJSONStructure,c=[o,i];s&&typeof s!="string"&&(c=c.concat(s)),s&&typeof s=="string"&&(c=c.concat(a?s.split(a):s)),o.indexOf(".")>-1&&(c=o.split("."));var f=ea(this.data,c);return f||!u||typeof s!="string"?f:fy(this.data&&this.data[o]&&this.data[o][i],s,a)}},{key:"addResource",value:function(o,i,s,l){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1},u=this.options.keySeparator;u===void 0&&(u=".");var c=[o,i];s&&(c=c.concat(u?s.split(u):s)),o.indexOf(".")>-1&&(c=o.split("."),l=i,i=c[1]),this.addNamespaces(i),ly(this.data,c,l),a.silent||this.emit("added",o,i,s,l)}},{key:"addResources",value:function(o,i,s){var l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(var a in s)(typeof s[a]=="string"||Object.prototype.toString.apply(s[a])==="[object Array]")&&this.addResource(o,i,a,s[a],{silent:!0});l.silent||this.emit("added",o,i,s)}},{key:"addResourceBundle",value:function(o,i,s,l,a){var u=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},c=[o,i];o.indexOf(".")>-1&&(c=o.split("."),l=s,s=i,i=c[1]),this.addNamespaces(i);var f=ea(this.data,c)||{};l?uy(f,s,a):f=na(na({},f),s),ly(this.data,c,f),u.silent||this.emit("added",o,i,s)}},{key:"removeResourceBundle",value:function(o,i){this.hasResourceBundle(o,i)&&delete this.data[o][i],this.removeNamespaces(i),this.emit("removed",o,i)}},{key:"hasResourceBundle",value:function(o,i){return this.getResource(o,i)!==void 0}},{key:"getResourceBundle",value:function(o,i){return i||(i=this.options.defaultNS),this.options.compatibilityAPI==="v1"?na(na({},{}),this.getResource(o,i)):this.getResource(o,i)}},{key:"getDataByLanguage",value:function(o){return this.data[o]}},{key:"hasLanguageSomeTranslations",value:function(o){var i=this.getDataByLanguage(o),s=i&&Object.keys(i)||[];return!!s.find(function(l){return i[l]&&Object.keys(i[l]).length>0})}},{key:"toJSON",value:function(){return this.data}}]),n}(Wn),dy={processors:{},addPostProcessor:function(t){this.processors[t.name]=t},handle:function(t,n,r,o,i){var s=this;return t.forEach(function(l){s.processors[l]&&(n=s.processors[l].process(n,r,o,i))}),n}};function py(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function $e(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?py(Object(n),!0).forEach(function(r){pn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):py(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function dT(e){var t=pT();return function(){var r=Wt(e),o;if(t){var i=Wt(this).constructor;o=Reflect.construct(r,arguments,i)}else o=r.apply(this,arguments);return Wi(this,o)}}function pT(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var hy={},gy=function(e){Jl(n,e);var t=dT(n);function n(r){var o,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return vt(this,n),o=t.call(this),ta&&Wn.call(jn(o)),rT(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],r,jn(o)),o.options=i,o.options.keySeparator===void 0&&(o.options.keySeparator="."),o.logger=Gt.create("translator"),o}return yt(n,[{key:"changeLanguage",value:function(o){o&&(this.language=o)}},{key:"exists",value:function(o){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(o==null)return!1;var s=this.resolve(o,i);return s&&s.res!==void 0}},{key:"extractFromKey",value:function(o,i){var s=i.nsSeparator!==void 0?i.nsSeparator:this.options.nsSeparator;s===void 0&&(s=":");var l=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,a=i.ns||this.options.defaultNS||[],u=s&&o.indexOf(s)>-1,c=!this.options.userDefinedKeySeparator&&!i.keySeparator&&!this.options.userDefinedNsSeparator&&!i.nsSeparator&&!aT(o,s,l);if(u&&!c){var f=o.match(this.interpolator.nestingRegexp);if(f&&f.length>0)return{key:o,namespaces:a};var p=o.split(s);(s!==l||s===l&&this.options.ns.indexOf(p[0])>-1)&&(a=p.shift()),o=p.join(l)}return typeof a=="string"&&(a=[a]),{key:o,namespaces:a}}},{key:"translate",value:function(o,i,s){var l=this;if(Dt(i)!=="object"&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),i||(i={}),o==null)return"";Array.isArray(o)||(o=[String(o)]);var a=i.returnDetails!==void 0?i.returnDetails:this.options.returnDetails,u=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,c=this.extractFromKey(o[o.length-1],i),f=c.key,p=c.namespaces,h=p[p.length-1],v=i.lng||this.language,m=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(v&&v.toLowerCase()==="cimode"){if(m){var E=i.nsSeparator||this.options.nsSeparator;return a?{res:"".concat(h).concat(E).concat(f),usedKey:f,exactUsedKey:f,usedLng:v,usedNS:h}:"".concat(h).concat(E).concat(f)}return a?{res:f,usedKey:f,exactUsedKey:f,usedLng:v,usedNS:h}:f}var d=this.resolve(o,i),g=d&&d.res,y=d&&d.usedKey||f,S=d&&d.exactUsedKey||f,w=Object.prototype.toString.apply(g),O=["[object Number]","[object Function]","[object RegExp]"],T=i.joinArrays!==void 0?i.joinArrays:this.options.joinArrays,b=!this.i18nFormat||this.i18nFormat.handleAsObject,P=typeof g!="string"&&typeof g!="boolean"&&typeof g!="number";if(b&&g&&P&&O.indexOf(w)<0&&!(typeof T=="string"&&w==="[object Array]")){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var k=this.options.returnedObjectHandler?this.options.returnedObjectHandler(y,g,$e($e({},i),{},{ns:p})):"key '".concat(f," (").concat(this.language,")' returned an object instead of string.");return a?(d.res=k,d):k}if(u){var B=w==="[object Array]",$=B?[]:{},F=B?S:y;for(var R in g)if(Object.prototype.hasOwnProperty.call(g,R)){var D="".concat(F).concat(u).concat(R);$[R]=this.translate(D,$e($e({},i),{joinArrays:!1,ns:p})),$[R]===D&&($[R]=g[R])}g=$}}else if(b&&typeof T=="string"&&w==="[object Array]")g=g.join(T),g&&(g=this.extendTranslation(g,o,i,s));else{var A=!1,C=!1,x=i.count!==void 0&&typeof i.count!="string",L=n.hasDefaultValue(i),U=x?this.pluralResolver.getSuffix(v,i.count,i):"",z=i["defaultValue".concat(U)]||i.defaultValue;!this.isValidLookup(g)&&L&&(A=!0,g=z),this.isValidLookup(g)||(C=!0,g=f);var j=i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,K=j&&C?void 0:g,Y=L&&z!==g&&this.options.updateMissing;if(C||A||Y){if(this.logger.log(Y?"updateKey":"missingKey",v,h,f,Y?z:g),u){var Z=this.resolve(f,$e($e({},i),{},{keySeparator:!1}));Z&&Z.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var X=[],ee=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ee&&ee[0])for(var oe=0;oe<ee.length;oe++)X.push(ee[oe]);else this.options.saveMissingTo==="all"?X=this.languageUtils.toResolveHierarchy(i.lng||this.language):X.push(i.lng||this.language);var ge=function(Ne,He,ut){var me=L&&ut!==g?ut:K;l.options.missingKeyHandler?l.options.missingKeyHandler(Ne,h,He,me,Y,i):l.backendConnector&&l.backendConnector.saveMissing&&l.backendConnector.saveMissing(Ne,h,He,me,Y,i),l.emit("missingKey",Ne,h,He,g)};this.options.saveMissing&&(this.options.saveMissingPlurals&&x?X.forEach(function(ue){l.pluralResolver.getSuffixes(ue,i).forEach(function(Ne){ge([ue],f+Ne,i["defaultValue".concat(Ne)]||z)})}):ge(X,f,z))}g=this.extendTranslation(g,o,i,d,s),C&&g===f&&this.options.appendNamespaceToMissingKey&&(g="".concat(h,":").concat(f)),(C||A)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?g=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?"".concat(h,":").concat(f):f,A?g:void 0):g=this.options.parseMissingKeyHandler(g))}return a?(d.res=g,d):g}},{key:"extendTranslation",value:function(o,i,s,l,a){var u=this;if(this.i18nFormat&&this.i18nFormat.parse)o=this.i18nFormat.parse(o,$e($e({},this.options.interpolation.defaultVariables),s),l.usedLng,l.usedNS,l.usedKey,{resolved:l});else if(!s.skipInterpolation){s.interpolation&&this.interpolator.init($e($e({},s),{interpolation:$e($e({},this.options.interpolation),s.interpolation)}));var c=typeof o=="string"&&(s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables),f;if(c){var p=o.match(this.interpolator.nestingRegexp);f=p&&p.length}var h=s.replace&&typeof s.replace!="string"?s.replace:s;if(this.options.interpolation.defaultVariables&&(h=$e($e({},this.options.interpolation.defaultVariables),h)),o=this.interpolator.interpolate(o,h,s.lng||this.language,s),c){var v=o.match(this.interpolator.nestingRegexp),m=v&&v.length;f<m&&(s.nest=!1)}s.nest!==!1&&(o=this.interpolator.nest(o,function(){for(var g=arguments.length,y=new Array(g),S=0;S<g;S++)y[S]=arguments[S];return a&&a[0]===y[0]&&!s.context?(u.logger.warn("It seems you are nesting recursively key: ".concat(y[0]," in key: ").concat(i[0])),null):u.translate.apply(u,y.concat([i]))},s)),s.interpolation&&this.interpolator.reset()}var E=s.postProcess||this.options.postProcess,d=typeof E=="string"?[E]:E;return o!=null&&d&&d.length&&s.applyPostProcessor!==!1&&(o=dy.handle(d,o,i,this.options&&this.options.postProcessPassResolved?$e({i18nResolved:l},s):s,this)),o}},{key:"resolve",value:function(o){var i=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},l,a,u,c,f;return typeof o=="string"&&(o=[o]),o.forEach(function(p){if(!i.isValidLookup(l)){var h=i.extractFromKey(p,s),v=h.key;a=v;var m=h.namespaces;i.options.fallbackNS&&(m=m.concat(i.options.fallbackNS));var E=s.count!==void 0&&typeof s.count!="string",d=E&&!s.ordinal&&s.count===0&&i.pluralResolver.shouldUseIntlApi(),g=s.context!==void 0&&(typeof s.context=="string"||typeof s.context=="number")&&s.context!=="",y=s.lngs?s.lngs:i.languageUtils.toResolveHierarchy(s.lng||i.language,s.fallbackLng);m.forEach(function(S){i.isValidLookup(l)||(f=S,!hy["".concat(y[0],"-").concat(S)]&&i.utils&&i.utils.hasLoadedNamespace&&!i.utils.hasLoadedNamespace(f)&&(hy["".concat(y[0],"-").concat(S)]=!0,i.logger.warn('key "'.concat(a,'" for languages "').concat(y.join(", "),`" won't get resolved as namespace "`).concat(f,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),y.forEach(function(w){if(!i.isValidLookup(l)){c=w;var O=[v];if(i.i18nFormat&&i.i18nFormat.addLookupKeys)i.i18nFormat.addLookupKeys(O,v,w,S,s);else{var T;E&&(T=i.pluralResolver.getSuffix(w,s.count,s));var b="".concat(i.options.pluralSeparator,"zero");if(E&&(O.push(v+T),d&&O.push(v+b)),g){var P="".concat(v).concat(i.options.contextSeparator).concat(s.context);O.push(P),E&&(O.push(P+T),d&&O.push(P+b))}}for(var k;k=O.pop();)i.isValidLookup(l)||(u=k,l=i.getResource(w,S,k,s))}}))})}}),{res:l,usedKey:a,exactUsedKey:u,usedLng:c,usedNS:f}}},{key:"isValidLookup",value:function(o){return o!==void 0&&!(!this.options.returnNull&&o===null)&&!(!this.options.returnEmptyString&&o==="")}},{key:"getResource",value:function(o,i,s){var l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(o,i,s,l):this.resourceStore.getResource(o,i,s,l)}}],[{key:"hasDefaultValue",value:function(o){var i="defaultValue";for(var s in o)if(Object.prototype.hasOwnProperty.call(o,s)&&i===s.substring(0,i.length)&&o[s]!==void 0)return!0;return!1}}]),n}(Wn);function Cf(e){return e.charAt(0).toUpperCase()+e.slice(1)}var my=function(){function e(t){vt(this,e),this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Gt.create("languageUtils")}return yt(e,[{key:"getScriptPartFromCode",value:function(n){if(!n||n.indexOf("-")<0)return null;var r=n.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}},{key:"getLanguagePartFromCode",value:function(n){if(!n||n.indexOf("-")<0)return n;var r=n.split("-");return this.formatLanguageCode(r[0])}},{key:"formatLanguageCode",value:function(n){if(typeof n=="string"&&n.indexOf("-")>-1){var r=["hans","hant","latn","cyrl","cans","mong","arab"],o=n.split("-");return this.options.lowerCaseLng?o=o.map(function(i){return i.toLowerCase()}):o.length===2?(o[0]=o[0].toLowerCase(),o[1]=o[1].toUpperCase(),r.indexOf(o[1].toLowerCase())>-1&&(o[1]=Cf(o[1].toLowerCase()))):o.length===3&&(o[0]=o[0].toLowerCase(),o[1].length===2&&(o[1]=o[1].toUpperCase()),o[0]!=="sgn"&&o[2].length===2&&(o[2]=o[2].toUpperCase()),r.indexOf(o[1].toLowerCase())>-1&&(o[1]=Cf(o[1].toLowerCase())),r.indexOf(o[2].toLowerCase())>-1&&(o[2]=Cf(o[2].toLowerCase()))),o.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?n.toLowerCase():n}},{key:"isSupportedCode",value:function(n){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(n=this.getLanguagePartFromCode(n)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(n)>-1}},{key:"getBestMatchFromCodes",value:function(n){var r=this;if(!n)return null;var o;return n.forEach(function(i){if(!o){var s=r.formatLanguageCode(i);(!r.options.supportedLngs||r.isSupportedCode(s))&&(o=s)}}),!o&&this.options.supportedLngs&&n.forEach(function(i){if(!o){var s=r.getLanguagePartFromCode(i);if(r.isSupportedCode(s))return o=s;o=r.options.supportedLngs.find(function(l){if(l.indexOf(s)===0)return l})}}),o||(o=this.getFallbackCodes(this.options.fallbackLng)[0]),o}},{key:"getFallbackCodes",value:function(n,r){if(!n)return[];if(typeof n=="function"&&(n=n(r)),typeof n=="string"&&(n=[n]),Object.prototype.toString.apply(n)==="[object Array]")return n;if(!r)return n.default||[];var o=n[r];return o||(o=n[this.getScriptPartFromCode(r)]),o||(o=n[this.formatLanguageCode(r)]),o||(o=n[this.getLanguagePartFromCode(r)]),o||(o=n.default),o||[]}},{key:"toResolveHierarchy",value:function(n,r){var o=this,i=this.getFallbackCodes(r||this.options.fallbackLng||[],n),s=[],l=function(u){u&&(o.isSupportedCode(u)?s.push(u):o.logger.warn("rejecting language code not found in supportedLngs: ".concat(u)))};return typeof n=="string"&&n.indexOf("-")>-1?(this.options.load!=="languageOnly"&&l(this.formatLanguageCode(n)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&l(this.getScriptPartFromCode(n)),this.options.load!=="currentOnly"&&l(this.getLanguagePartFromCode(n))):typeof n=="string"&&l(this.formatLanguageCode(n)),i.forEach(function(a){s.indexOf(a)<0&&l(o.formatLanguageCode(a))}),s}}]),e}(),hT=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],gT={1:function(t){return Number(t>1)},2:function(t){return Number(t!=1)},3:function(t){return 0},4:function(t){return Number(t%10==1&&t%100!=11?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2)},5:function(t){return Number(t==0?0:t==1?1:t==2?2:t%100>=3&&t%100<=10?3:t%100>=11?4:5)},6:function(t){return Number(t==1?0:t>=2&&t<=4?1:2)},7:function(t){return Number(t==1?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2)},8:function(t){return Number(t==1?0:t==2?1:t!=8&&t!=11?2:3)},9:function(t){return Number(t>=2)},10:function(t){return Number(t==1?0:t==2?1:t<7?2:t<11?3:4)},11:function(t){return Number(t==1||t==11?0:t==2||t==12?1:t>2&&t<20?2:3)},12:function(t){return Number(t%10!=1||t%100==11)},13:function(t){return Number(t!==0)},14:function(t){return Number(t==1?0:t==2?1:t==3?2:3)},15:function(t){return Number(t%10==1&&t%100!=11?0:t%10>=2&&(t%100<10||t%100>=20)?1:2)},16:function(t){return Number(t%10==1&&t%100!=11?0:t!==0?1:2)},17:function(t){return Number(t==1||t%10==1&&t%100!=11?0:1)},18:function(t){return Number(t==0?0:t==1?1:2)},19:function(t){return Number(t==1?0:t==0||t%100>1&&t%100<11?1:t%100>10&&t%100<20?2:3)},20:function(t){return Number(t==1?0:t==0||t%100>0&&t%100<20?1:2)},21:function(t){return Number(t%100==1?1:t%100==2?2:t%100==3||t%100==4?3:0)},22:function(t){return Number(t==1?0:t==2?1:(t<0||t>10)&&t%10==0?2:3)}},mT=["v1","v2","v3"],vy={zero:0,one:1,two:2,few:3,many:4,other:5};function vT(){var e={};return hT.forEach(function(t){t.lngs.forEach(function(n){e[n]={numbers:t.nr,plurals:gT[t.fc]}})}),e}var yT=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};vt(this,e),this.languageUtils=t,this.options=n,this.logger=Gt.create("pluralResolver"),(!this.options.compatibilityJSON||this.options.compatibilityJSON==="v4")&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=vT()}return yt(e,[{key:"addRule",value:function(n,r){this.rules[n]=r}},{key:"getRule",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(n,{type:r.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[n]||this.rules[this.languageUtils.getLanguagePartFromCode(n)]}},{key:"needsPlural",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=this.getRule(n,r);return this.shouldUseIntlApi()?o&&o.resolvedOptions().pluralCategories.length>1:o&&o.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(n,r){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(n,o).map(function(i){return"".concat(r).concat(i)})}},{key:"getSuffixes",value:function(n){var r=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=this.getRule(n,o);return i?this.shouldUseIntlApi()?i.resolvedOptions().pluralCategories.sort(function(s,l){return vy[s]-vy[l]}).map(function(s){return"".concat(r.options.prepend).concat(s)}):i.numbers.map(function(s){return r.getSuffix(n,s,o)}):[]}},{key:"getSuffix",value:function(n,r){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=this.getRule(n,o);return i?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(i.select(r)):this.getSuffixRetroCompatible(i,r):(this.logger.warn("no plural rule found for: ".concat(n)),"")}},{key:"getSuffixRetroCompatible",value:function(n,r){var o=this,i=n.noAbs?n.plurals(r):n.plurals(Math.abs(r)),s=n.numbers[i];this.options.simplifyPluralSuffix&&n.numbers.length===2&&n.numbers[0]===1&&(s===2?s="plural":s===1&&(s=""));var l=function(){return o.options.prepend&&s.toString()?o.options.prepend+s.toString():s.toString()};return this.options.compatibilityJSON==="v1"?s===1?"":typeof s=="number"?"_plural_".concat(s.toString()):l():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&n.numbers.length===2&&n.numbers[0]===1?l():this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString()}},{key:"shouldUseIntlApi",value:function(){return!mT.includes(this.options.compatibilityJSON)}}]),e}();function yy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function kt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?yy(Object(n),!0).forEach(function(r){pn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yy(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ET=function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};vt(this,e),this.logger=Gt.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(n){return n},this.init(t)}return yt(e,[{key:"init",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};n.interpolation||(n.interpolation={escapeValue:!0});var r=n.interpolation;this.escape=r.escape!==void 0?r.escape:sT,this.escapeValue=r.escapeValue!==void 0?r.escapeValue:!0,this.useRawValueToEscape=r.useRawValueToEscape!==void 0?r.useRawValueToEscape:!1,this.prefix=r.prefix?xo(r.prefix):r.prefixEscaped||"{{",this.suffix=r.suffix?xo(r.suffix):r.suffixEscaped||"}}",this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||",",this.unescapePrefix=r.unescapeSuffix?"":r.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":r.unescapeSuffix||"",this.nestingPrefix=r.nestingPrefix?xo(r.nestingPrefix):r.nestingPrefixEscaped||xo("$t("),this.nestingSuffix=r.nestingSuffix?xo(r.nestingSuffix):r.nestingSuffixEscaped||xo(")"),this.nestingOptionsSeparator=r.nestingOptionsSeparator?r.nestingOptionsSeparator:r.nestingOptionsSeparator||",",this.maxReplaces=r.maxReplaces?r.maxReplaces:1e3,this.alwaysFormat=r.alwaysFormat!==void 0?r.alwaysFormat:!1,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var n="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(n,"g");var r="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(r,"g");var o="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(o,"g")}},{key:"interpolate",value:function(n,r,o,i){var s=this,l,a,u,c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function f(E){return E.replace(/\$/g,"$$$$")}var p=function(d){if(d.indexOf(s.formatSeparator)<0){var g=ay(r,c,d);return s.alwaysFormat?s.format(g,void 0,o,kt(kt(kt({},i),r),{},{interpolationkey:d})):g}var y=d.split(s.formatSeparator),S=y.shift().trim(),w=y.join(s.formatSeparator).trim();return s.format(ay(r,c,S),w,o,kt(kt(kt({},i),r),{},{interpolationkey:S}))};this.resetRegExp();var h=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,v=i&&i.interpolation&&i.interpolation.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables,m=[{regex:this.regexpUnescape,safeValue:function(d){return f(d)}},{regex:this.regexp,safeValue:function(d){return s.escapeValue?f(s.escape(d)):f(d)}}];return m.forEach(function(E){for(u=0;l=E.regex.exec(n);){var d=l[1].trim();if(a=p(d),a===void 0)if(typeof h=="function"){var g=h(n,l,i);a=typeof g=="string"?g:""}else if(i&&Object.prototype.hasOwnProperty.call(i,d))a="";else if(v){a=l[0];continue}else s.logger.warn("missed to pass in variable ".concat(d," for interpolating ").concat(n)),a="";else typeof a!="string"&&!s.useRawValueToEscape&&(a=sy(a));var y=E.safeValue(a);if(n=n.replace(l[0],y),v?(E.regex.lastIndex+=a.length,E.regex.lastIndex-=l[0].length):E.regex.lastIndex=0,u++,u>=s.maxReplaces)break}}),n}},{key:"nest",value:function(n,r){var o=this,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s,l,a;function u(h,v){var m=this.nestingOptionsSeparator;if(h.indexOf(m)<0)return h;var E=h.split(new RegExp("".concat(m,"[ ]*{"))),d="{".concat(E[1]);h=E[0],d=this.interpolate(d,a);var g=d.match(/'/g),y=d.match(/"/g);(g&&g.length%2===0&&!y||y.length%2!==0)&&(d=d.replace(/'/g,'"'));try{a=JSON.parse(d),v&&(a=kt(kt({},v),a))}catch(S){return this.logger.warn("failed parsing options string in nesting for key ".concat(h),S),"".concat(h).concat(m).concat(d)}return delete a.defaultValue,h}for(;s=this.nestingRegexp.exec(n);){var c=[];a=kt({},i),a=a.replace&&typeof a.replace!="string"?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;var f=!1;if(s[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(s[1])){var p=s[1].split(this.formatSeparator).map(function(h){return h.trim()});s[1]=p.shift(),c=p,f=!0}if(l=r(u.call(this,s[1].trim(),a),a),l&&s[0]===n&&typeof l!="string")return l;typeof l!="string"&&(l=sy(l)),l||(this.logger.warn("missed to resolve ".concat(s[1]," for nesting ").concat(n)),l=""),f&&(l=c.reduce(function(h,v){return o.format(h,v,i.lng,kt(kt({},i),{},{interpolationkey:s[1].trim()}))},l.trim())),n=n.replace(s[0],l),this.regexp.lastIndex=0}return n}}]),e}();function Ey(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function hn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ey(Object(n),!0).forEach(function(r){pn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ey(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ST(e){var t=e.toLowerCase().trim(),n={};if(e.indexOf("(")>-1){var r=e.split("(");t=r[0].toLowerCase().trim();var o=r[1].substring(0,r[1].length-1);if(t==="currency"&&o.indexOf(":")<0)n.currency||(n.currency=o.trim());else if(t==="relativetime"&&o.indexOf(":")<0)n.range||(n.range=o.trim());else{var i=o.split(";");i.forEach(function(s){if(s){var l=s.split(":"),a=eT(l),u=a[0],c=a.slice(1),f=c.join(":").trim().replace(/^'+|'+$/g,"");n[u.trim()]||(n[u.trim()]=f),f==="false"&&(n[u.trim()]=!1),f==="true"&&(n[u.trim()]=!0),isNaN(f)||(n[u.trim()]=parseInt(f,10))}})}}return{formatName:t,formatOptions:n}}function To(e){var t={};return function(r,o,i){var s=o+JSON.stringify(i),l=t[s];return l||(l=e(o,i),t[s]=l),l(r)}}var _T=function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};vt(this,e),this.logger=Gt.create("formatter"),this.options=t,this.formats={number:To(function(n,r){var o=new Intl.NumberFormat(n,hn({},r));return function(i){return o.format(i)}}),currency:To(function(n,r){var o=new Intl.NumberFormat(n,hn(hn({},r),{},{style:"currency"}));return function(i){return o.format(i)}}),datetime:To(function(n,r){var o=new Intl.DateTimeFormat(n,hn({},r));return function(i){return o.format(i)}}),relativetime:To(function(n,r){var o=new Intl.RelativeTimeFormat(n,hn({},r));return function(i){return o.format(i,r.range||"day")}}),list:To(function(n,r){var o=new Intl.ListFormat(n,hn({},r));return function(i){return o.format(i)}})},this.init(t)}return yt(e,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}},o=r.interpolation;this.formatSeparator=o.formatSeparator?o.formatSeparator:o.formatSeparator||","}},{key:"add",value:function(n,r){this.formats[n.toLowerCase().trim()]=r}},{key:"addCached",value:function(n,r){this.formats[n.toLowerCase().trim()]=To(r)}},{key:"format",value:function(n,r,o){var i=this,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},l=r.split(this.formatSeparator),a=l.reduce(function(u,c){var f=ST(c),p=f.formatName,h=f.formatOptions;if(i.formats[p]){var v=u;try{var m=s&&s.formatParams&&s.formatParams[s.interpolationkey]||{},E=m.locale||m.lng||s.locale||s.lng||o;v=i.formats[p](u,E,hn(hn(hn({},h),s),m))}catch(d){i.logger.warn(d)}return v}else i.logger.warn("there was no format function for ".concat(p));return u},n);return a}}]),e}();function Sy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function _y(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Sy(Object(n),!0).forEach(function(r){pn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Sy(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function wT(e){var t=RT();return function(){var r=Wt(e),o;if(t){var i=Wt(this).constructor;o=Reflect.construct(r,arguments,i)}else o=r.apply(this,arguments);return Wi(this,o)}}function RT(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function NT(e,t){e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)}var OT=function(e){Jl(n,e);var t=wT(n);function n(r,o,i){var s,l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return vt(this,n),s=t.call(this),ta&&Wn.call(jn(s)),s.backend=r,s.store=o,s.services=i,s.languageUtils=i.languageUtils,s.options=l,s.logger=Gt.create("backendConnector"),s.waitingReads=[],s.maxParallelReads=l.maxParallelReads||10,s.readingCalls=0,s.maxRetries=l.maxRetries>=0?l.maxRetries:5,s.retryTimeout=l.retryTimeout>=1?l.retryTimeout:350,s.state={},s.queue=[],s.backend&&s.backend.init&&s.backend.init(i,l.backend,l),s}return yt(n,[{key:"queueLoad",value:function(o,i,s,l){var a=this,u={},c={},f={},p={};return o.forEach(function(h){var v=!0;i.forEach(function(m){var E="".concat(h,"|").concat(m);!s.reload&&a.store.hasResourceBundle(h,m)?a.state[E]=2:a.state[E]<0||(a.state[E]===1?c[E]===void 0&&(c[E]=!0):(a.state[E]=1,v=!1,c[E]===void 0&&(c[E]=!0),u[E]===void 0&&(u[E]=!0),p[m]===void 0&&(p[m]=!0)))}),v||(f[h]=!0)}),(Object.keys(u).length||Object.keys(c).length)&&this.queue.push({pending:c,pendingCount:Object.keys(c).length,loaded:{},errors:[],callback:l}),{toLoad:Object.keys(u),pending:Object.keys(c),toLoadLanguages:Object.keys(f),toLoadNamespaces:Object.keys(p)}}},{key:"loaded",value:function(o,i,s){var l=o.split("|"),a=l[0],u=l[1];i&&this.emit("failedLoading",a,u,i),s&&this.store.addResourceBundle(a,u,s),this.state[o]=i?-1:2;var c={};this.queue.forEach(function(f){oT(f.loaded,[a],u),NT(f,o),i&&f.errors.push(i),f.pendingCount===0&&!f.done&&(Object.keys(f.loaded).forEach(function(p){c[p]||(c[p]={});var h=f.loaded[p];h.length&&h.forEach(function(v){c[p][v]===void 0&&(c[p][v]=!0)})}),f.done=!0,f.errors.length?f.callback(f.errors):f.callback())}),this.emit("loaded",c),this.queue=this.queue.filter(function(f){return!f.done})}},{key:"read",value:function(o,i,s){var l=this,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,u=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,c=arguments.length>5?arguments[5]:void 0;if(!o.length)return c(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:o,ns:i,fcName:s,tried:a,wait:u,callback:c});return}this.readingCalls++;var f=function(m,E){if(l.readingCalls--,l.waitingReads.length>0){var d=l.waitingReads.shift();l.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(m&&E&&a<l.maxRetries){setTimeout(function(){l.read.call(l,o,i,s,a+1,u*2,c)},u);return}c(m,E)},p=this.backend[s].bind(this.backend);if(p.length===2){try{var h=p(o,i);h&&typeof h.then=="function"?h.then(function(v){return f(null,v)}).catch(f):f(null,h)}catch(v){f(v)}return}return p(o,i,f)}},{key:"prepareLoading",value:function(o,i){var s=this,l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),a&&a();typeof o=="string"&&(o=this.languageUtils.toResolveHierarchy(o)),typeof i=="string"&&(i=[i]);var u=this.queueLoad(o,i,l,a);if(!u.toLoad.length)return u.pending.length||a(),null;u.toLoad.forEach(function(c){s.loadOne(c)})}},{key:"load",value:function(o,i,s){this.prepareLoading(o,i,{},s)}},{key:"reload",value:function(o,i,s){this.prepareLoading(o,i,{reload:!0},s)}},{key:"loadOne",value:function(o){var i=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",l=o.split("|"),a=l[0],u=l[1];this.read(a,u,"read",void 0,void 0,function(c,f){c&&i.logger.warn("".concat(s,"loading namespace ").concat(u," for language ").concat(a," failed"),c),!c&&f&&i.logger.log("".concat(s,"loaded namespace ").concat(u," for language ").concat(a),f),i.loaded(o,c,f)})}},{key:"saveMissing",value:function(o,i,s,l,a){var u=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},c=arguments.length>6&&arguments[6]!==void 0?arguments[6]:function(){};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(i)){this.logger.warn('did not save key "'.concat(s,'" as the namespace "').concat(i,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(s==null||s==="")){if(this.backend&&this.backend.create){var f=_y(_y({},u),{},{isUpdate:a}),p=this.backend.create.bind(this.backend);if(p.length<6)try{var h;p.length===5?h=p(o,i,s,l,f):h=p(o,i,s,l),h&&typeof h.then=="function"?h.then(function(v){return c(null,v)}).catch(c):c(null,h)}catch(v){c(v)}else p(o,i,s,l,c,f)}!o||!o[0]||this.store.addResource(o[0],i,s,l)}}}]),n}(Wn);function wy(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(t){var n={};if(Dt(t[1])==="object"&&(n=t[1]),typeof t[1]=="string"&&(n.defaultValue=t[1]),typeof t[2]=="string"&&(n.tDescription=t[2]),Dt(t[2])==="object"||Dt(t[3])==="object"){var r=t[3]||t[2];Object.keys(r).forEach(function(o){n[o]=r[o]})}return n},interpolation:{escapeValue:!0,format:function(t,n,r,o){return t},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function Ry(e){return typeof e.ns=="string"&&(e.ns=[e.ns]),typeof e.fallbackLng=="string"&&(e.fallbackLng=[e.fallbackLng]),typeof e.fallbackNS=="string"&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function Ny(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Yt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ny(Object(n),!0).forEach(function(r){pn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ny(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function xT(e){var t=TT();return function(){var r=Wt(e),o;if(t){var i=Wt(this).constructor;o=Reflect.construct(r,arguments,i)}else o=r.apply(this,arguments);return Wi(this,o)}}function TT(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ra(){}function IT(e){var t=Object.getOwnPropertyNames(Object.getPrototypeOf(e));t.forEach(function(n){typeof e[n]=="function"&&(e[n]=e[n].bind(e))})}var oa=function(e){Jl(n,e);var t=xT(n);function n(){var r,o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;if(vt(this,n),r=t.call(this),ta&&Wn.call(jn(r)),r.options=Ry(o),r.services={},r.logger=Gt,r.modules={external:[]},IT(jn(r)),i&&!r.isInitialized&&!o.isClone){if(!r.options.initImmediate)return r.init(o,i),Wi(r,jn(r));setTimeout(function(){r.init(o,i)},0)}return r}return yt(n,[{key:"init",value:function(){var o=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;typeof i=="function"&&(s=i,i={}),!i.defaultNS&&i.defaultNS!==!1&&i.ns&&(typeof i.ns=="string"?i.defaultNS=i.ns:i.ns.indexOf("translation")<0&&(i.defaultNS=i.ns[0]));var l=wy();this.options=Yt(Yt(Yt({},l),this.options),Ry(i)),this.options.compatibilityAPI!=="v1"&&(this.options.interpolation=Yt(Yt({},l.interpolation),this.options.interpolation)),i.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=i.keySeparator),i.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=i.nsSeparator);function a(d){return d?typeof d=="function"?new d:d:null}if(!this.options.isClone){this.modules.logger?Gt.init(a(this.modules.logger),this.options):Gt.init(null,this.options);var u;this.modules.formatter?u=this.modules.formatter:typeof Intl<"u"&&(u=_T);var c=new my(this.options);this.store=new fT(this.options.resources,this.options);var f=this.services;f.logger=Gt,f.resourceStore=this.store,f.languageUtils=c,f.pluralResolver=new yT(c,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),u&&(!this.options.interpolation.format||this.options.interpolation.format===l.interpolation.format)&&(f.formatter=a(u),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new ET(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new OT(a(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(d){for(var g=arguments.length,y=new Array(g>1?g-1:0),S=1;S<g;S++)y[S-1]=arguments[S];o.emit.apply(o,[d].concat(y))}),this.modules.languageDetector&&(f.languageDetector=a(this.modules.languageDetector),f.languageDetector.init&&f.languageDetector.init(f,this.options.detection,this.options)),this.modules.i18nFormat&&(f.i18nFormat=a(this.modules.i18nFormat),f.i18nFormat.init&&f.i18nFormat.init(this)),this.translator=new gy(this.services,this.options),this.translator.on("*",function(d){for(var g=arguments.length,y=new Array(g>1?g-1:0),S=1;S<g;S++)y[S-1]=arguments[S];o.emit.apply(o,[d].concat(y))}),this.modules.external.forEach(function(d){d.init&&d.init(o)})}if(this.format=this.options.interpolation.format,s||(s=ra),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){var p=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);p.length>0&&p[0]!=="dev"&&(this.options.lng=p[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined");var h=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];h.forEach(function(d){o[d]=function(){var g;return(g=o.store)[d].apply(g,arguments)}});var v=["addResource","addResources","addResourceBundle","removeResourceBundle"];v.forEach(function(d){o[d]=function(){var g;return(g=o.store)[d].apply(g,arguments),o}});var m=Gi(),E=function(){var g=function(S,w){o.isInitialized&&!o.initializedStoreOnce&&o.logger.warn("init: i18next is already initialized. You should call init just once!"),o.isInitialized=!0,o.options.isClone||o.logger.log("initialized",o.options),o.emit("initialized",o.options),m.resolve(w),s(S,w)};if(o.languages&&o.options.compatibilityAPI!=="v1"&&!o.isInitialized)return g(null,o.t.bind(o));o.changeLanguage(o.options.lng,g)};return this.options.resources||!this.options.initImmediate?E():setTimeout(E,0),m}},{key:"loadResources",value:function(o){var i=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ra,l=s,a=typeof o=="string"?o:this.language;if(typeof o=="function"&&(l=o),!this.options.resources||this.options.partialBundledLanguages){if(a&&a.toLowerCase()==="cimode")return l();var u=[],c=function(h){if(h){var v=i.services.languageUtils.toResolveHierarchy(h);v.forEach(function(m){u.indexOf(m)<0&&u.push(m)})}};if(a)c(a);else{var f=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);f.forEach(function(p){return c(p)})}this.options.preload&&this.options.preload.forEach(function(p){return c(p)}),this.services.backendConnector.load(u,this.options.ns,function(p){!p&&!i.resolvedLanguage&&i.language&&i.setResolvedLanguage(i.language),l(p)})}else l(null)}},{key:"reloadResources",value:function(o,i,s){var l=Gi();return o||(o=this.languages),i||(i=this.options.ns),s||(s=ra),this.services.backendConnector.reload(o,i,function(a){l.resolve(),s(a)}),l}},{key:"use",value:function(o){if(!o)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!o.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return o.type==="backend"&&(this.modules.backend=o),(o.type==="logger"||o.log&&o.warn&&o.error)&&(this.modules.logger=o),o.type==="languageDetector"&&(this.modules.languageDetector=o),o.type==="i18nFormat"&&(this.modules.i18nFormat=o),o.type==="postProcessor"&&dy.addPostProcessor(o),o.type==="formatter"&&(this.modules.formatter=o),o.type==="3rdParty"&&this.modules.external.push(o),this}},{key:"setResolvedLanguage",value:function(o){if(!(!o||!this.languages)&&!(["cimode","dev"].indexOf(o)>-1))for(var i=0;i<this.languages.length;i++){var s=this.languages[i];if(!(["cimode","dev"].indexOf(s)>-1)&&this.store.hasLanguageSomeTranslations(s)){this.resolvedLanguage=s;break}}}},{key:"changeLanguage",value:function(o,i){var s=this;this.isLanguageChangingTo=o;var l=Gi();this.emit("languageChanging",o);var a=function(p){s.language=p,s.languages=s.services.languageUtils.toResolveHierarchy(p),s.resolvedLanguage=void 0,s.setResolvedLanguage(p)},u=function(p,h){h?(a(h),s.translator.changeLanguage(h),s.isLanguageChangingTo=void 0,s.emit("languageChanged",h),s.logger.log("languageChanged",h)):s.isLanguageChangingTo=void 0,l.resolve(function(){return s.t.apply(s,arguments)}),i&&i(p,function(){return s.t.apply(s,arguments)})},c=function(p){!o&&!p&&s.services.languageDetector&&(p=[]);var h=typeof p=="string"?p:s.services.languageUtils.getBestMatchFromCodes(p);h&&(s.language||a(h),s.translator.language||s.translator.changeLanguage(h),s.services.languageDetector&&s.services.languageDetector.cacheUserLanguage&&s.services.languageDetector.cacheUserLanguage(h)),s.loadResources(h,function(v){u(v,h)})};return!o&&this.services.languageDetector&&!this.services.languageDetector.async?c(this.services.languageDetector.detect()):!o&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(c):this.services.languageDetector.detect(c):c(o),l}},{key:"getFixedT",value:function(o,i,s){var l=this,a=function u(c,f){var p;if(Dt(f)!=="object"){for(var h=arguments.length,v=new Array(h>2?h-2:0),m=2;m<h;m++)v[m-2]=arguments[m];p=l.options.overloadTranslationOptionHandler([c,f].concat(v))}else p=Yt({},f);p.lng=p.lng||u.lng,p.lngs=p.lngs||u.lngs,p.ns=p.ns||u.ns,p.keyPrefix=p.keyPrefix||s||u.keyPrefix;var E=l.options.keySeparator||".",d;return p.keyPrefix&&Array.isArray(c)?d=c.map(function(g){return"".concat(p.keyPrefix).concat(E).concat(g)}):d=p.keyPrefix?"".concat(p.keyPrefix).concat(E).concat(c):c,l.t(d,p)};return typeof o=="string"?a.lng=o:a.lngs=o,a.ns=i,a.keyPrefix=s,a}},{key:"t",value:function(){var o;return this.translator&&(o=this.translator).translate.apply(o,arguments)}},{key:"exists",value:function(){var o;return this.translator&&(o=this.translator).exists.apply(o,arguments)}},{key:"setDefaultNamespace",value:function(o){this.options.defaultNS=o}},{key:"hasLoadedNamespace",value:function(o){var i=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var l=this.resolvedLanguage||this.languages[0],a=this.options?this.options.fallbackLng:!1,u=this.languages[this.languages.length-1];if(l.toLowerCase()==="cimode")return!0;var c=function(h,v){var m=i.services.backendConnector.state["".concat(h,"|").concat(v)];return m===-1||m===2};if(s.precheck){var f=s.precheck(this,c);if(f!==void 0)return f}return!!(this.hasResourceBundle(l,o)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||c(l,o)&&(!a||c(u,o)))}},{key:"loadNamespaces",value:function(o,i){var s=this,l=Gi();return this.options.ns?(typeof o=="string"&&(o=[o]),o.forEach(function(a){s.options.ns.indexOf(a)<0&&s.options.ns.push(a)}),this.loadResources(function(a){l.resolve(),i&&i(a)}),l):(i&&i(),Promise.resolve())}},{key:"loadLanguages",value:function(o,i){var s=Gi();typeof o=="string"&&(o=[o]);var l=this.options.preload||[],a=o.filter(function(u){return l.indexOf(u)<0});return a.length?(this.options.preload=l.concat(a),this.loadResources(function(u){s.resolve(),i&&i(u)}),s):(i&&i(),Promise.resolve())}},{key:"dir",value:function(o){if(o||(o=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!o)return"rtl";var i=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],s=this.services&&this.services.languageUtils||new my(wy());return i.indexOf(s.getLanguagePartFromCode(o))>-1||o.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var o=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ra,l=Yt(Yt(Yt({},this.options),i),{isClone:!0}),a=new n(l);(i.debug!==void 0||i.prefix!==void 0)&&(a.logger=a.logger.clone(i));var u=["store","services","language"];return u.forEach(function(c){a[c]=o[c]}),a.services=Yt({},this.services),a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a.translator=new gy(a.services,a.options),a.translator.on("*",function(c){for(var f=arguments.length,p=new Array(f>1?f-1:0),h=1;h<f;h++)p[h-1]=arguments[h];a.emit.apply(a,[c].concat(p))}),a.init(l,s),a.translator.options=a.options,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}},{key:"toJSON",value:function(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}]),n}(Wn);pn(oa,"createInstance",function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return new oa(e,t)});var Te=oa.createInstance();Te.createInstance=oa.createInstance,Te.createInstance,Te.dir,Te.init,Te.loadResources,Te.reloadResources,Te.use,Te.changeLanguage,Te.getFixedT,Te.t,Te.exists,Te.setDefaultNamespace,Te.hasLoadedNamespace,Te.loadNamespaces,Te.loadLanguages;var Oy=[],CT=Oy.forEach,AT=Oy.slice;function bT(e){return CT.call(AT.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e}var xy=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,LT=function(t,n,r){var o=r||{};o.path=o.path||"/";var i=encodeURIComponent(n),s="".concat(t,"=").concat(i);if(o.maxAge>0){var l=o.maxAge-0;if(Number.isNaN(l))throw new Error("maxAge should be a Number");s+="; Max-Age=".concat(Math.floor(l))}if(o.domain){if(!xy.test(o.domain))throw new TypeError("option domain is invalid");s+="; Domain=".concat(o.domain)}if(o.path){if(!xy.test(o.path))throw new TypeError("option path is invalid");s+="; Path=".concat(o.path)}if(o.expires){if(typeof o.expires.toUTCString!="function")throw new TypeError("option expires is invalid");s+="; Expires=".concat(o.expires.toUTCString())}if(o.httpOnly&&(s+="; HttpOnly"),o.secure&&(s+="; Secure"),o.sameSite){var a=typeof o.sameSite=="string"?o.sameSite.toLowerCase():o.sameSite;switch(a){case!0:s+="; SameSite=Strict";break;case"lax":s+="; SameSite=Lax";break;case"strict":s+="; SameSite=Strict";break;case"none":s+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return s},Ty={create:function(t,n,r,o){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(i.expires=new Date,i.expires.setTime(i.expires.getTime()+r*60*1e3)),o&&(i.domain=o),document.cookie=LT(t,encodeURIComponent(n),i)},read:function(t){for(var n="".concat(t,"="),r=document.cookie.split(";"),o=0;o<r.length;o++){for(var i=r[o];i.charAt(0)===" ";)i=i.substring(1,i.length);if(i.indexOf(n)===0)return i.substring(n.length,i.length)}return null},remove:function(t){this.create(t,"",-1)}},DT={name:"cookie",lookup:function(t){var n;if(t.lookupCookie&&typeof document<"u"){var r=Ty.read(t.lookupCookie);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupCookie&&typeof document<"u"&&Ty.create(n.lookupCookie,t,n.cookieMinutes,n.cookieDomain,n.cookieOptions)}},kT={name:"querystring",lookup:function(t){var n;if(typeof window<"u"){var r=window.location.search;!window.location.search&&window.location.hash&&window.location.hash.indexOf("?")>-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));for(var o=r.substring(1),i=o.split("&"),s=0;s<i.length;s++){var l=i[s].indexOf("=");if(l>0){var a=i[s].substring(0,l);a===t.lookupQuerystring&&(n=i[s].substring(l+1))}}}return n}},Yi=null,Iy=function(){if(Yi!==null)return Yi;try{Yi=window!=="undefined"&&window.localStorage!==null;var t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{Yi=!1}return Yi},PT={name:"localStorage",lookup:function(t){var n;if(t.lookupLocalStorage&&Iy()){var r=window.localStorage.getItem(t.lookupLocalStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupLocalStorage&&Iy()&&window.localStorage.setItem(n.lookupLocalStorage,t)}},Ki=null,Cy=function(){if(Ki!==null)return Ki;try{Ki=window!=="undefined"&&window.sessionStorage!==null;var t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{Ki=!1}return Ki},MT={name:"sessionStorage",lookup:function(t){var n;if(t.lookupSessionStorage&&Cy()){var r=window.sessionStorage.getItem(t.lookupSessionStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupSessionStorage&&Cy()&&window.sessionStorage.setItem(n.lookupSessionStorage,t)}},UT={name:"navigator",lookup:function(t){var n=[];if(typeof navigator<"u"){if(navigator.languages)for(var r=0;r<navigator.languages.length;r++)n.push(navigator.languages[r]);navigator.userLanguage&&n.push(navigator.userLanguage),navigator.language&&n.push(navigator.language)}return n.length>0?n:void 0}},FT={name:"htmlTag",lookup:function(t){var n,r=t.htmlTag||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(n=r.getAttribute("lang")),n}},VT={name:"path",lookup:function(t){var n;if(typeof window<"u"){var r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(r instanceof Array)if(typeof t.lookupFromPathIndex=="number"){if(typeof r[t.lookupFromPathIndex]!="string")return;n=r[t.lookupFromPathIndex].replace("/","")}else n=r[0].replace("/","")}return n}},BT={name:"subdomain",lookup:function(t){var n=typeof t.lookupFromSubdomainIndex=="number"?t.lookupFromSubdomainIndex+1:1,r=typeof window<"u"&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(r)return r[n]}};function $T(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"]}}var Ay=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};vt(this,e),this.type="languageDetector",this.detectors={},this.init(t,n)}return yt(e,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n,this.options=bT(r,this.options||{},$T()),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=o,this.addDetector(DT),this.addDetector(kT),this.addDetector(PT),this.addDetector(MT),this.addDetector(UT),this.addDetector(FT),this.addDetector(VT),this.addDetector(BT)}},{key:"addDetector",value:function(n){this.detectors[n.name]=n}},{key:"detect",value:function(n){var r=this;n||(n=this.options.order);var o=[];return n.forEach(function(i){if(r.detectors[i]){var s=r.detectors[i].lookup(r.options);s&&typeof s=="string"&&(s=[s]),s&&(o=o.concat(s))}}),this.services.languageUtils.getBestMatchFromCodes?o:o.length>0?o[0]:null}},{key:"cacheUserLanguage",value:function(n,r){var o=this;r||(r=this.options.caches),r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(n)>-1||r.forEach(function(i){o.detectors[i]&&o.detectors[i].cacheUserLanguage(n,o.options)}))}}]),e}();Ay.type="languageDetector";var zT=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,HT={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},jT=function(t){return HT[t]},WT=function(t){return t.replace(zT,jT)};function by(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Ly(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?by(Object(n),!0).forEach(function(r){pn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):by(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Dy={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:WT};function GT(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Dy=Ly(Ly({},Dy),e)}var YT={type:"3rdParty",init:function(t){GT(t.options.react)}};N.createContext(),function(){function e(){vt(this,e),this.usedNamespaces={}}return yt(e,[{key:"addUsedNamespaces",value:function(n){var r=this;n.forEach(function(o){r.usedNamespaces[o]||(r.usedNamespaces[o]=!0)})}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}]),e}();const KT={ABOUT:"About",ACTION:"Action",ADD_CONDITION:"Add Condition",ADD_OPTION:"Add Option",ADD_VARIABLE:"Add Variable",ANSWER_CALL:"Answer Call",ANSWERED:"Answered",API_VERSION:"API Version",APP_VERSION:"App Version",BEEP_SUBTITLE:"Play a beep before recording",BEEP:"Beep",BUILDER_VERSION:"Builder Version",BUSY:"Busy",CALL_ADDRESSES:"Call Addresses",CALL_NUMBERS:"Call Numbers",CALL_RESOURCES:"Call Resources",CALLER_PRESSES:"Caller Presses",CHOOSE_OPTION_SINGLE_MULTIPLE:"Choose single or multiple",CHOOSE_OPTION_TTS_AUDIO:"Choose how to play the message",CLOSE:"Close",COND_NUMBER:"Cond {{index}}",CONDITION_NUMBER:"Condition {{index}}",CONDITIONS:"Conditions",DECISION:"Decision",DECLINE:"Decline",DISCONNECT_CALL_AFTER_RINGING:"Disconnect call after ringing",ELSE:"Else",ENTER_URL:"Enter URL",ERROR_ADD_RECORDING_FIRST:"Please add a Start Call Recording node first.",ERROR_DUPLICATE_RECORDING_LABEL:"This entry already exists. Please use a unique label.",ERROR_DUPLICATE_VARIABLE_KEY:"This variable already exists. Please use a unique key.",ERROR_INVALID_JSON:"Invalid JSON",ERROR_NUMBER_IS_REQUIRED:"A number is required.",ERROR_NUMBER_MIN_MAX_IS_REQUIRED:"A number between {{min}} and {{max}} is required.",ERROR_RECORDING_LABEL_REQUIRED:"A value is required. Maximum 20 characters.",ERROR_STRING_VALUE_REQUIRED:"Invalid character. String value is required.",ERROR_TELEPHONE_KEY_REQUIRED:"A value of 0-9, *, or # is required.",ERROR_TERMINATORS:"This value should contain only 0-9, *, or #.",ERROR_TEXT_IS_REQUIRED:"A text value is required.",ERROR_URL_IS_REQUIRED:"A valid URL is required.",ERROR_VALUE_IS_REQUIRED:"A value is required.",ERROR_VARIABLE_KEY_REQUIRED:"Valid characters are lowercase letters, digits, or underscore. Maximum 20 characters.",ERROR:"Error",FAILED:"Failed",FAILURE:"Failure",FORMAT:"Format",FORWARD_TO_ADDRESS:"Forward to Address",FORWARD_TO_PHONE:"Forward to Phone",FORWARD_TO_RESOURCE:"Forward to Resource",FORWARD:"Forward",FROM_PHONE_NUMBER:"From Phone Number",FROM:"From",GATHER_INPUT:"Gather Input",HANDLE_CALL:"Handle Call",HANG_UP_CALL:"Hang Up Call",HANG_UP:"Hang Up",INFO_NODE_ANSWER:"This is the info text for the Answer node.",INFO_NODE_COND:"This is the info text for the Conditions node.",INFO_NODE_FORWARD_TO_ADDRESS:"This is the info text for the Forward to Address node.",INFO_NODE_FORWARD_TO_PHONE:"This is the info text for the Forward to Phone node.",INFO_NODE_FORWARD_TO_RESOURCE:"This is the info text for the Forward to Resource node.",INFO_NODE_GATHER_INPUT:"This is the info text for the Gather Input node.",INFO_NODE_HANG_UP:"This is the info text for the Hang Up node.",INFO_NODE_OPTION_REMOVE:"Are you sure? Removing this option will delete the flow connection and move back the following option, if there is one.",INFO_NODE_PLAY_AUDIO_FILE:"This is the info text for the Play Audio File node.",INFO_NODE_PLAY:"This is the info text for the Play node.",INFO_NODE_RECORD_CALL_START:"This is the info text for the Record Call Start node.",INFO_NODE_RECORD_CALL_STOP:"This is the info text for the Record Call Stop node.",INFO_NODE_RECORD:"This is the info text for the Record node.",INFO_NODE_REQUEST:"This is the info text for the Request node.",INFO_NODE_SEND_SMS:"This is the info text for the Send SMS node.",INFO_NODE_SET_VARIABLES_OPTION:"Are you sure you want to remove this variable?",INFO_NODE_SET_VARIABLES:"This is the info text for the Set Variables node.",INFO_NODE_TEXT_TO_SPEECH:"This is the info text for the Text to Speech node.",INFO_NODE_UNSET_VARIABLES:"This is the info text for the Unset Variables node.",INFO_STATUS_ERROR:"An error occurred while loading or saving the flow.",INPUT:"Input",KEY:"Key",METHOD:"Method",MORE_INFO_STATUS_ERROR:"More info on Flow document error",MORE_INFO_TITLE:"More info {{title}}",MULTIPLE_ADDRESSES:"Multiple Addresses",MULTIPLE_NUMBERS:"Multiple Numbers",MULTIPLE_RESOURCES:"Multiple Resources",NAVIGATE_BACK:"Navigate Back",NO_ANSWER:"No Answer",NO_INPUT:"No Input",NO_VARIABLES_SET:"Please set variables first",NUMBER_OF_VARIABLES_SELECTED_one:"{{count}} variable selected",NUMBER_OF_VARIABLES_SELECTED_other:"{{count}} variables selected",OFF:"Off",ON:"On",OPT_NUMBER:"Opt {{index}}",OPTION_NUMBER:"Option {{index}}",OPTIONAL:"optional",OR_SAYS:"Or says",PHONE_NUMBER:"Phone Number",PLAY_AUDIO_FILE:"Play Audio File",PLAY_AUDIO_TTS:"Play Audio or TTS",PROMPT_TEXT_TO_SPEECH:"Prompt Text to Speech",REASON:"Reason",RECORD_CALL_START:"Start Call Recording",RECORD_CALL_STOP:"Stop Call Recording",RECORD:"Record",RECORDING_NAME_DEFAULT:"Recording {{index}}",RECORDING_NAME:"Recording Name",RECORDING:"Recording",RELAYML_VERSION:"SWML Version",REMOVE_CONDITION:"Remove Condition {{index}}",REMOVE_EDGE:"Remove Edge",REMOVE_NODE:"Remove Node {{title}}",REMOVE_OPTION:"Remove Option {{index}}",REMOVE_VARIABLE:"Remove Variable {{index}}",REQUEST_BODY:"Body",REQUEST_HEADERS:"Headers (JSON)",REQUEST:"Request",SAVE_VARIABLES_SUBTITLE:"Store the response as variables",SAVE_VARIABLES:"Save Variables",SECONDS:"seconds",SELECT_VARIABLES_TO_UNSET:"Select Variables to Unset",SELECT_VARIABLES:"Select Variables",SELECT:"Select",SEND_SMS:"Send SMS",SEQUENTIALLY:"Sequentially",SET_VARIABLES:"Set Variables",SETTINGS:"Settings",SIMULTANEOUSLY:"Simultaneously",SINGLE_ADDRESS:"Single Address",SINGLE_NUMBER:"Single Number",SINGLE_RESOURCE:"Single Resource",SMS_TEXT:"SMS Text",STATUS_ERROR:"Error",STATUS_LOADING:"Loading...",STATUS_SAVED:"Saved",STATUS_SAVING:"Saving...",STEREO_SUBTITLE:"Enable stereo audio",STEREO:"Stereo",SUCCESS:"Success",TERMINATORS:"Terminators",TEXT_TO_SPEECH:"Text to Speech",TEXT:"Text",TO_PHONE_NUMBER:"To Phone Number",TO:"To",UNKNOWN:"Unknown",UNSET_VARIABLES:"Unset Variables",URL:"URL",VALUE:"Value",VARIABLE_KEY:"Variable {{key}}",VOICEMAIL_RECORDING:"Voicemail Recording",WAIT_FOR_INPUT:"Wait for Input",WRITE_SOMETHING:"Write something"},I={ABOUT:"ABOUT",ACTION:"ACTION",ADD_CONDITION:"ADD_CONDITION",ADD_OPTION:"ADD_OPTION",ADD_VARIABLE:"ADD_VARIABLE",ANSWER_CALL:"ANSWER_CALL",ANSWERED:"ANSWERED",API_VERSION:"API_VERSION",APP_VERSION:"APP_VERSION",BEEP_SUBTITLE:"BEEP_SUBTITLE",BEEP:"BEEP",BUILDER_VERSION:"BUILDER_VERSION",BUSY:"BUSY",CALL_ADDRESSES:"CALL_ADDRESSES",CALL_NUMBERS:"CALL_NUMBERS",CALL_RESOURCES:"CALL_RESOURCES",CALLER_PRESSES:"CALLER_PRESSES",CHOOSE_OPTION_SINGLE_MULTIPLE:"CHOOSE_OPTION_SINGLE_MULTIPLE",CHOOSE_OPTION_TTS_AUDIO:"CHOOSE_OPTION_TTS_AUDIO",CLOSE:"CLOSE",COND_NUMBER:"COND_NUMBER",CONDITION_NUMBER:"CONDITION_NUMBER",CONDITIONS:"CONDITIONS",DECISION:"DECISION",DECLINE:"DECLINE",DISCONNECT_CALL_AFTER_RINGING:"DISCONNECT_CALL_AFTER_RINGING",ELSE:"ELSE",ENTER_URL:"ENTER_URL",ERROR_ADD_RECORDING_FIRST:"ERROR_ADD_RECORDING_FIRST",ERROR_DUPLICATE_RECORDING_LABEL:"ERROR_DUPLICATE_RECORDING_LABEL",ERROR_DUPLICATE_VARIABLE_KEY:"ERROR_DUPLICATE_VARIABLE_KEY",ERROR_INVALID_JSON:"ERROR_INVALID_JSON",ERROR_NUMBER_IS_REQUIRED:"ERROR_NUMBER_IS_REQUIRED",ERROR_NUMBER_MIN_MAX_IS_REQUIRED:"ERROR_NUMBER_MIN_MAX_IS_REQUIRED",ERROR_RECORDING_LABEL_REQUIRED:"ERROR_RECORDING_LABEL_REQUIRED",ERROR_STRING_VALUE_REQUIRED:"ERROR_STRING_VALUE_REQUIRED",ERROR_TELEPHONE_KEY_REQUIRED:"ERROR_TELEPHONE_KEY_REQUIRED",ERROR_TERMINATORS:"ERROR_TERMINATORS",ERROR_TEXT_IS_REQUIRED:"ERROR_TEXT_IS_REQUIRED",ERROR_URL_IS_REQUIRED:"ERROR_URL_IS_REQUIRED",ERROR_VALUE_IS_REQUIRED:"ERROR_VALUE_IS_REQUIRED",ERROR_VARIABLE_KEY_REQUIRED:"ERROR_VARIABLE_KEY_REQUIRED",ERROR:"ERROR",FAILED:"FAILED",FAILURE:"FAILURE",FORMAT:"FORMAT",FORWARD_TO_ADDRESS:"FORWARD_TO_ADDRESS",FORWARD_TO_PHONE:"FORWARD_TO_PHONE",FORWARD_TO_RESOURCE:"FORWARD_TO_RESOURCE",FORWARD:"FORWARD",FROM_PHONE_NUMBER:"FROM_PHONE_NUMBER",FROM:"FROM",GATHER_INPUT:"GATHER_INPUT",HANDLE_CALL:"HANDLE_CALL",HANG_UP_CALL:"HANG_UP_CALL",HANG_UP:"HANG_UP",INFO_NODE_ANSWER:"INFO_NODE_ANSWER",INFO_NODE_COND:"INFO_NODE_COND",INFO_NODE_FORWARD_TO_ADDRESS:"INFO_NODE_FORWARD_TO_ADDRESS",INFO_NODE_FORWARD_TO_PHONE:"INFO_NODE_FORWARD_TO_PHONE",INFO_NODE_FORWARD_TO_RESOURCE:"INFO_NODE_FORWARD_TO_RESOURCE",INFO_NODE_GATHER_INPUT:"INFO_NODE_GATHER_INPUT",INFO_NODE_HANG_UP:"INFO_NODE_HANG_UP",INFO_NODE_OPTION_REMOVE:"INFO_NODE_OPTION_REMOVE",INFO_NODE_PLAY_AUDIO_FILE:"INFO_NODE_PLAY_AUDIO_FILE",INFO_NODE_PLAY:"INFO_NODE_PLAY",INFO_NODE_RECORD_CALL_START:"INFO_NODE_RECORD_CALL_START",INFO_NODE_RECORD_CALL_STOP:"INFO_NODE_RECORD_CALL_STOP",INFO_NODE_RECORD:"INFO_NODE_RECORD",INFO_NODE_REQUEST:"INFO_NODE_REQUEST",INFO_NODE_SEND_SMS:"INFO_NODE_SEND_SMS",INFO_NODE_SET_VARIABLES_OPTION:"INFO_NODE_SET_VARIABLES_OPTION",INFO_NODE_SET_VARIABLES:"INFO_NODE_SET_VARIABLES",INFO_NODE_TEXT_TO_SPEECH:"INFO_NODE_TEXT_TO_SPEECH",INFO_NODE_UNSET_VARIABLES:"INFO_NODE_UNSET_VARIABLES",INFO_STATUS_ERROR:"INFO_STATUS_ERROR",INPUT:"INPUT",KEY:"KEY",METHOD:"METHOD",MORE_INFO_STATUS_ERROR:"MORE_INFO_STATUS_ERROR",MORE_INFO_TITLE:"MORE_INFO_TITLE",MULTIPLE_ADDRESSES:"MULTIPLE_ADDRESSES",MULTIPLE_NUMBERS:"MULTIPLE_NUMBERS",MULTIPLE_RESOURCES:"MULTIPLE_RESOURCES",NAVIGATE_BACK:"NAVIGATE_BACK",NO_ANSWER:"NO_ANSWER",NO_INPUT:"NO_INPUT",NO_VARIABLES_SET:"NO_VARIABLES_SET",NUMBER_OF_VARIABLES_SELECTED:"NUMBER_OF_VARIABLES_SELECTED",OFF:"OFF",ON:"ON",OPT_NUMBER:"OPT_NUMBER",OPTION_NUMBER:"OPTION_NUMBER",OPTIONAL:"OPTIONAL",OR_SAYS:"OR_SAYS",PHONE_NUMBER:"PHONE_NUMBER",PLAY_AUDIO_FILE:"PLAY_AUDIO_FILE",PLAY_AUDIO_TTS:"PLAY_AUDIO_TTS",PROMPT_TEXT_TO_SPEECH:"PROMPT_TEXT_TO_SPEECH",REASON:"REASON",RECORD_CALL_START:"RECORD_CALL_START",RECORD_CALL_STOP:"RECORD_CALL_STOP",RECORD:"RECORD",RECORDING_NAME_DEFAULT:"RECORDING_NAME_DEFAULT",RECORDING_NAME:"RECORDING_NAME",RECORDING:"RECORDING",RELAYML_VERSION:"RELAYML_VERSION",REMOVE_CONDITION:"REMOVE_CONDITION",REMOVE_EDGE:"REMOVE_EDGE",REMOVE_NODE:"REMOVE_NODE",REMOVE_OPTION:"REMOVE_OPTION",REMOVE_VARIABLE:"REMOVE_VARIABLE",REQUEST_BODY:"REQUEST_BODY",REQUEST_HEADERS:"REQUEST_HEADERS",REQUEST:"REQUEST",SAVE_VARIABLES_SUBTITLE:"SAVE_VARIABLES_SUBTITLE",SAVE_VARIABLES:"SAVE_VARIABLES",SECONDS:"SECONDS",SELECT_VARIABLES_TO_UNSET:"SELECT_VARIABLES_TO_UNSET",SELECT_VARIABLES:"SELECT_VARIABLES",SELECT:"SELECT",SEND_SMS:"SEND_SMS",SEQUENTIALLY:"SEQUENTIALLY",SET_VARIABLES:"SET_VARIABLES",SETTINGS:"SETTINGS",SIMULTANEOUSLY:"SIMULTANEOUSLY",SINGLE_ADDRESS:"SINGLE_ADDRESS",SINGLE_NUMBER:"SINGLE_NUMBER",SINGLE_RESOURCE:"SINGLE_RESOURCE",SMS_TEXT:"SMS_TEXT",STATUS_ERROR:"STATUS_ERROR",STATUS_LOADING:"STATUS_LOADING",STATUS_SAVED:"STATUS_SAVED",STATUS_SAVING:"STATUS_SAVING",STEREO_SUBTITLE:"STEREO_SUBTITLE",STEREO:"STEREO",SUCCESS:"SUCCESS",TERMINATORS:"TERMINATORS",TEXT_TO_SPEECH:"TEXT_TO_SPEECH",TEXT:"TEXT",TO_PHONE_NUMBER:"TO_PHONE_NUMBER",TO:"TO",UNKNOWN:"UNKNOWN",UNSET_VARIABLES:"UNSET_VARIABLES",URL:"URL",VALUE:"VALUE",VARIABLE_KEY:"VARIABLE_KEY",VOICEMAIL_RECORDING:"VOICEMAIL_RECORDING",WAIT_FOR_INPUT:"WAIT_FOR_INPUT",WRITE_SOMETHING:"WRITE_SOMETHING"},QT={order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag","path","subdomain"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage","cookie"],excludeCacheFor:["cimode"]},XT={"en-US":{translation:KT}},qT=()=>{Te.use(Ay).use(YT).init({debug:zx,detection:QT,fallbackLng:"en-US",interpolation:{escapeValue:!1},keySeparator:!1,resources:XT})};function M(e,t){return t?Te.t(e,t):Te.t(e)}const ZT={entries:[],nextLabelIndex:0},Gn=Tl((e,t)=>({...ZT,getEntries(){return t().entries},getEntryValue(n){var r;return(r=t().entries.find(o=>o.controlId===n))==null?void 0:r.label},getGeneratedLabel(){let n="";do this.nextLabelIndex++,n=M(I.RECORDING_NAME_DEFAULT,{index:this.nextLabelIndex});while(this.isValueDuplicate(n));return n},isKeyDuplicate(n){return t().entries.some(r=>r.controlId===n)},isValueDuplicate(n,r){const o=t().entries.reduce((i,s)=>{const{label:l,controlId:a}=s;return l!==""&&l===n&&(!r||a!==r)?[...i,s]:i},[]);return Boolean(o.length)},removeEntry(n){e(r=>({entries:r.entries.filter(o=>o.controlId!==n)}))},upsertEntry:n=>{e(r=>{let o=[...r.entries];const i=Boolean(n.label.trim());return(r.isKeyDuplicate(n.controlId)||!i)&&(o=o.filter(s=>s.controlId!==n.controlId)),i&&o.push({...n}),{entries:o}})}})),JT=e=>{const t=[];e.forEach(n=>{n.type==="recordCallStart"&&n.data.controlId&&n.data.label&&t.push({controlId:n.data.controlId,label:n.data.label})}),Gn.setState({entries:t,nextLabelIndex:t.length})},eI=(e,t)=>{const n=[];return t.forEach(r=>{r.type==="recordCallStart"&&r.data.controlId&&(n.push(r.data.controlId),Gn.getState().removeEntry(r.data.controlId))}),n.length?e.reduce((r,o)=>o.type==="recordCallStop"&&n.includes(o.data.controlId)?[...r,{...o,data:{...o.data,controlId:"",missingRequiredParams:!0}}]:r,[]):[]},ky={recordCallStart:e=>{const t=Gn.getState().getGeneratedLabel();return Gn.getState().upsertEntry({controlId:e.data.controlId,label:t}),{...e,data:{...e.data,label:t}}}},tI=e=>ey[e]!==void 0,nI=e=>typeof e=="object"&&e!==null&&Object.keys(e).length>0,rI=e=>ky[e.type]!==void 0,Py=(e,t={})=>{const{deletable:n=!0,position:r={x:300,y:250},selected:o=!0}=t,i=()=>({id:Me(),type:e,position:r,deletable:n,data:{missingRequiredParams:!1},selected:o}),s=(a,u)=>({...a,data:{...a.data,...u,missingRequiredParams:!0}});let l=i();if(tI(e)){const a=ey[e]();nI(a)&&(l=s(l,a))}return rI(l)&&(l=ky[l.type](l)),l},ia={apiVersion:void 0,builderVersion:Xv,cfbAppVersion:Qv,relayMLVersion:void 0},oI=e=>{const t={...ia,...e};ia.apiVersion=t.apiVersion,ia.builderVersion=t.builderVersion,ia.relayMLVersion=t.relayMLVersion},Af=()=>({apiVersion:void 0,builderVersion:Xv,cfbAppVersion:Qv,relayMLVersion:void 0}),My=1e3,bf=Ct(),iI=e=>(t,n,r)=>{let o,i;const s=async()=>{const{httpService:l,nodes:a,edges:u,documentVersion:c}=n(),{builderVersion:f}=Af();bf.debug("Saving data to server"),t({dataHandlingStatus:"saving",saveFlowStatus:"saving"}),clearTimeout(i);try{if(!l)throw new Error("Missing httpService");const h={documentVersion:(await l.putFlow({documentVersion:c,builderVersion:f,nodes:a,edges:u})).document_version};switch(n().dataHandlingStatus){case"saving":t({...h,dataHandlingStatus:"queueing",saveFlowStatus:"saved"});break;case"holding":t({...h,saveFlowStatus:"awaiting-save"}),bf.debug("Setting up a new save for held changes"),i=setTimeout(()=>{s()},My);break;default:bf.debug("Saving data to server - invalid state")}}catch(p){console.error("Put Flow",p),t({dataHandlingStatus:"queueing",saveFlowStatus:"error"})}};return r.setState=(l,a,...u)=>{const{dataHandlingStatus:c,initializing:f}=n(),p=typeof l=="function"?l(n()):l;!f&&(p.nodes||p.edges)?c==="queueing"?(p.saveFlowStatus="awaiting-save",t(p,a,...u),clearTimeout(o),o=setTimeout(()=>{s()},My)):(p.dataHandlingStatus="holding",t(p,a,...u)):"initializing"in p&&p.initializing!==f?(p.dataHandlingStatus="queueing",p.saveFlowStatus="saved",t(p,a,...u)):t(p,a,...u)},e(r.setState,n,r)},sI={variables:new Map,keyToIdMap:new Map},vr=Tl((e,t)=>({...sI,_dedupeKey(n,r){const o=Array.from(r.values()).find(i=>i.key===n);o&&r.delete(o.id)},isKeyDuplicate(n,r){const o=t().keyToIdMap.get(n);return o?o!==r:!1},removeVariable(n){e(r=>{const o=new Map(r.variables),i=new Map(r.keyToIdMap),s=o.get(n);return s&&(o.delete(n),i.delete(s.key)),{keyToIdMap:i,variables:o}})},setVariables:n=>{e(()=>{const r=new Map,o=new Map;return n.forEach(i=>{const s=o.get(i.key);s&&r.delete(s),r.set(i.id,i),o.set(i.key,i.id)}),{keyToIdMap:o,variables:r}})},upsertVariable:n=>{e(r=>{const o=new Map(r.variables),i=new Map(r.keyToIdMap),s=o.get(n.id),l=i.get(n.key);return l&&o.delete(l),s&&i.delete(s.key),o.set(n.id,n),i.set(n.key,n.id),{keyToIdMap:i,variables:o}})}})),lI=e=>{const t=[];e.forEach(n=>{n.type==="set"&&n.data.variables&&t.push(...n.data.variables)}),vr.getState().setVariables(t)},aI=e=>{if(e!=null&&e.length){const{removeVariable:t}=vr.getState();e.forEach(n=>{n.type==="set"&&n.data.variables&&n.data.variables.forEach(o=>t(o.id))})}},ze=Ct(),uI=Py("handleCall",{position:{x:300,y:100},deletable:!1}),Qi={backButtonHref:void 0,colorMode:"light",dataHandlingStatus:"queueing",documentVersion:0,edges:[],flowId:"",flowInteractive:!0,flowTitle:"",getFlowURL:"",httpService:void 0,initializing:!0,isDraggingNode:!1,isEdgeConnecting:!1,isEdgeUpdateSuccessful:!1,nodes:[],reactFlowInstance:void 0,rootAppHeight:void 0,rootAppWidth:void 0,rootElementId:"",saveFlowStatus:"initial",selectedNode:void 0,updateFlowURL:"",updatingSourceHandleId:void 0},ne=Tl()(iI((e,t)=>({...Qi,reset:()=>{ze.debug("Reset!"),e({nodes:[...Qi.nodes],edges:[...Qi.edges]})},exportStoreData:()=>{const{nodes:n,edges:r}=t();jx(n,r)},addNode:n=>{ze.debug("Add Node",n);const{nodes:r,reactFlowInstance:o}=t();if(!o)throw new Error("ReactFlowInstance not found");const i=150,s=150,l=o.project({x:i,y:s}),a=Py(n,{position:l}),u=r.map(c=>({...c,selected:!1}));u.push(a),e({nodes:u,selectedNode:a})},getNodeEdges:n=>t().edges.filter(r=>r.source===n),getTargetEdges:n=>t().edges.filter(r=>r.target===n),partialUpdateNodeData:(n,r)=>{var s;ze.debug("partialUpdateNodeData",n,r);const o=[],i=t().nodes.map(l=>{if(l.id===n){if("options"in r&&"options"in l.data){const a=l.data.options.map(c=>c.id),u=r.options.map(c=>c.id);o.push(...a.filter(c=>!u.includes(c)))}return{...l,data:{...l.data,...r}}}return l});if(o.length){const l=t().edges.filter(a=>a.sourceHandle&&o.includes(a.sourceHandle));ze.debug("Remove orphaned edges",{sourceHandleDeleted:o,edgesToDelete:l}),(s=t().reactFlowInstance)==null||s.deleteElements({edges:l})}e({nodes:i})},removeNode:n=>{ze.debug("removeNode",n);const r=t().reactFlowInstance;r&&r.deleteElements({nodes:[{id:n}]})},removeEdge:n=>{ze.debug("removeEdge",n);const r=t().reactFlowInstance;r&&r.deleteElements({edges:[{id:n}]})},onInit:async n=>{const{getFlowURL:r,updateFlowURL:o}=t();ze.log("onInit",{getFlowURL:r,updateFlowURL:o});const i=H_({getFlowURL:r,updateFlowURL:o,headers:Hx()}),s=Af(),{id:l,title:a,document_version:u,flow_data:c}=await i.getFlow();let f=c;f||(f={apiVersion:s.apiVersion,builderVersion:s.builderVersion,relayMLVersion:s.relayMLVersion,edges:Qi.edges,nodes:Qi.nodes.concat([uI])}),e({httpService:i,reactFlowInstance:n,flowId:l,flowTitle:a,documentVersion:u,nodes:f.nodes.map(Yx),edges:f.edges.map(Gx)}),oI({apiVersion:f.apiVersion,builderVersion:f.builderVersion,relayMLVersion:f.relayMLVersion}),lI(f.nodes),JT(f.nodes)},onNodeDragStart:()=>{e({isDraggingNode:!0})},onNodeDragStop:()=>{e({isDraggingNode:!1})},onNodesChange:n=>{e({nodes:Pv(n,t().nodes)})},onNodesDelete:n=>{ze.debug("onNodesDelete"),aI(n),eI(t().nodes,n).forEach(o=>{ne.getState().partialUpdateNodeData(o.id,o.data)})},onEdgesChange:n=>{e({edges:QO(n,t().edges)})},onEdgesDelete:n=>{ze.debug("onEdgesDelete [noop]",n)},onConnect:n=>{ze.debug("onConnect"),e({edges:Qm(n,t().edges)})},onConnectStart:()=>{ze.debug("onConnectStart"),e({isEdgeConnecting:!0})},onConnectEnd:()=>{ze.debug("onConnectEnd"),e({isEdgeConnecting:!1})},onEdgeUpdateStart:(n,r)=>{ze.debug("onEdgeUpdateStart"),e({isEdgeUpdateSuccessful:!1,updatingSourceHandleId:r.sourceHandle??void 0})},onEdgeUpdate:(n,r)=>{ze.debug("onEdgeUpdate"),e({edges:lO(n,r,t().edges),isEdgeUpdateSuccessful:!0})},onEdgeUpdateEnd:(n,r)=>{var o;ze.debug("onEdgeUpdateEnd"),t().isEdgeUpdateSuccessful?e({isEdgeUpdateSuccessful:!0}):(o=t().reactFlowInstance)==null||o.deleteElements({edges:[{id:r.id}]}),e({updatingSourceHandleId:void 0})},onSelectionChange:({nodes:n})=>{e({selectedNode:n.find(r=>r.selected)})},setColorMode:n=>{e({colorMode:n})}})));window.__useRFStore=ne;const b2="";function cI({fromNode:e,fromPosition:t,fromX:n,fromY:r,toX:o,toY:i}){if(!e)return null;const[s]=Bi({borderRadius:20,sourceX:n,sourceY:r,sourcePosition:t,targetPosition:G.Top,targetX:o,targetY:i});return V("g",{children:[_("path",{fill:"none",stroke:"#222",strokeWidth:1.5,className:"animated",d:s}),_("circle",{cx:o,cy:i,fill:"#fff",r:3,stroke:"#222",strokeWidth:1.5})]})}const Xi=40;function fI(e,t,n,r=0,o=!1){const{width:i,height:s,position:l}=n,a=i??0,u=s??0,c=a/2,f=u/2;if(o)return{tx:l.x,ty:l.y+f};const p=l.x+c,h=l.y+f,v=e,m=t,E=(v-p)/a-(m-h)/u,d=(v-p)/u+(m-h)/u,g=1/(Math.abs(E)+Math.abs(d)),y=g*E,S=g*d,w=c*(y+S)+p;return{tx:Math.min(Math.max(w,l.x+r),l.x+a-r),ty:l.y}}const dI=({isCircular:e,sourceX:t,labelX:n,sourceY:r,labelY:o})=>e?{x:t-Xi*1.5,y:r}:{x:n-Xi/2,y:o-Xi/2};function pI(e){const{id:t,source:n,target:r,sourcePosition:o,sourceX:i,sourceY:s}=e,l=ne(d=>d.removeEdge),a=ae(N.useCallback(d=>d.nodeInternals.get(n),[n])),u=ae(N.useCallback(d=>d.nodeInternals.get(r),[r]));if(!a||!u)return null;const c=n===r,{tx:f,ty:p}=fI(i,s,u,20,c),[h,v,m]=Bi({borderRadius:20,sourceX:i,sourceY:s,sourcePosition:o,targetPosition:c?G.Left:G.Top,targetX:f,targetY:p}),E=(d,g)=>{d.stopPropagation(),l(g)};return V("g",{className:"group",children:[_(mo,{path:h,...e}),_("foreignObject",{width:Xi,height:Xi,className:"hidden group-hover:block",requiredExtensions:"http://www.w3.org/1999/xhtml",...dI({isCircular:c,sourceX:i,labelX:v,sourceY:s,labelY:m}),children:_("div",{className:"h-10 w-10",children:V("button",{className:"flex h-10 w-10 cursor-pointer items-center justify-center rounded-full border border-foreground/10 bg-backgroundAlt",onClick:d=>E(d,t),children:[_(Et,{tag:"trash-can",className:"text-negative"}),_("span",{className:"sr-only",children:M(I.REMOVE_EDGE)})]})})})]})}var hI={prefix:"fas",iconName:"trash-can",icon:[448,512,[61460,"trash-alt"],"f2ed","M135.2 17.7C140.6 6.8 151.7 0 163.8 0H284.2c12.1 0 23.2 6.8 28.6 17.7L320 32h96c17.7 0 32 14.3 32 32s-14.3 32-32 32H32C14.3 96 0 81.7 0 64S14.3 32 32 32h96l7.2-14.3zM32 128H416V448c0 35.3-28.7 64-64 64H96c-35.3 0-64-28.7-64-64V128zm96 64c-8.8 0-16 7.2-16 16V432c0 8.8 7.2 16 16 16s16-7.2 16-16V208c0-8.8-7.2-16-16-16zm96 0c-8.8 0-16 7.2-16 16V432c0 8.8 7.2 16 16 16s16-7.2 16-16V208c0-8.8-7.2-16-16-16zm96 0c-8.8 0-16 7.2-16 16V432c0 8.8 7.2 16 16 16s16-7.2 16-16V208c0-8.8-7.2-16-16-16z"]},gI={prefix:"fas",iconName:"circle-exclamation",icon:[512,512,["exclamation-circle"],"f06a","M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm0-384c13.3 0 24 10.7 24 24V264c0 13.3-10.7 24-24 24s-24-10.7-24-24V152c0-13.3 10.7-24 24-24zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z"]},mI={prefix:"fas",iconName:"arrow-left",icon:[448,512,[8592],"f060","M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.2 288 416 288c17.7 0 32-14.3 32-32s-14.3-32-32-32l-306.7 0L214.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160z"]},vI={prefix:"fas",iconName:"circle-info",icon:[512,512,["info-circle"],"f05a","M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM216 336h24V272H216c-13.3 0-24-10.7-24-24s10.7-24 24-24h48c13.3 0 24 10.7 24 24v88h8c13.3 0 24 10.7 24 24s-10.7 24-24 24H216c-13.3 0-24-10.7-24-24s10.7-24 24-24zm40-208a32 32 0 1 1 0 64 32 32 0 1 1 0-64z"]},yI={prefix:"fas",iconName:"xmark",icon:[320,512,[128473,10005,10006,10060,215,"close","multiply","remove","times"],"f00d","M310.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L160 210.7 54.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L114.7 256 9.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L160 301.3 265.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L205.3 256 310.6 150.6z"]};const EI={"arrow-left":mI,"circle-exclamation":gI,"circle-info":vI,"trash-can":hI,xmark:yI},Et=N.forwardRef(function({className:t="",size:n="",tag:r},o){const i=EI[r];return i?_("svg",{"aria-hidden":"true","data-prefix":i.prefix,"data-icon":r,className:`svg-inline--fa fa-${r} ${n?`fa-${n}`:""} ${t}`,focusable:"false",ref:o,role:"img",viewBox:`0 0 ${i.icon[0]} ${i.icon[1]}`,xmlns:"http://www.w3.org/2000/svg",children:_("path",{d:i.icon[4],fill:"currentColor"})}):(Ct().debug(`Unknown icon: ${r}`),null)}),SI=({isSelected:e,nodeId:t,nodeTitle:n,showDelete:r})=>{const o=ne(a=>a.removeNode),i=ne(a=>a.isEdgeConnecting);return V("div",{className:"flex w-full items-center justify-between p-4",children:[_("h2",{className:`text-lg font-semibold leading-6 ${e?"text-primary":""}`,children:n}),r&&!i&&V("button",{className:"opacity-0 transition-opacity group-hover/node-wrapper:opacity-100",onClick:()=>{o(t)},children:[_(Et,{tag:"trash-can",className:"text-negative"}),_("span",{className:"sr-only",children:M(I.REMOVE_NODE,{title:n})})]})]})},_I=({id:e,missingRequiredEntry:t})=>{const n=ne(i=>i.getTargetEdges),[r,o]=N.useState(!1);return N.useEffect(()=>{const i=()=>n(e).length===0;o(i());const s=ne.subscribe((l,a)=>{l.edges.length!==a.edges.length&&o(i()),l.nodes.length!==a.nodes.length&&o(i()),l.isEdgeUpdateSuccessful!==a.isEdgeUpdateSuccessful&&o(i())});return()=>s()},[e,n]),r||t?V("div",{className:"flex flex-col gap-y-6 px-4 pb-4 text-sm italic leading-4",children:[r&&_("p",{children:"Not Connected to Flow"}),t&&_("p",{children:"Missing Required Entry"})]}):null},wI=({id:e,isConnectable:t})=>{if(!e)throw new Error("TargetHandle: id is required");return _(Eo,{type:"target",id:`target-${e}`,position:G.Top,isConnectable:t,className:"mt-1 h-4 w-full rounded-none rounded-t-md border-none bg-primary opacity-0 transition-opacity hover:opacity-100"})},Ze=({children:e,id:t,isConnectable:n=!0,missingRequiredEntry:r,nodeTitle:o,selected:i,showDelete:s,showValidation:l=!0,target:a=!0})=>V("section",{className:`${i?"shadow-xl":""} group/node-wrapper min-w-[300px] rounded-lg border border-foreground/10 bg-background transition-[visibility]`,children:[a&&t&&_(wI,{id:t,isConnectable:n}),_(SI,{nodeId:t,isSelected:i,nodeTitle:o,showDelete:s}),l&&_(_I,{id:t,missingRequiredEntry:r??!1}),e]}),RI=({children:e,handleClick:t,...n})=>_("li",{role:"presentation",children:V("div",{className:"flex items-center gap-2 rounded-lg bg-secondary p-2 pr-1",role:"option","aria-selected":"true",tabIndex:0,children:[_("span",{className:"text-sm text-foreground",children:e}),V("button",{className:" px-1",onClick:t,onKeyDown:o=>{(o.key==="Backspace"||o.key==="Delete")&&(o.stopPropagation(),t==null||t())},type:"button",...n,children:[_("span",{className:"sr-only",children:"Remove"}),_(Et,{tag:"xmark",size:"xs"})]})]})}),yr=e=>_("div",{className:"relative after:absolute after:right-3 after:top-3 after:h-[7px] after:w-[7px] after:rotate-45 after:border-r after:border-b after:border-foreground after:content-['']",children:_("select",{className:"pr-8",...e,children:e.children})}),NI={disabled:"border-disabled cursor-not-allowed",negative:"border-negative hover:bg-negative",positive:"border-positive hover:bg-positive"},Kt=({color:e="positive",enabled:t=!0,id:n,isConnectable:r,position:o=G.Bottom,positionClasses:i="-bottom-2.5"})=>{if(!n)throw new Error("SourceHandle: id is required");const s=t?e:"disabled",l=ne(p=>p.updatingSourceHandleId),c=!ne(p=>p.edges.some(h=>h.sourceHandle===n))||l===n;return _("div",{className:`absolute top-auto left-1/2 h-5 w-5 -translate-x-1/2 rounded-full ${i} ${c&&r&&t?"":"nodrag cursor-not-allowed"}`,children:_(Eo,{className:`bottom-0 h-full w-full border-[3px] bg-background transition-colors ${NI[s]??""}`,id:n,isConnectable:c&&r&&t,position:o,type:"source"})})},sa=({children:e})=>_("div",{className:"divide-foreground/10 flex w-full items-center divide-x",children:e}),Io=({color:e="positive",enabled:t=!0,id:n,isConnectable:r,optionText:o,position:i=G.Bottom,positionClasses:s="-bottom-2.5"})=>V("div",{className:"relative w-full min-w-[104px] whitespace-nowrap border-t border-foreground/10 py-4",children:[_("div",{className:"flex flex-col items-center justify-center",children:_("p",{className:`${t?"":"text-disabled"} min-h-[1rem] text-sm leading-4`,children:o})}),_(Kt,{color:e,enabled:t,id:n,isConnectable:r,position:i,positionClasses:s})]}),OI=({checked:e=!1,name:t,onClick:n})=>V("button",{name:t,onClick:n,type:"button",className:`${e?"bg-primary":"bg-secondary"} relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out`,role:"switch","aria-checked":e?"true":"false",children:[_("span",{className:"sr-only",children:M(e?I.ON:I.OFF)}),_("span",{className:`pointer-events-none inline-block h-5 w-5 ${e?"translate-x-5":"translate-x-0"} transform rounded-full bg-white shadow transition duration-200 ease-in-out`})]}),Uy=({checked:e,clickHandler:t,name:n,subtitle:r,title:o})=>V("div",{className:"mb-2 flex items-center justify-between",children:[V("div",{className:"flex flex-grow flex-col",children:[_("span",{className:"text-base font-medium leading-6 text-foreground",children:o}),r&&_("span",{className:"text-xs text-foreground/50",children:r})]}),_(OI,{checked:e,name:n,onClick:t})]}),qi=({errorText:e,label:t,name:n,onChange:r,required:o,valid:i,value:s,...l})=>V("label",{children:[_("span",{className:"sr-only",children:t}),_("textarea",{"aria-invalid":i?void 0:"true",className:`peer min-h-[77px] w-full resize-none ${i?"":"invalid"}`,inputMode:"text",minLength:1,name:n,onChange:r,required:o,value:s,...l}),_("p",{className:"requirements",role:"alert",children:e})]}),xI=({dragging:e,id:t,isConnectable:n,selected:r})=>_(Ze,{id:t,isConnectable:n,missingRequiredEntry:!1,nodeTitle:"Answer Call",selected:r,showDelete:!e,children:_(Kt,{id:t,isConnectable:n,color:"positive"})}),TI={success:I.SUCCESS,noAnswer:I.NO_ANSWER,busy:I.BUSY,decline:I.DECLINE,error:I.ERROR},II={address:I.FORWARD_TO_ADDRESS,phone:I.FORWARD_TO_PHONE,resource:I.FORWARD_TO_RESOURCE},Lf=({id:e,data:t,dragging:n,isConnectable:r,selected:o})=>V(Ze,{id:e,isConnectable:r,missingRequiredEntry:t.missingRequiredParams,nodeTitle:M(II[t.destinationType]),selected:o,showDelete:!n,children:[t.destinations.length>0?_("section",{className:"p-4 pt-2",children:_("ul",{className:"space-y-2",children:t.destinations.map((i,s)=>_("li",{className:"text-sm",children:i},`node-${i}-${s}`))})}):null,_(sa,{children:t.options.map(i=>_(Io,{id:i.id,optionText:M(TI[i.result]),color:Jv(i.result),isConnectable:r},i.id))})]}),CI=({id:e,data:t,dragging:n,isConnectable:r,selected:o})=>_(Ze,{id:e,isConnectable:r,missingRequiredEntry:t.missingRequiredParams,nodeTitle:"Gather Input",selected:o,showDelete:!n,children:V(sa,{children:[t.options.map((i,s)=>{const l=Boolean(i.command||i.digit);return _(Io,{color:"positive",enabled:l,id:i.id,isConnectable:r,optionText:M(I.OPT_NUMBER,{index:s+1})},i.id)}),t.results.map(i=>_(Io,{color:"negative",id:i.id,isConnectable:r,optionText:i.result==="no_input"?M(I.NO_INPUT):M(I.UNKNOWN)},i.id))]})}),AI=({id:e,isConnectable:t,selected:n})=>_(Ze,{allowDelete:!1,id:e,isConnectable:t,nodeTitle:M(I.HANDLE_CALL),selected:n,showDelete:!1,showValidation:!1,target:!1,children:_(Kt,{id:e,color:"positive",isConnectable:t})}),Df={busy:I.BUSY,decline:I.DECLINE,hangup:I.HANG_UP},bI=({data:e,dragging:t,id:n,isConnectable:r,selected:o})=>_(Ze,{id:n,isConnectable:r,missingRequiredEntry:!1,nodeTitle:M(I.HANG_UP_CALL),selected:o,showDelete:!t,children:e.reason&&_("section",{className:"p-4 pt-2",children:_("p",{children:M(Df[e.reason])})})}),LI=e=>{try{return new URL(e).pathname.split("/").at(-1)}catch{return""}},DI=({data:e,dragging:t,id:n,isConnectable:r,selected:o})=>{let i=e.selected&&e[e.selected];return i&&e.selected==="url"&&(i=LI(i)||"Play Audio"),V(Ze,{id:n,isConnectable:r,missingRequiredEntry:e.missingRequiredParams,nodeTitle:M(I.PLAY_AUDIO_TTS),selected:o,showDelete:!t,children:[i&&_("div",{className:"max-w-[300px] p-4 pt-0",children:e.selected==="url"?_("a",{className:"break-words text-primary underline line-clamp-3",href:e.url,target:"_blank",rel:"noopener noreferrer",children:i}):_("p",{className:"break-words line-clamp-3",children:i})}),_(Kt,{id:n,isConnectable:r})]})},kI=({id:e,data:t,dragging:n,isConnectable:r,selected:o})=>V(Ze,{id:e,isConnectable:r,missingRequiredEntry:t.missingRequiredParams,nodeTitle:M(I.SET_VARIABLES),selected:o,showDelete:!n,children:[t.variables.length>0&&_("div",{className:"flow-root",children:_("div",{className:"inline-block p-4 pt-0 align-middle",children:V("table",{className:"w-80 table-fixed divide-y divide-foreground/10",children:[_("thead",{children:V("tr",{children:[_("th",{scope:"col",className:"py-3.5 text-left text-sm font-semibold",children:M(I.KEY)}),_("th",{scope:"col",className:"px-2 py-3.5 text-left text-sm font-semibold",children:M(I.VALUE)})]})}),_("tbody",{className:"divide-y divide-foreground/10 bg-background text-sm",children:t.variables.map(i=>i.key?V("tr",{children:[_("td",{className:"overflow-hidden text-ellipsis whitespace-nowrap py-2 text-sm",children:i.key}),_("td",{className:"overflow-hidden text-ellipsis whitespace-nowrap break-all px-2 py-2 text-sm",children:i.value})]},i.id):null)})]})})}),_(Kt,{id:e,isConnectable:r,color:"positive"})]}),PI=({id:e,data:t,dragging:n,isConnectable:r,selected:o})=>{const i=ne(s=>s.partialUpdateNodeData);return N.useEffect(()=>{const s=vr.subscribe(l=>{const u=Array.from(l.variables.values()).reduce((c,f)=>{const p=t.variables.find(h=>h.setId===f.id);return p&&c.push({...p,key:f.key}),c},[]);i(e,{variables:u,missingRequiredParams:u.length===0})});return()=>s()},[i,e,t.variables]),_(Ze,{id:e,isConnectable:r,missingRequiredEntry:t.missingRequiredParams,nodeTitle:M(I.UNSET_VARIABLES),selected:o,showDelete:!n,children:_(Kt,{id:e,isConnectable:r,color:"positive"})})},MI=({data:e,dragging:t,id:n,isConnectable:r,selected:o})=>_(Ze,{id:n,isConnectable:r,missingRequiredEntry:e.missingRequiredParams,nodeTitle:M(I.VOICEMAIL_RECORDING),selected:o,showDelete:!t,children:_(Kt,{id:n,isConnectable:r,color:"positive"})}),UI=({data:e,dragging:t,id:n,isConnectable:r,selected:o})=>{const{label:i,missingRequiredParams:s}=e;return V(Ze,{id:n,isConnectable:r,missingRequiredEntry:s,nodeTitle:M(I.RECORD_CALL_START),selected:o,showDelete:!t,children:[i&&_("section",{className:"whitespace-nowrap px-4 pb-4 text-sm",children:i}),_(Kt,{id:n,isConnectable:r,color:"positive"})]})},FI=({data:e,dragging:t,id:n,isConnectable:r,selected:o})=>{var l;const i=(l=Gn(a=>a.entries))==null?void 0:l.find(a=>a.controlId===e.controlId),s=i==null?void 0:i.label;return V(Ze,{id:n,isConnectable:r,missingRequiredEntry:!s,nodeTitle:M(I.RECORD_CALL_STOP),selected:o,showDelete:!t,children:[s&&_("section",{className:"whitespace-nowrap px-4 pb-4 text-sm",children:s}),_(Kt,{id:n,color:"positive",isConnectable:r})]})},VI=({data:e,dragging:t,id:n,isConnectable:r,selected:o})=>V(Ze,{id:n,isConnectable:r,missingRequiredEntry:e.missingRequiredParams,nodeTitle:M(I.SEND_SMS),selected:o,showDelete:!t,children:[(e.body||e.toNumber)&&V("div",{className:"max-w-[300px] p-4 pt-0",children:[e.fromNumber&&V("p",{className:`whitespace-nowrap ${e.body?"pb-2":""}`,children:[M(I.FROM),": ",e.fromNumber]}),e.toNumber&&V("p",{className:`whitespace-nowrap ${e.body?"pb-2":""}`,children:[M(I.TO),": ",e.toNumber]}),e.body&&_("p",{className:"break-words pt-1 line-clamp-3",children:e.body})]}),_(Kt,{id:n,isConnectable:r})]}),BI={success:I.SUCCESS,failed:I.FAILED},$I={answer:xI,forwardAddress:Lf,forwardPhone:Lf,forwardResource:Lf,handleCall:AI,hangup:bI,play:DI,promptPlay:CI,record:MI,recordCallStart:UI,recordCallStop:FI,sendSms:VI,set:kI,unset:PI,request:({data:e,dragging:t,id:n,isConnectable:r,selected:o})=>{var i;return _(Ze,{id:n,isConnectable:r,missingRequiredEntry:e.missingRequiredParams,nodeTitle:M(I.REQUEST),selected:o,showDelete:!t,children:_(sa,{children:(i=e==null?void 0:e.options)==null?void 0:i.map(s=>_(Io,{id:s.id,optionText:M(BI[s.result]),color:Jv(s.result),isConnectable:r},s.id))})})},cond:({id:e,data:t,dragging:n,isConnectable:r,selected:o})=>_(Ze,{id:e,isConnectable:r,missingRequiredEntry:t.missingRequiredParams,nodeTitle:M(I.CONDITIONS),selected:o,showDelete:!n,children:V(sa,{children:[t.options.map((i,s)=>{const l=Boolean(i.value);return _(Io,{color:"positive",enabled:l,id:i.id,isConnectable:r,optionText:M(I.COND_NUMBER,{index:s+1})},i.id)}),_(Io,{color:"negative",id:t.fallback,isConnectable:r,optionText:M(I.ELSE)},t.fallback)]})})},zI={floating:pI},HI={duration:1e3,includeHiddenNodes:!0,padding:.3},jI=e=>({edges:e.edges,nodes:e.nodes,onConnect:e.onConnect,onConnectEnd:e.onConnectEnd,onConnectStart:e.onConnectStart,onEdgesChange:e.onEdgesChange,onEdgesDelete:e.onEdgesDelete,onEdgeUpdate:e.onEdgeUpdate,onEdgeUpdateEnd:e.onEdgeUpdateEnd,onEdgeUpdateStart:e.onEdgeUpdateStart,onInit:e.onInit,onNodeDragStart:e.onNodeDragStart,onNodeDragStop:e.onNodeDragStop,onNodesChange:e.onNodesChange,onNodesDelete:e.onNodesDelete,onSelectionChange:e.onSelectionChange}),WI=({children:e})=>{const{edges:t,nodes:n,onConnect:r,onConnectEnd:o,onConnectStart:i,onEdgesChange:s,onEdgesDelete:l,onEdgeUpdate:a,onEdgeUpdateEnd:u,onEdgeUpdateStart:c,onInit:f,onNodeDragStart:p,onNodeDragStop:h,onNodesChange:v,onNodesDelete:m,onSelectionChange:E}=ne(jI,Xe);return _(Yv,{className:"bg-sw-white !h-auto",connectionLineComponent:cI,connectionMode:Bn.Strict,defaultEdgeOptions:Zv,edges:t,edgeTypes:zI,fitView:!0,fitViewOptions:HI,nodes:n,nodeTypes:$I,onConnect:r,onConnectEnd:o,onConnectStart:i,onEdgesChange:s,onEdgesDelete:l,onEdgeUpdate:a,onEdgeUpdateEnd:u,onEdgeUpdateStart:c,onInit:f,onNodeDragStart:p,onNodeDragStop:h,onNodesChange:v,onNodesDelete:m,onSelectionChange:E,children:e})},GI=1e3,YI=e=>ne.setState({initializing:e}),KI=()=>{const e=ne(i=>i.initializing),t=ne(i=>i.flowInteractive),n=Re(),r=Dx(),o=N.useCallback(i=>{n.setState({nodesDraggable:i,nodesConnectable:i,elementsSelectable:i})},[n]);N.useEffect(()=>{let i;e&&(r?(i&&clearTimeout(i),i=setTimeout(()=>{o(!0),YI(!1)},GI)):o(!1))},[e,r,o]),N.useEffect(()=>{e||o(t)},[e,t,o])};/*!
62
62
  * tabbable 6.1.1
63
63
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
64
- */var QI=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],kf=QI.join(","),Fy=typeof Element>"u",Zi=Fy?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,la=!Fy&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e==null?void 0:e.ownerDocument},aa=function e(t,n){var r;n===void 0&&(n=!0);var o=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),i=o===""||o==="true",s=i||n&&t&&e(t.parentNode);return s},XI=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},qI=function(t,n,r){if(aa(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(kf));return n&&Zi.call(t,kf)&&o.unshift(t),o=o.filter(r),o},ZI=function e(t,n,r){for(var o=[],i=Array.from(t);i.length;){var s=i.shift();if(!aa(s,!1))if(s.tagName==="SLOT"){var l=s.assignedElements(),a=l.length?l:s.children,u=e(a,!0,r);r.flatten?o.push.apply(o,u):o.push({scopeParent:s,candidates:u})}else{var c=Zi.call(s,kf);c&&r.filter(s)&&(n||!t.includes(s))&&o.push(s);var f=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),p=!aa(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(f&&p){var h=e(f===!0?s.children:f.children,!0,r);r.flatten?o.push.apply(o,h):o.push({scopeParent:s,candidates:h})}else i.unshift.apply(i,s.children)}}return o},Vy=function(t,n){return t.tabIndex<0&&(n||/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||XI(t))&&isNaN(parseInt(t.getAttribute("tabindex"),10))?0:t.tabIndex},JI=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},By=function(t){return t.tagName==="INPUT"},eC=function(t){return By(t)&&t.type==="hidden"},tC=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},nC=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},rC=function(t){if(!t.name)return!0;var n=t.form||la(t),r=function(l){return n.querySelectorAll('input[type="radio"][name="'+l+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(t.name));else try{o=r(t.name)}catch(s){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",s.message),!1}var i=nC(o,t.form);return!i||i===t},oC=function(t){return By(t)&&t.type==="radio"},iC=function(t){return oC(t)&&!rC(t)},sC=function(t){var n,r=t&&la(t),o=(n=r)===null||n===void 0?void 0:n.host,i=!1;if(r&&r!==t){var s,l,a;for(i=!!((s=o)!==null&&s!==void 0&&(l=s.ownerDocument)!==null&&l!==void 0&&l.contains(o)||t!=null&&(a=t.ownerDocument)!==null&&a!==void 0&&a.contains(t));!i&&o;){var u,c,f;r=la(o),o=(u=r)===null||u===void 0?void 0:u.host,i=!!((c=o)!==null&&c!==void 0&&(f=c.ownerDocument)!==null&&f!==void 0&&f.contains(o))}}return i},$y=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},lC=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var i=Zi.call(t,"details>summary:first-of-type"),s=i?t.parentElement:t;if(Zi.call(s,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof o=="function"){for(var l=t;t;){var a=t.parentElement,u=la(t);if(a&&!a.shadowRoot&&o(a)===!0)return $y(t);t.assignedSlot?t=t.assignedSlot:!a&&u!==t.ownerDocument?t=u.host:t=a}t=l}if(sC(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return $y(t);return!1},aC=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return Zi.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},uC=function(t,n){return!(n.disabled||aa(n)||eC(n)||lC(n,t)||tC(n)||aC(n))},zy=function(t,n){return!(iC(n)||Vy(n)<0||!uC(t,n))},cC=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},fC=function e(t){var n=[],r=[];return t.forEach(function(o,i){var s=!!o.scopeParent,l=s?o.scopeParent:o,a=Vy(l,s),u=s?e(o.candidates):l;a===0?s?n.push.apply(n,u):n.push(l):r.push({documentOrder:i,tabIndex:a,item:o,isScope:s,content:u})}),r.sort(JI).reduce(function(o,i){return i.isScope?o.push.apply(o,i.content):o.push(i.content),o},[]).concat(n)},Hy=function(t,n){n=n||{};var r;return n.getShadowRoot?r=ZI([t],n.includeContainer,{filter:zy.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:cC}):r=qI(t,n.includeContainer,zy.bind(null,n)),fC(r)};function Ji(e){return e.split("-")[1]}function Pf(e){return e==="y"?"height":"width"}function Er(e){return e.split("-")[0]}function es(e){return["top","bottom"].includes(Er(e))?"x":"y"}function jy(e,t,n){let{reference:r,floating:o}=e;const i=r.x+r.width/2-o.width/2,s=r.y+r.height/2-o.height/2,l=es(t),a=Pf(l),u=r[a]/2-o[a]/2,c=l==="x";let f;switch(Er(t)){case"top":f={x:i,y:r.y-o.height};break;case"bottom":f={x:i,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:s};break;case"left":f={x:r.x-o.width,y:s};break;default:f={x:r.x,y:r.y}}switch(Ji(t)){case"start":f[l]-=u*(n&&c?-1:1);break;case"end":f[l]+=u*(n&&c?-1:1)}return f}const dC=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,l=i.filter(Boolean),a=await(s.isRTL==null?void 0:s.isRTL(t));let u=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:c,y:f}=jy(u,r,a),p=r,h={},v=0;for(let m=0;m<l.length;m++){const{name:E,fn:d}=l[m],{x:g,y,data:S,reset:w}=await d({x:c,y:f,initialPlacement:r,placement:p,strategy:o,middlewareData:h,rects:u,platform:s,elements:{reference:e,floating:t}});c=g??c,f=y??f,h={...h,[E]:{...h[E],...S}},w&&v<=50&&(v++,typeof w=="object"&&(w.placement&&(p=w.placement),w.rects&&(u=w.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):w.rects),{x:c,y:f}=jy(u,p,a)),m=-1)}return{x:c,y:f,placement:p,strategy:o,middlewareData:h}};function Wy(e){return typeof e!="number"?function(t){return{top:0,right:0,bottom:0,left:0,...t}}(e):{top:e,right:e,bottom:e,left:e}}function Mf(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}async function Gy(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:l,strategy:a}=e,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:f="floating",altBoundary:p=!1,padding:h=0}=t,v=Wy(h),m=l[p?f==="floating"?"reference":"floating":f],E=Mf(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(m)))==null||n?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:u,rootBoundary:c,strategy:a})),d=f==="floating"?{...s.floating,x:r,y:o}:s.reference,g=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),y=await(i.isElement==null?void 0:i.isElement(g))&&await(i.getScale==null?void 0:i.getScale(g))||{x:1,y:1},S=Mf(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:d,offsetParent:g,strategy:a}):d);return{top:(E.top-S.top+v.top)/y.y,bottom:(S.bottom-E.bottom+v.bottom)/y.y,left:(E.left-S.left+v.left)/y.x,right:(S.right-E.right+v.right)/y.x}}const pC=Math.min,hC=Math.max;function Uf(e,t,n){return hC(e,pC(t,n))}const Yy=e=>({name:"arrow",options:e,async fn(t){const{element:n,padding:r=0}=e||{},{x:o,y:i,placement:s,rects:l,platform:a}=t;if(n==null)return{};const u=Wy(r),c={x:o,y:i},f=es(s),p=Pf(f),h=await a.getDimensions(n),v=f==="y"?"top":"left",m=f==="y"?"bottom":"right",E=l.reference[p]+l.reference[f]-c[f]-l.floating[p],d=c[f]-l.reference[f],g=await(a.getOffsetParent==null?void 0:a.getOffsetParent(n));let y=g?f==="y"?g.clientHeight||0:g.clientWidth||0:0;y===0&&(y=l.floating[p]);const S=E/2-d/2,w=u[v],O=y-h[p]-u[m],T=y/2-h[p]/2+S,b=Uf(w,T,O),P=Ji(s)!=null&&T!=b&&l.reference[p]/2-(T<w?u[v]:u[m])-h[p]/2<0;return{[f]:c[f]-(P?T<w?w-T:O-T:0),data:{[f]:b,centerOffset:T-b}}}});["top","right","bottom","left"].reduce((e,t)=>e.concat(t,t+"-start",t+"-end"),[]);const gC={left:"right",right:"left",bottom:"top",top:"bottom"};function ua(e){return e.replace(/left|right|bottom|top/g,t=>gC[t])}function mC(e,t,n){n===void 0&&(n=!1);const r=Ji(e),o=es(e),i=Pf(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=ua(s)),{main:s,cross:ua(s)}}const vC={start:"end",end:"start"};function Ff(e){return e.replace(/start|end/g,t=>vC[t])}const yC=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n;const{placement:r,middlewareData:o,rects:i,initialPlacement:s,platform:l,elements:a}=t,{mainAxis:u=!0,crossAxis:c=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:v=!0,...m}=e,E=Er(r),d=Er(s)===s,g=await(l.isRTL==null?void 0:l.isRTL(a.floating)),y=f||(d||!v?[ua(s)]:function(B){const $=ua(B);return[Ff(B),$,Ff($)]}(s));f||h==="none"||y.push(...function(B,$,F,R){const D=Ji(B);let A=function(C,x,L){const U=["left","right"],z=["right","left"],j=["top","bottom"],K=["bottom","top"];switch(C){case"top":case"bottom":return L?x?z:U:x?U:z;case"left":case"right":return x?j:K;default:return[]}}(Er(B),F==="start",R);return D&&(A=A.map(C=>C+"-"+D),$&&(A=A.concat(A.map(Ff)))),A}(s,v,h,g));const S=[s,...y],w=await Gy(t,m),O=[];let T=((n=o.flip)==null?void 0:n.overflows)||[];if(u&&O.push(w[E]),c){const{main:B,cross:$}=mC(r,i,g);O.push(w[B],w[$])}if(T=[...T,{placement:r,overflows:O}],!O.every(B=>B<=0)){var b,P;const B=(((b=o.flip)==null?void 0:b.index)||0)+1,$=S[B];if($)return{data:{index:B,overflows:T},reset:{placement:$}};let F=(P=T.filter(R=>R.overflows[0]<=0).sort((R,D)=>R.overflows[1]-D.overflows[1])[0])==null?void 0:P.placement;if(!F)switch(p){case"bestFit":{var k;const R=(k=T.map(D=>[D.placement,D.overflows.filter(A=>A>0).reduce((A,C)=>A+C,0)]).sort((D,A)=>D[1]-A[1])[0])==null?void 0:k[0];R&&(F=R);break}case"initialPlacement":F=s}if(r!==F)return{reset:{placement:F}}}return{}}}},EC=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){const{x:n,y:r}=t,o=await async function(i,s){const{placement:l,platform:a,elements:u}=i,c=await(a.isRTL==null?void 0:a.isRTL(u.floating)),f=Er(l),p=Ji(l),h=es(l)==="x",v=["left","top"].includes(f)?-1:1,m=c&&h?-1:1,E=typeof s=="function"?s(i):s;let{mainAxis:d,crossAxis:g,alignmentAxis:y}=typeof E=="number"?{mainAxis:E,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...E};return p&&typeof y=="number"&&(g=p==="end"?-1*y:y),h?{x:g*m,y:d*v}:{x:d*v,y:g*m}}(t,e);return{x:n+o.x,y:r+o.y,data:o}}}};function SC(e){return e==="x"?"y":"x"}const _C=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:l={fn:E=>{let{x:d,y:g}=E;return{x:d,y:g}}},...a}=e,u={x:n,y:r},c=await Gy(t,a),f=es(Er(o)),p=SC(f);let h=u[f],v=u[p];if(i){const E=f==="y"?"bottom":"right";h=Uf(h+c[f==="y"?"top":"left"],h,h-c[E])}if(s){const E=p==="y"?"bottom":"right";v=Uf(v+c[p==="y"?"top":"left"],v,v-c[E])}const m=l.fn({...t,[f]:h,[p]:v});return{...m,data:{x:m.x-n,y:m.y-r}}}}};function at(e){var t;return((t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Qt(e){return at(e).getComputedStyle(e)}const Ky=Math.min,ts=Math.max,ca=Math.round;function Qy(e){const t=Qt(e);let n=parseFloat(t.width),r=parseFloat(t.height);const o=e.offsetWidth,i=e.offsetHeight,s=ca(n)!==o||ca(r)!==i;return s&&(n=o,r=i),{width:n,height:r,fallback:s}}function Yn(e){return qy(e)?(e.nodeName||"").toLowerCase():""}let fa;function Xy(){if(fa)return fa;const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?(fa=e.brands.map(t=>t.brand+"/"+t.version).join(" "),fa):navigator.userAgent}function Xt(e){return e instanceof at(e).HTMLElement}function Pt(e){return e instanceof at(e).Element}function qy(e){return e instanceof at(e).Node}function Zy(e){return typeof ShadowRoot>"u"?!1:e instanceof at(e).ShadowRoot||e instanceof ShadowRoot}function da(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Qt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function wC(e){return["table","td","th"].includes(Yn(e))}function Vf(e){const t=/firefox/i.test(Xy()),n=Qt(e),r=n.backdropFilter||n.WebkitBackdropFilter;return n.transform!=="none"||n.perspective!=="none"||!!r&&r!=="none"||t&&n.willChange==="filter"||t&&!!n.filter&&n.filter!=="none"||["transform","perspective"].some(o=>n.willChange.includes(o))||["paint","layout","strict","content"].some(o=>{const i=n.contain;return i!=null&&i.includes(o)})}function Bf(){return/^((?!chrome|android).)*safari/i.test(Xy())}function $f(e){return["html","body","#document"].includes(Yn(e))}function Jy(e){return Pt(e)?e:e.contextElement}const e0={x:1,y:1};function Co(e){const t=Jy(e);if(!Xt(t))return e0;const n=t.getBoundingClientRect(),{width:r,height:o,fallback:i}=Qy(t);let s=(i?ca(n.width):n.width)/r,l=(i?ca(n.height):n.height)/o;return s&&Number.isFinite(s)||(s=1),l&&Number.isFinite(l)||(l=1),{x:s,y:l}}function Sr(e,t,n,r){var o,i;t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),l=Jy(e);let a=e0;t&&(r?Pt(r)&&(a=Co(r)):a=Co(e));const u=l?at(l):window,c=Bf()&&n;let f=(s.left+(c&&((o=u.visualViewport)==null?void 0:o.offsetLeft)||0))/a.x,p=(s.top+(c&&((i=u.visualViewport)==null?void 0:i.offsetTop)||0))/a.y,h=s.width/a.x,v=s.height/a.y;if(l){const m=at(l),E=r&&Pt(r)?at(r):r;let d=m.frameElement;for(;d&&r&&E!==m;){const g=Co(d),y=d.getBoundingClientRect(),S=getComputedStyle(d);y.x+=(d.clientLeft+parseFloat(S.paddingLeft))*g.x,y.y+=(d.clientTop+parseFloat(S.paddingTop))*g.y,f*=g.x,p*=g.y,h*=g.x,v*=g.y,f+=y.x,p+=y.y,d=at(d).frameElement}}return{width:h,height:v,top:p,right:f+h,bottom:p+v,left:f,x:f,y:p}}function Kn(e){return((qy(e)?e.ownerDocument:e.document)||window.document).documentElement}function pa(e){return Pt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function t0(e){return Sr(Kn(e)).left+pa(e).scrollLeft}function ns(e){if(Yn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Zy(e)&&e.host||Kn(e);return Zy(t)?t.host:t}function n0(e){const t=ns(e);return $f(t)?t.ownerDocument.body:Xt(t)&&da(t)?t:n0(t)}function Qn(e,t){var n;t===void 0&&(t=[]);const r=n0(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),i=at(r);return o?t.concat(i,i.visualViewport||[],da(r)?r:[]):t.concat(r,Qn(r))}function r0(e,t,n){let r;if(t==="viewport")r=function(s,l){const a=at(s),u=Kn(s),c=a.visualViewport;let f=u.clientWidth,p=u.clientHeight,h=0,v=0;if(c){f=c.width,p=c.height;const m=Bf();(!m||m&&l==="fixed")&&(h=c.offsetLeft,v=c.offsetTop)}return{width:f,height:p,x:h,y:v}}(e,n);else if(t==="document")r=function(s){const l=Kn(s),a=pa(s),u=s.ownerDocument.body,c=ts(l.scrollWidth,l.clientWidth,u.scrollWidth,u.clientWidth),f=ts(l.scrollHeight,l.clientHeight,u.scrollHeight,u.clientHeight);let p=-a.scrollLeft+t0(s);const h=-a.scrollTop;return Qt(u).direction==="rtl"&&(p+=ts(l.clientWidth,u.clientWidth)-c),{width:c,height:f,x:p,y:h}}(Kn(e));else if(Pt(t))r=function(s,l){const a=Sr(s,!0,l==="fixed"),u=a.top+s.clientTop,c=a.left+s.clientLeft,f=Xt(s)?Co(s):{x:1,y:1};return{width:s.clientWidth*f.x,height:s.clientHeight*f.y,x:c*f.x,y:u*f.y}}(t,n);else{const s={...t};if(Bf()){var o,i;const l=at(e);s.x-=((o=l.visualViewport)==null?void 0:o.offsetLeft)||0,s.y-=((i=l.visualViewport)==null?void 0:i.offsetTop)||0}r=s}return Mf(r)}function o0(e,t){return Xt(e)&&Qt(e).position!=="fixed"?t?t(e):e.offsetParent:null}function i0(e,t){const n=at(e);let r=o0(e,t);for(;r&&wC(r)&&Qt(r).position==="static";)r=o0(r,t);return r&&(Yn(r)==="html"||Yn(r)==="body"&&Qt(r).position==="static"&&!Vf(r))?n:r||function(o){let i=ns(o);for(;Xt(i)&&!$f(i);){if(Vf(i))return i;i=ns(i)}return null}(e)||n}function RC(e,t,n){const r=Xt(t),o=Kn(t),i=Sr(e,!0,n==="fixed",t);let s={scrollLeft:0,scrollTop:0};const l={x:0,y:0};if(r||!r&&n!=="fixed")if((Yn(t)!=="body"||da(o))&&(s=pa(t)),Xt(t)){const a=Sr(t,!0);l.x=a.x+t.clientLeft,l.y=a.y+t.clientTop}else o&&(l.x=t0(o));return{x:i.left+s.scrollLeft-l.x,y:i.top+s.scrollTop-l.y,width:i.width,height:i.height}}const NC={getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=n==="clippingAncestors"?function(u,c){const f=c.get(u);if(f)return f;let p=Qn(u).filter(E=>Pt(E)&&Yn(E)!=="body"),h=null;const v=Qt(u).position==="fixed";let m=v?ns(u):u;for(;Pt(m)&&!$f(m);){const E=Qt(m),d=Vf(m);E.position==="fixed"?h=null:(v?d||h:d||E.position!=="static"||!h||!["absolute","fixed"].includes(h.position))?h=E:p=p.filter(g=>g!==m),m=ns(m)}return c.set(u,p),p}(t,this._c):[].concat(n),s=[...i,r],l=s[0],a=s.reduce((u,c)=>{const f=r0(t,c,o);return u.top=ts(f.top,u.top),u.right=Ky(f.right,u.right),u.bottom=Ky(f.bottom,u.bottom),u.left=ts(f.left,u.left),u},r0(t,l,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=Xt(n),i=Kn(n);if(n===i)return t;let s={scrollLeft:0,scrollTop:0},l={x:1,y:1};const a={x:0,y:0};if((o||!o&&r!=="fixed")&&((Yn(n)!=="body"||da(i))&&(s=pa(n)),Xt(n))){const u=Sr(n);l=Co(n),a.x=u.x+n.clientLeft,a.y=u.y+n.clientTop}return{width:t.width*l.x,height:t.height*l.y,x:t.x*l.x-s.scrollLeft*l.x+a.x,y:t.y*l.y-s.scrollTop*l.y+a.y}},isElement:Pt,getDimensions:function(e){return Xt(e)?Qy(e):e.getBoundingClientRect()},getOffsetParent:i0,getDocumentElement:Kn,getScale:Co,async getElementRects(e){let{reference:t,floating:n,strategy:r}=e;const o=this.getOffsetParent||i0,i=this.getDimensions;return{reference:RC(t,await o(n),r),floating:{x:0,y:0,...await i(n)}}},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>Qt(e).direction==="rtl"};function OC(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=!0,animationFrame:l=!1}=r,a=o&&!l,u=a||i?[...Pt(e)?Qn(e):e.contextElement?Qn(e.contextElement):[],...Qn(t)]:[];u.forEach(h=>{a&&h.addEventListener("scroll",n,{passive:!0}),i&&h.addEventListener("resize",n)});let c,f=null;if(s){let h=!0;f=new ResizeObserver(()=>{h||n(),h=!1}),Pt(e)&&!l&&f.observe(e),Pt(e)||!e.contextElement||l||f.observe(e.contextElement),f.observe(t)}let p=l?Sr(e):null;return l&&function h(){const v=Sr(e);!p||v.x===p.x&&v.y===p.y&&v.width===p.width&&v.height===p.height||n(),p=v,c=requestAnimationFrame(h)}(),n(),()=>{var h;u.forEach(v=>{a&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),(h=f)==null||h.disconnect(),f=null,l&&cancelAnimationFrame(c)}}const xC=(e,t,n)=>{const r=new Map,o={platform:NC,...n},i={...o.platform,_c:r};return dC(e,t,{...o,platform:i})},TC=e=>{const{element:t,padding:n}=e;function r(o){return Object.prototype.hasOwnProperty.call(o,"current")}return{name:"arrow",options:e,fn(o){return r(t)?t.current!=null?Yy({element:t.current,padding:n}).fn(o):{}:t?Yy({element:t,padding:n}).fn(o):{}}}};var ha=typeof document<"u"?N.useLayoutEffect:N.useEffect;function ga(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!ga(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!ga(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function s0(e){const t=N.useRef(e);return ha(()=>{t.current=e}),t}function IC(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,whileElementsMounted:i,open:s}=e,[l,a]=N.useState({x:null,y:null,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[u,c]=N.useState(r);ga(u,r)||c(r);const f=N.useRef(null),p=N.useRef(null),h=N.useRef(l),v=s0(i),m=s0(o),[E,d]=N.useState(null),[g,y]=N.useState(null),S=N.useCallback(k=>{f.current!==k&&(f.current=k,d(k))},[]),w=N.useCallback(k=>{p.current!==k&&(p.current=k,y(k))},[]),O=N.useCallback(()=>{if(!f.current||!p.current)return;const k={placement:t,strategy:n,middleware:u};m.current&&(k.platform=m.current),xC(f.current,p.current,k).then(B=>{const $={...B,isPositioned:!0};T.current&&!ga(h.current,$)&&(h.current=$,kr.flushSync(()=>{a($)}))})},[u,t,n,m]);ha(()=>{s===!1&&h.current.isPositioned&&(h.current.isPositioned=!1,a(k=>({...k,isPositioned:!1})))},[s]);const T=N.useRef(!1);ha(()=>(T.current=!0,()=>{T.current=!1}),[]),ha(()=>{if(E&&g){if(v.current)return v.current(E,g,O);O()}},[E,g,O,v]);const b=N.useMemo(()=>({reference:f,floating:p,setReference:S,setFloating:w}),[S,w]),P=N.useMemo(()=>({reference:E,floating:g}),[E,g]);return N.useMemo(()=>({...l,update:O,refs:b,elements:P,reference:S,floating:w}),[l,O,b,P,S,w])}var _r=typeof document<"u"?N.useLayoutEffect:N.useEffect;let zf=!1,CC=0;const l0=()=>"floating-ui-"+CC++;function AC(){const[e,t]=N.useState(()=>zf?l0():void 0);return _r(()=>{e==null&&t(l0())},[]),N.useEffect(()=>{zf||(zf=!0)},[]),e}const Hf=Rd["useId".toString()]||AC;function bC(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){e.set(t,(e.get(t)||[]).filter(r=>r!==n))}}}const LC=N.createContext(null),DC=N.createContext(null),a0=()=>{var e;return((e=N.useContext(LC))==null?void 0:e.id)||null},jf=()=>N.useContext(DC);function gn(e){return(e==null?void 0:e.ownerDocument)||document}function u0(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function kC(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}function Wf(e){return gn(e).defaultView||window}function qt(e){return e?e instanceof Wf(e).Element:!1}function c0(e){return e?e instanceof Wf(e).HTMLElement:!1}function PC(e){if(typeof ShadowRoot>"u")return!1;const t=Wf(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function MC(e){if(e.mozInputSource===0&&e.isTrusted)return!0;const t=/Android/i;return(t.test(u0())||t.test(kC()))&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function UC(e){return e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType!=="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0}function f0(){return/apple/i.test(navigator.vendor)}function FC(){return u0().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function d0(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function p0(e){const t=N.useRef(e);return _r(()=>{t.current=e}),t}const h0="data-floating-ui-safe-polygon";function Gf(e,t,n){return n&&!d0(n)?0:typeof e=="number"?e:e==null?void 0:e[t]}const VC=function(e,t){let{enabled:n=!0,delay:r=0,handleClose:o=null,mouseOnly:i=!1,restMs:s=0,move:l=!0}=t===void 0?{}:t;const{open:a,onOpenChange:u,dataRef:c,events:f,elements:{domReference:p,floating:h},refs:v}=e,m=jf(),E=a0(),d=p0(o),g=p0(r),y=N.useRef(),S=N.useRef(),w=N.useRef(),O=N.useRef(),T=N.useRef(!0),b=N.useRef(!1),P=N.useRef(()=>{}),k=N.useCallback(()=>{var R;const D=(R=c.current.openEvent)==null?void 0:R.type;return(D==null?void 0:D.includes("mouse"))&&D!=="mousedown"},[c]);N.useEffect(()=>{if(!n)return;function R(){clearTimeout(S.current),clearTimeout(O.current),T.current=!0}return f.on("dismiss",R),()=>{f.off("dismiss",R)}},[n,f]),N.useEffect(()=>{if(!n||!d.current||!a)return;function R(){k()&&u(!1)}const D=gn(h).documentElement;return D.addEventListener("mouseleave",R),()=>{D.removeEventListener("mouseleave",R)}},[h,a,u,n,d,c,k]);const B=N.useCallback(function(R){R===void 0&&(R=!0);const D=Gf(g.current,"close",y.current);D&&!w.current?(clearTimeout(S.current),S.current=setTimeout(()=>u(!1),D)):R&&(clearTimeout(S.current),u(!1))},[g,u]),$=N.useCallback(()=>{P.current(),w.current=void 0},[]),F=N.useCallback(()=>{if(b.current){const R=gn(v.floating.current).body;R.style.pointerEvents="",R.removeAttribute(h0),b.current=!1}},[v]);return N.useEffect(()=>{if(!n)return;function R(){return c.current.openEvent?["click","mousedown"].includes(c.current.openEvent.type):!1}function D(x){if(clearTimeout(S.current),T.current=!1,i&&!d0(y.current)||s>0&&Gf(g.current,"open")===0)return;c.current.openEvent=x;const L=Gf(g.current,"open",y.current);L?S.current=setTimeout(()=>{u(!0)},L):u(!0)}function A(x){if(R())return;P.current();const L=gn(h);if(clearTimeout(O.current),d.current){a||clearTimeout(S.current),w.current=d.current({...e,tree:m,x:x.clientX,y:x.clientY,onClose(){F(),$(),B()}});const U=w.current;L.addEventListener("mousemove",U),P.current=()=>{L.removeEventListener("mousemove",U)};return}B()}function C(x){R()||d.current==null||d.current({...e,tree:m,x:x.clientX,y:x.clientY,onClose(){F(),$(),B()}})(x)}if(qt(p)){const x=p;return a&&x.addEventListener("mouseleave",C),h==null||h.addEventListener("mouseleave",C),l&&x.addEventListener("mousemove",D,{once:!0}),x.addEventListener("mouseenter",D),x.addEventListener("mouseleave",A),()=>{a&&x.removeEventListener("mouseleave",C),h==null||h.removeEventListener("mouseleave",C),l&&x.removeEventListener("mousemove",D),x.removeEventListener("mouseenter",D),x.removeEventListener("mouseleave",A)}}},[p,h,n,e,i,s,l,B,$,F,u,a,m,g,d,c]),_r(()=>{var R;if(n&&a&&(R=d.current)!=null&&R.__options.blockPointerEvents&&k()){const C=gn(h).body;if(C.setAttribute(h0,""),C.style.pointerEvents="none",b.current=!0,qt(p)&&h){var D,A;const x=p,L=m==null||(D=m.nodesRef.current.find(U=>U.id===E))==null||(A=D.context)==null?void 0:A.elements.floating;return L&&(L.style.pointerEvents=""),x.style.pointerEvents="auto",h.style.pointerEvents="auto",()=>{x.style.pointerEvents="",h.style.pointerEvents=""}}}},[n,a,E,h,p,m,d,c,k]),_r(()=>{a||(y.current=void 0,$(),F())},[a,$,F]),N.useEffect(()=>()=>{$(),clearTimeout(S.current),clearTimeout(O.current),F()},[n,$,F]),N.useMemo(()=>{if(!n)return{};function R(D){y.current=D.pointerType}return{reference:{onPointerDown:R,onPointerEnter:R,onMouseMove(){a||s===0||(clearTimeout(O.current),O.current=setTimeout(()=>{T.current||u(!0)},s))}},floating:{onMouseEnter(){clearTimeout(S.current)},onMouseLeave(){f.emit("dismiss",{type:"mouseLeave",data:{returnFocus:!1}}),B(!1)}}}},[f,n,s,a,u,B])};function Yf(){return Yf=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Yf.apply(this,arguments)}function g0(e){let t=e.activeElement;for(;((n=t)==null||(r=n.shadowRoot)==null?void 0:r.activeElement)!=null;){var n,r;t=t.shadowRoot.activeElement}return t}function Kf(e,t){if(!e||!t)return!1;const n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&PC(n)){let r=t;do{if(r&&e===r)return!0;r=r.parentNode||r.host}while(r)}return!1}function Qf(e,t){let n=e.filter(o=>{var i;return o.parentId===t&&((i=o.context)==null?void 0:i.open)})||[],r=n;for(;r.length;)r=e.filter(o=>{var i;return(i=r)==null?void 0:i.some(s=>{var l;return o.parentId===s.id&&((l=o.context)==null?void 0:l.open)})})||[],n=n.concat(r);return n}function BC(e){return"composedPath"in e?e.composedPath()[0]:e.target}const m0=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function v0(e,t){const n=Hy(e,m0());t==="prev"&&n.reverse();const r=n.indexOf(g0(gn(e)));return n.slice(r+1)[0]}function $C(){return v0(document.body,"next")}function zC(){return v0(document.body,"prev")}function Xf(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Kf(n,r)}function HC(e){Hy(e,m0()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function jC(e){e.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}const WC=Rd["useInsertionEffect".toString()]||(e=>e());function qf(e){const t=N.useRef(()=>{});return WC(()=>{t.current=e}),N.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}const y0={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0};let Zf,Jf;function E0(e){e.key==="Tab"&&(Zf=e.target,clearTimeout(Jf))}function GC(e){const t=Zf===e.relatedTarget;return Zf=e.relatedTarget,clearTimeout(Jf),t}const S0=N.forwardRef(function(t,n){const r=qf(t.onFocus),[o,i]=N.useState();return _r(()=>(f0()&&i("button"),document.addEventListener("keydown",E0),()=>{document.removeEventListener("keydown",E0)}),[]),N.createElement("span",Yf({},t,{ref:n,tabIndex:0,role:o,"aria-hidden":o?void 0:!0,"data-floating-ui-focus-guard":"",style:y0,onFocus:s=>{f0()&&FC()&&!GC(s)?(s.persist(),Jf=window.setTimeout(()=>{r(s)},50)):r(s)}}))}),_0=N.createContext(null),YC=function(e){let{id:t,enabled:n=!0}=e===void 0?{}:e;const[r,o]=N.useState(null),i=Hf(),s=QC();return _r(()=>{if(!n)return;const l=t?document.getElementById(t):null;if(l)l.setAttribute("data-floating-ui-portal",""),o(l);else{const a=document.createElement("div");t!==""&&(a.id=t||i),a.setAttribute("data-floating-ui-portal",""),o(a);const u=(s==null?void 0:s.portalNode)||document.body;return u.appendChild(a),()=>{u.removeChild(a)}}},[t,s,i,n]),r},KC=e=>{let{children:t,id:n,root:r=null,preserveTabOrder:o=!0}=e;const i=YC({id:n,enabled:!r}),[s,l]=N.useState(null),a=N.useRef(null),u=N.useRef(null),c=N.useRef(null),f=N.useRef(null),p=!!s&&!s.modal&&!!(r||i)&&o;return N.useEffect(()=>{if(!i||!o||s!=null&&s.modal)return;function h(v){i&&Xf(v)&&(v.type==="focusin"?jC:HC)(i)}return i.addEventListener("focusin",h,!0),i.addEventListener("focusout",h,!0),()=>{i.removeEventListener("focusin",h,!0),i.removeEventListener("focusout",h,!0)}},[i,o,s==null?void 0:s.modal]),N.createElement(_0.Provider,{value:N.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:a,afterOutsideRef:u,beforeInsideRef:c,afterInsideRef:f,portalNode:i,setFocusManagerState:l}),[o,i])},p&&i&&N.createElement(S0,{"data-type":"outside",ref:a,onFocus:h=>{if(Xf(h,i)){var v;(v=c.current)==null||v.focus()}else{const m=zC()||(s==null?void 0:s.refs.domReference.current);m==null||m.focus()}}}),p&&i&&N.createElement("span",{"aria-owns":i.id,style:y0}),r?kr.createPortal(t,r):i?kr.createPortal(t,i):null,p&&i&&N.createElement(S0,{"data-type":"outside",ref:u,onFocus:h=>{if(Xf(h,i)){var v;(v=f.current)==null||v.focus()}else{const m=$C()||(s==null?void 0:s.refs.domReference.current);m==null||m.focus(),s!=null&&s.closeOnFocusOut&&(s==null||s.onOpenChange(!1))}}}))},QC=()=>N.useContext(_0);function ma(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}const XC={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},qC={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},ZC=function(e){var t,n;return e===void 0&&(e=!0),{escapeKeyBubbles:typeof e=="boolean"?e:(t=e.escapeKey)!=null?t:!0,outsidePressBubbles:typeof e=="boolean"?e:(n=e.outsidePress)!=null?n:!0}},JC=function(e,t){let{open:n,onOpenChange:r,events:o,nodeId:i,elements:{reference:s,domReference:l,floating:a},dataRef:u}=e,{enabled:c=!0,escapeKey:f=!0,outsidePress:p=!0,outsidePressEvent:h="pointerdown",referencePress:v=!1,referencePressEvent:m="pointerdown",ancestorScroll:E=!1,bubbles:d=!0}=t===void 0?{}:t;const g=jf(),y=a0()!=null,S=qf(typeof p=="function"?p:()=>!1),w=typeof p=="function"?S:p,O=N.useRef(!1),{escapeKeyBubbles:T,outsidePressBubbles:b}=ZC(d);return N.useEffect(()=>{if(!n||!c)return;u.current.__escapeKeyBubbles=T,u.current.__outsidePressBubbles=b;function P(R){if(R.key==="Escape"){const D=g?Qf(g.nodesRef.current,i):[];if(D.length>0){let A=!0;if(D.forEach(C=>{var x;if((x=C.context)!=null&&x.open&&!C.context.dataRef.current.__escapeKeyBubbles){A=!1;return}}),!A)return}o.emit("dismiss",{type:"escapeKey",data:{returnFocus:{preventScroll:!1}}}),r(!1)}}function k(R){const D=O.current;if(O.current=!1,D||typeof w=="function"&&!w(R))return;const A=BC(R);if(c0(A)&&a){const L=a.ownerDocument.defaultView||window,U=A.scrollWidth>A.clientWidth,z=A.scrollHeight>A.clientHeight;let j=z&&R.offsetX>A.clientWidth;if(z&&L.getComputedStyle(A).direction==="rtl"&&(j=R.offsetX<=A.offsetWidth-A.clientWidth),j||U&&R.offsetY>A.clientHeight)return}const C=g&&Qf(g.nodesRef.current,i).some(L=>{var U;return ma(R,(U=L.context)==null?void 0:U.elements.floating)});if(ma(R,a)||ma(R,l)||C)return;const x=g?Qf(g.nodesRef.current,i):[];if(x.length>0){let L=!0;if(x.forEach(U=>{var z;if((z=U.context)!=null&&z.open&&!U.context.dataRef.current.__outsidePressBubbles){L=!1;return}}),!L)return}o.emit("dismiss",{type:"outsidePress",data:{returnFocus:y?{preventScroll:!0}:MC(R)||UC(R)}}),r(!1)}function B(){r(!1)}const $=gn(a);f&&$.addEventListener("keydown",P),w&&$.addEventListener(h,k);let F=[];return E&&(qt(l)&&(F=Qn(l)),qt(a)&&(F=F.concat(Qn(a))),!qt(s)&&s&&s.contextElement&&(F=F.concat(Qn(s.contextElement)))),F=F.filter(R=>{var D;return R!==((D=$.defaultView)==null?void 0:D.visualViewport)}),F.forEach(R=>{R.addEventListener("scroll",B,{passive:!0})}),()=>{f&&$.removeEventListener("keydown",P),w&&$.removeEventListener(h,k),F.forEach(R=>{R.removeEventListener("scroll",B)})}},[u,a,l,s,f,w,h,o,g,i,n,r,E,c,T,b,y]),N.useEffect(()=>{O.current=!1},[w,h]),N.useMemo(()=>c?{reference:{[XC[m]]:()=>{v&&(o.emit("dismiss",{type:"referencePress",data:{returnFocus:!1}}),r(!1))}},floating:{[qC[h]]:()=>{O.current=!0}}}:{},[c,o,v,h,m,r])},eA=function(e,t){let{open:n,onOpenChange:r,dataRef:o,events:i,refs:s,elements:{floating:l,domReference:a}}=e,{enabled:u=!0,keyboardOnly:c=!0}=t===void 0?{}:t;const f=N.useRef(""),p=N.useRef(!1),h=N.useRef();return N.useEffect(()=>{if(!u)return;const m=gn(l).defaultView||window;function E(){!n&&c0(a)&&a===g0(gn(a))&&(p.current=!0)}return m.addEventListener("blur",E),()=>{m.removeEventListener("blur",E)}},[l,a,n,u]),N.useEffect(()=>{if(!u)return;function v(m){(m.type==="referencePress"||m.type==="escapeKey")&&(p.current=!0)}return i.on("dismiss",v),()=>{i.off("dismiss",v)}},[i,u]),N.useEffect(()=>()=>{clearTimeout(h.current)},[]),N.useMemo(()=>u?{reference:{onPointerDown(v){let{pointerType:m}=v;f.current=m,p.current=!!(m&&c)},onMouseLeave(){p.current=!1},onFocus(v){var m;p.current||v.type==="focus"&&((m=o.current.openEvent)==null?void 0:m.type)==="mousedown"&&o.current.openEvent&&ma(o.current.openEvent,a)||(o.current.openEvent=v.nativeEvent,r(!0))},onBlur(v){p.current=!1;const m=v.relatedTarget,E=qt(m)&&m.hasAttribute("data-floating-ui-focus-guard")&&m.getAttribute("data-type")==="outside";h.current=setTimeout(()=>{Kf(s.floating.current,m)||Kf(a,m)||E||r(!1)})}}}:{},[u,c,a,s,o,r])};function w0(e){return N.useMemo(()=>e.every(t=>t==null)?null:t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})},e)}const tA=function(e,t){let{open:n}=e,{enabled:r=!0,role:o="dialog"}=t===void 0?{}:t;const i=Hf(),s=Hf();return N.useMemo(()=>{const l={id:i,role:o};return r?o==="tooltip"?{reference:{"aria-describedby":n?i:void 0},floating:l}:{reference:{"aria-expanded":n?"true":"false","aria-haspopup":o==="alertdialog"?"dialog":o,"aria-controls":n?i:void 0,...o==="listbox"&&{role:"combobox"},...o==="menu"&&{id:s}},floating:{...l,...o==="menu"&&{"aria-labelledby":s}}}:{}},[r,o,n,i,s])};function nA(e){e===void 0&&(e={});const{open:t=!1,onOpenChange:n,nodeId:r}=e,o=IC(e),i=jf(),s=N.useRef(null),l=N.useRef({}),a=N.useState(()=>bC())[0],[u,c]=N.useState(null),f=N.useCallback(d=>{const g=qt(d)?{getBoundingClientRect:()=>d.getBoundingClientRect(),contextElement:d}:d;o.refs.setReference(g)},[o.refs]),p=N.useCallback(d=>{(qt(d)||d===null)&&(s.current=d,c(d)),(qt(o.refs.reference.current)||o.refs.reference.current===null||d!==null&&!qt(d))&&o.refs.setReference(d)},[o.refs]),h=N.useMemo(()=>({...o.refs,setReference:p,setPositionReference:f,domReference:s}),[o.refs,p,f]),v=N.useMemo(()=>({...o.elements,domReference:u}),[o.elements,u]),m=qf(n),E=N.useMemo(()=>({...o,refs:h,elements:v,dataRef:l,nodeId:r,events:a,open:t,onOpenChange:m}),[o,r,a,t,m,h,v]);return _r(()=>{const d=i==null?void 0:i.nodesRef.current.find(g=>g.id===r);d&&(d.context=E)}),N.useMemo(()=>({...o,context:E,refs:h,reference:p,positionReference:f}),[o,h,E,p,f])}function ed(e,t,n){const r=new Map;return{...n==="floating"&&{tabIndex:-1},...e,...t.map(o=>o?o[n]:null).concat(e).reduce((o,i)=>(i&&Object.entries(i).forEach(s=>{let[l,a]=s;if(l.indexOf("on")===0){if(r.has(l)||r.set(l,[]),typeof a=="function"){var u;(u=r.get(l))==null||u.push(a),o[l]=function(){for(var c,f=arguments.length,p=new Array(f),h=0;h<f;h++)p[h]=arguments[h];(c=r.get(l))==null||c.forEach(v=>v(...p))}}}else o[l]=a}),o),{})}}const rA=function(e){e===void 0&&(e=[]);const t=e,n=N.useCallback(i=>ed(i,e,"reference"),t),r=N.useCallback(i=>ed(i,e,"floating"),t),o=N.useCallback(i=>ed(i,e,"item"),e.map(i=>i==null?void 0:i.item));return N.useMemo(()=>({getReferenceProps:n,getFloatingProps:r,getItemProps:o}),[n,r,o])};function oA({initialOpen:e=!1,placement:t="top",open:n,onOpenChange:r}={}){const o=_t.useRef(null),[i,s]=_t.useState(e),l=n??i,a=r??s,u=nA({placement:t,open:l,onOpenChange:a,whileElementsMounted:OC,strategy:"fixed",middleware:[EC(8),yC(),_C({padding:8}),TC({element:o})]}),c=u.context,f=VC(c,{move:!1,enabled:n==null}),p=eA(c,{enabled:n==null}),h=JC(c),v=tA(c,{role:"tooltip"}),m=rA([f,p,h,v]);return _t.useMemo(()=>({open:l,setOpen:a,arrowRef:o,...m,...u}),[l,a,m,u])}const R0=_t.createContext(null),td=()=>{const e=_t.useContext(R0);if(e==null)throw new Error("Tooltip components must be wrapped in <Tooltip />");return e};function iA({children:e,...t}){const n=oA(t);return _(R0.Provider,{value:n,children:e})}const sA={top:"-bottom-1 before:border-t-0 before:border-l-0",bottom:"-top-1 before:border-b-0 before:border-r-0",right:"-right-1 before:border-r-0 before:border-t-0",left:"-left-1 before:border-l-0 before:border-b-0"},lA=({placement:e="top"})=>{const t=td(),[n,r]=N.useState(t.middlewareData.arrow);N.useEffect(()=>{t.middlewareData.arrow&&r(t.middlewareData.arrow)},[t.middlewareData.arrow]);const o={top:n!=null&&n.y?`${n.y??0}px`:void 0,left:n!=null&&n.x?`${n.x??0}px`:void 0},i=`${sA[e]}`;return _("div",{ref:t.arrowRef,style:o,className:`tooltip-arrow absolute w-2 h-2 bg-inherit rotate-45
65
- before:absolute before:w-2 before:h-2 before:content-[''] before:border before:border-foreground/30
66
- ${i}`})},aA=_t.forwardRef(function(t,n){var a;const r=ne(u=>u.rootElementId),o=N.useRef(null),i=td(),s=document.getElementById(r);if(s&&!o.current&&(o.current=(a=s.shadowRoot)==null?void 0:a.getRootNode()),!o.current)throw new Error(`shadowRoot id:${r} not found. Floating portal cannot be rendered`);const l=w0([i.refs.setFloating,n]);return _(KC,{root:o.current,children:i.open&&V("div",{className:"relative max-w-sm rounded-md bg-foreground p-2 text-sm leading-4 text-background shadow-sm",ref:l,style:{position:i.strategy,top:i.y??0,left:i.x??0,visibility:i.x==null?"hidden":"visible",...t.style},...i.getFloatingProps(t),children:[t.children,_(lA,{placement:i.placement})]})})}),uA=_t.forwardRef(function({children:t,asChild:n=!1,...r},o){const i=td(),s=w0([i.refs.setReference,o,t==null?void 0:t.ref]);return n&&_t.isValidElement(t)?_t.cloneElement(t,i.getReferenceProps({ref:s,...r,...t.props,"data-state":i.open?"open":"closed"})):_("button",{ref:s,"data-state":i.open?"open":"closed",...i.getReferenceProps(r),children:t})}),rs=({asChild:e=!0,children:t,placement:n="top",trigger:r=_(Et,{tag:"circle-info"})})=>V(iA,{placement:n,children:[_(uA,{asChild:e,children:r}),_(aA,{children:t})]}),cA={initial:I.STATUS_LOADING,saving:I.STATUS_SAVING,"awaiting-save":I.STATUS_SAVING,saved:I.STATUS_SAVED,error:I.STATUS_ERROR},N0=e=>(e.preventDefault(),e.returnValue=""),fA=({className:e=""})=>{const t=ne(o=>o.saveFlowStatus),n=cA[t];t==="saved"?removeEventListener("beforeunload",N0,{capture:!0}):addEventListener("beforeunload",N0,{capture:!0});const r=t==="error";return V("div",{"aria-live":r?"assertive":"polite",className:`react-flow__controls-button hidden min-w-[3.625rem] cursor-auto select-auto bg-background text-center text-sm hover:bg-background active:bg-background sm:block ${e} ${r?"text-negative":"text-foreground"}`,role:r?"alert":"status",children:[_("p",{children:M(n)}),r&&_(rs,{trigger:V("div",{className:"flex items-center justify-center pl-1",role:"tooltip",tabIndex:0,children:[_("span",{className:"sr-only",children:M(I.MORE_INFO_STATUS_ERROR)}),_(Et,{tag:"circle-exclamation"})]}),children:M(I.INFO_STATUS_ERROR)})]})},dA=()=>{KI();const e=ne(n=>n.isDraggingNode),t=ne(n=>n.rootAppWidth);return _(Bx,{className:e?"group/control-buttons":"",position:"top-left",showInteractive:Boolean(t&&t>=qv),children:_(fA,{})})},O0=/^[\w\d ']+$/,x0=/^\d+$/,T0=/^\d|\*|#$/,pA=/^[\d|\*|#$]{0,12}$/,hA=/^.{1,20}$/,I0=/^[a-z0-9_]{1,20}$/,va={MIN:1,MAX:99},wr=e=>(/(?:\/\^)(.+)(?:\$\/)/.exec(e.toString())??[])[1],nd=e=>t=>Boolean(e.exec(t)),rd=e=>nd(T0)(e),od=e=>nd(O0)(e),C0=e=>nd(I0)(e),A0=e=>typeof e=="string"&&e===""||Array.isArray(e)&&e.length===0?!1:typeof e=="object"&&e!==null?Object.keys(e).length===0?!1:Object.values(e).every(A0):!0,gA=e=>{var i;const t=N.useRef(),n=Ax(),r=e&&"options"in e.data?(i=e.data.options)==null?void 0:i.length:0;return t.current=r,{updateDynamicHandles:s=>{"options"in s&&s.options.length!==t.current&&(e&&n(e.id),t.current=s.options.length)}}},Zt=e=>{const[t,n]=N.useReducer((r,o)=>({...r,...o}),e);return[t,n]},os=({displayData:e,formRef:t,setCompleted:n})=>{N.useEffect(()=>{var l,a;const r=t.current,o=new FormData(r),i=Object.fromEntries(o.entries());let s=!0;for(const u of Object.keys(i)){if(((l=e[u])==null?void 0:l.valid)!==void 0&&(s=s&&Boolean((a=e[u])==null?void 0:a.valid),s)){const c=r.elements.namedItem(u);c&&"checkValidity"in c&&(s=s&&c.checkValidity())}if(!s)break}n(s)},[e,t,n])},b0={url:I.PLAY_AUDIO_FILE,text:I.TEXT_TO_SPEECH},L0=({displayData:e,label:t,handleOnUpdate:n,setDisplayData:r,showDefaultOption:o})=>{var a,u;const i=e.selected.value,s=c=>{const f=c.currentTarget.value;r({selected:{value:f,valid:Boolean(f)||!o}}),n({selected:f})},l=c=>{const f=c.target,{name:p,value:h}=f,v=h.trim();let m=!0;switch(p){case"url":m=f.checkValidity(),r({[p]:{value:h,valid:m}}),n({text:"",url:m?v:""});break;case"text":m=f.checkValidity()&&v.length>0,r({[p]:{value:h,valid:m}}),n({text:m?v:"",url:""});break;default:throw new Error(`Unhandled input name: ${p}`)}};return V("div",{children:[V("label",{children:[_("span",{className:"sr-only",children:t}),V(yr,{className:"w-full",name:"selected",onChange:s,value:i,children:[o&&_("option",{value:"",children:M(I.SELECT)}),Object.keys(b0).map(c=>_("option",{value:c,children:M(b0[c])},c))]})]}),i&&_(mA,{name:i,onChange:l,required:!0,selected:i,valid:(a=e[i])==null?void 0:a.valid,value:(u=e[i])==null?void 0:u.value})]})},mA=({name:e,onChange:t,required:n,selected:r,valid:o,value:i})=>{const l={url:_(qi,{errorText:M(I.ERROR_URL_IS_REQUIRED),inputMode:"url",label:M(I.PLAY_AUDIO_FILE),name:e,onChange:t,placeholder:M(I.ENTER_URL),required:n,valid:o,value:i}),text:_(qi,{errorText:M(I.ERROR_VALUE_IS_REQUIRED),inputMode:"text",label:M(I.TEXT_TO_SPEECH),name:e,onChange:t,placeholder:M(I.WRITE_SOMETHING),required:n,valid:o,value:i})}[r];return _(be,{children:l})},vA=[{field:"stereo",title:I.STEREO,subtitle:I.STEREO_SUBTITLE},{field:"beep",title:I.BEEP,subtitle:I.BEEP_SUBTITLE}],D0=({displayData:e,handleOnUpdate:t,setDisplayData:n})=>{const r=s=>{const l=s.target.name,a=!e[l].value,u={[l]:{value:a}};n(u),t({[l]:a})},o=s=>{const l=s.target,{name:a,value:u}=l,c=l.checkValidity(),f={[a]:{value:u,valid:c}};n(f),t({[a]:c?u.trim():""})},i=s=>{const l=s.target.name,a=s.target.value,u={[l]:{value:a,valid:!0}};n(u),t({[l]:a})};return V(be,{children:[_("div",{className:"mb-5",children:vA.map(s=>{const l=e[s.field].value;return _("div",{children:_(Uy,{checked:l,clickHandler:r,name:s.field,subtitle:M(s.subtitle),title:M(s.title)})},s.field)})}),V("label",{children:[M(I.TERMINATORS),_("input",{className:`w-full ${e.terminators.valid?"":"invalid"}`,defaultValue:e.terminators.value||"",name:"terminators",onChange:o,pattern:wr(pA),placeholder:"#*0",type:"text"}),_("p",{className:"requirements",role:"alert",children:M(I.ERROR_TERMINATORS)})]}),V("label",{children:[M(I.FORMAT),V(yr,{className:"w-full",value:e.format.value,name:"format",onChange:i,children:[_("option",{value:"mp3",children:"MP3"}),_("option",{value:"wav",children:"WAV"})]})]})]})},St=({children:e,formRef:t,info:n,handleOnChange:r=()=>null,title:o})=>_("form",{className:"flex h-full flex-col overflow-hidden",noValidate:!0,onChange:r,ref:t,children:V("div",{className:"flex flex-col overflow-hidden",children:[V("legend",{className:"mb-2 flex w-full shrink-0 items-center justify-between px-4",children:[_("span",{className:"text-lg font-semibold leading-6",children:o}),n&&_(rs,{trigger:V("div",{role:"tooltip",tabIndex:0,children:[_("span",{className:"sr-only",children:M(I.MORE_INFO_TITLE,{title:o})}),_(Et,{tag:"circle-info"})]}),children:n})]}),_("div",{className:"mx-1 flex-1 overflow-y-auto px-3",children:e})]})}),k0=()=>({value:{id:Me(),value:""},valid:!0}),id=e=>e.every(t=>t.valid),yA=({nodeData:e,handleOnUpdate:t})=>{const n=N.useRef(),r={options:{value:e.options.length?e.options.map(v=>({value:v,valid:Boolean(v.value)})):[k0()],valid:!0}},[o,i]=Zt(r);os({displayData:o,formRef:n,setCompleted:v=>{t({},v)}});const l=v=>{v.preventDefault();const m=[...o.options.value,k0()];i({options:{value:m,valid:id(m)}}),t({options:m.map(E=>E.value)})},a=v=>{const E=o.options.value.filter((d,g)=>g!==v);i({options:{value:E,valid:id(E)}}),t({options:E.map(d=>d.value)})},u=(v,m)=>v.map(d=>d.value.id===m.value.id?{...d,...m}:d),c=v=>v.map(m=>({...m.value,value:m.value.value.trim()})),f=(v,m)=>{const E=o.options.value;E[v]||Ct().error(`Option not found at index ${v}`);const d=E[v],g={...d==null?void 0:d.value,...m},y=Boolean(g.value.trim()),S={value:g,valid:y},w=u(o.options.value,S);i({options:{value:w,valid:id(w)}}),t({options:c(w)})},p=(v,m)=>{const E=v.target,{name:d,value:g}=E;switch(d){case"value":m!==void 0&&f(m,{[d]:g});break;default:Ct().error(`Unhandled input name: ${d}`)}},h=o.options.value;return _(St,{formRef:n,info:M(I.INFO_NODE_COND),title:M(I.CONDITIONS),children:_("div",{className:"divide-y divide-foreground/10",children:h.map((v,m,E)=>V("div",{className:"mb-3",children:[V("div",{className:"flex items-center",children:[_("h2",{className:"nowrap flex-1 py-4 text-sm font-medium uppercase leading-4 text-foreground/50",children:M(I.CONDITION_NUMBER,{index:m+1})}),Boolean(h.length>1)&&_(rs,{trigger:V("button",{className:"px-2",onClick:()=>a(m),type:"button",children:[_("span",{className:"sr-only",children:M(I.REMOVE_CONDITION,{index:m+1})}),_(Et,{tag:"xmark"})]}),children:M(I.INFO_NODE_OPTION_REMOVE)})]}),V("label",{className:"flex flex-col",children:[_("input",{className:`w-full ${v.valid?"":"invalid"}`,defaultValue:v.value.value,name:"value",onChange:d=>p(d,m),placeholder:"%{count} > 3, /hello/.test('%{foo}')",type:"text"}),_("p",{className:"requirements",role:"alert",children:M(I.ERROR_VALUE_IS_REQUIRED)})]}),m===E.length-1&&V("button",{onClick:l,type:"button",className:"mb-3 text-primary",children:["+ ",M(I.ADD_CONDITION)]})]},v.value.id))})})},EA={address:{info:I.INFO_NODE_FORWARD_TO_ADDRESS,title:I.FORWARD_TO_ADDRESS,call:I.CALL_ADDRESSES,single:I.SINGLE_ADDRESS,multiple:I.MULTIPLE_ADDRESSES},phone:{info:I.INFO_NODE_FORWARD_TO_PHONE,title:I.FORWARD_TO_PHONE,call:I.CALL_NUMBERS,single:I.SINGLE_NUMBER,multiple:I.MULTIPLE_NUMBERS},resource:{info:I.INFO_NODE_FORWARD_TO_RESOURCE,title:I.FORWARD_TO_RESOURCE,call:I.CALL_RESOURCES,single:I.SINGLE_RESOURCE,multiple:I.MULTIPLE_RESOURCES}},sd=({destinationType:e,nodeData:t,handleOnUpdate:n})=>{const r=N.useRef(),o=EA[e],i={single:o.single,multiple:o.multiple},s={callOrder:{value:"serial"},destinationList:{value:Wx(t.destinations),valid:!0},destinationSingle:{value:t.destinations.length===1&&t.destinations[0]?t.destinations[0]:"",valid:!0},sessionTimeout:{value:t.sessionTimeout,valid:!0},type:{value:t.type??"single"}},[l,a]=Zt(s);os({displayData:l,formRef:r,setCompleted:h=>{n({},h)}});const c=h=>{const v=h.currentTarget.value,m=l.destinationSingle.value;let E="single",d=m.trim()?[m.trim()]:[];v==="multiple"&&(E=l.callOrder.value,d=Of(l.destinationList.value)),a({type:{value:E}}),n({destinations:d,type:E})},f=h=>{const v=h.currentTarget.value;a({type:{value:v}}),n({type:v})},p=h=>{const v=h.target,m=v.name,E=v.value;let d=!0;switch(m){case"destinationSingle":d=v.checkValidity()&&E.trim().length>0,a({[m]:{value:E,valid:d}}),n({destinations:d?[E.trim()]:[]});break;case"destinationList":d=v.checkValidity()&&Boolean(Of(E).length),a({[m]:{value:E,valid:d}}),n({destinations:d?Of(E):[]});break;case"sessionTimeout":d=v.checkValidity(),a({[m]:{value:E?Number.parseInt(E,10):void 0,valid:d}}),n({sessionTimeout:d&&E?Number.parseInt(E,10):void 0});break;default:throw new Error(`Unhandled input name: ${m}`)}};return V(St,{info:M(o.info),title:M(o.title),formRef:r,children:[_("div",{className:"mb-1",children:V("label",{children:[_("span",{className:"sr-only",children:M(I.CHOOSE_OPTION_SINGLE_MULTIPLE)}),_(yr,{className:"w-full",name:"quantity",onChange:c,value:l.type.value==="single"?"single":"multiple",children:Object.keys(i).map(h=>_("option",{value:h,children:M(i[h])},h))})]})}),_("div",{children:l.type.value==="single"?_(SA,{displayData:l,destinationType:e,handleChange:p}):_(_A,{displayData:l,destinationType:e,handleCallOrderSelectChange:f,handleChange:p,labels:o})}),e!=="phone"&&V("label",{children:[_("div",{children:M(I.DISCONNECT_CALL_AFTER_RINGING)}),V("div",{className:"flex flex-wrap items-center gap-x-2",children:[_("input",{className:`w-14 ${l.sessionTimeout.valid?"":"invalid"}`,defaultValue:l.sessionTimeout.value,min:0,name:"sessionTimeout",onChange:p,pattern:wr(x0),type:"number",inputMode:"numeric"}),M(I.SECONDS),_("p",{className:"requirements w-full",role:"alert",children:M(I.ERROR_NUMBER_IS_REQUIRED)})]})]})]})},SA=({displayData:e,destinationType:t,handleChange:n})=>V(be,{children:[V("label",{children:[_("span",{className:"sr-only",children:M(I.SINGLE_NUMBER)}),_("input",{className:`w-full ${e.destinationSingle.valid?"":"invalid"}`,defaultValue:e.destinationSingle.value,name:"destinationSingle",onChange:n,placeholder:"+1 (204) 000 0000",required:!0,type:t==="phone"?"tel":"text"}),_("p",{className:"requirements",role:"alert",children:M(I.ERROR_VALUE_IS_REQUIRED)})]}),t!=="phone"&&_("div",{className:"mb-4 pt-4 text-xs uppercase",children:M(I.SETTINGS)})]}),_A=({displayData:e,destinationType:t,handleCallOrderSelectChange:n,handleChange:r,labels:o})=>{const i={serial:I.SEQUENTIALLY,parallel:I.SIMULTANEOUSLY};return V(be,{children:[V("label",{children:[_("span",{className:"sr-only",children:M(I.MULTIPLE_NUMBERS)}),_("textarea",{className:`min-h-[77px] w-full ${e.destinationList.valid?"":"invalid"}`,name:"destinationList",onChange:r,placeholder:"+1 (204) 123 0000, +1 (204) 456 0000, +1 (204) 789 0000",required:!0,value:e.destinationList.value}),_("p",{className:"requirements",role:"alert",children:M(I.ERROR_VALUE_IS_REQUIRED)})]}),_("div",{className:"mb-4 pt-4 text-xs uppercase",children:M(I.SETTINGS)}),_("div",{className:`${t==="phone"?"":"mb-4"}`,children:V("label",{children:[M(o.call),_(yr,{className:"w-full",name:"callOrder",onChange:n,value:e.type.value,children:Object.keys(i).map(s=>_("option",{value:s,children:M(i[s])},s))})]})})]})},P0=()=>({value:{id:Me(),command:"",digit:""},valid:!0}),ld=e=>e.every(t=>t.valid),wA=({nodeData:e,handleOnUpdate:t})=>{const n=N.useRef(),r={initialTimeout:{value:e.initialTimeout??5,valid:!0},url:{value:e.url,valid:!0},text:{value:e.text,valid:!0},selected:{value:e.selected||"text",valid:!0},options:{value:e.options.length?e.options.map(v=>({value:v,valid:Boolean(v.command||v.digit)})):[P0()],valid:!0}},[o,i]=Zt(r);os({displayData:o,formRef:n,setCompleted:v=>{t({},v)}});const l=v=>{v.preventDefault();const m=[...o.options.value,P0()];i({options:{value:m,valid:ld(m)}}),t({options:m.map(E=>E.value)})},a=v=>{const E=o.options.value.filter((d,g)=>g!==v);i({options:{value:E,valid:ld(E)}}),t({options:E.map(d=>d.value)})},u=(v,m)=>v.map(d=>d.value.id===m.value.id?{...d,...m}:d),c=v=>v.map(m=>{const E=m.value.command.trim(),d=m.value.digit.trim();return{...m.value,command:od(E)?E:"",digit:rd(d)?d:""}}),f=(v,m)=>{const E=o.options.value;if(!E[v])throw new Error(`Option not found at index ${v}`);const d=E[v],g={...d==null?void 0:d.value,...m},y=g.command.trim(),S=g.digit.trim(),w=Boolean(y)&&od(y)||Boolean(S)&&rd(S),O={value:g,valid:w},T=u(o.options.value,O);i({options:{value:T,valid:ld(T)}}),t({options:c(T)})},p=(v,m)=>{const E=v.target,{name:d,value:g}=E;let y=!0;switch(d){case"digit":case"command":m!==void 0&&f(m,{[d]:g});break;case"initialTimeout":{y=E.checkValidity(),i({[d]:{value:Number.parseInt(g,10),valid:y}}),t({initialTimeout:y&&g?parseInt(g,10):5});break}default:throw new Error(`Unhandled input name: ${d}`)}},h=o.options.value;return _(St,{formRef:n,info:M(I.INFO_NODE_GATHER_INPUT),title:M(I.GATHER_INPUT),children:V("div",{className:"divide-y divide-foreground/10",children:[_("div",{className:"mb-2",children:_(L0,{displayData:o,label:M(I.CHOOSE_OPTION_TTS_AUDIO),handleOnUpdate:t,setDisplayData:i})}),_("ul",{children:h.map((v,m,E)=>V("li",{className:"mb-3",children:[V("div",{className:"flex items-center",children:[_("h2",{className:"nowrap flex-1 py-6 text-sm font-medium uppercase leading-4 text-foreground/50",children:M(I.OPTION_NUMBER,{index:m+1})}),Boolean(h.length>1)&&_(rs,{trigger:V("button",{className:"px-2",onClick:()=>a(m),type:"button",children:[_("span",{className:"sr-only",children:M(I.REMOVE_OPTION,{index:m+1})}),_(Et,{tag:"xmark"})]}),children:M(I.INFO_NODE_OPTION_REMOVE)})]}),V("label",{className:"flex flex-col",children:[M(I.CALLER_PRESSES),_("input",{className:`w-1/4 ${!v.valid||v.value.digit&&!rd(v.value.digit)?"invalid":""}`,defaultValue:v.value.digit,name:"digit",onChange:d=>p(d,m),pattern:wr(T0),type:"text"}),_("p",{className:"requirements",role:"alert",children:M(I.ERROR_TELEPHONE_KEY_REQUIRED)})]}),V("label",{className:"flex flex-col",children:[M(I.OR_SAYS),_("input",{className:`w-full ${!v.valid||v.value.command&&!od(v.value.command)?"invalid":""}`,defaultValue:v.value.command,name:"command",onChange:d=>p(d,m),pattern:`${wr(O0)}|''`,type:"text"}),_("p",{className:"requirements",role:"alert",children:M(I.ERROR_TEXT_IS_REQUIRED)})]}),m===E.length-1&&V("button",{onClick:l,type:"button",className:"mb-3 text-primary",children:["+ ",M(I.ADD_OPTION)]})]},v.value.id))}),V("div",{className:"pt-6",children:[_("h2",{className:"pb-6 text-sm uppercase leading-4 text-foreground/50",children:M(I.SETTINGS)}),V("label",{children:[_("div",{className:"w-full",children:M(I.WAIT_FOR_INPUT)}),V("div",{className:"flex flex-wrap items-center gap-x-2",children:[_("input",{className:`w-14 ${o.initialTimeout.valid?"":"invalid"}`,defaultValue:o.initialTimeout.value,min:va.MIN,max:va.MAX,name:"initialTimeout",onChange:p,pattern:wr(x0),type:"number",inputMode:"numeric"}),M(I.SECONDS),_("p",{className:"requirements w-full",role:"alert",children:M(I.ERROR_NUMBER_MIN_MAX_IS_REQUIRED,{min:va.MIN,max:va.MAX})})]})]})]})]})})},RA=({nodeData:e,handleOnChange:t})=>_(St,{handleOnChange:t,info:M(I.INFO_NODE_HANG_UP),title:M(I.HANG_UP_CALL),children:V("label",{children:[V("p",{className:"mb-2 whitespace-nowrap",children:[M(I.REASON)," (",M(I.OPTIONAL),")"]}),V(yr,{className:"w-full",defaultValue:e.reason,name:"reason",children:[_("option",{value:"",children:M(I.SELECT)}),Object.keys(Df).map(n=>_("option",{value:n,children:M(Df[n])},n))]})]})}),NA=({nodeData:e,handleOnUpdate:t})=>{const n=N.useRef(),r={url:{value:e.url,valid:!0},text:{value:e.text,valid:!0},selected:{value:e.selected,valid:Boolean(e.selected)}},[o,i]=Zt(r);return os({displayData:o,formRef:n,setCompleted:l=>{t({},l)}}),_(St,{formRef:n,info:M(I.INFO_NODE_PLAY),title:M(I.PLAY_AUDIO_TTS),children:_(L0,{displayData:o,label:M(I.CHOOSE_OPTION_TTS_AUDIO),handleOnUpdate:t,setDisplayData:i,showDefaultOption:!0})})},OA=({nodeData:e,handleOnUpdate:t})=>{const n={beep:{value:e.beep},controlId:{value:e.controlId},format:{value:e.format,valid:!0},label:{value:e.label,valid:!0},stereo:{value:e.stereo},terminators:{value:e.terminators,valid:!0}},r=N.useRef(),[o,i]=Zt(n),[s,l]=N.useState(!1),a=Gn(p=>p.upsertEntry),u=Gn(p=>p.isValueDuplicate);os({displayData:o,formRef:r,setCompleted:p=>{t({},p)}});const f=p=>{let h=!0;const v=p.target,{name:m,value:E}=v,d=E.trim(),g=u(d,e.controlId);l(g),h=v.checkValidity()&&Boolean(d)&&!g,i({[m]:{value:E,valid:h}}),t({[m]:h?d:""}),a({controlId:e.controlId,label:h?d:""})};return V(St,{info:M(I.INFO_NODE_RECORD_CALL_START),title:M(I.RECORD_CALL_START),formRef:r,children:[V("label",{children:[M(I.RECORDING_NAME),_("input",{className:`w-full ${o.label.valid?"":"invalid"}`,defaultValue:o.label.value,name:"label",onChange:f,pattern:wr(hA),required:!0,type:"text"}),_("p",{className:"requirements",role:"alert",children:M(s?I.ERROR_DUPLICATE_RECORDING_LABEL:I.ERROR_RECORDING_LABEL_REQUIRED)})]}),_(D0,{handleOnUpdate:t,displayData:o,setDisplayData:i})]})},xA=({nodeData:e,handleOnChange:t})=>{const r=Gn(o=>o.getEntries)().sort((o,i)=>o.label.toLowerCase().localeCompare(i.label.toLowerCase()));return _(St,{handleOnChange:t,info:M(I.INFO_NODE_RECORD_CALL_STOP),title:M(I.RECORD_CALL_STOP),children:r.length?V("label",{children:[_("p",{className:"mb-2 whitespace-nowrap",children:M(I.RECORDING_NAME)}),V(yr,{className:"w-full",defaultValue:e.controlId,name:"controlId",children:[_("option",{value:"",children:M(I.SELECT)}),r.map(o=>_("option",{value:o.controlId,children:o.label},o.controlId))]})]}):_("p",{className:"text-negative",children:M(I.ERROR_ADD_RECORDING_FIRST)})})},TA=({nodeData:e,handleOnUpdate:t})=>{const n={beep:{value:e.beep},format:{value:e.format,valid:!0},stereo:{value:e.stereo},terminators:{value:e.terminators,valid:!0}},[r,o]=Zt(n);return _(St,{info:M(I.INFO_NODE_RECORD),title:M(I.VOICEMAIL_RECORDING),children:_(D0,{handleOnUpdate:t,displayData:r,setDisplayData:o})})},IA=["GET","POST","PUT","DELETE"],CA=e=>{console.log("bodyToTextArea",e);try{return typeof e=="string"?e:JSON.stringify(e)}catch{return e}},AA=({nodeData:e,handleOnUpdate:t})=>{const n={url:{value:e.url,valid:!0},method:{value:e.method,valid:!0},headers:{value:e.headers,valid:!0},body:{value:e.body,valid:!0},saveVariables:{value:Boolean(e.saveVariables),valid:!0}},[r,o]=Zt(n),i=a=>{const u=a.target,{name:c,value:f}=u,p=typeof f=="string"?f.trim():f;let h=!0;switch(c){case"url":case"method":h=u.checkValidity()&&!!p,o({[c]:{value:f,valid:h}}),t({[c]:h?p:""});break;case"headers":if(!f){o({[c]:{value:{},valid:!0}}),t({[c]:{}});return}try{const v=JSON.parse(f);o({[c]:{valid:!0}}),t({[c]:v})}catch{o({[c]:{valid:!1}}),t({[c]:{}})}break;case"body":try{const v=JSON.parse(f);o({[c]:{value:f,valid:!0}}),t({[c]:v})}catch{o({[c]:{value:f,valid:!0}}),t({[c]:f})}break;default:throw new Error(`Unhandled input name: ${c}`)}},s=a=>{const u=a.target.name,c=a.target.value,f={[u]:c};o(f),t(f)},l=a=>{const u=a.target.name,c=!r[u].value;o({[u]:{value:c}}),t({[u]:c})};return V(St,{info:M(I.INFO_NODE_REQUEST),title:M(I.REQUEST),children:[V("label",{children:[_("div",{children:M(I.URL)}),_("input",{className:`w-full ${r.url.valid?"":"invalid"}`,defaultValue:r.url.value,name:"url",onChange:i,placeholder:"https://user:password@example.com/api/status",required:!0,type:"text"}),_("p",{className:"requirements w-full",role:"alert",children:M(I.ERROR_VALUE_IS_REQUIRED)})]}),V("label",{className:"mb-3 block",children:[M(I.METHOD),_(yr,{className:"w-full",value:r.method.value,name:"method",onChange:s,children:IA.map(a=>_("option",{value:a,children:a},a))})]}),_("div",{className:"mb-4",children:_(Uy,{checked:r.saveVariables.value,clickHandler:l,name:"saveVariables",subtitle:M(I.SAVE_VARIABLES_SUBTITLE),title:M(I.SAVE_VARIABLES)})}),V("label",{children:[_("div",{children:M(I.REQUEST_HEADERS)}),_(qi,{errorText:M(I.ERROR_INVALID_JSON),inputMode:"text",valid:Boolean(r.headers.valid),label:M(I.REQUEST_HEADERS),name:"headers",onChange:i,placeholder:'{"Content-Type": "application/json", "X-Custom-Header": "foo"}',required:!0,value:JSON.stringify(r.headers.value)})]}),V("label",{children:[_("div",{children:M(I.REQUEST_BODY)}),_(qi,{inputMode:"text",valid:!0,label:M(I.REQUEST_BODY),name:"body",onChange:i,placeholder:"String or JSON to serialize",value:CA(r.body.value)})]})]})},bA=({nodeData:e,handleOnUpdate:t})=>{const n={body:{value:e.body,valid:!0},fromNumber:{value:e.fromNumber,valid:!0},toNumber:{value:e.toNumber,valid:!0}},[r,o]=Zt(n),i=s=>{const l=s.target,{name:a,value:u}=l,c=typeof u=="string"?u.trim():u;let f=!0;switch(a){case"body":case"fromNumber":case"toNumber":f=l.checkValidity()&&!!c,o({[a]:{value:u,valid:f}}),t({[a]:f?c:""});break;default:throw new Error(`Unhandled input name: ${a}`)}};return V(St,{info:M(I.INFO_NODE_SEND_SMS),title:M(I.SEND_SMS),children:[V("label",{className:"mb-1",children:[_("div",{children:M(I.FROM_PHONE_NUMBER)}),_("input",{className:`w-full ${r.fromNumber.valid?"":"invalid"}`,defaultValue:r.fromNumber.value,name:"fromNumber",onChange:i,placeholder:"+1 (204) 000 0000",required:!0,type:"tel"}),_("p",{className:"requirements w-full",role:"alert",children:M(I.ERROR_VALUE_IS_REQUIRED)})]}),V("label",{className:"mb-1",children:[_("div",{children:M(I.TO_PHONE_NUMBER)}),_("input",{className:`w-full ${r.toNumber.valid?"":"invalid"}`,defaultValue:r.toNumber.value,name:"toNumber",onChange:i,placeholder:"+1 (204) 000 0000",required:!0,type:"tel"}),_("p",{className:"requirements w-full",role:"alert",children:M(I.ERROR_VALUE_IS_REQUIRED)})]}),V("label",{children:[_("div",{children:M(I.TEXT)}),_(qi,{errorText:M(I.ERROR_VALUE_IS_REQUIRED),inputMode:"text",valid:Boolean(r.body.valid),label:M(I.SMS_TEXT),name:"body",onChange:i,placeholder:M(I.WRITE_SOMETHING),required:!0,value:r.body.value})]})]})},M0=()=>({id:Me(),key:"",value:"",valid:!0}),U0=e=>e.reduce((t,{id:n,key:r,value:o,valid:i})=>(i&&r.trim().length>0&&t.push({id:n,key:r,value:o}),t),[]),LA=({nodeData:e,handleOnUpdate:t})=>{var m;const n=vr(E=>E.isKeyDuplicate),r={variables:{value:e.variables.length>0?e.variables.map(E=>({...E,valid:!0})):[M0()],valid:!0}},[o,i]=Zt(r),s=vr(E=>E.upsertVariable),l=vr(E=>E.removeVariable),a=E=>{E.preventDefault(),i({variables:{value:[...o.variables.value,M0()],valid:!0}})},u=E=>E.key.trim().length>0&&!n(E.key,E.id)&&C0(E.key),c=E=>E.every(d=>d.valid),f=E=>o.variables.value.map(d=>d.id===E.id?{...d,...E}:d),p=(E,d)=>{const g=o.variables.value[E];if(!g)throw new Error(`Variable not found at index ${E}`);const y={...g,...d};y.valid=u(y);const S=f(y),w=c(S);i({variables:{value:S,valid:w}}),t({variables:U0(S)},w),y.valid?s({id:y.id,key:y.key,value:y.value}):l(y.id)},h=E=>{const d=o.variables.value[E];if(d){const g=o.variables.value.filter((S,w)=>w!==E),y=c(g);i({variables:{value:g,valid:y}}),t({variables:U0(g)},y),l(d.id)}},v=(E,d)=>{const g=E.target,y=g.name;if(g.checkValidity())switch(y){case"key":case"value":p(d,{[y]:g.value});break;default:throw new Error(`Unhandled input name: ${y}`)}else p(d,{[y]:"",valid:!1})};return _(St,{info:M(I.INFO_NODE_SET_VARIABLES),title:M(I.SET_VARIABLES),children:_("div",{className:"divide-y divide-foreground/10",children:(m=o.variables.value)==null?void 0:m.map((E,d,g)=>{const y=n(E.key,E.id);return V("div",{className:"mb-3",children:[V("div",{className:"flex flex-nowrap",children:[_("h3",{className:"flex-1 overflow-hidden text-ellipsis whitespace-nowrap py-6 text-sm font-medium uppercase leading-4 text-foreground/50",children:M(I.VARIABLE_KEY,{key:E.key})}),Boolean(g.length>1)&&_(rs,{trigger:V("button",{className:"px-2",onClick:()=>h(d),type:"button",children:[_("span",{className:"sr-only",children:M(I.REMOVE_VARIABLE,{key:E.key})}),_(Et,{tag:"xmark"})]}),children:M(I.INFO_NODE_SET_VARIABLES_OPTION)})]}),V("label",{className:"flex flex-col",children:[M(I.KEY),_("input",{className:`w-full ${(E.valid||C0(E.key))&&!y?"":"invalid"}`,defaultValue:E.key,name:"key",onChange:S=>v(S,d),pattern:wr(I0),type:"text"}),_("p",{className:"requirements",children:M(y?I.ERROR_DUPLICATE_VARIABLE_KEY:I.ERROR_VARIABLE_KEY_REQUIRED)})]}),V("label",{className:"flex flex-col",children:[M(I.VALUE),_("input",{className:"w-full",defaultValue:E.value,name:"value",onChange:S=>v(S,d),type:"text"}),_("p",{className:"requirements",children:M(I.ERROR_TEXT_IS_REQUIRED)})]}),d===g.length-1&&V("button",{onClick:a,type:"button",className:"mb-3 text-primary",children:["+ ",M(I.ADD_VARIABLE)]})]},E.id)})})})},DA=(e,t)=>{N.useEffect(()=>{var o;const n=(o=e.current)==null?void 0:o.getRootNode(),r=i=>{var l;const s=i.target;s instanceof Node&&!((l=e.current)!=null&&l.contains(s))&&t(i)};return n&&n.addEventListener("pointerdown",r),()=>{n&&n.removeEventListener("pointerdown",r)}},[e,t])},kA=({key:e,setId:t})=>({id:Me(),key:e,setId:t}),PA=e=>e.length>0,MA=({nodeData:e,handleOnUpdate:t})=>{const r={currentFocus:void 0,listOpen:!1,setVariablesList:Array.from(vr(v=>v.variables).values()).map(v=>({...v,selected:Boolean(e.variables.find(m=>m.setId===v.id))})).sort((v,m)=>v.key.toLowerCase().localeCompare(m.key.toLowerCase())),unsetVariables:e.variables},[o,i]=Zt(r),s=v=>o.setVariablesList.map(m=>m.id===v?{...m,selected:!m.selected}:m),l=v=>{const m=o.setVariablesList[v];if(!m)throw new Error("Variable not found");if(m.selected){const E=o.unsetVariables.findIndex(d=>d.setId===m.id);a(E)}else{const E=[...o.unsetVariables,kA({key:m.key,setId:m.id})];i({unsetVariables:E,setVariablesList:s(m.id)}),t({variables:E},!0)}},a=v=>{const m=o.unsetVariables[v];if(!m)throw new Error("Cannot Remove Variable, not found");const E=o.unsetVariables.filter(d=>d.id!==m.id);i({unsetVariables:E,setVariablesList:s(m.setId)}),t({variables:E},PA(E))},u=N.useRef(null);DA(u,()=>i({listOpen:!1}));const c=v=>{(v.key==="Escape"||v.key==="Esc")&&i({listOpen:!1})},f=(v,m)=>{v.preventDefault(),(v.key===" "||v.code==="Space"||v.key==="Enter")&&l(m),c(v)},p=()=>{i({listOpen:!o.listOpen})},h=o.unsetVariables.length;return V(St,{info:M(I.INFO_NODE_UNSET_VARIABLES),title:M(I.UNSET_VARIABLES),children:[V("div",{className:"my-1 flex flex-col",children:[_("label",{id:"listbox-label",className:"sr-only",children:M(I.SELECT_VARIABLES_TO_UNSET)}),V("div",{className:"relative",ref:u,children:[_("button",{"aria-expanded":"true","aria-haspopup":"listbox","aria-labelledby":"listbox-label",className:`relative w-full cursor-pointer rounded-md border border-foreground/10 bg-transparent py-1.5 px-3 text-left shadow-sm
64
+ */var QI=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],kf=QI.join(","),Fy=typeof Element>"u",Zi=Fy?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,la=!Fy&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e==null?void 0:e.ownerDocument},aa=function e(t,n){var r;n===void 0&&(n=!0);var o=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),i=o===""||o==="true",s=i||n&&t&&e(t.parentNode);return s},XI=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},qI=function(t,n,r){if(aa(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(kf));return n&&Zi.call(t,kf)&&o.unshift(t),o=o.filter(r),o},ZI=function e(t,n,r){for(var o=[],i=Array.from(t);i.length;){var s=i.shift();if(!aa(s,!1))if(s.tagName==="SLOT"){var l=s.assignedElements(),a=l.length?l:s.children,u=e(a,!0,r);r.flatten?o.push.apply(o,u):o.push({scopeParent:s,candidates:u})}else{var c=Zi.call(s,kf);c&&r.filter(s)&&(n||!t.includes(s))&&o.push(s);var f=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),p=!aa(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(f&&p){var h=e(f===!0?s.children:f.children,!0,r);r.flatten?o.push.apply(o,h):o.push({scopeParent:s,candidates:h})}else i.unshift.apply(i,s.children)}}return o},Vy=function(t,n){return t.tabIndex<0&&(n||/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||XI(t))&&isNaN(parseInt(t.getAttribute("tabindex"),10))?0:t.tabIndex},JI=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},By=function(t){return t.tagName==="INPUT"},eC=function(t){return By(t)&&t.type==="hidden"},tC=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},nC=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},rC=function(t){if(!t.name)return!0;var n=t.form||la(t),r=function(l){return n.querySelectorAll('input[type="radio"][name="'+l+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(t.name));else try{o=r(t.name)}catch(s){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",s.message),!1}var i=nC(o,t.form);return!i||i===t},oC=function(t){return By(t)&&t.type==="radio"},iC=function(t){return oC(t)&&!rC(t)},sC=function(t){var n,r=t&&la(t),o=(n=r)===null||n===void 0?void 0:n.host,i=!1;if(r&&r!==t){var s,l,a;for(i=!!((s=o)!==null&&s!==void 0&&(l=s.ownerDocument)!==null&&l!==void 0&&l.contains(o)||t!=null&&(a=t.ownerDocument)!==null&&a!==void 0&&a.contains(t));!i&&o;){var u,c,f;r=la(o),o=(u=r)===null||u===void 0?void 0:u.host,i=!!((c=o)!==null&&c!==void 0&&(f=c.ownerDocument)!==null&&f!==void 0&&f.contains(o))}}return i},$y=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},lC=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var i=Zi.call(t,"details>summary:first-of-type"),s=i?t.parentElement:t;if(Zi.call(s,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof o=="function"){for(var l=t;t;){var a=t.parentElement,u=la(t);if(a&&!a.shadowRoot&&o(a)===!0)return $y(t);t.assignedSlot?t=t.assignedSlot:!a&&u!==t.ownerDocument?t=u.host:t=a}t=l}if(sC(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return $y(t);return!1},aC=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return Zi.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},uC=function(t,n){return!(n.disabled||aa(n)||eC(n)||lC(n,t)||tC(n)||aC(n))},zy=function(t,n){return!(iC(n)||Vy(n)<0||!uC(t,n))},cC=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},fC=function e(t){var n=[],r=[];return t.forEach(function(o,i){var s=!!o.scopeParent,l=s?o.scopeParent:o,a=Vy(l,s),u=s?e(o.candidates):l;a===0?s?n.push.apply(n,u):n.push(l):r.push({documentOrder:i,tabIndex:a,item:o,isScope:s,content:u})}),r.sort(JI).reduce(function(o,i){return i.isScope?o.push.apply(o,i.content):o.push(i.content),o},[]).concat(n)},Hy=function(t,n){n=n||{};var r;return n.getShadowRoot?r=ZI([t],n.includeContainer,{filter:zy.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:cC}):r=qI(t,n.includeContainer,zy.bind(null,n)),fC(r)};function Ji(e){return e.split("-")[1]}function Pf(e){return e==="y"?"height":"width"}function Er(e){return e.split("-")[0]}function es(e){return["top","bottom"].includes(Er(e))?"x":"y"}function jy(e,t,n){let{reference:r,floating:o}=e;const i=r.x+r.width/2-o.width/2,s=r.y+r.height/2-o.height/2,l=es(t),a=Pf(l),u=r[a]/2-o[a]/2,c=l==="x";let f;switch(Er(t)){case"top":f={x:i,y:r.y-o.height};break;case"bottom":f={x:i,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:s};break;case"left":f={x:r.x-o.width,y:s};break;default:f={x:r.x,y:r.y}}switch(Ji(t)){case"start":f[l]-=u*(n&&c?-1:1);break;case"end":f[l]+=u*(n&&c?-1:1)}return f}const dC=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,l=i.filter(Boolean),a=await(s.isRTL==null?void 0:s.isRTL(t));let u=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:c,y:f}=jy(u,r,a),p=r,h={},v=0;for(let m=0;m<l.length;m++){const{name:E,fn:d}=l[m],{x:g,y,data:S,reset:w}=await d({x:c,y:f,initialPlacement:r,placement:p,strategy:o,middlewareData:h,rects:u,platform:s,elements:{reference:e,floating:t}});c=g??c,f=y??f,h={...h,[E]:{...h[E],...S}},w&&v<=50&&(v++,typeof w=="object"&&(w.placement&&(p=w.placement),w.rects&&(u=w.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):w.rects),{x:c,y:f}=jy(u,p,a)),m=-1)}return{x:c,y:f,placement:p,strategy:o,middlewareData:h}};function Wy(e){return typeof e!="number"?function(t){return{top:0,right:0,bottom:0,left:0,...t}}(e):{top:e,right:e,bottom:e,left:e}}function Mf(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}async function Gy(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:l,strategy:a}=e,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:f="floating",altBoundary:p=!1,padding:h=0}=t,v=Wy(h),m=l[p?f==="floating"?"reference":"floating":f],E=Mf(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(m)))==null||n?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:u,rootBoundary:c,strategy:a})),d=f==="floating"?{...s.floating,x:r,y:o}:s.reference,g=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),y=await(i.isElement==null?void 0:i.isElement(g))&&await(i.getScale==null?void 0:i.getScale(g))||{x:1,y:1},S=Mf(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:d,offsetParent:g,strategy:a}):d);return{top:(E.top-S.top+v.top)/y.y,bottom:(S.bottom-E.bottom+v.bottom)/y.y,left:(E.left-S.left+v.left)/y.x,right:(S.right-E.right+v.right)/y.x}}const pC=Math.min,hC=Math.max;function Uf(e,t,n){return hC(e,pC(t,n))}const Yy=e=>({name:"arrow",options:e,async fn(t){const{element:n,padding:r=0}=e||{},{x:o,y:i,placement:s,rects:l,platform:a}=t;if(n==null)return{};const u=Wy(r),c={x:o,y:i},f=es(s),p=Pf(f),h=await a.getDimensions(n),v=f==="y"?"top":"left",m=f==="y"?"bottom":"right",E=l.reference[p]+l.reference[f]-c[f]-l.floating[p],d=c[f]-l.reference[f],g=await(a.getOffsetParent==null?void 0:a.getOffsetParent(n));let y=g?f==="y"?g.clientHeight||0:g.clientWidth||0:0;y===0&&(y=l.floating[p]);const S=E/2-d/2,w=u[v],O=y-h[p]-u[m],T=y/2-h[p]/2+S,b=Uf(w,T,O),P=Ji(s)!=null&&T!=b&&l.reference[p]/2-(T<w?u[v]:u[m])-h[p]/2<0;return{[f]:c[f]-(P?T<w?w-T:O-T:0),data:{[f]:b,centerOffset:T-b}}}});["top","right","bottom","left"].reduce((e,t)=>e.concat(t,t+"-start",t+"-end"),[]);const gC={left:"right",right:"left",bottom:"top",top:"bottom"};function ua(e){return e.replace(/left|right|bottom|top/g,t=>gC[t])}function mC(e,t,n){n===void 0&&(n=!1);const r=Ji(e),o=es(e),i=Pf(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=ua(s)),{main:s,cross:ua(s)}}const vC={start:"end",end:"start"};function Ff(e){return e.replace(/start|end/g,t=>vC[t])}const yC=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n;const{placement:r,middlewareData:o,rects:i,initialPlacement:s,platform:l,elements:a}=t,{mainAxis:u=!0,crossAxis:c=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:v=!0,...m}=e,E=Er(r),d=Er(s)===s,g=await(l.isRTL==null?void 0:l.isRTL(a.floating)),y=f||(d||!v?[ua(s)]:function(B){const $=ua(B);return[Ff(B),$,Ff($)]}(s));f||h==="none"||y.push(...function(B,$,F,R){const D=Ji(B);let A=function(C,x,L){const U=["left","right"],z=["right","left"],j=["top","bottom"],K=["bottom","top"];switch(C){case"top":case"bottom":return L?x?z:U:x?U:z;case"left":case"right":return x?j:K;default:return[]}}(Er(B),F==="start",R);return D&&(A=A.map(C=>C+"-"+D),$&&(A=A.concat(A.map(Ff)))),A}(s,v,h,g));const S=[s,...y],w=await Gy(t,m),O=[];let T=((n=o.flip)==null?void 0:n.overflows)||[];if(u&&O.push(w[E]),c){const{main:B,cross:$}=mC(r,i,g);O.push(w[B],w[$])}if(T=[...T,{placement:r,overflows:O}],!O.every(B=>B<=0)){var b,P;const B=(((b=o.flip)==null?void 0:b.index)||0)+1,$=S[B];if($)return{data:{index:B,overflows:T},reset:{placement:$}};let F=(P=T.filter(R=>R.overflows[0]<=0).sort((R,D)=>R.overflows[1]-D.overflows[1])[0])==null?void 0:P.placement;if(!F)switch(p){case"bestFit":{var k;const R=(k=T.map(D=>[D.placement,D.overflows.filter(A=>A>0).reduce((A,C)=>A+C,0)]).sort((D,A)=>D[1]-A[1])[0])==null?void 0:k[0];R&&(F=R);break}case"initialPlacement":F=s}if(r!==F)return{reset:{placement:F}}}return{}}}},EC=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){const{x:n,y:r}=t,o=await async function(i,s){const{placement:l,platform:a,elements:u}=i,c=await(a.isRTL==null?void 0:a.isRTL(u.floating)),f=Er(l),p=Ji(l),h=es(l)==="x",v=["left","top"].includes(f)?-1:1,m=c&&h?-1:1,E=typeof s=="function"?s(i):s;let{mainAxis:d,crossAxis:g,alignmentAxis:y}=typeof E=="number"?{mainAxis:E,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...E};return p&&typeof y=="number"&&(g=p==="end"?-1*y:y),h?{x:g*m,y:d*v}:{x:d*v,y:g*m}}(t,e);return{x:n+o.x,y:r+o.y,data:o}}}};function SC(e){return e==="x"?"y":"x"}const _C=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:l={fn:E=>{let{x:d,y:g}=E;return{x:d,y:g}}},...a}=e,u={x:n,y:r},c=await Gy(t,a),f=es(Er(o)),p=SC(f);let h=u[f],v=u[p];if(i){const E=f==="y"?"bottom":"right";h=Uf(h+c[f==="y"?"top":"left"],h,h-c[E])}if(s){const E=p==="y"?"bottom":"right";v=Uf(v+c[p==="y"?"top":"left"],v,v-c[E])}const m=l.fn({...t,[f]:h,[p]:v});return{...m,data:{x:m.x-n,y:m.y-r}}}}};function at(e){var t;return((t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Qt(e){return at(e).getComputedStyle(e)}const Ky=Math.min,ts=Math.max,ca=Math.round;function Qy(e){const t=Qt(e);let n=parseFloat(t.width),r=parseFloat(t.height);const o=e.offsetWidth,i=e.offsetHeight,s=ca(n)!==o||ca(r)!==i;return s&&(n=o,r=i),{width:n,height:r,fallback:s}}function Yn(e){return qy(e)?(e.nodeName||"").toLowerCase():""}let fa;function Xy(){if(fa)return fa;const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?(fa=e.brands.map(t=>t.brand+"/"+t.version).join(" "),fa):navigator.userAgent}function Xt(e){return e instanceof at(e).HTMLElement}function Pt(e){return e instanceof at(e).Element}function qy(e){return e instanceof at(e).Node}function Zy(e){return typeof ShadowRoot>"u"?!1:e instanceof at(e).ShadowRoot||e instanceof ShadowRoot}function da(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Qt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function wC(e){return["table","td","th"].includes(Yn(e))}function Vf(e){const t=/firefox/i.test(Xy()),n=Qt(e),r=n.backdropFilter||n.WebkitBackdropFilter;return n.transform!=="none"||n.perspective!=="none"||!!r&&r!=="none"||t&&n.willChange==="filter"||t&&!!n.filter&&n.filter!=="none"||["transform","perspective"].some(o=>n.willChange.includes(o))||["paint","layout","strict","content"].some(o=>{const i=n.contain;return i!=null&&i.includes(o)})}function Bf(){return/^((?!chrome|android).)*safari/i.test(Xy())}function $f(e){return["html","body","#document"].includes(Yn(e))}function Jy(e){return Pt(e)?e:e.contextElement}const e0={x:1,y:1};function Co(e){const t=Jy(e);if(!Xt(t))return e0;const n=t.getBoundingClientRect(),{width:r,height:o,fallback:i}=Qy(t);let s=(i?ca(n.width):n.width)/r,l=(i?ca(n.height):n.height)/o;return s&&Number.isFinite(s)||(s=1),l&&Number.isFinite(l)||(l=1),{x:s,y:l}}function Sr(e,t,n,r){var o,i;t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),l=Jy(e);let a=e0;t&&(r?Pt(r)&&(a=Co(r)):a=Co(e));const u=l?at(l):window,c=Bf()&&n;let f=(s.left+(c&&((o=u.visualViewport)==null?void 0:o.offsetLeft)||0))/a.x,p=(s.top+(c&&((i=u.visualViewport)==null?void 0:i.offsetTop)||0))/a.y,h=s.width/a.x,v=s.height/a.y;if(l){const m=at(l),E=r&&Pt(r)?at(r):r;let d=m.frameElement;for(;d&&r&&E!==m;){const g=Co(d),y=d.getBoundingClientRect(),S=getComputedStyle(d);y.x+=(d.clientLeft+parseFloat(S.paddingLeft))*g.x,y.y+=(d.clientTop+parseFloat(S.paddingTop))*g.y,f*=g.x,p*=g.y,h*=g.x,v*=g.y,f+=y.x,p+=y.y,d=at(d).frameElement}}return{width:h,height:v,top:p,right:f+h,bottom:p+v,left:f,x:f,y:p}}function Kn(e){return((qy(e)?e.ownerDocument:e.document)||window.document).documentElement}function pa(e){return Pt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function t0(e){return Sr(Kn(e)).left+pa(e).scrollLeft}function ns(e){if(Yn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Zy(e)&&e.host||Kn(e);return Zy(t)?t.host:t}function n0(e){const t=ns(e);return $f(t)?t.ownerDocument.body:Xt(t)&&da(t)?t:n0(t)}function Qn(e,t){var n;t===void 0&&(t=[]);const r=n0(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),i=at(r);return o?t.concat(i,i.visualViewport||[],da(r)?r:[]):t.concat(r,Qn(r))}function r0(e,t,n){let r;if(t==="viewport")r=function(s,l){const a=at(s),u=Kn(s),c=a.visualViewport;let f=u.clientWidth,p=u.clientHeight,h=0,v=0;if(c){f=c.width,p=c.height;const m=Bf();(!m||m&&l==="fixed")&&(h=c.offsetLeft,v=c.offsetTop)}return{width:f,height:p,x:h,y:v}}(e,n);else if(t==="document")r=function(s){const l=Kn(s),a=pa(s),u=s.ownerDocument.body,c=ts(l.scrollWidth,l.clientWidth,u.scrollWidth,u.clientWidth),f=ts(l.scrollHeight,l.clientHeight,u.scrollHeight,u.clientHeight);let p=-a.scrollLeft+t0(s);const h=-a.scrollTop;return Qt(u).direction==="rtl"&&(p+=ts(l.clientWidth,u.clientWidth)-c),{width:c,height:f,x:p,y:h}}(Kn(e));else if(Pt(t))r=function(s,l){const a=Sr(s,!0,l==="fixed"),u=a.top+s.clientTop,c=a.left+s.clientLeft,f=Xt(s)?Co(s):{x:1,y:1};return{width:s.clientWidth*f.x,height:s.clientHeight*f.y,x:c*f.x,y:u*f.y}}(t,n);else{const s={...t};if(Bf()){var o,i;const l=at(e);s.x-=((o=l.visualViewport)==null?void 0:o.offsetLeft)||0,s.y-=((i=l.visualViewport)==null?void 0:i.offsetTop)||0}r=s}return Mf(r)}function o0(e,t){return Xt(e)&&Qt(e).position!=="fixed"?t?t(e):e.offsetParent:null}function i0(e,t){const n=at(e);let r=o0(e,t);for(;r&&wC(r)&&Qt(r).position==="static";)r=o0(r,t);return r&&(Yn(r)==="html"||Yn(r)==="body"&&Qt(r).position==="static"&&!Vf(r))?n:r||function(o){let i=ns(o);for(;Xt(i)&&!$f(i);){if(Vf(i))return i;i=ns(i)}return null}(e)||n}function RC(e,t,n){const r=Xt(t),o=Kn(t),i=Sr(e,!0,n==="fixed",t);let s={scrollLeft:0,scrollTop:0};const l={x:0,y:0};if(r||!r&&n!=="fixed")if((Yn(t)!=="body"||da(o))&&(s=pa(t)),Xt(t)){const a=Sr(t,!0);l.x=a.x+t.clientLeft,l.y=a.y+t.clientTop}else o&&(l.x=t0(o));return{x:i.left+s.scrollLeft-l.x,y:i.top+s.scrollTop-l.y,width:i.width,height:i.height}}const NC={getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=n==="clippingAncestors"?function(u,c){const f=c.get(u);if(f)return f;let p=Qn(u).filter(E=>Pt(E)&&Yn(E)!=="body"),h=null;const v=Qt(u).position==="fixed";let m=v?ns(u):u;for(;Pt(m)&&!$f(m);){const E=Qt(m),d=Vf(m);E.position==="fixed"?h=null:(v?d||h:d||E.position!=="static"||!h||!["absolute","fixed"].includes(h.position))?h=E:p=p.filter(g=>g!==m),m=ns(m)}return c.set(u,p),p}(t,this._c):[].concat(n),s=[...i,r],l=s[0],a=s.reduce((u,c)=>{const f=r0(t,c,o);return u.top=ts(f.top,u.top),u.right=Ky(f.right,u.right),u.bottom=Ky(f.bottom,u.bottom),u.left=ts(f.left,u.left),u},r0(t,l,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=Xt(n),i=Kn(n);if(n===i)return t;let s={scrollLeft:0,scrollTop:0},l={x:1,y:1};const a={x:0,y:0};if((o||!o&&r!=="fixed")&&((Yn(n)!=="body"||da(i))&&(s=pa(n)),Xt(n))){const u=Sr(n);l=Co(n),a.x=u.x+n.clientLeft,a.y=u.y+n.clientTop}return{width:t.width*l.x,height:t.height*l.y,x:t.x*l.x-s.scrollLeft*l.x+a.x,y:t.y*l.y-s.scrollTop*l.y+a.y}},isElement:Pt,getDimensions:function(e){return Xt(e)?Qy(e):e.getBoundingClientRect()},getOffsetParent:i0,getDocumentElement:Kn,getScale:Co,async getElementRects(e){let{reference:t,floating:n,strategy:r}=e;const o=this.getOffsetParent||i0,i=this.getDimensions;return{reference:RC(t,await o(n),r),floating:{x:0,y:0,...await i(n)}}},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>Qt(e).direction==="rtl"};function OC(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=!0,animationFrame:l=!1}=r,a=o&&!l,u=a||i?[...Pt(e)?Qn(e):e.contextElement?Qn(e.contextElement):[],...Qn(t)]:[];u.forEach(h=>{a&&h.addEventListener("scroll",n,{passive:!0}),i&&h.addEventListener("resize",n)});let c,f=null;if(s){let h=!0;f=new ResizeObserver(()=>{h||n(),h=!1}),Pt(e)&&!l&&f.observe(e),Pt(e)||!e.contextElement||l||f.observe(e.contextElement),f.observe(t)}let p=l?Sr(e):null;return l&&function h(){const v=Sr(e);!p||v.x===p.x&&v.y===p.y&&v.width===p.width&&v.height===p.height||n(),p=v,c=requestAnimationFrame(h)}(),n(),()=>{var h;u.forEach(v=>{a&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),(h=f)==null||h.disconnect(),f=null,l&&cancelAnimationFrame(c)}}const xC=(e,t,n)=>{const r=new Map,o={platform:NC,...n},i={...o.platform,_c:r};return dC(e,t,{...o,platform:i})},TC=e=>{const{element:t,padding:n}=e;function r(o){return Object.prototype.hasOwnProperty.call(o,"current")}return{name:"arrow",options:e,fn(o){return r(t)?t.current!=null?Yy({element:t.current,padding:n}).fn(o):{}:t?Yy({element:t,padding:n}).fn(o):{}}}};var ha=typeof document<"u"?N.useLayoutEffect:N.useEffect;function ga(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!ga(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!ga(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function s0(e){const t=N.useRef(e);return ha(()=>{t.current=e}),t}function IC(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,whileElementsMounted:i,open:s}=e,[l,a]=N.useState({x:null,y:null,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[u,c]=N.useState(r);ga(u,r)||c(r);const f=N.useRef(null),p=N.useRef(null),h=N.useRef(l),v=s0(i),m=s0(o),[E,d]=N.useState(null),[g,y]=N.useState(null),S=N.useCallback(k=>{f.current!==k&&(f.current=k,d(k))},[]),w=N.useCallback(k=>{p.current!==k&&(p.current=k,y(k))},[]),O=N.useCallback(()=>{if(!f.current||!p.current)return;const k={placement:t,strategy:n,middleware:u};m.current&&(k.platform=m.current),xC(f.current,p.current,k).then(B=>{const $={...B,isPositioned:!0};T.current&&!ga(h.current,$)&&(h.current=$,kr.flushSync(()=>{a($)}))})},[u,t,n,m]);ha(()=>{s===!1&&h.current.isPositioned&&(h.current.isPositioned=!1,a(k=>({...k,isPositioned:!1})))},[s]);const T=N.useRef(!1);ha(()=>(T.current=!0,()=>{T.current=!1}),[]),ha(()=>{if(E&&g){if(v.current)return v.current(E,g,O);O()}},[E,g,O,v]);const b=N.useMemo(()=>({reference:f,floating:p,setReference:S,setFloating:w}),[S,w]),P=N.useMemo(()=>({reference:E,floating:g}),[E,g]);return N.useMemo(()=>({...l,update:O,refs:b,elements:P,reference:S,floating:w}),[l,O,b,P,S,w])}var _r=typeof document<"u"?N.useLayoutEffect:N.useEffect;let zf=!1,CC=0;const l0=()=>"floating-ui-"+CC++;function AC(){const[e,t]=N.useState(()=>zf?l0():void 0);return _r(()=>{e==null&&t(l0())},[]),N.useEffect(()=>{zf||(zf=!0)},[]),e}const Hf=Rd["useId".toString()]||AC;function bC(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){e.set(t,(e.get(t)||[]).filter(r=>r!==n))}}}const LC=N.createContext(null),DC=N.createContext(null),a0=()=>{var e;return((e=N.useContext(LC))==null?void 0:e.id)||null},jf=()=>N.useContext(DC);function gn(e){return(e==null?void 0:e.ownerDocument)||document}function u0(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function kC(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}function Wf(e){return gn(e).defaultView||window}function qt(e){return e?e instanceof Wf(e).Element:!1}function c0(e){return e?e instanceof Wf(e).HTMLElement:!1}function PC(e){if(typeof ShadowRoot>"u")return!1;const t=Wf(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function MC(e){if(e.mozInputSource===0&&e.isTrusted)return!0;const t=/Android/i;return(t.test(u0())||t.test(kC()))&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function UC(e){return e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType!=="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0}function f0(){return/apple/i.test(navigator.vendor)}function FC(){return u0().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function d0(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function p0(e){const t=N.useRef(e);return _r(()=>{t.current=e}),t}const h0="data-floating-ui-safe-polygon";function Gf(e,t,n){return n&&!d0(n)?0:typeof e=="number"?e:e==null?void 0:e[t]}const VC=function(e,t){let{enabled:n=!0,delay:r=0,handleClose:o=null,mouseOnly:i=!1,restMs:s=0,move:l=!0}=t===void 0?{}:t;const{open:a,onOpenChange:u,dataRef:c,events:f,elements:{domReference:p,floating:h},refs:v}=e,m=jf(),E=a0(),d=p0(o),g=p0(r),y=N.useRef(),S=N.useRef(),w=N.useRef(),O=N.useRef(),T=N.useRef(!0),b=N.useRef(!1),P=N.useRef(()=>{}),k=N.useCallback(()=>{var R;const D=(R=c.current.openEvent)==null?void 0:R.type;return(D==null?void 0:D.includes("mouse"))&&D!=="mousedown"},[c]);N.useEffect(()=>{if(!n)return;function R(){clearTimeout(S.current),clearTimeout(O.current),T.current=!0}return f.on("dismiss",R),()=>{f.off("dismiss",R)}},[n,f]),N.useEffect(()=>{if(!n||!d.current||!a)return;function R(){k()&&u(!1)}const D=gn(h).documentElement;return D.addEventListener("mouseleave",R),()=>{D.removeEventListener("mouseleave",R)}},[h,a,u,n,d,c,k]);const B=N.useCallback(function(R){R===void 0&&(R=!0);const D=Gf(g.current,"close",y.current);D&&!w.current?(clearTimeout(S.current),S.current=setTimeout(()=>u(!1),D)):R&&(clearTimeout(S.current),u(!1))},[g,u]),$=N.useCallback(()=>{P.current(),w.current=void 0},[]),F=N.useCallback(()=>{if(b.current){const R=gn(v.floating.current).body;R.style.pointerEvents="",R.removeAttribute(h0),b.current=!1}},[v]);return N.useEffect(()=>{if(!n)return;function R(){return c.current.openEvent?["click","mousedown"].includes(c.current.openEvent.type):!1}function D(x){if(clearTimeout(S.current),T.current=!1,i&&!d0(y.current)||s>0&&Gf(g.current,"open")===0)return;c.current.openEvent=x;const L=Gf(g.current,"open",y.current);L?S.current=setTimeout(()=>{u(!0)},L):u(!0)}function A(x){if(R())return;P.current();const L=gn(h);if(clearTimeout(O.current),d.current){a||clearTimeout(S.current),w.current=d.current({...e,tree:m,x:x.clientX,y:x.clientY,onClose(){F(),$(),B()}});const U=w.current;L.addEventListener("mousemove",U),P.current=()=>{L.removeEventListener("mousemove",U)};return}B()}function C(x){R()||d.current==null||d.current({...e,tree:m,x:x.clientX,y:x.clientY,onClose(){F(),$(),B()}})(x)}if(qt(p)){const x=p;return a&&x.addEventListener("mouseleave",C),h==null||h.addEventListener("mouseleave",C),l&&x.addEventListener("mousemove",D,{once:!0}),x.addEventListener("mouseenter",D),x.addEventListener("mouseleave",A),()=>{a&&x.removeEventListener("mouseleave",C),h==null||h.removeEventListener("mouseleave",C),l&&x.removeEventListener("mousemove",D),x.removeEventListener("mouseenter",D),x.removeEventListener("mouseleave",A)}}},[p,h,n,e,i,s,l,B,$,F,u,a,m,g,d,c]),_r(()=>{var R;if(n&&a&&(R=d.current)!=null&&R.__options.blockPointerEvents&&k()){const C=gn(h).body;if(C.setAttribute(h0,""),C.style.pointerEvents="none",b.current=!0,qt(p)&&h){var D,A;const x=p,L=m==null||(D=m.nodesRef.current.find(U=>U.id===E))==null||(A=D.context)==null?void 0:A.elements.floating;return L&&(L.style.pointerEvents=""),x.style.pointerEvents="auto",h.style.pointerEvents="auto",()=>{x.style.pointerEvents="",h.style.pointerEvents=""}}}},[n,a,E,h,p,m,d,c,k]),_r(()=>{a||(y.current=void 0,$(),F())},[a,$,F]),N.useEffect(()=>()=>{$(),clearTimeout(S.current),clearTimeout(O.current),F()},[n,$,F]),N.useMemo(()=>{if(!n)return{};function R(D){y.current=D.pointerType}return{reference:{onPointerDown:R,onPointerEnter:R,onMouseMove(){a||s===0||(clearTimeout(O.current),O.current=setTimeout(()=>{T.current||u(!0)},s))}},floating:{onMouseEnter(){clearTimeout(S.current)},onMouseLeave(){f.emit("dismiss",{type:"mouseLeave",data:{returnFocus:!1}}),B(!1)}}}},[f,n,s,a,u,B])};function Yf(){return Yf=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Yf.apply(this,arguments)}function g0(e){let t=e.activeElement;for(;((n=t)==null||(r=n.shadowRoot)==null?void 0:r.activeElement)!=null;){var n,r;t=t.shadowRoot.activeElement}return t}function Kf(e,t){if(!e||!t)return!1;const n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&PC(n)){let r=t;do{if(r&&e===r)return!0;r=r.parentNode||r.host}while(r)}return!1}function Qf(e,t){let n=e.filter(o=>{var i;return o.parentId===t&&((i=o.context)==null?void 0:i.open)})||[],r=n;for(;r.length;)r=e.filter(o=>{var i;return(i=r)==null?void 0:i.some(s=>{var l;return o.parentId===s.id&&((l=o.context)==null?void 0:l.open)})})||[],n=n.concat(r);return n}function BC(e){return"composedPath"in e?e.composedPath()[0]:e.target}const m0=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function v0(e,t){const n=Hy(e,m0());t==="prev"&&n.reverse();const r=n.indexOf(g0(gn(e)));return n.slice(r+1)[0]}function $C(){return v0(document.body,"next")}function zC(){return v0(document.body,"prev")}function Xf(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Kf(n,r)}function HC(e){Hy(e,m0()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function jC(e){e.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}const WC=Rd["useInsertionEffect".toString()]||(e=>e());function qf(e){const t=N.useRef(()=>{});return WC(()=>{t.current=e}),N.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}const y0={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0};let Zf,Jf;function E0(e){e.key==="Tab"&&(Zf=e.target,clearTimeout(Jf))}function GC(e){const t=Zf===e.relatedTarget;return Zf=e.relatedTarget,clearTimeout(Jf),t}const S0=N.forwardRef(function(t,n){const r=qf(t.onFocus),[o,i]=N.useState();return _r(()=>(f0()&&i("button"),document.addEventListener("keydown",E0),()=>{document.removeEventListener("keydown",E0)}),[]),N.createElement("span",Yf({},t,{ref:n,tabIndex:0,role:o,"aria-hidden":o?void 0:!0,"data-floating-ui-focus-guard":"",style:y0,onFocus:s=>{f0()&&FC()&&!GC(s)?(s.persist(),Jf=window.setTimeout(()=>{r(s)},50)):r(s)}}))}),_0=N.createContext(null),YC=function(e){let{id:t,enabled:n=!0}=e===void 0?{}:e;const[r,o]=N.useState(null),i=Hf(),s=QC();return _r(()=>{if(!n)return;const l=t?document.getElementById(t):null;if(l)l.setAttribute("data-floating-ui-portal",""),o(l);else{const a=document.createElement("div");t!==""&&(a.id=t||i),a.setAttribute("data-floating-ui-portal",""),o(a);const u=(s==null?void 0:s.portalNode)||document.body;return u.appendChild(a),()=>{u.removeChild(a)}}},[t,s,i,n]),r},KC=e=>{let{children:t,id:n,root:r=null,preserveTabOrder:o=!0}=e;const i=YC({id:n,enabled:!r}),[s,l]=N.useState(null),a=N.useRef(null),u=N.useRef(null),c=N.useRef(null),f=N.useRef(null),p=!!s&&!s.modal&&!!(r||i)&&o;return N.useEffect(()=>{if(!i||!o||s!=null&&s.modal)return;function h(v){i&&Xf(v)&&(v.type==="focusin"?jC:HC)(i)}return i.addEventListener("focusin",h,!0),i.addEventListener("focusout",h,!0),()=>{i.removeEventListener("focusin",h,!0),i.removeEventListener("focusout",h,!0)}},[i,o,s==null?void 0:s.modal]),N.createElement(_0.Provider,{value:N.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:a,afterOutsideRef:u,beforeInsideRef:c,afterInsideRef:f,portalNode:i,setFocusManagerState:l}),[o,i])},p&&i&&N.createElement(S0,{"data-type":"outside",ref:a,onFocus:h=>{if(Xf(h,i)){var v;(v=c.current)==null||v.focus()}else{const m=zC()||(s==null?void 0:s.refs.domReference.current);m==null||m.focus()}}}),p&&i&&N.createElement("span",{"aria-owns":i.id,style:y0}),r?kr.createPortal(t,r):i?kr.createPortal(t,i):null,p&&i&&N.createElement(S0,{"data-type":"outside",ref:u,onFocus:h=>{if(Xf(h,i)){var v;(v=f.current)==null||v.focus()}else{const m=$C()||(s==null?void 0:s.refs.domReference.current);m==null||m.focus(),s!=null&&s.closeOnFocusOut&&(s==null||s.onOpenChange(!1))}}}))},QC=()=>N.useContext(_0);function ma(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}const XC={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},qC={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},ZC=function(e){var t,n;return e===void 0&&(e=!0),{escapeKeyBubbles:typeof e=="boolean"?e:(t=e.escapeKey)!=null?t:!0,outsidePressBubbles:typeof e=="boolean"?e:(n=e.outsidePress)!=null?n:!0}},JC=function(e,t){let{open:n,onOpenChange:r,events:o,nodeId:i,elements:{reference:s,domReference:l,floating:a},dataRef:u}=e,{enabled:c=!0,escapeKey:f=!0,outsidePress:p=!0,outsidePressEvent:h="pointerdown",referencePress:v=!1,referencePressEvent:m="pointerdown",ancestorScroll:E=!1,bubbles:d=!0}=t===void 0?{}:t;const g=jf(),y=a0()!=null,S=qf(typeof p=="function"?p:()=>!1),w=typeof p=="function"?S:p,O=N.useRef(!1),{escapeKeyBubbles:T,outsidePressBubbles:b}=ZC(d);return N.useEffect(()=>{if(!n||!c)return;u.current.__escapeKeyBubbles=T,u.current.__outsidePressBubbles=b;function P(R){if(R.key==="Escape"){const D=g?Qf(g.nodesRef.current,i):[];if(D.length>0){let A=!0;if(D.forEach(C=>{var x;if((x=C.context)!=null&&x.open&&!C.context.dataRef.current.__escapeKeyBubbles){A=!1;return}}),!A)return}o.emit("dismiss",{type:"escapeKey",data:{returnFocus:{preventScroll:!1}}}),r(!1)}}function k(R){const D=O.current;if(O.current=!1,D||typeof w=="function"&&!w(R))return;const A=BC(R);if(c0(A)&&a){const L=a.ownerDocument.defaultView||window,U=A.scrollWidth>A.clientWidth,z=A.scrollHeight>A.clientHeight;let j=z&&R.offsetX>A.clientWidth;if(z&&L.getComputedStyle(A).direction==="rtl"&&(j=R.offsetX<=A.offsetWidth-A.clientWidth),j||U&&R.offsetY>A.clientHeight)return}const C=g&&Qf(g.nodesRef.current,i).some(L=>{var U;return ma(R,(U=L.context)==null?void 0:U.elements.floating)});if(ma(R,a)||ma(R,l)||C)return;const x=g?Qf(g.nodesRef.current,i):[];if(x.length>0){let L=!0;if(x.forEach(U=>{var z;if((z=U.context)!=null&&z.open&&!U.context.dataRef.current.__outsidePressBubbles){L=!1;return}}),!L)return}o.emit("dismiss",{type:"outsidePress",data:{returnFocus:y?{preventScroll:!0}:MC(R)||UC(R)}}),r(!1)}function B(){r(!1)}const $=gn(a);f&&$.addEventListener("keydown",P),w&&$.addEventListener(h,k);let F=[];return E&&(qt(l)&&(F=Qn(l)),qt(a)&&(F=F.concat(Qn(a))),!qt(s)&&s&&s.contextElement&&(F=F.concat(Qn(s.contextElement)))),F=F.filter(R=>{var D;return R!==((D=$.defaultView)==null?void 0:D.visualViewport)}),F.forEach(R=>{R.addEventListener("scroll",B,{passive:!0})}),()=>{f&&$.removeEventListener("keydown",P),w&&$.removeEventListener(h,k),F.forEach(R=>{R.removeEventListener("scroll",B)})}},[u,a,l,s,f,w,h,o,g,i,n,r,E,c,T,b,y]),N.useEffect(()=>{O.current=!1},[w,h]),N.useMemo(()=>c?{reference:{[XC[m]]:()=>{v&&(o.emit("dismiss",{type:"referencePress",data:{returnFocus:!1}}),r(!1))}},floating:{[qC[h]]:()=>{O.current=!0}}}:{},[c,o,v,h,m,r])},eA=function(e,t){let{open:n,onOpenChange:r,dataRef:o,events:i,refs:s,elements:{floating:l,domReference:a}}=e,{enabled:u=!0,keyboardOnly:c=!0}=t===void 0?{}:t;const f=N.useRef(""),p=N.useRef(!1),h=N.useRef();return N.useEffect(()=>{if(!u)return;const m=gn(l).defaultView||window;function E(){!n&&c0(a)&&a===g0(gn(a))&&(p.current=!0)}return m.addEventListener("blur",E),()=>{m.removeEventListener("blur",E)}},[l,a,n,u]),N.useEffect(()=>{if(!u)return;function v(m){(m.type==="referencePress"||m.type==="escapeKey")&&(p.current=!0)}return i.on("dismiss",v),()=>{i.off("dismiss",v)}},[i,u]),N.useEffect(()=>()=>{clearTimeout(h.current)},[]),N.useMemo(()=>u?{reference:{onPointerDown(v){let{pointerType:m}=v;f.current=m,p.current=!!(m&&c)},onMouseLeave(){p.current=!1},onFocus(v){var m;p.current||v.type==="focus"&&((m=o.current.openEvent)==null?void 0:m.type)==="mousedown"&&o.current.openEvent&&ma(o.current.openEvent,a)||(o.current.openEvent=v.nativeEvent,r(!0))},onBlur(v){p.current=!1;const m=v.relatedTarget,E=qt(m)&&m.hasAttribute("data-floating-ui-focus-guard")&&m.getAttribute("data-type")==="outside";h.current=setTimeout(()=>{Kf(s.floating.current,m)||Kf(a,m)||E||r(!1)})}}}:{},[u,c,a,s,o,r])};function w0(e){return N.useMemo(()=>e.every(t=>t==null)?null:t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})},e)}const tA=function(e,t){let{open:n}=e,{enabled:r=!0,role:o="dialog"}=t===void 0?{}:t;const i=Hf(),s=Hf();return N.useMemo(()=>{const l={id:i,role:o};return r?o==="tooltip"?{reference:{"aria-describedby":n?i:void 0},floating:l}:{reference:{"aria-expanded":n?"true":"false","aria-haspopup":o==="alertdialog"?"dialog":o,"aria-controls":n?i:void 0,...o==="listbox"&&{role:"combobox"},...o==="menu"&&{id:s}},floating:{...l,...o==="menu"&&{"aria-labelledby":s}}}:{}},[r,o,n,i,s])};function nA(e){e===void 0&&(e={});const{open:t=!1,onOpenChange:n,nodeId:r}=e,o=IC(e),i=jf(),s=N.useRef(null),l=N.useRef({}),a=N.useState(()=>bC())[0],[u,c]=N.useState(null),f=N.useCallback(d=>{const g=qt(d)?{getBoundingClientRect:()=>d.getBoundingClientRect(),contextElement:d}:d;o.refs.setReference(g)},[o.refs]),p=N.useCallback(d=>{(qt(d)||d===null)&&(s.current=d,c(d)),(qt(o.refs.reference.current)||o.refs.reference.current===null||d!==null&&!qt(d))&&o.refs.setReference(d)},[o.refs]),h=N.useMemo(()=>({...o.refs,setReference:p,setPositionReference:f,domReference:s}),[o.refs,p,f]),v=N.useMemo(()=>({...o.elements,domReference:u}),[o.elements,u]),m=qf(n),E=N.useMemo(()=>({...o,refs:h,elements:v,dataRef:l,nodeId:r,events:a,open:t,onOpenChange:m}),[o,r,a,t,m,h,v]);return _r(()=>{const d=i==null?void 0:i.nodesRef.current.find(g=>g.id===r);d&&(d.context=E)}),N.useMemo(()=>({...o,context:E,refs:h,reference:p,positionReference:f}),[o,h,E,p,f])}function ed(e,t,n){const r=new Map;return{...n==="floating"&&{tabIndex:-1},...e,...t.map(o=>o?o[n]:null).concat(e).reduce((o,i)=>(i&&Object.entries(i).forEach(s=>{let[l,a]=s;if(l.indexOf("on")===0){if(r.has(l)||r.set(l,[]),typeof a=="function"){var u;(u=r.get(l))==null||u.push(a),o[l]=function(){for(var c,f=arguments.length,p=new Array(f),h=0;h<f;h++)p[h]=arguments[h];(c=r.get(l))==null||c.forEach(v=>v(...p))}}}else o[l]=a}),o),{})}}const rA=function(e){e===void 0&&(e=[]);const t=e,n=N.useCallback(i=>ed(i,e,"reference"),t),r=N.useCallback(i=>ed(i,e,"floating"),t),o=N.useCallback(i=>ed(i,e,"item"),e.map(i=>i==null?void 0:i.item));return N.useMemo(()=>({getReferenceProps:n,getFloatingProps:r,getItemProps:o}),[n,r,o])};function oA({initialOpen:e=!1,placement:t="top",open:n,onOpenChange:r}={}){const o=_t.useRef(null),[i,s]=_t.useState(e),l=n??i,a=r??s,u=nA({placement:t,open:l,onOpenChange:a,whileElementsMounted:OC,strategy:"fixed",middleware:[EC(8),yC({fallbackPlacements:["top","bottom","left","right"]}),_C({padding:8}),TC({element:o})]}),c=u.context,f=VC(c,{move:!1,enabled:n==null}),p=eA(c,{enabled:n==null}),h=JC(c),v=tA(c,{role:"tooltip"}),m=rA([f,p,h,v]);return _t.useMemo(()=>({open:l,setOpen:a,arrowRef:o,...m,...u}),[l,a,m,u])}const R0=_t.createContext(null),td=()=>{const e=_t.useContext(R0);if(e==null)throw new Error("Tooltip components must be wrapped in <Tooltip />");return e};function iA({children:e,...t}){const n=oA(t);return _(R0.Provider,{value:n,children:e})}const sA={top:"-bottom-1 before:border-t-0 before:border-l-0",bottom:"-top-1 before:border-b-0 before:border-r-0",left:"-right-1 before:border-r-0 before:border-t-0",right:"-left-1 before:border-l-0 before:border-b-0"},lA=()=>{var s,l;const e=td(),[t,n]=N.useState(e.middlewareData.arrow);N.useEffect(()=>{e.middlewareData.arrow&&n(e.middlewareData.arrow)},[e.middlewareData.arrow]);const r={left:(t==null?void 0:t.x)!==null?`${t==null?void 0:t.x}px`:"",top:(t==null?void 0:t.y)!==null?`${t==null?void 0:t.y}px`:""},o=((l=(s=e.placement)==null?void 0:s.split("-"))==null?void 0:l[0])||"top",i=`${sA[o]}`;return _("div",{ref:e.arrowRef,style:r,className:`tooltip-arrow absolute h-2 w-2 rotate-45 bg-inherit
65
+ before:absolute before:h-2 before:w-2 before:border before:border-foreground/30 before:content-['']
66
+ ${i}`})},aA=_t.forwardRef(function(t,n){var a;const r=ne(u=>u.rootElementId),o=N.useRef(null),i=td(),s=document.getElementById(r);if(s&&!o.current&&(o.current=(a=s.shadowRoot)==null?void 0:a.getRootNode()),!o.current)throw new Error(`shadowRoot id:${r} not found. Floating portal cannot be rendered`);const l=w0([i.refs.setFloating,n]);return _(KC,{root:o.current,children:i.open&&V("div",{className:"relative max-w-sm rounded-md bg-foreground p-2 text-sm leading-4 text-background shadow-sm",ref:l,style:{position:i.strategy,top:i.y??0,left:i.x??0,visibility:i.x==null?"hidden":"visible",...t.style},...i.getFloatingProps(t),children:[t.children,_(lA,{})]})})}),uA=_t.forwardRef(function({children:t,asChild:n=!1,...r},o){const i=td(),s=w0([i.refs.setReference,o,t==null?void 0:t.ref]);return n&&_t.isValidElement(t)?_t.cloneElement(t,i.getReferenceProps({ref:s,...r,...t.props,"data-state":i.open?"open":"closed"})):_("button",{ref:s,"data-state":i.open?"open":"closed",...i.getReferenceProps(r),children:t})}),rs=({asChild:e=!0,children:t,placement:n="top",trigger:r=_(Et,{tag:"circle-info"})})=>V(iA,{placement:n,children:[_(uA,{asChild:e,children:r}),_(aA,{children:t})]}),cA={initial:I.STATUS_LOADING,saving:I.STATUS_SAVING,"awaiting-save":I.STATUS_SAVING,saved:I.STATUS_SAVED,error:I.STATUS_ERROR},N0=e=>(e.preventDefault(),e.returnValue=""),fA=({className:e=""})=>{const t=ne(o=>o.saveFlowStatus),n=cA[t];t==="saved"?removeEventListener("beforeunload",N0,{capture:!0}):addEventListener("beforeunload",N0,{capture:!0});const r=t==="error";return V("div",{"aria-live":r?"assertive":"polite",className:`react-flow__controls-button hidden min-w-[3.625rem] cursor-auto select-auto bg-background text-center text-sm hover:bg-background active:bg-background sm:flex ${e} ${r?"text-negative":"text-foreground"}`,role:r?"alert":"status",children:[_("p",{children:M(n)}),r&&_(rs,{placement:"right",trigger:V("div",{className:"flex items-center justify-center pl-1",role:"tooltip",tabIndex:0,children:[_("span",{className:"sr-only",children:M(I.MORE_INFO_STATUS_ERROR)}),_(Et,{tag:"circle-exclamation"})]}),children:M(I.INFO_STATUS_ERROR)})]})},dA=()=>{KI();const e=ne(n=>n.isDraggingNode),t=ne(n=>n.rootAppWidth);return _(Bx,{className:e?"group/control-buttons":"",position:"top-left",showInteractive:Boolean(t&&t>=qv),children:_(fA,{})})},O0=/^[\w\d ']+$/,x0=/^\d+$/,T0=/^\d|\*|#$/,pA=/^[\d|\*|#$]{0,12}$/,hA=/^.{1,20}$/,I0=/^[a-z0-9_]{1,20}$/,va={MIN:1,MAX:99},wr=e=>(/(?:\/\^)(.+)(?:\$\/)/.exec(e.toString())??[])[1],nd=e=>t=>Boolean(e.exec(t)),rd=e=>nd(T0)(e),od=e=>nd(O0)(e),C0=e=>nd(I0)(e),A0=e=>typeof e=="string"&&e===""||Array.isArray(e)&&e.length===0?!1:typeof e=="object"&&e!==null?Object.keys(e).length===0?!1:Object.values(e).every(A0):!0,gA=e=>{var i;const t=N.useRef(),n=Ax(),r=e&&"options"in e.data?(i=e.data.options)==null?void 0:i.length:0;return t.current=r,{updateDynamicHandles:s=>{"options"in s&&s.options.length!==t.current&&(e&&n(e.id),t.current=s.options.length)}}},Zt=e=>{const[t,n]=N.useReducer((r,o)=>({...r,...o}),e);return[t,n]},os=({displayData:e,formRef:t,setCompleted:n})=>{N.useEffect(()=>{var l,a;const r=t.current,o=new FormData(r),i=Object.fromEntries(o.entries());let s=!0;for(const u of Object.keys(i)){if(((l=e[u])==null?void 0:l.valid)!==void 0&&(s=s&&Boolean((a=e[u])==null?void 0:a.valid),s)){const c=r.elements.namedItem(u);c&&"checkValidity"in c&&(s=s&&c.checkValidity())}if(!s)break}n(s)},[e,t,n])},b0={url:I.PLAY_AUDIO_FILE,text:I.TEXT_TO_SPEECH},L0=({displayData:e,label:t,handleOnUpdate:n,setDisplayData:r,showDefaultOption:o})=>{var a,u;const i=e.selected.value,s=c=>{const f=c.currentTarget.value;r({selected:{value:f,valid:Boolean(f)||!o}}),n({selected:f})},l=c=>{const f=c.target,{name:p,value:h}=f,v=h.trim();let m=!0;switch(p){case"url":m=f.checkValidity(),r({[p]:{value:h,valid:m}}),n({text:"",url:m?v:""});break;case"text":m=f.checkValidity()&&v.length>0,r({[p]:{value:h,valid:m}}),n({text:m?v:"",url:""});break;default:throw new Error(`Unhandled input name: ${p}`)}};return V("div",{children:[V("label",{children:[_("span",{className:"sr-only",children:t}),V(yr,{className:"w-full",name:"selected",onChange:s,value:i,children:[o&&_("option",{value:"",children:M(I.SELECT)}),Object.keys(b0).map(c=>_("option",{value:c,children:M(b0[c])},c))]})]}),i&&_(mA,{name:i,onChange:l,required:!0,selected:i,valid:(a=e[i])==null?void 0:a.valid,value:(u=e[i])==null?void 0:u.value})]})},mA=({name:e,onChange:t,required:n,selected:r,valid:o,value:i})=>{const l={url:_(qi,{errorText:M(I.ERROR_URL_IS_REQUIRED),inputMode:"url",label:M(I.PLAY_AUDIO_FILE),name:e,onChange:t,placeholder:M(I.ENTER_URL),required:n,valid:o,value:i}),text:_(qi,{errorText:M(I.ERROR_VALUE_IS_REQUIRED),inputMode:"text",label:M(I.TEXT_TO_SPEECH),name:e,onChange:t,placeholder:M(I.WRITE_SOMETHING),required:n,valid:o,value:i})}[r];return _(be,{children:l})},vA=[{field:"stereo",title:I.STEREO,subtitle:I.STEREO_SUBTITLE},{field:"beep",title:I.BEEP,subtitle:I.BEEP_SUBTITLE}],D0=({displayData:e,handleOnUpdate:t,setDisplayData:n})=>{const r=s=>{const l=s.target.name,a=!e[l].value,u={[l]:{value:a}};n(u),t({[l]:a})},o=s=>{const l=s.target,{name:a,value:u}=l,c=l.checkValidity(),f={[a]:{value:u,valid:c}};n(f),t({[a]:c?u.trim():""})},i=s=>{const l=s.target.name,a=s.target.value,u={[l]:{value:a,valid:!0}};n(u),t({[l]:a})};return V(be,{children:[_("div",{className:"mb-5",children:vA.map(s=>{const l=e[s.field].value;return _("div",{children:_(Uy,{checked:l,clickHandler:r,name:s.field,subtitle:M(s.subtitle),title:M(s.title)})},s.field)})}),V("label",{children:[M(I.TERMINATORS),_("input",{className:`w-full ${e.terminators.valid?"":"invalid"}`,defaultValue:e.terminators.value||"",name:"terminators",onChange:o,pattern:wr(pA),placeholder:"#*0",type:"text"}),_("p",{className:"requirements",role:"alert",children:M(I.ERROR_TERMINATORS)})]}),V("label",{children:[M(I.FORMAT),V(yr,{className:"w-full",value:e.format.value,name:"format",onChange:i,children:[_("option",{value:"mp3",children:"MP3"}),_("option",{value:"wav",children:"WAV"})]})]})]})},St=({children:e,formRef:t,info:n,handleOnChange:r=()=>null,title:o})=>_("form",{className:"flex h-full flex-col overflow-hidden",noValidate:!0,onChange:r,ref:t,children:V("div",{className:"flex flex-col overflow-hidden",children:[V("legend",{className:"mb-2 flex w-full shrink-0 items-center justify-between px-4",children:[_("span",{className:"text-lg font-semibold leading-6",children:o}),n&&_(rs,{trigger:V("div",{role:"tooltip",tabIndex:0,children:[_("span",{className:"sr-only",children:M(I.MORE_INFO_TITLE,{title:o})}),_(Et,{tag:"circle-info"})]}),children:n})]}),_("div",{className:"mx-1 flex-1 overflow-y-auto px-3",children:e})]})}),k0=()=>({value:{id:Me(),value:""},valid:!0}),id=e=>e.every(t=>t.valid),yA=({nodeData:e,handleOnUpdate:t})=>{const n=N.useRef(),r={options:{value:e.options.length?e.options.map(v=>({value:v,valid:Boolean(v.value)})):[k0()],valid:!0}},[o,i]=Zt(r);os({displayData:o,formRef:n,setCompleted:v=>{t({},v)}});const l=v=>{v.preventDefault();const m=[...o.options.value,k0()];i({options:{value:m,valid:id(m)}}),t({options:m.map(E=>E.value)})},a=v=>{const E=o.options.value.filter((d,g)=>g!==v);i({options:{value:E,valid:id(E)}}),t({options:E.map(d=>d.value)})},u=(v,m)=>v.map(d=>d.value.id===m.value.id?{...d,...m}:d),c=v=>v.map(m=>({...m.value,value:m.value.value.trim()})),f=(v,m)=>{const E=o.options.value;E[v]||Ct().error(`Option not found at index ${v}`);const d=E[v],g={...d==null?void 0:d.value,...m},y=Boolean(g.value.trim()),S={value:g,valid:y},w=u(o.options.value,S);i({options:{value:w,valid:id(w)}}),t({options:c(w)})},p=(v,m)=>{const E=v.target,{name:d,value:g}=E;switch(d){case"value":m!==void 0&&f(m,{[d]:g});break;default:Ct().error(`Unhandled input name: ${d}`)}},h=o.options.value;return _(St,{formRef:n,info:M(I.INFO_NODE_COND),title:M(I.CONDITIONS),children:_("div",{className:"divide-y divide-foreground/10",children:h.map((v,m,E)=>V("div",{className:"mb-3",children:[V("div",{className:"flex items-center",children:[_("h2",{className:"nowrap flex-1 py-4 text-sm font-medium uppercase leading-4 text-foreground/50",children:M(I.CONDITION_NUMBER,{index:m+1})}),Boolean(h.length>1)&&_(rs,{trigger:V("button",{className:"px-2",onClick:()=>a(m),type:"button",children:[_("span",{className:"sr-only",children:M(I.REMOVE_CONDITION,{index:m+1})}),_(Et,{tag:"xmark"})]}),children:M(I.INFO_NODE_OPTION_REMOVE)})]}),V("label",{className:"flex flex-col",children:[_("input",{className:`w-full ${v.valid?"":"invalid"}`,defaultValue:v.value.value,name:"value",onChange:d=>p(d,m),placeholder:"%{count} > 3, /hello/.test('%{foo}')",type:"text"}),_("p",{className:"requirements",role:"alert",children:M(I.ERROR_VALUE_IS_REQUIRED)})]}),m===E.length-1&&V("button",{onClick:l,type:"button",className:"mb-3 text-primary",children:["+ ",M(I.ADD_CONDITION)]})]},v.value.id))})})},EA={address:{info:I.INFO_NODE_FORWARD_TO_ADDRESS,title:I.FORWARD_TO_ADDRESS,call:I.CALL_ADDRESSES,single:I.SINGLE_ADDRESS,multiple:I.MULTIPLE_ADDRESSES},phone:{info:I.INFO_NODE_FORWARD_TO_PHONE,title:I.FORWARD_TO_PHONE,call:I.CALL_NUMBERS,single:I.SINGLE_NUMBER,multiple:I.MULTIPLE_NUMBERS},resource:{info:I.INFO_NODE_FORWARD_TO_RESOURCE,title:I.FORWARD_TO_RESOURCE,call:I.CALL_RESOURCES,single:I.SINGLE_RESOURCE,multiple:I.MULTIPLE_RESOURCES}},sd=({destinationType:e,nodeData:t,handleOnUpdate:n})=>{const r=N.useRef(),o=EA[e],i={single:o.single,multiple:o.multiple},s={callOrder:{value:"serial"},destinationList:{value:Wx(t.destinations),valid:!0},destinationSingle:{value:t.destinations.length===1&&t.destinations[0]?t.destinations[0]:"",valid:!0},sessionTimeout:{value:t.sessionTimeout,valid:!0},type:{value:t.type??"single"}},[l,a]=Zt(s);os({displayData:l,formRef:r,setCompleted:h=>{n({},h)}});const c=h=>{const v=h.currentTarget.value,m=l.destinationSingle.value;let E="single",d=m.trim()?[m.trim()]:[];v==="multiple"&&(E=l.callOrder.value,d=Of(l.destinationList.value)),a({type:{value:E}}),n({destinations:d,type:E})},f=h=>{const v=h.currentTarget.value;a({type:{value:v}}),n({type:v})},p=h=>{const v=h.target,m=v.name,E=v.value;let d=!0;switch(m){case"destinationSingle":d=v.checkValidity()&&E.trim().length>0,a({[m]:{value:E,valid:d}}),n({destinations:d?[E.trim()]:[]});break;case"destinationList":d=v.checkValidity()&&Boolean(Of(E).length),a({[m]:{value:E,valid:d}}),n({destinations:d?Of(E):[]});break;case"sessionTimeout":d=v.checkValidity(),a({[m]:{value:E?Number.parseInt(E,10):void 0,valid:d}}),n({sessionTimeout:d&&E?Number.parseInt(E,10):void 0});break;default:throw new Error(`Unhandled input name: ${m}`)}};return V(St,{info:M(o.info),title:M(o.title),formRef:r,children:[_("div",{className:"mb-1",children:V("label",{children:[_("span",{className:"sr-only",children:M(I.CHOOSE_OPTION_SINGLE_MULTIPLE)}),_(yr,{className:"w-full",name:"quantity",onChange:c,value:l.type.value==="single"?"single":"multiple",children:Object.keys(i).map(h=>_("option",{value:h,children:M(i[h])},h))})]})}),_("div",{children:l.type.value==="single"?_(SA,{displayData:l,destinationType:e,handleChange:p}):_(_A,{displayData:l,destinationType:e,handleCallOrderSelectChange:f,handleChange:p,labels:o})}),e!=="phone"&&V("label",{children:[_("div",{children:M(I.DISCONNECT_CALL_AFTER_RINGING)}),V("div",{className:"flex flex-wrap items-center gap-x-2",children:[_("input",{className:`w-14 ${l.sessionTimeout.valid?"":"invalid"}`,defaultValue:l.sessionTimeout.value,min:0,name:"sessionTimeout",onChange:p,pattern:wr(x0),type:"number",inputMode:"numeric"}),M(I.SECONDS),_("p",{className:"requirements w-full",role:"alert",children:M(I.ERROR_NUMBER_IS_REQUIRED)})]})]})]})},SA=({displayData:e,destinationType:t,handleChange:n})=>V(be,{children:[V("label",{children:[_("span",{className:"sr-only",children:M(I.SINGLE_NUMBER)}),_("input",{className:`w-full ${e.destinationSingle.valid?"":"invalid"}`,defaultValue:e.destinationSingle.value,name:"destinationSingle",onChange:n,placeholder:"+1 (204) 000 0000",required:!0,type:t==="phone"?"tel":"text"}),_("p",{className:"requirements",role:"alert",children:M(I.ERROR_VALUE_IS_REQUIRED)})]}),t!=="phone"&&_("div",{className:"mb-4 pt-4 text-xs uppercase",children:M(I.SETTINGS)})]}),_A=({displayData:e,destinationType:t,handleCallOrderSelectChange:n,handleChange:r,labels:o})=>{const i={serial:I.SEQUENTIALLY,parallel:I.SIMULTANEOUSLY};return V(be,{children:[V("label",{children:[_("span",{className:"sr-only",children:M(I.MULTIPLE_NUMBERS)}),_("textarea",{className:`min-h-[77px] w-full ${e.destinationList.valid?"":"invalid"}`,name:"destinationList",onChange:r,placeholder:"+1 (204) 123 0000, +1 (204) 456 0000, +1 (204) 789 0000",required:!0,value:e.destinationList.value}),_("p",{className:"requirements",role:"alert",children:M(I.ERROR_VALUE_IS_REQUIRED)})]}),_("div",{className:"mb-4 pt-4 text-xs uppercase",children:M(I.SETTINGS)}),_("div",{className:`${t==="phone"?"":"mb-4"}`,children:V("label",{children:[M(o.call),_(yr,{className:"w-full",name:"callOrder",onChange:n,value:e.type.value,children:Object.keys(i).map(s=>_("option",{value:s,children:M(i[s])},s))})]})})]})},P0=()=>({value:{id:Me(),command:"",digit:""},valid:!0}),ld=e=>e.every(t=>t.valid),wA=({nodeData:e,handleOnUpdate:t})=>{const n=N.useRef(),r={initialTimeout:{value:e.initialTimeout??5,valid:!0},url:{value:e.url,valid:!0},text:{value:e.text,valid:!0},selected:{value:e.selected||"text",valid:!0},options:{value:e.options.length?e.options.map(v=>({value:v,valid:Boolean(v.command||v.digit)})):[P0()],valid:!0}},[o,i]=Zt(r);os({displayData:o,formRef:n,setCompleted:v=>{t({},v)}});const l=v=>{v.preventDefault();const m=[...o.options.value,P0()];i({options:{value:m,valid:ld(m)}}),t({options:m.map(E=>E.value)})},a=v=>{const E=o.options.value.filter((d,g)=>g!==v);i({options:{value:E,valid:ld(E)}}),t({options:E.map(d=>d.value)})},u=(v,m)=>v.map(d=>d.value.id===m.value.id?{...d,...m}:d),c=v=>v.map(m=>{const E=m.value.command.trim(),d=m.value.digit.trim();return{...m.value,command:od(E)?E:"",digit:rd(d)?d:""}}),f=(v,m)=>{const E=o.options.value;if(!E[v])throw new Error(`Option not found at index ${v}`);const d=E[v],g={...d==null?void 0:d.value,...m},y=g.command.trim(),S=g.digit.trim(),w=Boolean(y)&&od(y)||Boolean(S)&&rd(S),O={value:g,valid:w},T=u(o.options.value,O);i({options:{value:T,valid:ld(T)}}),t({options:c(T)})},p=(v,m)=>{const E=v.target,{name:d,value:g}=E;let y=!0;switch(d){case"digit":case"command":m!==void 0&&f(m,{[d]:g});break;case"initialTimeout":{y=E.checkValidity(),i({[d]:{value:Number.parseInt(g,10),valid:y}}),t({initialTimeout:y&&g?parseInt(g,10):5});break}default:throw new Error(`Unhandled input name: ${d}`)}},h=o.options.value;return _(St,{formRef:n,info:M(I.INFO_NODE_GATHER_INPUT),title:M(I.GATHER_INPUT),children:V("div",{className:"divide-y divide-foreground/10",children:[_("div",{className:"mb-2",children:_(L0,{displayData:o,label:M(I.CHOOSE_OPTION_TTS_AUDIO),handleOnUpdate:t,setDisplayData:i})}),_("ul",{children:h.map((v,m,E)=>V("li",{className:"mb-3",children:[V("div",{className:"flex items-center",children:[_("h2",{className:"nowrap flex-1 py-6 text-sm font-medium uppercase leading-4 text-foreground/50",children:M(I.OPTION_NUMBER,{index:m+1})}),Boolean(h.length>1)&&_(rs,{trigger:V("button",{className:"px-2",onClick:()=>a(m),type:"button",children:[_("span",{className:"sr-only",children:M(I.REMOVE_OPTION,{index:m+1})}),_(Et,{tag:"xmark"})]}),children:M(I.INFO_NODE_OPTION_REMOVE)})]}),V("label",{className:"flex flex-col",children:[M(I.CALLER_PRESSES),_("input",{className:`w-1/4 ${!v.valid||v.value.digit&&!rd(v.value.digit)?"invalid":""}`,defaultValue:v.value.digit,name:"digit",onChange:d=>p(d,m),pattern:wr(T0),type:"text"}),_("p",{className:"requirements",role:"alert",children:M(I.ERROR_TELEPHONE_KEY_REQUIRED)})]}),V("label",{className:"flex flex-col",children:[M(I.OR_SAYS),_("input",{className:`w-full ${!v.valid||v.value.command&&!od(v.value.command)?"invalid":""}`,defaultValue:v.value.command,name:"command",onChange:d=>p(d,m),pattern:`${wr(O0)}|''`,type:"text"}),_("p",{className:"requirements",role:"alert",children:M(I.ERROR_TEXT_IS_REQUIRED)})]}),m===E.length-1&&V("button",{onClick:l,type:"button",className:"mb-3 text-primary",children:["+ ",M(I.ADD_OPTION)]})]},v.value.id))}),V("div",{className:"pt-6",children:[_("h2",{className:"pb-6 text-sm uppercase leading-4 text-foreground/50",children:M(I.SETTINGS)}),V("label",{children:[_("div",{className:"w-full",children:M(I.WAIT_FOR_INPUT)}),V("div",{className:"flex flex-wrap items-center gap-x-2",children:[_("input",{className:`w-14 ${o.initialTimeout.valid?"":"invalid"}`,defaultValue:o.initialTimeout.value,min:va.MIN,max:va.MAX,name:"initialTimeout",onChange:p,pattern:wr(x0),type:"number",inputMode:"numeric"}),M(I.SECONDS),_("p",{className:"requirements w-full",role:"alert",children:M(I.ERROR_NUMBER_MIN_MAX_IS_REQUIRED,{min:va.MIN,max:va.MAX})})]})]})]})]})})},RA=({nodeData:e,handleOnChange:t})=>_(St,{handleOnChange:t,info:M(I.INFO_NODE_HANG_UP),title:M(I.HANG_UP_CALL),children:V("label",{children:[V("p",{className:"mb-2 whitespace-nowrap",children:[M(I.REASON)," (",M(I.OPTIONAL),")"]}),V(yr,{className:"w-full",defaultValue:e.reason,name:"reason",children:[_("option",{value:"",children:M(I.SELECT)}),Object.keys(Df).map(n=>_("option",{value:n,children:M(Df[n])},n))]})]})}),NA=({nodeData:e,handleOnUpdate:t})=>{const n=N.useRef(),r={url:{value:e.url,valid:!0},text:{value:e.text,valid:!0},selected:{value:e.selected,valid:Boolean(e.selected)}},[o,i]=Zt(r);return os({displayData:o,formRef:n,setCompleted:l=>{t({},l)}}),_(St,{formRef:n,info:M(I.INFO_NODE_PLAY),title:M(I.PLAY_AUDIO_TTS),children:_(L0,{displayData:o,label:M(I.CHOOSE_OPTION_TTS_AUDIO),handleOnUpdate:t,setDisplayData:i,showDefaultOption:!0})})},OA=({nodeData:e,handleOnUpdate:t})=>{const n={beep:{value:e.beep},controlId:{value:e.controlId},format:{value:e.format,valid:!0},label:{value:e.label,valid:!0},stereo:{value:e.stereo},terminators:{value:e.terminators,valid:!0}},r=N.useRef(),[o,i]=Zt(n),[s,l]=N.useState(!1),a=Gn(p=>p.upsertEntry),u=Gn(p=>p.isValueDuplicate);os({displayData:o,formRef:r,setCompleted:p=>{t({},p)}});const f=p=>{let h=!0;const v=p.target,{name:m,value:E}=v,d=E.trim(),g=u(d,e.controlId);l(g),h=v.checkValidity()&&Boolean(d)&&!g,i({[m]:{value:E,valid:h}}),t({[m]:h?d:""}),a({controlId:e.controlId,label:h?d:""})};return V(St,{info:M(I.INFO_NODE_RECORD_CALL_START),title:M(I.RECORD_CALL_START),formRef:r,children:[V("label",{children:[M(I.RECORDING_NAME),_("input",{className:`w-full ${o.label.valid?"":"invalid"}`,defaultValue:o.label.value,name:"label",onChange:f,pattern:wr(hA),required:!0,type:"text"}),_("p",{className:"requirements",role:"alert",children:M(s?I.ERROR_DUPLICATE_RECORDING_LABEL:I.ERROR_RECORDING_LABEL_REQUIRED)})]}),_(D0,{handleOnUpdate:t,displayData:o,setDisplayData:i})]})},xA=({nodeData:e,handleOnChange:t})=>{const r=Gn(o=>o.getEntries)().sort((o,i)=>o.label.toLowerCase().localeCompare(i.label.toLowerCase()));return _(St,{handleOnChange:t,info:M(I.INFO_NODE_RECORD_CALL_STOP),title:M(I.RECORD_CALL_STOP),children:r.length?V("label",{children:[_("p",{className:"mb-2 whitespace-nowrap",children:M(I.RECORDING_NAME)}),V(yr,{className:"w-full",defaultValue:e.controlId,name:"controlId",children:[_("option",{value:"",children:M(I.SELECT)}),r.map(o=>_("option",{value:o.controlId,children:o.label},o.controlId))]})]}):_("p",{className:"text-negative",children:M(I.ERROR_ADD_RECORDING_FIRST)})})},TA=({nodeData:e,handleOnUpdate:t})=>{const n={beep:{value:e.beep},format:{value:e.format,valid:!0},stereo:{value:e.stereo},terminators:{value:e.terminators,valid:!0}},[r,o]=Zt(n);return _(St,{info:M(I.INFO_NODE_RECORD),title:M(I.VOICEMAIL_RECORDING),children:_(D0,{handleOnUpdate:t,displayData:r,setDisplayData:o})})},IA=["GET","POST","PUT","DELETE"],CA=e=>{console.log("bodyToTextArea",e);try{return typeof e=="string"?e:JSON.stringify(e)}catch{return e}},AA=({nodeData:e,handleOnUpdate:t})=>{const n={url:{value:e.url,valid:!0},method:{value:e.method,valid:!0},headers:{value:e.headers,valid:!0},body:{value:e.body,valid:!0},saveVariables:{value:Boolean(e.saveVariables),valid:!0}},[r,o]=Zt(n),i=a=>{const u=a.target,{name:c,value:f}=u,p=typeof f=="string"?f.trim():f;let h=!0;switch(c){case"url":case"method":h=u.checkValidity()&&!!p,o({[c]:{value:f,valid:h}}),t({[c]:h?p:""});break;case"headers":if(!f){o({[c]:{value:{},valid:!0}}),t({[c]:{}});return}try{const v=JSON.parse(f);o({[c]:{valid:!0}}),t({[c]:v})}catch{o({[c]:{valid:!1}}),t({[c]:{}})}break;case"body":try{const v=JSON.parse(f);o({[c]:{value:f,valid:!0}}),t({[c]:v})}catch{o({[c]:{value:f,valid:!0}}),t({[c]:f})}break;default:throw new Error(`Unhandled input name: ${c}`)}},s=a=>{const u=a.target.name,c=a.target.value,f={[u]:c};o(f),t(f)},l=a=>{const u=a.target.name,c=!r[u].value;o({[u]:{value:c}}),t({[u]:c})};return V(St,{info:M(I.INFO_NODE_REQUEST),title:M(I.REQUEST),children:[V("label",{children:[_("div",{children:M(I.URL)}),_("input",{className:`w-full ${r.url.valid?"":"invalid"}`,defaultValue:r.url.value,name:"url",onChange:i,placeholder:"https://user:password@example.com/api/status",required:!0,type:"text"}),_("p",{className:"requirements w-full",role:"alert",children:M(I.ERROR_VALUE_IS_REQUIRED)})]}),V("label",{className:"mb-3 block",children:[M(I.METHOD),_(yr,{className:"w-full",value:r.method.value,name:"method",onChange:s,children:IA.map(a=>_("option",{value:a,children:a},a))})]}),_("div",{className:"mb-4",children:_(Uy,{checked:r.saveVariables.value,clickHandler:l,name:"saveVariables",subtitle:M(I.SAVE_VARIABLES_SUBTITLE),title:M(I.SAVE_VARIABLES)})}),V("label",{children:[_("div",{children:M(I.REQUEST_HEADERS)}),_(qi,{errorText:M(I.ERROR_INVALID_JSON),inputMode:"text",valid:Boolean(r.headers.valid),label:M(I.REQUEST_HEADERS),name:"headers",onChange:i,placeholder:'{"Content-Type": "application/json", "X-Custom-Header": "foo"}',required:!0,value:JSON.stringify(r.headers.value)})]}),V("label",{children:[_("div",{children:M(I.REQUEST_BODY)}),_(qi,{inputMode:"text",valid:!0,label:M(I.REQUEST_BODY),name:"body",onChange:i,placeholder:"String or JSON to serialize",value:CA(r.body.value)})]})]})},bA=({nodeData:e,handleOnUpdate:t})=>{const n={body:{value:e.body,valid:!0},fromNumber:{value:e.fromNumber,valid:!0},toNumber:{value:e.toNumber,valid:!0}},[r,o]=Zt(n),i=s=>{const l=s.target,{name:a,value:u}=l,c=typeof u=="string"?u.trim():u;let f=!0;switch(a){case"body":case"fromNumber":case"toNumber":f=l.checkValidity()&&!!c,o({[a]:{value:u,valid:f}}),t({[a]:f?c:""});break;default:throw new Error(`Unhandled input name: ${a}`)}};return V(St,{info:M(I.INFO_NODE_SEND_SMS),title:M(I.SEND_SMS),children:[V("label",{className:"mb-1",children:[_("div",{children:M(I.FROM_PHONE_NUMBER)}),_("input",{className:`w-full ${r.fromNumber.valid?"":"invalid"}`,defaultValue:r.fromNumber.value,name:"fromNumber",onChange:i,placeholder:"+1 (204) 000 0000",required:!0,type:"tel"}),_("p",{className:"requirements w-full",role:"alert",children:M(I.ERROR_VALUE_IS_REQUIRED)})]}),V("label",{className:"mb-1",children:[_("div",{children:M(I.TO_PHONE_NUMBER)}),_("input",{className:`w-full ${r.toNumber.valid?"":"invalid"}`,defaultValue:r.toNumber.value,name:"toNumber",onChange:i,placeholder:"+1 (204) 000 0000",required:!0,type:"tel"}),_("p",{className:"requirements w-full",role:"alert",children:M(I.ERROR_VALUE_IS_REQUIRED)})]}),V("label",{children:[_("div",{children:M(I.TEXT)}),_(qi,{errorText:M(I.ERROR_VALUE_IS_REQUIRED),inputMode:"text",valid:Boolean(r.body.valid),label:M(I.SMS_TEXT),name:"body",onChange:i,placeholder:M(I.WRITE_SOMETHING),required:!0,value:r.body.value})]})]})},M0=()=>({id:Me(),key:"",value:"",valid:!0}),U0=e=>e.reduce((t,{id:n,key:r,value:o,valid:i})=>(i&&r.trim().length>0&&t.push({id:n,key:r,value:o}),t),[]),LA=({nodeData:e,handleOnUpdate:t})=>{var m;const n=vr(E=>E.isKeyDuplicate),r={variables:{value:e.variables.length>0?e.variables.map(E=>({...E,valid:!0})):[M0()],valid:!0}},[o,i]=Zt(r),s=vr(E=>E.upsertVariable),l=vr(E=>E.removeVariable),a=E=>{E.preventDefault(),i({variables:{value:[...o.variables.value,M0()],valid:!0}})},u=E=>E.key.trim().length>0&&!n(E.key,E.id)&&C0(E.key),c=E=>E.every(d=>d.valid),f=E=>o.variables.value.map(d=>d.id===E.id?{...d,...E}:d),p=(E,d)=>{const g=o.variables.value[E];if(!g)throw new Error(`Variable not found at index ${E}`);const y={...g,...d};y.valid=u(y);const S=f(y),w=c(S);i({variables:{value:S,valid:w}}),t({variables:U0(S)},w),y.valid?s({id:y.id,key:y.key,value:y.value}):l(y.id)},h=E=>{const d=o.variables.value[E];if(d){const g=o.variables.value.filter((S,w)=>w!==E),y=c(g);i({variables:{value:g,valid:y}}),t({variables:U0(g)},y),l(d.id)}},v=(E,d)=>{const g=E.target,y=g.name;if(g.checkValidity())switch(y){case"key":case"value":p(d,{[y]:g.value});break;default:throw new Error(`Unhandled input name: ${y}`)}else p(d,{[y]:"",valid:!1})};return _(St,{info:M(I.INFO_NODE_SET_VARIABLES),title:M(I.SET_VARIABLES),children:_("div",{className:"divide-y divide-foreground/10",children:(m=o.variables.value)==null?void 0:m.map((E,d,g)=>{const y=n(E.key,E.id);return V("div",{className:"mb-3",children:[V("div",{className:"flex flex-nowrap",children:[_("h3",{className:"flex-1 overflow-hidden text-ellipsis whitespace-nowrap py-6 text-sm font-medium uppercase leading-4 text-foreground/50",children:M(I.VARIABLE_KEY,{key:E.key})}),Boolean(g.length>1)&&_(rs,{trigger:V("button",{className:"px-2",onClick:()=>h(d),type:"button",children:[_("span",{className:"sr-only",children:M(I.REMOVE_VARIABLE,{key:E.key})}),_(Et,{tag:"xmark"})]}),children:M(I.INFO_NODE_SET_VARIABLES_OPTION)})]}),V("label",{className:"flex flex-col",children:[M(I.KEY),_("input",{className:`w-full ${(E.valid||C0(E.key))&&!y?"":"invalid"}`,defaultValue:E.key,name:"key",onChange:S=>v(S,d),pattern:wr(I0),type:"text"}),_("p",{className:"requirements",children:M(y?I.ERROR_DUPLICATE_VARIABLE_KEY:I.ERROR_VARIABLE_KEY_REQUIRED)})]}),V("label",{className:"flex flex-col",children:[M(I.VALUE),_("input",{className:"w-full",defaultValue:E.value,name:"value",onChange:S=>v(S,d),type:"text"}),_("p",{className:"requirements",children:M(I.ERROR_TEXT_IS_REQUIRED)})]}),d===g.length-1&&V("button",{onClick:a,type:"button",className:"mb-3 text-primary",children:["+ ",M(I.ADD_VARIABLE)]})]},E.id)})})})},DA=(e,t)=>{N.useEffect(()=>{var o;const n=(o=e.current)==null?void 0:o.getRootNode(),r=i=>{var l;const s=i.target;s instanceof Node&&!((l=e.current)!=null&&l.contains(s))&&t(i)};return n&&n.addEventListener("pointerdown",r),()=>{n&&n.removeEventListener("pointerdown",r)}},[e,t])},kA=({key:e,setId:t})=>({id:Me(),key:e,setId:t}),PA=e=>e.length>0,MA=({nodeData:e,handleOnUpdate:t})=>{const r={currentFocus:void 0,listOpen:!1,setVariablesList:Array.from(vr(v=>v.variables).values()).map(v=>({...v,selected:Boolean(e.variables.find(m=>m.setId===v.id))})).sort((v,m)=>v.key.toLowerCase().localeCompare(m.key.toLowerCase())),unsetVariables:e.variables},[o,i]=Zt(r),s=v=>o.setVariablesList.map(m=>m.id===v?{...m,selected:!m.selected}:m),l=v=>{const m=o.setVariablesList[v];if(!m)throw new Error("Variable not found");if(m.selected){const E=o.unsetVariables.findIndex(d=>d.setId===m.id);a(E)}else{const E=[...o.unsetVariables,kA({key:m.key,setId:m.id})];i({unsetVariables:E,setVariablesList:s(m.id)}),t({variables:E},!0)}},a=v=>{const m=o.unsetVariables[v];if(!m)throw new Error("Cannot Remove Variable, not found");const E=o.unsetVariables.filter(d=>d.id!==m.id);i({unsetVariables:E,setVariablesList:s(m.setId)}),t({variables:E},PA(E))},u=N.useRef(null);DA(u,()=>i({listOpen:!1}));const c=v=>{(v.key==="Escape"||v.key==="Esc")&&i({listOpen:!1})},f=(v,m)=>{v.preventDefault(),(v.key===" "||v.code==="Space"||v.key==="Enter")&&l(m),c(v)},p=()=>{i({listOpen:!o.listOpen})},h=o.unsetVariables.length;return V(St,{info:M(I.INFO_NODE_UNSET_VARIABLES),title:M(I.UNSET_VARIABLES),children:[V("div",{className:"my-1 flex flex-col",children:[_("label",{id:"listbox-label",className:"sr-only",children:M(I.SELECT_VARIABLES_TO_UNSET)}),V("div",{className:"relative",ref:u,children:[_("button",{"aria-expanded":"true","aria-haspopup":"listbox","aria-labelledby":"listbox-label",className:`relative w-full cursor-pointer rounded-md border border-foreground/10 bg-transparent py-1.5 px-3 text-left shadow-sm
67
67
  after:absolute after:right-3 after:top-3 after:h-[7px] after:w-[7px] after:rotate-45 after:border-r after:border-b after:border-foreground after:content-['']
68
68
  focus:outline-none focus:ring-1 focus:ring-foreground`,onClick:p,onKeyDown:c,type:"button",children:h>0?M(I.NUMBER_OF_VARIABLES_SELECTED,{count:h}):M(I.SELECT_VARIABLES)}),o.listOpen&&V("ul",{"aria-activedescendant":o.currentFocus,"aria-labelledby":"listbox-label","aria-multiselectable":"true",className:"mt-1 max-h-60 w-full overflow-auto rounded-lg border border-foreground/10 bg-backgroundAlt py-1 shadow-xl",role:"listbox",children:[!o.setVariablesList.length&&_("li",{"aria-disabled":"true",className:"relative",role:"option",children:_("label",{className:"flex select-none items-center py-2 pl-3 pr-9",children:M(I.NO_VARIABLES_SET)})}),o.setVariablesList.map((v,m)=>_("li",{"aria-selected":v.selected,className:"relative",id:v.id,role:"option",children:V("label",{className:"flex select-none items-center py-2 pl-3 pr-9",children:[_("input",{checked:v.selected,className:"mr-2 h-4 w-4 rounded accent-primary",onChange:()=>l(m),onKeyDown:E=>f(E,m),type:"checkbox"}),v.key]})},v.id))]})]})]}),h>0&&V("section",{className:"pt-3",children:[_("h3",{className:"mb-2 leading-5 text-foreground",children:M(I.UNSET_VARIABLES)}),_("ul",{className:"flex flex-wrap gap-2",children:o.unsetVariables.map((v,m)=>_(RI,{handleClick:()=>a(m),children:v.key},v.id))})]})]})},UA=(e,t)=>{if("options"in t)switch(e.type){case"promptPlay":case"cond":return!0}return!1},FA=()=>{const e=ne(c=>c.selectedNode),t=ne(c=>c.partialUpdateNodeData),n=e==null?void 0:e.data,r=e==null?void 0:e.id,{updateDynamicHandles:o}=gA(e);if(!(e&&n&&r))return null;const i=c=>{const f=new FormData(c.currentTarget),p=Object.fromEntries(f.entries());t(r,{...p,missingRequiredParams:!A0(p)})},s=(c,f)=>{typeof f=="boolean"&&(c.missingRequiredParams=!f),UA(e,c)&&o(c),t(r,c)},l={forwardAddress:()=>_(sd,{destinationType:"address",nodeData:n,handleOnUpdate:s}),forwardPhone:()=>_(sd,{destinationType:"phone",nodeData:n,handleOnUpdate:s}),forwardResource:()=>_(sd,{destinationType:"resource",nodeData:n,handleOnUpdate:s}),hangup:()=>_(RA,{nodeData:n,handleOnChange:i}),play:()=>_(NA,{nodeData:n,handleOnUpdate:s}),promptPlay:()=>_(wA,{nodeData:n,handleOnUpdate:s}),set:()=>_(LA,{nodeData:n,handleOnUpdate:s}),unset:()=>_(MA,{nodeData:n,handleOnUpdate:s}),record:()=>_(TA,{nodeData:n,handleOnUpdate:s}),recordCallStart:()=>_(OA,{nodeData:n,handleOnUpdate:s}),recordCallStop:()=>_(xA,{nodeData:n,handleOnChange:i}),sendSms:()=>_(bA,{nodeData:n,handleOnUpdate:s}),request:()=>_(AA,{nodeData:n,handleOnUpdate:s}),cond:()=>_(yA,{nodeData:n,handleOnUpdate:s})};if(!(c=>Boolean(c in l))(e.type))return null;const u=l[e.type];return _(nf,{className:"nokey flex max-h-[95%] w-[300px] flex-col overflow-hidden rounded-md border border-foreground/10 bg-background py-4",position:"top-right",children:_(u,{})})};function F0(e){let t;try{t=e()}catch{return}return{getItem:r=>{var o;const i=l=>l===null?null:JSON.parse(l),s=(o=t.getItem(r))!=null?o:null;return s instanceof Promise?s.then(i):i(s)},setItem:(r,o)=>t.setItem(r,JSON.stringify(o)),removeItem:r=>t.removeItem(r)}}const is=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return is(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return is(r)(n)}}}},VA=(e,t)=>(n,r,o)=>{let i={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:E=>E,version:0,merge:(E,d)=>({...d,...E}),...t},s=!1;const l=new Set,a=new Set;let u;try{u=i.getStorage()}catch{}if(!u)return e((...E)=>{console.warn(`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`),n(...E)},r,o);const c=is(i.serialize),f=()=>{const E=i.partialize({...r()});let d;const g=c({state:E,version:i.version}).then(y=>u.setItem(i.name,y)).catch(y=>{d=y});if(d)throw d;return g},p=o.setState;o.setState=(E,d)=>{p(E,d),f()};const h=e((...E)=>{n(...E),f()},r,o);let v;const m=()=>{var E;if(!u)return;s=!1,l.forEach(g=>g(r()));const d=((E=i.onRehydrateStorage)==null?void 0:E.call(i,r()))||void 0;return is(u.getItem.bind(u))(i.name).then(g=>{if(g)return i.deserialize(g)}).then(g=>{if(g)if(typeof g.version=="number"&&g.version!==i.version){if(i.migrate)return i.migrate(g.state,g.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return g.state}).then(g=>{var y;return v=i.merge(g,(y=r())!=null?y:h),n(v,!0),f()}).then(()=>{d==null||d(v,void 0),s=!0,a.forEach(g=>g(v))}).catch(g=>{d==null||d(void 0,g)})};return o.persist={setOptions:E=>{i={...i,...E},E.getStorage&&(u=E.getStorage())},clearStorage:()=>{u==null||u.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>m(),hasHydrated:()=>s,onHydrate:E=>(l.add(E),()=>{l.delete(E)}),onFinishHydration:E=>(a.add(E),()=>{a.delete(E)})},m(),v||h},BA=(e,t)=>(n,r,o)=>{let i={storage:F0(()=>localStorage),partialize:m=>m,version:0,merge:(m,E)=>({...E,...m}),...t},s=!1;const l=new Set,a=new Set;let u=i.storage;if(!u)return e((...m)=>{console.warn(`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`),n(...m)},r,o);const c=()=>{const m=i.partialize({...r()});return u.setItem(i.name,{state:m,version:i.version})},f=o.setState;o.setState=(m,E)=>{f(m,E),c()};const p=e((...m)=>{n(...m),c()},r,o);let h;const v=()=>{var m;if(!u)return;s=!1,l.forEach(d=>d(r()));const E=((m=i.onRehydrateStorage)==null?void 0:m.call(i,r()))||void 0;return is(u.getItem.bind(u))(i.name).then(d=>{if(d)if(typeof d.version=="number"&&d.version!==i.version){if(i.migrate)return i.migrate(d.state,d.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return d.state}).then(d=>{var g;return h=i.merge(d,(g=r())!=null?g:p),n(h,!0),c()}).then(()=>{E==null||E(h,void 0),s=!0,a.forEach(d=>d(h))}).catch(d=>{E==null||E(void 0,d)})};return o.persist={setOptions:m=>{i={...i,...m},m.storage&&(u=m.storage)},clearStorage:()=>{u==null||u.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>v(),hasHydrated:()=>s,onHydrate:m=>(l.add(m),()=>{l.delete(m)}),onFinishHydration:m=>(a.add(m),()=>{a.delete(m)})},v(),h||p},$A=(e,t)=>{var n;return"getStorage"in t||"serialize"in t||"deserialize"in t?(((n={VITE_BASE_URL:"",VITE_BASIC_AUTH:"signalwire:1aG93uXk",VITE_DEFAULT_STYLE_HREF:"https://cdn.swire.io/npm/@signalwire/cfb@dev/dist/style.css",BASE_URL:"/cfb/",MODE:"staging",DEV:!1,PROD:!0,SSR:!1})==null?void 0:n.MODE)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),VA(e,t)):BA(e,t)},V0=window,B0={showAllNodes:!1,showDevOptions:!1},Rr=Tl()($A(e=>({...B0,toggleFlag:t=>{e(n=>({...n,[t]:!n[t]}))}}),{name:"flags",storage:F0(()=>localStorage),version:0}));Rr.subscribe(e=>{console.log("feature flags changed",e)});const zA=e=>{const t=(r,o)=>{Rr.setState(i=>({...i,[r]:o}))},n=r=>{const o=Rr.getState(),i={...r};return Object.entries(o).forEach(([s,l])=>{s in i&&typeof l=="boolean"&&(i[s]=l)}),i};if(V0){const r=new Proxy(n(e),{get:(o,i)=>Reflect.get(o,i),set:(o,i,s)=>{if(typeof s=="boolean"&&i in o)t(i,s);else throw new Error("unknown flag");return Reflect.set(o,i,s)}});V0.swFlags=r}},HA=()=>zA(B0),jA=()=>V("div",{className:"rounded-sm border border-gray-200 p-2",children:[_("h3",{className:"w-full",children:"Feature Flags"}),V("div",{className:"flex flex-col gap-y-2 py-2",children:[_($0,{flagName:"showAllNodes"}),_($0,{flagName:"showDevOptions"})]})]}),$0=({flagName:e})=>{const t=Rr(o=>o.toggleFlag),r=Rr(o=>o[e])?"translate-x-5 bg-positive":"translate-x-0 bg-negative";return V("label",{className:"flex cursor-pointer items-center",children:[V("div",{className:"relative",children:[_("input",{type:"checkbox",className:"sr-only",onChange:()=>t(e)}),_("div",{className:"h-5 w-10 rounded-full bg-foreground/70",children:_("div",{className:`absolute left-1 top-1 h-3 w-3 rounded-full transition ${r}`})})]}),_("p",{className:"ml-3 text-sm font-medium",children:e})]})},z0={action:{label:I.ACTION,nodes:{answer:{active:!0,label:I.ANSWER_CALL},hangup:{active:!0,label:I.HANG_UP_CALL},sendSms:{active:!0,label:I.SEND_SMS},play:{active:!0,label:I.PLAY_AUDIO_TTS}}},decision:{label:I.DECISION,nodes:{cond:{active:!0,label:I.CONDITIONS},set:{active:!0,label:I.SET_VARIABLES},unset:{active:!0,label:I.UNSET_VARIABLES}}},forwardTo:{label:I.FORWARD,nodes:{forwardAddress:{active:!1,label:I.FORWARD_TO_ADDRESS},forwardPhone:{active:!0,label:I.FORWARD_TO_PHONE},forwardResource:{active:!1,label:I.FORWARD_TO_RESOURCE}}},input:{label:I.INPUT,nodes:{promptPlay:{active:!0,label:I.GATHER_INPUT},request:{active:!0,label:I.REQUEST}}},recording:{label:I.RECORD,nodes:{record:{active:!0,label:I.VOICEMAIL_RECORDING},recordCallStart:{active:!0,label:I.RECORD_CALL_START},recordCallStop:{active:!0,label:I.RECORD_CALL_STOP}}}},WA=(e,t)=>({label:M(z0[e].label),nodes:Object.entries(z0[e].nodes).map(([n,r])=>(r.active||t)&&{title:M(r.label),type:n}).filter(Boolean).sort((n,r)=>n.title.localeCompare(r.title))}),{apiVersion:GA,builderVersion:YA,cfbAppVersion:KA,relayMLVersion:QA}=Af(),XA={[I.API_VERSION]:GA,[I.APP_VERSION]:KA,[I.BUILDER_VERSION]:YA,[I.RELAYML_VERSION]:QA},qA=()=>{const e=()=>{var r;((r=n.current)==null?void 0:r.open)===!1&&n.current.showModal()},t=()=>{var r;(r=n.current)!=null&&r.open&&n.current.close()},n=_t.useRef(null);return V("section",{className:"ml-4 mt-4",children:[_("menu",{children:_("button",{className:"text-xs text-foreground hover:underline",onClick:e,children:M(I.ABOUT)})}),_("dialog",{ref:n,className:"aspect-[5/4] w-72 max-w-xs overflow-hidden rounded-lg border border-foreground/10 bg-background text-foreground shadow-xl backdrop:backdrop-blur-sm backdrop:backdrop-brightness-95",children:V("div",{className:"h-full px-2 pb-10",children:[V("div",{className:"flex items-center justify-between",children:[_("h2",{className:"text-2xl leading-10",children:M(I.ABOUT)}),V("button",{className:"my-0.5 -mr-1.5 rounded-md py-0.5 px-1.5 ",onClick:t,children:[_("span",{className:"sr-only",children:M(I.CLOSE)}),_(Et,{tag:"xmark",size:"lg"})]})]}),V("div",{className:"h-full overflow-y-auto",children:[_("ul",{className:"mt-1 flex flex-col items-center justify-center text-sm",children:Object.entries(XA).map(([r,o])=>_("li",{className:"text-foreground/70",children:V("p",{children:[M(r),": ",o]})},r))}),_("div",{className:"mt-6 flex items-center justify-center ",children:_("button",{className:"rounded border border-foreground/10 bg-positive py-1.5 px-2.5 text-sm font-medium tracking-wider text-background ",onClick:t,children:M(I.CLOSE)})})]})]})})]})},ZA=()=>{const e=ne(t=>t.backButtonHref);return e?V("a",{href:e,children:[_("span",{className:"sr-only",children:M(I.NAVIGATE_BACK)}),_(Et,{tag:"arrow-left",className:"text-negative",size:"lg"})]}):null},JA=["action","forwardTo","recording","input","decision"],eb=()=>{const e=Rr(a=>a.showAllNodes),t=Rr(a=>a.showDevOptions),n=ne(a=>a.addNode),r=ne(a=>a.flowTitle),o=ne(a=>a.exportStoreData),i=N.useRef(null),s=a=>{a.preventDefault(),i.current&&i.current.showModal()},l=(a,u)=>{a.preventDefault(),n(u)};return V(be,{children:[V("section",{className:"hidden h-full w-1/6 min-w-[160px] shrink-0 flex-col bg-background py-4 text-foreground sm:flex",children:[V("nav",{className:"mx-4 flex shrink-0 items-center justify-between",children:[_(ZA,{}),t&&_("button",{className:"rounded bg-positive p-1 px-2 text-xs text-white",onClick:s,children:"Dev Options"})]}),_("h1",{className:"m-4 block shrink-0 text-lg font-semibold leading-tight line-clamp-2",children:r}),_("ul",{className:"overflow-y-auto",id:"sidebar-node-list",children:JA.map(a=>_("li",{children:_(tb,{group:a,handleOnClick:l,showAllNodes:e})},a))}),_(qA,{})]}),t&&_("dialog",{className:"z-50 my-10 rounded-lg border border-foreground/10 bg-background text-foreground",ref:i,children:_("form",{children:V("fieldset",{children:[V("legend",{className:"flex w-full justify-between pb-2",children:[_("h1",{className:"text-2xl leading-10",children:"Dev Options"}),V("button",{className:"p-1 pt-0 font-semibold",formMethod:"dialog",children:[_("span",{className:"sr-only",children:"Close"}),_(Et,{tag:"xmark",size:"lg"})]})]}),V("div",{className:"mb-1 rounded-sm border border-gray-200 p-2",children:[_("h3",{className:"w-full",children:"Flow Data"}),_("div",{className:"flex flex-row gap-x-2 py-2",children:_("div",{className:"flex items-center",children:_("button",{type:"button",className:"rounded border bg-background px-2 py-1 text-sm hover:scale-105 hover:bg-background/80 active:scale-95",onClick:o,children:"View JSON File"})})})]}),_(jA,{})]})})})]})},tb=({group:e,handleOnClick:t,showAllNodes:n})=>{const r=WA(e,n),o=`ngm-heading-${Kx(r.label)}`;return V(be,{children:[_("h2",{className:"px-4 pb-2 text-sm uppercase text-foreground/50",id:o,children:r.label}),_("ul",{"aria-labelledby":o,className:"flex-1 px-4 pb-2",children:r.nodes.map(i=>_("li",{children:_("button",{className:"mb-2 block w-full rounded-lg border border-foreground/10 p-3 text-center text-sm line-clamp-1 hover:shadow-md",onClick:s=>t(s,i.type),children:i.title})},i.type))})]})},nb=()=>{const e=N.useRef(null),[t,n]=N.useState(),[r,o]=N.useState(null);return N.useLayoutEffect(()=>(e.current=new ResizeObserver(([i])=>n(i)),r&&e.current.observe(r),()=>{var i;return(i=e.current)==null?void 0:i.disconnect()}),[r]),{setTarget:o,observerEntry:t}},rb=e=>{ne.setState({flowInteractive:e})},ob=({rootAppHeight:e,rootAppWidth:t})=>{ne.setState({rootAppHeight:e,rootAppWidth:t})},ib=()=>{const{observerEntry:e,setTarget:t}=nb(),n=ne(o=>o.initializing),r=ne(o=>o.rootAppWidth);return N.useEffect(()=>{!n&&r&&rb(r>=qv)},[n,r]),N.useEffect(()=>{e&&(Ct().log("resized",{rootAppHeight:e.contentRect.height,rootAppWidth:e.contentRect.width}),ob({rootAppHeight:e.contentRect.height,rootAppWidth:e.contentRect.width}))},[e]),{rootTarget:t}},F2="";function sb(){Ct().warn("Hello World!");const{rootTarget:e}=ib(),t=ne(n=>n.colorMode)??"";return _(be,{children:V("div",{className:`${t} flex h-full w-full bg-backgroundAlt text-foreground`,ref:e,children:[_(eb,{}),V(WI,{children:[_(dA,{}),_(FA,{})]})]})})}const lb=`@font-face{font-family:SWInter;font-style:normal;font-weight:400;font-display:swap;src:url(//cdn.signalwire.com/fonts/inter/Inter-Regular.woff2) format("woff2"),url(//cdn.signalwire.com/fonts/inter/Inter-Regular.woff) format("woff")}
69
69
  `,ab=e=>{if(!e||!e.getFlowURL||!e.updateFlowURL)throw new TypeError("Invalid or missing required params")};function ub(e){ab(e);const{backButtonHref:t,rootElementId:n="sw-cfb-root",styleHref:r="https://cdn.swire.io/npm/@signalwire/cfb@dev/dist/style.css",getFlowURL:o,updateFlowURL:i}=e;ne.setState({rootElementId:n,backButtonHref:t,getFlowURL:o,updateFlowURL:i}),qT(),HA();const s=document.getElementById(n);if(!s)throw new Error(`Id: '${n}' not found in the DOM`);s.attachShadow({mode:"open"}),s.shadowRoot&&Na.createRoot(s.shadowRoot).render(V(N.StrictMode,{children:[_("link",{type:"text/css",rel:"stylesheet",href:r}),_(sb,{})]}));const l=document.createElement("style");document.head.appendChild(l),l.appendChild(document.createTextNode(lb))}Lr.main=ub,Object.defineProperty(Lr,Symbol.toStringTag,{value:"Module"})});