import{u as Jr,j as m,o as Zr,c as Je}from"./index-f45b8810.js";import{u as Hr,B as ye,L as Gr,h as Xr}from"./fetch.client-5aab1c76.js";import{A as Qr}from"./alert-38484668.js";/*! * is-plain-object * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. */function Ze(e){return Object.prototype.toString.call(e)==="[object Object]"}function P(e){var r,t;return Ze(e)===!1?!1:(r=e.constructor,r===void 0?!0:(t=r.prototype,!(Ze(t)===!1||t.hasOwnProperty("isPrototypeOf")===!1)))}function R(e){for(var r=arguments.length,t=Array(r>1?r-1:0),n=1;n3?r.i-4:r.i:Array.isArray(e)?1:ke(e)?2:Se(e)?3:0}function Pe(e,r){return X(e)===2?e.has(r):Object.prototype.hasOwnProperty.call(e,r)}function Yr(e,r){return X(e)===2?e.get(r):e[r]}function mr(e,r,t){var n=X(e);n===2?e.set(r,t):n===3?e.add(t):e[r]=t}function _r(e,r){return e===r?e!==0||1/e==1/r:e!=e&&r!=r}function ke(e){return nt&&e instanceof Map}function Se(e){return st&&e instanceof Set}function V(e){return e.o||e.t}function Re(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var r=at(e);delete r[N];for(var t=qe(r),n=0;n1&&(e.set=e.add=e.clear=e.delete=et),Object.freeze(e),r&&te(e,function(t,n){return De(n,!0)},!0)),e}function et(){R(2)}function Be(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function B(e){var r=ot[e];return r||R(18,e),r}function He(){return ne}function be(e,r){r&&(B("Patches"),e.u=[],e.s=[],e.v=r)}function fe(e){je(e),e.p.forEach(rt),e.p=null}function je(e){e===ne&&(ne=e.l)}function Ge(e){return ne={p:[],l:ne,h:e,m:!0,_:0}}function rt(e){var r=e[N];r.i===0||r.i===1?r.j():r.g=!0}function we(e,r){r._=r.p.length;var t=r.p[0],n=e!==void 0&&e!==t;return r.h.O||B("ES5").S(r,e,n),n?(t[N].P&&(fe(r),R(4)),K(e)&&(e=ce(r,e),r.l||le(r,e)),r.u&&B("Patches").M(t[N].t,e,r.u,r.s)):e=ce(r,t,[]),fe(r),r.u&&r.v(r.u,r.s),e!==pr?e:void 0}function ce(e,r,t){if(Be(r))return r;var n=r[N];if(!n)return te(r,function(f,c){return Xe(e,n,r,f,c,t)},!0),r;if(n.A!==e)return r;if(!n.P)return le(e,n.t,!0),n.t;if(!n.I){n.I=!0,n.A._--;var s=n.i===4||n.i===5?n.o=Re(n.k):n.o,i=s,a=!1;n.i===3&&(i=new Set(s),s.clear(),a=!0),te(i,function(f,c){return Xe(e,n,s,f,c,t,a)}),le(e,s,!1),t&&e.u&&B("Patches").N(n,t,e.u,e.s)}return n.o}function Xe(e,r,t,n,s,i,a){if(W(s)){var f=ce(e,s,i&&r&&r.i!==3&&!Pe(r.R,n)?i.concat(n):void 0);if(mr(t,n,f),!W(f))return;e.m=!1}else a&&t.add(s);if(K(s)&&!Be(s)){if(!e.h.D&&e._<1)return;ce(e,s),r&&r.A.l||le(e,s)}}function le(e,r,t){t===void 0&&(t=!1),!e.l&&e.h.D&&e.m&&De(r,t)}function xe(e,r){var t=e[N];return(t?V(t):e)[r]}function Qe(e,r){if(r in e)for(var t=Object.getPrototypeOf(e);t;){var n=Object.getOwnPropertyDescriptor(t,r);if(n)return n;t=Object.getPrototypeOf(t)}}function Ae(e){e.P||(e.P=!0,e.l&&Ae(e.l))}function Oe(e){e.o||(e.o=Re(e.t))}function Ee(e,r,t){var n=ke(r)?B("MapSet").F(r,t):Se(r)?B("MapSet").T(r,t):e.O?function(s,i){var a=Array.isArray(s),f={i:a?1:0,A:i?i.A:He(),P:!1,I:!1,R:{},l:i,t:s,k:null,o:null,j:null,C:!1},c=f,l=Ne;a&&(c=[f],l=ee);var d=Proxy.revocable(c,l),h=d.revoke,v=d.proxy;return f.k=v,f.j=h,v}(r,t):B("ES5").J(r,t);return(t?t.A:He()).p.push(n),n}function tt(e){return W(e)||R(22,e),function r(t){if(!K(t))return t;var n,s=t[N],i=X(t);if(s){if(!s.P&&(s.i<4||!B("ES5").K(s)))return s.t;s.I=!0,n=Ye(t,i),s.I=!1}else n=Ye(t,i);return te(n,function(a,f){s&&Yr(s.t,a)===f||mr(n,a,r(f))}),i===3?new Set(n):n}(e)}function Ye(e,r){switch(r){case 2:return new Map(e);case 3:return Array.from(e)}return Re(e)}var _e,ne,Te=typeof Symbol<"u"&&typeof Symbol("x")=="symbol",nt=typeof Map<"u",st=typeof Set<"u",er=typeof Proxy<"u"&&Proxy.revocable!==void 0&&typeof Reflect<"u",pr=Te?Symbol.for("immer-nothing"):((_e={})["immer-nothing"]=!0,_e),rr=Te?Symbol.for("immer-draftable"):"__$immer_draftable",N=Te?Symbol.for("immer-state"):"__$immer_state",it=""+Object.prototype.constructor,qe=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Object.getOwnPropertySymbols!==void 0?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,at=Object.getOwnPropertyDescriptors||function(e){var r={};return qe(e).forEach(function(t){r[t]=Object.getOwnPropertyDescriptor(e,t)}),r},ot={},Ne={get:function(e,r){if(r===N)return e;var t=V(e);if(!Pe(t,r))return function(s,i,a){var f,c=Qe(i,a);return c?"value"in c?c.value:(f=c.get)===null||f===void 0?void 0:f.call(s.k):void 0}(e,t,r);var n=t[r];return e.I||!K(n)?n:n===xe(e.t,r)?(Oe(e),e.o[r]=Ee(e.A.h,n,e)):n},has:function(e,r){return r in V(e)},ownKeys:function(e){return Reflect.ownKeys(V(e))},set:function(e,r,t){var n=Qe(V(e),r);if(n!=null&&n.set)return n.set.call(e.k,t),!0;if(!e.P){var s=xe(V(e),r),i=s==null?void 0:s[N];if(i&&i.t===t)return e.o[r]=t,e.R[r]=!1,!0;if(_r(t,s)&&(t!==void 0||Pe(e.t,r)))return!0;Oe(e),Ae(e)}return e.o[r]===t&&(t!==void 0||r in e.o)||Number.isNaN(t)&&Number.isNaN(e.o[r])||(e.o[r]=t,e.R[r]=!0),!0},deleteProperty:function(e,r){return xe(e.t,r)!==void 0||r in e.t?(e.R[r]=!1,Oe(e),Ae(e)):delete e.R[r],e.o&&delete e.o[r],!0},getOwnPropertyDescriptor:function(e,r){var t=V(e),n=Reflect.getOwnPropertyDescriptor(t,r);return n&&{writable:!0,configurable:e.i!==1||r!=="length",enumerable:n.enumerable,value:t[r]}},defineProperty:function(){R(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){R(12)}},ee={};te(Ne,function(e,r){ee[e]=function(){return arguments[0]=arguments[0][0],r.apply(this,arguments)}}),ee.deleteProperty=function(e,r){return ee.set.call(this,e,r,void 0)},ee.set=function(e,r,t){return Ne.set.call(this,e[0],r,t,e[0])};var ft=function(){function e(t){var n=this;this.O=er,this.D=!0,this.produce=function(s,i,a){if(typeof s=="function"&&typeof i!="function"){var f=i;i=s;var c=n;return function(j){var L=this;j===void 0&&(j=f);for(var A=arguments.length,S=Array(A>1?A-1:0),U=1;U1?d-1:0),v=1;v=0;s--){var i=n[s];if(i.path.length===0&&i.op==="replace"){t=i.value;break}}s>-1&&(n=n.slice(s+1));var a=B("Patches").$;return W(t)?a(t,n):this.produce(t,function(f){return a(f,n)})},e}(),k=new ft,Le=k.produce;k.produceWithPatches.bind(k);k.setAutoFreeze.bind(k);k.setUseProxies.bind(k);k.applyPatches.bind(k);var tr=k.createDraft.bind(k),nr=k.finishDraft.bind(k),o={ancestors(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:t=!1}=r,n=o.levels(e,r);return t?n=n.slice(1):n=n.slice(0,-1),n},common(e,r){for(var t=[],n=0;nr[n])return 1}return 0},endsAfter(e,r){var t=e.length-1,n=e.slice(0,t),s=r.slice(0,t),i=e[t],a=r[t];return o.equals(n,s)&&i>a},endsAt(e,r){var t=e.length,n=e.slice(0,t),s=r.slice(0,t);return o.equals(n,s)},endsBefore(e,r){var t=e.length-1,n=e.slice(0,t),s=r.slice(0,t),i=e[t],a=r[t];return o.equals(n,s)&&it===r[n])},hasPrevious(e){return e[e.length-1]>0},isAfter(e,r){return o.compare(e,r)===1},isAncestor(e,r){return e.lengthr.length&&o.compare(e,r)===0},isParent(e,r){return e.length+1===r.length&&o.compare(e,r)===0},isPath(e){return Array.isArray(e)&&(e.length===0||typeof e[0]=="number")},isSibling(e,r){if(e.length!==r.length)return!1;var t=e.slice(0,-1),n=r.slice(0,-1),s=e[e.length-1],i=r[r.length-1];return s!==i&&o.equals(t,n)},levels(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:t=!1}=r,n=[],s=0;s<=e.length;s++)n.push(e.slice(0,s));return t&&n.reverse(),n},next(e){if(e.length===0)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var r=e[e.length-1];return e.slice(0,-1).concat(r+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(e.length===0)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(e.length===0)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var r=e[e.length-1];if(r<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(r-1)},relative(e,r){if(!o.isAncestor(r,e)&&!o.equals(e,r))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(r,"], because it is not above or equal to the path."));return e.slice(r.length)},transform(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e)return null;var n=[...e],{affinity:s="forward"}=t;if(e.length===0)return n;switch(r.type){case"insert_node":{var{path:i}=r;(o.equals(i,n)||o.endsBefore(i,n)||o.isAncestor(i,n))&&(n[i.length-1]+=1);break}case"remove_node":{var{path:a}=r;if(o.equals(a,n)||o.isAncestor(a,n))return null;o.endsBefore(a,n)&&(n[a.length-1]-=1);break}case"merge_node":{var{path:f,position:c}=r;o.equals(f,n)||o.endsBefore(f,n)?n[f.length-1]-=1:o.isAncestor(f,n)&&(n[f.length-1]-=1,n[f.length]+=c);break}case"split_node":{var{path:l,position:d}=r;if(o.equals(l,n)){if(s==="forward")n[n.length-1]+=1;else if(s!=="backward")return null}else o.endsBefore(l,n)?n[l.length-1]+=1:o.isAncestor(l,n)&&e[l.length]>=d&&(n[l.length-1]+=1,n[l.length]-=d);break}case"move_node":{var{path:h,newPath:v}=r;if(o.equals(h,v))return n;if(o.isAncestor(h,n)||o.equals(h,n)){var x=v.slice();return o.endsBefore(h,v)&&h.length{switch(t.type){case"insert_node":{var{path:n,node:s}=t,i=u.parent(e,n),a=n[n.length-1];if(a>i.children.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(n,"] because the destination is past the end of the node."));if(i.children.splice(a,0,s),r)for(var[f,c]of g.points(r))r[c]=y.transform(f,t);break}case"insert_text":{var{path:l,offset:d,text:h}=t;if(h.length===0)break;var v=u.leaf(e,l),x=v.text.slice(0,d),O=v.text.slice(d);if(v.text=x+h+O,r)for(var[j,L]of g.points(r))r[L]=y.transform(j,t);break}case"merge_node":{var{path:A}=t,S=u.get(e,A),U=o.previous(A),I=u.get(e,U),ie=u.parent(e,A),br=A[A.length-1];if(w.isText(S)&&w.isText(I))I.text+=S.text;else if(!w.isText(S)&&!w.isText(I))I.children.push(...S.children);else throw new Error('Cannot apply a "merge_node" operation at path ['.concat(A,"] to nodes of different interfaces: ").concat(D.stringify(S)," ").concat(D.stringify(I)));if(ie.children.splice(br,1),r)for(var[wr,xr]of g.points(r))r[xr]=y.transform(wr,t);break}case"move_node":{var{path:M,newPath:Ie}=t;if(o.isAncestor(M,Ie))throw new Error("Cannot move a path [".concat(M,"] to new path [").concat(Ie,"] because the destination is inside itself."));var Or=u.get(e,M),Pr=u.parent(e,M),jr=M[M.length-1];Pr.children.splice(jr,1);var ue=o.transform(M,t),Ar=u.get(e,o.parent(ue)),Er=ue[ue.length-1];if(Ar.children.splice(Er,0,Or),r)for(var[Nr,kr]of g.points(r))r[kr]=y.transform(Nr,t);break}case"remove_node":{var{path:F}=t,Sr=F[F.length-1],Rr=u.parent(e,F);if(Rr.children.splice(Sr,1),r)for(var[Y,Dr]of g.points(r)){var Me=y.transform(Y,t);if(r!=null&&Me!=null)r[Dr]=Me;else{var J=void 0,$=void 0;for(var[Fe,de]of u.texts(e))if(o.compare(de,F)===-1)J=[Fe,de];else{$=[Fe,de];break}var he=!1;J&&$&&(o.equals($[1],F)?he=!o.hasPrevious($[1]):he=o.common(J[1],F).length{for(var t in e){var n=e[t],s=r[t];if(P(n)&&P(s)){if(!yr(n,s))return!1}else if(Array.isArray(n)&&Array.isArray(s)){if(n.length!==s.length)return!1;for(var i=0;i=0)&&(t[s]=e[s]);return t}function se(e,r){if(e==null)return{};var t=ht(e,r),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}var gt=["anchor","focus"];function ir(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),t.push.apply(t,n)}return t}function vt(e){for(var r=1;r1&&arguments[1]!==void 0?arguments[1]:{},{reverse:t=!1}=r,{anchor:n,focus:s}=e;return g.isBackward(e)===t?[n,s]:[s,n]},end(e){var[,r]=g.edges(e);return r},equals(e,r){return y.equals(e.anchor,r.anchor)&&y.equals(e.focus,r.focus)},includes(e,r){if(g.isRange(r)){if(g.includes(e,r.anchor)||g.includes(e,r.focus))return!0;var[t,n]=g.edges(e),[s,i]=g.edges(r);return y.isBefore(t,s)&&y.isAfter(n,i)}var[a,f]=g.edges(e),c=!1,l=!1;return y.isPoint(r)?(c=y.compare(r,a)>=0,l=y.compare(r,f)<=0):(c=o.compare(r,a.path)>=0,l=o.compare(r,f.path)<=0),c&&l},intersection(e,r){var t=se(e,gt),[n,s]=g.edges(e),[i,a]=g.edges(r),f=y.isBefore(n,i)?i:n,c=y.isBefore(s,a)?s:a;return y.isBefore(c,f)?null:vt({anchor:f,focus:c},t)},isBackward(e){var{anchor:r,focus:t}=e;return y.isAfter(r,t)},isCollapsed(e){var{anchor:r,focus:t}=e;return y.equals(r,t)},isExpanded(e){return!g.isCollapsed(e)},isForward(e){return!g.isBackward(e)},isRange(e){return P(e)&&y.isPoint(e.anchor)&&y.isPoint(e.focus)},*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[r]=g.edges(e);return r},transform(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Le(e,n=>{if(n===null)return null;var{affinity:s="inward"}=t,i,a;if(s==="inward"){var f=g.isCollapsed(n);g.isForward(n)?(i="forward",a=f?i:"backward"):(i="backward",a=f?i:"forward")}else s==="outward"?g.isForward(n)?(i="backward",a="forward"):(i="forward",a="backward"):(i=s,a=s);var c=y.transform(n.anchor,r,{affinity:i}),l=y.transform(n.focus,r,{affinity:a});if(!c||!l)return null;n.anchor=c,n.focus=l})}},ar=e=>P(e)&&u.isNodeList(e.children)&&!E.isEditor(e),q={isAncestor(e){return P(e)&&u.isNodeList(e.children)},isElement:ar,isElementList(e){return Array.isArray(e)&&e.every(r=>q.isElement(r))},isElementProps(e){return e.children!==void 0},isElementType:function(r,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"type";return ar(r)&&r[n]===t},matches(e,r){for(var t in r)if(t!=="children"&&e[t]!==r[t])return!1;return!0}},mt=["children"],pt=["text"],or=new WeakMap,u={ancestor(e,r){var t=u.get(e,r);if(w.isText(t))throw new Error("Cannot get the ancestor node at path [".concat(r,"] because it refers to a text node instead: ").concat(D.stringify(t)));return t},*ancestors(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};for(var n of o.ancestors(r,t)){var s=u.ancestor(e,n),i=[s,n];yield i}},child(e,r){if(w.isText(e))throw new Error("Cannot get the child of a text node: ".concat(D.stringify(e)));var t=e.children[r];if(t==null)throw new Error("Cannot get child at index `".concat(r,"` in node: ").concat(D.stringify(e)));return t},*children(e,r){for(var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{reverse:n=!1}=t,s=u.ancestor(e,r),{children:i}=s,a=n?i.length-1:0;n?a>=0:a1&&arguments[1]!==void 0?arguments[1]:{};for(var[t,n]of u.nodes(e,r))n.length!==0&&(yield[t,n])},*elements(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};for(var[t,n]of u.nodes(e,r))q.isElement(t)&&(yield[t,n])},extractProps(e){if(q.isAncestor(e)){var r=se(e,mt);return r}else{var r=se(e,pt);return r}},first(e,r){for(var t=r.slice(),n=u.get(e,t);n&&!(w.isText(n)||n.children.length===0);)n=n.children[0],t.push(0);return[n,t]},fragment(e,r){if(w.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(D.stringify(e)));var t=Le({children:e.children},n=>{var[s,i]=g.edges(r),a=u.nodes(n,{reverse:!0,pass:v=>{var[,x]=v;return!g.includes(r,x)}});for(var[,f]of a){if(!g.includes(r,f)){var c=u.parent(n,f),l=f[f.length-1];c.children.splice(l,1)}if(o.equals(f,i.path)){var d=u.leaf(n,f);d.text=d.text.slice(0,i.offset)}if(o.equals(f,s.path)){var h=u.leaf(n,f);h.text=h.text.slice(s.offset)}}E.isEditor(n)&&(n.selection=null)});return t.children},get(e,r){for(var t=e,n=0;nu.isNode(n));return or.set(e,t),t},last(e,r){for(var t=r.slice(),n=u.get(e,t);n&&!(w.isText(n)||n.children.length===0);){var s=n.children.length-1;n=n.children[s],t.push(s)}return[n,t]},leaf(e,r){var t=u.get(e,r);if(!w.isText(t))throw new Error("Cannot get the leaf node at path [".concat(r,"] because it refers to a non-leaf node: ").concat(D.stringify(t)));return t},*levels(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};for(var n of o.levels(r,t)){var s=u.get(e,n);yield[s,n]}},matches(e,r){return q.isElement(e)&&q.isElementProps(r)&&q.matches(e,r)||w.isText(e)&&w.isTextProps(r)&&w.matches(e,r)},*nodes(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{pass:t,reverse:n=!1}=r,{from:s=[],to:i}=r,a=new Set,f=[],c=e;!(i&&(n?o.isBefore(f,i):o.isAfter(f,i)));){if(a.has(c)||(yield[c,f]),!a.has(c)&&!w.isText(c)&&c.children.length!==0&&(t==null||t([c,f])===!1)){a.add(c);var l=n?c.children.length-1:0;o.isAncestor(f,s)&&(l=s[f.length]),f=f.concat(l),c=u.get(e,f);continue}if(f.length===0)break;if(!n){var d=o.next(f);if(u.has(e,d)){f=d,c=u.get(e,f);continue}}if(n&&f[f.length-1]!==0){var h=o.previous(f);f=h,c=u.get(e,f);continue}f=o.parent(f),c=u.get(e,f),a.add(c)}},parent(e,r){var t=o.parent(r),n=u.get(e,t);if(w.isText(n))throw new Error("Cannot get the parent of path [".concat(r,"] because it does not exist in the root."));return n},string(e){return w.isText(e)?e.text:e.children.map(u.string).join("")},*texts(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};for(var[t,n]of u.nodes(e,r))w.isText(t)&&(yield[t,n])}};function fr(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),t.push.apply(t,n)}return t}function b(e){for(var r=1;rre.isOperation(r))},isSelectionOperation(e){return re.isOperation(e)&&e.type.endsWith("_selection")},isTextOperation(e){return re.isOperation(e)&&e.type.endsWith("_text")},inverse(e){switch(e.type){case"insert_node":return b(b({},e),{},{type:"remove_node"});case"insert_text":return b(b({},e),{},{type:"remove_text"});case"merge_node":return b(b({},e),{},{type:"split_node",path:o.previous(e.path)});case"move_node":{var{newPath:r,path:t}=e;if(o.equals(r,t))return e;if(o.isSibling(t,r))return b(b({},e),{},{path:r,newPath:t});var n=o.transform(t,e),s=o.transform(o.next(t),e);return b(b({},e),{},{path:n,newPath:s})}case"remove_node":return b(b({},e),{},{type:"insert_node"});case"remove_text":return b(b({},e),{},{type:"insert_text"});case"set_node":{var{properties:i,newProperties:a}=e;return b(b({},e),{},{properties:a,newProperties:i})}case"set_selection":{var{properties:f,newProperties:c}=e;return f==null?b(b({},e),{},{properties:c,newProperties:null}):c==null?b(b({},e),{},{properties:null,newProperties:f}):b(b({},e),{},{properties:c,newProperties:f})}case"split_node":return b(b({},e),{},{type:"merge_node",path:o.next(e.path)})}}},cr=new WeakMap,yt=e=>{var r=cr.get(e);if(r!==void 0)return r;if(!P(e))return!1;var t=typeof e.addMark=="function"&&typeof e.apply=="function"&&typeof e.deleteFragment=="function"&&typeof e.insertBreak=="function"&&typeof e.insertSoftBreak=="function"&&typeof e.insertFragment=="function"&&typeof e.insertNode=="function"&&typeof e.insertText=="function"&&typeof e.isElementReadOnly=="function"&&typeof e.isInline=="function"&&typeof e.isSelectable=="function"&&typeof e.isVoid=="function"&&typeof e.normalizeNode=="function"&&typeof e.onChange=="function"&&typeof e.removeMark=="function"&&typeof e.getDirtyPaths=="function"&&(e.marks===null||P(e.marks))&&(e.selection===null||g.isRange(e.selection))&&u.isNodeList(e.children)&&re.isOperationList(e.operations);return cr.set(e,t),t},E={above(e,r){return e.above(r)},addMark(e,r,t){e.addMark(r,t)},after(e,r,t){return e.after(r,t)},before(e,r,t){return e.before(r,t)},deleteBackward(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{unit:t="character"}=r;e.deleteBackward(t)},deleteForward(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{unit:t="character"}=r;e.deleteForward(t)},deleteFragment(e,r){e.deleteFragment(r)},edges(e,r){return e.edges(r)},elementReadOnly(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return e.elementReadOnly(r)},end(e,r){return e.end(r)},first(e,r){return e.first(r)},fragment(e,r){return e.fragment(r)},hasBlocks(e,r){return e.hasBlocks(r)},hasInlines(e,r){return e.hasInlines(r)},hasPath(e,r){return e.hasPath(r)},hasTexts(e,r){return e.hasTexts(r)},insertBreak(e){e.insertBreak()},insertFragment(e,r,t){e.insertFragment(r,t)},insertNode(e,r){e.insertNode(r)},insertSoftBreak(e){e.insertSoftBreak()},insertText(e,r){e.insertText(r)},isBlock(e,r){return e.isBlock(r)},isEdge(e,r,t){return e.isEdge(r,t)},isEditor(e){return yt(e)},isElementReadOnly(e,r){return e.isElementReadOnly(r)},isEmpty(e,r){return e.isEmpty(r)},isEnd(e,r,t){return e.isEnd(r,t)},isInline(e,r){return e.isInline(r)},isNormalizing(e){return e.isNormalizing()},isSelectable(e,r){return e.isSelectable(r)},isStart(e,r,t){return e.isStart(r,t)},isVoid(e,r){return e.isVoid(r)},last(e,r){return e.last(r)},leaf(e,r,t){return e.leaf(r,t)},levels(e,r){return e.levels(r)},marks(e){return e.getMarks()},next(e,r){return e.next(r)},node(e,r,t){return e.node(r,t)},nodes(e,r){return e.nodes(r)},normalize(e,r){e.normalize(r)},parent(e,r,t){return e.parent(r,t)},path(e,r,t){return e.path(r,t)},pathRef(e,r,t){return e.pathRef(r,t)},pathRefs(e){return e.pathRefs()},point(e,r,t){return e.point(r,t)},pointRef(e,r,t){return e.pointRef(r,t)},pointRefs(e){return e.pointRefs()},positions(e,r){return e.positions(r)},previous(e,r){return e.previous(r)},range(e,r,t){return e.range(r,t)},rangeRef(e,r,t){return e.rangeRef(r,t)},rangeRefs(e){return e.rangeRefs()},removeMark(e,r){e.removeMark(r)},setNormalizing(e,r){e.setNormalizing(r)},start(e,r){return e.start(r)},string(e,r,t){return e.string(r,t)},unhangRange(e,r,t){return e.unhangRange(r,t)},void(e,r){return e.void(r)},withoutNormalizing(e,r){e.withoutNormalizing(r)}};function lr(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),t.push.apply(t,n)}return t}function ur(e){for(var r=1;rr.offset?1:0:t},isAfter(e,r){return y.compare(e,r)===1},isBefore(e,r){return y.compare(e,r)===-1},equals(e,r){return e.offset===r.offset&&o.equals(e.path,r.path)},isPoint(e){return P(e)&&typeof e.offset=="number"&&o.isPath(e.path)},transform(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Le(e,n=>{if(n===null)return null;var{affinity:s="forward"}=t,{path:i,offset:a}=n;switch(r.type){case"insert_node":case"move_node":{n.path=o.transform(i,r,t);break}case"insert_text":{o.equals(r.path,i)&&(r.offset2&&arguments[2]!==void 0?arguments[2]:{},{loose:n=!1}=t;function s(i){var a=se(i,bt);return a}return yr(n?s(e):e,n?s(r):r)},isText(e){return P(e)&&typeof e.text=="string"},isTextList(e){return Array.isArray(e)&&e.every(r=>w.isText(r))},isTextProps(e){return e.text!==void 0},matches(e,r){for(var t in r)if(t!=="text"&&(!e.hasOwnProperty(t)||e[t]!==r[t]))return!1;return!0},decorations(e,r){var t=[T({},e)];for(var n of r){var s=se(n,wt),[i,a]=g.edges(n),f=[],c=0,l=i.offset,d=a.offset;for(var h of t){var{length:v}=h.text,x=c;if(c+=v,l<=x&&c<=d){Object.assign(h,s),f.push(h);continue}if(l!==d&&(l===c||d===x)||l>c||dx){var S=l-x;j=T(T({},O),{},{text:O.text.slice(0,S)}),O=T(T({},O),{},{text:O.text.slice(S)})}Object.assign(O,s),j&&f.push(j),f.push(O),L&&f.push(L)}t=f}return t}},xt=e=>e.selection?e.selection:e.children.length>0?E.end(e,[]):[0],p;(function(e){e[e.None=0]="None",e[e.Extend=1]="Extend",e[e.ZWJ=2]="ZWJ",e[e.RI=4]="RI",e[e.Prepend=8]="Prepend",e[e.SpacingMark=16]="SpacingMark",e[e.L=32]="L",e[e.V=64]="V",e[e.T=128]="T",e[e.LV=256]="LV",e[e.LVT=512]="LVT",e[e.ExtPict=1024]="ExtPict",e[e.Any=2048]="Any"})(p||(p={}));p.L,p.L|p.V|p.LV|p.LVT,p.LV|p.V,p.V|p.T,p.LVT|p.T,p.T,p.Any,p.Extend|p.ZWJ,p.Any,p.SpacingMark,p.Prepend,p.Any,p.ZWJ,p.ExtPict,p.RI,p.RI;var Ot={delete(e,r){e.delete(r)},insertFragment(e,r,t){e.insertFragment(r,t)},insertText(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};E.withoutNormalizing(e,()=>{var{voids:n=!1}=t,{at:s=xt(e)}=t;if(o.isPath(s)&&(s=E.range(e,s)),g.isRange(s))if(g.isCollapsed(s))s=s.anchor;else{var i=g.end(s);if(!n&&E.void(e,{at:i}))return;var a=g.start(s),f=E.pointRef(e,a),c=E.pointRef(e,i);vr.delete(e,{at:s,voids:n});var l=f.unref(),d=c.unref();s=l||d,vr.setSelection(e,{anchor:s,focus:s})}if(!(!n&&E.void(e,{at:s})||E.elementReadOnly(e,{at:s}))){var{path:h,offset:v}=s;r.length>0&&e.apply({type:"insert_text",path:h,offset:v,text:r})}})}};function gr(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),t.push.apply(t,n)}return t}function oe(e){for(var r=1;ra.children).map(a=>a==null?void 0:a.text))??[];r.push(i.join(" "));continue}q.isElement(s)&&((n=s.children)==null||n.forEach(i=>{r.push(i.text.trim())}))}return r.join(" ")}function Nt(){const{hide:e,data:r}=Jr(),t=Hr({mutationKey:["attach-to-911-call"],onSuccess(n,s){e(),s.type==="assign"?Je({title:"Attached to call",message:`Successfully attached yourself to call #${n.caseNumber}.`}):Je({title:"Unattached from call",message:`Successfully unattached yourself from call #${n.caseNumber}.`})},mutationFn:async n=>{if(!(r!=null&&r.url)||!r.userApiToken)throw new Error("SnailyCAD API URL and/or Personal API Token not provided.");const{data:s,error:i,errorMessage:a}=await Xr({url:r.url,path:`/911-calls/${n.type}/${n.callId}`,method:"POST",data:{unit:r.unitId},headers:{userApiToken:r.userApiToken}});if(i||!s)throw new Error(a||"Unknown error occurred. Please see F8 console for further details.");return s}});return m.jsxs("div",{className:"w-[56em] rounded-md bg-primary p-8",children:[m.jsxs("header",{className:"mb-2",children:[m.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[m.jsx("h1",{className:"text-2xl font-bold text-white",children:"Active 911 Calls"}),m.jsx(ye,{className:"px-1 text-base",onPress:e,children:m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",className:"bi bi-x",viewBox:"0 0 16 16",children:m.jsx("path",{d:"M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"})})})]}),m.jsxs("p",{className:"text-neutral-200",children:["A list of all active 911 calls. Click on any of them to assign yourself to a call.",m.jsx("br",{}),"Additionally use",m.jsx("code",{className:"inline-block bg-secondary p-0.5",children:"/sn-attach "})]})]}),t.error?m.jsx(Qr,{type:"error",title:"An error occurred",message:t.error.message}):null,m.jsx("div",{className:"thin-scrollbar mt-6 block max-w-full overflow-x-auto pb-5",children:m.jsxs("table",{className:"w-full whitespace-nowrap text-white",children:[m.jsxs("thead",{children:[m.jsx("th",{className:"select-none bg-gray-200 p-2 px-3 text-left text-sm font-semibold uppercase text-neutral-700 first:rounded-tl-md last:rounded-tr-md dark:bg-secondary dark:text-gray-400 lg:table-cell",children:"Case Number"}),m.jsx("th",{className:"select-none bg-gray-200 p-2 px-3 text-left text-sm font-semibold uppercase text-neutral-700 first:rounded-tl-md last:rounded-tr-md dark:bg-secondary dark:text-gray-400 lg:table-cell",children:"Location"}),m.jsx("th",{className:"select-none bg-gray-200 p-2 px-3 text-left text-sm font-semibold uppercase text-neutral-700 first:rounded-tl-md last:rounded-tr-md dark:bg-secondary dark:text-gray-400 lg:table-cell",children:"Caller"}),m.jsx("th",{className:"select-none bg-gray-200 p-2 px-3 text-left text-sm font-semibold uppercase text-neutral-700 first:rounded-tl-md last:rounded-tr-md dark:bg-secondary dark:text-gray-400 lg:table-cell",children:"Description"}),m.jsx("th",{className:"select-none bg-gray-200 p-2 px-3 text-left text-sm font-semibold uppercase text-neutral-700 first:rounded-tl-md last:rounded-tr-md dark:bg-secondary dark:text-gray-400 lg:table-cell",children:"Actions"})]}),m.jsx("tbody",{children:r==null?void 0:r.calls.map(n=>{var f,c;const s=((f=t.variables)==null?void 0:f.callId)===n.id,i=(c=n.assignedUnits)==null?void 0:c.some(l=>{var d;return((d=l.unit)==null?void 0:d.id)===r.unitId}),a=n.descriptionData?Pt(n.descriptionData):n.description;return m.jsxs("tr",{className:Zr(i&&"bg-amber-900"),children:[m.jsxs("td",{className:"m-0 p-3 text-left",children:["#",n.caseNumber]}),m.jsx("td",{className:"m-0 p-3 text-left",children:n.location}),m.jsx("td",{className:"m-0 p-3 text-left",children:n.name}),m.jsx("td",{className:"m-0 p-3 text-left",children:a||"None"}),m.jsx("td",{className:"m-0 p-3 text-left",children:m.jsxs(ye,{className:"flex items-center gap-2",isDisabled:s&&t.isPending,onPress:()=>t.mutate({type:i?"unassign":"assign",callId:n.id}),size:"xs",children:[s&&t.isPending?m.jsx(Gr,{className:"w-4 h-4"}):null,i?"Unassign from call":"Assign to call"]})})]},n.id)})})]})}),m.jsx(ye,{onPress:e,children:"Cancel"})]})}export{Nt as Call911AttachScreen};