@dialstack/sdk-react 3.1.0 → 3.3.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/ai-agent.cjs +1 -1
- package/dist/ai-agent.cjs.map +1 -1
- package/dist/ai-agent.d.cts +9 -0
- package/dist/ai-agent.d.ts +9 -0
- package/dist/ai-agent.mjs +1 -1
- package/dist/ai-agent.mjs.map +1 -1
- package/dist/call-history.cjs +1 -1
- package/dist/call-history.cjs.map +1 -1
- package/dist/call-history.mjs +1 -1
- package/dist/call-history.mjs.map +1 -1
- package/dist/call-logs.cjs +1 -1
- package/dist/call-logs.cjs.map +1 -1
- package/dist/call-logs.mjs +1 -1
- package/dist/call-logs.mjs.map +1 -1
- package/dist/dial-plan.cjs +1 -1
- package/dist/dial-plan.cjs.map +1 -1
- package/dist/dial-plan.mjs +1 -1
- package/dist/dial-plan.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/onboarding.cjs +1 -1
- package/dist/onboarding.cjs.map +1 -1
- package/dist/onboarding.mjs +1 -1
- package/dist/onboarding.mjs.map +1 -1
- package/dist/phone-number-ordering.cjs +1 -1
- package/dist/phone-number-ordering.cjs.map +1 -1
- package/dist/phone-number-ordering.mjs +1 -1
- package/dist/phone-number-ordering.mjs.map +1 -1
- package/dist/phone-numbers.cjs +1 -1
- package/dist/phone-numbers.cjs.map +1 -1
- package/dist/phone-numbers.mjs +1 -1
- package/dist/phone-numbers.mjs.map +1 -1
- package/dist/softphone.cjs +1 -1
- package/dist/softphone.cjs.map +1 -1
- package/dist/softphone.d.cts +42 -7
- package/dist/softphone.d.ts +42 -7
- package/dist/softphone.mjs +1 -1
- package/dist/softphone.mjs.map +1 -1
- package/dist/voicemails.cjs +1 -1
- package/dist/voicemails.cjs.map +1 -1
- package/dist/voicemails.mjs +1 -1
- package/dist/voicemails.mjs.map +1 -1
- package/package.json +4 -4
package/dist/dial-plan.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e,{useState as n,useEffect as o,memo as a,useRef as t,useMemo as l,useCallback as r,useId as i,useImperativeHandle as d}from"react";import{Handle as s,Position as c,getStraightPath as p,getSmoothStepPath as u,BaseEdge as f,ReactFlowProvider as g,useReactFlow as b,useUpdateNodeInternals as m,useNodesState as v,useEdgesState as _,applyNodeChanges as h,MarkerType as x,ReactFlow as y,ConnectionLineType as w,Background as k,Controls as E}from"@xyflow/react";import{useDialstackComponents as N}from"@dialstack/sdk-react";import C from"dagre";import{Command as L}from"cmdk";import{parsePhoneNumberFromString as z,AsYouType as O}from"libphonenumber-js";import{createPortal as S}from"react-dom";function R(e,n,o,a){return new(o||(o=Promise))(function(t,l){function r(e){try{d(a.next(e))}catch(e){l(e)}}function i(e){try{d(a.throw(e))}catch(e){l(e)}}function d(e){var n;e.done?t(e.value):(n=e.value,n instanceof o?n:new o(function(e){e(n)})).then(r,i)}d((a=a.apply(e,n||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const T="smoothstep";const j=({icon:n,label:o,timeout:a,subtitle:t})=>e.createElement("div",{className:"ds-dial-plan-node__header"},e.createElement("div",{className:"ds-dial-plan-node__icon"},n),e.createElement("span",{className:"ds-dial-plan-node__type-label"},o,void 0!==a&&e.createElement("span",{style:{textTransform:"none"}}," (",a,"s)")),t&&e.createElement("span",{className:"ds-dial-plan-node__name"},t)),A=({id:n,label:o})=>e.createElement("div",{className:"ds-dial-plan-node__exit-row"},e.createElement("span",{className:"ds-dial-plan-node__exit-label"},o),e.createElement(s,{type:"source",position:c.Right,id:n,className:"ds-dial-plan-handle ds-dial-plan-handle--next"})),I=({exits:n,locale:o})=>0===n.length?null:e.createElement(e.Fragment,null,n.map(n=>e.createElement(A,{key:n.id,id:n.id,label:n.localeExitKey&&(null==o?void 0:o.exits[n.localeExitKey])||n.label})));const F=({resourceId:n,onOpenResource:o,label:a})=>e.createElement("button",{type:"button",className:"ds-dial-plan-config-field__open-link",onClick:()=>o(n)},e.createElement("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),e.createElement("polyline",{points:"15 3 21 3 21 9"}),e.createElement("line",{x1:"10",y1:"14",x2:"21",y2:"3"})),a),D=({groups:a,value:r,loading:i=!1,placeholder:d="Search…",onSelect:s,onCreateResource:c,selectLabel:p="— Select —",noResultsLabel:u="No results found",loadingLabel:f="Loading…",createNewPrefix:g="+ Create new…",extensionLabel:b="Ext."})=>{const[m,v]=n(!1),[_,h]=n(""),x=t(null);o(()=>{var e;if(!m)return;const n=null===(e=x.current)||void 0===e?void 0:e.getRootNode(),o=n instanceof ShadowRoot||n instanceof Document?n:document,a=e=>function(e){"Escape"===e.key&&(v(!1),h(""))}(e),t=e=>function(e){x.current&&!x.current.contains(e.target)&&(v(!1),h(""))}(e);return o.addEventListener("keydown",a),o.addEventListener("mousedown",t),()=>{o.removeEventListener("keydown",a),o.removeEventListener("mousedown",t)}},[m]);const y=l(()=>{if(!r)return"";for(const e of a){const n=e.items.find(e=>e.id===r);if(n)return n.extension_number?`${n.name} (${b} ${n.extension_number})`:n.name}return""},[r,a,b]);if(!m)return e.createElement("button",{type:"button",className:"ds-resource-combobox__trigger",onClick:()=>v(!0)},e.createElement("span",{className:y?"":"ds-resource-combobox__trigger-placeholder"},y||p),e.createElement("svg",{className:"ds-resource-combobox__trigger-chevron",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("polyline",{points:"6 9 12 15 18 9"})));const w=a.some(e=>e.items.length>0);return e.createElement("div",{ref:x},e.createElement(L,{className:"ds-resource-combobox",shouldFilter:!0,loop:!0},e.createElement(L.Input,{className:"ds-resource-combobox__input",placeholder:d,value:_,onValueChange:h,autoFocus:!0}),e.createElement(L.List,{className:"ds-resource-combobox__list"},e.createElement(L.Empty,{className:"ds-resource-combobox__empty"},u),a.map(n=>e.createElement(L.Group,{key:n.label,heading:n.label,className:"ds-resource-combobox__group"},n.items.map(o=>{var a;return e.createElement(L.Item,{key:o.id,value:`${o.name} ${null!==(a=o.extension_number)&&void 0!==a?a:""} ${n.label} ${o.id}`,className:"ds-resource-combobox__item"+(o.id===r?" ds-resource-combobox__item--selected":""),onSelect:()=>{return e=o.id,n=o.extension_number?`${o.name} (${b} ${o.extension_number})`:o.name,s(e,n),v(!1),void h("");var e,n}},e.createElement("span",{className:"ds-resource-combobox__name"},o.name),o.extension_number&&e.createElement("span",{className:"ds-resource-combobox__ext"},"(",b," ",o.extension_number,")"),e.createElement("span",{className:"ds-resource-combobox__check"},o.id===r?"✓":""))}),c&&n.type&&e.createElement(L.Item,{forceMount:!0,value:`create new ${n.label}`,className:"ds-resource-combobox__create",onSelect:()=>function(e){return R(this,void 0,void 0,function*(){if(!c)return;const n=yield c(e);n&&(s(n.id,n.extension_number?`${n.name} (${b} ${n.extension_number})`:n.name),v(!1),h(""))})}(n.type)},g))),!w&&!_&&i&&e.createElement("div",{className:"ds-resource-combobox__empty"},f))))},P=({label:n,htmlFor:o,action:a,children:t})=>e.createElement("div",{className:"ds-dial-plan-config-field"},a?e.createElement("div",{className:"ds-dial-plan-config-field__header"},e.createElement("label",{className:"ds-dial-plan-config-field__label",htmlFor:o},n),a):e.createElement("label",{className:"ds-dial-plan-config-field__label",htmlFor:o},n),t);function $(e,a,t,i){const[d,s]=n([]),[c,p]=n(!0),u=l(()=>JSON.stringify(e),[e]),f=r(()=>Promise.all(e.map(e=>a(e.type,e.options))).then(n=>{s(e.map((e,o)=>{var a,t;return{label:null!==(a=null==i?void 0:i.resourceGroups[e.labelKey])&&void 0!==a?a:e.fallback,type:e.type,items:null!==(t=n[o])&&void 0!==t?t:[]}}))}).catch(()=>{}).finally(()=>p(!1)),[a,i,u]);o(()=>{f()},[f]);const g=r(n=>R(this,void 0,void 0,function*(){var o;if(!t)return;const a=null===(o=e.find(e=>e.type===n))||void 0===o?void 0:o.options,l=yield t(n,a);return l&&(yield f()),l}),[t,f,u]);return{groups:d,loading:c,handleCreateResource:t?g:void 0}}const M=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("circle",{cx:"12",cy:"12",r:"10"}),e.createElement("polyline",{points:"12 6 12 12 16 14"})),H=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"})),K=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),e.createElement("circle",{cx:"9",cy:"7",r:"4"}),e.createElement("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87"}),e.createElement("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})),B=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("polyline",{points:"23 7 23 1 17 1"}),e.createElement("line",{x1:"16",y1:"8",x2:"23",y2:"1"}),e.createElement("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"})),V=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("circle",{cx:"5.5",cy:"11.5",r:"4.5"}),e.createElement("circle",{cx:"18.5",cy:"11.5",r:"4.5"}),e.createElement("line",{x1:"5.5",y1:"16",x2:"18.5",y2:"16"})),W=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M12 8V4H8"}),e.createElement("rect",{width:"16",height:"12",x:"4",y:"8",rx:"2"}),e.createElement("path",{d:"M2 14h2"}),e.createElement("path",{d:"M20 14h2"}),e.createElement("path",{d:"M15 13v2"}),e.createElement("path",{d:"M9 13v2"})),U=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("rect",{x:"3",y:"3",width:"7",height:"7"}),e.createElement("rect",{x:"14",y:"3",width:"7",height:"7"}),e.createElement("rect",{x:"3",y:"14",width:"7",height:"7"}),e.createElement("rect",{x:"14",y:"14",width:"7",height:"7"})),q=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-3.33-2.67m-2.67-3.34a19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91"}),e.createElement("line",{x1:"23",y1:"1",x2:"1",y2:"23"})),G=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),e.createElement("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07"}),e.createElement("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14"})),Y={type:"schedule",flowType:"schedule",localeKey:"schedule",label:"Schedule",description:"Route calls by schedule",color:"#0ea5e9",exits:[{id:"open",label:"Open",configKey:"open",localeExitKey:"open"},{id:"closed",label:"Closed",configKey:"closed",localeExitKey:"closed"},{id:"holiday",label:"Holiday",configKey:"holiday",localeExitKey:"holiday"}],configPanel:({config:n,onConfigChange:o,listResources:a,onCreateResource:t,onOpenResource:l,locale:r})=>{var i,d,s,c,p,u;const{groups:f,loading:g,handleCreateResource:b}=$([{type:"schedule",labelKey:"schedules",fallback:"Schedules"}],a,t,r),m=null!==(i=n.schedule_id)&&void 0!==i?i:"",v=void 0!==n.holiday;return e.createElement(e.Fragment,null,e.createElement(P,{label:null!==(d=null==r?void 0:r.configLabels.schedule)&&void 0!==d?d:"Schedule"},e.createElement(D,{groups:f,value:m,loading:g,placeholder:null!==(s=null==r?void 0:r.configLabels.searchSchedules)&&void 0!==s?s:"Search schedules…",onSelect:(e,n)=>o({schedule_id:e},{scheduleName:n}),onCreateResource:b,selectLabel:null==r?void 0:r.combobox.select,noResultsLabel:null==r?void 0:r.combobox.noResults,loadingLabel:null==r?void 0:r.combobox.loading,createNewPrefix:null==r?void 0:r.combobox.createNew,extensionLabel:null==r?void 0:r.combobox.extensionLabel}),m&&l&&e.createElement(F,{resourceId:m,onOpenResource:l,label:null!==(c=null==r?void 0:r.configLabels.openInNewTab)&&void 0!==c?c:"Open target details"})),e.createElement("div",{className:"ds-dial-plan-config-field"},e.createElement("label",{className:"ds-dial-plan-config-field__checkbox"},e.createElement("input",{type:"checkbox",checked:v,onChange:e=>{return n=e.target.checked,o({holiday:n?null:void 0},{holidayEnabled:n});var n}}),e.createElement("span",null,null!==(p=null==r?void 0:r.configLabels.routeHolidaySeparately)&&void 0!==p?p:"Route holidays separately")),e.createElement("p",{className:"ds-dial-plan-config-field__hint"},null!==(u=null==r?void 0:r.configLabels.routeHolidaySeparatelyHint)&&void 0!==u?u:"When on, holidays route to a dedicated branch you wire below. Otherwise holidays follow the Closed exit.")))},defaultConfig:{schedule_id:""},icon:M,renderNode:(n,o)=>{const a=n.locale,t=o.exits.slice(0,n.holidayEnabled?3:2);return e.createElement(e.Fragment,null,e.createElement(j,{icon:o.icon,label:n.label,subtitle:n.scheduleName}),e.createElement("div",{className:"ds-dial-plan-node__exits"},e.createElement(I,{exits:t,locale:a})))},toFlowNode:e=>{const n=e;return{label:"Schedule",scheduleId:n.config.schedule_id,holidayEnabled:void 0!==n.config.holiday,originalNode:n}},collectResourceIds:(e,n)=>{e.schedule_id&&n.addSchedule(e.schedule_id)},enrichNode:(e,n,o)=>{const a=n.schedules.get(e.scheduleId);return Object.assign(Object.assign({},e),{scheduleName:null==a?void 0:a.name,locale:o})},onConfigChange:(e,n,o)=>{"holiday"in n&&void 0===n.holiday&&(o.setEdges(n=>{const a=n.filter(n=>!(n.source===e&&"holiday"===n.sourceHandle));return a.length!==n.length&&o.updateDirty(o.nodesRef.current,a),a}),requestAnimationFrame(()=>o.updateNodeInternals(e)))},serializeConfig:(e,n,o)=>{var a;return(null===(a=e.data)||void 0===a?void 0:a.holidayEnabled)&&void 0===o.holiday?Object.assign(Object.assign({},o),{holiday:null}):o}},X=({value:n,min:o,max:a,onChange:t,locale:l})=>{var r;return e.createElement(P,{label:null!==(r=null==l?void 0:l.configLabels.timeout)&&void 0!==r?r:"Timeout (seconds)"},e.createElement("input",{className:"ds-dial-plan-config-field__input",type:"number",min:o,max:a,value:n,onChange:e=>t(Math.min(a,Math.max(o,Number(e.target.value)||o)))}))},Z={type:"ring_all_users",flowType:"ringAllUsers",localeKey:"ringAllUsers",label:"Ring All",description:"Ring all account users",color:"#f59e0b",exits:[{id:"next",label:"Timeout",configKey:"next",localeExitKey:"timeout"}],configPanel:({config:n,onConfigChange:o,locale:a})=>{var t;const l=null!==(t=n.timeout)&&void 0!==t?t:24;return e.createElement(X,{value:l,min:1,max:300,onChange:e=>o({timeout:e}),locale:a})},defaultConfig:{timeout:24},icon:K,renderNode:(n,o)=>e.createElement(e.Fragment,null,e.createElement(j,{icon:o.icon,label:n.label,timeout:n.timeout}),o.exits.length>0&&e.createElement("div",{className:"ds-dial-plan-node__exits"},e.createElement(I,{exits:o.exits,locale:n.locale}))),toFlowNode:e=>{const n=e;return{label:"Ring All",timeout:n.config.timeout,originalNode:n}}};function Q(e,n){return e.startsWith("user_")?n.targetTypes.user:e.startsWith("rg_")?n.targetTypes.ringGroup:e.startsWith("dp_")?n.targetTypes.dialPlan:e.startsWith("qu_")?n.targetTypes.queue:e.startsWith("va_")?n.targetTypes.voiceApp:e.startsWith("svm_")?n.targetTypes.sharedVoicemail:n.nodeTypes.internalDial}function J(e,n,o){const a=n.users.get(e),t=(null==a?void 0:a.name)||(null==a?void 0:a.email);return t&&(null==a?void 0:a.extension_number)?`${t} (${o.combobox.extensionLabel} ${a.extension_number})`:t}const ee={type:"internal_dial",flowType:"internalDial",localeKey:"internalDial",label:"Internal Extension",description:"Ring a user, group, or plan",color:"#22c55e",exits:[{id:"next",label:"Timeout",configKey:"next",localeExitKey:"timeout"}],configPanel:({config:n,onConfigChange:o,listResources:a,onCreateResource:t,onOpenResource:l,locale:r})=>{var i,d,s,c,p;const{groups:u,loading:f,handleCreateResource:g}=$([{type:"user",labelKey:"users",fallback:"Users"},{type:"ring_group",labelKey:"ringGroups",fallback:"Ring Groups"},{type:"queue",labelKey:"queues",fallback:"Queues"},{type:"dial_plan",labelKey:"dialPlans",fallback:"Dial Plans"}],a,t,r),b=null!==(i=n.target_id)&&void 0!==i?i:"",m=null!==(d=n.timeout)&&void 0!==d?d:30;return e.createElement(e.Fragment,null,e.createElement(X,{value:m,min:0,max:300,onChange:e=>o({timeout:e}),locale:r}),e.createElement(P,{label:null!==(s=null==r?void 0:r.configLabels.target)&&void 0!==s?s:"Target"},e.createElement(D,{groups:u,value:b,loading:f,placeholder:null!==(c=null==r?void 0:r.configLabels.searchTargets)&&void 0!==c?c:"Search targets…",onSelect:(e,n)=>o({target_id:e},{targetName:n}),onCreateResource:g,selectLabel:null==r?void 0:r.combobox.select,noResultsLabel:null==r?void 0:r.combobox.noResults,loadingLabel:null==r?void 0:r.combobox.loading,createNewPrefix:null==r?void 0:r.combobox.createNew,extensionLabel:null==r?void 0:r.combobox.extensionLabel}),b&&l&&e.createElement(F,{resourceId:b,onOpenResource:l,label:null!==(p=null==r?void 0:r.configLabels.openInNewTab)&&void 0!==p?p:"Open target details"})))},defaultConfig:{target_id:"",timeout:30},icon:H,renderNode:(n,o)=>e.createElement(e.Fragment,null,e.createElement(j,{icon:o.icon,label:n.label,timeout:n.timeout,subtitle:n.targetName}),e.createElement("div",{className:"ds-dial-plan-node__exits"},e.createElement(I,{exits:o.exits,locale:n.locale}))),toFlowNode:e=>{const n=e;return{label:"Internal Extension",targetId:n.config.target_id,timeout:n.config.timeout,originalNode:n}},collectResourceIds:(e,n)=>{e.target_id&&n.addTarget(e.target_id)},enrichNode:(e,n,o)=>{const a=e.targetId,t=J(a,n,o),l=Q(a,o);return Object.assign(Object.assign({},e),{targetName:t,targetType:l,locale:o})}};function ne(e){if(!e)return"";const n=z(e);if(!n)return e;return"US"===n.country||"1"===n.countryCallingCode?n.formatNational():n.formatInternational()}const oe=e=>e.startsWith("+")?"+"+e.slice(1).replace(/\D/g,""):e.replace(/\D/g,""),ae={type:"external_dial",flowType:"externalDial",localeKey:"externalDial",label:"External Number",description:"Ring an external phone number",color:"#f43f5e",exits:[{id:"next",label:"Timeout",configKey:"next",localeExitKey:"timeout"}],configPanel:({nodeId:a,config:t,onConfigChange:l,onInvalidDraftChange:d,locale:s})=>{var c,p,u,f,g;const b=null!==(c=t.phone_number)&&void 0!==c?c:"",m=null!==(p=t.timeout)&&void 0!==p?p:60,[v,_]=n(ne(b)),[h,x]=n(null),y=i(),w=`${y}-phone`,k=`${y}-error`,[E,N]=n({nodeId:a,e164:b});E.nodeId===a&&E.e164===b||(N({nodeId:a,e164:b}),_(ne(b)),x(null)),o(()=>(null==d||d(null!==h),()=>null==d?void 0:d(!1)),[h,d]);const C=null!==(u=null==s?void 0:s.configLabels.phoneNumberInvalid)&&void 0!==u?u:"Enter a valid phone number, for example (415) 555-1234.",L=r(e=>{const n=oe(e.target.value);_(n?new O("US").input(n):""),x(null);const o=(e=>{const n=e?z(e,"US"):null;return(null==n?void 0:n.isValid())?n.number:null})(n);o?l({phone_number:o}):n||l({phone_number:""})},[l]),S=r(()=>{const e=oe(v);if(!e)return x(null),void l({phone_number:""});const n=z(e,"US");if(null==n?void 0:n.isValid()){const e="US"===n.country||"1"===n.countryCallingCode;return _(e?n.formatNational():n.formatInternational()),x(null),void l({phone_number:n.number})}x(C)},[v,C,l]),R=r(()=>{_(""),x(null),l({phone_number:""})},[l]);return e.createElement(e.Fragment,null,e.createElement(X,{value:m,min:1,max:120,onChange:e=>l({timeout:e}),locale:s}),e.createElement(P,{label:null!==(f=null==s?void 0:s.configLabels.phoneNumber)&&void 0!==f?f:"Phone Number",htmlFor:w},e.createElement("div",{className:"ds-dial-plan-config-field__input-wrapper"},e.createElement("input",{id:w,className:"ds-dial-plan-config-field__input",type:"tel",placeholder:"+1 415 555 1234",value:v,onChange:L,onBlur:S,"aria-invalid":!!h||void 0,"aria-describedby":h?k:void 0}),v&&e.createElement("button",{type:"button",className:"ds-dial-plan-config-field__clear",onClick:R,"aria-label":null!==(g=null==s?void 0:s.configLabels.clearPhoneNumber)&&void 0!==g?g:"Clear phone number"},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none"},e.createElement("path",{d:"M10.5 3.5L3.5 10.5M3.5 3.5l7 7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})))),h&&e.createElement("p",{className:"ds-dial-plan-config-field__error",id:k,role:"alert"},h)))},defaultConfig:{phone_number:"",timeout:60},icon:B,renderNode:(n,o)=>e.createElement(e.Fragment,null,e.createElement(j,{icon:o.icon,label:n.label,timeout:n.timeout,subtitle:n.phoneNumber}),e.createElement("div",{className:"ds-dial-plan-node__exits"},e.createElement(I,{exits:o.exits,locale:n.locale}))),toFlowNode:e=>{const n=e;return{label:"External Number",phoneNumber:ne(n.config.phone_number),timeout:n.config.timeout,originalNode:n}}};function te({label:n,value:o,options:a,onChange:t,hint:l}){return e.createElement(P,{label:n},e.createElement("div",{className:"ds-dial-plan-config-field__segmented",role:"radiogroup","aria-label":n},a.map(n=>{const a=n.value===o;return e.createElement("button",{key:n.value,type:"button",role:"radio","aria-checked":a,className:"ds-dial-plan-config-field__segmented-option"+(a?" ds-dial-plan-config-field__segmented-option--active":""),onClick:()=>{a||t(n.value)}},n.label)})),l&&e.createElement("p",{className:"ds-dial-plan-config-field__hint"},l))}const le={type:"voice_app",flowType:"voiceApp",localeKey:"voiceApp",label:"Voice App",description:"Route to a voice application",color:"#6366f1",exits:[{id:"next",label:"Timeout",configKey:"next",localeExitKey:"timeout"}],configPanel:({config:n,onConfigChange:a,listResources:t,onCreateResource:l,onOpenResource:r,locale:i})=>{var d,s,c,p,u,f,g,b,m,v;const _=null!==(d=n.voice_app_id)&&void 0!==d?d:"",h=null!==(s=n.mode)&&void 0!==s?s:"control",{groups:x,handleCreateResource:y}=$([{type:"voice_app",labelKey:"voiceApps",fallback:"Voice Apps",options:{notifyEligible:"notify"===h}}],t,l,i);return o(()=>{var e,n;if("notify"!==h||!_)return;const o=null!==(n=null===(e=x[0])||void 0===e?void 0:e.items)&&void 0!==n?n:[];if(0===o.length)return;o.some(e=>e.id===_)||a({voice_app_id:""},{voiceAppName:void 0})},[h,_,x,a]),e.createElement(e.Fragment,null,e.createElement(P,{label:null!==(c=null==i?void 0:i.configLabels.target)&&void 0!==c?c:"Target"},e.createElement(D,{groups:x,value:_,placeholder:null!==(p=null==i?void 0:i.configLabels.searchTargets)&&void 0!==p?p:"Search targets…",onSelect:(e,n)=>a({voice_app_id:e},{voiceAppName:n}),onCreateResource:y,selectLabel:null==i?void 0:i.combobox.select,noResultsLabel:null==i?void 0:i.combobox.noResults,loadingLabel:null==i?void 0:i.combobox.loading,createNewPrefix:null==i?void 0:i.combobox.createNew,extensionLabel:null==i?void 0:i.combobox.extensionLabel}),_&&r&&e.createElement(F,{resourceId:_,onOpenResource:r,label:null!==(u=null==i?void 0:i.configLabels.openInNewTab)&&void 0!==u?u:"Open target details"})),e.createElement(te,{label:null!==(f=null==i?void 0:i.configLabels.mode)&&void 0!==f?f:"Mode",value:h,options:[{value:"control",label:null!==(g=null==i?void 0:i.voiceAppMode.control)&&void 0!==g?g:"Control"},{value:"notify",label:null!==(b=null==i?void 0:i.voiceAppMode.notify)&&void 0!==b?b:"Notify"}],onChange:e=>a({mode:e}),hint:"notify"===h?null!==(m=null==i?void 0:i.voiceAppMode.notifyHint)&&void 0!==m?m:"Notifies the voice app of the call in the background. The dial plan keeps routing via Next without waiting.":null!==(v=null==i?void 0:i.voiceAppMode.controlHint)&&void 0!==v?v:"Hands the call off to the voice app, which takes over the conversation."}))},defaultConfig:{voice_app_id:"",mode:"control"},icon:W,renderNode:(n,o)=>{var a,t,l,r;const i=n.locale,d="notify"===n.mode,s=d?null!==(a=null==i?void 0:i.voiceAppMode.notifyBadge)&&void 0!==a?a:"Notify mode":null!==(t=null==i?void 0:i.voiceAppMode.controlBadge)&&void 0!==t?t:"Control mode",c=d?null!==(l=null==i?void 0:i.exits.next)&&void 0!==l?l:"Next":null!==(r=null==i?void 0:i.exits.timeout)&&void 0!==r?r:"Timeout";return e.createElement(e.Fragment,null,e.createElement(j,{icon:o.icon,label:n.label,subtitle:n.voiceAppName}),e.createElement("span",{className:"ds-dial-plan-node__badge"},s),e.createElement("div",{className:"ds-dial-plan-node__exits"},e.createElement(A,{id:"next",label:c})))},toFlowNode:e=>{var n;const o=e;return{label:"Voice App",voiceAppId:o.config.voice_app_id,mode:null!==(n=o.config.mode)&&void 0!==n?n:"control",originalNode:o}},normalizeFromAlias:e=>{var n;const o=e.config,a=null!==(n=o.target_id)&&void 0!==n?n:"",t=o.next;return Object.assign(Object.assign({},e),{type:"voice_app",config:Object.assign({voice_app_id:a,mode:"control"},void 0!==t?{next:t}:{})})},collectResourceIds:(e,n)=>{e.voice_app_id&&n.addTarget(e.voice_app_id)},enrichNode:(e,n,o)=>{const a=e.voiceAppId,t=a?J(a,n,o):void 0;return Object.assign(Object.assign({},e),{voiceAppName:t,locale:o})}},re={type:"voicemail",apiType:"internal_dial",flowType:"voicemail",localeKey:"voicemail",label:"Voicemail",description:"Send to voicemail",color:"#8b5cf6",exits:[],configPanel:({config:n,onConfigChange:o,listResources:a,onCreateResource:t,onOpenResource:l,locale:r})=>{var i,d,s,c;const{groups:p,loading:u,handleCreateResource:f}=$([{type:"user",labelKey:"users",fallback:"Users"},{type:"shared_voicemail",labelKey:"sharedVoicemails",fallback:"Shared Voicemails"}],a,t,r),g=null!==(i=n.target_id)&&void 0!==i?i:"";return e.createElement(P,{label:null!==(d=null==r?void 0:r.configLabels.target)&&void 0!==d?d:"Target"},e.createElement(D,{groups:p,value:g,loading:u,placeholder:null!==(s=null==r?void 0:r.configLabels.searchTargets)&&void 0!==s?s:"Search targets…",onSelect:(e,n)=>o({target_id:e,timeout:0},{targetName:n}),onCreateResource:f,selectLabel:null==r?void 0:r.combobox.select,noResultsLabel:null==r?void 0:r.combobox.noResults,loadingLabel:null==r?void 0:r.combobox.loading,createNewPrefix:null==r?void 0:r.combobox.createNew,extensionLabel:null==r?void 0:r.combobox.extensionLabel}),g&&l&&e.createElement(F,{resourceId:g,onOpenResource:l,label:null!==(c=null==r?void 0:r.configLabels.openInNewTab)&&void 0!==c?c:"Open target details"}))},defaultConfig:{target_id:"",timeout:0},icon:V,renderNode:(n,o)=>e.createElement(j,{icon:o.icon,label:n.label,subtitle:n.targetName}),toFlowNode:e=>{const n=e;return{label:"Voicemail",targetId:n.config.target_id,timeout:0,originalNode:n}},collectResourceIds:(e,n)=>{e.target_id&&n.addTarget(e.target_id)},enrichNode:(e,n,o)=>{const a=e.targetId,t=J(a,n,o),l=Q(a,o);return Object.assign(Object.assign({},e),{targetName:t,targetType:l,locale:o})}},ie=["1","2","3","4","5","6","7","8","9","0","*","#"];function de(e){return"*"===e?"digit_star":"#"===e?"digit_hash":`digit_${e}`}const se=[{id:"timeout",label:"Timeout",configKey:"timeout_next_node",localeExitKey:"timeout"},{id:"invalid",label:"Invalid",configKey:"invalid_next_node",localeExitKey:"invalid"}],ce={type:"menu",flowType:"menu",localeKey:"menu",label:"IVR Menu",description:"Play prompt and route by keypress",color:"#ec4899",exits:[...se],allowSelfLoop:!0,configPanel:({config:n,onConfigChange:o,listResources:a,onCreateResource:t,locale:l})=>{var r,i,d,s,c,p,u;const{groups:f,loading:g,handleCreateResource:b}=$([{type:"audio_clip",labelKey:"audioClips",fallback:"Audio Clips"}],a,t,l),m=null!==(r=n.prompt_clip_id)&&void 0!==r?r:"",v=null!==(i=n.timeout)&&void 0!==i?i:5,_=null!==(d=n.options)&&void 0!==d?d:[{digit:"1"}],h=new Set(_.map(e=>e.digit));return e.createElement(e.Fragment,null,e.createElement(P,{label:null!==(s=null==l?void 0:l.configLabels.promptClip)&&void 0!==s?s:"Prompt"},e.createElement(D,{groups:f,value:m,loading:g,placeholder:null!==(c=null==l?void 0:l.configLabels.search)&&void 0!==c?c:"Search...",onSelect:(e,n)=>o({prompt_clip_id:e},{promptClipName:n}),onCreateResource:b,selectLabel:null==l?void 0:l.combobox.select,noResultsLabel:null==l?void 0:l.combobox.noResults,loadingLabel:null==l?void 0:l.combobox.loading,createNewPrefix:null==l?void 0:l.combobox.createNew})),e.createElement(X,{value:v,min:1,max:30,onChange:e=>o({timeout:e}),locale:l}),e.createElement(P,{label:null!==(p=null==l?void 0:l.configLabels.options)&&void 0!==p?p:"Options",action:e.createElement("button",{type:"button",className:"ds-dial-plan-menu-options__add",onClick:function(){const e=ie.find(e=>!h.has(e));e&&o({options:[..._,{digit:e}]})},disabled:_.length>=12},"+ ",null!==(u=null==l?void 0:l.configLabels.addOption)&&void 0!==u?u:"Add")},e.createElement("div",{className:"ds-dial-plan-menu-options"},_.map((n,a)=>{var t,r,i,d,s,c;return e.createElement("div",{key:a,className:"ds-dial-plan-menu-options__card"},e.createElement("div",{className:"ds-dial-plan-menu-options__field ds-dial-plan-menu-options__field--label"},e.createElement("span",{className:"ds-dial-plan-menu-options__field-label"},null!==(t=null==l?void 0:l.configLabels.optionLabel)&&void 0!==t?t:"Label"," ",e.createElement("span",{className:"ds-dial-plan-menu-options__field-hint"},"(optional)")),e.createElement("input",{type:"text",className:"ds-dial-plan-config-field__input",value:null!==(r=n.label)&&void 0!==r?r:"",maxLength:20,placeholder:null!==(i=null==l?void 0:l.configLabels.optionLabelPlaceholder)&&void 0!==i?i:"e.g. Sales",onChange:e=>{return n=a,t=e.target.value,void o({options:_.map((e,o)=>{if(o!==n)return e;const a=Object.assign({},e);return t?a.label=t:delete a.label,a})});var n,t}})),e.createElement("div",{className:"ds-dial-plan-menu-options__field ds-dial-plan-menu-options__field--digit"},e.createElement("span",{className:"ds-dial-plan-menu-options__field-label"},null!==(d=null==l?void 0:l.configLabels.digit)&&void 0!==d?d:"Digit"),e.createElement("select",{className:"ds-dial-plan-config-field__input",value:n.digit,onChange:e=>{return n=a,t=e.target.value,void o({options:_.map((e,o)=>o===n?Object.assign(Object.assign({},e),{digit:t}):e)});var n,t}},ie.filter(e=>e===n.digit||!h.has(e)).map(n=>e.createElement("option",{key:n,value:n},"*"===n?"✱":n)))),e.createElement("button",{type:"button",className:"ds-dial-plan-menu-options__remove",onClick:()=>{return e=a,void o({options:_.filter((n,o)=>o!==e)});var e},title:null!==(s=null==l?void 0:l.configLabels.removeOption)&&void 0!==s?s:"Remove","aria-label":null!==(c=null==l?void 0:l.configLabels.removeOption)&&void 0!==c?c:"Remove"},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))))}))))},defaultConfig:{prompt_clip_id:"",timeout:5,options:[{digit:"1"}]},icon:U,renderNode:(n,o)=>{var a;const t=null!==(a=n.options)&&void 0!==a?a:[],l=n.locale;return e.createElement(e.Fragment,null,e.createElement(j,{icon:o.icon,label:n.label,timeout:n.timeout,subtitle:n.promptClipName}),e.createElement("div",{className:"ds-dial-plan-node__exits"},t.map(n=>{const o="*"===n.digit?"✱":n.digit,a=n.label?`${n.label} — ${o}`:o;return e.createElement(A,{key:n.digit,id:de(n.digit),label:a})}),e.createElement(I,{exits:o.exits,locale:l})))},toFlowNode:e=>{const n=e;return{label:"IVR Menu",promptClipId:n.config.prompt_clip_id,timeout:n.config.timeout,options:n.config.options,originalNode:n}},createEdgesForNode:(e,n)=>{const o=e,a=[];o.config.timeout_next_node&&n.has(o.config.timeout_next_node)&&a.push({id:`${o.id}-timeout->${o.config.timeout_next_node}`,source:o.id,target:o.config.timeout_next_node,sourceHandle:"timeout",type:T}),o.config.invalid_next_node&&n.has(o.config.invalid_next_node)&&a.push({id:`${o.id}-invalid->${o.config.invalid_next_node}`,source:o.id,target:o.config.invalid_next_node,sourceHandle:"invalid",type:T});for(const e of o.config.options)if(e.next_node&&n.has(e.next_node)){const n=de(e.digit);a.push({id:`${o.id}-${n}->${e.next_node}`,source:o.id,target:e.next_node,sourceHandle:n,type:T})}return a},collectResourceIds:(e,n)=>{e.prompt_clip_id&&n.addAudioClip(e.prompt_clip_id)},enrichNode:(e,n,o)=>{const a=n.audioClips.get(e.promptClipId);return Object.assign(Object.assign({},e),{promptClipName:null==a?void 0:a.name,locale:o})},resolveExitLabel:e=>{const n=function(e){if("digit_star"===e)return"*";if("digit_hash"===e)return"#";const n=e.match(/^digit_(\d)$/);return null==n?void 0:n[1]}(e);if(n)return"*"===n?"✱":n},onConfigChange:(e,n,o)=>{var a,t;if(!n.options)return;const l=n.options,r=new Set(l.map(e=>de(e.digit)));for(const e of se)r.add(e.id);const i=o.nodesRef.current.find(n=>n.id===e),d=null!==(t=null===(a=null==i?void 0:i.data)||void 0===a?void 0:a.options)&&void 0!==t?t:[],s=new Map;if(d.length===l.length)for(let e=0;e<l.length;e++){const n=de(d[e].digit),o=de(l[e].digit);n!==o&&s.set(n,o)}o.setEdges(n=>{const a=n.map(n=>{if(n.source!==e||!n.sourceHandle)return n;const o=s.get(n.sourceHandle);return o?Object.assign(Object.assign({},n),{sourceHandle:o,id:`${e}-${o}->${n.target}`}):n}).filter(n=>n.source!==e||!n.sourceHandle||r.has(n.sourceHandle));return(a.length!==n.length||s.size>0)&&o.updateDirty(o.nodesRef.current,a),a}),requestAnimationFrame(()=>o.updateNodeInternals(e))},serializeConfig:(e,n,o)=>{var a;const t=(null!==(a=o.options)&&void 0!==a?a:[]).map(o=>{const a=de(o.digit),t=n.find(n=>n.source===e.id&&n.sourceHandle===a),l={digit:o.digit};return o.label&&(l.label=o.label),t&&(l.next_node=t.target),l});return Object.assign(Object.assign({},o),{options:t})}},pe={type:"audio_clip",flowType:"audioClip",localeKey:"audioClip",label:"Audio Clip",description:"Play an audio clip",color:"#14b8a6",exits:[{id:"next",label:"Next",configKey:"next",localeExitKey:"next"}],configPanel:({config:n,onConfigChange:o,listResources:a,onCreateResource:t,locale:l})=>{var r,i,d;const{groups:s,loading:c,handleCreateResource:p}=$([{type:"audio_clip",labelKey:"audioClips",fallback:"Audio Clips"}],a,t,l),u=null!==(r=n.clip_id)&&void 0!==r?r:"";return e.createElement(P,{label:null!==(i=null==l?void 0:l.configLabels.audioClip)&&void 0!==i?i:"Audio Clip"},e.createElement(D,{groups:s,value:u,loading:c,placeholder:null!==(d=null==l?void 0:l.configLabels.search)&&void 0!==d?d:"Search...",onSelect:(e,n)=>o({clip_id:e},{clipName:n}),onCreateResource:p,selectLabel:null==l?void 0:l.combobox.select,noResultsLabel:null==l?void 0:l.combobox.noResults,loadingLabel:null==l?void 0:l.combobox.loading,createNewPrefix:null==l?void 0:l.combobox.createNew}))},defaultConfig:{clip_id:""},icon:G,renderNode:(n,o)=>e.createElement(e.Fragment,null,e.createElement(j,{icon:o.icon,label:n.label,subtitle:n.clipName}),e.createElement("div",{className:"ds-dial-plan-node__exits"},e.createElement(I,{exits:o.exits,locale:n.locale}))),toFlowNode:e=>{const n=e;return{label:"Audio Clip",clipId:n.config.clip_id,originalNode:n}},normalizeFromAlias:e=>Object.assign(Object.assign({},e),{type:"audio_clip"}),collectResourceIds:(e,n)=>{e.clip_id&&n.addAudioClip(e.clip_id)},enrichNode:(e,n,o)=>{const a=n.audioClips.get(e.clipId);return Object.assign(Object.assign({},e),{clipName:null==a?void 0:a.name,locale:o})}},ue={type:"hang_up",flowType:"hangUp",localeKey:"hangUp",label:"Hang Up",description:"End the call",color:"#ef4444",exits:[],configPanel:({locale:n})=>{var o;return e.createElement("div",{className:"ds-dial-plan-config-panel__note"},null!==(o=null==n?void 0:n.nodeDescriptions.hangUp)&&void 0!==o?o:"End the call")},defaultConfig:{},icon:q,renderNode:(n,o)=>e.createElement(j,{icon:o.icon,label:n.label}),toFlowNode:e=>({label:"Hang Up",originalNode:e}),enrichNode:(e,n,o)=>Object.assign(Object.assign({},e),{label:o.nodeTypes.hangUp,locale:o})},fe=new class{constructor(){this.byType=new Map,this.byFlowType=new Map,this.legacyTypeAliases=new Map}register(e){this.byType.set(e.type,e),this.byFlowType.set(e.flowType,e)}registerAlias(e,n){this.legacyTypeAliases.set(e,n)}get(e){return this.byType.get(e)}resolveType(e){var n;let o=this.byType.get(e.type);if(!o){const n=this.legacyTypeAliases.get(e.type);n&&(o=this.byType.get(n))}return(null==o?void 0:o.resolveAlias)&&null!==(n=o.resolveAlias(e))&&void 0!==n?n:o}getByFlowType(e){return this.byFlowType.get(e)}getAll(){return Array.from(this.byType.values())}getNodeTypesMap(){const e={};for(const n of this.byType.values())e[n.flowType]=n.component;return e}createEdgesForNode(e,n){const o=this.resolveType(e);if(!o)return[];if(o.createEdgesForNode)return o.createEdgesForNode(e,n);const a=[];for(const t of o.exits){const o=e.config[t.configKey];o&&n.has(o)&&a.push({id:`${e.id}-${t.id}->${o}`,source:e.id,target:o,sourceHandle:t.id,type:T})}return a}},ge=(be=fe,a(function({data:n,selected:o,type:a}){const t=be.getByFlowType(null!=a?a:"");if(!t)return null;const l=t.renderNode(n,t),r=t.type.replace(/_/g,"-");return e.createElement("div",{className:`ds-dial-plan-node ds-dial-plan-node--themed ds-dial-plan-node--${r} ${o?"ds-dial-plan-node--selected":""}`,style:{"--node-color":t.color}},e.createElement(s,{type:"target",position:c.Left,className:"ds-dial-plan-handle"}),l)}));var be;const me=[Y,Z,ee,ae,le,re,ce,pe,ue];for(const e of me)fe.register(Object.assign(Object.assign({},e),{component:ge}));const ve=fe.get("internal_dial");ve&&(ve.resolveAlias=e=>{const n=e.config,o=n.target_id;return(null==o?void 0:o.startsWith("svm_"))||0===n.timeout&&!n.next?fe.get("voicemail"):(null==o?void 0:o.startsWith("va_"))?fe.get("voice_app"):void 0}),fe.registerAlias("sound_clip","audio_clip");const _e="__start__";function he(e,n=fe){var o;const a=[],t=[],l=new Map;for(const n of e.nodes)l.set(n.id,n);const r={id:_e,type:"start",position:{x:0,y:0},data:{label:"Start"}};a.push(r),e.entry_node&&l.has(e.entry_node)&&t.push({id:`${_e}->${e.entry_node}`,source:_e,target:e.entry_node,type:T});for(const r of e.nodes){const e=n.resolveType(r),i=null!==(o=r.position)&&void 0!==o?o:{x:0,y:0},d=e&&e.type!==r.type&&e.normalizeFromAlias?e.normalizeFromAlias(r):r;if(e){const n=e.toFlowNode(d),o={id:r.id,type:e.flowType,position:i,data:n};a.push(o)}else a.push({id:r.id,type:"default",position:i,data:{label:r.id,originalNode:r}});const s=n.createEdgesForNode(d,l);t.push(...s)}return e.nodes.some(e=>!e.position)?we(a,t):{nodes:a,edges:t}}function xe(e,n,o){var a,t,l,r;const i=n.find(e=>e.source===_e),d=null!==(a=null==i?void 0:i.target)&&void 0!==a?a:"",s=[];for(const a of e){if(a.id===_e)continue;const e=o.getByFlowType(null!==(t=a.type)&&void 0!==t?t:"");if(!e||!(null===(l=a.data)||void 0===l?void 0:l.originalNode))continue;const i=a.data.originalNode,d=Object.assign({},i.config);for(const n of e.exits)d[n.configKey]=void 0;for(const o of n){if(o.source!==a.id)continue;const n=e.exits.find(e=>e.id===o.sourceHandle);n&&(d[n.configKey]=o.target)}const c=e.serializeConfig?e.serializeConfig(a,n,d):d;s.push({id:a.id,type:null!==(r=e.apiType)&&void 0!==r?r:i.type,position:a.position,config:c})}return{entry_node:d,nodes:s}}function ye(e){var n,o,a;if((null===(n=e.measured)||void 0===n?void 0:n.width)&&(null===(o=e.measured)||void 0===o?void 0:o.height))return{width:e.measured.width,height:e.measured.height};if("start"===e.type)return{width:60,height:60};if("schedule"===e.type)return{width:180,height:140};if("menu"===e.type){const n=e.data.options;return{width:180,height:60+28*((null!==(a=null==n?void 0:n.length)&&void 0!==a?a:1)+2)}}return{width:180,height:80}}function we(e,n){var o;const a=new C.graphlib.Graph;a.setGraph({rankdir:"LR",nodesep:60,ranksep:80,marginx:40,marginy:40}),a.setDefaultEdgeLabel(()=>({}));for(const n of e){const{width:e,height:o}=ye(n);a.setNode(n.id,{width:e,height:o})}for(const e of n)a.setEdge(e.source,e.target);C.layout(a);const t=new Map;for(const n of e){const e=a.node(n.id),{width:o,height:l}=ye(n);t.set(n.id,{x:Math.round(e.x-o/2),y:Math.round(e.y-l/2)})}const l=new Map;for(const e of n){const n=l.get(e.source);n?n.push(e.target):l.set(e.source,[e.target])}const r=e=>{var n;const o=new Set([e]),a=[e];for(;a.length>0;){const e=a.shift();for(const t of null!==(n=l.get(e))&&void 0!==n?n:[])o.has(t)||(o.add(t),a.push(t))}return o};for(const a of e){const e=fe.getByFlowType(null!==(o=a.type)&&void 0!==o?o:"");if(!e||e.exits.length<2)continue;const l=[];for(const o of e.exits){const e=n.find(e=>e.source===a.id&&e.sourceHandle===o.id);e&&l.push(e.target)}if(l.length<2)continue;const i=l[0],d=l[1],s=t.get(i),c=t.get(d);if(!s||!c)continue;if(s.y<=c.y)continue;const p=r(i),u=r(d);if([...p].some(e=>u.has(e)))continue;const f=s.y-c.y;for(const e of p){const n=t.get(e);n&&(n.y-=f)}for(const e of u){const n=t.get(e);n&&(n.y+=f)}}const i=e.find(e=>e.id===_e),d=t.get(_e),s=i&&d?i.position.x-d.x:0,c=i&&d?i.position.y-d.y:0;return{nodes:e.map(e=>{const n=t.get(e.id);return Object.assign(Object.assign({},e),{position:{x:n.x+s,y:n.y+c}})}),edges:n}}const ke=a(function({data:n}){return e.createElement("div",{className:"ds-dial-plan-node ds-dial-plan-node--start"},e.createElement("div",{className:"ds-dial-plan-node__content"},e.createElement("span",{className:"ds-dial-plan-node__label"},n.label)),e.createElement(s,{type:"source",position:c.Right,className:"ds-dial-plan-handle"}))}),Ee=({registry:n,onAddNode:o,locale:a})=>{const t=n.getAll();return e.createElement("div",{className:"ds-dial-plan-node-library"},t.map(n=>{var t,l;const r=null!==(t=null==a?void 0:a.nodeTypes[n.localeKey])&&void 0!==t?t:n.label,i=null!==(l=null==a?void 0:a.nodeDescriptions[n.localeKey])&&void 0!==l?l:n.description;return e.createElement("div",{key:n.type,className:`ds-dial-plan-node-library__item ds-dial-plan-node-library__item--${n.type}`,style:{"--node-color":n.color},draggable:!0,onClick:()=>o(n.type),onDragStart:e=>{const o=e.currentTarget.getBoundingClientRect(),a=(e.clientX-o.left)/o.width,t=(e.clientY-o.top)/o.height;e.dataTransfer.setData("application/reactflow",n.type),e.dataTransfer.setData("application/reactflow-grab-frac",`${a},${t}`),e.dataTransfer.effectAllowed="move"},title:i},e.createElement("span",{className:"ds-dial-plan-node-library__item-icon"},n.icon),e.createElement("span",{className:"ds-dial-plan-node-library__item-label"},r))}))},Ne=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("polyline",{points:"3 6 5 6 21 6"}),e.createElement("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})),Ce=({node:n,registration:a,onConfigChange:l,onInvalidDraftChange:r,onDelete:i,onClose:d,listResources:s,onCreateResource:c,onOpenResource:p,locale:u})=>{var f,g,b;const m=t(null);o(()=>{var e;const n=null===(e=m.current)||void 0===e?void 0:e.getRootNode(),o=n instanceof ShadowRoot||n instanceof Document?n:document,a=e=>function(e){"Escape"===e.key&&d()}(e);return o.addEventListener("keydown",a),()=>o.removeEventListener("keydown",a)},[d]);const v=n.data.originalNode,_=null!==(f=null==v?void 0:v.config)&&void 0!==f?f:{},h=a.configPanel;return e.createElement("div",{ref:m,className:"ds-dial-plan-config-panel"},e.createElement("div",{className:"ds-dial-plan-config-panel__header"},e.createElement("span",{className:"ds-dial-plan-config-panel__header-icon"},a.icon),e.createElement("span",{className:"ds-dial-plan-config-panel__header-label"},a.label),e.createElement("button",{type:"button",className:"ds-dial-plan-config-panel__delete",onClick:()=>{i(n.id),d()},title:null!==(g=null==u?void 0:u.panel.delete_)&&void 0!==g?g:"Delete"},Ne),e.createElement("button",{className:"ds-dial-plan-config-panel__close",onClick:d,title:null!==(b=null==u?void 0:u.panel.close)&&void 0!==b?b:"Close",type:"button"},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})))),e.createElement("div",{className:"ds-dial-plan-config-panel__body"},e.createElement(h,{nodeId:n.id,onInvalidDraftChange:r,config:_,onConfigChange:(e,o)=>l(n.id,e,o),listResources:s,onCreateResource:c,onOpenResource:p,locale:u})))},Le=a(function({onAutoLayout:n,onSave:o,isDirty:a,hasInvalidDraft:t,locale:l}){var r;const i=null!==(r=null==l?void 0:l.toolbar)&&void 0!==r?r:{autoLayout:"Auto Layout",save:"Save"};return e.createElement("div",{className:"ds-dial-plan-editor-toolbar"},e.createElement("button",{className:"ds-dial-plan-editor-toolbar__button",onClick:n,title:i.autoLayout,type:"button"},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2"},e.createElement("rect",{x:"3",y:"3",width:"7",height:"7"}),e.createElement("rect",{x:"14",y:"3",width:"7",height:"7"}),e.createElement("rect",{x:"14",y:"14",width:"7",height:"7"}),e.createElement("line",{x1:"6.5",y1:"10",x2:"6.5",y2:"17"}),e.createElement("line",{x1:"6.5",y1:"17",x2:"14",y2:"17.5"})),e.createElement("span",null,i.autoLayout)),o&&e.createElement("button",{className:"ds-dial-plan-editor-toolbar__button",onClick:o,title:i.save,type:"button",disabled:!a||t},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2"},e.createElement("path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"}),e.createElement("polyline",{points:"17 21 17 13 7 13 7 21"}),e.createElement("polyline",{points:"7 3 7 8 15 8"})),e.createElement("span",null,i.save)))});var ze;const Oe=!("undefined"==typeof window||void 0===window.document||"function"!=typeof HTMLElement.prototype.attachShadow||"undefined"==typeof navigator||/jsdom/i.test(null!==(ze=navigator.userAgent)&&void 0!==ze?ze:"")||"undefined"!=typeof window&&"__STORYBOOK_PREVIEW__"in window),Se=({children:a,stylesheets:l,className:i,style:d})=>{const[s,c]=n(null),p=t(null),u=r(e=>{var n;if(p.current=e,!Oe||!e)return;const o=null!==(n=e.shadowRoot)&&void 0!==n?n:e.attachShadow({mode:"open"});c(o)},[]);o(()=>{Oe&&p.current&&function(e,n){const o=e.shadowRoot;o&&(o.adoptedStyleSheets=n.map(e=>{const n=new CSSStyleSheet;return n.replaceSync(e),n}))}(p.current,l)},[l]);const f=t(null);return o(()=>{if(!Oe&&0!==l.length)return f.current||(f.current=document.createElement("style"),document.head.appendChild(f.current)),f.current.textContent=l.join("\n"),()=>{f.current&&(f.current.remove(),f.current=null)}},[l]),Oe?e.createElement("div",{ref:u,className:i,style:d},s&&S(a,s)):e.createElement("div",{className:i,style:d},a)},Re={nodeTypes:{start:"Start",schedule:"Schedule",internalDial:"Internal Extension",voicemail:"Voicemail",externalDial:"External Number",ringAllUsers:"Ring All Users",voiceApp:"Voice App",menu:"IVR Menu",audioClip:"Audio Clip",hangUp:"Hang Up"},exits:{open:"Open",closed:"Closed",holiday:"Holiday",next:"Next",timeout:"Timeout",invalid:"Invalid"},nodeDescriptions:{schedule:"Route calls by schedule",internalDial:"Ring a user, group, or plan",voicemail:"Send to voicemail",ringAllUsers:"Ring all users",externalDial:"Ring an external phone number",voiceApp:"Route to a voice application",menu:"Play prompt and route by keypress",audioClip:"Play an audio clip",hangUp:"End the call"},targetTypes:{user:"User",ringGroup:"Ring Group",dialPlan:"Dial Plan",queue:"Queue",voiceApp:"Voice App",sharedVoicemail:"Shared Voicemail"},resourceGroups:{users:"Users",ringGroups:"Ring Groups",dialPlans:"Dial Plans",queues:"Queues",voiceApps:"Voice Apps",sharedVoicemails:"Shared Voicemails",schedules:"Schedules",audioClips:"Audio Clips"},configLabels:{timeout:"Timeout (seconds)",target:"Target",schedule:"Schedule",search:"Search...",searchTargets:"Search targets...",searchSchedules:"Search schedules...",openInNewTab:"Open target details",promptClip:"Prompt",audioClip:"Audio Clip",digit:"Digit",options:"Options",addOption:"Add Option",removeOption:"Remove",optionLabel:"Label",optionLabelPlaceholder:"e.g. Sales",routeHolidaySeparately:"Route holidays separately",routeHolidaySeparatelyHint:"When on, holidays route to a dedicated branch you wire below. Otherwise holidays follow the Closed exit.",mode:"Mode",phoneNumber:"Phone Number",phoneNumberInvalid:"Enter a valid phone number, for example (415) 555-1234.",clearPhoneNumber:"Clear phone number"},voiceAppMode:{control:"Control",notify:"Notify",controlBadge:"Control mode",notifyBadge:"Notify mode",controlHint:"Hands the call off to the voice app, which takes over the conversation.",notifyHint:"Notifies the voice app of the call in the background. The dial plan keeps routing via Next without waiting."},toolbar:{autoLayout:"Auto Layout",save:"Save"},panel:{delete_:"Delete",close:"Close",connection:"Connection",from:"From",exit:"Exit",to:"To"},combobox:{select:"— Select —",search:"Search...",noResults:"No results found",loading:"Loading...",createNew:"+ Create new...",extensionLabel:"Ext.",noName:"(No name)"},status:{loading:"Loading dial plan...",loadError:"Failed to load dial plan",notFound:"No dial plan found",saveError:"Failed to save dial plan",newDialPlan:"New Dial Plan"}},Te={schedule_id:"A schedule must be selected in the Schedule node",target_id:"A target must be selected in the Internal Extension node",phone_number:"Enter a valid US phone number in the External Number node"},je={schedule:"Schedule",internal_dial:"Internal Extension",ring_all_users:"Ring All",external_dial:"External Number"};const Ae={view:{editable:!1,interactive:!0,showChrome:!0},edit:{editable:!0,interactive:!0,showChrome:!0},preview:{editable:!1,interactive:!1,showChrome:!1}},Ie={id:"",name:"New Dial Plan",entry_node:"",nodes:[],created_at:"",updated_at:""},Fe=Object.assign({start:ke},fe.getNodeTypesMap()),De={[T]:n=>{const{sourceX:o,sourceY:a,targetX:t,targetY:l,sourcePosition:r,targetPosition:i,markerEnd:d,style:s}=n,c=Math.abs(a-l),[g]=c<=1?p({sourceX:o,sourceY:a,targetX:t,targetY:l}):u({sourceX:o,sourceY:a,targetX:t,targetY:l,sourcePosition:r,targetPosition:i,borderRadius:8});return e.createElement(f,{path:g,markerEnd:d,style:s})}};const Pe=e.forwardRef(function({dialPlanId:a,mode:l="view",locale:i=Re,onNodeClick:s,onLoaderStart:c,onLoaderEnd:p,onLoadError:u,onSave:f,onDirtyChange:g,onError:C,className:L,style:z,onCreateResource:O,onOpenResource:S},j){var A;const{editable:I,interactive:F,showChrome:D}=Ae[l],{dialstack:P}=N(),$=b(),M=m(),[H,K]=n(!I||!!a),[B,V]=n(null),[W,U]=v([]),[q,G,Y]=_([]),[X,Z]=n(null),[J,ee]=n(null),[ne,oe]=n(!1),[ae,te]=n(!1);o(()=>{var e,n;null===(n=(e=ce.current).onDirtyChange)||void 0===n||n.call(e,ne)},[ne]);const[le,re]=n(null),ie=t(null),de=t(W),se=t(q);de.current=W,se.current=q;const ce=t({onLoaderStart:c,onLoaderEnd:p,onLoadError:u,onError:C,onSave:f,onDirtyChange:g});ce.current={onLoaderStart:c,onLoaderEnd:p,onLoadError:u,onError:C,onSave:f,onDirtyChange:g};const pe=t(null),ue=t(!1);o(()=>{let e=!1;return function(){R(this,void 0,void 0,function*(){var n,o,t,l,r,d,s,c;if(I&&!a){const{nodes:n,edges:o}=he(Object.assign(Object.assign({},Ie),{name:i.status.newDialPlan}),fe);return void(e||(U(n),G(o),pe.current={nodes:n,edges:o},K(!1)))}K(!0),V(null),null===(o=(n=ce.current).onLoaderStart)||void 0===o||o.call(n);try{const n=yield P.dialPlans.retrieve(a);if(e)return;const o=yield function(e,n){return R(this,void 0,void 0,function*(){var o;const a=new Set,t=new Set,l=new Set;for(const n of e.nodes){const e=fe.resolveType(n),r=e?me.find(n=>{var o;return n.type===(null!==(o=e.apiType)&&void 0!==o?o:e.type)}):null;null===(o=null==r?void 0:r.collectResourceIds)||void 0===o||o.call(r,n.config,{addSchedule:e=>a.add(e),addTarget:e=>t.add(e),addAudioClip:e=>l.add(e)})}const r=l.size>0?n.audioClips.list().catch(()=>[]):Promise.resolve([]),[i,d,...s]=yield Promise.all([Promise.all(Array.from(a).map(e=>R(this,void 0,void 0,function*(){try{return yield n.schedules.retrieve(e)}catch(e){return null}}))),r,...Array.from(t).map(e=>R(this,void 0,void 0,function*(){var o;const a=yield n.resolveRoutingTarget(e);return a?{id:a.id,name:a.name||a.id,extension_number:null!==(o=a.extension_number)&&void 0!==o?o:void 0}:null}))]),c=new Map,p=new Map,u=new Map;for(const e of i)e&&c.set(e.id,e);for(const e of s)e&&p.set(e.id,e);for(const e of d)u.set(e.id,e);return{schedules:c,users:p,audioClips:u}})}(n,P);if(e)return;const{nodes:r,edges:d}=he(n,fe),s=function(e,n,o){return e.map(e=>{var a;const t=fe.getByFlowType(null!==(a=e.type)&&void 0!==a?a:""),l=t?me.find(e=>{var n;return e.type===(null!==(n=t.apiType)&&void 0!==n?n:t.type)}):null;return(null==l?void 0:l.enrichNode)?Object.assign(Object.assign({},e),{data:l.enrichNode(e.data,n,o)}):Object.assign(Object.assign({},e),{data:Object.assign(Object.assign({},e.data),{locale:o})})})}(r,o,i);U(s),G(d),pe.current={nodes:s,edges:d},re({id:n.id,name:n.name}),K(!1),null===(l=(t=ce.current).onLoaderEnd)||void 0===l||l.call(t,n)}catch(n){if(!e){const e=n instanceof Error?n:new Error(String(n));V(e),K(!1),null===(d=(r=ce.current).onLoadError)||void 0===d||d.call(r,e),null===(c=(s=ce.current).onError)||void 0===c||c.call(s,e)}}})}(),()=>{e=!0}},[P,a,U,G]);const ge=r((e,n)=>{if(!pe.current)return;const o=(e,n)=>JSON.stringify({nodes:e.map(e=>({id:e.id,data:e.data,position:e.position})),edges:n.map(e=>({id:e.id,source:e.source,target:e.target,sourceHandle:e.sourceHandle}))}),a=o(pe.current.nodes,pe.current.edges)!==o(e,n);oe(a)},[]);o(()=>{ue.current&&(ue.current=!1,ge(W,q))},[W,q,ge]);const be=r(e=>{Y(e),e.some(e=>"remove"===e.type)&&queueMicrotask(()=>ge(de.current,se.current))},[Y,ge]),ve=r(e=>{const n=de.current.filter(n=>n.id!==e).map(n=>{var o;const a=null===(o=n.data)||void 0===o?void 0:o.originalNode;if(!a)return n;const t=a.config;if(!t)return n;const l=Object.assign({},t);let r=!1;for(const n of Object.keys(l))l[n]===e&&(l[n]=void 0,r=!0);return r?Object.assign(Object.assign({},n),{data:Object.assign(Object.assign({},n.data),{originalNode:Object.assign(Object.assign({},a),{config:l})})}):n}),o=se.current.filter(n=>n.source!==e&&n.target!==e);U(n),G(o),ge(n,o),X===e&&Z(null)},[U,G,X,ge]),_e=r(e=>{const n=new Set(e.filter(e=>"remove"===e.type&&"id"in e&&"__start__"!==e.id).map(e=>"id"in e?e.id:""));if(n.size>0){const e=de.current.filter(e=>!n.has(e.id)).map(e=>{var o;const a=null===(o=e.data)||void 0===o?void 0:o.originalNode;if(!a)return e;const t=a.config;if(!t)return e;const l=Object.assign({},t);let r=!1;for(const e of Object.keys(l))"string"==typeof l[e]&&n.has(l[e])&&(l[e]=void 0,r=!0);return r?Object.assign(Object.assign({},e),{data:Object.assign(Object.assign({},e.data),{originalNode:Object.assign(Object.assign({},a),{config:l})})}):e}),o=se.current.filter(e=>!n.has(e.source)&&!n.has(e.target));U(e),G(o),ge(e,o),X&&n.has(X)&&Z(null)}const o=e.filter(e=>"remove"!==e.type&&!("position"===e.type&&"id"in e&&"__start__"===e.id));0!==o.length&&(o.some(e=>"position"===e.type&&!e.dragging)&&(ue.current=!0),U(e=>h(o,e)))},[U,G,ge,X]),ye=r((e,n,o)=>{var a,t;const l=fe.get(e);if(!l)return;const r=`${e}_${crypto.randomUUID().replace(/-/g,"").slice(0,12)}`;let i=n;if(!i){const e=null===(a=ie.current)||void 0===a?void 0:a.getBoundingClientRect(),n=e?e.left+e.width/2:400,o=e?e.top+e.height/2:300;i=$.screenToFlowPosition({x:n,y:o})}const d={id:r,type:null!==(t=l.apiType)&&void 0!==t?t:e,config:Object.assign({},l.defaultConfig)},s=l.toFlowNode(d),c={id:r,type:l.flowType,position:i,data:s,selected:!0};if(U(e=>{const n=e.map(e=>e.selected?Object.assign(Object.assign({},e),{selected:!1}):e);return n.push(c),ge(n,se.current),n}),Z(r),o){const e=i;requestAnimationFrame(()=>{var n;const a=null===(n=ie.current)||void 0===n?void 0:n.querySelector(`[data-id="${CSS.escape(r)}"]`);if(!a)return;const t=a.offsetWidth,l=a.offsetHeight;t&&l&&U(n=>n.map(n=>n.id===r?Object.assign(Object.assign({},n),{position:{x:e.x-o.x*t,y:e.y-o.y*l}}):n))})}},[$,U,ge]),ke=r(e=>{e.preventDefault();const n=e.dataTransfer.getData("application/reactflow");if(!n)return;const[o,a]=e.dataTransfer.getData("application/reactflow-grab-frac").split(","),t={x:Number(o),y:Number(a)},l=$.screenToFlowPosition({x:e.clientX,y:e.clientY});ye(n,l,t)},[$,ye]),ze=r(e=>{e.preventDefault(),e.dataTransfer.dropEffect="move"},[]),Oe=r(e=>{var n,o,a;const t={id:`${e.source}-${null!==(n=e.sourceHandle)&&void 0!==n?n:""}->${e.target}`,source:e.source,target:e.target,sourceHandle:null!==(o=e.sourceHandle)&&void 0!==o?o:void 0,targetHandle:null!==(a=e.targetHandle)&&void 0!==a?a:void 0,type:T,markerEnd:{type:x.ArrowClosed,width:12,height:12,color:"#94a3b8"}};G(n=>{const o=n.filter(n=>{var o,a;return!(n.source===e.source&&(null!==(o=n.sourceHandle)&&void 0!==o?o:null)===(null!==(a=e.sourceHandle)&&void 0!==a?a:null))}),a=[...o,t];return ge(de.current,a),a})},[G,ge]),Se=r((e,n)=>{G(o=>{var a,t,l;const r=o.filter(o=>{var a,t;return o.id!==e.id&&!(o.source===n.source&&(null!==(a=o.sourceHandle)&&void 0!==a?a:null)===(null!==(t=n.sourceHandle)&&void 0!==t?t:null))}),i=[...r,{id:`${n.source}-${null!==(a=n.sourceHandle)&&void 0!==a?a:""}->${n.target}`,source:n.source,target:n.target,sourceHandle:null!==(t=n.sourceHandle)&&void 0!==t?t:void 0,targetHandle:null!==(l=n.targetHandle)&&void 0!==l?l:void 0,type:T,markerEnd:{type:x.ArrowClosed,width:12,height:12,color:"#94a3b8"}}];return ge(de.current,i),i})},[G,ge]),Pe=r(e=>{var n;if(!e.source||!e.target||e.source!==e.target)return!0;const o=de.current.find(n=>n.id===e.source),a=fe.getByFlowType(null!==(n=null==o?void 0:o.type)&&void 0!==n?n:"");return!0===(null==a?void 0:a.allowSelfLoop)},[de]),$e=r((e,n,o)=>{var a,t,l;U(a=>{const t=a.map(a=>{var t,l;if(a.id!==e)return a;const r=null===(t=a.data)||void 0===t?void 0:t.originalNode;if(!r)return a;const d=Object.assign(Object.assign({},r),{config:Object.assign(Object.assign({},r.config),n)}),s=fe.getByFlowType(null!==(l=a.type)&&void 0!==l?l:""),c=s?s.toFlowNode(d):Object.assign(Object.assign({},a.data),{originalNode:d}),p=n.target_id,u=p?Q(p,i):void 0;return Object.assign(Object.assign({},a),{data:Object.assign(Object.assign(Object.assign(Object.assign({},a.data),c),o),u&&{targetType:u})})});return ge(t,se.current),t});const r=null!==(t=null===(a=de.current.find(n=>n.id===e))||void 0===a?void 0:a.type)&&void 0!==t?t:"",d=fe.getByFlowType(r),s=d?me.find(e=>{var n;return e.type===(null!==(n=d.apiType)&&void 0!==n?n:d.type)}):null;null===(l=null==s?void 0:s.onConfigChange)||void 0===l||l.call(s,e,n,{setEdges:G,updateNodeInternals:M,nodesRef:de,updateDirty:ge}),n.target_id&&requestAnimationFrame(()=>M(e))},[U,G,ge,M]),Me=r(()=>{const{nodes:e,edges:n}=we(W,q);U(e),G(n),ge(e,n),requestAnimationFrame(()=>$.fitView({padding:.2}))},[W,q,U,G,ge,$]),He=r((e,n)=>R(this,void 0,void 0,function*(){var o;try{const t={expand:["extensions"]};switch(e){case"schedule":return yield P.schedules.list();case"user":return(yield P.users.list(t)).map(e=>{var n,o,a;return{id:e.id,name:e.name||i.combobox.noName,extension_number:null===(a=null===(o=null===(n=e.extensions)||void 0===n?void 0:n.data)||void 0===o?void 0:o[0])||void 0===a?void 0:a.number}});case"ring_group":return yield P.ringGroups.list(t);case"queue":return yield P.queues.list({expand:t.expand});case"dial_plan":{const e=yield P.dialPlans.list(t),n=null!==(o=null==le?void 0:le.id)&&void 0!==o?o:a;return e.filter(e=>e.id!==n)}case"voice_app":{const e=yield P.voiceApps.list(t);if(!(null==n?void 0:n.notifyEligible))return e;try{const n=yield P.aiAgents.list({limit:100}),o=new Set(n.map(e=>e.voice_app_id));return e.filter(e=>!o.has(e.id))}catch(n){return e}}case"shared_voicemail":return yield P.sharedVoicemailBoxes.list();case"audio_clip":return yield P.audioClips.list();default:return[]}}catch(e){return[]}}),[P,a,le,i]),Ke=r(()=>R(this,void 0,void 0,function*(){var e,n,o,t,l,r;try{const l=de.current,r=se.current,d=xe(l,r,fe),s=a?yield P.dialPlans.update(a,d):yield P.dialPlans.create(Object.assign({name:i.status.newDialPlan},d));pe.current={nodes:[...l],edges:[...r]},oe(!1),null===(n=(e=ce.current).onDirtyChange)||void 0===n||n.call(e,!1),null===(t=(o=ce.current).onSave)||void 0===t||t.call(o,s)}catch(e){const n=e instanceof Error?e:new Error(String(e)),o=n.message.includes("/nodes/")?xe(de.current,se.current,fe):null;if(o){const e=n.message.match(/^\/nodes\/(\d+)\//);if(null==e?void 0:e[1]){const n=o.nodes[parseInt(e[1],10)];n&&Z(n.id)}}throw null===(r=(l=ce.current).onError)||void 0===r||r.call(l,new Error(function(e,n){var o,a,t;if(e.startsWith("voice_app notify mode is not supported on AI agent voice apps"))return"A Voice App used in Notify mode is backed by an AI agent. AI-agent voice apps must use Control mode.";const l=e.indexOf(": "),r=l>0&&e.startsWith("/")?e.slice(0,l):"",i=l>0?e.slice(l+2):e,d=r.split("/").filter(Boolean);if("entry_node"===d[0])return"The Start node must be connected to another node";if("nodes"===d[0]&&i.includes("minItems"))return"The dial plan must have at least one node";if("nodes"===d[0]&&"config"===d[2]&&d[3]){const e=d[3];if(Te[e])return Te[e];const l=parseInt(null!==(o=d[1])&&void 0!==o?o:"",10),r=isNaN(l)||null===(a=null==n?void 0:n[l])||void 0===a?void 0:a.type,i=r?null!==(t=je[r])&&void 0!==t?t:r:void 0;return i?`Invalid ${e.replace(/_/g," ")} in the ${i} node`:`Invalid ${e.replace(/_/g," ")}`}return r?i:e}(n.message,null==o?void 0:o.nodes))),e}}),[P,a]);d(j,()=>({save:Ke}),[Ke]);const Be=r((e,n)=>{"__start__"!==n.id&&(Z(n.id),ee(null))},[]),Ve=r((e,n)=>{ee(n.id),Z(null)},[]),We=r(e=>{const n=se.current.filter(n=>n.id!==e);G(n),ge(de.current,n),ee(null)},[G,ge]),Ue=r(()=>{Z(null),ee(null)},[]),qe=r((e,n)=>{var o;if(!s)return;if("__start__"===n.id)return;const a=null===(o=n.data)||void 0===o?void 0:o.originalNode;a&&s(n.id,a)},[s]),Ge=X?W.find(e=>e.id===X):null,Ye=Ge?fe.getByFlowType(null!==(A=Ge.type)&&void 0!==A?A:""):null,Xe=J?q.find(e=>e.id===J):null,Ze=!(!Ge||!Ye)||!!Xe;if(H)return e.createElement("div",{className:`ds-dial-plan-viewer ds-dial-plan-viewer--loading ${L||""}`,style:z},e.createElement("div",{className:"ds-dial-plan-viewer__loading"},e.createElement("div",{className:"ds-dial-plan-viewer__spinner"}),e.createElement("span",null,i.status.loading)));if(B)return e.createElement("div",{className:`ds-dial-plan-viewer ds-dial-plan-viewer--error ${L||""}`,style:z},e.createElement("div",{className:"ds-dial-plan-viewer__error"},e.createElement("span",null,i.status.loadError),e.createElement("span",{className:"ds-dial-plan-viewer__error-message"},B.message)));if(!I&&0===W.length)return e.createElement("div",{className:`ds-dial-plan-viewer ds-dial-plan-viewer--empty ${L||""}`,style:z},e.createElement("div",{className:"ds-dial-plan-viewer__empty"},e.createElement("span",null,i.status.notFound)));const Qe=e.createElement(y,{nodes:W,edges:q,nodeTypes:Fe,edgeTypes:De,onNodesChange:I?_e:void 0,onEdgesChange:I?be:void 0,onConnect:I?Oe:void 0,onReconnect:I?Se:void 0,onEdgeClick:I?Ve:void 0,isValidConnection:I?Pe:void 0,edgesReconnectable:I,onNodeClick:I?Be:s?qe:void 0,onPaneClick:I?Ue:void 0,nodesDraggable:I,nodesConnectable:I,elementsSelectable:I,selectionOnDrag:!1,selectNodesOnDrag:!1,panOnDrag:F,panOnScroll:!1,zoomOnScroll:F,zoomOnPinch:F,zoomOnDoubleClick:F,preventScrolling:F,connectionLineType:w.SmoothStep,selectionKeyCode:null,multiSelectionKeyCode:null,deleteKeyCode:I?["Backspace","Delete"]:null,fitView:!0,fitViewOptions:{padding:F?.2:.15,minZoom:F?.5:0,maxZoom:1.5},minZoom:F?.3:0,maxZoom:2,defaultEdgeOptions:{type:T,animated:!1,markerEnd:{type:x.ArrowClosed,width:12,height:12,color:"#94a3b8"}},proOptions:{hideAttribution:!0}},D&&e.createElement(k,{gap:20,size:1}),D&&e.createElement(E,{showInteractive:!1}),I&&e.createElement(Le,{onAutoLayout:Me,onSave:()=>{Ke().catch(()=>{})},isDirty:ne,hasInvalidDraft:ae}));return e.createElement("div",{className:`ds-dial-plan-editor ${"preview"===l?"ds-dial-plan-editor--preview":""} ${L||""}`,style:z},I&&e.createElement("div",{className:"ds-dial-plan-node-library-wrapper"},e.createElement(Ee,{registry:fe,onAddNode:ye})),e.createElement("div",{ref:ie,className:"ds-dial-plan-editor__canvas",onDrop:I?ke:void 0,onDragOver:I?ze:void 0},Qe),I&&e.createElement("div",{className:"ds-dial-plan-config-panel-wrapper"+(Ze?" ds-dial-plan-config-panel-wrapper--open":"")},Ge&&Ye&&e.createElement(Ce,{node:Ge,registration:Ye,onConfigChange:$e,onInvalidDraftChange:te,onDelete:ve,onClose:()=>{Z(null),U(e=>e.map(e=>e.selected?Object.assign(Object.assign({},e),{selected:!1}):e))},listResources:He,onCreateResource:O,onOpenResource:S,locale:i}),Xe&&e.createElement("div",{className:"ds-dial-plan-config-panel"},e.createElement("div",{className:"ds-dial-plan-config-panel__header"},e.createElement("span",{className:"ds-dial-plan-config-panel__header-icon"},e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M4 8h8v8h8"}),e.createElement("polyline",{points:"17 13 20 16 17 19"}))),e.createElement("span",{className:"ds-dial-plan-config-panel__header-label"},i.panel.connection),e.createElement("button",{type:"button",className:"ds-dial-plan-config-panel__delete",onClick:()=>We(Xe.id),title:i.panel.delete_},Ne),e.createElement("button",{type:"button",className:"ds-dial-plan-config-panel__close",onClick:()=>{ee(null),G(e=>e.map(e=>e.selected?Object.assign(Object.assign({},e),{selected:!1}):e))},title:i.panel.close},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})))),e.createElement("div",{className:"ds-dial-plan-config-panel__body"},e.createElement("div",{className:"ds-dial-plan-config-field"},e.createElement("span",{className:"ds-dial-plan-config-field__label"},i.panel.from),e.createElement("span",{className:"ds-dial-plan-edge-panel__value"},(()=>{var e,n,o;const a=W.find(e=>e.id===Xe.source),t=a?fe.getByFlowType(null!==(e=a.type)&&void 0!==e?e:""):null,l=null!==(o=null!==(n=null==t?void 0:t.label)&&void 0!==n?n:null==a?void 0:a.type)&&void 0!==o?o:Xe.source;return l.charAt(0).toUpperCase()+l.slice(1)})())),Xe.sourceHandle&&e.createElement("div",{className:"ds-dial-plan-config-field"},e.createElement("span",{className:"ds-dial-plan-config-field__label"},i.panel.exit),e.createElement("span",{className:"ds-dial-plan-edge-panel__value"},(()=>{var e,n,o,a,t;const l=Xe.sourceHandle,r=W.find(e=>e.id===Xe.source),i=r?fe.getByFlowType(null!==(e=r.type)&&void 0!==e?e:""):null,d=i?me.find(e=>{var n;return e.type===(null!==(n=i.apiType)&&void 0!==n?n:i.type)}):null;return null!==(t=null!==(o=null===(n=null==d?void 0:d.resolveExitLabel)||void 0===n?void 0:n.call(d,l))&&void 0!==o?o:null===(a=null==i?void 0:i.exits.find(e=>e.id===l))||void 0===a?void 0:a.label)&&void 0!==t?t:l})())),e.createElement("div",{className:"ds-dial-plan-config-field"},e.createElement("span",{className:"ds-dial-plan-config-field__label"},i.panel.to),e.createElement("span",{className:"ds-dial-plan-edge-panel__value"},(()=>{var e,n,o;const a=W.find(e=>e.id===Xe.target),t=a?fe.getByFlowType(null!==(e=a.type)&&void 0!==e?e:""):null,l=null!==(o=null!==(n=null==t?void 0:t.label)&&void 0!==n?n:null==a?void 0:a.type)&&void 0!==o?o:Xe.target;return l.charAt(0).toUpperCase()+l.slice(1)})()))))))}),$e=["/* this gets exported as style.css and can be used for the default theming */\n/* these are the necessary styles for React/Svelte Flow, they get used by base.css and style.css */\n.react-flow {\n direction: ltr;\n\n --xy-edge-stroke-default: #b1b1b7;\n --xy-edge-stroke-width-default: 1;\n --xy-edge-stroke-selected-default: #555;\n\n --xy-connectionline-stroke-default: #b1b1b7;\n --xy-connectionline-stroke-width-default: 1;\n\n --xy-attribution-background-color-default: rgba(255, 255, 255, 0.5);\n\n --xy-minimap-background-color-default: #fff;\n --xy-minimap-mask-background-color-default: rgba(240, 240, 240, 0.6);\n --xy-minimap-mask-stroke-color-default: transparent;\n --xy-minimap-mask-stroke-width-default: 1;\n --xy-minimap-node-background-color-default: #e2e2e2;\n --xy-minimap-node-stroke-color-default: transparent;\n --xy-minimap-node-stroke-width-default: 2;\n\n --xy-background-color-default: transparent;\n --xy-background-pattern-dots-color-default: #91919a;\n --xy-background-pattern-lines-color-default: #eee;\n --xy-background-pattern-cross-color-default: #e2e2e2;\n background-color: var(--xy-background-color, var(--xy-background-color-default));\n --xy-node-color-default: inherit;\n --xy-node-border-default: 1px solid #1a192b;\n --xy-node-background-color-default: #fff;\n --xy-node-group-background-color-default: rgba(240, 240, 240, 0.25);\n --xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(0, 0, 0, 0.08);\n --xy-node-boxshadow-selected-default: 0 0 0 0.5px #1a192b;\n --xy-node-border-radius-default: 3px;\n\n --xy-handle-background-color-default: #1a192b;\n --xy-handle-border-color-default: #fff;\n\n --xy-selection-background-color-default: rgba(0, 89, 220, 0.08);\n --xy-selection-border-default: 1px dotted rgba(0, 89, 220, 0.8);\n\n --xy-controls-button-background-color-default: #fefefe;\n --xy-controls-button-background-color-hover-default: #f4f4f4;\n --xy-controls-button-color-default: inherit;\n --xy-controls-button-color-hover-default: inherit;\n --xy-controls-button-border-color-default: #eee;\n --xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, 0.08);\n\n --xy-edge-label-background-color-default: #ffffff;\n --xy-edge-label-color-default: inherit;\n --xy-resize-background-color-default: #3367d9;\n}\n.react-flow.dark {\n --xy-edge-stroke-default: #3e3e3e;\n --xy-edge-stroke-width-default: 1;\n --xy-edge-stroke-selected-default: #727272;\n\n --xy-connectionline-stroke-default: #b1b1b7;\n --xy-connectionline-stroke-width-default: 1;\n\n --xy-attribution-background-color-default: rgba(150, 150, 150, 0.25);\n\n --xy-minimap-background-color-default: #141414;\n --xy-minimap-mask-background-color-default: rgba(60, 60, 60, 0.6);\n --xy-minimap-mask-stroke-color-default: transparent;\n --xy-minimap-mask-stroke-width-default: 1;\n --xy-minimap-node-background-color-default: #2b2b2b;\n --xy-minimap-node-stroke-color-default: transparent;\n --xy-minimap-node-stroke-width-default: 2;\n\n --xy-background-color-default: #141414;\n --xy-background-pattern-dots-color-default: #555;\n --xy-background-pattern-lines-color-default: #333;\n --xy-background-pattern-cross-color-default: #333;\n --xy-node-color-default: #f8f8f8;\n --xy-node-border-default: 1px solid #3c3c3c;\n --xy-node-background-color-default: #1e1e1e;\n --xy-node-group-background-color-default: rgba(240, 240, 240, 0.25);\n --xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(255, 255, 255, 0.08);\n --xy-node-boxshadow-selected-default: 0 0 0 0.5px #999;\n\n --xy-handle-background-color-default: #bebebe;\n --xy-handle-border-color-default: #1e1e1e;\n\n --xy-selection-background-color-default: rgba(200, 200, 220, 0.08);\n --xy-selection-border-default: 1px dotted rgba(200, 200, 220, 0.8);\n\n --xy-controls-button-background-color-default: #2b2b2b;\n --xy-controls-button-background-color-hover-default: #3e3e3e;\n --xy-controls-button-color-default: #f8f8f8;\n --xy-controls-button-color-hover-default: #fff;\n --xy-controls-button-border-color-default: #5b5b5b;\n --xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, 0.08);\n\n --xy-edge-label-background-color-default: #141414;\n --xy-edge-label-color-default: #f8f8f8;\n}\n.react-flow__background {\n background-color: var(--xy-background-color-props, var(--xy-background-color, var(--xy-background-color-default)));\n pointer-events: none;\n z-index: -1;\n}\n.react-flow__container {\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n}\n.react-flow__pane {\n z-index: 1;\n touch-action: none;\n}\n.react-flow__pane.draggable {\n cursor: grab;\n }\n.react-flow__pane.dragging {\n cursor: grabbing;\n }\n.react-flow__pane.selection {\n cursor: pointer;\n }\n.react-flow__viewport {\n transform-origin: 0 0;\n z-index: 2;\n pointer-events: none;\n}\n.react-flow__renderer {\n z-index: 4;\n}\n.react-flow__selection {\n z-index: 6;\n}\n.react-flow__nodesselection-rect:focus,\n.react-flow__nodesselection-rect:focus-visible {\n outline: none;\n}\n.react-flow__edge-path {\n stroke: var(--xy-edge-stroke, var(--xy-edge-stroke-default));\n stroke-width: var(--xy-edge-stroke-width, var(--xy-edge-stroke-width-default));\n fill: none;\n}\n.react-flow__connection-path {\n stroke: var(--xy-connectionline-stroke, var(--xy-connectionline-stroke-default));\n stroke-width: var(--xy-connectionline-stroke-width, var(--xy-connectionline-stroke-width-default));\n fill: none;\n}\n.react-flow .react-flow__edges {\n position: absolute;\n}\n.react-flow .react-flow__edges svg {\n overflow: visible;\n position: absolute;\n pointer-events: none;\n }\n.react-flow__edge {\n pointer-events: visibleStroke;\n}\n.react-flow__edge.selectable {\n cursor: pointer;\n }\n.react-flow__edge.animated path {\n stroke-dasharray: 5;\n animation: dashdraw 0.5s linear infinite;\n }\n.react-flow__edge.animated path.react-flow__edge-interaction {\n stroke-dasharray: none;\n animation: none;\n }\n.react-flow__edge.inactive {\n pointer-events: none;\n }\n.react-flow__edge.selected,\n .react-flow__edge:focus,\n .react-flow__edge:focus-visible {\n outline: none;\n }\n.react-flow__edge.selected .react-flow__edge-path,\n .react-flow__edge.selectable:focus .react-flow__edge-path,\n .react-flow__edge.selectable:focus-visible .react-flow__edge-path {\n stroke: var(--xy-edge-stroke-selected, var(--xy-edge-stroke-selected-default));\n }\n.react-flow__edge-textwrapper {\n pointer-events: all;\n }\n.react-flow__edge .react-flow__edge-text {\n pointer-events: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n }\n/* Arrowhead marker styles - use CSS custom properties as default */\n.react-flow__arrowhead polyline {\n stroke: var(--xy-edge-stroke, var(--xy-edge-stroke-default));\n}\n.react-flow__arrowhead polyline.arrowclosed {\n fill: var(--xy-edge-stroke, var(--xy-edge-stroke-default));\n}\n.react-flow__connection {\n pointer-events: none;\n}\n.react-flow__connection .animated {\n stroke-dasharray: 5;\n animation: dashdraw 0.5s linear infinite;\n }\nsvg.react-flow__connectionline {\n z-index: 1001;\n overflow: visible;\n position: absolute;\n}\n.react-flow__nodes {\n pointer-events: none;\n transform-origin: 0 0;\n}\n.react-flow__node {\n position: absolute;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n pointer-events: all;\n transform-origin: 0 0;\n box-sizing: border-box;\n cursor: default;\n}\n.react-flow__node.selectable {\n cursor: pointer;\n }\n.react-flow__node.draggable {\n cursor: grab;\n pointer-events: all;\n }\n.react-flow__node.draggable.dragging {\n cursor: grabbing;\n }\n.react-flow__nodesselection {\n z-index: 3;\n transform-origin: left top;\n pointer-events: none;\n}\n.react-flow__nodesselection-rect {\n position: absolute;\n pointer-events: all;\n cursor: grab;\n }\n.react-flow__handle {\n position: absolute;\n pointer-events: none;\n min-width: 5px;\n min-height: 5px;\n width: 6px;\n height: 6px;\n background-color: var(--xy-handle-background-color, var(--xy-handle-background-color-default));\n border: 1px solid var(--xy-handle-border-color, var(--xy-handle-border-color-default));\n border-radius: 100%;\n}\n.react-flow__handle.connectingfrom {\n pointer-events: all;\n }\n.react-flow__handle.connectionindicator {\n pointer-events: all;\n cursor: crosshair;\n }\n.react-flow__handle-bottom {\n top: auto;\n left: 50%;\n bottom: 0;\n transform: translate(-50%, 50%);\n }\n.react-flow__handle-top {\n top: 0;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n.react-flow__handle-left {\n top: 50%;\n left: 0;\n transform: translate(-50%, -50%);\n }\n.react-flow__handle-right {\n top: 50%;\n right: 0;\n transform: translate(50%, -50%);\n }\n.react-flow__edgeupdater {\n cursor: move;\n pointer-events: all;\n}\n.react-flow__pane.selection .react-flow__panel {\n pointer-events: none;\n}\n.react-flow__panel {\n position: absolute;\n z-index: 5;\n margin: 15px;\n}\n.react-flow__panel.top {\n top: 0;\n }\n.react-flow__panel.bottom {\n bottom: 0;\n }\n.react-flow__panel.top.center, .react-flow__panel.bottom.center {\n left: 50%;\n transform: translateX(-15px) translateX(-50%);\n }\n.react-flow__panel.left {\n left: 0;\n }\n.react-flow__panel.right {\n right: 0;\n }\n.react-flow__panel.left.center, .react-flow__panel.right.center {\n top: 50%;\n transform: translateY(-15px) translateY(-50%);\n }\n.react-flow__attribution {\n font-size: 10px;\n background: var(--xy-attribution-background-color, var(--xy-attribution-background-color-default));\n padding: 2px 3px;\n margin: 0;\n}\n.react-flow__attribution a {\n text-decoration: none;\n color: #999;\n }\n@keyframes dashdraw {\n from {\n stroke-dashoffset: 10;\n }\n}\n.react-flow__edgelabel-renderer {\n position: absolute;\n width: 100%;\n height: 100%;\n pointer-events: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n left: 0;\n top: 0;\n}\n.react-flow__viewport-portal {\n position: absolute;\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n}\n.react-flow__minimap {\n background: var(\n --xy-minimap-background-color-props,\n var(--xy-minimap-background-color, var(--xy-minimap-background-color-default))\n );\n}\n.react-flow__minimap-svg {\n display: block;\n }\n.react-flow__minimap-mask {\n fill: var(\n --xy-minimap-mask-background-color-props,\n var(--xy-minimap-mask-background-color, var(--xy-minimap-mask-background-color-default))\n );\n stroke: var(\n --xy-minimap-mask-stroke-color-props,\n var(--xy-minimap-mask-stroke-color, var(--xy-minimap-mask-stroke-color-default))\n );\n stroke-width: var(\n --xy-minimap-mask-stroke-width-props,\n var(--xy-minimap-mask-stroke-width, var(--xy-minimap-mask-stroke-width-default))\n );\n }\n.react-flow__minimap-node {\n fill: var(\n --xy-minimap-node-background-color-props,\n var(--xy-minimap-node-background-color, var(--xy-minimap-node-background-color-default))\n );\n stroke: var(\n --xy-minimap-node-stroke-color-props,\n var(--xy-minimap-node-stroke-color, var(--xy-minimap-node-stroke-color-default))\n );\n stroke-width: var(\n --xy-minimap-node-stroke-width-props,\n var(--xy-minimap-node-stroke-width, var(--xy-minimap-node-stroke-width-default))\n );\n }\n.react-flow__background-pattern.dots {\n fill: var(\n --xy-background-pattern-color-props,\n var(--xy-background-pattern-color, var(--xy-background-pattern-dots-color-default))\n );\n }\n.react-flow__background-pattern.lines {\n stroke: var(\n --xy-background-pattern-color-props,\n var(--xy-background-pattern-color, var(--xy-background-pattern-lines-color-default))\n );\n }\n.react-flow__background-pattern.cross {\n stroke: var(\n --xy-background-pattern-color-props,\n var(--xy-background-pattern-color, var(--xy-background-pattern-cross-color-default))\n );\n }\n.react-flow__controls {\n display: flex;\n flex-direction: column;\n box-shadow: var(--xy-controls-box-shadow, var(--xy-controls-box-shadow-default));\n}\n.react-flow__controls.horizontal {\n flex-direction: row;\n }\n.react-flow__controls-button {\n display: flex;\n justify-content: center;\n align-items: center;\n height: 26px;\n width: 26px;\n padding: 4px;\n border: none;\n background: var(--xy-controls-button-background-color, var(--xy-controls-button-background-color-default));\n border-bottom: 1px solid\n var(\n --xy-controls-button-border-color-props,\n var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default))\n );\n color: var(\n --xy-controls-button-color-props,\n var(--xy-controls-button-color, var(--xy-controls-button-color-default))\n );\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n }\n.react-flow__controls-button svg {\n width: 100%;\n max-width: 12px;\n max-height: 12px;\n fill: currentColor;\n }\n.react-flow__edge.updating .react-flow__edge-path {\n stroke: #777;\n }\n.react-flow__edge-text {\n font-size: 10px;\n }\n.react-flow__node.selectable:focus,\n .react-flow__node.selectable:focus-visible {\n outline: none;\n }\n.react-flow__node-input,\n.react-flow__node-default,\n.react-flow__node-output,\n.react-flow__node-group {\n padding: 10px;\n border-radius: var(--xy-node-border-radius, var(--xy-node-border-radius-default));\n width: 150px;\n font-size: 12px;\n color: var(--xy-node-color, var(--xy-node-color-default));\n text-align: center;\n border: var(--xy-node-border, var(--xy-node-border-default));\n background-color: var(--xy-node-background-color, var(--xy-node-background-color-default));\n}\n.react-flow__node-input.selectable:hover, .react-flow__node-default.selectable:hover, .react-flow__node-output.selectable:hover, .react-flow__node-group.selectable:hover {\n box-shadow: var(--xy-node-boxshadow-hover, var(--xy-node-boxshadow-hover-default));\n }\n.react-flow__node-input.selectable.selected,\n .react-flow__node-input.selectable:focus,\n .react-flow__node-input.selectable:focus-visible,\n .react-flow__node-default.selectable.selected,\n .react-flow__node-default.selectable:focus,\n .react-flow__node-default.selectable:focus-visible,\n .react-flow__node-output.selectable.selected,\n .react-flow__node-output.selectable:focus,\n .react-flow__node-output.selectable:focus-visible,\n .react-flow__node-group.selectable.selected,\n .react-flow__node-group.selectable:focus,\n .react-flow__node-group.selectable:focus-visible {\n box-shadow: var(--xy-node-boxshadow-selected, var(--xy-node-boxshadow-selected-default));\n }\n.react-flow__node-group {\n background-color: var(--xy-node-group-background-color, var(--xy-node-group-background-color-default));\n}\n.react-flow__nodesselection-rect,\n.react-flow__selection {\n background: var(--xy-selection-background-color, var(--xy-selection-background-color-default));\n border: var(--xy-selection-border, var(--xy-selection-border-default));\n}\n.react-flow__nodesselection-rect:focus,\n .react-flow__nodesselection-rect:focus-visible,\n .react-flow__selection:focus,\n .react-flow__selection:focus-visible {\n outline: none;\n }\n.react-flow__controls-button:hover {\n background: var(\n --xy-controls-button-background-color-hover-props,\n var(--xy-controls-button-background-color-hover, var(--xy-controls-button-background-color-hover-default))\n );\n color: var(\n --xy-controls-button-color-hover-props,\n var(--xy-controls-button-color-hover, var(--xy-controls-button-color-hover-default))\n );\n }\n.react-flow__controls-button:disabled {\n pointer-events: none;\n }\n.react-flow__controls-button:disabled svg {\n fill-opacity: 0.4;\n }\n.react-flow__controls-button:last-child {\n border-bottom: none;\n }\n.react-flow__controls.horizontal .react-flow__controls-button {\n border-bottom: none;\n border-right: 1px solid\n var(\n --xy-controls-button-border-color-props,\n var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default))\n );\n }\n.react-flow__controls.horizontal .react-flow__controls-button:last-child {\n border-right: none;\n }\n.react-flow__resize-control {\n position: absolute;\n}\n.react-flow__resize-control.left,\n.react-flow__resize-control.right {\n cursor: ew-resize;\n}\n.react-flow__resize-control.top,\n.react-flow__resize-control.bottom {\n cursor: ns-resize;\n}\n.react-flow__resize-control.top.left,\n.react-flow__resize-control.bottom.right {\n cursor: nwse-resize;\n}\n.react-flow__resize-control.bottom.left,\n.react-flow__resize-control.top.right {\n cursor: nesw-resize;\n}\n/* handle styles */\n.react-flow__resize-control.handle {\n width: 5px;\n height: 5px;\n border: 1px solid #fff;\n border-radius: 1px;\n background-color: var(--xy-resize-background-color, var(--xy-resize-background-color-default));\n translate: -50% -50%;\n}\n.react-flow__resize-control.handle.left {\n left: 0;\n top: 50%;\n}\n.react-flow__resize-control.handle.right {\n left: 100%;\n top: 50%;\n}\n.react-flow__resize-control.handle.top {\n left: 50%;\n top: 0;\n}\n.react-flow__resize-control.handle.bottom {\n left: 50%;\n top: 100%;\n}\n.react-flow__resize-control.handle.top.left {\n left: 0;\n}\n.react-flow__resize-control.handle.bottom.left {\n left: 0;\n}\n.react-flow__resize-control.handle.top.right {\n left: 100%;\n}\n.react-flow__resize-control.handle.bottom.right {\n left: 100%;\n}\n/* line styles */\n.react-flow__resize-control.line {\n border-color: var(--xy-resize-background-color, var(--xy-resize-background-color-default));\n border-width: 0;\n border-style: solid;\n}\n.react-flow__resize-control.line.left,\n.react-flow__resize-control.line.right {\n width: 1px;\n transform: translate(-50%, 0);\n top: 0;\n height: 100%;\n}\n.react-flow__resize-control.line.left {\n left: 0;\n border-left-width: 1px;\n}\n.react-flow__resize-control.line.right {\n left: 100%;\n border-right-width: 1px;\n}\n.react-flow__resize-control.line.top,\n.react-flow__resize-control.line.bottom {\n height: 1px;\n transform: translate(0, -50%);\n left: 0;\n width: 100%;\n}\n.react-flow__resize-control.line.top {\n top: 0;\n border-top-width: 1px;\n}\n.react-flow__resize-control.line.bottom {\n border-bottom-width: 1px;\n top: 100%;\n}\n.react-flow__edge-textbg {\n fill: var(--xy-edge-label-background-color, var(--xy-edge-label-background-color-default));\n}\n.react-flow__edge-text {\n fill: var(--xy-edge-label-color, var(--xy-edge-label-color-default));\n}\n",'\n/* ============================================================================\n Shadow DOM Reset\n ============================================================================ */\n\n:host {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n}\n\n*, *::before, *::after {\n box-sizing: border-box;\n}\n\n/* ============================================================================\n Container\n ============================================================================ */\n\n.ds-dial-plan-viewer {\n width: 100%;\n height: 100%;\n background: var(--ds-color-background, #ffffff);\n border-radius: var(--ds-border-radius, 8px);\n overflow: hidden;\n}\n\n/* ============================================================================\n Base Node Styles\n ============================================================================ */\n\n.ds-dial-plan-node {\n padding: 12px 16px;\n border-radius: var(--ds-border-radius, 8px);\n border: 2px solid var(--ds-color-border, #e2e8f0);\n background: var(--ds-color-background, #ffffff);\n font-family: var(--ds-font-family, -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif);\n font-size: var(--ds-font-size-sm, 14px);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n transition: border-color 0.15s ease, box-shadow 0.15s ease, outline-color 0.15s ease;\n min-width: 140px;\n outline: 3px solid transparent;\n outline-offset: 2px;\n}\n\n.ds-dial-plan-node--selected {\n border-color: var(--ds-color-primary, #3b82f6);\n outline-color: var(--ds-color-primary, #3b82f6);\n box-shadow: 0 0 16px 2px rgba(59, 130, 246, 0.4), 0 4px 12px rgba(59, 130, 246, 0.2);\n}\n\n.ds-dial-plan-node__content,\n.ds-dial-plan-node__header {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px;\n}\n\n.ds-dial-plan-node__icon {\n color: var(--ds-color-text-secondary, #64748b);\n}\n\n.ds-dial-plan-node__label {\n font-weight: 600;\n color: var(--ds-color-text, #1e293b);\n text-align: center;\n}\n\n.ds-dial-plan-node__type-label {\n font-size: var(--ds-font-size-xs, 12px);\n font-weight: 500;\n color: var(--ds-color-text-secondary, #64748b);\n text-transform: uppercase;\n letter-spacing: 0.5px;\n}\n\n.ds-dial-plan-node__name {\n font-weight: 600;\n font-size: var(--ds-font-size-sm, 14px);\n color: var(--ds-color-text, #1e293b);\n text-align: center;\n}\n\n.ds-dial-plan-node__type {\n font-size: var(--ds-font-size-xs, 12px);\n color: var(--ds-color-text-secondary, #64748b);\n}\n\n.ds-dial-plan-node__exits {\n display: flex;\n flex-direction: column;\n gap: 6px;\n margin-top: 12px;\n padding-top: 10px;\n border-top: 1px solid var(--ds-color-border, #e2e8f0);\n}\n\n.ds-dial-plan-node__exit-row {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: 8px;\n position: relative;\n}\n\n.ds-dial-plan-node__exit-label {\n font-size: 11px;\n color: var(--ds-color-text-secondary, #64748b);\n white-space: nowrap;\n}\n\n/* Position handles at the right edge of exit rows */\n.ds-dial-plan-node__exit-row .ds-dial-plan-handle {\n position: absolute;\n right: -16px;\n}\n\n/* ============================================================================\n Start Node\n ============================================================================ */\n\n.ds-dial-plan-node--start {\n background: var(--ds-color-primary, #3b82f6);\n border-color: var(--ds-color-primary, #3b82f6);\n border-radius: 50%;\n width: 60px;\n height: 60px;\n min-width: auto;\n padding: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.ds-dial-plan-node--start .ds-dial-plan-node__content {\n flex-direction: row;\n}\n\n.ds-dial-plan-node--start .ds-dial-plan-node__label {\n color: #ffffff;\n font-size: var(--ds-font-size-sm, 14px);\n}\n\n/* ============================================================================\n Node color theming (driven by --node-color CSS variable from registration)\n ============================================================================ */\n\n.ds-dial-plan-node--themed {\n border-color: var(--node-color);\n background: color-mix(in srgb, var(--node-color) 8%, white);\n}\n\n.ds-dial-plan-node--themed .ds-dial-plan-node__icon {\n color: var(--node-color);\n}\n\n.ds-dial-plan-node--themed.ds-dial-plan-node--selected {\n border-color: var(--node-color);\n outline-color: var(--node-color);\n box-shadow: 0 0 16px 2px color-mix(in srgb, var(--node-color) 40%, transparent),\n 0 4px 12px color-mix(in srgb, var(--node-color) 20%, transparent);\n}\n\n/* ============================================================================\n Per-type node colors (override --themed fallback with hand-crafted gradients)\n ============================================================================ */\n\n.ds-dial-plan-node--schedule {\n background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);\n border-color: var(--ds-color-info, #0ea5e9);\n min-height: 80px;\n}\n.ds-dial-plan-node--schedule .ds-dial-plan-node__icon { color: var(--ds-color-info, #0ea5e9); }\n.ds-dial-plan-node--schedule.ds-dial-plan-node--selected {\n border-color: var(--ds-color-info, #0ea5e9);\n outline-color: var(--ds-color-info, #0ea5e9);\n box-shadow: 0 0 16px 2px rgba(14, 165, 233, 0.4), 0 4px 12px rgba(14, 165, 233, 0.2);\n}\n\n.ds-dial-plan-node--internal-dial {\n background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);\n border-color: var(--ds-color-success, #22c55e);\n}\n.ds-dial-plan-node--internal-dial .ds-dial-plan-node__icon { color: var(--ds-color-success, #22c55e); }\n.ds-dial-plan-node--internal-dial.ds-dial-plan-node--selected {\n border-color: var(--ds-color-success, #22c55e);\n outline-color: var(--ds-color-success, #22c55e);\n box-shadow: 0 0 16px 2px rgba(34, 197, 94, 0.4), 0 4px 12px rgba(34, 197, 94, 0.2);\n}\n\n.ds-dial-plan-node--voicemail {\n background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);\n border-color: var(--ds-color-purple, #a855f7);\n}\n.ds-dial-plan-node--voicemail .ds-dial-plan-node__icon { color: var(--ds-color-purple, #a855f7); }\n.ds-dial-plan-node--voicemail.ds-dial-plan-node--selected {\n border-color: var(--ds-color-purple, #a855f7);\n outline-color: var(--ds-color-purple, #a855f7);\n box-shadow: 0 0 16px 2px rgba(168, 85, 247, 0.4), 0 4px 12px rgba(168, 85, 247, 0.2);\n}\n\n.ds-dial-plan-node--ring-all-users {\n background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);\n border-color: var(--ds-color-warning, #f59e0b);\n}\n.ds-dial-plan-node--ring-all-users .ds-dial-plan-node__icon { color: var(--ds-color-warning, #f59e0b); }\n.ds-dial-plan-node--ring-all-users.ds-dial-plan-node--selected {\n border-color: var(--ds-color-warning, #f59e0b);\n outline-color: var(--ds-color-warning, #f59e0b);\n box-shadow: 0 0 16px 2px rgba(245, 158, 11, 0.4), 0 4px 12px rgba(245, 158, 11, 0.2);\n}\n\n.ds-dial-plan-node--external-dial {\n background: linear-gradient(135deg, #fff1f2 0%, #fecdd3 100%);\n border-color: var(--ds-color-rose, #f43f5e);\n}\n.ds-dial-plan-node--external-dial .ds-dial-plan-node__icon { color: var(--ds-color-rose, #f43f5e); }\n.ds-dial-plan-node--external-dial.ds-dial-plan-node--selected {\n border-color: var(--ds-color-rose, #f43f5e);\n outline-color: var(--ds-color-rose, #f43f5e);\n box-shadow: 0 0 16px 2px rgba(244, 63, 94, 0.4), 0 4px 12px rgba(244, 63, 94, 0.2);\n}\n\n.ds-dial-plan-node--voice-app {\n border: 2px solid transparent;\n background:\n linear-gradient(135deg, #c7d2fe 0%, #ddd6fe 40%, #bae6fd 100%) padding-box,\n linear-gradient(135deg, #38bdf8 0%, #818cf8 35%, #a855f7 60%, #ec4899 100%) border-box;\n position: relative;\n transition: box-shadow 0.15s ease;\n}\n.ds-dial-plan-node--voice-app .ds-dial-plan-node__icon { color: #4f46e5; }\n.ds-dial-plan-node--voice-app.ds-dial-plan-node--selected {\n border-color: transparent;\n outline: none;\n box-shadow: 0 0 16px 2px rgba(99, 102, 241, 0.4), 0 4px 12px rgba(56, 189, 248, 0.2);\n}\n.ds-dial-plan-node--voice-app::after {\n content: \'\';\n position: absolute;\n inset: -7px;\n border-radius: calc(var(--ds-border-radius, 8px) + 5px);\n border: 3px solid transparent;\n background: linear-gradient(135deg, #38bdf8 0%, #818cf8 35%, #a855f7 60%, #ec4899 100%) border-box;\n -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);\n -webkit-mask-composite: xor;\n mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);\n mask-composite: exclude;\n pointer-events: none;\n opacity: 0;\n transition: opacity 0.15s ease;\n z-index: -1;\n}\n.ds-dial-plan-node--voice-app.ds-dial-plan-node--selected::after { opacity: 1; }\n\n.ds-dial-plan-node--menu {\n background: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 100%);\n border-color: #ec4899;\n}\n.ds-dial-plan-node--menu .ds-dial-plan-node__icon { color: #ec4899; }\n.ds-dial-plan-node--menu.ds-dial-plan-node--selected {\n border-color: #ec4899;\n outline-color: #ec4899;\n box-shadow: 0 0 16px 2px rgba(236, 72, 153, 0.4), 0 4px 12px rgba(236, 72, 153, 0.2);\n}\n\n.ds-dial-plan-node--audio-clip {\n background: linear-gradient(135deg, #f0fdfa 0%, #ccfbf1 100%);\n border-color: #14b8a6;\n}\n.ds-dial-plan-node--audio-clip .ds-dial-plan-node__icon { color: #14b8a6; }\n.ds-dial-plan-node--audio-clip.ds-dial-plan-node--selected {\n border-color: #14b8a6;\n outline-color: #14b8a6;\n box-shadow: 0 0 16px 2px rgba(20, 184, 166, 0.4), 0 4px 12px rgba(20, 184, 166, 0.2);\n}\n\n/* ============================================================================\n Menu Config Panel — Options List\n ============================================================================ */\n\n.ds-dial-plan-config-field__header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 6px;\n}\n\n.ds-dial-plan-config-field__header .ds-dial-plan-config-field__label {\n margin: 0;\n}\n\n.ds-dial-plan-menu-options {\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n\n.ds-dial-plan-menu-options__card {\n display: flex;\n align-items: flex-end;\n gap: 6px;\n}\n\n.ds-dial-plan-menu-options__field {\n display: flex;\n flex-direction: column;\n gap: 4px;\n min-width: 0;\n}\n\n.ds-dial-plan-menu-options__field--digit {\n flex: 0 0 64px;\n}\n\n.ds-dial-plan-menu-options__field--label {\n flex: 1;\n}\n\n.ds-dial-plan-menu-options__field-label {\n font-size: 10px;\n font-weight: 600;\n letter-spacing: 0.05em;\n text-transform: uppercase;\n color: var(--ds-color-text-muted, #94a3b8);\n}\n\n.ds-dial-plan-menu-options__field-hint {\n font-weight: 400;\n text-transform: none;\n letter-spacing: 0;\n opacity: 0.8;\n}\n\n.ds-dial-plan-menu-options__remove {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n border: none;\n background: none;\n color: var(--ds-color-text-muted, #94a3b8);\n cursor: pointer;\n border-radius: 4px;\n flex-shrink: 0;\n}\n\n.ds-dial-plan-menu-options__remove:hover {\n color: var(--ds-color-danger, #ef4444);\n background: rgba(239, 68, 68, 0.1);\n}\n\n.ds-dial-plan-menu-options__add {\n padding: 3px 10px;\n border: 1px solid var(--ds-color-primary, #6366f1);\n background: none;\n color: var(--ds-color-primary, #6366f1);\n cursor: pointer;\n border-radius: 4px;\n font-size: 11px;\n font-weight: 500;\n white-space: nowrap;\n}\n\n.ds-dial-plan-menu-options__add:hover:not(:disabled) {\n background: var(--ds-color-primary, #6366f1);\n color: #ffffff;\n}\n\n.ds-dial-plan-menu-options__add:disabled {\n opacity: 0.4;\n cursor: default;\n}\n\n/* ============================================================================\n Handles\n ============================================================================ */\n\n.ds-dial-plan-handle {\n width: 10px;\n height: 10px;\n background: var(--ds-color-border, #e2e8f0);\n border: 2px solid var(--ds-color-background, #ffffff);\n}\n\n.ds-dial-plan-handle--next {\n background: var(--ds-color-text-secondary, #64748b);\n}\n\n/* ============================================================================\n React Flow Overrides (both viewer and editor)\n ============================================================================ */\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__edge-path {\n stroke: var(--ds-color-border, #94a3b8);\n stroke-width: 2;\n}\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__edge.selected .react-flow__edge-path {\n stroke: var(--ds-color-primary, #3b82f6);\n}\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__edge-text {\n font-size: var(--ds-font-size-xs, 12px);\n fill: var(--ds-color-text-secondary, #64748b);\n}\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__background {\n background-color: var(--ds-color-background, #ffffff);\n}\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__minimap {\n background: var(--ds-color-background, #ffffff);\n border: 1px solid var(--ds-color-border, #e2e8f0);\n border-radius: var(--ds-border-radius, 8px);\n}\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__controls {\n border-radius: var(--ds-border-radius, 8px);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n}\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__controls-button {\n background: var(--ds-color-background, #ffffff);\n border-color: var(--ds-color-border, #e2e8f0);\n color: var(--ds-color-text, #1e293b);\n}\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__controls-button:hover {\n background: var(--ds-color-background-hover, #f8fafc);\n}\n\n/* ============================================================================\n Loading, Error, and Empty States\n ============================================================================ */\n\n.ds-dial-plan-viewer--loading,\n.ds-dial-plan-viewer--error,\n.ds-dial-plan-viewer--empty {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.ds-dial-plan-viewer__loading,\n.ds-dial-plan-viewer__error,\n.ds-dial-plan-viewer__empty {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 12px;\n font-family: var(--ds-font-family, -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif);\n font-size: var(--ds-font-size-sm, 14px);\n color: var(--ds-color-text-secondary, #64748b);\n}\n\n.ds-dial-plan-viewer__spinner {\n width: 32px;\n height: 32px;\n border: 3px solid var(--ds-color-border, #e2e8f0);\n border-top-color: var(--ds-color-primary, #3b82f6);\n border-radius: 50%;\n animation: ds-dial-plan-spin 0.8s linear infinite;\n}\n\n@keyframes ds-dial-plan-spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n.ds-dial-plan-viewer__error {\n color: var(--ds-color-danger, #ef4444);\n}\n\n.ds-dial-plan-viewer__error-message {\n font-size: var(--ds-font-size-xs, 12px);\n color: var(--ds-color-text-secondary, #64748b);\n max-width: 300px;\n text-align: center;\n}\n\n/* ============================================================================\n Config Panel\n ============================================================================ */\n\n.ds-dial-plan-config-panel {\n width: 260px;\n height: 100%;\n background: var(--ds-color-background, #ffffff);\n border-left: 1px solid var(--ds-color-border, #e2e8f0);\n display: flex;\n flex-direction: column;\n font-family: var(--ds-font-family, -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif);\n font-size: var(--ds-font-size-sm, 14px);\n overflow-y: auto;\n}\n\n.ds-dial-plan-config-panel__header {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 12px 16px;\n border-bottom: 1px solid var(--ds-color-border, #e2e8f0);\n}\n\n.ds-dial-plan-config-panel__header-icon {\n color: var(--ds-color-text-secondary, #64748b);\n display: flex;\n align-items: center;\n}\n\n.ds-dial-plan-config-panel__header-label {\n flex: 1;\n font-weight: 600;\n color: var(--ds-color-text, #1e293b);\n}\n\n.ds-dial-plan-config-panel__delete {\n color: var(--ds-color-danger, #ef4444);\n background: none;\n border: none;\n padding: 2px;\n cursor: pointer;\n display: flex;\n align-items: center;\n}\n\n.ds-dial-plan-config-panel__delete:hover {\n color: #dc2626;\n}\n\n.ds-dial-plan-config-panel__close {\n background: none;\n border: none;\n color: var(--ds-color-text-secondary, #64748b);\n cursor: pointer;\n padding: 2px;\n display: flex;\n align-items: center;\n}\n\n.ds-dial-plan-config-panel__close:hover {\n color: var(--ds-color-text, #1e293b);\n}\n\n.ds-dial-plan-config-panel__body {\n padding: 16px;\n display: flex;\n flex-direction: column;\n gap: 12px;\n}\n\n.ds-dial-plan-config-field {\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n\n.ds-dial-plan-config-field__label {\n font-size: var(--ds-font-size-xs, 12px);\n font-weight: 500;\n color: var(--ds-color-text-secondary, #64748b);\n text-transform: uppercase;\n letter-spacing: 0.5px;\n}\n\n.ds-dial-plan-config-field__select,\n.ds-dial-plan-config-field__input {\n width: 100%;\n padding: 6px 8px;\n border: 1px solid var(--ds-color-border, #e2e8f0);\n border-radius: var(--ds-border-radius, 8px);\n background: var(--ds-color-background, #ffffff);\n color: var(--ds-color-text, #1e293b);\n font-size: var(--ds-font-size-sm, 14px);\n font-family: inherit;\n outline: none;\n box-sizing: border-box;\n}\n\n.ds-dial-plan-config-field__checkbox {\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: var(--ds-font-size-sm, 14px);\n color: var(--ds-color-text, #1e293b);\n cursor: pointer;\n}\n\n.ds-dial-plan-config-field__hint {\n margin: 4px 0 0;\n font-size: var(--ds-font-size-xs, 12px);\n color: var(--ds-color-text-secondary, #64748b);\n line-height: 1.4;\n}\n\n.ds-dial-plan-config-field__error {\n margin: 4px 0 0;\n font-size: var(--ds-font-size-xs, 12px);\n color: var(--ds-color-danger, #ef4444);\n line-height: 1.4;\n}\n\n.ds-dial-plan-config-field__input[aria-invalid=\'true\'] {\n border-color: var(--ds-color-danger, #ef4444);\n}\n\n.ds-dial-plan-edge-panel__value {\n font-size: var(--ds-font-size-sm, 14px);\n color: var(--ds-color-text, #1e293b);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-edge-panel__value {\n color: #e2e8f0;\n}\n\n.ds-dial-plan-config-field__open-link {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n background: none;\n border: none;\n padding: 0;\n margin-top: 4px;\n font-size: var(--ds-font-size-xs, 12px);\n color: var(--ds-color-primary, #3b82f6);\n cursor: pointer;\n font-family: inherit;\n}\n\n.ds-dial-plan-config-field__open-link:hover {\n text-decoration: underline;\n}\n\n.ds-dial-plan-config-field__select:focus,\n.ds-dial-plan-config-field__input:focus {\n border-color: var(--ds-color-primary, #3b82f6);\n box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);\n}\n\n.ds-dial-plan-config-field__input-wrapper {\n position: relative;\n display: flex;\n align-items: center;\n}\n\n.ds-dial-plan-config-field__input-wrapper .ds-dial-plan-config-field__input {\n padding-right: 28px;\n}\n\n.ds-dial-plan-config-field__clear {\n position: absolute;\n right: 6px;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n padding: 0;\n border: none;\n border-radius: 50%;\n background: transparent;\n color: var(--ds-color-text-secondary, #64748b);\n cursor: pointer;\n}\n\n.ds-dial-plan-config-field__clear:hover {\n background: var(--ds-color-border, #e2e8f0);\n color: var(--ds-color-text, #1e293b);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-field__clear:hover {\n background: rgba(255, 255, 255, 0.1);\n color: #e2e8f0;\n}\n\n.ds-dial-plan-config-field__segmented {\n display: flex;\n border: 1px solid var(--ds-color-border, #e2e8f0);\n border-radius: var(--ds-border-radius, 8px);\n overflow: hidden;\n background: var(--ds-color-background, #ffffff);\n}\n\n.ds-dial-plan-config-field__segmented-option {\n flex: 1;\n padding: 6px 8px;\n border: none;\n background: transparent;\n color: var(--ds-color-text-secondary, #64748b);\n font-size: var(--ds-font-size-sm, 14px);\n font-family: inherit;\n cursor: pointer;\n}\n\n.ds-dial-plan-config-field__segmented-option + .ds-dial-plan-config-field__segmented-option {\n border-left: 1px solid var(--ds-color-border, #e2e8f0);\n}\n\n.ds-dial-plan-config-field__segmented-option--active {\n background: var(--ds-color-primary, #3b82f6);\n color: #ffffff;\n font-weight: 500;\n}\n\n.ds-dial-plan-config-field__hint {\n margin: 4px 0 0;\n font-size: var(--ds-font-size-xs, 11px);\n line-height: 1.4;\n color: var(--ds-color-text-secondary, #64748b);\n}\n\n.ds-dial-plan-node__badge {\n display: block;\n width: fit-content;\n margin: 4px auto 0;\n padding: 2px 8px;\n border-radius: 999px;\n background: var(--ds-color-muted, #eef2ff);\n color: var(--ds-color-text-secondary, #64748b);\n font-size: var(--ds-font-size-xs, 11px);\n font-weight: 500;\n letter-spacing: 0.3px;\n text-align: center;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__badge {\n background: rgba(255, 255, 255, 0.1);\n color: #e2e8f0;\n}\n\n/* ============================================================================\n Resource Combobox\n ============================================================================ */\n\n.ds-resource-combobox {\n border: 1px solid var(--ds-color-border, #e2e8f0);\n border-radius: var(--ds-border-radius, 8px);\n background: var(--ds-color-background, #ffffff);\n overflow: hidden;\n}\n\n.ds-resource-combobox__trigger {\n width: 100%;\n padding: 6px 8px;\n border: 1px solid var(--ds-color-border, #e2e8f0);\n border-radius: var(--ds-border-radius, 8px);\n background: var(--ds-color-background, #ffffff);\n color: var(--ds-color-text, #1e293b);\n font-size: var(--ds-font-size-sm, 14px);\n font-family: inherit;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n text-align: left;\n}\n\n.ds-resource-combobox__trigger:hover {\n border-color: var(--ds-color-primary, #3b82f6);\n}\n\n.ds-resource-combobox__trigger-placeholder {\n color: var(--ds-color-text-secondary, #64748b);\n}\n\n.ds-resource-combobox__trigger-chevron {\n color: var(--ds-color-text-secondary, #64748b);\n opacity: 0.5;\n flex-shrink: 0;\n}\n\n.ds-resource-combobox__input {\n width: 100%;\n padding: 8px 10px;\n border: none;\n border-bottom: 1px solid var(--ds-color-border, #e2e8f0);\n background: transparent;\n color: var(--ds-color-text, #1e293b);\n font-size: var(--ds-font-size-sm, 14px);\n font-family: inherit;\n outline: none;\n box-sizing: border-box;\n}\n\n.ds-resource-combobox__input::placeholder {\n color: var(--ds-color-text-secondary, #64748b);\n}\n\n.ds-resource-combobox__list {\n max-height: 400px;\n overflow-y: auto;\n padding: 4px 0;\n}\n\n.ds-resource-combobox__group [cmdk-group-heading] {\n padding: 6px 10px 2px;\n font-size: var(--ds-font-size-xs, 12px);\n font-weight: 500;\n color: var(--ds-color-text-secondary, #64748b);\n text-transform: uppercase;\n letter-spacing: 0.5px;\n}\n\n.ds-resource-combobox__item {\n padding: 6px 10px;\n font-size: var(--ds-font-size-sm, 14px);\n color: var(--ds-color-text, #1e293b);\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n border-radius: 0;\n}\n\n.ds-resource-combobox__item[data-selected="true"] {\n background: var(--ds-color-primary, #3b82f6);\n color: #ffffff;\n}\n\n.ds-resource-combobox__item--selected {\n font-weight: 500;\n}\n\n.ds-resource-combobox__name {\n flex: 1;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.ds-resource-combobox__ext {\n font-size: var(--ds-font-size-xs, 12px);\n color: var(--ds-color-text-secondary, #64748b);\n margin-left: auto;\n padding-left: 8px;\n white-space: nowrap;\n flex-shrink: 0;\n}\n\n.ds-resource-combobox__check {\n font-size: 12px;\n opacity: 0.7;\n width: 16px;\n text-align: center;\n flex-shrink: 0;\n}\n\n.ds-resource-combobox__create {\n padding: 6px 10px;\n font-size: var(--ds-font-size-sm, 14px);\n color: var(--ds-color-primary, #3b82f6);\n cursor: pointer;\n font-style: italic;\n}\n\n.ds-resource-combobox__create[data-selected="true"] {\n background: var(--ds-color-primary, #3b82f6);\n color: #ffffff;\n}\n\n.ds-resource-combobox__empty {\n padding: 12px 10px;\n font-size: var(--ds-font-size-sm, 14px);\n color: var(--ds-color-text-secondary, #64748b);\n text-align: center;\n}\n\n/* ============================================================================\n Dark Mode\n Activated by .dark class on an ancestor (Tailwind / next-themes convention)\n or data-theme="dark" attribute.\n ============================================================================ */\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-viewer,\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-editor {\n background: #1a1a2e;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node {\n background: #1e1e32;\n border-color: rgba(255, 255, 255, 0.1);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__label,\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__name {\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__icon,\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__type-label,\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__type,\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__exit-label {\n color: #94a3b8;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__exits {\n border-top-color: rgba(255, 255, 255, 0.1);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--themed {\n background: color-mix(in srgb, var(--node-color) 20%, #1a1a2e);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--schedule {\n background: linear-gradient(135deg, #0c2d48 0%, #0a3761 100%);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--internal-dial {\n background: linear-gradient(135deg, #052e16 0%, #064e3b 100%);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--voicemail {\n background: linear-gradient(135deg, #2e1065 0%, #3b0764 100%);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--ring-all-users {\n background: linear-gradient(135deg, #451a03 0%, #78350f 100%);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--external-dial {\n background: linear-gradient(135deg, #4c0519 0%, #881337 100%);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--voice-app {\n background:\n linear-gradient(135deg, #252262 0%, #3b1d7e 40%, #0c3a5e 100%) padding-box,\n linear-gradient(135deg, #38bdf8 0%, #818cf8 35%, #a855f7 60%, #ec4899 100%) border-box;\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--menu {\n background: linear-gradient(135deg, #500724 0%, #831843 100%);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--audio-clip {\n background: linear-gradient(135deg, #042f2e 0%, #115e59 100%);\n}\n\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-handle {\n border-color: #1e1e32;\n}\n\n:is(.dark, [data-theme="dark"]) :is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__background {\n background-color: #1a1a2e;\n}\n\n:is(.dark, [data-theme="dark"]) :is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__edge-path {\n stroke: rgba(255, 255, 255, 0.2);\n}\n\n:is(.dark, [data-theme="dark"]) :is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__edge-text {\n fill: #94a3b8;\n}\n\n:is(.dark, [data-theme="dark"]) :is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__minimap {\n background: #1e1e32;\n border-color: rgba(255, 255, 255, 0.1);\n}\n\n:is(.dark, [data-theme="dark"]) :is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__controls {\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);\n}\n\n:is(.dark, [data-theme="dark"]) :is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__controls-button {\n background: #1e1e32;\n border-color: rgba(255, 255, 255, 0.1);\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) :is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__controls-button:hover {\n background: #2a2a45;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-viewer__loading,\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-viewer__empty {\n color: #94a3b8;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-viewer__spinner {\n border-color: rgba(255, 255, 255, 0.1);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-panel {\n background: #1e1e32;\n border-left-color: rgba(255, 255, 255, 0.1);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-panel__header {\n border-bottom-color: rgba(255, 255, 255, 0.1);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-panel__header-label {\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-panel__close {\n color: #94a3b8;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-panel__close:hover {\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-field__label {\n color: #94a3b8;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-field__select,\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-field__input {\n background: #12122a;\n border-color: rgba(255, 255, 255, 0.1);\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-resource-combobox__trigger {\n background: #12122a;\n border-color: rgba(255, 255, 255, 0.1);\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-resource-combobox {\n border-color: rgba(255, 255, 255, 0.1);\n background: #12122a;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-resource-combobox__input {\n color: #e2e8f0;\n border-bottom-color: rgba(255, 255, 255, 0.1);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-resource-combobox__item {\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-resource-combobox__item--selected {\n color: #e2e8f0;\n}\n\n/* Node Library */\n\n.ds-dial-plan-node-library {\n width: 200px;\n height: 100%;\n background: var(--ds-color-background, #ffffff);\n border-right: 1px solid var(--ds-color-border, #e2e8f0);\n display: flex;\n flex-direction: column;\n gap: 10px;\n padding: 12px;\n font-family: var(--ds-font-family, -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif);\n font-size: var(--ds-font-size-sm, 14px);\n overflow-y: auto;\n}\n\n.ds-dial-plan-node-library__item {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px;\n padding: 10px 12px;\n border-radius: var(--ds-border-radius, 8px);\n border: 2px solid var(--node-color, var(--ds-color-border, #e2e8f0));\n background: color-mix(in srgb, var(--node-color, #ffffff) 10%, white);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n cursor: grab;\n transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;\n}\n\n.ds-dial-plan-node-library__item:hover {\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);\n transform: translateY(-1px);\n}\n\n.ds-dial-plan-node-library__item:active {\n cursor: grabbing;\n transform: scale(0.97);\n}\n\n/* Per-type library item colors */\n.ds-dial-plan-node-library__item--schedule { background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%); border-color: var(--ds-color-info, #0ea5e9); }\n.ds-dial-plan-node-library__item--internal_dial { background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%); border-color: var(--ds-color-success, #22c55e); }\n.ds-dial-plan-node-library__item--voicemail { background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%); border-color: var(--ds-color-purple, #a855f7); }\n.ds-dial-plan-node-library__item--ring_all_users { background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%); border-color: var(--ds-color-warning, #f59e0b); }\n.ds-dial-plan-node-library__item--external_dial { background: linear-gradient(135deg, #fff1f2 0%, #fecdd3 100%); border-color: var(--ds-color-rose, #f43f5e); }\n.ds-dial-plan-node-library__item--voice_app,\n.ds-dial-plan-node-library__item--voice_app:hover {\n border: 2px solid transparent;\n background: linear-gradient(135deg, #c7d2fe 0%, #ddd6fe 40%, #bae6fd 100%) padding-box, linear-gradient(135deg, #38bdf8 0%, #818cf8 35%, #a855f7 60%, #ec4899 100%) border-box;\n}\n.ds-dial-plan-node-library__item--menu { background: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 100%); border-color: #ec4899; }\n.ds-dial-plan-node-library__item--audio_clip { background: linear-gradient(135deg, #f0fdfa 0%, #ccfbf1 100%); border-color: #14b8a6; }\n\n.ds-dial-plan-node-library__item-icon {\n display: flex;\n align-items: center;\n color: var(--node-color);\n}\n.ds-dial-plan-node-library__item--schedule .ds-dial-plan-node-library__item-icon { color: var(--ds-color-info, #0ea5e9); }\n.ds-dial-plan-node-library__item--internal_dial .ds-dial-plan-node-library__item-icon { color: var(--ds-color-success, #22c55e); }\n.ds-dial-plan-node-library__item--voicemail .ds-dial-plan-node-library__item-icon { color: var(--ds-color-purple, #a855f7); }\n.ds-dial-plan-node-library__item--ring_all_users .ds-dial-plan-node-library__item-icon { color: var(--ds-color-warning, #f59e0b); }\n.ds-dial-plan-node-library__item--external_dial .ds-dial-plan-node-library__item-icon { color: var(--ds-color-rose, #f43f5e); }\n.ds-dial-plan-node-library__item--voice_app .ds-dial-plan-node-library__item-icon { color: #4f46e5; }\n.ds-dial-plan-node-library__item--menu .ds-dial-plan-node-library__item-icon { color: #ec4899; }\n.ds-dial-plan-node-library__item--audio_clip .ds-dial-plan-node-library__item-icon { color: #14b8a6; }\n\n.ds-dial-plan-node-library__item-label {\n font-size: var(--ds-font-size-xs, 12px);\n font-weight: 600;\n color: var(--ds-color-text, #1e293b);\n text-align: center;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library {\n background: #1e1e32;\n border-right-color: rgba(255, 255, 255, 0.1);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item {\n background: color-mix(in srgb, var(--node-color, #1e1e32) 20%, #1e1e32);\n border-color: rgba(255, 255, 255, 0.1);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--schedule { background: linear-gradient(135deg, #0c2d48 0%, #0a3761 100%); }\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--internal_dial { background: linear-gradient(135deg, #052e16 0%, #064e3b 100%); }\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--voicemail { background: linear-gradient(135deg, #2e1065 0%, #3b0764 100%); }\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--ring_all_users { background: linear-gradient(135deg, #451a03 0%, #78350f 100%); }\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--external_dial { background: linear-gradient(135deg, #4c0519 0%, #881337 100%); }\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--voice_app { background: linear-gradient(135deg, #252262 0%, #3b1d7e 40%, #0c3a5e 100%) padding-box, linear-gradient(135deg, #38bdf8 0%, #818cf8 35%, #a855f7 60%, #ec4899 100%) border-box; }\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--menu { background: linear-gradient(135deg, #500724 0%, #831843 100%); }\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--audio_clip { background: linear-gradient(135deg, #042f2e 0%, #115e59 100%); }\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item-label {\n color: #e2e8f0;\n}\n\n/* ============================================================================\n Editor Toolbar\n ============================================================================ */\n\n.ds-dial-plan-editor-toolbar {\n position: absolute;\n top: 16px;\n right: 16px;\n z-index: 10;\n display: flex;\n gap: 8px;\n}\n\n.ds-dial-plan-editor-toolbar__button {\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 8px 12px;\n background: var(--ds-color-background, #ffffff);\n border: 1px solid var(--ds-color-border, #e2e8f0);\n border-radius: var(--ds-border-radius, 8px);\n color: var(--ds-color-text, #1e293b);\n font-family: var(--ds-font-family, -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif);\n font-size: var(--ds-font-size-sm, 14px);\n font-weight: 500;\n cursor: pointer;\n transition: all 0.15s ease;\n}\n\n.ds-dial-plan-editor-toolbar__button:hover {\n background: var(--ds-color-background-hover, #f1f5f9);\n border-color: var(--ds-color-border, #cbd5e1);\n}\n\n.ds-dial-plan-editor-toolbar__button:active {\n transform: scale(0.98);\n}\n\n.ds-dial-plan-editor-toolbar__button:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n}\n\n.ds-dial-plan-editor-toolbar__button:disabled:hover {\n background: var(--ds-color-background, #ffffff);\n border-color: var(--ds-color-border, #e2e8f0);\n}\n\n.ds-dial-plan-editor-toolbar__button svg {\n color: var(--ds-color-text-secondary, #64748b);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-editor-toolbar__button {\n background: #1e293b;\n border-color: #334155;\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-editor-toolbar__button:hover {\n background: #334155;\n border-color: #475569;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-editor-toolbar__button:disabled:hover {\n background: #1e293b;\n border-color: #334155;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-editor-toolbar__button svg {\n color: #cbd5e1;\n}\n\n/* Editor Layout */\n\n.ds-dial-plan-editor {\n display: flex;\n width: 100%;\n height: 100%;\n flex: 1;\n min-height: 400px;\n background: var(--ds-color-background, #ffffff);\n overflow: hidden;\n}\n\n.ds-dial-plan-editor--preview {\n min-height: 0;\n}\n\n.ds-dial-plan-editor__canvas {\n flex: 1;\n position: relative;\n}\n\n/* Node Library wrapper */\n\n.ds-dial-plan-node-library-wrapper {\n width: 200px;\n flex-shrink: 0;\n align-self: stretch;\n overflow: hidden;\n}\n\n/* Config panel wrapper (slide-in animation) */\n\n.ds-dial-plan-config-panel-wrapper {\n width: 0;\n flex-shrink: 0;\n align-self: stretch;\n overflow: hidden;\n transition: width 0.2s ease;\n}\n\n.ds-dial-plan-config-panel-wrapper--open {\n width: 260px;\n}\n\n\n'],Me=e.forwardRef((a,t)=>{var l;const{dialstack:r}=N(),i=function(e){const[a,t]=n(()=>e.getAppearance());return o(()=>{if("undefined"==typeof document)return;const n=document.createElement("div"),o=e=>{const n=e.detail;t(null==n?void 0:n.appearance)};return n.addEventListener("dialstack-appearance-update",o),e.addAppearanceTarget(n),()=>{e.removeAppearanceTarget(n),n.removeEventListener("dialstack-appearance-update",o)}},[e]),a}(r),d="dark"===(null==i?void 0:i.theme)?"dark":"light",s=null!==(l=a.theme)&&void 0!==l?l:d;return e.createElement(Se,{stylesheets:$e,className:a.className,style:Object.assign({width:"100%",height:"100%",flex:1,minHeight:0},a.style)},e.createElement("div",{"data-theme":s,style:{display:"flex",flexDirection:"column",flex:1,minHeight:0}},e.createElement(g,null,e.createElement(Pe,Object.assign({ref:t},a)))))});Me.displayName="DialPlan";export{Me as DialPlan};
|
|
1
|
+
import e,{useState as n,useEffect as o,memo as a,useRef as t,useMemo as l,useCallback as r,useId as i,useImperativeHandle as d}from"react";import{Handle as s,Position as c,getStraightPath as u,getSmoothStepPath as p,BaseEdge as f,ReactFlowProvider as g,useReactFlow as b,useUpdateNodeInternals as m,useNodesState as v,useEdgesState as _,applyNodeChanges as h,MarkerType as x,ReactFlow as y,ConnectionLineType as w,Background as k,Controls as E}from"@xyflow/react";import{useDialstackComponents as N}from"@dialstack/sdk-react";import C from"dagre";import{Command as L}from"cmdk";import{parsePhoneNumberFromString as O,AsYouType as z}from"libphonenumber-js";import{createPortal as S}from"react-dom";function R(e,n,o,a){return new(o||(o=Promise))(function(t,l){function r(e){try{d(a.next(e))}catch(e){l(e)}}function i(e){try{d(a.throw(e))}catch(e){l(e)}}function d(e){var n;e.done?t(e.value):(n=e.value,n instanceof o?n:new o(function(e){e(n)})).then(r,i)}d((a=a.apply(e,n||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const T="smoothstep";const j=({icon:n,label:o,timeout:a,subtitle:t})=>e.createElement("div",{className:"ds-dial-plan-node__header"},e.createElement("div",{className:"ds-dial-plan-node__icon"},n),e.createElement("span",{className:"ds-dial-plan-node__type-label"},o,void 0!==a&&e.createElement("span",{style:{textTransform:"none"}}," (",a,"s)")),t&&e.createElement("span",{className:"ds-dial-plan-node__name"},t)),A=({id:n,label:o})=>e.createElement("div",{className:"ds-dial-plan-node__exit-row"},e.createElement("span",{className:"ds-dial-plan-node__exit-label"},o),e.createElement(s,{type:"source",position:c.Right,id:n,className:"ds-dial-plan-handle ds-dial-plan-handle--next"})),I=({exits:n,locale:o})=>0===n.length?null:e.createElement(e.Fragment,null,n.map(n=>e.createElement(A,{key:n.id,id:n.id,label:n.localeExitKey&&(null==o?void 0:o.exits[n.localeExitKey])||n.label})));const F=({resourceId:n,onOpenResource:o,label:a})=>e.createElement("button",{type:"button",className:"ds-dial-plan-config-field__open-link",onClick:()=>o(n)},e.createElement("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),e.createElement("polyline",{points:"15 3 21 3 21 9"}),e.createElement("line",{x1:"10",y1:"14",x2:"21",y2:"3"})),a),D=({groups:a,value:r,loading:i=!1,placeholder:d="Search…",onSelect:s,onCreateResource:c,selectLabel:u="— Select —",noResultsLabel:p="No results found",loadingLabel:f="Loading…",createNewPrefix:g="+ Create new…",extensionLabel:b="Ext."})=>{const[m,v]=n(!1),[_,h]=n(""),x=t(null);o(()=>{var e;if(!m)return;const n=null===(e=x.current)||void 0===e?void 0:e.getRootNode(),o=n instanceof ShadowRoot||n instanceof Document?n:document,a=e=>function(e){"Escape"===e.key&&(v(!1),h(""))}(e),t=e=>function(e){x.current&&!x.current.contains(e.target)&&(v(!1),h(""))}(e);return o.addEventListener("keydown",a),o.addEventListener("mousedown",t),()=>{o.removeEventListener("keydown",a),o.removeEventListener("mousedown",t)}},[m]);const y=l(()=>{if(!r)return"";for(const e of a){const n=e.items.find(e=>e.id===r);if(n)return n.extension_number?`${n.name} (${b} ${n.extension_number})`:n.name}return""},[r,a,b]);if(!m)return e.createElement("button",{type:"button",className:"ds-resource-combobox__trigger",onClick:()=>v(!0)},e.createElement("span",{className:y?"":"ds-resource-combobox__trigger-placeholder"},y||u),e.createElement("svg",{className:"ds-resource-combobox__trigger-chevron",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("polyline",{points:"6 9 12 15 18 9"})));const w=a.some(e=>e.items.length>0);return e.createElement("div",{ref:x},e.createElement(L,{className:"ds-resource-combobox",shouldFilter:!0,loop:!0},e.createElement(L.Input,{className:"ds-resource-combobox__input",placeholder:d,value:_,onValueChange:h,autoFocus:!0}),e.createElement(L.List,{className:"ds-resource-combobox__list"},e.createElement(L.Empty,{className:"ds-resource-combobox__empty"},p),a.map(n=>e.createElement(L.Group,{key:n.label,heading:n.label,className:"ds-resource-combobox__group"},n.items.map(o=>{var a;return e.createElement(L.Item,{key:o.id,value:`${o.name} ${null!==(a=o.extension_number)&&void 0!==a?a:""} ${n.label} ${o.id}`,className:"ds-resource-combobox__item"+(o.id===r?" ds-resource-combobox__item--selected":""),onSelect:()=>{return e=o.id,n=o.extension_number?`${o.name} (${b} ${o.extension_number})`:o.name,s(e,n),v(!1),void h("");var e,n}},e.createElement("span",{className:"ds-resource-combobox__name"},o.name),o.extension_number&&e.createElement("span",{className:"ds-resource-combobox__ext"},"(",b," ",o.extension_number,")"),e.createElement("span",{className:"ds-resource-combobox__check"},o.id===r?"✓":""))}),c&&n.type&&e.createElement(L.Item,{forceMount:!0,value:`create new ${n.label}`,className:"ds-resource-combobox__create",onSelect:()=>function(e){return R(this,void 0,void 0,function*(){if(!c)return;const n=yield c(e);n&&(s(n.id,n.extension_number?`${n.name} (${b} ${n.extension_number})`:n.name),v(!1),h(""))})}(n.type)},g))),!w&&!_&&i&&e.createElement("div",{className:"ds-resource-combobox__empty"},f))))},P=({label:n,htmlFor:o,action:a,children:t})=>e.createElement("div",{className:"ds-dial-plan-config-field"},a?e.createElement("div",{className:"ds-dial-plan-config-field__header"},e.createElement("label",{className:"ds-dial-plan-config-field__label",htmlFor:o},n),a):e.createElement("label",{className:"ds-dial-plan-config-field__label",htmlFor:o},n),t);function M(e,a,t,i){const[d,s]=n([]),[c,u]=n(!0),p=l(()=>JSON.stringify(e),[e]),f=r(()=>Promise.all(e.map(e=>a(e.type,e.options))).then(n=>{s(e.map((e,o)=>{var a,t;return{label:null!==(a=null==i?void 0:i.resourceGroups[e.labelKey])&&void 0!==a?a:e.fallback,type:e.type,items:null!==(t=n[o])&&void 0!==t?t:[]}}))}).catch(()=>{}).finally(()=>u(!1)),[a,i,p]);o(()=>{f()},[f]);const g=r(n=>R(this,void 0,void 0,function*(){var o;if(!t)return;const a=null===(o=e.find(e=>e.type===n))||void 0===o?void 0:o.options,l=yield t(n,a);return l&&(yield f()),l}),[t,f,p]);return{groups:d,loading:c,handleCreateResource:t?g:void 0}}const H=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("circle",{cx:"12",cy:"12",r:"10"}),e.createElement("polyline",{points:"12 6 12 12 16 14"})),$=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"})),K=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),e.createElement("circle",{cx:"9",cy:"7",r:"4"}),e.createElement("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87"}),e.createElement("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})),B=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("polyline",{points:"23 7 23 1 17 1"}),e.createElement("line",{x1:"16",y1:"8",x2:"23",y2:"1"}),e.createElement("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"})),U=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("circle",{cx:"5.5",cy:"11.5",r:"4.5"}),e.createElement("circle",{cx:"18.5",cy:"11.5",r:"4.5"}),e.createElement("line",{x1:"5.5",y1:"16",x2:"18.5",y2:"16"})),W=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M12 8V4H8"}),e.createElement("rect",{width:"16",height:"12",x:"4",y:"8",rx:"2"}),e.createElement("path",{d:"M2 14h2"}),e.createElement("path",{d:"M20 14h2"}),e.createElement("path",{d:"M15 13v2"}),e.createElement("path",{d:"M9 13v2"})),V=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("rect",{x:"3",y:"3",width:"7",height:"7"}),e.createElement("rect",{x:"14",y:"3",width:"7",height:"7"}),e.createElement("rect",{x:"3",y:"14",width:"7",height:"7"}),e.createElement("rect",{x:"14",y:"14",width:"7",height:"7"})),q=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-3.33-2.67m-2.67-3.34a19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91"}),e.createElement("line",{x1:"23",y1:"1",x2:"1",y2:"23"})),G=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),e.createElement("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07"}),e.createElement("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14"})),Y={type:"schedule",flowType:"schedule",localeKey:"schedule",label:"Schedule",description:"Route calls by schedule",color:"#0ea5e9",exits:[{id:"open",label:"Open",configKey:"open",localeExitKey:"open"},{id:"closed",label:"Closed",configKey:"closed",localeExitKey:"closed"},{id:"holiday",label:"Holiday",configKey:"holiday",localeExitKey:"holiday"}],configPanel:({config:n,onConfigChange:o,listResources:a,onCreateResource:t,onOpenResource:l,locale:r})=>{var i,d,s,c,u,p;const{groups:f,loading:g,handleCreateResource:b}=M([{type:"schedule",labelKey:"schedules",fallback:"Schedules"}],a,t,r),m=null!==(i=n.schedule_id)&&void 0!==i?i:"",v=void 0!==n.holiday;return e.createElement(e.Fragment,null,e.createElement(P,{label:null!==(d=null==r?void 0:r.configLabels.schedule)&&void 0!==d?d:"Schedule"},e.createElement(D,{groups:f,value:m,loading:g,placeholder:null!==(s=null==r?void 0:r.configLabels.searchSchedules)&&void 0!==s?s:"Search schedules…",onSelect:(e,n)=>o({schedule_id:e},{scheduleName:n}),onCreateResource:b,selectLabel:null==r?void 0:r.combobox.select,noResultsLabel:null==r?void 0:r.combobox.noResults,loadingLabel:null==r?void 0:r.combobox.loading,createNewPrefix:null==r?void 0:r.combobox.createNew,extensionLabel:null==r?void 0:r.combobox.extensionLabel}),m&&l&&e.createElement(F,{resourceId:m,onOpenResource:l,label:null!==(c=null==r?void 0:r.configLabels.openInNewTab)&&void 0!==c?c:"Open target details"})),e.createElement("div",{className:"ds-dial-plan-config-field"},e.createElement("label",{className:"ds-dial-plan-config-field__checkbox"},e.createElement("input",{type:"checkbox",checked:v,onChange:e=>{return n=e.target.checked,o({holiday:n?null:void 0},{holidayEnabled:n});var n}}),e.createElement("span",null,null!==(u=null==r?void 0:r.configLabels.routeHolidaySeparately)&&void 0!==u?u:"Route holidays separately")),e.createElement("p",{className:"ds-dial-plan-config-field__hint"},null!==(p=null==r?void 0:r.configLabels.routeHolidaySeparatelyHint)&&void 0!==p?p:"When on, holidays route to a dedicated branch you wire below. Otherwise holidays follow the Closed exit.")))},defaultConfig:{schedule_id:""},icon:H,renderNode:(n,o)=>{const a=n.locale,t=o.exits.slice(0,n.holidayEnabled?3:2);return e.createElement(e.Fragment,null,e.createElement(j,{icon:o.icon,label:n.label,subtitle:n.scheduleName}),e.createElement("div",{className:"ds-dial-plan-node__exits"},e.createElement(I,{exits:t,locale:a})))},toFlowNode:e=>{const n=e;return{label:"Schedule",scheduleId:n.config.schedule_id,holidayEnabled:void 0!==n.config.holiday,originalNode:n}},collectResourceIds:(e,n)=>{e.schedule_id&&n.addSchedule(e.schedule_id)},enrichNode:(e,n,o)=>{const a=n.schedules.get(e.scheduleId);return Object.assign(Object.assign({},e),{scheduleName:null==a?void 0:a.name,locale:o})},onConfigChange:(e,n,o)=>{"holiday"in n&&void 0===n.holiday&&(o.setEdges(n=>{const a=n.filter(n=>!(n.source===e&&"holiday"===n.sourceHandle));return a.length!==n.length&&o.updateDirty(o.nodesRef.current,a),a}),requestAnimationFrame(()=>o.updateNodeInternals(e)))},serializeConfig:(e,n,o)=>{var a;return(null===(a=e.data)||void 0===a?void 0:a.holidayEnabled)&&void 0===o.holiday?Object.assign(Object.assign({},o),{holiday:null}):o}},X=({value:n,min:o,max:a,onChange:t,locale:l})=>{var r;return e.createElement(P,{label:null!==(r=null==l?void 0:l.configLabels.timeout)&&void 0!==r?r:"Timeout (seconds)"},e.createElement("input",{className:"ds-dial-plan-config-field__input",type:"number",min:o,max:a,value:n,onChange:e=>t(Math.min(a,Math.max(o,Number(e.target.value)||o)))}))},Z={type:"ring_all_users",flowType:"ringAllUsers",localeKey:"ringAllUsers",label:"Ring All",description:"Ring all account users",color:"#f59e0b",exits:[{id:"next",label:"Timeout",configKey:"next",localeExitKey:"timeout"}],configPanel:({config:n,onConfigChange:o,locale:a})=>{var t;const l=null!==(t=n.timeout)&&void 0!==t?t:24;return e.createElement(X,{value:l,min:1,max:300,onChange:e=>o({timeout:e}),locale:a})},defaultConfig:{timeout:24},icon:K,renderNode:(n,o)=>e.createElement(e.Fragment,null,e.createElement(j,{icon:o.icon,label:n.label,timeout:n.timeout}),o.exits.length>0&&e.createElement("div",{className:"ds-dial-plan-node__exits"},e.createElement(I,{exits:o.exits,locale:n.locale}))),toFlowNode:e=>{const n=e;return{label:"Ring All",timeout:n.config.timeout,originalNode:n}}};function Q({label:n,value:o,options:a,onChange:t,hint:l}){return e.createElement(P,{label:n},e.createElement("div",{className:"ds-dial-plan-config-field__segmented",role:"radiogroup","aria-label":n},a.map(n=>{const a=n.value===o;return e.createElement("button",{key:n.value,type:"button",role:"radio","aria-checked":a,className:"ds-dial-plan-config-field__segmented-option"+(a?" ds-dial-plan-config-field__segmented-option--active":""),onClick:()=>{a||t(n.value)}},n.label)})),l&&e.createElement("p",{className:"ds-dial-plan-config-field__hint"},l))}function J(e,n){return e.startsWith("user_")?n.targetTypes.user:e.startsWith("rg_")?n.targetTypes.ringGroup:e.startsWith("dp_")?n.targetTypes.dialPlan:e.startsWith("qu_")?n.targetTypes.queue:e.startsWith("va_")?n.targetTypes.voiceApp:e.startsWith("svm_")?n.targetTypes.sharedVoicemail:n.nodeTypes.internalDial}function ee(e,n,o){const a=n.users.get(e),t=(null==a?void 0:a.name)||(null==a?void 0:a.email);return t&&(null==a?void 0:a.extension_number)?`${t} (${o.combobox.extensionLabel} ${a.extension_number})`:t}const ne={type:"internal_dial",flowType:"internalDial",localeKey:"internalDial",label:"Internal Extension",description:"Ring a user, group, or plan",color:"#22c55e",exits:[{id:"next",label:"Timeout",configKey:"next",localeExitKey:"timeout"}],configPanel:({config:n,onConfigChange:o,listResources:a,onCreateResource:t,onOpenResource:l,locale:r})=>{var i,d,s,c,u,p,f,g,b;const{groups:m,loading:v,handleCreateResource:_}=M([{type:"user",labelKey:"users",fallback:"Users"},{type:"ring_group",labelKey:"ringGroups",fallback:"Ring Groups"},{type:"queue",labelKey:"queues",fallback:"Queues"},{type:"dial_plan",labelKey:"dialPlans",fallback:"Dial Plans"}],a,t,r),h=null!==(i=n.target_id)&&void 0!==i?i:"",x=null!==(d=n.timeout)&&void 0!==d?d:30,y=null!==(s=n.timeout_override)&&void 0!==s&&s,w=y?1:0;return e.createElement(e.Fragment,null,e.createElement(P,{label:null!==(c=null==r?void 0:r.configLabels.target)&&void 0!==c?c:"Target"},e.createElement(D,{groups:m,value:h,loading:v,placeholder:null!==(u=null==r?void 0:r.configLabels.searchTargets)&&void 0!==u?u:"Search targets…",onSelect:(e,n)=>o({target_id:e},{targetName:n}),onCreateResource:_,selectLabel:null==r?void 0:r.combobox.select,noResultsLabel:null==r?void 0:r.combobox.noResults,loadingLabel:null==r?void 0:r.combobox.loading,createNewPrefix:null==r?void 0:r.combobox.createNew,extensionLabel:null==r?void 0:r.combobox.extensionLabel}),h&&l&&e.createElement(F,{resourceId:h,onOpenResource:l,label:null!==(p=null==r?void 0:r.configLabels.openInNewTab)&&void 0!==p?p:"Open target details"})),e.createElement(Q,{label:null!==(f=null==r?void 0:r.configLabels.timeoutOverride)&&void 0!==f?f:"Override resource timeout",value:y?"on":"off",options:[{value:"off",label:null!==(g=null==r?void 0:r.configLabels.timeoutOverrideOff)&&void 0!==g?g:"Off"},{value:"on",label:null!==(b=null==r?void 0:r.configLabels.timeoutOverrideOn)&&void 0!==b?b:"On"}],onChange:e=>{const n="on"===e;o(n&&0===x?{timeout_override:!0,timeout:1}:{timeout_override:n})}}),e.createElement(X,{value:x,min:w,max:300,onChange:e=>o({timeout:e}),locale:r}))},defaultConfig:{target_id:"",timeout:30,timeout_override:!1},icon:$,renderNode:(n,o)=>e.createElement(e.Fragment,null,e.createElement(j,{icon:o.icon,label:n.label,timeout:n.timeout,subtitle:n.targetName}),e.createElement("div",{className:"ds-dial-plan-node__exits"},e.createElement(I,{exits:o.exits,locale:n.locale}))),toFlowNode:e=>{var n;const o=e;return{label:"Internal Extension",targetId:o.config.target_id,timeout:o.config.timeout,timeoutOverride:null!==(n=o.config.timeout_override)&&void 0!==n&&n,originalNode:o}},collectResourceIds:(e,n)=>{e.target_id&&n.addTarget(e.target_id)},enrichNode:(e,n,o)=>{const a=e.targetId,t=ee(a,n,o),l=J(a,o),r=function(e,n,o,a){var t;if(0===n)return 0;const l=null===(t=a.users.get(e))||void 0===t?void 0:t.timeout_seconds;return o?void 0===n?l:e.startsWith("user_")&&void 0!==l?Math.min(n,l):n:null!=l?l:n}(a,e.timeout,e.timeoutOverride,n);return Object.assign(Object.assign({},e),{targetName:t,targetType:l,timeout:r,locale:o})}};function oe(e){if(!e)return"";const n=O(e);if(!n)return e;return"US"===n.country||"1"===n.countryCallingCode?n.formatNational():n.formatInternational()}const ae=e=>e.startsWith("+")?"+"+e.slice(1).replace(/\D/g,""):e.replace(/\D/g,""),te={type:"external_dial",flowType:"externalDial",localeKey:"externalDial",label:"External Number",description:"Ring an external phone number",color:"#f43f5e",exits:[{id:"next",label:"Timeout",configKey:"next",localeExitKey:"timeout"}],configPanel:({nodeId:a,config:t,onConfigChange:l,onInvalidDraftChange:d,locale:s})=>{var c,u,p,f,g;const b=null!==(c=t.phone_number)&&void 0!==c?c:"",m=null!==(u=t.timeout)&&void 0!==u?u:60,[v,_]=n(oe(b)),[h,x]=n(null),y=i(),w=`${y}-phone`,k=`${y}-error`,[E,N]=n({nodeId:a,e164:b});E.nodeId===a&&E.e164===b||(N({nodeId:a,e164:b}),_(oe(b)),x(null)),o(()=>(null==d||d(null!==h),()=>null==d?void 0:d(!1)),[h,d]);const C=null!==(p=null==s?void 0:s.configLabels.phoneNumberInvalid)&&void 0!==p?p:"Enter a valid phone number, for example (415) 555-1234.",L=r(e=>{const n=ae(e.target.value);_(n?new z("US").input(n):""),x(null);const o=(e=>{const n=e?O(e,"US"):null;return(null==n?void 0:n.isValid())?n.number:null})(n);o?l({phone_number:o}):n||l({phone_number:""})},[l]),S=r(()=>{const e=ae(v);if(!e)return x(null),void l({phone_number:""});const n=O(e,"US");if(null==n?void 0:n.isValid()){const e="US"===n.country||"1"===n.countryCallingCode;return _(e?n.formatNational():n.formatInternational()),x(null),void l({phone_number:n.number})}x(C)},[v,C,l]),R=r(()=>{_(""),x(null),l({phone_number:""})},[l]);return e.createElement(e.Fragment,null,e.createElement(X,{value:m,min:1,max:120,onChange:e=>l({timeout:e}),locale:s}),e.createElement(P,{label:null!==(f=null==s?void 0:s.configLabels.phoneNumber)&&void 0!==f?f:"Phone Number",htmlFor:w},e.createElement("div",{className:"ds-dial-plan-config-field__input-wrapper"},e.createElement("input",{id:w,className:"ds-dial-plan-config-field__input",type:"tel",placeholder:"+1 415 555 1234",value:v,onChange:L,onBlur:S,"aria-invalid":!!h||void 0,"aria-describedby":h?k:void 0}),v&&e.createElement("button",{type:"button",className:"ds-dial-plan-config-field__clear",onClick:R,"aria-label":null!==(g=null==s?void 0:s.configLabels.clearPhoneNumber)&&void 0!==g?g:"Clear phone number"},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none"},e.createElement("path",{d:"M10.5 3.5L3.5 10.5M3.5 3.5l7 7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})))),h&&e.createElement("p",{className:"ds-dial-plan-config-field__error",id:k,role:"alert"},h)))},defaultConfig:{phone_number:"",timeout:60},icon:B,renderNode:(n,o)=>e.createElement(e.Fragment,null,e.createElement(j,{icon:o.icon,label:n.label,timeout:n.timeout,subtitle:n.phoneNumber}),e.createElement("div",{className:"ds-dial-plan-node__exits"},e.createElement(I,{exits:o.exits,locale:n.locale}))),toFlowNode:e=>{const n=e;return{label:"External Number",phoneNumber:oe(n.config.phone_number),timeout:n.config.timeout,originalNode:n}}},le={type:"voice_app",flowType:"voiceApp",localeKey:"voiceApp",label:"Voice App",description:"Route to a voice application",color:"#6366f1",exits:[{id:"next",label:"Timeout",configKey:"next",localeExitKey:"timeout"}],configPanel:({config:n,onConfigChange:a,listResources:t,onCreateResource:l,onOpenResource:r,locale:i})=>{var d,s,c,u,p,f,g,b,m,v;const _=null!==(d=n.voice_app_id)&&void 0!==d?d:"",h=null!==(s=n.mode)&&void 0!==s?s:"control",{groups:x,handleCreateResource:y}=M([{type:"voice_app",labelKey:"voiceApps",fallback:"Voice Apps",options:{notifyEligible:"notify"===h}}],t,l,i);return o(()=>{var e,n;if("notify"!==h||!_)return;const o=null!==(n=null===(e=x[0])||void 0===e?void 0:e.items)&&void 0!==n?n:[];if(0===o.length)return;o.some(e=>e.id===_)||a({voice_app_id:""},{voiceAppName:void 0})},[h,_,x,a]),e.createElement(e.Fragment,null,e.createElement(P,{label:null!==(c=null==i?void 0:i.configLabels.target)&&void 0!==c?c:"Target"},e.createElement(D,{groups:x,value:_,placeholder:null!==(u=null==i?void 0:i.configLabels.searchTargets)&&void 0!==u?u:"Search targets…",onSelect:(e,n)=>a({voice_app_id:e},{voiceAppName:n}),onCreateResource:y,selectLabel:null==i?void 0:i.combobox.select,noResultsLabel:null==i?void 0:i.combobox.noResults,loadingLabel:null==i?void 0:i.combobox.loading,createNewPrefix:null==i?void 0:i.combobox.createNew,extensionLabel:null==i?void 0:i.combobox.extensionLabel}),_&&r&&e.createElement(F,{resourceId:_,onOpenResource:r,label:null!==(p=null==i?void 0:i.configLabels.openInNewTab)&&void 0!==p?p:"Open target details"})),e.createElement(Q,{label:null!==(f=null==i?void 0:i.configLabels.mode)&&void 0!==f?f:"Mode",value:h,options:[{value:"control",label:null!==(g=null==i?void 0:i.voiceAppMode.control)&&void 0!==g?g:"Control"},{value:"notify",label:null!==(b=null==i?void 0:i.voiceAppMode.notify)&&void 0!==b?b:"Notify"}],onChange:e=>a({mode:e}),hint:"notify"===h?null!==(m=null==i?void 0:i.voiceAppMode.notifyHint)&&void 0!==m?m:"Notifies the voice app of the call in the background. The dial plan keeps routing via Next without waiting.":null!==(v=null==i?void 0:i.voiceAppMode.controlHint)&&void 0!==v?v:"Hands the call off to the voice app, which takes over the conversation."}))},defaultConfig:{voice_app_id:"",mode:"control"},icon:W,renderNode:(n,o)=>{var a,t,l,r;const i=n.locale,d="notify"===n.mode,s=d?null!==(a=null==i?void 0:i.voiceAppMode.notifyBadge)&&void 0!==a?a:"Notify mode":null!==(t=null==i?void 0:i.voiceAppMode.controlBadge)&&void 0!==t?t:"Control mode",c=d?null!==(l=null==i?void 0:i.exits.next)&&void 0!==l?l:"Next":null!==(r=null==i?void 0:i.exits.timeout)&&void 0!==r?r:"Timeout";return e.createElement(e.Fragment,null,e.createElement(j,{icon:o.icon,label:n.label,subtitle:n.voiceAppName}),e.createElement("span",{className:"ds-dial-plan-node__badge"},s),e.createElement("div",{className:"ds-dial-plan-node__exits"},e.createElement(A,{id:"next",label:c})))},toFlowNode:e=>{var n;const o=e;return{label:"Voice App",voiceAppId:o.config.voice_app_id,mode:null!==(n=o.config.mode)&&void 0!==n?n:"control",originalNode:o}},normalizeFromAlias:e=>{var n;const o=e.config,a=null!==(n=o.target_id)&&void 0!==n?n:"",t=o.next;return Object.assign(Object.assign({},e),{type:"voice_app",config:Object.assign({voice_app_id:a,mode:"control"},void 0!==t?{next:t}:{})})},collectResourceIds:(e,n)=>{e.voice_app_id&&n.addTarget(e.voice_app_id)},enrichNode:(e,n,o)=>{const a=e.voiceAppId,t=a?ee(a,n,o):void 0;return Object.assign(Object.assign({},e),{voiceAppName:t,locale:o})}},re={type:"voicemail",apiType:"internal_dial",flowType:"voicemail",localeKey:"voicemail",label:"Voicemail",description:"Send to voicemail",color:"#8b5cf6",exits:[],configPanel:({config:n,onConfigChange:o,listResources:a,onCreateResource:t,onOpenResource:l,locale:r})=>{var i,d,s,c;const{groups:u,loading:p,handleCreateResource:f}=M([{type:"user",labelKey:"users",fallback:"Users"},{type:"shared_voicemail",labelKey:"sharedVoicemails",fallback:"Shared Voicemails"}],a,t,r),g=null!==(i=n.target_id)&&void 0!==i?i:"";return e.createElement(P,{label:null!==(d=null==r?void 0:r.configLabels.target)&&void 0!==d?d:"Target"},e.createElement(D,{groups:u,value:g,loading:p,placeholder:null!==(s=null==r?void 0:r.configLabels.searchTargets)&&void 0!==s?s:"Search targets…",onSelect:(e,n)=>o({target_id:e,timeout:0},{targetName:n}),onCreateResource:f,selectLabel:null==r?void 0:r.combobox.select,noResultsLabel:null==r?void 0:r.combobox.noResults,loadingLabel:null==r?void 0:r.combobox.loading,createNewPrefix:null==r?void 0:r.combobox.createNew,extensionLabel:null==r?void 0:r.combobox.extensionLabel}),g&&l&&e.createElement(F,{resourceId:g,onOpenResource:l,label:null!==(c=null==r?void 0:r.configLabels.openInNewTab)&&void 0!==c?c:"Open target details"}))},defaultConfig:{target_id:"",timeout:0},icon:U,renderNode:(n,o)=>e.createElement(j,{icon:o.icon,label:n.label,subtitle:n.targetName}),toFlowNode:e=>{const n=e;return{label:"Voicemail",targetId:n.config.target_id,timeout:0,originalNode:n}},collectResourceIds:(e,n)=>{e.target_id&&n.addTarget(e.target_id)},enrichNode:(e,n,o)=>{const a=e.targetId,t=ee(a,n,o),l=J(a,o);return Object.assign(Object.assign({},e),{targetName:t,targetType:l,locale:o})}},ie=["1","2","3","4","5","6","7","8","9","0","*","#"];function de(e){return"*"===e?"digit_star":"#"===e?"digit_hash":`digit_${e}`}const se=[{id:"timeout",label:"Timeout",configKey:"timeout_next_node",localeExitKey:"timeout"},{id:"invalid",label:"Invalid",configKey:"invalid_next_node",localeExitKey:"invalid"}],ce={type:"menu",flowType:"menu",localeKey:"menu",label:"IVR Menu",description:"Play prompt and route by keypress",color:"#ec4899",exits:[...se],allowSelfLoop:!0,configPanel:({config:n,onConfigChange:o,listResources:a,onCreateResource:t,locale:l})=>{var r,i,d,s,c,u,p,f,g,b;const{groups:m,loading:v,handleCreateResource:_}=M([{type:"audio_clip",labelKey:"audioClips",fallback:"Audio Clips"}],a,t,l),h=null!==(r=n.prompt_clip_id)&&void 0!==r?r:"",x=null!==(i=n.timeout)&&void 0!==i?i:5,y=null!==(d=n.options)&&void 0!==d?d:[{digit:"1"}],w=null!==(s=n.extension_entry_enabled)&&void 0!==s&&s,k=new Set(y.map(e=>e.digit));return e.createElement(e.Fragment,null,e.createElement(P,{label:null!==(c=null==l?void 0:l.configLabels.promptClip)&&void 0!==c?c:"Prompt"},e.createElement(D,{groups:m,value:h,loading:v,placeholder:null!==(u=null==l?void 0:l.configLabels.search)&&void 0!==u?u:"Search...",onSelect:(e,n)=>o({prompt_clip_id:e},{promptClipName:n}),onCreateResource:_,selectLabel:null==l?void 0:l.combobox.select,noResultsLabel:null==l?void 0:l.combobox.noResults,loadingLabel:null==l?void 0:l.combobox.loading,createNewPrefix:null==l?void 0:l.combobox.createNew})),e.createElement(X,{value:x,min:1,max:30,onChange:e=>o({timeout:e}),locale:l}),e.createElement("div",{className:"ds-dial-plan-config-field"},e.createElement("label",{className:"ds-dial-plan-config-field__checkbox"},e.createElement("input",{type:"checkbox",checked:w,onChange:e=>o({extension_entry_enabled:e.target.checked})}),e.createElement("span",null,null!==(p=null==l?void 0:l.configLabels.extensionEntry)&&void 0!==p?p:"Allow extension dialing")),e.createElement("p",{className:"ds-dial-plan-config-field__hint"},null!==(f=null==l?void 0:l.configLabels.extensionEntryHint)&&void 0!==f?f:"When on, callers can key an extension instead of choosing an option.")),e.createElement(P,{label:null!==(g=null==l?void 0:l.configLabels.options)&&void 0!==g?g:"Options",action:e.createElement("button",{type:"button",className:"ds-dial-plan-menu-options__add",onClick:function(){const e=ie.find(e=>!k.has(e));e&&o({options:[...y,{digit:e}]})},disabled:y.length>=12},"+ ",null!==(b=null==l?void 0:l.configLabels.addOption)&&void 0!==b?b:"Add")},e.createElement("div",{className:"ds-dial-plan-menu-options"},y.map((n,a)=>{var t,r,i,d,s,c;return e.createElement("div",{key:a,className:"ds-dial-plan-menu-options__card"},e.createElement("div",{className:"ds-dial-plan-menu-options__field ds-dial-plan-menu-options__field--label"},e.createElement("span",{className:"ds-dial-plan-menu-options__field-label"},null!==(t=null==l?void 0:l.configLabels.optionLabel)&&void 0!==t?t:"Label"," ",e.createElement("span",{className:"ds-dial-plan-menu-options__field-hint"},"(optional)")),e.createElement("input",{type:"text",className:"ds-dial-plan-config-field__input",value:null!==(r=n.label)&&void 0!==r?r:"",maxLength:20,placeholder:null!==(i=null==l?void 0:l.configLabels.optionLabelPlaceholder)&&void 0!==i?i:"e.g. Sales",onChange:e=>{return n=a,t=e.target.value,void o({options:y.map((e,o)=>{if(o!==n)return e;const a=Object.assign({},e);return t?a.label=t:delete a.label,a})});var n,t}})),e.createElement("div",{className:"ds-dial-plan-menu-options__field ds-dial-plan-menu-options__field--digit"},e.createElement("span",{className:"ds-dial-plan-menu-options__field-label"},null!==(d=null==l?void 0:l.configLabels.digit)&&void 0!==d?d:"Digit"),e.createElement("select",{className:"ds-dial-plan-config-field__input",value:n.digit,onChange:e=>{return n=a,t=e.target.value,void o({options:y.map((e,o)=>o===n?Object.assign(Object.assign({},e),{digit:t}):e)});var n,t}},ie.filter(e=>e===n.digit||!k.has(e)).map(n=>e.createElement("option",{key:n,value:n},"*"===n?"✱":n)))),e.createElement("button",{type:"button",className:"ds-dial-plan-menu-options__remove",onClick:()=>{return e=a,void o({options:y.filter((n,o)=>o!==e)});var e},title:null!==(s=null==l?void 0:l.configLabels.removeOption)&&void 0!==s?s:"Remove","aria-label":null!==(c=null==l?void 0:l.configLabels.removeOption)&&void 0!==c?c:"Remove"},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))))}))))},defaultConfig:{prompt_clip_id:"",timeout:5,options:[{digit:"1"}],extension_entry_enabled:!1},icon:V,renderNode:(n,o)=>{var a;const t=null!==(a=n.options)&&void 0!==a?a:[],l=n.locale;return e.createElement(e.Fragment,null,e.createElement(j,{icon:o.icon,label:n.label,timeout:n.timeout,subtitle:n.promptClipName}),e.createElement("div",{className:"ds-dial-plan-node__exits"},t.map(n=>{const o="*"===n.digit?"✱":n.digit,a=n.label?`${n.label} — ${o}`:o;return e.createElement(A,{key:n.digit,id:de(n.digit),label:a})}),e.createElement(I,{exits:o.exits,locale:l})))},toFlowNode:e=>{const n=e;return{label:"IVR Menu",promptClipId:n.config.prompt_clip_id,timeout:n.config.timeout,options:n.config.options,originalNode:n}},createEdgesForNode:(e,n)=>{const o=e,a=[];o.config.timeout_next_node&&n.has(o.config.timeout_next_node)&&a.push({id:`${o.id}-timeout->${o.config.timeout_next_node}`,source:o.id,target:o.config.timeout_next_node,sourceHandle:"timeout",type:T}),o.config.invalid_next_node&&n.has(o.config.invalid_next_node)&&a.push({id:`${o.id}-invalid->${o.config.invalid_next_node}`,source:o.id,target:o.config.invalid_next_node,sourceHandle:"invalid",type:T});for(const e of o.config.options)if(e.next_node&&n.has(e.next_node)){const n=de(e.digit);a.push({id:`${o.id}-${n}->${e.next_node}`,source:o.id,target:e.next_node,sourceHandle:n,type:T})}return a},collectResourceIds:(e,n)=>{e.prompt_clip_id&&n.addAudioClip(e.prompt_clip_id)},enrichNode:(e,n,o)=>{const a=n.audioClips.get(e.promptClipId);return Object.assign(Object.assign({},e),{promptClipName:null==a?void 0:a.name,locale:o})},resolveExitLabel:e=>{const n=function(e){if("digit_star"===e)return"*";if("digit_hash"===e)return"#";const n=e.match(/^digit_(\d)$/);return null==n?void 0:n[1]}(e);if(n)return"*"===n?"✱":n},onConfigChange:(e,n,o)=>{var a,t;if(!n.options)return;const l=n.options,r=new Set(l.map(e=>de(e.digit)));for(const e of se)r.add(e.id);const i=o.nodesRef.current.find(n=>n.id===e),d=null!==(t=null===(a=null==i?void 0:i.data)||void 0===a?void 0:a.options)&&void 0!==t?t:[],s=new Map;if(d.length===l.length)for(let e=0;e<l.length;e++){const n=de(d[e].digit),o=de(l[e].digit);n!==o&&s.set(n,o)}o.setEdges(n=>{const a=n.map(n=>{if(n.source!==e||!n.sourceHandle)return n;const o=s.get(n.sourceHandle);return o?Object.assign(Object.assign({},n),{sourceHandle:o,id:`${e}-${o}->${n.target}`}):n}).filter(n=>n.source!==e||!n.sourceHandle||r.has(n.sourceHandle));return(a.length!==n.length||s.size>0)&&o.updateDirty(o.nodesRef.current,a),a}),requestAnimationFrame(()=>o.updateNodeInternals(e))},serializeConfig:(e,n,o)=>{var a;const t=(null!==(a=o.options)&&void 0!==a?a:[]).map(o=>{const a=de(o.digit),t=n.find(n=>n.source===e.id&&n.sourceHandle===a),l={digit:o.digit};return o.label&&(l.label=o.label),t&&(l.next_node=t.target),l});return Object.assign(Object.assign({},o),{options:t})}},ue={type:"audio_clip",flowType:"audioClip",localeKey:"audioClip",label:"Audio Clip",description:"Play an audio clip",color:"#14b8a6",exits:[{id:"next",label:"Next",configKey:"next",localeExitKey:"next"}],configPanel:({config:n,onConfigChange:o,listResources:a,onCreateResource:t,locale:l})=>{var r,i,d;const{groups:s,loading:c,handleCreateResource:u}=M([{type:"audio_clip",labelKey:"audioClips",fallback:"Audio Clips"}],a,t,l),p=null!==(r=n.clip_id)&&void 0!==r?r:"";return e.createElement(P,{label:null!==(i=null==l?void 0:l.configLabels.audioClip)&&void 0!==i?i:"Audio Clip"},e.createElement(D,{groups:s,value:p,loading:c,placeholder:null!==(d=null==l?void 0:l.configLabels.search)&&void 0!==d?d:"Search...",onSelect:(e,n)=>o({clip_id:e},{clipName:n}),onCreateResource:u,selectLabel:null==l?void 0:l.combobox.select,noResultsLabel:null==l?void 0:l.combobox.noResults,loadingLabel:null==l?void 0:l.combobox.loading,createNewPrefix:null==l?void 0:l.combobox.createNew}))},defaultConfig:{clip_id:""},icon:G,renderNode:(n,o)=>e.createElement(e.Fragment,null,e.createElement(j,{icon:o.icon,label:n.label,subtitle:n.clipName}),e.createElement("div",{className:"ds-dial-plan-node__exits"},e.createElement(I,{exits:o.exits,locale:n.locale}))),toFlowNode:e=>{const n=e;return{label:"Audio Clip",clipId:n.config.clip_id,originalNode:n}},normalizeFromAlias:e=>Object.assign(Object.assign({},e),{type:"audio_clip"}),collectResourceIds:(e,n)=>{e.clip_id&&n.addAudioClip(e.clip_id)},enrichNode:(e,n,o)=>{const a=n.audioClips.get(e.clipId);return Object.assign(Object.assign({},e),{clipName:null==a?void 0:a.name,locale:o})}},pe={type:"hang_up",flowType:"hangUp",localeKey:"hangUp",label:"Hang Up",description:"End the call",color:"#ef4444",exits:[],configPanel:({locale:n})=>{var o;return e.createElement("div",{className:"ds-dial-plan-config-panel__note"},null!==(o=null==n?void 0:n.nodeDescriptions.hangUp)&&void 0!==o?o:"End the call")},defaultConfig:{},icon:q,renderNode:(n,o)=>e.createElement(j,{icon:o.icon,label:n.label}),toFlowNode:e=>({label:"Hang Up",originalNode:e}),enrichNode:(e,n,o)=>Object.assign(Object.assign({},e),{label:o.nodeTypes.hangUp,locale:o})},fe=new class{constructor(){this.byType=new Map,this.byFlowType=new Map,this.legacyTypeAliases=new Map}register(e){this.byType.set(e.type,e),this.byFlowType.set(e.flowType,e)}registerAlias(e,n){this.legacyTypeAliases.set(e,n)}get(e){return this.byType.get(e)}resolveType(e){var n;let o=this.byType.get(e.type);if(!o){const n=this.legacyTypeAliases.get(e.type);n&&(o=this.byType.get(n))}return(null==o?void 0:o.resolveAlias)&&null!==(n=o.resolveAlias(e))&&void 0!==n?n:o}getByFlowType(e){return this.byFlowType.get(e)}getAll(){return Array.from(this.byType.values())}getNodeTypesMap(){const e={};for(const n of this.byType.values())e[n.flowType]=n.component;return e}createEdgesForNode(e,n){const o=this.resolveType(e);if(!o)return[];if(o.createEdgesForNode)return o.createEdgesForNode(e,n);const a=[];for(const t of o.exits){const o=e.config[t.configKey];o&&n.has(o)&&a.push({id:`${e.id}-${t.id}->${o}`,source:e.id,target:o,sourceHandle:t.id,type:T})}return a}},ge=(be=fe,a(function({data:n,selected:o,type:a}){const t=be.getByFlowType(null!=a?a:"");if(!t)return null;const l=t.renderNode(n,t),r=t.type.replace(/_/g,"-");return e.createElement("div",{className:`ds-dial-plan-node ds-dial-plan-node--themed ds-dial-plan-node--${r} ${o?"ds-dial-plan-node--selected":""}`,style:{"--node-color":t.color}},e.createElement(s,{type:"target",position:c.Left,className:"ds-dial-plan-handle"}),l)}));var be;const me=[Y,Z,ne,te,le,re,ce,ue,pe];for(const e of me)fe.register(Object.assign(Object.assign({},e),{component:ge}));const ve=fe.get("internal_dial");ve&&(ve.resolveAlias=e=>{const n=e.config,o=n.target_id;return(null==o?void 0:o.startsWith("svm_"))||0===n.timeout&&!n.next?fe.get("voicemail"):(null==o?void 0:o.startsWith("va_"))?fe.get("voice_app"):void 0}),fe.registerAlias("sound_clip","audio_clip");const _e="__start__";function he(e,n=fe){var o;const a=[],t=[],l=new Map;for(const n of e.nodes)l.set(n.id,n);const r={id:_e,type:"start",position:{x:0,y:0},data:{label:"Start"}};a.push(r),e.entry_node&&l.has(e.entry_node)&&t.push({id:`${_e}->${e.entry_node}`,source:_e,target:e.entry_node,type:T});for(const r of e.nodes){const e=n.resolveType(r),i=null!==(o=r.position)&&void 0!==o?o:{x:0,y:0},d=e&&e.type!==r.type&&e.normalizeFromAlias?e.normalizeFromAlias(r):r;if(e){const n=e.toFlowNode(d),o={id:r.id,type:e.flowType,position:i,data:n};a.push(o)}else a.push({id:r.id,type:"default",position:i,data:{label:r.id,originalNode:r}});const s=n.createEdgesForNode(d,l);t.push(...s)}return e.nodes.some(e=>!e.position)?we(a,t):{nodes:a,edges:t}}function xe(e,n,o){var a,t,l,r;const i=n.find(e=>e.source===_e),d=null!==(a=null==i?void 0:i.target)&&void 0!==a?a:"",s=[];for(const a of e){if(a.id===_e)continue;const e=o.getByFlowType(null!==(t=a.type)&&void 0!==t?t:"");if(!e||!(null===(l=a.data)||void 0===l?void 0:l.originalNode))continue;const i=a.data.originalNode,d=Object.assign({},i.config);for(const n of e.exits)d[n.configKey]=void 0;for(const o of n){if(o.source!==a.id)continue;const n=e.exits.find(e=>e.id===o.sourceHandle);n&&(d[n.configKey]=o.target)}const c=e.serializeConfig?e.serializeConfig(a,n,d):d;s.push({id:a.id,type:null!==(r=e.apiType)&&void 0!==r?r:i.type,position:a.position,config:c})}return{entry_node:d,nodes:s}}function ye(e){var n,o,a;if((null===(n=e.measured)||void 0===n?void 0:n.width)&&(null===(o=e.measured)||void 0===o?void 0:o.height))return{width:e.measured.width,height:e.measured.height};if("start"===e.type)return{width:60,height:60};if("schedule"===e.type)return{width:180,height:140};if("menu"===e.type){const n=e.data.options;return{width:180,height:60+28*((null!==(a=null==n?void 0:n.length)&&void 0!==a?a:1)+2)}}return{width:180,height:80}}function we(e,n){var o;const a=new C.graphlib.Graph;a.setGraph({rankdir:"LR",nodesep:60,ranksep:80,marginx:40,marginy:40}),a.setDefaultEdgeLabel(()=>({}));for(const n of e){const{width:e,height:o}=ye(n);a.setNode(n.id,{width:e,height:o})}for(const e of n)a.setEdge(e.source,e.target);C.layout(a);const t=new Map;for(const n of e){const e=a.node(n.id),{width:o,height:l}=ye(n);t.set(n.id,{x:Math.round(e.x-o/2),y:Math.round(e.y-l/2)})}const l=new Map;for(const e of n){const n=l.get(e.source);n?n.push(e.target):l.set(e.source,[e.target])}const r=e=>{var n;const o=new Set([e]),a=[e];for(;a.length>0;){const e=a.shift();for(const t of null!==(n=l.get(e))&&void 0!==n?n:[])o.has(t)||(o.add(t),a.push(t))}return o};for(const a of e){const e=fe.getByFlowType(null!==(o=a.type)&&void 0!==o?o:"");if(!e||e.exits.length<2)continue;const l=[];for(const o of e.exits){const e=n.find(e=>e.source===a.id&&e.sourceHandle===o.id);e&&l.push(e.target)}if(l.length<2)continue;const i=l[0],d=l[1],s=t.get(i),c=t.get(d);if(!s||!c)continue;if(s.y<=c.y)continue;const u=r(i),p=r(d);if([...u].some(e=>p.has(e)))continue;const f=s.y-c.y;for(const e of u){const n=t.get(e);n&&(n.y-=f)}for(const e of p){const n=t.get(e);n&&(n.y+=f)}}const i=e.find(e=>e.id===_e),d=t.get(_e),s=i&&d?i.position.x-d.x:0,c=i&&d?i.position.y-d.y:0;return{nodes:e.map(e=>{const n=t.get(e.id);return Object.assign(Object.assign({},e),{position:{x:n.x+s,y:n.y+c}})}),edges:n}}function ke(e,n,o,a){const t=fe.getByFlowType(e),l=t?me.find(e=>{var n;return e.type===(null!==(n=t.apiType)&&void 0!==n?n:t.type)}):null;return(null==l?void 0:l.enrichNode)?l.enrichNode(n,o,a):n}const Ee=a(function({data:n}){return e.createElement("div",{className:"ds-dial-plan-node ds-dial-plan-node--start"},e.createElement("div",{className:"ds-dial-plan-node__content"},e.createElement("span",{className:"ds-dial-plan-node__label"},n.label)),e.createElement(s,{type:"source",position:c.Right,className:"ds-dial-plan-handle"}))}),Ne=({registry:n,onAddNode:o,locale:a})=>{const t=n.getAll();return e.createElement("div",{className:"ds-dial-plan-node-library"},t.map(n=>{var t,l;const r=null!==(t=null==a?void 0:a.nodeTypes[n.localeKey])&&void 0!==t?t:n.label,i=null!==(l=null==a?void 0:a.nodeDescriptions[n.localeKey])&&void 0!==l?l:n.description;return e.createElement("div",{key:n.type,className:`ds-dial-plan-node-library__item ds-dial-plan-node-library__item--${n.type}`,style:{"--node-color":n.color},draggable:!0,onClick:()=>o(n.type),onDragStart:e=>{const o=e.currentTarget.getBoundingClientRect(),a=(e.clientX-o.left)/o.width,t=(e.clientY-o.top)/o.height;e.dataTransfer.setData("application/reactflow",n.type),e.dataTransfer.setData("application/reactflow-grab-frac",`${a},${t}`),e.dataTransfer.effectAllowed="move"},title:i},e.createElement("span",{className:"ds-dial-plan-node-library__item-icon"},n.icon),e.createElement("span",{className:"ds-dial-plan-node-library__item-label"},r))}))},Ce=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("polyline",{points:"3 6 5 6 21 6"}),e.createElement("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})),Le=({node:n,registration:a,onConfigChange:l,onInvalidDraftChange:r,onDelete:i,onClose:d,listResources:s,onCreateResource:c,onOpenResource:u,locale:p})=>{var f,g,b;const m=t(null);o(()=>{var e;const n=null===(e=m.current)||void 0===e?void 0:e.getRootNode(),o=n instanceof ShadowRoot||n instanceof Document?n:document,a=e=>function(e){"Escape"===e.key&&d()}(e);return o.addEventListener("keydown",a),()=>o.removeEventListener("keydown",a)},[d]);const v=n.data.originalNode,_=null!==(f=null==v?void 0:v.config)&&void 0!==f?f:{},h=a.configPanel;return e.createElement("div",{ref:m,className:"ds-dial-plan-config-panel"},e.createElement("div",{className:"ds-dial-plan-config-panel__header"},e.createElement("span",{className:"ds-dial-plan-config-panel__header-icon"},a.icon),e.createElement("span",{className:"ds-dial-plan-config-panel__header-label"},a.label),e.createElement("button",{type:"button",className:"ds-dial-plan-config-panel__delete",onClick:()=>{i(n.id),d()},title:null!==(g=null==p?void 0:p.panel.delete_)&&void 0!==g?g:"Delete"},Ce),e.createElement("button",{className:"ds-dial-plan-config-panel__close",onClick:d,title:null!==(b=null==p?void 0:p.panel.close)&&void 0!==b?b:"Close",type:"button"},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})))),e.createElement("div",{className:"ds-dial-plan-config-panel__body"},e.createElement(h,{nodeId:n.id,onInvalidDraftChange:r,config:_,onConfigChange:(e,o)=>l(n.id,e,o),listResources:s,onCreateResource:c,onOpenResource:u,locale:p})))},Oe=a(function({onAutoLayout:n,onSave:o,isDirty:a,hasInvalidDraft:t,locale:l}){var r;const i=null!==(r=null==l?void 0:l.toolbar)&&void 0!==r?r:{autoLayout:"Auto Layout",save:"Save"};return e.createElement("div",{className:"ds-dial-plan-editor-toolbar"},e.createElement("button",{className:"ds-dial-plan-editor-toolbar__button",onClick:n,title:i.autoLayout,type:"button"},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2"},e.createElement("rect",{x:"3",y:"3",width:"7",height:"7"}),e.createElement("rect",{x:"14",y:"3",width:"7",height:"7"}),e.createElement("rect",{x:"14",y:"14",width:"7",height:"7"}),e.createElement("line",{x1:"6.5",y1:"10",x2:"6.5",y2:"17"}),e.createElement("line",{x1:"6.5",y1:"17",x2:"14",y2:"17.5"})),e.createElement("span",null,i.autoLayout)),o&&e.createElement("button",{className:"ds-dial-plan-editor-toolbar__button",onClick:o,title:i.save,type:"button",disabled:!a||t},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2"},e.createElement("path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"}),e.createElement("polyline",{points:"17 21 17 13 7 13 7 21"}),e.createElement("polyline",{points:"7 3 7 8 15 8"})),e.createElement("span",null,i.save)))});var ze;const Se=!("undefined"==typeof window||void 0===window.document||"function"!=typeof HTMLElement.prototype.attachShadow||"undefined"==typeof navigator||/jsdom/i.test(null!==(ze=navigator.userAgent)&&void 0!==ze?ze:"")||"undefined"!=typeof window&&"__STORYBOOK_PREVIEW__"in window),Re=({children:a,stylesheets:l,className:i,style:d})=>{const[s,c]=n(null),u=t(null),p=r(e=>{var n;if(u.current=e,!Se||!e)return;const o=null!==(n=e.shadowRoot)&&void 0!==n?n:e.attachShadow({mode:"open"});c(o)},[]);o(()=>{Se&&u.current&&function(e,n){const o=e.shadowRoot;o&&(o.adoptedStyleSheets=n.map(e=>{const n=new CSSStyleSheet;return n.replaceSync(e),n}))}(u.current,l)},[l]);const f=t(null);return o(()=>{if(!Se&&0!==l.length)return f.current||(f.current=document.createElement("style"),document.head.appendChild(f.current)),f.current.textContent=l.join("\n"),()=>{f.current&&(f.current.remove(),f.current=null)}},[l]),Se?e.createElement("div",{ref:p,className:i,style:d},s&&S(a,s)):e.createElement("div",{className:i,style:d},a)},Te={nodeTypes:{start:"Start",schedule:"Schedule",internalDial:"Internal Extension",voicemail:"Voicemail",externalDial:"External Number",ringAllUsers:"Ring All Users",voiceApp:"Voice App",menu:"IVR Menu",audioClip:"Audio Clip",hangUp:"Hang Up"},exits:{open:"Open",closed:"Closed",holiday:"Holiday",next:"Next",timeout:"Timeout",invalid:"Invalid"},nodeDescriptions:{schedule:"Route calls by schedule",internalDial:"Ring a user, group, or plan",voicemail:"Send to voicemail",ringAllUsers:"Ring all users",externalDial:"Ring an external phone number",voiceApp:"Route to a voice application",menu:"Play prompt and route by keypress",audioClip:"Play an audio clip",hangUp:"End the call"},targetTypes:{user:"User",ringGroup:"Ring Group",dialPlan:"Dial Plan",queue:"Queue",voiceApp:"Voice App",sharedVoicemail:"Shared Voicemail"},resourceGroups:{users:"Users",ringGroups:"Ring Groups",dialPlans:"Dial Plans",queues:"Queues",voiceApps:"Voice Apps",sharedVoicemails:"Shared Voicemails",schedules:"Schedules",audioClips:"Audio Clips"},configLabels:{timeout:"Timeout (seconds)",target:"Target",schedule:"Schedule",search:"Search...",searchTargets:"Search targets...",searchSchedules:"Search schedules...",openInNewTab:"Open target details",promptClip:"Prompt",audioClip:"Audio Clip",digit:"Digit",options:"Options",addOption:"Add Option",removeOption:"Remove",optionLabel:"Label",optionLabelPlaceholder:"e.g. Sales",routeHolidaySeparately:"Route holidays separately",routeHolidaySeparatelyHint:"When on, holidays route to a dedicated branch you wire below. Otherwise holidays follow the Closed exit.",mode:"Mode",phoneNumber:"Phone Number",phoneNumberInvalid:"Enter a valid phone number, for example (415) 555-1234.",clearPhoneNumber:"Clear phone number",timeoutOverride:"Override resource timeout",timeoutOverrideOn:"On",timeoutOverrideOff:"Off",extensionEntry:"Allow extension dialing",extensionEntryHint:"When on, callers can key an extension instead of choosing an option."},voiceAppMode:{control:"Control",notify:"Notify",controlBadge:"Control mode",notifyBadge:"Notify mode",controlHint:"Hands the call off to the voice app, which takes over the conversation.",notifyHint:"Notifies the voice app of the call in the background. The dial plan keeps routing via Next without waiting."},toolbar:{autoLayout:"Auto Layout",save:"Save"},panel:{delete_:"Delete",close:"Close",connection:"Connection",from:"From",exit:"Exit",to:"To"},combobox:{select:"— Select —",search:"Search...",noResults:"No results found",loading:"Loading...",createNew:"+ Create new...",extensionLabel:"Ext.",noName:"(No name)"},status:{loading:"Loading dial plan...",loadError:"Failed to load dial plan",notFound:"No dial plan found",saveError:"Failed to save dial plan",newDialPlan:"New Dial Plan"}},je={schedule_id:"A schedule must be selected in the Schedule node",target_id:"A target must be selected in the Internal Extension node",phone_number:"Enter a valid US phone number in the External Number node"},Ae={schedule:"Schedule",internal_dial:"Internal Extension",ring_all_users:"Ring All",external_dial:"External Number"};const Ie={view:{editable:!1,interactive:!0,showChrome:!0},edit:{editable:!0,interactive:!0,showChrome:!0},preview:{editable:!1,interactive:!1,showChrome:!1}},Fe={id:"",name:"New Dial Plan",entry_node:"",nodes:[],created_at:"",updated_at:""},De=Object.assign({start:Ee},fe.getNodeTypesMap()),Pe={[T]:n=>{const{sourceX:o,sourceY:a,targetX:t,targetY:l,sourcePosition:r,targetPosition:i,markerEnd:d,style:s}=n,c=Math.abs(a-l),[g]=c<=1?u({sourceX:o,sourceY:a,targetX:t,targetY:l}):p({sourceX:o,sourceY:a,targetX:t,targetY:l,sourcePosition:r,targetPosition:i,borderRadius:8});return e.createElement(f,{path:g,markerEnd:d,style:s})}};const Me=e.forwardRef(function({dialPlanId:a,mode:l="view",locale:i=Te,onNodeClick:s,onLoaderStart:c,onLoaderEnd:u,onLoadError:p,onSave:f,onDirtyChange:g,onError:C,className:L,style:O,onCreateResource:z,onOpenResource:S},j){var A;const{editable:I,interactive:F,showChrome:D}=Ie[l],{dialstack:P}=N(),M=b(),H=m(),[$,K]=n(!I||!!a),[B,U]=n(null),[W,V]=v([]),[q,G,Y]=_([]),[X,Z]=n(null),[Q,ee]=n(null),[ne,oe]=n(!1),[ae,te]=n(!1);o(()=>{var e,n;null===(n=(e=ce.current).onDirtyChange)||void 0===n||n.call(e,ne)},[ne]);const[le,re]=n(null),ie=t(null),de=t(W),se=t(q);de.current=W,se.current=q;const ce=t({onLoaderStart:c,onLoaderEnd:u,onLoadError:p,onError:C,onSave:f,onDirtyChange:g});ce.current={onLoaderStart:c,onLoaderEnd:u,onLoadError:p,onError:C,onSave:f,onDirtyChange:g};const ue=t(null),pe=t({schedules:new Map,users:new Map,audioClips:new Map}),ge=t(!1);o(()=>{let e=!1;return function(){R(this,void 0,void 0,function*(){var n,o,t,l,r,d,s,c;if(I&&!a){const{nodes:n,edges:o}=he(Object.assign(Object.assign({},Fe),{name:i.status.newDialPlan}),fe);return void(e||(V(n),G(o),ue.current={nodes:n,edges:o},K(!1)))}K(!0),U(null),null===(o=(n=ce.current).onLoaderStart)||void 0===o||o.call(n);try{const n=yield P.dialPlans.retrieve(a);if(e)return;const o=yield function(e,n){return R(this,void 0,void 0,function*(){var o;const a=new Set,t=new Set,l=new Set;for(const n of e.nodes){const e=fe.resolveType(n),r=e?me.find(n=>{var o;return n.type===(null!==(o=e.apiType)&&void 0!==o?o:e.type)}):null;null===(o=null==r?void 0:r.collectResourceIds)||void 0===o||o.call(r,n.config,{addSchedule:e=>a.add(e),addTarget:e=>t.add(e),addAudioClip:e=>l.add(e)})}const r=l.size>0?n.audioClips.list().catch(()=>[]):Promise.resolve([]),[i,d,...s]=yield Promise.all([Promise.all(Array.from(a).map(e=>R(this,void 0,void 0,function*(){try{return yield n.schedules.retrieve(e)}catch(e){return null}}))),r,...Array.from(t).map(e=>R(this,void 0,void 0,function*(){var o,a;const t=yield n.resolveRoutingTarget(e);return t?{id:t.id,name:t.name||t.id,extension_number:null!==(o=t.extension_number)&&void 0!==o?o:void 0,timeout_seconds:null!==(a=t.timeout_seconds)&&void 0!==a?a:void 0}:null}))]),c=new Map,u=new Map,p=new Map;for(const e of i)e&&c.set(e.id,e);for(const e of s)e&&u.set(e.id,e);for(const e of d)p.set(e.id,e);return{schedules:c,users:u,audioClips:p}})}(n,P);if(e)return;pe.current=o;const{nodes:r,edges:d}=he(n,fe),s=function(e,n,o){return e.map(e=>{var a;const t=fe.getByFlowType(null!==(a=e.type)&&void 0!==a?a:""),l=t?me.find(e=>{var n;return e.type===(null!==(n=t.apiType)&&void 0!==n?n:t.type)}):null;return(null==l?void 0:l.enrichNode)?Object.assign(Object.assign({},e),{data:l.enrichNode(e.data,n,o)}):Object.assign(Object.assign({},e),{data:Object.assign(Object.assign({},e.data),{locale:o})})})}(r,o,i);V(s),G(d),ue.current={nodes:s,edges:d},re({id:n.id,name:n.name}),K(!1),null===(l=(t=ce.current).onLoaderEnd)||void 0===l||l.call(t,n)}catch(n){if(!e){const e=n instanceof Error?n:new Error(String(n));U(e),K(!1),null===(d=(r=ce.current).onLoadError)||void 0===d||d.call(r,e),null===(c=(s=ce.current).onError)||void 0===c||c.call(s,e)}}})}(),()=>{e=!0}},[P,a,V,G]);const be=r((e,n)=>{if(!ue.current)return;const o=(e,n)=>JSON.stringify({nodes:e.map(e=>({id:e.id,data:e.data,position:e.position})),edges:n.map(e=>({id:e.id,source:e.source,target:e.target,sourceHandle:e.sourceHandle}))}),a=o(ue.current.nodes,ue.current.edges)!==o(e,n);oe(a)},[]);o(()=>{ge.current&&(ge.current=!1,be(W,q))},[W,q,be]);const ve=r(e=>{Y(e),e.some(e=>"remove"===e.type)&&queueMicrotask(()=>be(de.current,se.current))},[Y,be]),_e=r(e=>{const n=de.current.filter(n=>n.id!==e).map(n=>{var o;const a=null===(o=n.data)||void 0===o?void 0:o.originalNode;if(!a)return n;const t=a.config;if(!t)return n;const l=Object.assign({},t);let r=!1;for(const n of Object.keys(l))l[n]===e&&(l[n]=void 0,r=!0);return r?Object.assign(Object.assign({},n),{data:Object.assign(Object.assign({},n.data),{originalNode:Object.assign(Object.assign({},a),{config:l})})}):n}),o=se.current.filter(n=>n.source!==e&&n.target!==e);V(n),G(o),be(n,o),X===e&&Z(null)},[V,G,X,be]),ye=r(e=>{const n=new Set(e.filter(e=>"remove"===e.type&&"id"in e&&"__start__"!==e.id).map(e=>"id"in e?e.id:""));if(n.size>0){const e=de.current.filter(e=>!n.has(e.id)).map(e=>{var o;const a=null===(o=e.data)||void 0===o?void 0:o.originalNode;if(!a)return e;const t=a.config;if(!t)return e;const l=Object.assign({},t);let r=!1;for(const e of Object.keys(l))"string"==typeof l[e]&&n.has(l[e])&&(l[e]=void 0,r=!0);return r?Object.assign(Object.assign({},e),{data:Object.assign(Object.assign({},e.data),{originalNode:Object.assign(Object.assign({},a),{config:l})})}):e}),o=se.current.filter(e=>!n.has(e.source)&&!n.has(e.target));V(e),G(o),be(e,o),X&&n.has(X)&&Z(null)}const o=e.filter(e=>"remove"!==e.type&&!("position"===e.type&&"id"in e&&"__start__"===e.id));0!==o.length&&(o.some(e=>"position"===e.type&&!e.dragging)&&(ge.current=!0),V(e=>h(o,e)))},[V,G,be,X]),Ee=r((e,n,o)=>{var a,t;const l=fe.get(e);if(!l)return;const r=`${e}_${crypto.randomUUID().replace(/-/g,"").slice(0,12)}`;let i=n;if(!i){const e=null===(a=ie.current)||void 0===a?void 0:a.getBoundingClientRect(),n=e?e.left+e.width/2:400,o=e?e.top+e.height/2:300;i=M.screenToFlowPosition({x:n,y:o})}const d={id:r,type:null!==(t=l.apiType)&&void 0!==t?t:e,config:Object.assign({},l.defaultConfig)},s=l.toFlowNode(d),c={id:r,type:l.flowType,position:i,data:s,selected:!0};if(V(e=>{const n=e.map(e=>e.selected?Object.assign(Object.assign({},e),{selected:!1}):e);return n.push(c),be(n,se.current),n}),Z(r),o){const e=i;requestAnimationFrame(()=>{var n;const a=null===(n=ie.current)||void 0===n?void 0:n.querySelector(`[data-id="${CSS.escape(r)}"]`);if(!a)return;const t=a.offsetWidth,l=a.offsetHeight;t&&l&&V(n=>n.map(n=>n.id===r?Object.assign(Object.assign({},n),{position:{x:e.x-o.x*t,y:e.y-o.y*l}}):n))})}},[M,V,be]),ze=r(e=>{e.preventDefault();const n=e.dataTransfer.getData("application/reactflow");if(!n)return;const[o,a]=e.dataTransfer.getData("application/reactflow-grab-frac").split(","),t={x:Number(o),y:Number(a)},l=M.screenToFlowPosition({x:e.clientX,y:e.clientY});Ee(n,l,t)},[M,Ee]),Se=r(e=>{e.preventDefault(),e.dataTransfer.dropEffect="move"},[]),Re=r(e=>{var n,o,a;const t={id:`${e.source}-${null!==(n=e.sourceHandle)&&void 0!==n?n:""}->${e.target}`,source:e.source,target:e.target,sourceHandle:null!==(o=e.sourceHandle)&&void 0!==o?o:void 0,targetHandle:null!==(a=e.targetHandle)&&void 0!==a?a:void 0,type:T,markerEnd:{type:x.ArrowClosed,width:12,height:12,color:"#94a3b8"}};G(n=>{const o=n.filter(n=>{var o,a;return!(n.source===e.source&&(null!==(o=n.sourceHandle)&&void 0!==o?o:null)===(null!==(a=e.sourceHandle)&&void 0!==a?a:null))}),a=[...o,t];return be(de.current,a),a})},[G,be]),Me=r((e,n)=>{G(o=>{var a,t,l;const r=o.filter(o=>{var a,t;return o.id!==e.id&&!(o.source===n.source&&(null!==(a=o.sourceHandle)&&void 0!==a?a:null)===(null!==(t=n.sourceHandle)&&void 0!==t?t:null))}),i=[...r,{id:`${n.source}-${null!==(a=n.sourceHandle)&&void 0!==a?a:""}->${n.target}`,source:n.source,target:n.target,sourceHandle:null!==(t=n.sourceHandle)&&void 0!==t?t:void 0,targetHandle:null!==(l=n.targetHandle)&&void 0!==l?l:void 0,type:T,markerEnd:{type:x.ArrowClosed,width:12,height:12,color:"#94a3b8"}}];return be(de.current,i),i})},[G,be]),He=r(e=>{var n;if(!e.source||!e.target||e.source!==e.target)return!0;const o=de.current.find(n=>n.id===e.source),a=fe.getByFlowType(null!==(n=null==o?void 0:o.type)&&void 0!==n?n:"");return!0===(null==a?void 0:a.allowSelfLoop)},[de]),$e=r((e,n,o)=>{var a,t,l;V(a=>{const t=a.map(a=>{var t;if(a.id!==e)return a;const l=function({flowType:e,data:n,configUpdates:o,displayUpdates:a,maps:t,locale:l}){const r=n.originalNode;if(!r)return null;const i=Object.assign(Object.assign({},r),{config:Object.assign(Object.assign({},r.config),o)}),d=fe.getByFlowType(e),s=d?d.toFlowNode(i):Object.assign(Object.assign({},n),{originalNode:i}),c=o.target_id,u=c?J(c,l):void 0,p=d?me.find(e=>{var n;return e.type===(null!==(n=d.apiType)&&void 0!==n?n:d.type)}):null,f=Object.assign(Object.assign({},n),s),g=(null==p?void 0:p.enrichNode)?p.enrichNode(f,t,l):f;return Object.assign(Object.assign(Object.assign({},g),a),u&&{targetType:u})}({flowType:null!==(t=a.type)&&void 0!==t?t:"",data:a.data,configUpdates:n,displayUpdates:o,maps:pe.current,locale:i});return l?Object.assign(Object.assign({},a),{data:l}):a});return be(t,se.current),t});const r=null!==(t=null===(a=de.current.find(n=>n.id===e))||void 0===a?void 0:a.type)&&void 0!==t?t:"",d=fe.getByFlowType(r),s=d?me.find(e=>{var n;return e.type===(null!==(n=d.apiType)&&void 0!==n?n:d.type)}):null;null===(l=null==s?void 0:s.onConfigChange)||void 0===l||l.call(s,e,n,{setEdges:G,updateNodeInternals:H,nodesRef:de,updateDirty:be}),n.target_id&&requestAnimationFrame(()=>H(e));const c=n.target_id;c&&!pe.current.users.has(c)&&P.resolveRoutingTarget(c).then(n=>{var o,a;n&&(pe.current.users.set(c,{id:n.id,name:n.name||n.id,extension_number:null!==(o=n.extension_number)&&void 0!==o?o:void 0,timeout_seconds:null!==(a=n.timeout_seconds)&&void 0!==a?a:void 0}),V(n=>n.map(n=>{var o;return n.id===e?Object.assign(Object.assign({},n),{data:ke(null!==(o=n.type)&&void 0!==o?o:"",n.data,pe.current,i)}):n})))})},[P,V,G,be,H]),Ke=r(()=>{const{nodes:e,edges:n}=we(W,q);V(e),G(n),be(e,n),requestAnimationFrame(()=>M.fitView({padding:.2}))},[W,q,V,G,be,M]),Be=r((e,n)=>R(this,void 0,void 0,function*(){var o;try{const t={expand:["extensions"]};switch(e){case"schedule":return yield P.schedules.list();case"user":return(yield P.users.list(t)).map(e=>{var n,o,a;return{id:e.id,name:e.name||i.combobox.noName,extension_number:null===(a=null===(o=null===(n=e.extensions)||void 0===n?void 0:n.data)||void 0===o?void 0:o[0])||void 0===a?void 0:a.number}});case"ring_group":return yield P.ringGroups.list(t);case"queue":return yield P.queues.list({expand:t.expand});case"dial_plan":{const e=yield P.dialPlans.list(t),n=null!==(o=null==le?void 0:le.id)&&void 0!==o?o:a;return e.filter(e=>e.id!==n)}case"voice_app":{const e=yield P.voiceApps.list(t);if(!(null==n?void 0:n.notifyEligible))return e;try{const n=yield P.aiAgents.list({limit:100}),o=new Set(n.map(e=>e.voice_app_id));return e.filter(e=>!o.has(e.id))}catch(n){return e}}case"shared_voicemail":return yield P.sharedVoicemailBoxes.list();case"audio_clip":return yield P.audioClips.list();default:return[]}}catch(e){return[]}}),[P,a,le,i]),Ue=r(()=>R(this,void 0,void 0,function*(){var e,n,o,t,l,r;try{const l=de.current,r=se.current,d=xe(l,r,fe),s=a?yield P.dialPlans.update(a,d):yield P.dialPlans.create(Object.assign({name:i.status.newDialPlan},d));ue.current={nodes:[...l],edges:[...r]},oe(!1),null===(n=(e=ce.current).onDirtyChange)||void 0===n||n.call(e,!1),null===(t=(o=ce.current).onSave)||void 0===t||t.call(o,s)}catch(e){const n=e instanceof Error?e:new Error(String(e)),o=n.message.includes("/nodes/")?xe(de.current,se.current,fe):null;if(o){const e=n.message.match(/^\/nodes\/(\d+)\//);if(null==e?void 0:e[1]){const n=o.nodes[parseInt(e[1],10)];n&&Z(n.id)}}throw null===(r=(l=ce.current).onError)||void 0===r||r.call(l,new Error(function(e,n){var o,a,t;if(e.startsWith("voice_app notify mode is not supported on AI agent voice apps"))return"A Voice App used in Notify mode is backed by a Managed VoiceAI agent. Managed VoiceAI voice apps must use Control mode.";const l=e.indexOf(": "),r=l>0&&e.startsWith("/")?e.slice(0,l):"",i=l>0?e.slice(l+2):e,d=r.split("/").filter(Boolean);if("entry_node"===d[0])return"The Start node must be connected to another node";if("nodes"===d[0]&&i.includes("minItems"))return"The dial plan must have at least one node";if("nodes"===d[0]&&"config"===d[2]&&d[3]){const e=d[3];if(je[e])return je[e];const l=parseInt(null!==(o=d[1])&&void 0!==o?o:"",10),r=isNaN(l)||null===(a=null==n?void 0:n[l])||void 0===a?void 0:a.type,i=r?null!==(t=Ae[r])&&void 0!==t?t:r:void 0;return i?`Invalid ${e.replace(/_/g," ")} in the ${i} node`:`Invalid ${e.replace(/_/g," ")}`}return r?i:e}(n.message,null==o?void 0:o.nodes))),e}}),[P,a]);d(j,()=>({save:Ue}),[Ue]);const We=r((e,n)=>{"__start__"!==n.id&&(Z(n.id),ee(null))},[]),Ve=r((e,n)=>{ee(n.id),Z(null)},[]),qe=r(e=>{const n=se.current.filter(n=>n.id!==e);G(n),be(de.current,n),ee(null)},[G,be]),Ge=r(()=>{Z(null),ee(null)},[]),Ye=r((e,n)=>{var o;if(!s)return;if("__start__"===n.id)return;const a=null===(o=n.data)||void 0===o?void 0:o.originalNode;a&&s(n.id,a)},[s]),Xe=X?W.find(e=>e.id===X):null,Ze=Xe?fe.getByFlowType(null!==(A=Xe.type)&&void 0!==A?A:""):null,Qe=Q?q.find(e=>e.id===Q):null,Je=!(!Xe||!Ze)||!!Qe;if($)return e.createElement("div",{className:`ds-dial-plan-viewer ds-dial-plan-viewer--loading ${L||""}`,style:O},e.createElement("div",{className:"ds-dial-plan-viewer__loading"},e.createElement("div",{className:"ds-dial-plan-viewer__spinner"}),e.createElement("span",null,i.status.loading)));if(B)return e.createElement("div",{className:`ds-dial-plan-viewer ds-dial-plan-viewer--error ${L||""}`,style:O},e.createElement("div",{className:"ds-dial-plan-viewer__error"},e.createElement("span",null,i.status.loadError),e.createElement("span",{className:"ds-dial-plan-viewer__error-message"},B.message)));if(!I&&0===W.length)return e.createElement("div",{className:`ds-dial-plan-viewer ds-dial-plan-viewer--empty ${L||""}`,style:O},e.createElement("div",{className:"ds-dial-plan-viewer__empty"},e.createElement("span",null,i.status.notFound)));const en=e.createElement(y,{nodes:W,edges:q,nodeTypes:De,edgeTypes:Pe,onNodesChange:I?ye:void 0,onEdgesChange:I?ve:void 0,onConnect:I?Re:void 0,onReconnect:I?Me:void 0,onEdgeClick:I?Ve:void 0,isValidConnection:I?He:void 0,edgesReconnectable:I,onNodeClick:I?We:s?Ye:void 0,onPaneClick:I?Ge:void 0,nodesDraggable:I,nodesConnectable:I,elementsSelectable:I,selectionOnDrag:!1,selectNodesOnDrag:!1,panOnDrag:F,panOnScroll:!1,zoomOnScroll:F,zoomOnPinch:F,zoomOnDoubleClick:F,preventScrolling:F,connectionLineType:w.SmoothStep,selectionKeyCode:null,multiSelectionKeyCode:null,deleteKeyCode:I?["Backspace","Delete"]:null,fitView:!0,fitViewOptions:{padding:F?.2:.15,minZoom:F?.5:0,maxZoom:1.5},minZoom:F?.3:0,maxZoom:2,defaultEdgeOptions:{type:T,animated:!1,markerEnd:{type:x.ArrowClosed,width:12,height:12,color:"#94a3b8"}},proOptions:{hideAttribution:!0}},D&&e.createElement(k,{gap:20,size:1}),D&&e.createElement(E,{showInteractive:!1}),I&&e.createElement(Oe,{onAutoLayout:Ke,onSave:()=>{Ue().catch(()=>{})},isDirty:ne,hasInvalidDraft:ae}));return e.createElement("div",{className:`ds-dial-plan-editor ${"preview"===l?"ds-dial-plan-editor--preview":""} ${L||""}`,style:O},I&&e.createElement("div",{className:"ds-dial-plan-node-library-wrapper"},e.createElement(Ne,{registry:fe,onAddNode:Ee})),e.createElement("div",{ref:ie,className:"ds-dial-plan-editor__canvas",onDrop:I?ze:void 0,onDragOver:I?Se:void 0},en),I&&e.createElement("div",{className:"ds-dial-plan-config-panel-wrapper"+(Je?" ds-dial-plan-config-panel-wrapper--open":"")},Xe&&Ze&&e.createElement(Le,{node:Xe,registration:Ze,onConfigChange:$e,onInvalidDraftChange:te,onDelete:_e,onClose:()=>{Z(null),V(e=>e.map(e=>e.selected?Object.assign(Object.assign({},e),{selected:!1}):e))},listResources:Be,onCreateResource:z,onOpenResource:S,locale:i}),Qe&&e.createElement("div",{className:"ds-dial-plan-config-panel"},e.createElement("div",{className:"ds-dial-plan-config-panel__header"},e.createElement("span",{className:"ds-dial-plan-config-panel__header-icon"},e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M4 8h8v8h8"}),e.createElement("polyline",{points:"17 13 20 16 17 19"}))),e.createElement("span",{className:"ds-dial-plan-config-panel__header-label"},i.panel.connection),e.createElement("button",{type:"button",className:"ds-dial-plan-config-panel__delete",onClick:()=>qe(Qe.id),title:i.panel.delete_},Ce),e.createElement("button",{type:"button",className:"ds-dial-plan-config-panel__close",onClick:()=>{ee(null),G(e=>e.map(e=>e.selected?Object.assign(Object.assign({},e),{selected:!1}):e))},title:i.panel.close},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})))),e.createElement("div",{className:"ds-dial-plan-config-panel__body"},e.createElement("div",{className:"ds-dial-plan-config-field"},e.createElement("span",{className:"ds-dial-plan-config-field__label"},i.panel.from),e.createElement("span",{className:"ds-dial-plan-edge-panel__value"},(()=>{var e,n,o;const a=W.find(e=>e.id===Qe.source),t=a?fe.getByFlowType(null!==(e=a.type)&&void 0!==e?e:""):null,l=null!==(o=null!==(n=null==t?void 0:t.label)&&void 0!==n?n:null==a?void 0:a.type)&&void 0!==o?o:Qe.source;return l.charAt(0).toUpperCase()+l.slice(1)})())),Qe.sourceHandle&&e.createElement("div",{className:"ds-dial-plan-config-field"},e.createElement("span",{className:"ds-dial-plan-config-field__label"},i.panel.exit),e.createElement("span",{className:"ds-dial-plan-edge-panel__value"},(()=>{var e,n,o,a,t;const l=Qe.sourceHandle,r=W.find(e=>e.id===Qe.source),i=r?fe.getByFlowType(null!==(e=r.type)&&void 0!==e?e:""):null,d=i?me.find(e=>{var n;return e.type===(null!==(n=i.apiType)&&void 0!==n?n:i.type)}):null;return null!==(t=null!==(o=null===(n=null==d?void 0:d.resolveExitLabel)||void 0===n?void 0:n.call(d,l))&&void 0!==o?o:null===(a=null==i?void 0:i.exits.find(e=>e.id===l))||void 0===a?void 0:a.label)&&void 0!==t?t:l})())),e.createElement("div",{className:"ds-dial-plan-config-field"},e.createElement("span",{className:"ds-dial-plan-config-field__label"},i.panel.to),e.createElement("span",{className:"ds-dial-plan-edge-panel__value"},(()=>{var e,n,o;const a=W.find(e=>e.id===Qe.target),t=a?fe.getByFlowType(null!==(e=a.type)&&void 0!==e?e:""):null,l=null!==(o=null!==(n=null==t?void 0:t.label)&&void 0!==n?n:null==a?void 0:a.type)&&void 0!==o?o:Qe.target;return l.charAt(0).toUpperCase()+l.slice(1)})()))))))}),He=["/* this gets exported as style.css and can be used for the default theming */\n/* these are the necessary styles for React/Svelte Flow, they get used by base.css and style.css */\n.react-flow {\n direction: ltr;\n\n --xy-edge-stroke-default: #b1b1b7;\n --xy-edge-stroke-width-default: 1;\n --xy-edge-stroke-selected-default: #555;\n\n --xy-connectionline-stroke-default: #b1b1b7;\n --xy-connectionline-stroke-width-default: 1;\n\n --xy-attribution-background-color-default: rgba(255, 255, 255, 0.5);\n\n --xy-minimap-background-color-default: #fff;\n --xy-minimap-mask-background-color-default: rgba(240, 240, 240, 0.6);\n --xy-minimap-mask-stroke-color-default: transparent;\n --xy-minimap-mask-stroke-width-default: 1;\n --xy-minimap-node-background-color-default: #e2e2e2;\n --xy-minimap-node-stroke-color-default: transparent;\n --xy-minimap-node-stroke-width-default: 2;\n\n --xy-background-color-default: transparent;\n --xy-background-pattern-dots-color-default: #91919a;\n --xy-background-pattern-lines-color-default: #eee;\n --xy-background-pattern-cross-color-default: #e2e2e2;\n background-color: var(--xy-background-color, var(--xy-background-color-default));\n --xy-node-color-default: inherit;\n --xy-node-border-default: 1px solid #1a192b;\n --xy-node-background-color-default: #fff;\n --xy-node-group-background-color-default: rgba(240, 240, 240, 0.25);\n --xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(0, 0, 0, 0.08);\n --xy-node-boxshadow-selected-default: 0 0 0 0.5px #1a192b;\n --xy-node-border-radius-default: 3px;\n\n --xy-handle-background-color-default: #1a192b;\n --xy-handle-border-color-default: #fff;\n\n --xy-selection-background-color-default: rgba(0, 89, 220, 0.08);\n --xy-selection-border-default: 1px dotted rgba(0, 89, 220, 0.8);\n\n --xy-controls-button-background-color-default: #fefefe;\n --xy-controls-button-background-color-hover-default: #f4f4f4;\n --xy-controls-button-color-default: inherit;\n --xy-controls-button-color-hover-default: inherit;\n --xy-controls-button-border-color-default: #eee;\n --xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, 0.08);\n\n --xy-edge-label-background-color-default: #ffffff;\n --xy-edge-label-color-default: inherit;\n --xy-resize-background-color-default: #3367d9;\n}\n.react-flow.dark {\n --xy-edge-stroke-default: #3e3e3e;\n --xy-edge-stroke-width-default: 1;\n --xy-edge-stroke-selected-default: #727272;\n\n --xy-connectionline-stroke-default: #b1b1b7;\n --xy-connectionline-stroke-width-default: 1;\n\n --xy-attribution-background-color-default: rgba(150, 150, 150, 0.25);\n\n --xy-minimap-background-color-default: #141414;\n --xy-minimap-mask-background-color-default: rgba(60, 60, 60, 0.6);\n --xy-minimap-mask-stroke-color-default: transparent;\n --xy-minimap-mask-stroke-width-default: 1;\n --xy-minimap-node-background-color-default: #2b2b2b;\n --xy-minimap-node-stroke-color-default: transparent;\n --xy-minimap-node-stroke-width-default: 2;\n\n --xy-background-color-default: #141414;\n --xy-background-pattern-dots-color-default: #555;\n --xy-background-pattern-lines-color-default: #333;\n --xy-background-pattern-cross-color-default: #333;\n --xy-node-color-default: #f8f8f8;\n --xy-node-border-default: 1px solid #3c3c3c;\n --xy-node-background-color-default: #1e1e1e;\n --xy-node-group-background-color-default: rgba(240, 240, 240, 0.25);\n --xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(255, 255, 255, 0.08);\n --xy-node-boxshadow-selected-default: 0 0 0 0.5px #999;\n\n --xy-handle-background-color-default: #bebebe;\n --xy-handle-border-color-default: #1e1e1e;\n\n --xy-selection-background-color-default: rgba(200, 200, 220, 0.08);\n --xy-selection-border-default: 1px dotted rgba(200, 200, 220, 0.8);\n\n --xy-controls-button-background-color-default: #2b2b2b;\n --xy-controls-button-background-color-hover-default: #3e3e3e;\n --xy-controls-button-color-default: #f8f8f8;\n --xy-controls-button-color-hover-default: #fff;\n --xy-controls-button-border-color-default: #5b5b5b;\n --xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, 0.08);\n\n --xy-edge-label-background-color-default: #141414;\n --xy-edge-label-color-default: #f8f8f8;\n}\n.react-flow__background {\n background-color: var(--xy-background-color-props, var(--xy-background-color, var(--xy-background-color-default)));\n pointer-events: none;\n z-index: -1;\n}\n.react-flow__container {\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n}\n.react-flow__pane {\n z-index: 1;\n touch-action: none;\n}\n.react-flow__pane.draggable {\n cursor: grab;\n }\n.react-flow__pane.dragging {\n cursor: grabbing;\n }\n.react-flow__pane.selection {\n cursor: pointer;\n }\n.react-flow__viewport {\n transform-origin: 0 0;\n z-index: 2;\n pointer-events: none;\n}\n.react-flow__renderer {\n z-index: 4;\n}\n.react-flow__selection {\n z-index: 6;\n}\n.react-flow__nodesselection-rect:focus,\n.react-flow__nodesselection-rect:focus-visible {\n outline: none;\n}\n.react-flow__edge-path {\n stroke: var(--xy-edge-stroke, var(--xy-edge-stroke-default));\n stroke-width: var(--xy-edge-stroke-width, var(--xy-edge-stroke-width-default));\n fill: none;\n}\n.react-flow__connection-path {\n stroke: var(--xy-connectionline-stroke, var(--xy-connectionline-stroke-default));\n stroke-width: var(--xy-connectionline-stroke-width, var(--xy-connectionline-stroke-width-default));\n fill: none;\n}\n.react-flow .react-flow__edges {\n position: absolute;\n}\n.react-flow .react-flow__edges svg {\n overflow: visible;\n position: absolute;\n pointer-events: none;\n }\n.react-flow__edge {\n pointer-events: visibleStroke;\n}\n.react-flow__edge.selectable {\n cursor: pointer;\n }\n.react-flow__edge.animated path {\n stroke-dasharray: 5;\n animation: dashdraw 0.5s linear infinite;\n }\n.react-flow__edge.animated path.react-flow__edge-interaction {\n stroke-dasharray: none;\n animation: none;\n }\n.react-flow__edge.inactive {\n pointer-events: none;\n }\n.react-flow__edge.selected,\n .react-flow__edge:focus,\n .react-flow__edge:focus-visible {\n outline: none;\n }\n.react-flow__edge.selected .react-flow__edge-path,\n .react-flow__edge.selectable:focus .react-flow__edge-path,\n .react-flow__edge.selectable:focus-visible .react-flow__edge-path {\n stroke: var(--xy-edge-stroke-selected, var(--xy-edge-stroke-selected-default));\n }\n.react-flow__edge-textwrapper {\n pointer-events: all;\n }\n.react-flow__edge .react-flow__edge-text {\n pointer-events: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n }\n/* Arrowhead marker styles - use CSS custom properties as default */\n.react-flow__arrowhead polyline {\n stroke: var(--xy-edge-stroke, var(--xy-edge-stroke-default));\n}\n.react-flow__arrowhead polyline.arrowclosed {\n fill: var(--xy-edge-stroke, var(--xy-edge-stroke-default));\n}\n.react-flow__connection {\n pointer-events: none;\n}\n.react-flow__connection .animated {\n stroke-dasharray: 5;\n animation: dashdraw 0.5s linear infinite;\n }\nsvg.react-flow__connectionline {\n z-index: 1001;\n overflow: visible;\n position: absolute;\n}\n.react-flow__nodes {\n pointer-events: none;\n transform-origin: 0 0;\n}\n.react-flow__node {\n position: absolute;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n pointer-events: all;\n transform-origin: 0 0;\n box-sizing: border-box;\n cursor: default;\n}\n.react-flow__node.selectable {\n cursor: pointer;\n }\n.react-flow__node.draggable {\n cursor: grab;\n pointer-events: all;\n }\n.react-flow__node.draggable.dragging {\n cursor: grabbing;\n }\n.react-flow__nodesselection {\n z-index: 3;\n transform-origin: left top;\n pointer-events: none;\n}\n.react-flow__nodesselection-rect {\n position: absolute;\n pointer-events: all;\n cursor: grab;\n }\n.react-flow__handle {\n position: absolute;\n pointer-events: none;\n min-width: 5px;\n min-height: 5px;\n width: 6px;\n height: 6px;\n background-color: var(--xy-handle-background-color, var(--xy-handle-background-color-default));\n border: 1px solid var(--xy-handle-border-color, var(--xy-handle-border-color-default));\n border-radius: 100%;\n}\n.react-flow__handle.connectingfrom {\n pointer-events: all;\n }\n.react-flow__handle.connectionindicator {\n pointer-events: all;\n cursor: crosshair;\n }\n.react-flow__handle-bottom {\n top: auto;\n left: 50%;\n bottom: 0;\n transform: translate(-50%, 50%);\n }\n.react-flow__handle-top {\n top: 0;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n.react-flow__handle-left {\n top: 50%;\n left: 0;\n transform: translate(-50%, -50%);\n }\n.react-flow__handle-right {\n top: 50%;\n right: 0;\n transform: translate(50%, -50%);\n }\n.react-flow__edgeupdater {\n cursor: move;\n pointer-events: all;\n}\n.react-flow__pane.selection .react-flow__panel {\n pointer-events: none;\n}\n.react-flow__panel {\n position: absolute;\n z-index: 5;\n margin: 15px;\n}\n.react-flow__panel.top {\n top: 0;\n }\n.react-flow__panel.bottom {\n bottom: 0;\n }\n.react-flow__panel.top.center, .react-flow__panel.bottom.center {\n left: 50%;\n transform: translateX(-15px) translateX(-50%);\n }\n.react-flow__panel.left {\n left: 0;\n }\n.react-flow__panel.right {\n right: 0;\n }\n.react-flow__panel.left.center, .react-flow__panel.right.center {\n top: 50%;\n transform: translateY(-15px) translateY(-50%);\n }\n.react-flow__attribution {\n font-size: 10px;\n background: var(--xy-attribution-background-color, var(--xy-attribution-background-color-default));\n padding: 2px 3px;\n margin: 0;\n}\n.react-flow__attribution a {\n text-decoration: none;\n color: #999;\n }\n@keyframes dashdraw {\n from {\n stroke-dashoffset: 10;\n }\n}\n.react-flow__edgelabel-renderer {\n position: absolute;\n width: 100%;\n height: 100%;\n pointer-events: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n left: 0;\n top: 0;\n}\n.react-flow__viewport-portal {\n position: absolute;\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n}\n.react-flow__minimap {\n background: var(\n --xy-minimap-background-color-props,\n var(--xy-minimap-background-color, var(--xy-minimap-background-color-default))\n );\n}\n.react-flow__minimap-svg {\n display: block;\n }\n.react-flow__minimap-mask {\n fill: var(\n --xy-minimap-mask-background-color-props,\n var(--xy-minimap-mask-background-color, var(--xy-minimap-mask-background-color-default))\n );\n stroke: var(\n --xy-minimap-mask-stroke-color-props,\n var(--xy-minimap-mask-stroke-color, var(--xy-minimap-mask-stroke-color-default))\n );\n stroke-width: var(\n --xy-minimap-mask-stroke-width-props,\n var(--xy-minimap-mask-stroke-width, var(--xy-minimap-mask-stroke-width-default))\n );\n }\n.react-flow__minimap-node {\n fill: var(\n --xy-minimap-node-background-color-props,\n var(--xy-minimap-node-background-color, var(--xy-minimap-node-background-color-default))\n );\n stroke: var(\n --xy-minimap-node-stroke-color-props,\n var(--xy-minimap-node-stroke-color, var(--xy-minimap-node-stroke-color-default))\n );\n stroke-width: var(\n --xy-minimap-node-stroke-width-props,\n var(--xy-minimap-node-stroke-width, var(--xy-minimap-node-stroke-width-default))\n );\n }\n.react-flow__background-pattern.dots {\n fill: var(\n --xy-background-pattern-color-props,\n var(--xy-background-pattern-color, var(--xy-background-pattern-dots-color-default))\n );\n }\n.react-flow__background-pattern.lines {\n stroke: var(\n --xy-background-pattern-color-props,\n var(--xy-background-pattern-color, var(--xy-background-pattern-lines-color-default))\n );\n }\n.react-flow__background-pattern.cross {\n stroke: var(\n --xy-background-pattern-color-props,\n var(--xy-background-pattern-color, var(--xy-background-pattern-cross-color-default))\n );\n }\n.react-flow__controls {\n display: flex;\n flex-direction: column;\n box-shadow: var(--xy-controls-box-shadow, var(--xy-controls-box-shadow-default));\n}\n.react-flow__controls.horizontal {\n flex-direction: row;\n }\n.react-flow__controls-button {\n display: flex;\n justify-content: center;\n align-items: center;\n height: 26px;\n width: 26px;\n padding: 4px;\n border: none;\n background: var(--xy-controls-button-background-color, var(--xy-controls-button-background-color-default));\n border-bottom: 1px solid\n var(\n --xy-controls-button-border-color-props,\n var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default))\n );\n color: var(\n --xy-controls-button-color-props,\n var(--xy-controls-button-color, var(--xy-controls-button-color-default))\n );\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n }\n.react-flow__controls-button svg {\n width: 100%;\n max-width: 12px;\n max-height: 12px;\n fill: currentColor;\n }\n.react-flow__edge.updating .react-flow__edge-path {\n stroke: #777;\n }\n.react-flow__edge-text {\n font-size: 10px;\n }\n.react-flow__node.selectable:focus,\n .react-flow__node.selectable:focus-visible {\n outline: none;\n }\n.react-flow__node-input,\n.react-flow__node-default,\n.react-flow__node-output,\n.react-flow__node-group {\n padding: 10px;\n border-radius: var(--xy-node-border-radius, var(--xy-node-border-radius-default));\n width: 150px;\n font-size: 12px;\n color: var(--xy-node-color, var(--xy-node-color-default));\n text-align: center;\n border: var(--xy-node-border, var(--xy-node-border-default));\n background-color: var(--xy-node-background-color, var(--xy-node-background-color-default));\n}\n.react-flow__node-input.selectable:hover, .react-flow__node-default.selectable:hover, .react-flow__node-output.selectable:hover, .react-flow__node-group.selectable:hover {\n box-shadow: var(--xy-node-boxshadow-hover, var(--xy-node-boxshadow-hover-default));\n }\n.react-flow__node-input.selectable.selected,\n .react-flow__node-input.selectable:focus,\n .react-flow__node-input.selectable:focus-visible,\n .react-flow__node-default.selectable.selected,\n .react-flow__node-default.selectable:focus,\n .react-flow__node-default.selectable:focus-visible,\n .react-flow__node-output.selectable.selected,\n .react-flow__node-output.selectable:focus,\n .react-flow__node-output.selectable:focus-visible,\n .react-flow__node-group.selectable.selected,\n .react-flow__node-group.selectable:focus,\n .react-flow__node-group.selectable:focus-visible {\n box-shadow: var(--xy-node-boxshadow-selected, var(--xy-node-boxshadow-selected-default));\n }\n.react-flow__node-group {\n background-color: var(--xy-node-group-background-color, var(--xy-node-group-background-color-default));\n}\n.react-flow__nodesselection-rect,\n.react-flow__selection {\n background: var(--xy-selection-background-color, var(--xy-selection-background-color-default));\n border: var(--xy-selection-border, var(--xy-selection-border-default));\n}\n.react-flow__nodesselection-rect:focus,\n .react-flow__nodesselection-rect:focus-visible,\n .react-flow__selection:focus,\n .react-flow__selection:focus-visible {\n outline: none;\n }\n.react-flow__controls-button:hover {\n background: var(\n --xy-controls-button-background-color-hover-props,\n var(--xy-controls-button-background-color-hover, var(--xy-controls-button-background-color-hover-default))\n );\n color: var(\n --xy-controls-button-color-hover-props,\n var(--xy-controls-button-color-hover, var(--xy-controls-button-color-hover-default))\n );\n }\n.react-flow__controls-button:disabled {\n pointer-events: none;\n }\n.react-flow__controls-button:disabled svg {\n fill-opacity: 0.4;\n }\n.react-flow__controls-button:last-child {\n border-bottom: none;\n }\n.react-flow__controls.horizontal .react-flow__controls-button {\n border-bottom: none;\n border-right: 1px solid\n var(\n --xy-controls-button-border-color-props,\n var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default))\n );\n }\n.react-flow__controls.horizontal .react-flow__controls-button:last-child {\n border-right: none;\n }\n.react-flow__resize-control {\n position: absolute;\n}\n.react-flow__resize-control.left,\n.react-flow__resize-control.right {\n cursor: ew-resize;\n}\n.react-flow__resize-control.top,\n.react-flow__resize-control.bottom {\n cursor: ns-resize;\n}\n.react-flow__resize-control.top.left,\n.react-flow__resize-control.bottom.right {\n cursor: nwse-resize;\n}\n.react-flow__resize-control.bottom.left,\n.react-flow__resize-control.top.right {\n cursor: nesw-resize;\n}\n/* handle styles */\n.react-flow__resize-control.handle {\n width: 5px;\n height: 5px;\n border: 1px solid #fff;\n border-radius: 1px;\n background-color: var(--xy-resize-background-color, var(--xy-resize-background-color-default));\n translate: -50% -50%;\n}\n.react-flow__resize-control.handle.left {\n left: 0;\n top: 50%;\n}\n.react-flow__resize-control.handle.right {\n left: 100%;\n top: 50%;\n}\n.react-flow__resize-control.handle.top {\n left: 50%;\n top: 0;\n}\n.react-flow__resize-control.handle.bottom {\n left: 50%;\n top: 100%;\n}\n.react-flow__resize-control.handle.top.left {\n left: 0;\n}\n.react-flow__resize-control.handle.bottom.left {\n left: 0;\n}\n.react-flow__resize-control.handle.top.right {\n left: 100%;\n}\n.react-flow__resize-control.handle.bottom.right {\n left: 100%;\n}\n/* line styles */\n.react-flow__resize-control.line {\n border-color: var(--xy-resize-background-color, var(--xy-resize-background-color-default));\n border-width: 0;\n border-style: solid;\n}\n.react-flow__resize-control.line.left,\n.react-flow__resize-control.line.right {\n width: 1px;\n transform: translate(-50%, 0);\n top: 0;\n height: 100%;\n}\n.react-flow__resize-control.line.left {\n left: 0;\n border-left-width: 1px;\n}\n.react-flow__resize-control.line.right {\n left: 100%;\n border-right-width: 1px;\n}\n.react-flow__resize-control.line.top,\n.react-flow__resize-control.line.bottom {\n height: 1px;\n transform: translate(0, -50%);\n left: 0;\n width: 100%;\n}\n.react-flow__resize-control.line.top {\n top: 0;\n border-top-width: 1px;\n}\n.react-flow__resize-control.line.bottom {\n border-bottom-width: 1px;\n top: 100%;\n}\n.react-flow__edge-textbg {\n fill: var(--xy-edge-label-background-color, var(--xy-edge-label-background-color-default));\n}\n.react-flow__edge-text {\n fill: var(--xy-edge-label-color, var(--xy-edge-label-color-default));\n}\n",'\n/* ============================================================================\n Shadow DOM Reset\n ============================================================================ */\n\n:host {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n}\n\n*, *::before, *::after {\n box-sizing: border-box;\n}\n\n/* ============================================================================\n Container\n ============================================================================ */\n\n.ds-dial-plan-viewer {\n width: 100%;\n height: 100%;\n background: var(--ds-color-background, #ffffff);\n border-radius: var(--ds-border-radius, 8px);\n overflow: hidden;\n}\n\n/* ============================================================================\n Base Node Styles\n ============================================================================ */\n\n.ds-dial-plan-node {\n padding: 12px 16px;\n border-radius: var(--ds-border-radius, 8px);\n border: 2px solid var(--ds-color-border, #e2e8f0);\n background: var(--ds-color-background, #ffffff);\n font-family: var(--ds-font-family, -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif);\n font-size: var(--ds-font-size-sm, 14px);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n transition: border-color 0.15s ease, box-shadow 0.15s ease, outline-color 0.15s ease;\n min-width: 140px;\n outline: 3px solid transparent;\n outline-offset: 2px;\n}\n\n.ds-dial-plan-node--selected {\n border-color: var(--ds-color-primary, #3b82f6);\n outline-color: var(--ds-color-primary, #3b82f6);\n box-shadow: 0 0 16px 2px rgba(59, 130, 246, 0.4), 0 4px 12px rgba(59, 130, 246, 0.2);\n}\n\n.ds-dial-plan-node__content,\n.ds-dial-plan-node__header {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px;\n}\n\n.ds-dial-plan-node__icon {\n color: var(--ds-color-text-secondary, #64748b);\n}\n\n.ds-dial-plan-node__label {\n font-weight: 600;\n color: var(--ds-color-text, #1e293b);\n text-align: center;\n}\n\n.ds-dial-plan-node__type-label {\n font-size: var(--ds-font-size-xs, 12px);\n font-weight: 500;\n color: var(--ds-color-text-secondary, #64748b);\n text-transform: uppercase;\n letter-spacing: 0.5px;\n}\n\n.ds-dial-plan-node__name {\n font-weight: 600;\n font-size: var(--ds-font-size-sm, 14px);\n color: var(--ds-color-text, #1e293b);\n text-align: center;\n}\n\n.ds-dial-plan-node__type {\n font-size: var(--ds-font-size-xs, 12px);\n color: var(--ds-color-text-secondary, #64748b);\n}\n\n.ds-dial-plan-node__exits {\n display: flex;\n flex-direction: column;\n gap: 6px;\n margin-top: 12px;\n padding-top: 10px;\n border-top: 1px solid var(--ds-color-border, #e2e8f0);\n}\n\n.ds-dial-plan-node__exit-row {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: 8px;\n position: relative;\n}\n\n.ds-dial-plan-node__exit-label {\n font-size: 11px;\n color: var(--ds-color-text-secondary, #64748b);\n white-space: nowrap;\n}\n\n/* Position handles at the right edge of exit rows */\n.ds-dial-plan-node__exit-row .ds-dial-plan-handle {\n position: absolute;\n right: -16px;\n}\n\n/* ============================================================================\n Start Node\n ============================================================================ */\n\n.ds-dial-plan-node--start {\n background: var(--ds-color-primary, #3b82f6);\n border-color: var(--ds-color-primary, #3b82f6);\n border-radius: 50%;\n width: 60px;\n height: 60px;\n min-width: auto;\n padding: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.ds-dial-plan-node--start .ds-dial-plan-node__content {\n flex-direction: row;\n}\n\n.ds-dial-plan-node--start .ds-dial-plan-node__label {\n color: #ffffff;\n font-size: var(--ds-font-size-sm, 14px);\n}\n\n/* ============================================================================\n Node color theming (driven by --node-color CSS variable from registration)\n ============================================================================ */\n\n.ds-dial-plan-node--themed {\n border-color: var(--node-color);\n background: color-mix(in srgb, var(--node-color) 8%, white);\n}\n\n.ds-dial-plan-node--themed .ds-dial-plan-node__icon {\n color: var(--node-color);\n}\n\n.ds-dial-plan-node--themed.ds-dial-plan-node--selected {\n border-color: var(--node-color);\n outline-color: var(--node-color);\n box-shadow: 0 0 16px 2px color-mix(in srgb, var(--node-color) 40%, transparent),\n 0 4px 12px color-mix(in srgb, var(--node-color) 20%, transparent);\n}\n\n/* ============================================================================\n Per-type node colors (override --themed fallback with hand-crafted gradients)\n ============================================================================ */\n\n.ds-dial-plan-node--schedule {\n background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);\n border-color: var(--ds-color-info, #0ea5e9);\n min-height: 80px;\n}\n.ds-dial-plan-node--schedule .ds-dial-plan-node__icon { color: var(--ds-color-info, #0ea5e9); }\n.ds-dial-plan-node--schedule.ds-dial-plan-node--selected {\n border-color: var(--ds-color-info, #0ea5e9);\n outline-color: var(--ds-color-info, #0ea5e9);\n box-shadow: 0 0 16px 2px rgba(14, 165, 233, 0.4), 0 4px 12px rgba(14, 165, 233, 0.2);\n}\n\n.ds-dial-plan-node--internal-dial {\n background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);\n border-color: var(--ds-color-success, #22c55e);\n}\n.ds-dial-plan-node--internal-dial .ds-dial-plan-node__icon { color: var(--ds-color-success, #22c55e); }\n.ds-dial-plan-node--internal-dial.ds-dial-plan-node--selected {\n border-color: var(--ds-color-success, #22c55e);\n outline-color: var(--ds-color-success, #22c55e);\n box-shadow: 0 0 16px 2px rgba(34, 197, 94, 0.4), 0 4px 12px rgba(34, 197, 94, 0.2);\n}\n\n.ds-dial-plan-node--voicemail {\n background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);\n border-color: var(--ds-color-purple, #a855f7);\n}\n.ds-dial-plan-node--voicemail .ds-dial-plan-node__icon { color: var(--ds-color-purple, #a855f7); }\n.ds-dial-plan-node--voicemail.ds-dial-plan-node--selected {\n border-color: var(--ds-color-purple, #a855f7);\n outline-color: var(--ds-color-purple, #a855f7);\n box-shadow: 0 0 16px 2px rgba(168, 85, 247, 0.4), 0 4px 12px rgba(168, 85, 247, 0.2);\n}\n\n.ds-dial-plan-node--ring-all-users {\n background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);\n border-color: var(--ds-color-warning, #f59e0b);\n}\n.ds-dial-plan-node--ring-all-users .ds-dial-plan-node__icon { color: var(--ds-color-warning, #f59e0b); }\n.ds-dial-plan-node--ring-all-users.ds-dial-plan-node--selected {\n border-color: var(--ds-color-warning, #f59e0b);\n outline-color: var(--ds-color-warning, #f59e0b);\n box-shadow: 0 0 16px 2px rgba(245, 158, 11, 0.4), 0 4px 12px rgba(245, 158, 11, 0.2);\n}\n\n.ds-dial-plan-node--external-dial {\n background: linear-gradient(135deg, #fff1f2 0%, #fecdd3 100%);\n border-color: var(--ds-color-rose, #f43f5e);\n}\n.ds-dial-plan-node--external-dial .ds-dial-plan-node__icon { color: var(--ds-color-rose, #f43f5e); }\n.ds-dial-plan-node--external-dial.ds-dial-plan-node--selected {\n border-color: var(--ds-color-rose, #f43f5e);\n outline-color: var(--ds-color-rose, #f43f5e);\n box-shadow: 0 0 16px 2px rgba(244, 63, 94, 0.4), 0 4px 12px rgba(244, 63, 94, 0.2);\n}\n\n.ds-dial-plan-node--voice-app {\n border: 2px solid transparent;\n background:\n linear-gradient(135deg, #c7d2fe 0%, #ddd6fe 40%, #bae6fd 100%) padding-box,\n linear-gradient(135deg, #38bdf8 0%, #818cf8 35%, #a855f7 60%, #ec4899 100%) border-box;\n position: relative;\n transition: box-shadow 0.15s ease;\n}\n.ds-dial-plan-node--voice-app .ds-dial-plan-node__icon { color: #4f46e5; }\n.ds-dial-plan-node--voice-app.ds-dial-plan-node--selected {\n border-color: transparent;\n outline: none;\n box-shadow: 0 0 16px 2px rgba(99, 102, 241, 0.4), 0 4px 12px rgba(56, 189, 248, 0.2);\n}\n.ds-dial-plan-node--voice-app::after {\n content: \'\';\n position: absolute;\n inset: -7px;\n border-radius: calc(var(--ds-border-radius, 8px) + 5px);\n border: 3px solid transparent;\n background: linear-gradient(135deg, #38bdf8 0%, #818cf8 35%, #a855f7 60%, #ec4899 100%) border-box;\n -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);\n -webkit-mask-composite: xor;\n mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);\n mask-composite: exclude;\n pointer-events: none;\n opacity: 0;\n transition: opacity 0.15s ease;\n z-index: -1;\n}\n.ds-dial-plan-node--voice-app.ds-dial-plan-node--selected::after { opacity: 1; }\n\n.ds-dial-plan-node--menu {\n background: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 100%);\n border-color: #ec4899;\n}\n.ds-dial-plan-node--menu .ds-dial-plan-node__icon { color: #ec4899; }\n.ds-dial-plan-node--menu.ds-dial-plan-node--selected {\n border-color: #ec4899;\n outline-color: #ec4899;\n box-shadow: 0 0 16px 2px rgba(236, 72, 153, 0.4), 0 4px 12px rgba(236, 72, 153, 0.2);\n}\n\n.ds-dial-plan-node--audio-clip {\n background: linear-gradient(135deg, #f0fdfa 0%, #ccfbf1 100%);\n border-color: #14b8a6;\n}\n.ds-dial-plan-node--audio-clip .ds-dial-plan-node__icon { color: #14b8a6; }\n.ds-dial-plan-node--audio-clip.ds-dial-plan-node--selected {\n border-color: #14b8a6;\n outline-color: #14b8a6;\n box-shadow: 0 0 16px 2px rgba(20, 184, 166, 0.4), 0 4px 12px rgba(20, 184, 166, 0.2);\n}\n\n/* ============================================================================\n Menu Config Panel — Options List\n ============================================================================ */\n\n.ds-dial-plan-config-field__header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 6px;\n}\n\n.ds-dial-plan-config-field__header .ds-dial-plan-config-field__label {\n margin: 0;\n}\n\n.ds-dial-plan-menu-options {\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n\n.ds-dial-plan-menu-options__card {\n display: flex;\n align-items: flex-end;\n gap: 6px;\n}\n\n.ds-dial-plan-menu-options__field {\n display: flex;\n flex-direction: column;\n gap: 4px;\n min-width: 0;\n}\n\n.ds-dial-plan-menu-options__field--digit {\n flex: 0 0 64px;\n}\n\n.ds-dial-plan-menu-options__field--label {\n flex: 1;\n}\n\n.ds-dial-plan-menu-options__field-label {\n font-size: 10px;\n font-weight: 600;\n letter-spacing: 0.05em;\n text-transform: uppercase;\n color: var(--ds-color-text-muted, #94a3b8);\n}\n\n.ds-dial-plan-menu-options__field-hint {\n font-weight: 400;\n text-transform: none;\n letter-spacing: 0;\n opacity: 0.8;\n}\n\n.ds-dial-plan-menu-options__remove {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n border: none;\n background: none;\n color: var(--ds-color-text-muted, #94a3b8);\n cursor: pointer;\n border-radius: 4px;\n flex-shrink: 0;\n}\n\n.ds-dial-plan-menu-options__remove:hover {\n color: var(--ds-color-danger, #ef4444);\n background: rgba(239, 68, 68, 0.1);\n}\n\n.ds-dial-plan-menu-options__add {\n padding: 3px 10px;\n border: 1px solid var(--ds-color-primary, #6366f1);\n background: none;\n color: var(--ds-color-primary, #6366f1);\n cursor: pointer;\n border-radius: 4px;\n font-size: 11px;\n font-weight: 500;\n white-space: nowrap;\n}\n\n.ds-dial-plan-menu-options__add:hover:not(:disabled) {\n background: var(--ds-color-primary, #6366f1);\n color: #ffffff;\n}\n\n.ds-dial-plan-menu-options__add:disabled {\n opacity: 0.4;\n cursor: default;\n}\n\n/* ============================================================================\n Handles\n ============================================================================ */\n\n.ds-dial-plan-handle {\n width: 10px;\n height: 10px;\n background: var(--ds-color-border, #e2e8f0);\n border: 2px solid var(--ds-color-background, #ffffff);\n}\n\n.ds-dial-plan-handle--next {\n background: var(--ds-color-text-secondary, #64748b);\n}\n\n/* ============================================================================\n React Flow Overrides (both viewer and editor)\n ============================================================================ */\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__edge-path {\n stroke: var(--ds-color-border, #94a3b8);\n stroke-width: 2;\n}\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__edge.selected .react-flow__edge-path {\n stroke: var(--ds-color-primary, #3b82f6);\n}\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__edge-text {\n font-size: var(--ds-font-size-xs, 12px);\n fill: var(--ds-color-text-secondary, #64748b);\n}\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__background {\n background-color: var(--ds-color-background, #ffffff);\n}\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__minimap {\n background: var(--ds-color-background, #ffffff);\n border: 1px solid var(--ds-color-border, #e2e8f0);\n border-radius: var(--ds-border-radius, 8px);\n}\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__controls {\n border-radius: var(--ds-border-radius, 8px);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n}\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__controls-button {\n background: var(--ds-color-background, #ffffff);\n border-color: var(--ds-color-border, #e2e8f0);\n color: var(--ds-color-text, #1e293b);\n}\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__controls-button:hover {\n background: var(--ds-color-background-hover, #f8fafc);\n}\n\n/* ============================================================================\n Loading, Error, and Empty States\n ============================================================================ */\n\n.ds-dial-plan-viewer--loading,\n.ds-dial-plan-viewer--error,\n.ds-dial-plan-viewer--empty {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.ds-dial-plan-viewer__loading,\n.ds-dial-plan-viewer__error,\n.ds-dial-plan-viewer__empty {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 12px;\n font-family: var(--ds-font-family, -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif);\n font-size: var(--ds-font-size-sm, 14px);\n color: var(--ds-color-text-secondary, #64748b);\n}\n\n.ds-dial-plan-viewer__spinner {\n width: 32px;\n height: 32px;\n border: 3px solid var(--ds-color-border, #e2e8f0);\n border-top-color: var(--ds-color-primary, #3b82f6);\n border-radius: 50%;\n animation: ds-dial-plan-spin 0.8s linear infinite;\n}\n\n@keyframes ds-dial-plan-spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n.ds-dial-plan-viewer__error {\n color: var(--ds-color-danger, #ef4444);\n}\n\n.ds-dial-plan-viewer__error-message {\n font-size: var(--ds-font-size-xs, 12px);\n color: var(--ds-color-text-secondary, #64748b);\n max-width: 300px;\n text-align: center;\n}\n\n/* ============================================================================\n Config Panel\n ============================================================================ */\n\n.ds-dial-plan-config-panel {\n width: 260px;\n height: 100%;\n background: var(--ds-color-background, #ffffff);\n border-left: 1px solid var(--ds-color-border, #e2e8f0);\n display: flex;\n flex-direction: column;\n font-family: var(--ds-font-family, -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif);\n font-size: var(--ds-font-size-sm, 14px);\n overflow-y: auto;\n}\n\n.ds-dial-plan-config-panel__header {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 12px 16px;\n border-bottom: 1px solid var(--ds-color-border, #e2e8f0);\n}\n\n.ds-dial-plan-config-panel__header-icon {\n color: var(--ds-color-text-secondary, #64748b);\n display: flex;\n align-items: center;\n}\n\n.ds-dial-plan-config-panel__header-label {\n flex: 1;\n font-weight: 600;\n color: var(--ds-color-text, #1e293b);\n}\n\n.ds-dial-plan-config-panel__delete {\n color: var(--ds-color-danger, #ef4444);\n background: none;\n border: none;\n padding: 2px;\n cursor: pointer;\n display: flex;\n align-items: center;\n}\n\n.ds-dial-plan-config-panel__delete:hover {\n color: #dc2626;\n}\n\n.ds-dial-plan-config-panel__close {\n background: none;\n border: none;\n color: var(--ds-color-text-secondary, #64748b);\n cursor: pointer;\n padding: 2px;\n display: flex;\n align-items: center;\n}\n\n.ds-dial-plan-config-panel__close:hover {\n color: var(--ds-color-text, #1e293b);\n}\n\n.ds-dial-plan-config-panel__body {\n padding: 16px;\n display: flex;\n flex-direction: column;\n gap: 12px;\n}\n\n.ds-dial-plan-config-field {\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n\n.ds-dial-plan-config-field__label {\n font-size: var(--ds-font-size-xs, 12px);\n font-weight: 500;\n color: var(--ds-color-text-secondary, #64748b);\n text-transform: uppercase;\n letter-spacing: 0.5px;\n}\n\n.ds-dial-plan-config-field__select,\n.ds-dial-plan-config-field__input {\n width: 100%;\n padding: 6px 8px;\n border: 1px solid var(--ds-color-border, #e2e8f0);\n border-radius: var(--ds-border-radius, 8px);\n background: var(--ds-color-background, #ffffff);\n color: var(--ds-color-text, #1e293b);\n font-size: var(--ds-font-size-sm, 14px);\n font-family: inherit;\n outline: none;\n box-sizing: border-box;\n}\n\n.ds-dial-plan-config-field__checkbox {\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: var(--ds-font-size-sm, 14px);\n color: var(--ds-color-text, #1e293b);\n cursor: pointer;\n}\n\n.ds-dial-plan-config-field__hint {\n margin: 4px 0 0;\n font-size: var(--ds-font-size-xs, 12px);\n color: var(--ds-color-text-secondary, #64748b);\n line-height: 1.4;\n}\n\n.ds-dial-plan-config-field__error {\n margin: 4px 0 0;\n font-size: var(--ds-font-size-xs, 12px);\n color: var(--ds-color-danger, #ef4444);\n line-height: 1.4;\n}\n\n.ds-dial-plan-config-field__input[aria-invalid=\'true\'] {\n border-color: var(--ds-color-danger, #ef4444);\n}\n\n.ds-dial-plan-edge-panel__value {\n font-size: var(--ds-font-size-sm, 14px);\n color: var(--ds-color-text, #1e293b);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-edge-panel__value {\n color: #e2e8f0;\n}\n\n.ds-dial-plan-config-field__open-link {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n background: none;\n border: none;\n padding: 0;\n margin-top: 4px;\n font-size: var(--ds-font-size-xs, 12px);\n color: var(--ds-color-primary, #3b82f6);\n cursor: pointer;\n font-family: inherit;\n}\n\n.ds-dial-plan-config-field__open-link:hover {\n text-decoration: underline;\n}\n\n.ds-dial-plan-config-field__select:focus,\n.ds-dial-plan-config-field__input:focus {\n border-color: var(--ds-color-primary, #3b82f6);\n box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);\n}\n\n.ds-dial-plan-config-field__input-wrapper {\n position: relative;\n display: flex;\n align-items: center;\n}\n\n.ds-dial-plan-config-field__input-wrapper .ds-dial-plan-config-field__input {\n padding-right: 28px;\n}\n\n.ds-dial-plan-config-field__clear {\n position: absolute;\n right: 6px;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n padding: 0;\n border: none;\n border-radius: 50%;\n background: transparent;\n color: var(--ds-color-text-secondary, #64748b);\n cursor: pointer;\n}\n\n.ds-dial-plan-config-field__clear:hover {\n background: var(--ds-color-border, #e2e8f0);\n color: var(--ds-color-text, #1e293b);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-field__clear:hover {\n background: rgba(255, 255, 255, 0.1);\n color: #e2e8f0;\n}\n\n.ds-dial-plan-config-field__segmented {\n display: flex;\n border: 1px solid var(--ds-color-border, #e2e8f0);\n border-radius: var(--ds-border-radius, 8px);\n overflow: hidden;\n background: var(--ds-color-background, #ffffff);\n}\n\n.ds-dial-plan-config-field__segmented-option {\n flex: 1;\n padding: 6px 8px;\n border: none;\n background: transparent;\n color: var(--ds-color-text-secondary, #64748b);\n font-size: var(--ds-font-size-sm, 14px);\n font-family: inherit;\n cursor: pointer;\n}\n\n.ds-dial-plan-config-field__segmented-option + .ds-dial-plan-config-field__segmented-option {\n border-left: 1px solid var(--ds-color-border, #e2e8f0);\n}\n\n.ds-dial-plan-config-field__segmented-option--active {\n background: var(--ds-color-primary, #3b82f6);\n color: #ffffff;\n font-weight: 500;\n}\n\n.ds-dial-plan-config-field__hint {\n margin: 4px 0 0;\n font-size: var(--ds-font-size-xs, 11px);\n line-height: 1.4;\n color: var(--ds-color-text-secondary, #64748b);\n}\n\n.ds-dial-plan-node__badge {\n display: block;\n width: fit-content;\n margin: 4px auto 0;\n padding: 2px 8px;\n border-radius: 999px;\n background: var(--ds-color-muted, #eef2ff);\n color: var(--ds-color-text-secondary, #64748b);\n font-size: var(--ds-font-size-xs, 11px);\n font-weight: 500;\n letter-spacing: 0.3px;\n text-align: center;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__badge {\n background: rgba(255, 255, 255, 0.1);\n color: #e2e8f0;\n}\n\n/* ============================================================================\n Resource Combobox\n ============================================================================ */\n\n.ds-resource-combobox {\n border: 1px solid var(--ds-color-border, #e2e8f0);\n border-radius: var(--ds-border-radius, 8px);\n background: var(--ds-color-background, #ffffff);\n overflow: hidden;\n}\n\n.ds-resource-combobox__trigger {\n width: 100%;\n padding: 6px 8px;\n border: 1px solid var(--ds-color-border, #e2e8f0);\n border-radius: var(--ds-border-radius, 8px);\n background: var(--ds-color-background, #ffffff);\n color: var(--ds-color-text, #1e293b);\n font-size: var(--ds-font-size-sm, 14px);\n font-family: inherit;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n text-align: left;\n}\n\n.ds-resource-combobox__trigger:hover {\n border-color: var(--ds-color-primary, #3b82f6);\n}\n\n.ds-resource-combobox__trigger-placeholder {\n color: var(--ds-color-text-secondary, #64748b);\n}\n\n.ds-resource-combobox__trigger-chevron {\n color: var(--ds-color-text-secondary, #64748b);\n opacity: 0.5;\n flex-shrink: 0;\n}\n\n.ds-resource-combobox__input {\n width: 100%;\n padding: 8px 10px;\n border: none;\n border-bottom: 1px solid var(--ds-color-border, #e2e8f0);\n background: transparent;\n color: var(--ds-color-text, #1e293b);\n font-size: var(--ds-font-size-sm, 14px);\n font-family: inherit;\n outline: none;\n box-sizing: border-box;\n}\n\n.ds-resource-combobox__input::placeholder {\n color: var(--ds-color-text-secondary, #64748b);\n}\n\n.ds-resource-combobox__list {\n max-height: 400px;\n overflow-y: auto;\n padding: 4px 0;\n}\n\n.ds-resource-combobox__group [cmdk-group-heading] {\n padding: 6px 10px 2px;\n font-size: var(--ds-font-size-xs, 12px);\n font-weight: 500;\n color: var(--ds-color-text-secondary, #64748b);\n text-transform: uppercase;\n letter-spacing: 0.5px;\n}\n\n.ds-resource-combobox__item {\n padding: 6px 10px;\n font-size: var(--ds-font-size-sm, 14px);\n color: var(--ds-color-text, #1e293b);\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n border-radius: 0;\n}\n\n.ds-resource-combobox__item[data-selected="true"] {\n background: var(--ds-color-primary, #3b82f6);\n color: #ffffff;\n}\n\n.ds-resource-combobox__item--selected {\n font-weight: 500;\n}\n\n.ds-resource-combobox__name {\n flex: 1;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.ds-resource-combobox__ext {\n font-size: var(--ds-font-size-xs, 12px);\n color: var(--ds-color-text-secondary, #64748b);\n margin-left: auto;\n padding-left: 8px;\n white-space: nowrap;\n flex-shrink: 0;\n}\n\n.ds-resource-combobox__check {\n font-size: 12px;\n opacity: 0.7;\n width: 16px;\n text-align: center;\n flex-shrink: 0;\n}\n\n.ds-resource-combobox__create {\n padding: 6px 10px;\n font-size: var(--ds-font-size-sm, 14px);\n color: var(--ds-color-primary, #3b82f6);\n cursor: pointer;\n font-style: italic;\n}\n\n.ds-resource-combobox__create[data-selected="true"] {\n background: var(--ds-color-primary, #3b82f6);\n color: #ffffff;\n}\n\n.ds-resource-combobox__empty {\n padding: 12px 10px;\n font-size: var(--ds-font-size-sm, 14px);\n color: var(--ds-color-text-secondary, #64748b);\n text-align: center;\n}\n\n/* ============================================================================\n Dark Mode\n Activated by .dark class on an ancestor (Tailwind / next-themes convention)\n or data-theme="dark" attribute.\n ============================================================================ */\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-viewer,\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-editor {\n background: #1a1a2e;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node {\n background: #1e1e32;\n border-color: rgba(255, 255, 255, 0.1);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__label,\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__name {\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__icon,\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__type-label,\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__type,\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__exit-label {\n color: #94a3b8;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__exits {\n border-top-color: rgba(255, 255, 255, 0.1);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--themed {\n background: color-mix(in srgb, var(--node-color) 20%, #1a1a2e);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--schedule {\n background: linear-gradient(135deg, #0c2d48 0%, #0a3761 100%);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--internal-dial {\n background: linear-gradient(135deg, #052e16 0%, #064e3b 100%);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--voicemail {\n background: linear-gradient(135deg, #2e1065 0%, #3b0764 100%);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--ring-all-users {\n background: linear-gradient(135deg, #451a03 0%, #78350f 100%);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--external-dial {\n background: linear-gradient(135deg, #4c0519 0%, #881337 100%);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--voice-app {\n background:\n linear-gradient(135deg, #252262 0%, #3b1d7e 40%, #0c3a5e 100%) padding-box,\n linear-gradient(135deg, #38bdf8 0%, #818cf8 35%, #a855f7 60%, #ec4899 100%) border-box;\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--menu {\n background: linear-gradient(135deg, #500724 0%, #831843 100%);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--audio-clip {\n background: linear-gradient(135deg, #042f2e 0%, #115e59 100%);\n}\n\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-handle {\n border-color: #1e1e32;\n}\n\n:is(.dark, [data-theme="dark"]) :is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__background {\n background-color: #1a1a2e;\n}\n\n:is(.dark, [data-theme="dark"]) :is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__edge-path {\n stroke: rgba(255, 255, 255, 0.2);\n}\n\n:is(.dark, [data-theme="dark"]) :is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__edge-text {\n fill: #94a3b8;\n}\n\n:is(.dark, [data-theme="dark"]) :is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__minimap {\n background: #1e1e32;\n border-color: rgba(255, 255, 255, 0.1);\n}\n\n:is(.dark, [data-theme="dark"]) :is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__controls {\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);\n}\n\n:is(.dark, [data-theme="dark"]) :is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__controls-button {\n background: #1e1e32;\n border-color: rgba(255, 255, 255, 0.1);\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) :is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__controls-button:hover {\n background: #2a2a45;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-viewer__loading,\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-viewer__empty {\n color: #94a3b8;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-viewer__spinner {\n border-color: rgba(255, 255, 255, 0.1);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-panel {\n background: #1e1e32;\n border-left-color: rgba(255, 255, 255, 0.1);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-panel__header {\n border-bottom-color: rgba(255, 255, 255, 0.1);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-panel__header-label {\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-panel__close {\n color: #94a3b8;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-panel__close:hover {\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-field__label {\n color: #94a3b8;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-field__checkbox {\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-field__select,\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-field__input {\n background: #12122a;\n border-color: rgba(255, 255, 255, 0.1);\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-resource-combobox__trigger {\n background: #12122a;\n border-color: rgba(255, 255, 255, 0.1);\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-resource-combobox {\n border-color: rgba(255, 255, 255, 0.1);\n background: #12122a;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-resource-combobox__input {\n color: #e2e8f0;\n border-bottom-color: rgba(255, 255, 255, 0.1);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-resource-combobox__item {\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-resource-combobox__item--selected {\n color: #e2e8f0;\n}\n\n/* Node Library */\n\n.ds-dial-plan-node-library {\n width: 200px;\n height: 100%;\n background: var(--ds-color-background, #ffffff);\n border-right: 1px solid var(--ds-color-border, #e2e8f0);\n display: flex;\n flex-direction: column;\n gap: 10px;\n padding: 12px;\n font-family: var(--ds-font-family, -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif);\n font-size: var(--ds-font-size-sm, 14px);\n overflow-y: auto;\n}\n\n.ds-dial-plan-node-library__item {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px;\n padding: 10px 12px;\n border-radius: var(--ds-border-radius, 8px);\n border: 2px solid var(--node-color, var(--ds-color-border, #e2e8f0));\n background: color-mix(in srgb, var(--node-color, #ffffff) 10%, white);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n cursor: grab;\n transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;\n}\n\n.ds-dial-plan-node-library__item:hover {\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);\n transform: translateY(-1px);\n}\n\n.ds-dial-plan-node-library__item:active {\n cursor: grabbing;\n transform: scale(0.97);\n}\n\n/* Per-type library item colors */\n.ds-dial-plan-node-library__item--schedule { background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%); border-color: var(--ds-color-info, #0ea5e9); }\n.ds-dial-plan-node-library__item--internal_dial { background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%); border-color: var(--ds-color-success, #22c55e); }\n.ds-dial-plan-node-library__item--voicemail { background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%); border-color: var(--ds-color-purple, #a855f7); }\n.ds-dial-plan-node-library__item--ring_all_users { background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%); border-color: var(--ds-color-warning, #f59e0b); }\n.ds-dial-plan-node-library__item--external_dial { background: linear-gradient(135deg, #fff1f2 0%, #fecdd3 100%); border-color: var(--ds-color-rose, #f43f5e); }\n.ds-dial-plan-node-library__item--voice_app,\n.ds-dial-plan-node-library__item--voice_app:hover {\n border: 2px solid transparent;\n background: linear-gradient(135deg, #c7d2fe 0%, #ddd6fe 40%, #bae6fd 100%) padding-box, linear-gradient(135deg, #38bdf8 0%, #818cf8 35%, #a855f7 60%, #ec4899 100%) border-box;\n}\n.ds-dial-plan-node-library__item--menu { background: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 100%); border-color: #ec4899; }\n.ds-dial-plan-node-library__item--audio_clip { background: linear-gradient(135deg, #f0fdfa 0%, #ccfbf1 100%); border-color: #14b8a6; }\n\n.ds-dial-plan-node-library__item-icon {\n display: flex;\n align-items: center;\n color: var(--node-color);\n}\n.ds-dial-plan-node-library__item--schedule .ds-dial-plan-node-library__item-icon { color: var(--ds-color-info, #0ea5e9); }\n.ds-dial-plan-node-library__item--internal_dial .ds-dial-plan-node-library__item-icon { color: var(--ds-color-success, #22c55e); }\n.ds-dial-plan-node-library__item--voicemail .ds-dial-plan-node-library__item-icon { color: var(--ds-color-purple, #a855f7); }\n.ds-dial-plan-node-library__item--ring_all_users .ds-dial-plan-node-library__item-icon { color: var(--ds-color-warning, #f59e0b); }\n.ds-dial-plan-node-library__item--external_dial .ds-dial-plan-node-library__item-icon { color: var(--ds-color-rose, #f43f5e); }\n.ds-dial-plan-node-library__item--voice_app .ds-dial-plan-node-library__item-icon { color: #4f46e5; }\n.ds-dial-plan-node-library__item--menu .ds-dial-plan-node-library__item-icon { color: #ec4899; }\n.ds-dial-plan-node-library__item--audio_clip .ds-dial-plan-node-library__item-icon { color: #14b8a6; }\n\n.ds-dial-plan-node-library__item-label {\n font-size: var(--ds-font-size-xs, 12px);\n font-weight: 600;\n color: var(--ds-color-text, #1e293b);\n text-align: center;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library {\n background: #1e1e32;\n border-right-color: rgba(255, 255, 255, 0.1);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item {\n background: color-mix(in srgb, var(--node-color, #1e1e32) 20%, #1e1e32);\n border-color: rgba(255, 255, 255, 0.1);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--schedule { background: linear-gradient(135deg, #0c2d48 0%, #0a3761 100%); }\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--internal_dial { background: linear-gradient(135deg, #052e16 0%, #064e3b 100%); }\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--voicemail { background: linear-gradient(135deg, #2e1065 0%, #3b0764 100%); }\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--ring_all_users { background: linear-gradient(135deg, #451a03 0%, #78350f 100%); }\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--external_dial { background: linear-gradient(135deg, #4c0519 0%, #881337 100%); }\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--voice_app { background: linear-gradient(135deg, #252262 0%, #3b1d7e 40%, #0c3a5e 100%) padding-box, linear-gradient(135deg, #38bdf8 0%, #818cf8 35%, #a855f7 60%, #ec4899 100%) border-box; }\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--menu { background: linear-gradient(135deg, #500724 0%, #831843 100%); }\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--audio_clip { background: linear-gradient(135deg, #042f2e 0%, #115e59 100%); }\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item-label {\n color: #e2e8f0;\n}\n\n/* ============================================================================\n Editor Toolbar\n ============================================================================ */\n\n.ds-dial-plan-editor-toolbar {\n position: absolute;\n top: 16px;\n right: 16px;\n z-index: 10;\n display: flex;\n gap: 8px;\n}\n\n.ds-dial-plan-editor-toolbar__button {\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 8px 12px;\n background: var(--ds-color-background, #ffffff);\n border: 1px solid var(--ds-color-border, #e2e8f0);\n border-radius: var(--ds-border-radius, 8px);\n color: var(--ds-color-text, #1e293b);\n font-family: var(--ds-font-family, -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif);\n font-size: var(--ds-font-size-sm, 14px);\n font-weight: 500;\n cursor: pointer;\n transition: all 0.15s ease;\n}\n\n.ds-dial-plan-editor-toolbar__button:hover {\n background: var(--ds-color-background-hover, #f1f5f9);\n border-color: var(--ds-color-border, #cbd5e1);\n}\n\n.ds-dial-plan-editor-toolbar__button:active {\n transform: scale(0.98);\n}\n\n.ds-dial-plan-editor-toolbar__button:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n}\n\n.ds-dial-plan-editor-toolbar__button:disabled:hover {\n background: var(--ds-color-background, #ffffff);\n border-color: var(--ds-color-border, #e2e8f0);\n}\n\n.ds-dial-plan-editor-toolbar__button svg {\n color: var(--ds-color-text-secondary, #64748b);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-editor-toolbar__button {\n background: #1e293b;\n border-color: #334155;\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-editor-toolbar__button:hover {\n background: #334155;\n border-color: #475569;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-editor-toolbar__button:disabled:hover {\n background: #1e293b;\n border-color: #334155;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-editor-toolbar__button svg {\n color: #cbd5e1;\n}\n\n/* Editor Layout */\n\n.ds-dial-plan-editor {\n display: flex;\n width: 100%;\n height: 100%;\n flex: 1;\n min-height: 400px;\n background: var(--ds-color-background, #ffffff);\n overflow: hidden;\n}\n\n.ds-dial-plan-editor--preview {\n min-height: 0;\n}\n\n.ds-dial-plan-editor__canvas {\n flex: 1;\n position: relative;\n}\n\n/* Node Library wrapper */\n\n.ds-dial-plan-node-library-wrapper {\n width: 200px;\n flex-shrink: 0;\n align-self: stretch;\n overflow: hidden;\n}\n\n/* Config panel wrapper (slide-in animation) */\n\n.ds-dial-plan-config-panel-wrapper {\n width: 0;\n flex-shrink: 0;\n align-self: stretch;\n overflow: hidden;\n transition: width 0.2s ease;\n}\n\n.ds-dial-plan-config-panel-wrapper--open {\n width: 260px;\n}\n\n\n'],$e=e.forwardRef((a,t)=>{var l;const{dialstack:r}=N(),i=function(e){const[a,t]=n(()=>e.getAppearance());return o(()=>{if("undefined"==typeof document)return;const n=document.createElement("div"),o=e=>{const n=e.detail;t(null==n?void 0:n.appearance)};return n.addEventListener("dialstack-appearance-update",o),e.addAppearanceTarget(n),()=>{e.removeAppearanceTarget(n),n.removeEventListener("dialstack-appearance-update",o)}},[e]),a}(r),d="dark"===(null==i?void 0:i.theme)?"dark":"light",s=null!==(l=a.theme)&&void 0!==l?l:d;return e.createElement(Re,{stylesheets:He,className:a.className,style:Object.assign({width:"100%",height:"100%",flex:1,minHeight:0},a.style)},e.createElement("div",{"data-theme":s,style:{display:"flex",flexDirection:"column",flex:1,minHeight:0}},e.createElement(g,null,e.createElement(Me,Object.assign({ref:t},a)))))});$e.displayName="DialPlan";export{$e as DialPlan};
|
|
2
2
|
//# sourceMappingURL=dial-plan.mjs.map
|