import{a as i_,b as H_,c as K_}from"https://app.gitbook.com/public/app/chunks/chunk-Q7WTP7ML.min.js";import{a as b1,b as k1,c as x1,d as Qg,e as r_,f as u_,g as kc,h as p_,i as A_,j as D_,k as G_}from"https://app.gitbook.com/public/app/chunks/chunk-GC23IXXO.min.js";import{a as Tx,b as d_,c as R_}from"https://app.gitbook.com/public/app/chunks/chunk-T42Z62SC.min.js";import{a as Q1}from"https://app.gitbook.com/public/app/chunks/chunk-Y72P6YX6.min.js";import{a as B1,b as BD,c as L_,d as N_}from"https://app.gitbook.com/public/app/chunks/chunk-BE4KPEHA.min.js";import{a as Zr,b as W_,c as ad}from"https://app.gitbook.com/public/app/chunks/chunk-4SOBZR2T.min.js";import{a as ph}from"https://app.gitbook.com/public/app/chunks/chunk-U7PRGJTD.min.js";import"https://app.gitbook.com/public/app/chunks/chunk-JE3FFDV2.min.js";import{a as Ma,b as Qp,c as NO,d as AO}from"https://app.gitbook.com/public/app/chunks/chunk-TCCNHHJO.min.js";import{a as rd}from"https://app.gitbook.com/public/app/chunks/chunk-ADRY3IEO.min.js";import{A as ur,B as j1,C as wc,D as $1,F as td,G as Lw,H as l_,I as Nw,J as od,L as T_,M as M_,a as vi,b as Rw,c as ge,d as Bt,e as Ug,f as am,g as W1,h as Mw,i as Yg,j as Zu,k as jg,l as z1,m as F1,n as V1,o as q1,p as $g,q as Zg,r as G1,s as Jg,t as H1,u as K1,v as X1,w as bc,x as Ju,y as U1,z as Y1}from"https://app.gitbook.com/public/app/chunks/chunk-AC66EKMY.min.js";import{a as nh}from"https://app.gitbook.com/public/app/chunks/chunk-MNMDJBDI.min.js";import{a as Ps}from"https://app.gitbook.com/public/app/chunks/chunk-F6NGKYSV.min.js";import{a as oh}from"https://app.gitbook.com/public/app/chunks/chunk-C4SJPGGN.min.js";import{b as DO}from"https://app.gitbook.com/public/app/chunks/chunk-QKYFLOIO.min.js";import{a as sd,b as z_,c as F_}from"https://app.gitbook.com/public/app/chunks/chunk-VDOWUZDR.min.js";import"https://app.gitbook.com/public/app/chunks/chunk-UMNW7V6U.min.js";import{a as og,b as Px,e as wO,f as Pw,g as Ew,h as Pn,i as im,j as Mn,k as lm,l as ah,m as a_,n as yh,o as ra,q as V_,r as q_}from"https://app.gitbook.com/public/app/chunks/chunk-PGPCZH4V.min.js";import{a as E_}from"https://app.gitbook.com/public/app/chunks/chunk-57UQM67A.min.js";import{a as qe,b as Jr,c as vh}from"https://app.gitbook.com/public/app/chunks/chunk-4CCMJRJD.min.js";import"https://app.gitbook.com/public/app/chunks/chunk-TGXEK7XE.min.js";import{a as rh,b as n_,d as mh,e as y_}from"https://app.gitbook.com/public/app/chunks/chunk-URRZP235.min.js";import{a as id,c as Ml,d as B_}from"https://app.gitbook.com/public/app/chunks/chunk-BR4AKNPD.min.js";import{a as oa}from"https://app.gitbook.com/public/app/chunks/chunk-MDGYK3KH.min.js";import{a as hh}from"https://app.gitbook.com/public/app/chunks/chunk-LRLHE5UU.min.js";import{b as h_}from"https://app.gitbook.com/public/app/chunks/chunk-JIDEEDOC.min.js";import{c as bh}from"https://app.gitbook.com/public/app/chunks/chunk-2QFTAXGC.min.js";import{a as ho,b as Is,c as Es,d as St,e as Pr,f as Cc,g as dh,h as Va,j as I_,k as P_,m as Dw}from"https://app.gitbook.com/public/app/chunks/chunk-REK4PVLK.min.js";import{a as c_,c as m_,d as f_,e as g_,g as O_,i as Tl,j as __}from"https://app.gitbook.com/public/app/chunks/chunk-ZMGVS43S.min.js";import{b as Zp,c as Jp,e as MO,f as LO}from"https://app.gitbook.com/public/app/chunks/chunk-7GFRLHQ6.min.js";import{a as i1,b as Ce}from"https://app.gitbook.com/public/app/chunks/chunk-PH3DA7JJ.min.js";import{a as $o,b as um,c as Je,d as uh}from"https://app.gitbook.com/public/app/chunks/chunk-ANAZ4FDC.min.js";import{$ as o1,K as Ix,L as Xr,M as Mx,N as Du,O as ng,P as Lx,V as Dg,W as e1,X as Dt,Y as Bg,Z as t1,ba as n1,ca as r1,da as ne,ha as Wg,ia as _w,ja as v_,ka as nd,oa as Ms,pa as b_,qa as Pl,ra as w_,sa as S_,ta as Aw,wa as C_,xa as No,ya as xi}from"https://app.gitbook.com/public/app/chunks/chunk-T4VDA6TU.min.js";import{a as Gg}from"https://app.gitbook.com/public/app/chunks/chunk-WYE6KHZL.min.js";import{a as Sc}from"https://app.gitbook.com/public/app/chunks/chunk-OM7TP4AG.min.js";import{a as yo,b as ih,d as cm,e as Il,g as ch,h as s_,i as Lo,j as lh,k as Ts,l as Fa}from"https://app.gitbook.com/public/app/chunks/chunk-D4QCWM7Z.min.js";import{b as Ir,d as Qu,e as eh,f as oo,g as th,h as Z1,i as J1,j as e_,k as ae,l as t_,m as o_,n as ed,o as sm,p as le,q as sh}from"https://app.gitbook.com/public/app/chunks/chunk-MYKYXVRA.min.js";import{a as Au,b as J,c as $r}from"https://app.gitbook.com/public/app/chunks/chunk-5AOZ7ADI.min.js";import{f as D1}from"https://app.gitbook.com/public/app/chunks/chunk-EKJLKUZF.min.js";import{a as Nx,c as El,d as k_,e as fh,f as xc,g as gh,h as x_}from"https://app.gitbook.com/public/app/chunks/chunk-JZCJSRRC.min.js";import{a as na}from"https://app.gitbook.com/public/app/chunks/chunk-IGKSMFLE.min.js";import{d as we}from"https://app.gitbook.com/public/app/chunks/chunk-HSTL35EO.min.js";import{$b as mw,$c as B,$e as Ow,Ad as FO,Bc as Jx,Cc as _g,Dc as SO,Eb as uw,Ec as CO,Ee as GO,Fb as ys,Fc as yi,Fe as xw,Gb as Ia,Gc as kO,Ge as fc,Hc as Rg,Ic as xO,Ie as Xu,Jc as Ig,Je as HO,Kb as rg,Kc as OO,Ke as gc,Lb as Ax,Lc as _O,Mc as RO,Me as KO,Nb as ig,Nc as IO,Ne as Lg,Ob as un,Oc as Sw,Oe as XO,Pb as Sl,Pc as PO,Pd as VO,Pe as tm,Qb as Dx,Qc as EO,Rb as Bx,Rc as TO,Rd as qO,Sc as Pg,Sd as kw,Tc as jp,Td as Tg,Uc as La,Vb as Wx,Vc as $p,Wb as dw,Wc as Rr,Xc as Rt,Xd as Mg,Yc as cr,Ye as om,Zb as zx,Zc as Na,Ze as UO,_b as pw,_c as lr,ac as Fx,ad as em,bd as Cw,bf as YO,cc as Vx,cd as BO,cf as jO,dd as Hu,e as Ox,ed as In,f as _x,fd as Ku,g as Rx,gd as WO,ic as Kx,jc as sg,jd as zO,jf as $O,kc as Xx,kd as to,kf as ZO,lc as Ux,mc as Vp,mf as JO,nc as Yx,nf as Ng,oc as $i,of as Ag,pc as jx,pd as Aa,pf as QO,qc as $x,rd as ea,wb as ji,xb as hs,xc as Zx,zd as Eg}from"https://app.gitbook.com/public/app/chunks/chunk-3TI7A3I3.min.js";import{b as ki}from"https://app.gitbook.com/public/app/chunks/chunk-KGG77WQT.min.js";import{A as S1,B as To,C as mt,D as ju,E as Da,F as Re,G as Mo,I as C1,J as V,L as Tn,M as Hg,O as yc,P as Ba,Q as vc,R as O1,S as _1,T as R1,U as I1,V as Wa,W as Rl,X as P1,Y as E1,a as MD,b as hc,ba as T1,c as Iw,ca as $u,d as a1,da as Ci,e as s1,ea as M1,f as c1,fa as za,g as l1,ga as bt,h as j,i as It,j as pe,ja as W,k as g1,ka as L1,la as N1,ma as go,na as Kg,o as Tw,oa as Xg,p as Yo,pa as rm,q as nm,r as En,ra as A1,s as Uu,u as v1,w as Si,x as Yu,y as w1,z as jo}from"https://app.gitbook.com/public/app/chunks/chunk-QE7TWPD2.min.js";import{c as Yi}from"https://app.gitbook.com/public/app/chunks/chunk-4MH4QYR7.min.js";import{$ as dn,$a as uO,A as dg,Aa as Yr,Ab as yO,B as Gt,Ba as ar,Bb as Pe,C as qp,Ca as sr,Cb as AD,D as LD,Da as jr,Db as DD,Ea as mo,Eb as ee,Fa as Kp,Fb as Qi,G as oO,Gb as vO,H as Gp,Ha as Rn,Hb as bO,I as pc,Ia as Xp,Ib as qu,Ja as Up,Jb as Gu,Ka as mc,La as mg,Ma as Ta,Na as zu,Oa as fg,P as Hp,Pa as gg,Q as nO,Qa as hg,R as rO,Ra as ks,S as ND,T as iO,Ta as Yp,U as hw,Ua as xs,V as rr,Va as yg,W as Ea,Wa as vg,X as aO,Xa as We,Y as _n,Ya as bw,Z as vs,Za as Os,_ as bs,_a as lO,aa as Zi,ab as wt,b as fw,ba as sO,bb as Fu,ca as Ve,cb as ww,d as qx,da as Ge,db as bg,e as gw,ea as tt,eb as eo,f as ag,fa as lo,ga as uo,gb as xl,h as Bu,ha as Ht,hb as dO,i as hi,ia as po,ib as pO,j as Gx,ja as Xo,jb as mO,k as Hx,ka as fe,kb as fO,la as ws,lb as wg,ma as Kt,mb as Sg,n as Pa,na as Eo,nb as _s,o as Qx,oa as yw,ob as Cg,p as cg,pa as cO,qa as vw,qb as Vu,r as Wu,ra as Cl,rb as gO,sa as pg,sb as kg,t as lg,ta as ir,tb as xg,u as qt,ua as Or,ub as hO,v as Po,va as Ur,vb as Uo,wa as Ss,wb as Og,x as eO,xa as kl,xb as Ji,y as be,ya as _r,yb as pt,z as tO,za as Cs,zb as Ol}from"https://app.gitbook.com/public/app/chunks/chunk-IEUYLQSD.min.js";import{a as Ze}from"https://app.gitbook.com/public/app/chunks/chunk-TFATNSDK.min.js";import{B as N,C as ta,D as u1,E as Z,F as d1,G as v,H as M,I as g,J as w,K as p1,L as zg,M as Fg,N as Vg,P as Ue,Q as qg,R as fo,S as je,T as m1,U as f1,V as _l,W as h1,X as y1,Y as Rs,Z as bi,_,aa as wi,ba as D,ca as F,m as x,n as TD,o as z,q as Sx,r as At,t as Cx,u as kx,v as tr,w as or,x as Kr,y as xx}from"https://app.gitbook.com/public/app/chunks/chunk-T2HA4LRU.min.js";import{b as nr,c as lw}from"https://app.gitbook.com/public/app/chunks/chunk-DIEFZQMG.min.js";import{a as Fp}from"https://app.gitbook.com/public/app/chunks/chunk-644MUXOE.min.js";import{b as Oe,c as Fe,d as se,e as Ex,f as ug}from"https://app.gitbook.com/public/app/chunks/chunk-XAGBDEI3.min.js";import{b as Ae,c as ED,d as b,f as c}from"https://app.gitbook.com/public/app/chunks/chunk-JSCW7V4P.min.js";var iI=Ae((Cne,rI)=>{c();var r8="Expected a function",oI=NaN,i8="[object Symbol]",a8=/^\s+|\s+$/g,s8=/^[-+]0x[0-9a-f]+$/i,c8=/^0b[01]+$/i,l8=/^0o[0-7]+$/i,u8=parseInt,d8=typeof window=="object"&&window&&window.Object===Object&&window,p8=typeof self=="object"&&self&&self.Object===Object&&self,m8=d8||p8||Function("return this")(),f8=Object.prototype,g8=f8.toString,h8=Math.max,y8=Math.min,Zw=function(){return m8.Date.now()};function v8(t,o,e){var n,r,i,a,s,l,u=0,d=!1,p=!1,f=!0;if(typeof t!="function")throw new TypeError(r8);o=nI(o)||0,Jw(e)&&(d=!!e.leading,p="maxWait"in e,i=p?h8(nI(e.maxWait)||0,o):i,f="trailing"in e?!!e.trailing:f);function m(E){var P=n,L=r;return n=r=void 0,u=E,a=t.apply(L,P),a}function h(E){return u=E,s=setTimeout(C,o),d?m(E):a}function y(E){var P=E-l,L=E-u,T=o-P;return p?y8(T,i-L):T}function S(E){var P=E-l,L=E-u;return l===void 0||P>=o||P<0||p&&L>=i}function C(){var E=Zw();if(S(E))return k(E);s=setTimeout(C,y(E))}function k(E){return s=void 0,f&&n?m(E):(n=r=void 0,a)}function O(){s!==void 0&&clearTimeout(s),u=0,n=l=r=s=void 0}function R(){return s===void 0?a:k(Zw())}function I(){var E=Zw(),P=S(E);if(n=arguments,r=this,l=E,P){if(s===void 0)return h(l);if(p)return s=setTimeout(C,o),m(l)}return s===void 0&&(s=setTimeout(C,o)),a}return I.cancel=O,I.flush=R,I}function Jw(t){var o=typeof t;return!!t&&(o=="object"||o=="function")}function b8(t){return!!t&&typeof t=="object"}function w8(t){return typeof t=="symbol"||b8(t)&&g8.call(t)==i8}function nI(t){if(typeof t=="number")return t;if(w8(t))return oI;if(Jw(t)){var o=typeof t.valueOf=="function"?t.valueOf():t;t=Jw(o)?o+"":o}if(typeof t!="string")return t===0?t:+t;t=t.replace(a8,"");var e=c8.test(t);return e||l8.test(t)?u8(t.slice(2),e?2:8):s8.test(t)?oI:+t}rI.exports=v8});var cI=Ae((xne,sI)=>{c();var aI=function(){if(typeof self=="object"&&self)return self;if(typeof window=="object"&&window)return window;throw new Error("Unable to resolve global `this`")};sI.exports=function(){if(this)return this;if(typeof globalThis=="object"&&globalThis)return globalThis;try{Object.defineProperty(Object.prototype,"__global__",{get:function(){return this},configurable:!0})}catch{return aI()}try{return __global__||aI()}finally{delete Object.prototype.__global__}}()});var lI=Ae((_ne,S8)=>{S8.exports={name:"websocket",description:"Websocket Client & Server Library implementing the WebSocket protocol as specified in RFC 6455.",keywords:["websocket","websockets","socket","networking","comet","push","RFC-6455","realtime","server","client"],author:"Brian McKelvey (https://github.com/theturtle32)",contributors:["I\xF1aki Baz Castillo (http://dev.sipdoc.net)"],version:"1.0.34",repository:{type:"git",url:"https://github.com/theturtle32/WebSocket-Node.git"},homepage:"https://github.com/theturtle32/WebSocket-Node",engines:{node:">=4.0.0"},dependencies:{bufferutil:"^4.0.1",debug:"^2.2.0","es5-ext":"^0.10.50","typedarray-to-buffer":"^3.1.5","utf-8-validate":"^5.0.2",yaeti:"^0.0.6"},devDependencies:{"buffer-equal":"^1.0.0",gulp:"^4.0.2","gulp-jshint":"^2.0.4","jshint-stylish":"^2.2.1",jshint:"^2.0.0",tape:"^4.9.1"},config:{verbose:!1},scripts:{test:"tape test/unit/*.js",gulp:"gulp"},main:"index",directories:{lib:"./lib"},browser:"lib/browser.js",license:"Apache-2.0"}});var dI=Ae((Rne,uI)=>{c();uI.exports=lI().version});var fI=Ae((Pne,mI)=>{c();var Dl;if(typeof globalThis=="object")Dl=globalThis;else try{Dl=cI()}catch{}finally{if(!Dl&&typeof window<"u"&&(Dl=window),!Dl)throw new Error("Could not determine global this")}var ym=Dl.WebSocket||Dl.MozWebSocket,C8=dI();function pI(t,o){var e;return o?e=new ym(t,o):e=new ym(t),e}ym&&["CONNECTING","OPEN","CLOSING","CLOSED"].forEach(function(t){Object.defineProperty(pI,t,{get:function(){return ym[t]}})});mI.exports={w3cwebsocket:ym?pI:null,version:C8}});var pP=Ae(cS=>{c();Object.defineProperty(cS,"__esModule",{value:!0});var e3=Object.assign||function(t){for(var o=1;o=0||Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}function s3(t,o){if(!(t instanceof o))throw new TypeError("Cannot call a class as a function")}function lP(t,o){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return o&&(typeof o=="object"||typeof o=="function")?o:t}function c3(t,o){if(typeof o!="function"&&o!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof o);t.prototype=Object.create(o&&o.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),o&&(Object.setPrototypeOf?Object.setPrototypeOf(t,o):t.__proto__=o)}var dP=function(t){c3(o,t);function o(){var e,n,r,i;s3(this,o);for(var a=arguments.length,s=Array(a),l=0;l{U3.exports="https://app.gitbook.com/public/app/assets/youtube.raw-KIFNDQS6.svg"});var mE=Ae((ime,Y3)=>{Y3.exports="https://app.gitbook.com/public/app/assets/soundcloud.raw-2NJLH377.svg"});var fE=Ae((ame,j3)=>{j3.exports="https://app.gitbook.com/public/app/assets/loom.raw-3KUBFJOQ.svg"});var gE=Ae((sme,$3)=>{$3.exports="https://app.gitbook.com/public/app/assets/github.raw-G362N2HA.svg"});var hE=Ae((cme,Z3)=>{Z3.exports="https://app.gitbook.com/public/app/assets/github.dark.raw-A2MHFBQG.svg"});var yE=Ae((lme,J3)=>{J3.exports="https://app.gitbook.com/public/app/assets/framer.raw-BZOKEAUJ.svg"});var vE=Ae((ume,Q3)=>{Q3.exports="https://app.gitbook.com/public/app/assets/framer.dark.raw-HVTXI7EB.svg"});var bE=Ae((dme,eB)=>{eB.exports="https://app.gitbook.com/public/app/assets/codepen.raw-PGSLYKJU.svg"});var wE=Ae((pme,tB)=>{tB.exports="https://app.gitbook.com/public/app/assets/codepen.dark.raw-HNDMNQX3.svg"});var SE=Ae((mme,oB)=>{oB.exports="https://app.gitbook.com/public/app/assets/dribbble.raw-KBB5DOUQ.svg"});var CE=Ae((fme,nB)=>{nB.exports="https://app.gitbook.com/public/app/assets/trello.raw-5HIIOOAI.svg"});var kE=Ae((gme,rB)=>{rB.exports="https://app.gitbook.com/public/app/assets/typeform.raw-74VPCTO6.svg"});var xE=Ae((hme,iB)=>{iB.exports="https://app.gitbook.com/public/app/assets/typeform.dark.raw-47MGSH5W.svg"});var OE=Ae((yme,aB)=>{aB.exports="https://app.gitbook.com/public/app/assets/google-docs.raw-I6UHVZFS.svg"});var _E=Ae((vme,sB)=>{sB.exports="https://app.gitbook.com/public/app/assets/google-sheets.raw-IGZ6R7IJ.svg"});var RE=Ae((bme,cB)=>{cB.exports="https://app.gitbook.com/public/app/assets/google-slides.raw-WGHORNC6.svg"});var IE=Ae((wme,lB)=>{lB.exports="https://app.gitbook.com/public/app/assets/google-forms.raw-7C25TP6G.svg"});var qT=Ae((bye,Z5)=>{Z5.exports={"100":"Continue","101":"Switching Protocols","102":"Processing","103":"Early Hints","200":"OK","201":"Created","202":"Accepted","203":"Non-Authoritative Information","204":"No Content","205":"Reset Content","206":"Partial Content","207":"Multi-Status","208":"Already Reported","226":"IM Used","300":"Multiple Choices","301":"Moved Permanently","302":"Found","303":"See Other","304":"Not Modified","305":"Use Proxy","307":"Temporary Redirect","308":"Permanent Redirect","400":"Bad Request","401":"Unauthorized","402":"Payment Required","403":"Forbidden","404":"Not Found","405":"Method Not Allowed","406":"Not Acceptable","407":"Proxy Authentication Required","408":"Request Timeout","409":"Conflict","410":"Gone","411":"Length Required","412":"Precondition Failed","413":"Payload Too Large","414":"URI Too Long","415":"Unsupported Media Type","416":"Range Not Satisfiable","417":"Expectation Failed","418":"I'm a Teapot","421":"Misdirected Request","422":"Unprocessable Entity","423":"Locked","424":"Failed Dependency","425":"Too Early","426":"Upgrade Required","428":"Precondition Required","429":"Too Many Requests","431":"Request Header Fields Too Large","451":"Unavailable For Legal Reasons","500":"Internal Server Error","501":"Not Implemented","502":"Bad Gateway","503":"Service Unavailable","504":"Gateway Timeout","505":"HTTP Version Not Supported","506":"Variant Also Negotiates","507":"Insufficient Storage","508":"Loop Detected","509":"Bandwidth Limit Exceeded","510":"Not Extended","511":"Network Authentication Required"}});var KT=Ae((wye,HT)=>{"use strict";c();var tC=qT();HT.exports=ua;ua.message=tC;ua.code=J5(tC);ua.codes=Q5(tC);ua.redirect={300:!0,301:!0,302:!0,303:!0,305:!0,307:!0,308:!0};ua.empty={204:!0,205:!0,304:!0};ua.retry={502:!0,503:!0,504:!0};function J5(t){var o={};return Object.keys(t).forEach(function(n){var r=t[n],i=Number(n);o[r.toLowerCase()]=i}),o}function Q5(t){return Object.keys(t).map(function(e){return Number(e)})}function eW(t){var o=t.toLowerCase();if(!Object.prototype.hasOwnProperty.call(ua.code,o))throw new Error('invalid status message: "'+t+'"');return ua.code[o]}function GT(t){if(!Object.prototype.hasOwnProperty.call(ua.message,t))throw new Error("invalid status code: "+t);return ua.message[t]}function ua(t){if(typeof t=="number")return GT(t);if(typeof t!="string")throw new TypeError("code must be a number or string");var o=parseInt(t,10);return isNaN(o)?eW(t):GT(o)}});var hM=Ae((Uy,gM)=>{c();(function(t,o){typeof define=="function"&&define.amd?define(o):typeof Uy=="object"&&typeof Uy.nodeName!="string"?gM.exports=o():t.RangeFix=o()})(Uy,function(){var t,o={};o.isBroken=function(){var r,i,a,s,l,u,d,p;return t===void 0&&(i=document.createElement("p"),a=document.createElement("span"),s=document.createTextNode("aa"),l=document.createTextNode("aa"),u=document.createElement("img"),u.setAttribute("src","data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs="),d=document.createRange(),t={},i.appendChild(s),i.appendChild(a),a.appendChild(u),a.appendChild(l),document.body.appendChild(i),d.setStart(s,1),d.setEnd(a,0),t.getClientRects=t.getBoundingClientRect=d.getClientRects().length>1,t.getClientRects||(d.setEnd(l,1),t.getClientRects=t.getBoundingClientRect=d.getClientRects().length===2),t.getBoundingClientRect||(d.setEnd(d.startContainer,d.startOffset),r=d.getBoundingClientRect(),t.getBoundingClientRect=r.top===0&&r.left===0),document.body.removeChild(i),p=window.ActiveXObject&&new Function("/*@cc_on return @_jscript_version; @*/")(),t.ieZoom=!!p&&p<=10),t};function e(r){var i;return!r||screen.deviceXDPI===screen.logicalXDPI?r:"length"in r?Array.prototype.map.call(r,e):(i=screen.deviceXDPI/screen.logicalXDPI,{top:r.top/i,bottom:r.bottom/i,left:r.left/i,right:r.right/i,width:r.width/i,height:r.height/i})}function n(r,i){var a,s=0,l=1024;if(l>=i.length)return Array.prototype.push.apply(r,i);for(;s{eF.exports="https://app.gitbook.com/public/app/assets/default-page-cover-K4LPTE6Y.png"});var tN=Ae((yBe,eN)=>{"use strict";c();var qV="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";eN.exports=qV});var iN=Ae((bBe,rN)=>{"use strict";c();var GV=tN();function oN(){}function nN(){}nN.resetWarningCache=oN;rN.exports=function(){function t(n,r,i,a,s,l){if(l!==GV){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}t.isRequired=t;function o(){return t}var e={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:o,element:t,elementType:t,instanceOf:o,node:t,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:nN,resetWarningCache:oN};return e.PropTypes=e,e}});var sN=Ae((kBe,aN)=>{c();aN.exports=iN()();var SBe,CBe});var fN=Ae(QC=>{"use strict";c();Object.defineProperty(QC,"__esModule",{value:!0});var ZC=Object.assign||function(t){for(var o=1;o=0||Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}function UV(t,o){if(!(t instanceof o))throw new TypeError("Cannot call a class as a function")}function YV(t,o){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return o&&(typeof o=="object"||typeof o=="function")?o:t}function jV(t,o){if(typeof o!="function"&&o!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof o);t.prototype=Object.create(o&&o.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),o&&(Object.setPrototypeOf?Object.setPrototypeOf(t,o):t.__proto__=o)}var cN={position:"absolute",top:0,left:0,visibility:"hidden",height:0,overflow:"scroll",whiteSpace:"pre"},$V=["extraWidth","injectStyles","inputClassName","inputRef","inputStyle","minWidth","onAutosize","placeholderIsMinWidth"],ZV=function(o){return $V.forEach(function(e){return delete o[e]}),o},lN=function(o,e){e.style.fontSize=o.fontSize,e.style.fontFamily=o.fontFamily,e.style.fontWeight=o.fontWeight,e.style.fontStyle=o.fontStyle,e.style.letterSpacing=o.letterSpacing,e.style.textTransform=o.textTransform},mN=typeof window<"u"&&window.navigator?/MSIE |Trident\/|Edge\//.test(window.navigator.userAgent):!1,uN=function(){return mN?"_"+Math.random().toString(36).substr(2,12):void 0},JC=function(t){jV(o,t);function o(e){UV(this,o);var n=YV(this,(o.__proto__||Object.getPrototypeOf(o)).call(this,e));return n.inputRef=function(r){n.input=r,typeof n.props.inputRef=="function"&&n.props.inputRef(r)},n.placeHolderSizerRef=function(r){n.placeHolderSizer=r},n.sizerRef=function(r){n.sizer=r},n.state={inputWidth:e.minWidth,inputId:e.id||uN()},n}return HV(o,[{key:"componentDidMount",value:function(){this.mounted=!0,this.copyInputStyles(),this.updateInputWidth()}},{key:"UNSAFE_componentWillReceiveProps",value:function(n){var r=n.id;r!==this.props.id&&this.setState({inputId:r||uN()})}},{key:"componentDidUpdate",value:function(n,r){r.inputWidth!==this.state.inputWidth&&typeof this.props.onAutosize=="function"&&this.props.onAutosize(this.state.inputWidth),this.updateInputWidth()}},{key:"componentWillUnmount",value:function(){this.mounted=!1}},{key:"copyInputStyles",value:function(){if(!(!this.mounted||!window.getComputedStyle)){var n=this.input&&window.getComputedStyle(this.input);n&&(lN(n,this.sizer),this.placeHolderSizer&&lN(n,this.placeHolderSizer))}}},{key:"updateInputWidth",value:function(){if(!(!this.mounted||!this.sizer||typeof this.sizer.scrollWidth>"u")){var n=void 0;this.props.placeholder&&(!this.props.value||this.props.value&&this.props.placeholderIsMinWidth)?n=Math.max(this.sizer.scrollWidth,this.placeHolderSizer.scrollWidth)+2:n=this.sizer.scrollWidth+2;var r=this.props.type==="number"&&this.props.extraWidth===void 0?16:parseInt(this.props.extraWidth)||0;n+=r,n{"use strict";c();Object.defineProperty(Wk,"__esModule",{value:!0});var pG={justifyContent:"center",alignItems:"center",overflow:"hidden",backgroundColor:"transparent"};Wk.default={container:pG}});var zk=Ae(wp=>{"use strict";c();Object.defineProperty(wp,"__esModule",{value:!0});wp.ImageZoomState=wp.ImageZoomProps=void 0;var mG=function(){function t(){this.cropWidth=100,this.cropHeight=100,this.imageWidth=100,this.imageHeight=100,this.panToMove=!0,this.pinchToZoom=!0,this.enableDoubleClickZoom=!0,this.clickDistance=10,this.maxOverflow=100,this.longPressTime=800,this.doubleClickInterval=175,this.style={},this.swipeDownThreshold=230,this.enableSwipeDown=!1,this.enableCenterFocus=!0,this.useHardwareTextureAndroid=!0,this.minScale=.6,this.maxScale=10,this.useNativeDriver=!1,this.onClick=function(){},this.onDoubleClick=function(){},this.onLongPress=function(){},this.horizontalOuterRangeOffset=function(){},this.onDragLeft=function(){},this.responderRelease=function(){},this.onMove=function(){},this.layoutChange=function(){},this.onSwipeDown=function(){},this.onStartShouldSetPanResponder=function(){return!0},this.onPanResponderTerminationRequest=function(){return!1}}return t}();wp.ImageZoomProps=mG;var fG=function(){function t(){this.centerX=.5,this.centerY=.5}return t}();wp.ImageZoomState=fG});var M2=Ae(xu=>{"use strict";c();var gG=xu&&xu.__extends||function(){var t=function(o,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)r.hasOwnProperty(i)&&(n[i]=r[i])},t(o,e)};return function(o,e){t(o,e);function n(){this.constructor=o}o.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Vf=xu&&xu.__assign||function(){return Vf=Object.assign||function(t){for(var o,e=1,n=arguments.length;e1){var r=(n.nativeEvent.changedTouches[0].pageX+n.nativeEvent.changedTouches[1].pageX)/2;e.centerDiffX=r-e.props.cropWidth/2;var i=(n.nativeEvent.changedTouches[0].pageY+n.nativeEvent.changedTouches[1].pageY)/2;e.centerDiffY=i-e.props.cropHeight/2}e.longPressTimeout&&clearTimeout(e.longPressTimeout);var a=n.nativeEvent,s=a.locationX,l=a.locationY,u=a.pageX,d=a.pageY;if(e.longPressTimeout=setTimeout(function(){e.isLongPress=!0,e.props.onLongPress&&e.props.onLongPress({locationX:s,locationY:l,pageX:u,pageY:d})},e.props.longPressTime),n.nativeEvent.changedTouches.length<=1)if(new Date().getTime()-e.lastClickTime<(e.props.doubleClickInterval||0)){if(e.lastClickTime=0,e.doubleClickX=n.nativeEvent.changedTouches[0].pageX,e.doubleClickY=n.nativeEvent.changedTouches[0].pageY,e.props.onDoubleClick&&e.props.onDoubleClick({locationX:n.nativeEvent.changedTouches[0].locationX,locationY:n.nativeEvent.changedTouches[0].locationY,pageX:e.doubleClickX,pageY:e.doubleClickY}),clearTimeout(e.longPressTimeout),e.isDoubleClick=!0,e.props.enableDoubleClickZoom){if(e.scale>1||e.scale<1)e.scale=1,e.positionX=0,e.positionY=0;else{var p=e.scale;e.scale=2;var f=e.scale-p;e.positionX=(e.props.cropWidth/2-e.doubleClickX)*f/e.scale,e.positionY=(e.props.cropHeight/2-e.doubleClickY)*f/e.scale}e.imageDidMove("centerOn"),$t.Animated.parallel([$t.Animated.timing(e.animatedScale,{toValue:e.scale,duration:100,useNativeDriver:!!e.props.useNativeDriver}),$t.Animated.timing(e.animatedPositionX,{toValue:e.positionX,duration:100,useNativeDriver:!!e.props.useNativeDriver}),$t.Animated.timing(e.animatedPositionY,{toValue:e.positionY,duration:100,useNativeDriver:!!e.props.useNativeDriver})]).start()}}else e.lastClickTime=new Date().getTime()},onPanResponderMove:function(n,r){if(!e.isDoubleClick){if(n.nativeEvent.changedTouches.length<=1){var i=r.dx-(e.lastPositionX||0);e.lastPositionX===null&&(i=0);var a=r.dy-(e.lastPositionY||0);if(e.lastPositionY===null&&(a=0),e.lastPositionX=r.dx,e.lastPositionY=r.dy,e.horizontalWholeCounter+=i,e.verticalWholeCounter+=a,(Math.abs(e.horizontalWholeCounter)>5||Math.abs(e.verticalWholeCounter)>5)&&clearTimeout(e.longPressTimeout),e.props.panToMove){if(e.swipeDownOffset===0){if(Math.abs(i)>Math.abs(a)&&(e.isHorizontalWrap=!0),e.props.imageWidth*e.scale>e.props.cropWidth){e.horizontalWholeOuterCounter>0?i<0?e.horizontalWholeOuterCounter>Math.abs(i)?(e.horizontalWholeOuterCounter+=i,i=0):(i+=e.horizontalWholeOuterCounter,e.horizontalWholeOuterCounter=0,e.props.horizontalOuterRangeOffset&&e.props.horizontalOuterRangeOffset(0)):e.horizontalWholeOuterCounter+=i:e.horizontalWholeOuterCounter<0&&(i>0?Math.abs(e.horizontalWholeOuterCounter)>i?(e.horizontalWholeOuterCounter+=i,i=0):(i+=e.horizontalWholeOuterCounter,e.horizontalWholeOuterCounter=0,e.props.horizontalOuterRangeOffset&&e.props.horizontalOuterRangeOffset(0)):e.horizontalWholeOuterCounter+=i),e.positionX+=i/e.scale;var s=(e.props.imageWidth*e.scale-e.props.cropWidth)/2/e.scale;e.positionX<-s?(e.positionX=-s,e.horizontalWholeOuterCounter+=-1/1e10):e.positionX>s&&(e.positionX=s,e.horizontalWholeOuterCounter+=1/1e10),e.animatedPositionX.setValue(e.positionX)}else e.horizontalWholeOuterCounter+=i;e.horizontalWholeOuterCounter>(e.props.maxOverflow||0)?e.horizontalWholeOuterCounter=e.props.maxOverflow||0:e.horizontalWholeOuterCounter<-(e.props.maxOverflow||0)&&(e.horizontalWholeOuterCounter=-(e.props.maxOverflow||0)),e.horizontalWholeOuterCounter!==0&&e.props.horizontalOuterRangeOffset&&e.props.horizontalOuterRangeOffset(e.horizontalWholeOuterCounter)}e.props.imageHeight*e.scale>e.props.cropHeight?(e.positionY+=a/e.scale,e.animatedPositionY.setValue(e.positionY)):e.props.enableSwipeDown&&!e.isHorizontalWrap&&(e.swipeDownOffset+=a,e.swipeDownOffset>0&&(e.positionY+=a/e.scale,e.animatedPositionY.setValue(e.positionY),e.scale=e.scale-a/1e3,e.animatedScale.setValue(e.scale)))}}else if(e.longPressTimeout&&clearTimeout(e.longPressTimeout),e.props.pinchToZoom){var l=void 0,u=void 0;n.nativeEvent.changedTouches[0].locationX>n.nativeEvent.changedTouches[1].locationX?(l=n.nativeEvent.changedTouches[1].pageX,u=n.nativeEvent.changedTouches[0].pageX):(l=n.nativeEvent.changedTouches[0].pageX,u=n.nativeEvent.changedTouches[1].pageX);var d=void 0,p=void 0;n.nativeEvent.changedTouches[0].locationY>n.nativeEvent.changedTouches[1].locationY?(d=n.nativeEvent.changedTouches[1].pageY,p=n.nativeEvent.changedTouches[0].pageY):(d=n.nativeEvent.changedTouches[0].pageY,p=n.nativeEvent.changedTouches[1].pageY);var f=u-l,m=p-d,h=Math.sqrt(f*f+m*m);if(e.zoomCurrentDistance=Number(h.toFixed(1)),e.zoomLastDistance!==null){var y=(e.zoomCurrentDistance-e.zoomLastDistance)/200,S=e.scale+y;S<(e.props.minScale||0)&&(S=e.props.minScale||0),S>(e.props.maxScale||0)&&(S=e.props.maxScale||0);var C=e.scale;e.scale=S,e.animatedScale.setValue(e.scale);var k=e.scale-C;e.positionX-=e.centerDiffX*k/e.scale,e.positionY-=e.centerDiffY*k/e.scale,e.animatedPositionX.setValue(e.positionX),e.animatedPositionY.setValue(e.positionY)}e.zoomLastDistance=e.zoomCurrentDistance}e.imageDidMove("onPanResponderMove")}},onPanResponderRelease:function(n,r){if(e.longPressTimeout&&clearTimeout(e.longPressTimeout),!e.isDoubleClick&&!e.isLongPress){var i=Math.sqrt(r.dx*r.dx+r.dy*r.dy),a=n.nativeEvent,s=a.locationX,l=a.locationY,u=a.pageX,d=a.pageY;n.nativeEvent.changedTouches.length===1&&i<(e.props.clickDistance||0)?e.singleClickTimeout=setTimeout(function(){e.props.onClick&&e.props.onClick({locationX:s,locationY:l,pageX:u,pageY:d})},e.props.doubleClickInterval):(e.props.responderRelease&&e.props.responderRelease(r.vx,e.scale),e.panResponderReleaseResolve())}},onPanResponderTerminate:function(){}}),e.resetScale=function(){e.positionX=0,e.positionY=0,e.scale=1,e.animatedScale.setValue(1)},e.panResponderReleaseResolve=function(){if(e.props.enableSwipeDown&&e.props.swipeDownThreshold&&e.swipeDownOffset>e.props.swipeDownThreshold){e.props.onSwipeDown&&e.props.onSwipeDown();return}if(e.props.enableCenterFocus&&e.scale<1&&(e.scale=1,$t.Animated.timing(e.animatedScale,{toValue:e.scale,duration:100,useNativeDriver:!!e.props.useNativeDriver}).start()),e.props.imageWidth*e.scale<=e.props.cropWidth&&(e.positionX=0,$t.Animated.timing(e.animatedPositionX,{toValue:e.positionX,duration:100,useNativeDriver:!!e.props.useNativeDriver}).start()),e.props.imageHeight*e.scale<=e.props.cropHeight&&(e.positionY=0,$t.Animated.timing(e.animatedPositionY,{toValue:e.positionY,duration:100,useNativeDriver:!!e.props.useNativeDriver}).start()),e.props.imageHeight*e.scale>e.props.cropHeight){var n=(e.props.imageHeight*e.scale-e.props.cropHeight)/2/e.scale;e.positionY<-n?e.positionY=-n:e.positionY>n&&(e.positionY=n),$t.Animated.timing(e.animatedPositionY,{toValue:e.positionY,duration:100,useNativeDriver:!!e.props.useNativeDriver}).start()}if(e.props.imageWidth*e.scale>e.props.cropWidth){var r=(e.props.imageWidth*e.scale-e.props.cropWidth)/2/e.scale;e.positionX<-r?e.positionX=-r:e.positionX>r&&(e.positionX=r),$t.Animated.timing(e.animatedPositionX,{toValue:e.positionX,duration:100,useNativeDriver:!!e.props.useNativeDriver}).start()}e.props.enableCenterFocus&&e.scale===1&&(e.positionX=0,e.positionY=0,$t.Animated.timing(e.animatedPositionX,{toValue:e.positionX,duration:100,useNativeDriver:!!e.props.useNativeDriver}).start(),$t.Animated.timing(e.animatedPositionY,{toValue:e.positionY,duration:100,useNativeDriver:!!e.props.useNativeDriver}).start()),e.horizontalWholeOuterCounter=0,e.swipeDownOffset=0,e.imageDidMove("onPanResponderRelease")},e}return o.prototype.componentDidMount=function(){this.props.centerOn&&this.centerOn(this.props.centerOn)},o.prototype.componentDidUpdate=function(e){(this.props.centerOn&&!e.centerOn||this.props.centerOn&&e.centerOn&&this.didCenterOnChange(e.centerOn,this.props.centerOn))&&this.centerOn(this.props.centerOn)},o.prototype.imageDidMove=function(e){this.props.onMove&&this.props.onMove({type:e,positionX:this.positionX,positionY:this.positionY,scale:this.scale,zoomCurrentDistance:this.zoomCurrentDistance})},o.prototype.didCenterOnChange=function(e,n){return e.x!==n.x||e.y!==n.y||e.scale!==n.scale},o.prototype.centerOn=function(e){var n=this;this.positionX=e.x,this.positionY=e.y,this.scale=e.scale;var r=e.duration||300;$t.Animated.parallel([$t.Animated.timing(this.animatedScale,{toValue:this.scale,duration:r,useNativeDriver:!!this.props.useNativeDriver}),$t.Animated.timing(this.animatedPositionX,{toValue:this.positionX,duration:r,useNativeDriver:!!this.props.useNativeDriver}),$t.Animated.timing(this.animatedPositionY,{toValue:this.positionY,duration:r,useNativeDriver:!!this.props.useNativeDriver})]).start(function(){n.imageDidMove("centerOn")})},o.prototype.handleLayout=function(e){this.props.layoutChange&&this.props.layoutChange(e)},o.prototype.reset=function(){this.scale=1,this.animatedScale.setValue(this.scale),this.positionX=0,this.animatedPositionX.setValue(this.positionX),this.positionY=0,this.animatedPositionY.setValue(this.positionY)},o.prototype.render=function(){var e={transform:[{scale:this.animatedScale},{translateX:this.animatedPositionX},{translateY:this.animatedPositionY}]},n=$t.StyleSheet.flatten(this.props.style);return Nb.createElement($t.View,{style:Vf(Vf(Vf({},hG.default.container),n),{width:this.props.cropWidth,height:this.props.cropHeight}),...this.imagePanResponder.panHandlers},Nb.createElement($t.Animated.View,{style:e,renderToHardwareTextureAndroid:this.props.useHardwareTextureAndroid},Nb.createElement($t.View,{onLayout:this.handleLayout.bind(this),style:{width:this.props.imageWidth,height:this.props.imageHeight}},this.props.children)))},o.defaultProps=new T2.ImageZoomProps,o}(Nb.Component);xu.default=yG});var L2=Ae(ul=>{"use strict";c();var vG=ul&&ul.__createBinding||(Object.create?function(t,o,e,n){n===void 0&&(n=e),Object.defineProperty(t,n,{enumerable:!0,get:function(){return o[e]}})}:function(t,o,e,n){n===void 0&&(n=e),t[n]=o[e]}),bG=ul&&ul.__exportStar||function(t,o){for(var e in t)e!=="default"&&!o.hasOwnProperty(e)&&vG(o,t,e)};Object.defineProperty(ul,"__esModule",{value:!0});var wG=M2();ul.default=wG.default;bG(zk(),ul)});var Fk=Ae(Ab=>{"use strict";c();Object.defineProperty(Ab,"__esModule",{value:!0});Ab.default=function(t,o,e){return{modalContainer:{backgroundColor:e,justifyContent:"center",alignItems:"center",overflow:"hidden"},watchOrigin:{position:"absolute",width:t,bottom:20,justifyContent:"center",alignItems:"center"},watchOriginTouchable:{paddingLeft:10,paddingRight:10,paddingTop:5,paddingBottom:5,borderRadius:30,borderColor:"white",borderWidth:.5,backgroundColor:"rgba(0, 0, 0, 0.1)"},watchOriginText:{color:"white",backgroundColor:"transparent"},imageStyle:{},container:{backgroundColor:e},moveBox:{flexDirection:"row",alignItems:"center"},menuContainer:{position:"absolute",width:t,height:o,left:0,bottom:0,zIndex:12},menuShadow:{position:"absolute",width:t,height:o,backgroundColor:"black",left:0,bottom:0,opacity:.2,zIndex:10},menuContent:{position:"absolute",width:t,left:0,bottom:0,zIndex:11},operateContainer:{justifyContent:"center",alignItems:"center",backgroundColor:"white",height:40,borderBottomColor:"#ccc",borderBottomWidth:1},operateText:{color:"#333"},loadingTouchable:{width:t,height:o},loadingContainer:{flex:1,justifyContent:"center",alignItems:"center"},arrowLeftContainer:{position:"absolute",top:0,bottom:0,left:0,justifyContent:"center",zIndex:13},arrowRightContainer:{position:"absolute",top:0,bottom:0,right:0,justifyContent:"center",zIndex:13}}};Ab.simpleStyle={count:{position:"absolute",left:0,right:0,top:38,zIndex:13,justifyContent:"center",alignItems:"center",backgroundColor:"transparent"},countText:{color:"white",fontSize:16,backgroundColor:"transparent",textShadowColor:"rgba(0, 0, 0, 0.3)",textShadowOffset:{width:0,height:.5},textShadowRadius:0}}});var Gk=Ae(Db=>{"use strict";c();Object.defineProperty(Db,"__esModule",{value:!0});var Vk=x(),qk=z(),N2=Fk(),SG=function(){function t(){this.show=!1,this.imageUrls=[],this.flipThreshold=80,this.maxOverflow=300,this.index=0,this.failImageSource=void 0,this.backgroundColor="black",this.footerContainerStyle={},this.menuContext={saveToLocal:"save to the album",cancel:"cancel"},this.saveToLocalByLongPress=!0,this.enableImageZoom=!0,this.style={},this.enableSwipeDown=!1,this.enablePreload=!1,this.pageAnimateTime=100,this.useNativeDriver=!1,this.onLongPress=function(){},this.onClick=function(){},this.onDoubleClick=function(){},this.onSave=function(){},this.onMove=function(){},this.renderHeader=function(){return null},this.renderFooter=function(){return null},this.renderIndicator=function(o,e){return Vk.createElement(qk.View,{style:N2.simpleStyle.count},Vk.createElement(qk.Text,{style:N2.simpleStyle.countText},o+"/"+e))},this.renderImage=function(o){return Vk.createElement(qk.Image,o)},this.renderArrowLeft=function(){return null},this.renderArrowRight=function(){return null},this.onShowModal=function(){},this.onCancel=function(){},this.onSwipeDown=function(){},this.loadingRender=function(){return null},this.onSaveToCamera=function(){},this.onChange=function(){}}return t}();Db.Props=SG;var CG=function(){function t(){this.show=!1,this.currentShowIndex=0,this.prevIndexProp=0,this.imageLoaded=!1,this.imageSizes=[],this.isShowMenu=!1}return t}();Db.State=CG});var B2=Ae(ac=>{"use strict";c();var kG=ac&&ac.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,e){o.__proto__=e}||function(o,e){for(var n in e)e.hasOwnProperty(n)&&(o[n]=e[n])};return function(o,e){t(o,e);function n(){this.constructor=o}o.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Ou=ac&&ac.__assign||Object.assign||function(t){for(var o,e=1,n=arguments.length;e0&&(e.state.currentShowIndex||0>0)&&e.loadImage((e.state.currentShowIndex||0)-1)},e.handleResponderRelease=function(n){n===void 0&&(n=0);var r=xe.I18nManager.isRTL?-n:n,i=xe.I18nManager.isRTL?e.positionXNumber-e.standardPositionX<-(e.props.flipThreshold||0):e.positionXNumber-e.standardPositionX>(e.props.flipThreshold||0),a=xe.I18nManager.isRTL?e.positionXNumber-e.standardPositionX>(e.props.flipThreshold||0):e.positionXNumber-e.standardPositionX<-(e.props.flipThreshold||0);if(r>.7){e.goBack.call(e),(e.state.currentShowIndex||0>0)&&e.loadImage((e.state.currentShowIndex||0)-1);return}else if(r<-.7){e.goNext.call(e),(e.state.currentShowIndex||00&&this.state.imageSizes[e].height>0){i.status="success",a();return}var s=!1,l=!1;if((!r.url||r.url.startsWith("file:"))&&(l=!0),r.width&&r.height){this.props.enablePreload&&l===!1&&xe.Image.prefetch(r.url),i.width=r.width,i.height=r.height,i.status="success",a();return}xe.Image.getSize(r.url,function(u,d){i.width=u,i.height=d,i.status="success",a()},function(){try{var u=xe.Image.resolveAssetSource(r.props.source);i.width=u.width,i.height=u.height,i.status="success",a()}catch{i.status="fail",a()}})}}},o.prototype.resetPosition=function(){this.positionXNumber=this.standardPositionX,xe.Animated.timing(this.positionX,{toValue:this.standardPositionX,duration:150,useNativeDriver:!!this.props.useNativeDriver}).start()},o.prototype.getContent=function(){var e=this,n=this.width,r=this.height,i=this.props.imageUrls.map(function(a,s){if((e.state.currentShowIndex||0)>s+1||(e.state.currentShowIndex||0)n){var p=n/l;l*=p,u*=p}if(u>r){var f=r/u;l*=f,u*=f}var m=function(h){var y=h.children,S=xG(h,["children"]);return it.createElement(A2.default,{cropWidth:e.width,cropHeight:e.height,maxOverflow:e.props.maxOverflow,horizontalOuterRangeOffset:e.handleHorizontalOuterRangeOffset,responderRelease:e.handleResponderRelease,onMove:e.props.onMove,onLongPress:e.handleLongPressWithIndex.get(s),onClick:e.handleClick,onDoubleClick:e.handleDoubleClick,enableSwipeDown:e.props.enableSwipeDown,swipeDownThreshold:e.props.swipeDownThreshold,onSwipeDown:e.handleSwipeDown,pinchToZoom:e.props.enableImageZoom,enableDoubleClickZoom:e.props.enableImageZoom,doubleClickInterval:e.props.doubleClickInterval,...S},y)};switch(d.status){case"loading":return it.createElement(m,{key:s,style:Ou({},e.styles.modalContainer,e.styles.loadingContainer),imageWidth:n,imageHeight:r},it.createElement(xe.View,{style:e.styles.loadingContainer},e.props.loadingRender()));case"success":return a.props||(a.props={}),a.props.style||(a.props.style={}),a.props.style=Ou({},e.styles.imageStyle,a.props.style,{width:l,height:u}),typeof a.props.source=="number"||(a.props.source||(a.props.source={}),a.props.source=Ou({uri:a.url},a.props.source)),e.props.enablePreload&&e.preloadImage(e.state.currentShowIndex||0),it.createElement(A2.default,{key:s,ref:function(h){return e.imageRefs[s]=h},cropWidth:e.width,cropHeight:e.height,maxOverflow:e.props.maxOverflow,horizontalOuterRangeOffset:e.handleHorizontalOuterRangeOffset,responderRelease:e.handleResponderRelease,onMove:e.props.onMove,onLongPress:e.handleLongPressWithIndex.get(s),onClick:e.handleClick,onDoubleClick:e.handleDoubleClick,imageWidth:l,imageHeight:u,enableSwipeDown:e.props.enableSwipeDown,swipeDownThreshold:e.props.swipeDownThreshold,onSwipeDown:e.handleSwipeDown,panToMove:!e.state.isShowMenu,pinchToZoom:e.props.enableImageZoom&&!e.state.isShowMenu,enableDoubleClickZoom:e.props.enableImageZoom&&!e.state.isShowMenu,doubleClickInterval:e.props.doubleClickInterval,minScale:e.props.minScale,maxScale:e.props.maxScale},e.props.renderImage(a.props));case"fail":return it.createElement(m,{key:s,style:e.styles.modalContainer,imageWidth:e.props.failImageSource?e.props.failImageSource.width:n,imageHeight:e.props.failImageSource?e.props.failImageSource.height:r},e.props.failImageSource&&e.props.renderImage({source:{uri:e.props.failImageSource.url},style:{width:e.props.failImageSource.width,height:e.props.failImageSource.height}}))}});return it.createElement(xe.Animated.View,{style:{zIndex:9}},it.createElement(xe.Animated.View,{style:Ou({},this.styles.container,{opacity:this.fadeAnim})},this.props.renderHeader(this.state.currentShowIndex),it.createElement(xe.View,{style:this.styles.arrowLeftContainer},it.createElement(xe.TouchableWithoutFeedback,{onPress:this.goBack},it.createElement(xe.View,null,this.props.renderArrowLeft()))),it.createElement(xe.View,{style:this.styles.arrowRightContainer},it.createElement(xe.TouchableWithoutFeedback,{onPress:this.goNext},it.createElement(xe.View,null,this.props.renderArrowRight()))),it.createElement(xe.Animated.View,{style:Ou({},this.styles.moveBox,{transform:[{translateX:this.positionX}],width:this.width*this.props.imageUrls.length})},i),this.props.renderIndicator((this.state.currentShowIndex||0)+1,this.props.imageUrls.length),this.props.imageUrls[this.state.currentShowIndex||0]&&this.props.imageUrls[this.state.currentShowIndex||0].originSizeKb&&this.props.imageUrls[this.state.currentShowIndex||0].originUrl&&it.createElement(xe.View,{style:this.styles.watchOrigin},it.createElement(xe.TouchableOpacity,{style:this.styles.watchOriginTouchable},it.createElement(xe.Text,{style:this.styles.watchOriginText},"\u67E5\u770B\u539F\u56FE(2M)"))),it.createElement(xe.View,{style:[{bottom:0,position:"absolute",zIndex:9},this.props.footerContainerStyle]},this.props.renderFooter(this.state.currentShowIndex||0))))},o.prototype.getMenu=function(){return this.state.isShowMenu?this.props.menus?it.createElement(xe.View,{style:this.styles.menuContainer},this.props.menus({cancel:this.handleLeaveMenu,saveToLocal:this.saveToLocal})):it.createElement(xe.View,{style:this.styles.menuContainer},it.createElement(xe.View,{style:this.styles.menuShadow}),it.createElement(xe.View,{style:this.styles.menuContent},it.createElement(xe.TouchableHighlight,{underlayColor:"#F2F2F2",onPress:this.saveToLocal,style:this.styles.operateContainer},it.createElement(xe.Text,{style:this.styles.operateText},this.props.menuContext.saveToLocal)),it.createElement(xe.TouchableHighlight,{underlayColor:"#F2F2F2",onPress:this.handleLeaveMenu,style:this.styles.operateContainer},it.createElement(xe.Text,{style:this.styles.operateText},this.props.menuContext.cancel)))):null},o.prototype.render=function(){var e=null;return e=it.createElement(xe.View,null,this.getContent(),this.getMenu()),it.createElement(xe.View,{onLayout:this.handleLayout,style:Ou({flex:1,overflow:"hidden"},this.props.style)},e)},o.defaultProps=new Hk.Props,o}(it.Component);ac.default=OG});var z2=Ae(qf=>{"use strict";c();Object.defineProperty(qf,"__esModule",{value:!0});var W2=B2();qf.ImageViewer=W2.default;var _G=Gk();qf.ImageViewerPropsDefine=_G.Props;qf.default=W2.default});c();c();(function(){"use strict";var t="ListFormat"in Intl;function o(q,oe){if(!(q instanceof oe))throw new TypeError("Cannot call a class as a function")}function e(q,oe){for(var $=0;$=2&&$.charAt(te-2)==="-"&&(te-=2),$=$.slice(0,te)}}function E(q,oe){var $=[],te=!0,he=!1,Me=void 0;try{for(var at=oe[Symbol.iterator](),Ye;!(te=(Ye=at.next()).done);te=!0){var st=Ye.value,ct=R(st),et=I(q,ct);et!==void 0&&$.push(st)}}catch(co){he=!0,Me=co}finally{try{!te&&at.return!=null&&at.return()}finally{if(he)throw Me}}return $}function P(q,oe){return E(q,oe)}function L(q){return typeof q=="string"||l(q)==="symbol"}function T(q,oe){if(l(q)!=="object")throw new TypeError("Given argument ".concat(q," must be of type Object"));if(!L(oe))throw new TypeError("Given argument ".concat(oe," must be a PropertyKey"));return q[oe]}function H(q){return!!q}function U(q){return q+""}function K(q,oe,$,te,he){var Me=T(q,oe);if(Me!==void 0){if($!=="boolean"&&$!=="string")throw new TypeError("Expected type ".concat($," to be 'boolean' or 'string"));if($==="boolean"&&(Me=H(Me)),$==="string"&&(Me=U(Me)),te!==void 0&&!te.includes(Me))throw new RangeError("Value ".concat(Me," out of range for options property ").concat(oe));return Me}else return he}function Y(q,oe,$){var te;return $!==void 0?($=u($),te=K($,"localeMatcher","string",a,"best fit")):te="best fit",te==="best fit"?P(q,oe):E(q,oe)}function X(q){var oe=q.availableLocales,$=q.requestedLocales,te=Object.create(null),he=!0,Me=!1,at=void 0;try{for(var Ye=$[Symbol.iterator](),st;!(he=(st=Ye.next()).done);he=!0){var ct=st.value,et=R(ct),co=I(oe,et);if(co!==void 0){if(te.locale=co,ct!==et){var Nt=ct.match(O);te.extension=Nt==null?"":Nt[0]}return te}}}catch(ms){Me=!0,at=ms}finally{try{!he&&Ye.return!=null&&Ye.return()}finally{if(Me)throw at}}var er=m();return te.locale=er,te}function re(q){return X(q)}function me(q,oe,$,te,he){var Me=$.localeMatcher,at=Me==="lookup"?X({availableLocales:q,requestedLocales:oe}):re({availableLocales:q,requestedLocales:oe}),Ye=at.locale,st=Object.create(null);st.dataLocale=Ye;var ct="-u";if(ct.length>2){var et=String.prototype.indexOf.call(Ye,"-x-");if(et===-1)Ye="".concat(Ye).concat(ct);else{var co=Ye.slice(0,et),Nt=Ye.slice(et);Ye="".concat(co).concat(ct).concat(Nt)}Ye=Intl.getCanonicalLocales(Ye)[0]}return st.locale=Ye,st}function Be(q){if(Array.isArray(q)){for(var oe=0,$=new Array(q.length);oehe){var Ye=q.slice(he,te);$.push({type:"literal",value:Ye})}var st=q.slice(te+1,at);if(oe[Number(st)]==null)throw new TypeError("Expected placeables to have a part for PropertyKey: ".concat(st));var ct=oe[Number(st)];if(Qn(ct.value)){var et=!0,co=!1,Nt=void 0;try{for(var er=ct.value[Symbol.iterator](),ms;!(et=(ms=er.next()).done);et=!0){var Lu=ms.value;$.push(Lu)}}catch(Hi){co=!0,Nt=Hi}finally{try{!et&&er.return!=null&&er.return()}finally{if(co)throw Nt}}}else $.push(ct);he=at+1,te=String.prototype.indexOf.call(q,"{",he)}if(he=0;){ct===0?$=C(q,"templateStart"):ct"u")throw new TypeError("Could not define Intl.ListFormat: Expected 'Intl' to exist. Remember to include polyfill for Intl.getCanonicalLocales before applying this polyfill");Intl.ListFormat=cn}t||fi()})();c();"__addLocaleData"in Intl.ListFormat&&Intl.ListFormat.__addLocaleData({locale:"en",data:{formats:{conjunction:{long:{Pair:"{0} and {1}",Start:"{0}, {1}",Middle:"{0}, {1}",End:"{0}, and {1}"},short:{Pair:"{0} & {1}",Start:"{0}, {1}",Middle:"{0}, {1}",End:"{0}, & {1}"},narrow:{Pair:"{0}, {1}",Start:"{0}, {1}",Middle:"{0}, {1}",End:"{0}, {1}"}},disjunction:{long:{Pair:"{0} or {1}",Start:"{0}, {1}",Middle:"{0}, {1}",End:"{0}, or {1}"},short:{Pair:"{0} or {1}",Start:"{0}, {1}",Middle:"{0}, {1}",End:"{0}, or {1}"},narrow:{Pair:"{0} or {1}",Start:"{0}, {1}",Middle:"{0}, {1}",End:"{0}, or {1}"}},unit:{long:{Pair:"{0}, {1}",Start:"{0}, {1}",Middle:"{0}, {1}",End:"{0}, {1}"},short:{Pair:"{0}, {1}",Start:"{0}, {1}",Middle:"{0}, {1}",End:"{0}, {1}"},narrow:{Pair:"{0} {1}",Start:"{0} {1}",Middle:"{0} {1}",End:"{0} {1}"}}}}});var vx=b(z());c();c();function X_(){return`https://${Ia.services.content.host}`}c();function U_(t,o){let e=[],n=0;for(;nr+i.length,0),e=new Uint8Array(o),n=0;return t.forEach(r=>{e.set(r,n),n+=r.length}),e}c();function j_(t){return{type:"link",id:Ma(),edits:{},...t}}c();var dm=100;var Bw=200;function $_(t){return t.replace(/(\r\n|\r|\n)/g," ")}function wh(t){return $_(t).trim().slice(0,dm).trim()||"Untitled"}function Z_(t){return $_(t).trim().slice(0,Bw).trim()}function WD(t){return Ex()(["docs","editorial","landing"]).includes(t)}function cd(t){return typeof t.cover?.yPos=="number"}function ld(t){return t?.layout?typeof t.layout=="string"&&WD(t.layout)?t.layout:"custom":"docs"}function ud(t){let o=ld(t),e={docs:{cover:!0,coverSize:"full",title:!0,description:!0,tableOfContents:!0,outline:!0,pagination:!0},editorial:{cover:!0,coverSize:"full",title:!0,description:!0,tableOfContents:!1,outline:!0,pagination:!0},landing:{cover:!0,coverSize:"full",title:!0,description:!0,tableOfContents:!1,outline:!1,pagination:!0}};switch(o){case"docs":return e.docs;case"editorial":return e.editorial;case"landing":return e.landing;case"custom":return typeof t?.layout=="object"?t.layout:e.docs;default:Oe(o)}}c();function J_(t,o){let{pageId:e,rename:n=!1}=o;return{...structuredClone(t),id:e,title:n?wh(`Copy of ${t.title}`):t.title,git:void 0,pages:t.type==="link"?void 0:[]}}c();var zD=Ze("hive:revisions:diff");function Ww(t,o){let e=[];return o.forEach(n=>{let r=t[n];if(!r){zD.warning(`Couldn't find page ${n} although it is referenced. This may indicate a bad page tree normalization.`);return}e.push({renderKey:n,page:r,pages:r.type==="link"?[]:Ww(t,r.pages)})}),e}c();function Q_(t,o){return{edits:MO([o]),...t,id:t.id||Ma()}}c();function eR(t,o,e,n){if(e.blobId)return new URL(`/content/${o}/blobs/${e.blobId}/${e.name}`,t).toString();if(e.downloadURL)return n?n(e.downloadURL):e.downloadURL;throw new Error("File does not have a download URL")}c();c();function Oc(t,o,e={}){let n;if(e.into){let r=B.getIn(t,["pages",e.into]);if(!r||!Hu(r))throw new Error(`Cannot insert page into ${e.into}`);n=B.get(r,"pages")}else n=B.getIn(t,["rootPages"]);if(!n)throw new Error(`Cannot insert page into ${e.into}`);e.at!==void 0?B.insert(n,e.at,[o.id]):B.push(n,[o.id]),B.setIn(t,["pages",o.id],cr(t)?Na(o):o)}function tR(t,o,e){let n=In(t,e),r=n?B.get(n,"pages"):B.get(t,"rootPages"),i=B.findIndex(r,s=>s===e);if(i<0)return{at:i};let a=n?B.get(n,"id"):void 0;return o==="after"?{into:a,at:i+1}:{into:a,at:i}}function oR(t,o,e){let n=tR(t,"before",e);if(!(n.at===void 0||n?.at<0))return Oc(t,o,n)}function Sh(t,o,e){let n=tR(t,"after",e);if(!(n.at===void 0||n?.at<0))return Oc(t,o,n)}c();function ia(t,o,e){let n=B.getIn(t,["pages",o]);if(n)if(typeof e=="function"){e(n);return}else Object.entries(e).forEach(([r,i])=>{B.set(n,r,cr(t)?Na(i):i)})}function nR(t,o,e){ia(t,o,n=>{if(!em(n))return;let r=ud(lr(n));B.set(n,"layout",{...r,...e})})}function rR(t,o,e){ia(t,o,{title:wh(e)})}function iR(t,o,e){ia(t,o,n=>{em(n)&&B.set(n,"description",Z_(e))})}function zw(t,o){let{originalPageId:e,parentPageId:n}=o,r=o.newPageId||Ma(),i=B.getIn(t,["pages",e]);if(!i)return;let a=J_(cr(i)?lr(i):i,{pageId:r,rename:!n});n?Oc(t,a,{into:n}):Sh(t,a,e);let s;if(Hu(i)){let l=B.get(i,"pages");s=B.map(l,u=>{let d=Ma();return zw(t,{originalPageId:u,parentPageId:a.id,newPageId:d}),d})}return ia(t,a.id,{pages:s}),r}c();c();c();function _c(t,o){let e=WO(t,o),n=[];return e.forEach(r=>{n.push(r),B.get(r,"type")!=="link"&&n.push(..._c(t,B.get(r,"id")))}),n}function aR(t,o,e){return B.getIn(t,["pages",e])?Ku(t,e).some(i=>B.get(i,"id")===o):!1}function pm(t,o,e={}){let n=B.getIn(t,["pages",o]);if(!n)return;let r=In(t,o);if(e.deleteEmptyGroupParent&&r&&B.get(r,"type")==="group"&&B.get(r,"pages").length===1)return pm(t,B.get(r,"id"));let i=[B.get(n,"id")];B.get(n,"type")!=="link"&&_c(t,o).forEach(u=>{i.push(B.get(u,"id"))}),[...B.entries(B.get(t,"pages"))].some(([,l])=>em(l)&&!i.includes(B.get(l,"id")))&&(B.delArrayValue(r?B.get(r,"pages"):B.get(t,"rootPages"),o),i.forEach(l=>{B.del(B.get(t,"pages"),l);let u=B.get(t,"conflicts");u&&B.getIn(u,["pages",l])&&B.delIn(u,["pages",l])}))}function FD(t,o,e){if(o===e)return!1;let n=B.getIn(t,["pages",o]),r=B.getIn(t,["pages",e]);if(!n||!r||BO(r)||Cw(n))return!1;let i=Ku(t,e);return!(B.findIndex(i,a=>B.get(a,"id")===o)>=0)}function Ch(t,o,e,n={}){let r=B.getIn(t,["pages",o]),i=e?B.getIn(t,["pages",e]):void 0;if(i&&!Hu(i))throw new Error("Cannot move page under a link");if(!r||e&&!FD(t,o,e))return;let a=B.get(t,"rootPages"),s=i?B.get(i,"pages"):a,l=typeof n.at=="number"?n.at:s.length,u=In(t,o),d=u?B.get(u,"pages"):a,p=B.findIndex(d,m=>m===o),f=u?B.get(u,"id")===e:!e;l===p&&f||(p>=0&&(B.delArrayIndex(d,p,1),f&&(l=p<=l?l-1:l)),B.insert(s,l,[o]),n.deleteEmptyGroupParent&&u&&Cw(u)&&B.get(u,"pages").length===0&&pm(t,B.get(u,"id")))}function sR(t,o,e){let n=In(t,e),r=n?B.get(n,"pages"):B.get(t,"rootPages"),i=B.findIndex(r,a=>a===e);return{at:o==="after"?i+1:i,parentId:n?B.get(n,"id"):void 0}}function cR(t,o,e){let{at:n,parentId:r}=sR(t,"before",e);n<0||Ch(t,o,r,{at:n})}function lR(t,o,e){let{at:n,parentId:r}=sR(t,"after",e);n<0||Ch(t,o,r,{at:n})}c();function uR(t,o){if(B.getIn(t,["files",o.id]))throw new Error("File with same ID already exists in revision");let n=B.get(t,"files");B.set(n,o.id,o)}function dR(t,o){B.delIn(t,["files",o])}function pR(t,o,e){let n=B.getIn(t,["files",o]);if(!n)throw new Error("File doesn't exist in revision");Object.entries(e).forEach(([r,i])=>{B.set(n,r,cr(t)?Na(i):i)})}c();var Rc=Ze("normalizeRevision");function fR(t){let o=B.get(t,"id"),e=B.get(t,"contentId"),n=B.get(t,"pages"),r=B.get(t,"rootPages"),i=B.get(t,"conflicts"),a=B.values(B.get(t,"parents")),s=new Set(B.keys(n)),l;if(a.length>3)throw new Error(`Revision ${e}/${o} has more than 3 parents`);if(a.includes(o)){let m=a.filter(h=>h!==o);if(m.length===0)throw new Error(`Revision ${e}/${o} has no more parents after removing itself as parent`);B.set(t,"parents",m),Rc.warning(`${e}/${o}: updated parents to remove itself as parent. New parents:`,m)}let u=B.get(t,"customFields");u?mR(u):B.set(t,"customFields",{});let d=m=>{let h=[];if(m.forEach(y=>{p(y)&&h.push(y)}),h.length!==m.length)return h},p=m=>{if(!s.has(m))return!1;s.delete(m);let h=B.get(n,m);if(!h)return!1;let y=B.get(h,"customFields");if(y&&mR(y),B.get(h,"type")==="link")return VD(e,o,m,h),!0;let S=h;l===void 0&&B.get(h,"type")==="document"&&(l=B.get(h,"id"));let C=d(B.get(S,"pages"));return C&&(B.set(S,"pages",C),Rc.warning(`${e}/${o}: updated children for page ${m}. New children pages:`,C)),!0},f=d(r);if(f&&(B.set(t,"rootPages",f),Rc.warning(`${e}/${o}: normalized rootPages. New root pages:`,f)),s.size>0){let m=Array.from(s);B.push(r,m),Rc.warning(`${e}/${o}: made pages with invalid parent into rootPages. Pages:`,m)}if(!l){let m=NO();Oc(t,m),Rc.warning(`${e}/${o}: created empty page document ${m.id} as none were found. `)}if(i!==void 0){let m=B.get(i,"pages"),h=B.keys(m),y=h.reduce((S,C)=>{let k=B.get(n,C);return!k||B.get(k,"type")==="link"||B.get(k,"type")==="group"?S.add(C):S},new Set);y.size>0&&(y.size===h.length?(B.del(t,"conflicts"),Rc.warning(`${e}/${o}: normalized conflicts. All were invalid and have been removed.`)):(y.forEach(S=>{B.del(m,S)}),Rc.warning(`${e}/${o}: normalized conflicts. New conflicts:`,i)))}}function mR(t){for(let[o,e]of B.entries(t)){let n=B.get(e,"value");typeof n!="string"&&typeof n!="number"&&typeof n!="boolean"&&!Array.isArray(lr(n))&&B.del(t,o)}}function VD(t,o,e,n){let r=B.get(n,"target");(typeof r!="object"||typeof B.get(r,"kind")!="string")&&(Rc.warning(`${t}/${o}: normalized invalid link ${e}, with target ${JSON.stringify(lr(r))}`),B.set(n,"type","document"),B.set(n,"pages",[]),B.del(n,"target"))}c();function gR(t){return B.get(t,"conflicts")!==void 0}function qD(t,o,e){if(!gR(t))return;let n=B.getIn(t,["conflicts","pages"]);n&&B.has(n,o)&&B.set(n,o,e),GD(t)}function GD(t){if(!gR(t))return;let o=B.getIn(t,["conflicts","pages"]);if(o){for(let[,e]of B.entries(o))if(e!==!1)return;B.del(t,"conflicts")}}function hR(t,o){qD(t,o,!1)}c();function yR(t,o,e=void 0){ia(t,o,n=>{if(B.get(n,"type")!=="document")return;let i={ref:e,yPos:0};B.set(n,"cover",cr(t)?Na(i):i)})}function vR(t,o){ia(t,o,e=>{B.get(e,"type")==="document"&&B.del(e,"cover")})}function bR(t,o,e){ia(t,o,n=>{if(B.get(n,"type")!=="document")return;let i=B.get(n,"cover");i&&B.set(i,"yPos",e)})}c();function wR(t,o="Page",e=!1){let n=B.get(t,"pages"),i=B.values(n).map(l=>B.get(l,"title")),a=new Set(i);if(!e&&!a.has(o))return o;let s=l=>{let u=` ${l}`,d=`${o.slice(0,dm-u.length)}${u}`;return a.has(d)?s(l+1):d};return s(1)}c();function SR(t){B.get(t,"customFields")||B.set(t,"customFields",{})}function CR(t,o){SR(t),xR(t,o)}function kR(t,o,e){let n=B.getIn(t,["pages",o]);n&&(SR(n),xR(n,e))}function xR(t,o){Object.entries(o).forEach(([e,n])=>{B.getIn(t,["customFields",e])?B.setIn(t,["customFields",e,"value"],n.value):B.setIn(t,["customFields",e],cr(t)?Na(n):n)})}c();function OR(t,o){let e=B.get(t,"edits");B.set(t,"edits",Jp(e,Array.isArray(o)?o:[o]))}c();function _R(t,o,e){let n=B.getIn(t,["pages",o,"edits"]);if(!n)return;let r=(()=>Array.isArray(e)?Jp(n,e):typeof e=="string"?Jp(n,[e]):LO(n,e))();B.setIn(t,["pages",o,"edits"],r)}c();function kh(t){return t.getMap("data")}c();var RR=yi(t=>({id:t.get("id"),type:t.get("type"),contentId:t.get("contentId"),conflicts:lr(t.get("conflicts")),parents:t.get("parents").toArray(),mergedFrom:t.get("mergedFrom"),rolledBackBy:t.get("rolledBackBy"),git:lr(t.get("git")),rootPages:t.get("rootPages").toArray(),pages:HD(t.get("pages")),files:KD(t.get("files")),edits:lr(t.get("edits")),customFields:lr(t.get("customFields"))})),HD=yi(t=>{let o={};return t.forEach((e,n)=>{o[n]=cr(e)?IR(e):lr(e)}),o}),KD=yi(t=>{let o={};return t.forEach((e,n)=>{o[n]=cr(e)?IR(e):lr(e)}),o}),IR=yi(t=>lr(t));c();var PR={insertPage:Oc,insertPageAfter:Sh,insertPageBefore:oR,removePage:pm,updatePage:ia,updatePageLayout:nR,movePage:Ch,movePageAfter:lR,movePageBefore:cR,addPageCover:yR,removePageCover:vR,movePageCover:bR,renamePage:rR,setPageDescription:iR,duplicatePage:zw,resolveConflict:hR,insertFile:uR,removeFile:dR,updateFile:pR,getPageParent:In,getUniquePageTitle:wR,updateRevisionCustomFields:CR,updatePageCustomFields:kR,markRevisionAsEdited:OR,markPageAsEdited:_R};function ER(t){let o={revision:t};for(let e in PR)o[e]=(...n)=>PR[e](t,...n);return o}c();c();c();var vo=b(ND()),ke=vo.Reader,aa=vo.Writer,A=vo.util,Q=vo.roots.default||(vo.roots.default={}),hU=Q.PromptInitMessage=(()=>{function t(o){if(o)for(let e=Object.keys(o),n=0;n>>3){case 1:{i.id=e.int32();break}case 2:{i.index=e.int32();break}case 3:{i.count=e.int32();break}case 4:{i.stateVector=e.bytes();break}case 5:{i.version=e.int32();break}default:e.skipType(a&7);break}}if(!i.hasOwnProperty("id"))throw A.ProtocolError("missing required 'id'",{instance:i});if(!i.hasOwnProperty("stateVector"))throw A.ProtocolError("missing required 'stateVector'",{instance:i});return i},t.decodeDelimited=function(e){return e instanceof ke||(e=new ke(e)),this.decode(e,e.uint32())},t.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(!A.isInteger(e.id))return"id: integer expected";if(e.index!=null&&e.hasOwnProperty("index")&&!A.isInteger(e.index))return"index: integer expected";if(e.count!=null&&e.hasOwnProperty("count")&&!A.isInteger(e.count))return"count: integer expected";if(!(e.stateVector&&typeof e.stateVector.length=="number"||A.isString(e.stateVector)))return"stateVector: buffer expected";if(e.version!=null&&e.hasOwnProperty("version"))switch(e.version){default:return"version: enum value expected";case 0:case 1:case 2:break}return null},t.fromObject=function(e){if(e instanceof Q.PromptInitMessage)return e;let n=new Q.PromptInitMessage;switch(e.id!=null&&(n.id=e.id|0),e.index!=null&&(n.index=e.index|0),e.count!=null&&(n.count=e.count|0),e.stateVector!=null&&(typeof e.stateVector=="string"?A.base64.decode(e.stateVector,n.stateVector=A.newBuffer(A.base64.length(e.stateVector)),0):e.stateVector.length>=0&&(n.stateVector=e.stateVector)),e.version){default:if(typeof e.version=="number"){n.version=e.version;break}break;case"UNSPECIFIED":case 0:n.version=0;break;case"V1":case 1:n.version=1;break;case"V2":case 2:n.version=2;break}return n},t.toObject=function(e,n){n||(n={});let r={};return n.defaults&&(r.id=0,r.index=0,r.count=0,n.bytes===String?r.stateVector="":(r.stateVector=[],n.bytes!==Array&&(r.stateVector=A.newBuffer(r.stateVector))),r.version=n.enums===String?"UNSPECIFIED":0),e.id!=null&&e.hasOwnProperty("id")&&(r.id=e.id),e.index!=null&&e.hasOwnProperty("index")&&(r.index=e.index),e.count!=null&&e.hasOwnProperty("count")&&(r.count=e.count),e.stateVector!=null&&e.hasOwnProperty("stateVector")&&(r.stateVector=n.bytes===String?A.base64.encode(e.stateVector,0,e.stateVector.length):n.bytes===Array?Array.prototype.slice.call(e.stateVector):e.stateVector),e.version!=null&&e.hasOwnProperty("version")&&(r.version=n.enums===String?Q.UpdateFormatVersion[e.version]===void 0?e.version:Q.UpdateFormatVersion[e.version]:e.version),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,vo.util.toJSONOptions)},t.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/PromptInitMessage"},t})(),yU=Q.InitMessage=(()=>{function t(o){if(o)for(let e=Object.keys(o),n=0;n>>3){case 1:{i.id=e.int32();break}case 2:{i.index=e.int32();break}case 3:{i.count=e.int32();break}case 4:{i.update=e.bytes();break}case 5:{i.version=e.int32();break}default:e.skipType(a&7);break}}if(!i.hasOwnProperty("id"))throw A.ProtocolError("missing required 'id'",{instance:i});if(!i.hasOwnProperty("update"))throw A.ProtocolError("missing required 'update'",{instance:i});return i},t.decodeDelimited=function(e){return e instanceof ke||(e=new ke(e)),this.decode(e,e.uint32())},t.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(!A.isInteger(e.id))return"id: integer expected";if(e.index!=null&&e.hasOwnProperty("index")&&!A.isInteger(e.index))return"index: integer expected";if(e.count!=null&&e.hasOwnProperty("count")&&!A.isInteger(e.count))return"count: integer expected";if(!(e.update&&typeof e.update.length=="number"||A.isString(e.update)))return"update: buffer expected";if(e.version!=null&&e.hasOwnProperty("version"))switch(e.version){default:return"version: enum value expected";case 0:case 1:case 2:break}return null},t.fromObject=function(e){if(e instanceof Q.InitMessage)return e;let n=new Q.InitMessage;switch(e.id!=null&&(n.id=e.id|0),e.index!=null&&(n.index=e.index|0),e.count!=null&&(n.count=e.count|0),e.update!=null&&(typeof e.update=="string"?A.base64.decode(e.update,n.update=A.newBuffer(A.base64.length(e.update)),0):e.update.length>=0&&(n.update=e.update)),e.version){default:if(typeof e.version=="number"){n.version=e.version;break}break;case"UNSPECIFIED":case 0:n.version=0;break;case"V1":case 1:n.version=1;break;case"V2":case 2:n.version=2;break}return n},t.toObject=function(e,n){n||(n={});let r={};return n.defaults&&(r.id=0,r.index=0,r.count=0,n.bytes===String?r.update="":(r.update=[],n.bytes!==Array&&(r.update=A.newBuffer(r.update))),r.version=n.enums===String?"UNSPECIFIED":0),e.id!=null&&e.hasOwnProperty("id")&&(r.id=e.id),e.index!=null&&e.hasOwnProperty("index")&&(r.index=e.index),e.count!=null&&e.hasOwnProperty("count")&&(r.count=e.count),e.update!=null&&e.hasOwnProperty("update")&&(r.update=n.bytes===String?A.base64.encode(e.update,0,e.update.length):n.bytes===Array?Array.prototype.slice.call(e.update):e.update),e.version!=null&&e.hasOwnProperty("version")&&(r.version=n.enums===String?Q.UpdateFormatVersion[e.version]===void 0?e.version:Q.UpdateFormatVersion[e.version]:e.version),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,vo.util.toJSONOptions)},t.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/InitMessage"},t})(),vU=Q.UpdateMessage=(()=>{function t(o){if(o)for(let e=Object.keys(o),n=0;n>>3){case 1:{i.id=e.int32();break}case 2:{i.index=e.int32();break}case 3:{i.count=e.int32();break}case 4:{i.update=e.bytes();break}case 5:{i.version=e.int32();break}default:e.skipType(a&7);break}}if(!i.hasOwnProperty("id"))throw A.ProtocolError("missing required 'id'",{instance:i});if(!i.hasOwnProperty("update"))throw A.ProtocolError("missing required 'update'",{instance:i});return i},t.decodeDelimited=function(e){return e instanceof ke||(e=new ke(e)),this.decode(e,e.uint32())},t.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(!A.isInteger(e.id))return"id: integer expected";if(e.index!=null&&e.hasOwnProperty("index")&&!A.isInteger(e.index))return"index: integer expected";if(e.count!=null&&e.hasOwnProperty("count")&&!A.isInteger(e.count))return"count: integer expected";if(!(e.update&&typeof e.update.length=="number"||A.isString(e.update)))return"update: buffer expected";if(e.version!=null&&e.hasOwnProperty("version"))switch(e.version){default:return"version: enum value expected";case 0:case 1:case 2:break}return null},t.fromObject=function(e){if(e instanceof Q.UpdateMessage)return e;let n=new Q.UpdateMessage;switch(e.id!=null&&(n.id=e.id|0),e.index!=null&&(n.index=e.index|0),e.count!=null&&(n.count=e.count|0),e.update!=null&&(typeof e.update=="string"?A.base64.decode(e.update,n.update=A.newBuffer(A.base64.length(e.update)),0):e.update.length>=0&&(n.update=e.update)),e.version){default:if(typeof e.version=="number"){n.version=e.version;break}break;case"UNSPECIFIED":case 0:n.version=0;break;case"V1":case 1:n.version=1;break;case"V2":case 2:n.version=2;break}return n},t.toObject=function(e,n){n||(n={});let r={};return n.defaults&&(r.id=0,r.index=0,r.count=0,n.bytes===String?r.update="":(r.update=[],n.bytes!==Array&&(r.update=A.newBuffer(r.update))),r.version=n.enums===String?"UNSPECIFIED":0),e.id!=null&&e.hasOwnProperty("id")&&(r.id=e.id),e.index!=null&&e.hasOwnProperty("index")&&(r.index=e.index),e.count!=null&&e.hasOwnProperty("count")&&(r.count=e.count),e.update!=null&&e.hasOwnProperty("update")&&(r.update=n.bytes===String?A.base64.encode(e.update,0,e.update.length):n.bytes===Array?Array.prototype.slice.call(e.update):e.update),e.version!=null&&e.hasOwnProperty("version")&&(r.version=n.enums===String?Q.UpdateFormatVersion[e.version]===void 0?e.version:Q.UpdateFormatVersion[e.version]:e.version),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,vo.util.toJSONOptions)},t.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/UpdateMessage"},t})(),XD=Q.StoredUpdate=(()=>{function t(o){if(o)for(let e=Object.keys(o),n=0;n>>3){case 2:{i.update=e.bytes();break}case 3:{i.version=e.int32();break}default:e.skipType(a&7);break}}if(!i.hasOwnProperty("update"))throw A.ProtocolError("missing required 'update'",{instance:i});if(!i.hasOwnProperty("version"))throw A.ProtocolError("missing required 'version'",{instance:i});return i},t.decodeDelimited=function(e){return e instanceof ke||(e=new ke(e)),this.decode(e,e.uint32())},t.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(!(e.update&&typeof e.update.length=="number"||A.isString(e.update)))return"update: buffer expected";switch(e.version){default:return"version: enum value expected";case 0:case 1:case 2:break}return null},t.fromObject=function(e){if(e instanceof Q.StoredUpdate)return e;let n=new Q.StoredUpdate;switch(e.update!=null&&(typeof e.update=="string"?A.base64.decode(e.update,n.update=A.newBuffer(A.base64.length(e.update)),0):e.update.length>=0&&(n.update=e.update)),e.version){default:if(typeof e.version=="number"){n.version=e.version;break}break;case"UNSPECIFIED":case 0:n.version=0;break;case"V1":case 1:n.version=1;break;case"V2":case 2:n.version=2;break}return n},t.toObject=function(e,n){n||(n={});let r={};return n.defaults&&(n.bytes===String?r.update="":(r.update=[],n.bytes!==Array&&(r.update=A.newBuffer(r.update))),r.version=n.enums===String?"UNSPECIFIED":0),e.update!=null&&e.hasOwnProperty("update")&&(r.update=n.bytes===String?A.base64.encode(e.update,0,e.update.length):n.bytes===Array?Array.prototype.slice.call(e.update):e.update),e.version!=null&&e.hasOwnProperty("version")&&(r.version=n.enums===String?Q.UpdateFormatVersion[e.version]===void 0?e.version:Q.UpdateFormatVersion[e.version]:e.version),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,vo.util.toJSONOptions)},t.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/StoredUpdate"},t})(),bU=Q.UpdatePresenceMessage=(()=>{function t(o){if(this.data={},this.positions={},o)for(let e=Object.keys(o),n=0;n>>3){case 1:{i.id=e.int32();break}case 2:{i.data===A.emptyObject&&(i.data={});let u=e.uint32()+e.pos;for(a="",s="";e.pos>>3){case 1:a=e.string();break;case 2:s=e.string();break;default:e.skipType(d&7);break}}i.data[a]=s;break}case 3:{i.positions===A.emptyObject&&(i.positions={});let u=e.uint32()+e.pos;for(a="",s=[];e.pos>>3){case 1:a=e.string();break;case 2:s=e.bytes();break;default:e.skipType(d&7);break}}i.positions[a]=s;break}default:e.skipType(l&7);break}}if(!i.hasOwnProperty("id"))throw A.ProtocolError("missing required 'id'",{instance:i});return i},t.decodeDelimited=function(e){return e instanceof ke||(e=new ke(e)),this.decode(e,e.uint32())},t.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(!A.isInteger(e.id))return"id: integer expected";if(e.data!=null&&e.hasOwnProperty("data")){if(!A.isObject(e.data))return"data: object expected";let n=Object.keys(e.data);for(let r=0;r=0&&(n.positions[r[i]]=e.positions[r[i]])}return n},t.toObject=function(e,n){n||(n={});let r={};(n.objects||n.defaults)&&(r.data={},r.positions={}),n.defaults&&(r.id=0),e.id!=null&&e.hasOwnProperty("id")&&(r.id=e.id);let i;if(e.data&&(i=Object.keys(e.data)).length){r.data={};for(let a=0;a{function t(o){if(o)for(let e=Object.keys(o),n=0;n>>3){case 1:{i.id=e.int32();break}case 2:{i.message=e.int32();break}default:e.skipType(a&7);break}}if(!i.hasOwnProperty("id"))throw A.ProtocolError("missing required 'id'",{instance:i});if(!i.hasOwnProperty("message"))throw A.ProtocolError("missing required 'message'",{instance:i});return i},t.decodeDelimited=function(e){return e instanceof ke||(e=new ke(e)),this.decode(e,e.uint32())},t.verify=function(e){return typeof e!="object"||e===null?"object expected":A.isInteger(e.id)?A.isInteger(e.message)?null:"message: integer expected":"id: integer expected"},t.fromObject=function(e){if(e instanceof Q.AckMessage)return e;let n=new Q.AckMessage;return e.id!=null&&(n.id=e.id|0),e.message!=null&&(n.message=e.message|0),n},t.toObject=function(e,n){n||(n={});let r={};return n.defaults&&(r.id=0,r.message=0),e.id!=null&&e.hasOwnProperty("id")&&(r.id=e.id),e.message!=null&&e.hasOwnProperty("message")&&(r.message=e.message),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,vo.util.toJSONOptions)},t.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/AckMessage"},t})(),SU=Q.BroadcastPresencesMessage=(()=>{function t(o){if(this.presences={},o)for(let e=Object.keys(o),n=0;n>>3){case 1:{i.id=e.int32();break}case 2:{i.presences===A.emptyObject&&(i.presences={});let u=e.uint32()+e.pos;for(a="",s=null;e.pos>>3){case 1:a=e.string();break;case 2:s=Q.Presence.decode(e,e.uint32());break;default:e.skipType(d&7);break}}i.presences[a]=s;break}case 3:{i.selfClientId=e.string();break}default:e.skipType(l&7);break}}if(!i.hasOwnProperty("id"))throw A.ProtocolError("missing required 'id'",{instance:i});if(!i.hasOwnProperty("selfClientId"))throw A.ProtocolError("missing required 'selfClientId'",{instance:i});return i},t.decodeDelimited=function(e){return e instanceof ke||(e=new ke(e)),this.decode(e,e.uint32())},t.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(!A.isInteger(e.id))return"id: integer expected";if(e.presences!=null&&e.hasOwnProperty("presences")){if(!A.isObject(e.presences))return"presences: object expected";let n=Object.keys(e.presences);for(let r=0;r{function t(o){if(o)for(let e=Object.keys(o),n=0;n>>3){case 1:{i.id=e.int32();break}case 2:{i.operation=Q.ContentOperation.decode(e,e.uint32());break}default:e.skipType(a&7);break}}if(!i.hasOwnProperty("id"))throw A.ProtocolError("missing required 'id'",{instance:i});if(!i.hasOwnProperty("operation"))throw A.ProtocolError("missing required 'operation'",{instance:i});return i},t.decodeDelimited=function(e){return e instanceof ke||(e=new ke(e)),this.decode(e,e.uint32())},t.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(!A.isInteger(e.id))return"id: integer expected";{let n=Q.ContentOperation.verify(e.operation);if(n)return"operation."+n}return null},t.fromObject=function(e){if(e instanceof Q.BroadcastOperationMessage)return e;let n=new Q.BroadcastOperationMessage;if(e.id!=null&&(n.id=e.id|0),e.operation!=null){if(typeof e.operation!="object")throw TypeError(".BroadcastOperationMessage.operation: object expected");n.operation=Q.ContentOperation.fromObject(e.operation)}return n},t.toObject=function(e,n){n||(n={});let r={};return n.defaults&&(r.id=0,r.operation=null),e.id!=null&&e.hasOwnProperty("id")&&(r.id=e.id),e.operation!=null&&e.hasOwnProperty("operation")&&(r.operation=Q.ContentOperation.toObject(e.operation,n)),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,vo.util.toJSONOptions)},t.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/BroadcastOperationMessage"},t})(),Ll=Q.Message=(()=>{function t(e){if(e)for(let n=Object.keys(e),r=0;r>>3){case 1:{a.promptInit=Q.PromptInitMessage.decode(n,n.uint32());break}case 2:{a.init=Q.InitMessage.decode(n,n.uint32());break}case 3:{a.update=Q.UpdateMessage.decode(n,n.uint32());break}case 4:{a.updatePresence=Q.UpdatePresenceMessage.decode(n,n.uint32());break}case 5:{a.broadcastPresences=Q.BroadcastPresencesMessage.decode(n,n.uint32());break}case 6:{a.broadcastOperation=Q.BroadcastOperationMessage.decode(n,n.uint32());break}case 7:{a.ack=Q.AckMessage.decode(n,n.uint32());break}default:n.skipType(s&7);break}}return a},t.decodeDelimited=function(n){return n instanceof ke||(n=new ke(n)),this.decode(n,n.uint32())},t.verify=function(n){if(typeof n!="object"||n===null)return"object expected";let r={};if(n.promptInit!=null&&n.hasOwnProperty("promptInit")){r.message=1;{let i=Q.PromptInitMessage.verify(n.promptInit);if(i)return"promptInit."+i}}if(n.init!=null&&n.hasOwnProperty("init")){if(r.message===1)return"message: multiple values";r.message=1;{let i=Q.InitMessage.verify(n.init);if(i)return"init."+i}}if(n.update!=null&&n.hasOwnProperty("update")){if(r.message===1)return"message: multiple values";r.message=1;{let i=Q.UpdateMessage.verify(n.update);if(i)return"update."+i}}if(n.updatePresence!=null&&n.hasOwnProperty("updatePresence")){if(r.message===1)return"message: multiple values";r.message=1;{let i=Q.UpdatePresenceMessage.verify(n.updatePresence);if(i)return"updatePresence."+i}}if(n.broadcastPresences!=null&&n.hasOwnProperty("broadcastPresences")){if(r.message===1)return"message: multiple values";r.message=1;{let i=Q.BroadcastPresencesMessage.verify(n.broadcastPresences);if(i)return"broadcastPresences."+i}}if(n.broadcastOperation!=null&&n.hasOwnProperty("broadcastOperation")){if(r.message===1)return"message: multiple values";r.message=1;{let i=Q.BroadcastOperationMessage.verify(n.broadcastOperation);if(i)return"broadcastOperation."+i}}if(n.ack!=null&&n.hasOwnProperty("ack")){if(r.message===1)return"message: multiple values";r.message=1;{let i=Q.AckMessage.verify(n.ack);if(i)return"ack."+i}}return null},t.fromObject=function(n){if(n instanceof Q.Message)return n;let r=new Q.Message;if(n.promptInit!=null){if(typeof n.promptInit!="object")throw TypeError(".Message.promptInit: object expected");r.promptInit=Q.PromptInitMessage.fromObject(n.promptInit)}if(n.init!=null){if(typeof n.init!="object")throw TypeError(".Message.init: object expected");r.init=Q.InitMessage.fromObject(n.init)}if(n.update!=null){if(typeof n.update!="object")throw TypeError(".Message.update: object expected");r.update=Q.UpdateMessage.fromObject(n.update)}if(n.updatePresence!=null){if(typeof n.updatePresence!="object")throw TypeError(".Message.updatePresence: object expected");r.updatePresence=Q.UpdatePresenceMessage.fromObject(n.updatePresence)}if(n.broadcastPresences!=null){if(typeof n.broadcastPresences!="object")throw TypeError(".Message.broadcastPresences: object expected");r.broadcastPresences=Q.BroadcastPresencesMessage.fromObject(n.broadcastPresences)}if(n.broadcastOperation!=null){if(typeof n.broadcastOperation!="object")throw TypeError(".Message.broadcastOperation: object expected");r.broadcastOperation=Q.BroadcastOperationMessage.fromObject(n.broadcastOperation)}if(n.ack!=null){if(typeof n.ack!="object")throw TypeError(".Message.ack: object expected");r.ack=Q.AckMessage.fromObject(n.ack)}return r},t.toObject=function(n,r){r||(r={});let i={};return n.promptInit!=null&&n.hasOwnProperty("promptInit")&&(i.promptInit=Q.PromptInitMessage.toObject(n.promptInit,r),r.oneofs&&(i.message="promptInit")),n.init!=null&&n.hasOwnProperty("init")&&(i.init=Q.InitMessage.toObject(n.init,r),r.oneofs&&(i.message="init")),n.update!=null&&n.hasOwnProperty("update")&&(i.update=Q.UpdateMessage.toObject(n.update,r),r.oneofs&&(i.message="update")),n.updatePresence!=null&&n.hasOwnProperty("updatePresence")&&(i.updatePresence=Q.UpdatePresenceMessage.toObject(n.updatePresence,r),r.oneofs&&(i.message="updatePresence")),n.broadcastPresences!=null&&n.hasOwnProperty("broadcastPresences")&&(i.broadcastPresences=Q.BroadcastPresencesMessage.toObject(n.broadcastPresences,r),r.oneofs&&(i.message="broadcastPresences")),n.broadcastOperation!=null&&n.hasOwnProperty("broadcastOperation")&&(i.broadcastOperation=Q.BroadcastOperationMessage.toObject(n.broadcastOperation,r),r.oneofs&&(i.message="broadcastOperation")),n.ack!=null&&n.hasOwnProperty("ack")&&(i.ack=Q.AckMessage.toObject(n.ack,r),r.oneofs&&(i.message="ack")),i},t.prototype.toJSON=function(){return this.constructor.toObject(this,vo.util.toJSONOptions)},t.getTypeUrl=function(n){return n===void 0&&(n="type.googleapis.com"),n+"/Message"},t})(),kU=Q.Presence=(()=>{function t(o){if(this.data={},this.positions={},o)for(let e=Object.keys(o),n=0;n>>3){case 1:{i.data===A.emptyObject&&(i.data={});let u=e.uint32()+e.pos;for(a="",s="";e.pos>>3){case 1:a=e.string();break;case 2:s=e.string();break;default:e.skipType(d&7);break}}i.data[a]=s;break}case 2:{i.joinTimestamp=e.int64();break}case 3:{i.updateTimestamp=e.int64();break}case 4:{i.clientId=e.string();break}case 5:{i.positions===A.emptyObject&&(i.positions={});let u=e.uint32()+e.pos;for(a="",s=[];e.pos>>3){case 1:a=e.string();break;case 2:s=e.bytes();break;default:e.skipType(d&7);break}}i.positions[a]=s;break}default:e.skipType(l&7);break}}if(!i.hasOwnProperty("joinTimestamp"))throw A.ProtocolError("missing required 'joinTimestamp'",{instance:i});if(!i.hasOwnProperty("updateTimestamp"))throw A.ProtocolError("missing required 'updateTimestamp'",{instance:i});if(!i.hasOwnProperty("clientId"))throw A.ProtocolError("missing required 'clientId'",{instance:i});return i},t.decodeDelimited=function(e){return e instanceof ke||(e=new ke(e)),this.decode(e,e.uint32())},t.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.data!=null&&e.hasOwnProperty("data")){if(!A.isObject(e.data))return"data: object expected";let n=Object.keys(e.data);for(let r=0;r>>0,e.joinTimestamp.high>>>0).toNumber())),e.updateTimestamp!=null&&(A.Long?(n.updateTimestamp=A.Long.fromValue(e.updateTimestamp)).unsigned=!1:typeof e.updateTimestamp=="string"?n.updateTimestamp=parseInt(e.updateTimestamp,10):typeof e.updateTimestamp=="number"?n.updateTimestamp=e.updateTimestamp:typeof e.updateTimestamp=="object"&&(n.updateTimestamp=new A.LongBits(e.updateTimestamp.low>>>0,e.updateTimestamp.high>>>0).toNumber())),e.clientId!=null&&(n.clientId=String(e.clientId)),e.positions){if(typeof e.positions!="object")throw TypeError(".Presence.positions: object expected");n.positions={};for(let r=Object.keys(e.positions),i=0;i=0&&(n.positions[r[i]]=e.positions[r[i]])}return n},t.toObject=function(e,n){n||(n={});let r={};if((n.objects||n.defaults)&&(r.data={},r.positions={}),n.defaults){if(A.Long){let a=new A.Long(0,0,!1);r.joinTimestamp=n.longs===String?a.toString():n.longs===Number?a.toNumber():a}else r.joinTimestamp=n.longs===String?"0":0;if(A.Long){let a=new A.Long(0,0,!1);r.updateTimestamp=n.longs===String?a.toString():n.longs===Number?a.toNumber():a}else r.updateTimestamp=n.longs===String?"0":0;r.clientId=""}let i;if(e.data&&(i=Object.keys(e.data)).length){r.data={};for(let a=0;a>>0,e.joinTimestamp.high>>>0).toNumber():e.joinTimestamp),e.updateTimestamp!=null&&e.hasOwnProperty("updateTimestamp")&&(typeof e.updateTimestamp=="number"?r.updateTimestamp=n.longs===String?String(e.updateTimestamp):e.updateTimestamp:r.updateTimestamp=n.longs===String?A.Long.prototype.toString.call(e.updateTimestamp):n.longs===Number?new A.LongBits(e.updateTimestamp.low>>>0,e.updateTimestamp.high>>>0).toNumber():e.updateTimestamp),e.clientId!=null&&e.hasOwnProperty("clientId")&&(r.clientId=e.clientId),e.positions&&(i=Object.keys(e.positions)).length){r.positions={};for(let a=0;a{function t(o){if(this.payload={},o)for(let e=Object.keys(o),n=0;n>>3){case 1:{i.id=e.string();break}case 2:{i.status=e.int32();break}case 3:{i.createdAt=e.int64();break}case 4:{i.updatedAt=e.int64();break}case 5:{i.updateId=e.int32();break}case 6:{i.expireAfter=e.int32();break}case 7:{i.cursor=e.int32();break}case 8:{i.target=e.int32();break}case 9:{i.payload===A.emptyObject&&(i.payload={});let u=e.uint32()+e.pos;for(a="",s="";e.pos>>3){case 1:a=e.string();break;case 2:s=e.string();break;default:e.skipType(d&7);break}}i.payload[a]=s;break}default:e.skipType(l&7);break}}if(!i.hasOwnProperty("id"))throw A.ProtocolError("missing required 'id'",{instance:i});if(!i.hasOwnProperty("status"))throw A.ProtocolError("missing required 'status'",{instance:i});if(!i.hasOwnProperty("createdAt"))throw A.ProtocolError("missing required 'createdAt'",{instance:i});if(!i.hasOwnProperty("updatedAt"))throw A.ProtocolError("missing required 'updatedAt'",{instance:i});if(!i.hasOwnProperty("updateId"))throw A.ProtocolError("missing required 'updateId'",{instance:i});if(!i.hasOwnProperty("expireAfter"))throw A.ProtocolError("missing required 'expireAfter'",{instance:i});if(!i.hasOwnProperty("cursor"))throw A.ProtocolError("missing required 'cursor'",{instance:i});if(!i.hasOwnProperty("target"))throw A.ProtocolError("missing required 'target'",{instance:i});return i},t.decodeDelimited=function(e){return e instanceof ke||(e=new ke(e)),this.decode(e,e.uint32())},t.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(!A.isString(e.id))return"id: string expected";switch(e.status){default:return"status: enum value expected";case 0:case 1:case 2:case 3:break}if(!A.isInteger(e.createdAt)&&!(e.createdAt&&A.isInteger(e.createdAt.low)&&A.isInteger(e.createdAt.high)))return"createdAt: integer|Long expected";if(!A.isInteger(e.updatedAt)&&!(e.updatedAt&&A.isInteger(e.updatedAt.low)&&A.isInteger(e.updatedAt.high)))return"updatedAt: integer|Long expected";if(!A.isInteger(e.updateId))return"updateId: integer expected";if(!A.isInteger(e.expireAfter))return"expireAfter: integer expected";if(!A.isInteger(e.cursor))return"cursor: integer expected";if(!A.isInteger(e.target))return"target: integer expected";if(e.payload!=null&&e.hasOwnProperty("payload")){if(!A.isObject(e.payload))return"payload: object expected";let n=Object.keys(e.payload);for(let r=0;r>>0,e.createdAt.high>>>0).toNumber())),e.updatedAt!=null&&(A.Long?(n.updatedAt=A.Long.fromValue(e.updatedAt)).unsigned=!1:typeof e.updatedAt=="string"?n.updatedAt=parseInt(e.updatedAt,10):typeof e.updatedAt=="number"?n.updatedAt=e.updatedAt:typeof e.updatedAt=="object"&&(n.updatedAt=new A.LongBits(e.updatedAt.low>>>0,e.updatedAt.high>>>0).toNumber())),e.updateId!=null&&(n.updateId=e.updateId|0),e.expireAfter!=null&&(n.expireAfter=e.expireAfter|0),e.cursor!=null&&(n.cursor=e.cursor|0),e.target!=null&&(n.target=e.target|0),e.payload){if(typeof e.payload!="object")throw TypeError(".ContentOperation.payload: object expected");n.payload={};for(let r=Object.keys(e.payload),i=0;i>>0,e.createdAt.high>>>0).toNumber():e.createdAt),e.updatedAt!=null&&e.hasOwnProperty("updatedAt")&&(typeof e.updatedAt=="number"?r.updatedAt=n.longs===String?String(e.updatedAt):e.updatedAt:r.updatedAt=n.longs===String?A.Long.prototype.toString.call(e.updatedAt):n.longs===Number?new A.LongBits(e.updatedAt.low>>>0,e.updatedAt.high>>>0).toNumber():e.updatedAt),e.updateId!=null&&e.hasOwnProperty("updateId")&&(r.updateId=e.updateId),e.expireAfter!=null&&e.hasOwnProperty("expireAfter")&&(r.expireAfter=e.expireAfter),e.cursor!=null&&e.hasOwnProperty("cursor")&&(r.cursor=e.cursor),e.target!=null&&e.hasOwnProperty("target")&&(r.target=e.target);let i;if(e.payload&&(i=Object.keys(e.payload)).length){r.payload={};for(let a=0;a{let t={},o=Object.create(t);return o[t[0]="STARTING"]=0,o[t[1]="RUNNING"]=1,o[t[2]="SUCCESS"]=2,o[t[3]="ERROR"]=3,o})(),Ls=Q.UpdateFormatVersion=(()=>{let t={},o=Object.create(t);return o[t[0]="UNSPECIFIED"]=0,o[t[1]="V1"]=1,o[t[2]="V2"]=2,o})();var UD=.9*1024*1024;function TR(t,o=0){let e=o;return{newMessageID:()=>(e+=1,e),write:n=>{if(n.init){let r=n.init;Vw(r.update,(i,a,s)=>{t(xh({init:{...r,index:a,count:s,update:i}}),r.id)})}else if(n.update){let r=n.update;Vw(r.update,(i,a,s)=>{t(xh({update:{...r,index:a,count:s,update:i}}),r.id)})}else if(n.promptInit){let r=n.promptInit;Vw(r.stateVector,(i,a,s)=>{t(xh({promptInit:{...r,index:a,count:s,stateVector:i}}),r.id)})}else t(xh(n),n[Object.keys(n)[0]].id)}}}function xh(t){let o=Ll.verify(t);if(o)throw new Error(`ProtoBufObject message is not valid: ${o}`);let e=Ll.create(t);return Ll.encode(e).finish()}function Vw(t,o){U_(t,UD).forEach((n,r,i)=>{o(n,r,i.length)})}c();function MR(t){let o=new Map,e=(n,r)=>{if(!n.id||n.index===void 0||n.count===void 0)return r(n);let i=o.get(n.id)||[];if(i.push(n),o.set(n.id,i),i.length===n.count){let a=Y_(i.sort((l,u)=>(l.index||0)-(u.index||0)).map(l=>"update"in l?l.update:l.stateVector)),s=r({...n,..."update"in n?{update:a}:{stateVector:a}});return o.delete(n.id),s}};return n=>YD(n,{promptInit:r=>e(r,i=>t.promptInit(i)),init:r=>e(r,i=>t.init(i)),update:r=>e(r,i=>t.update(i)),updatePresence:t.updatePresence,broadcastOperation:t.broadcastOperation,broadcastPresences:t.broadcastPresences,ack:t.ack})}function YD(t,o){let e=Ll.decode(t),n=Ll.toObject(e);if(n.promptInit)return o.promptInit(n.promptInit);if(n.init)return o.init(n.init);if(n.update)return o.update(n.update);if(n.updatePresence)return o.updatePresence(n.updatePresence);if(n.broadcastOperation)return o.broadcastOperation(n.broadcastOperation);if(n.broadcastPresences)return o.broadcastPresences(n.broadcastPresences);if(n.ack)return o.ack(n.ack)}c();var AU=Ze("datasync:storage");function qw(t,o,e,n){switch(o){case null:case void 0:case Ls.UNSPECIFIED:case Ls.V1:{let r=Array.isArray(e)?TO(e):e;xO(t,r,n);break}case Ls.V2:{let r=Array.isArray(e)?Pg(e):e;Rg(t,r,n);break}default:Oe(o)}}c();var NR=yi(t=>{let o=t.getAttribute("data");return pc.create({key:t.getAttribute("key"),nodes:Oh(t),data:o?Gw(o):void 0})}),Oh=yi(t=>Pa.create(t.toArray().map(o=>{if(o instanceof Rr)return AR(o);if(o instanceof Rt)return jD(o);throw new Error(`Unknown node type: ${o}`)}))),jD=yi(t=>{let e=t.toDelta().map(n=>tO.create({text:n.insert,marks:$D(n.attributes||{})}));return dg.create({key:t.getAttribute("key"),leaves:Pa.create(e)})}),AR=yi(t=>{let o=t.getAttribute("key");switch(t.nodeName){case"block":{let e=t,n=e.getAttribute("data"),r=e.getAttribute("fragments");return Gt.create({key:o,type:e.getAttribute("type"),isVoid:e.getAttribute("isVoid"),data:n?Gw(n):void 0,nodes:Oh(t),fragments:r?LR(r):void 0})}case"inline":{let e=t,n=e.getAttribute("data"),r=e.getAttribute("fragments");return Gp.create({key:o,type:e.getAttribute("type"),isVoid:e.getAttribute("isVoid"),data:n?Gw(n):void 0,nodes:Oh(t),fragments:r?LR(r):void 0})}case"fragment":{let e=t;return oO.create({key:o,type:e.getAttribute("type"),fragment:e.getAttribute("fragment"),nodes:Oh(t)})}default:throw new Error(`Unknown object type: ${t.nodeName}`)}}),LR=yi(t=>Qx.create(t.toArray().map(o=>{if(!(o instanceof Rr))throw new Error(`Unknown node type: ${o}`);let e=AR(o);return[e.fragmentKey,e]})));function $D(t){return cg.create(Object.keys(t).map(o=>eO.create({type:o,data:t[o]})))}var Gw=yi(t=>Wu.create(t.toJSON()));c();function Nl(t){let o=t.object;switch(o){case"block":return JD(t);case"inline":return QD(t);case"text":return t9(t);default:throw new Error(`Unknown node type: ${o}`)}}function ZD(t){return t.toArray().map(o=>Nl(o))}function Hw(t,o){t.delete(0,t.length),t.insert(0,ZD(o))}function JD(t,o=new Rr(t.object)){return o.setAttribute("key",t.key),t.isVoid?o.setAttribute("isVoid",t.isVoid):o.removeAttribute("isVoid"),o.setAttribute("type",t.type),Rh(o,t.data),Hw(o,t.nodes),DR(o,t.fragments),o}function QD(t,o=new Rr(t.object)){return o.setAttribute("key",t.key),t.isVoid?o.setAttribute("isVoid",t.isVoid):o.removeAttribute("isVoid"),o.setAttribute("type",t.type),Rh(o,t.data),Hw(o,t.nodes),DR(o,t.fragments),o}function e9(t,o=new $p){return o.delete(0,o.length),t.forEach(e=>{o.push([Kw(e)])}),o}function DR(t,o){if(o.size===0){t.removeAttribute("fragments");return}let e=t.getAttribute("fragments");e||(e=new $p,t.setAttribute("fragments",e)),e9(o,e)}function Kw(t,o=new Rr(t.object)){return o.setAttribute("key",t.key),t.type&&o.setAttribute("type",t.type),t.fragment&&o.setAttribute("fragment",t.fragment),Hw(o,t.nodes),o}function t9(t,o=new Rt){let e=0;return o.setAttribute("key",t.key),o.delete(0,o.length),t.leaves.forEach(n=>{o.insert(e,n.text,_h(n.marks)),e+=n.text.length}),o}function _h(t){if(t.size===0)return{};let o={};return t.forEach(e=>{o[e.type]=e.data.toObject()}),o}function Rh(t,o){if(o.size===0){t.removeAttribute("data");return}let e=t.getAttribute("data");e||(e=new La,t.setAttribute("data",e)),o9(o,e)}function o9(t,o){return o.clear(),t.forEach((e,n)=>{o.set(n,dd(e))}),o}function dd(t){if(t==null||typeof t=="number"||typeof t=="string"||typeof t=="boolean")return t;if(Array.isArray(t)){let o=new jp;return t.forEach(e=>{o.push([dd(e)])}),o}else{let o=new La;return Object.keys(t).forEach(e=>{o.set(e,dd(t[e]))}),o}}c();c();function Ln(t,o){let e=t;for(let n=0;n{r9(o,e,n.document,r.document)})}function r9(t,o,e,n){switch(o.type){case"insert_text":i9(t,e,o);break;case"remove_text":a9(t,e,o);break;case"add_mark":s9(t,o);break;case"remove_mark":c9(t,o);break;case"remove_node":l9(t,o);break;case"insert_node":u9(t,o);break;case"set_node":f9(t,o);break;case"move_node":d9(t,e,n,o);break;case"split_node":p9(t,e,o);break;case"merge_node":m9(t,e,o);break;case"insert_fragment":g9(t,o);break;case"remove_fragment":h9(t,o);break;case"set_data":y9(t,o);break;case"remove_data":v9(t,o);break;case"insert_array_data":b9(t,o);break;case"remove_array_data":w9(t,o);break;case"set_selection":break;default:throw new Error(`Unsupported operation type: ${o.type}`)}}function i9(t,o,e){let n=Ln(t,[...e.path]);if(!(n instanceof Rt))throw new Error("Invalid operation path, expected a text node");n.insert(e.offset,e.text,_h(e.marks))}function a9(t,o,e){let n=Ln(t,[...e.path]);if(!(n instanceof Rt))throw new Error("Invalid operation path, expected a text node");n.delete(e.offset,e.text.length)}function s9(t,o){let e=Ln(t,[...o.path]);if(!(e instanceof Rt))throw new Error("Invalid operation path, expected a text node");e.format(o.offset,o.length,_h(cg.create([o.mark])))}function c9(t,o){let e=Ln(t,[...o.path]);if(!(e instanceof Rt))throw new Error("Invalid operation path, expected a text node");e.format(o.offset,o.length,{[o.mark.type]:null})}function l9(t,o){let{parent:e,index:n}=Al(t,[...o.path]);e.delete(n)}function u9(t,o){let{parent:e,index:n}=Al(t,[...o.path]);e.insert(n,[Nl(o.node)])}function d9(t,o,e,n){let{parent:r,index:i}=Al(t,[...n.path]),{parent:a,index:s}=Al(t,[...n.newPath]),l=e.assertPath(n.path),u=o.assertNode(l.key),d=Nl(u);r.delete(i),a.insert(s,[d])}function p9(t,o,e){let{parent:n,index:r}=Al(t,[...e.path]),i=o.assertNode(n.getAttribute("key"));if(i.object==="text")throw new Error("Invalid operation path, expected a node with descendants for split_node");let a=i.nodes.get(r);if(!a)throw new Error("Node not found in parent nodes");let s=i.nodes.get(r+1);if(!s)throw new Error("New node not found in parent nodes");n.delete(r),n.insert(r,[Nl(a),Nl(s)])}function m9(t,o,e){let{parent:n,index:r}=Al(t,[...e.path]),i=o.assertNode(n.getAttribute("key"));if(i.object==="text")throw new Error("Invalid operation path, expected a node with descendants for merge_node");let a=i.nodes.get(r-1);if(!a)throw new Error("Merged node not found in parent nodes");n.delete(r-1,2),n.insert(r-1,[Nl(a)])}function f9(t,o){let e=Ln(t,[...o.path]);if(typeof o.properties!="string"){if("key"in o.properties&&o.properties.key!==void 0&&e.setAttribute("key",o.properties.key),"type"in o.properties&&o.properties.type!==void 0&&e.setAttribute("type",o.properties.type),"isVoid"in o.properties&&o.properties.isVoid!==void 0){if(e instanceof Rt)throw new Error("Should not set isVoid on a text");e.setAttribute("isVoid",o.properties.isVoid)}if("data"in o.properties&&o.properties.data!==void 0){if(e instanceof Rt)throw new Error("Should not set data on a text");Rh(e,Wu.create(o.properties.data))}}}function g9(t,o){let e=Ln(t,[...o.path]);if(e instanceof Rt)throw new Error("Expect a fragment node");let n=e,r=o.fragmentPath[o.fragmentPath.length-1]-1,i=Kw(o.node),a=n.getAttribute("fragments");a||(a=new $p,n.setAttribute("fragments",a)),a.insert(r,[i])}function h9(t,o){let e=Ln(t,[...o.path]);if(e instanceof Rt)throw new Error("Expect a fragment node");let n=e,r=o.fragmentPath[o.fragmentPath.length-1]-1;n.getAttribute("fragments").delete(r)}function y9(t,o){let e=Ln(t,[...o.path]);if(e instanceof Rt)throw new Error("Should not set data on a text");let n=dd(o.data),r=mm(e,o.dataPath.slice(0,-1)),i=o.dataPath[o.dataPath.length-1];r.set(i,n)}function v9(t,o){let e=Ln(t,[...o.path]);if(e instanceof Rt)throw new Error("Should not set data on a text");let n=mm(e,o.dataPath.slice(0,-1)),r=o.dataPath[o.dataPath.length-1];n.delete(r)}function b9(t,o){let e=Ln(t,[...o.path]);if(e instanceof Rt)throw new Error("Should not set data on a text");let n=mm(e,o.dataPath.slice(0,-1)),r=o.dataPath[o.dataPath.length-1],i=n.get(r);if(!i||!(i instanceof jp))return;let a=dd(o.data);i.insert(o.dataIndex,[a])}function w9(t,o){let e=Ln(t,[...o.path]);if(e instanceof Rt)throw new Error("Should not set data on a text");let n=mm(e,o.dataPath.slice(0,-1)),r=o.dataPath[o.dataPath.length-1],i=n.get(r);if(!i||!(i instanceof jp))return;let a;for(;a=i.toArray().findIndex(s=>s===o.data)!==-1;)i.delete(a)}c();function fm(t){return t.get("data",Rr)}c();function zR(t,o,e){let n=fm(o);return qp.isBlockRange(e)?{anchor:e.anchorBlock?WR(n,t,e.anchorBlock):void 0,focus:e.focusBlock?WR(n,t,e.focusBlock):void 0}:{anchor:e.anchorKey?BR(n,t,e.anchorKey,e.anchorOffset):void 0,focus:e.focusKey?BR(n,t,e.focusKey,e.focusOffset):void 0}}function FR(t,o){if(!(!o.anchor||!o.focus)){if(o.anchor.type instanceof Rt){if(!(o.focus.type instanceof Rt))return;let e=o.anchor.type.getAttribute("key"),n=o.focus.type.getAttribute("key");return be.create({anchorKey:e,anchorOffset:o.anchor.index,focusKey:n,focusOffset:o.focus.index}).normalize(t)}if(o.anchor.type instanceof Rr){if(!(o.focus.type instanceof Rr))return;let e=o.anchor.type.getAttribute("key"),n=o.focus.type.getAttribute("key"),r=t.getDescendant(e),i=t.getDescendant(n);if(!r||!i||!r.isBlock()||!i.isBlock())return;let a=r.nodes.get(o.anchor.index),s=i.nodes.get(o.focus.index);return!a||!s?void 0:qp.create({anchorBlock:a.key,focusBlock:s?.key}).normalize(t)}}}function BR(t,o,e,n){let r=o.getPath(e);return r?{type:Ln(t,r),index:n,assoc:0}:void 0}function WR(t,o,e){let n=o.getPath(e);return n?{type:Ln(t,n.slice(0,-1)),index:n[n.length-1],assoc:0}:void 0}c();var S9=Ze("hive-core:normalizeYDocument");function VR(t){let o=new Set,e=new Set;return qR(t,o,e),e.size>0&&S9.warning(`Found ${e.size} duplicated keys in Y document. This is a bug in Hive.`),e.size}function qR(t,o,e){GR(t,o,e);let n=t.getAttribute("fragments");n&&C9(n,o,e)}function C9(t,o,e){GR(t,o,e)}function GR(t,o,e){let n=0;t.forEach((r,i)=>{let a=r.getAttribute("key");if(o.has(a)){e.add(a),CO(t),t.delete(i-n),n++;return}o.add(a),!(r instanceof Rt)&&qR(r,o,e)})}c();c();c();c();c();c();c();var pn=crypto;var Ns=new TextEncoder,Qr=new TextDecoder,KY=2**32;var HR=t=>{let o=atob(t),e=new Uint8Array(o.length);for(let n=0;n{let o=t;o instanceof Uint8Array&&(o=Qr.decode(o)),o=o.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return HR(o)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}};c();c();c();var Ih=class extends Error{static get code(){return"ERR_JOSE_GENERIC"}constructor(o){var e;super(o),this.code="ERR_JOSE_GENERIC",this.name=this.constructor.name,(e=Error.captureStackTrace)===null||e===void 0||e.call(Error,this,this.constructor)}};var Er=class extends Ih{constructor(){super(...arguments),this.code="ERR_JWT_INVALID"}static get code(){return"ERR_JWT_INVALID"}};c();c();var Ph=pn.getRandomValues.bind(pn);c();c();c();c();c();c();c();c();function P9(t){return typeof t=="object"&&t!==null}function dr(t){if(!P9(t)||Object.prototype.toString.call(t)!=="[object Object]")return!1;if(Object.getPrototypeOf(t)===null)return!0;let o=t;for(;Object.getPrototypeOf(o)!==null;)o=Object.getPrototypeOf(o);return Object.getPrototypeOf(t)===o}c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();var G9=Symbol();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();var jw=Ic;c();function $w(t){if(typeof t!="string")throw new Er("JWTs must use Compact JWS serialization, JWT must be a string");let{1:o,length:e}=t.split(".");if(e===5)throw new Er("Only JWTs using Compact JWS serialization can be decoded");if(e!==3)throw new Er("Invalid JWT");if(!o)throw new Er("JWTs must contain a payload");let n;try{n=jw(o)}catch{throw new Er("Failed to parse the base64url encoded payload")}let r;try{r=JSON.parse(Qr.decode(n))}catch{throw new Er("Failed to parse the decoded payload as JSON")}if(!dr(r))throw new Er("Invalid JWT Claims Set");return r}c();c();c();c();function tI(t){let o=$w(t);return{expiration:o.exp?o.exp*1e3:Date.now()+6*60*60*1e3,payload:{userId:o.userId,content:o.content}}}c();var Vh=b(x());c();var yI=b(Fp(),1),vI=b(iI(),1);c();var gI=b(Fp(),1),hI=b(fI(),1);var Ws=Ze("hive:socket");var Mh=class{constructor(o){this.state="closed";this.destroyed=!1;this.openBackoffDelay=1e3;this.pendingMessages=[];this.events=new gI.EventEmitter;this.getSocketURL=o}async open(){if(this.assertNotDestroyed(),this.webSocket)throw new Error("WebSocket already opened");this.clearScheduledReconnection();let o=await this.getSocketURL();return this.setState("connecting"),new Promise((e,n)=>{Ws.info("Opening WebSocket:",o);let r=new hI.default.w3cwebsocket(o);this.webSocket=r;try{r.binaryType="arraybuffer"}catch{}r.onopen=()=>{if(this.destroyed){r.close();return}Ws.warning("WebSocket opened"),this.setState("open"),this.sendPendingMessages(),e()},r.onclose=i=>{if(this.destroyed)return;let a=this.state;if(this.close("closed"),a==="connecting"){Ws.error("Websocket closed before initial connection",i),n(new Error("Websocket closed before initial connection"));return}a==="open"&&(Ws.warning("WebSocket unexpectedly closed, reconnecting:",i.code,i.reason),this.scheduleReconnection())},r.onerror=i=>{if(this.destroyed)return;let a=this.state;if(this.close("errored"),a==="connecting"){Ws.error("Websocket error with initial connection",i);let s=new Error("Websocket errored before being opened");Au(s,{attachments:[{name:"operations.json",type:"application/json",body:JSON.stringify(i)}]})}Ws.error("WebSocket error, reconnecting:",i),this.scheduleReconnection()},r.onmessage=i=>{if(this.destroyed){r.close();return}let a=i.data;a instanceof ArrayBuffer&&this.events.emit("message",new Uint8Array(a))}})}close(o="closed"){this.assertNotDestroyed(),this.setState(o),this.openBackoffTimer&&(clearTimeout(this.openBackoffTimer),this.openBackoffTimer=void 0),this.webSocket&&(Ws.info("Closing WebSocket"),this.webSocket.close(),this.webSocket=void 0)}destroy(){this.close(),this.events.removeAllListeners(),this.destroyed=!0}scheduleReconnection(){this.openBackoffTimer||(this.webSocket&&this.close(),Ws.info("Scheduling reconnection in",this.openBackoffDelay,"ms"),this.openBackoffTimer=setTimeout(()=>{this.open(),this.openBackoffDelay=Math.min(this.openBackoffDelay*2,3e4)},this.openBackoffDelay))}async forceScheduledReconnection(){if(!this.openBackoffTimer)throw new Error("No scheduled reconnection");await this.open()}clearScheduledReconnection(){this.openBackoffTimer&&(clearTimeout(this.openBackoffTimer),this.openBackoffTimer=void 0)}listen(o,e){return this.assertNotDestroyed(),this.events.addListener(o,e),()=>{this.events.removeListener(o,e)}}send(o){if(this.assertNotDestroyed(),this.state!=="open"||!this.webSocket){this.pendingMessages.push(o);return}this.webSocket.send(o)}sendPendingMessages(){let o=this.webSocket;this.state!=="open"||!o||(this.pendingMessages.forEach(e=>o.send(e)),this.pendingMessages=[])}setState(o){this.state!==o&&(Ws.info("socket changing state from",this.state,"to",o),this.state=o,this.events.emit("state",o))}assertNotDestroyed(){if(this.destroyed)throw new Error("socket is destroyed")}};var fn=Ze("hive:datasync");var md=class{constructor(o,e,n={}){this.state="closed";this.operation=null;this.clientId=null;this.socket=null;this.encoder=null;this.currentPresence=null;this.beforeTransactionPresence=null;this.pendingMessages=new Set;this.pendingMessagesResolves=[];this.destroyed=!1;this.events=new yI.EventEmitter;this.batchUpdates=[];let{YType:r=La,readOnly:i=!1}=n;if(typeof globalThis.window>"u")throw new Error("HiveDataSyncClient can only be used in the browser, or in node process when running tests");this.client=o,this.doc=new kO({guid:e}),this.presences=[],this.YType=r,this.#e=i;let a=this.doc.get("data",r);this.undoManager=new EO(a,{trackedOrigins:new Set(["local"])}),this.undoManager.on("stack-item-added",s=>{s.stackItem.meta.set("positionsBefore",this.beforeTransactionPresence?.positions),s.stackItem.meta.set("positions",this.currentPresence?.positions)}),this.undoManager.on("stack-item-updated",s=>{s.stackItem.meta.set("positions",this.currentPresence?.positions)}),this.undoManager.on("stack-item-popped",s=>{let l=s.type==="undo"?this.undoManager.redoStack:this.undoManager.undoStack,u=l[l.length-1];u&&(u.meta.set("positions",s.stackItem.meta.get("positionsBefore")),u.meta.set("positionsBefore",s.stackItem.meta.get("positions")));let d=s.stackItem.meta.get("positionsBefore");d&&this.events.emit("restorePositions",d)}),this.doc.on("updateV2",(s,l)=>{l!=="remote"&&(this.dangerouslyPaused?this.dangerouslyPaused.push(s):this.batchUpdate(s)),fn.info("call update listeners"),this.events.emit("update",l)}),this.doc.on("sync",()=>{this.doc.isSynced&&fn.info(`doc "${this.doc.guid}" is synced`),this.updateState()})}#e;updateState(){let o="closed";if(this.socket)switch(this.socket.state){case"connecting":o="connecting";break;case"open":this.doc.isSynced?o="open":o="connecting";break;case"errored":o="errored";break}o!==this.state&&(this.state=o,this.events.emit("state",o))}get presence(){return this.currentPresence||null}get readOnly(){return this.#e??!1}setReadOnly(o){this.readOnly&&!o?this.sendPromptInit():!this.readOnly&&o&&this.flushBatchUpdates(),this.#e=o}get clock(){let o=this.doc.get("data",this.YType);return SO(o)}open(o,e,n,r={}){if(this.assertNotDestroyed(),this.socket)switch(this.socket.state){case"open":case"connecting":return this.doc.isLoaded?void 0:this.doc.whenLoaded;case"errored":return Promise.reject(new Error("Connection failed to establish with the server"));case"closed":{let u=this.socket;this.socket=null,u.destroy();break}default:Oe(this.socket.state)}fn.info("opening datasync socket",e,n,r);let i=this.client.getSocket(o,e,n,r);this.socket=i;let a=MR({promptInit:u=>{this.sendInit(u.stateVector)},init:({update:u,version:d})=>{qw(this.doc,d,u,"remote"),this.doc.emit("sync",[!0])},update:({update:u,version:d})=>{qw(this.doc,d,u,"remote")},updatePresence:()=>{},broadcastOperation:u=>{this.operation={...u.operation,payload:u.operation.payload||{},createdAt:Number(u.operation.createdAt),updatedAt:Number(u.operation.updatedAt)},this.events.emit("operation",this.operation)},broadcastPresences:u=>{fn.info("received broadcast presences message");let d=this.clientId;this.clientId=u.selfClientId,d!==u.selfClientId&&(fn.info("client id changed to",u.selfClientId),this.events.emit("clientId",u.selfClientId)),this.presences=Object.values(u.presences||{}).map(p=>({clientId:p.clientId,joinTimestamp:Number(p.joinTimestamp),updateTimestamp:Number(p.updateTimestamp),data:p.data||{},positions:Object.fromEntries(Object.entries(p.positions||{}).map(([f,m])=>[f,IO(m)]))})).sort((p,f)=>p.joinTimestamp-f.joinTimestamp),this.events.emit("presences")},ack:u=>{this.ackMessage(u.message)}});this.encoder=TR((u,d)=>{this.pendingMessages.add(d),i.send(u)}),i.listen("state",u=>{this.updateState(),u==="open"?(this.sendPromptInit(),this.sendPresence()):this.doc.isSynced&&this.doc.emit("sync",[!1])}),i.listen("message",u=>{a(u)});let s=new hs(`hive:datasync:open:${e}`);if(s.setLabels(n),s.wrapPromise(i.open()),this.doc.isLoaded){fn.info(`doc "${this.doc.guid}" is already loaded`);return}fn.info(`waiting for doc "${this.doc.guid}" to be loaded`);let l=new hs(`hive:datasync:sync:${e}`);return l.setLabels(n),l.wrapPromise(this.doc.whenLoaded.then(()=>{fn.info(`doc "${this.doc.guid}" is loaded`)}))}close(){if(this.assertNotDestroyed(),!this.socket){fn.info("closing datasync, but socket is already closed");return}fn.info("closing datasync socket"),this.socket.destroy(),this.socket=null,this.encoder=null}destroy(){this.close(),this.batchDebounceFlush?.cancel(),this.undoManager.destroy(),this.doc.destroy(),this.events.removeAllListeners(),this.destroyed=!0}listen(o,e){return this.assertNotDestroyed(),this.events.addListener(o,e),()=>{this.events.removeListener(o,e)}}waitForSync(){if(this.assertNotDestroyed(),this.pendingMessages.size!==0)return fn.info("waiting for sync, pending messages count is",this.pendingMessages.size),new Promise(o=>{this.pendingMessagesResolves.push(o)})}transact(o){return this.assertNotDestroyed(),fn.info("start transaction on document"),this.beforeTransactionPresence=this.currentPresence,this.doc.transact(()=>o(this.doc),"local")}setPresence(o){this.assertNotDestroyed(),fn.info("set presence",o),this.currentPresence={data:o.data||this.currentPresence?.data||{},positions:Object.fromEntries(Object.entries(o.positions||{}).map(([e,n])=>n?[e,_O(n.type,n.index,n.assoc)]:null).filter(se))},this.sendPresence()}undo(){this.undoManager.undo()}redo(){this.undoManager.redo()}stopCapturing(){this.undoManager.stopCapturing()}hasBatchingEnabled(){return!!this.batchDebounceFlush}hasBatchedUpdates(){return this.batchUpdates.length>0}resetBatchingInterval(o,e=o*5){o?(this.batchDebounceFlush?.cancel(),this.batchDebounceFlush=(0,vI.default)(()=>{this.flushBatchUpdates()},o,{maxWait:e})):(this.flushBatchUpdates(),this.batchDebounceFlush=void 0)}disableBatching(){this.resetBatchingInterval(0)}flushBatchUpdates(){if(this.readOnly||(this.batchDebounceFlush?.cancel(),this.batchUpdates.length===0))return;let o=this.batchUpdates;this.batchUpdates=[];let e=Pg(o);this.sendUpdate(e)}sendPresence(){!this.encoder||!this.currentPresence||(fn.info("sending presence to server"),this.encoder.write({updatePresence:{id:this.encoder.newMessageID(),data:this.currentPresence.data,positions:Object.fromEntries(Object.entries(this.currentPresence.positions).map(([o,e])=>[o,RO(e)]))}}))}sendPromptInit(){this.encoder&&(fn.info("sending prompt to init to server"),this.encoder.write({promptInit:{id:this.encoder.newMessageID(),stateVector:OO(this.doc),version:Ls.V2}}))}sendInit(o){!this.encoder||this.readOnly||(fn.info("sending init to server"),this.encoder.write({init:{id:this.encoder.newMessageID(),update:Ig(this.doc,o),version:Ls.V2}}))}batchUpdate(o){if(!this.readOnly){if(!this.batchDebounceFlush){this.sendUpdate(o);return}this.batchUpdates.push(o),this.batchDebounceFlush()}}sendUpdate(o){!this.encoder||this.readOnly||(fn.info("sending update to server",o.byteLength),this.encoder.write({update:{id:this.encoder.newMessageID(),update:o,version:Ls.V2}}))}ackMessage(o){this.pendingMessages.delete(o),this.pendingMessages.size===0&&(this.pendingMessagesResolves.forEach(e=>e()),this.pendingMessagesResolves=[])}assertNotDestroyed(){if(this.destroyed)throw new Error("datasync is destroyed")}dangerouslyPauseSync(){throw new Error("dangerouslyPauseSync should only be used for testing")}async dangerouslyResumeSync(){throw new Error("dangerouslyPauseSync should only be used for testing")}};c();var bI=b(Fp(),1);var vm=class{constructor(o,e,n,r={}){this.events=new bI.default;this.manager=o,this.contentId=n.contentId,this.branchId=n.branchId,this.dataSync=new md(o.client,e,{readOnly:r.readOnly}),this._change=ER(kh(this.dataSync.doc)),this.dataSync.listen("update",()=>{this.dataSync.doc.transact(()=>{fR(kh(this.dataSync.doc))},"local"),this.#e=RR(kh(this.dataSync.doc)),this.events.emit("update")})}#e;get revision(){return this.#e}get presences(){return this.dataSync.presences}keepAlive(){return this.manager.keepAlive(this)}open(o={}){return this.dataSync.presence||this.dataSync.setPresence({data:o}),this.dataSync.open(this.contentId,"/branches/:branchId/datasync",{branchId:this.branchId},this.manager.clientId?{clientId:this.manager.clientId}:{})}close(){this.manager.close(this)}destroy(){this.dataSync.destroy()}waitForSync(){return this.dataSync.waitForSync()}listen(o,e){return o==="update"?(this.events.addListener(o,e),()=>{this.events.removeListener(o,e)}):this.dataSync.listen(o,e)}openPage(o){let e=this.dataSync.presence;this.manager.touch(this),e&&this.dataSync.setPresence({data:{...e.data,pageId:o}})}syncChange(o){return this.manager.touch(this),this.dataSync.transact(n=>o(this._change))}async change(o){if(this.dataSync.readOnly)throw new Error("can't apply change when dataSync is in read-only mode");let e=this.syncChange(o);return await this.waitForSync(),e}};c();var wI=b(Fp(),1);var bm=class{constructor(o,e,n,r={}){this.events=new wI.EventEmitter;this.manager=o,this.contentId=n.contentId,this.branchId=n.branchId,this.pageId=n.pageId,this.singleEditBatchingInterval=r.singleEditBatchingInterval??1500,this.#e=Hp.create(),this.dataSync=new md(o.client,e,{YType:Rr,readOnly:r.readOnly}),this.dataSync.resetBatchingInterval(this.singleEditBatchingInterval),this.dataSync.listen("restorePositions",i=>{let a=this.createSelectionFromRelatives(this.value.document,i);a=a?a.normalize(this.value.document):be.create(),this.#e.selection.isFocused&&(a=a.focus()),this.#e=this.#e.merge({selection:a}),this.events.emit("value")}),this.dataSync.listen("update",i=>{i==="local"||this.createSlateValue(),this.events.emit("value")}),this.dataSync.listen("presences",()=>{this.dataSync.presences.length>0?this.dataSync.hasBatchingEnabled()&&this.dataSync.disableBatching():this.dataSync.hasBatchingEnabled()||this.dataSync.resetBatchingInterval(this.singleEditBatchingInterval),this.updateSelections()}),this.dataSync.listen("state",i=>{i==="open"&&this.updateSelections()})}#e;get value(){return this.#e}createSlateValue(){let o=fm(this.dataSync.doc);this.dataSync.doc.transact(()=>VR(o),"local");let e=NR(o);this.#e=this.dataSync.doc.transact(()=>{let n=this.value.selection,r=vO[e.data.get("schemaType")||"document"],i=Hp.create({document:e},{normalize:!1}).setSchema(r);if(i.document!==e)throw new Error("Document should not be modified by creation of Value");let a=i.change({save:!1}).normalize();a.value.document!==i.document&&(i=i.merge({document:a.value.document}),Xw(a,o));let s=this.dataSync.presence?this.createSelectionFromRelatives(i.document,this.dataSync.presence.positions):void 0;return s&&(s=s.normalize(e)),s&&n.isFocused&&(s=s.focus()),i=i.merge({selection:s??be.create()}),i},"local")}keepAlive(){return this.manager.keepAlive(this)}open(o={}){return this.dataSync.presence||this.dataSync.setPresence({data:o}),this.dataSync.open(this.contentId,"/branches/:branchId/pages/:pageId/document/datasync",{branchId:this.branchId,pageId:this.pageId},this.manager.clientId?{clientId:this.manager.clientId}:{})}close(){this.manager.close(this)}destroy(){this.dataSync.destroy()}waitForSync(){return this.dataSync.waitForSync()}listen(o,e){return this.events.addListener(o,e),()=>{this.events.removeListener(o,e)}}applyChange(o){if(this.dataSync.readOnly)throw new Error("can't apply change when dataSync is in read-only mode");this.manager.touch(this);let e=this.value;if(this.#e=o.value,e.document!==o.value.document?(this.dataSync.transact(n=>{Xw(o,fm(n))}),this.updateSelections()):this.events.emit("value"),o.value.selection!==e.selection){let n=o.value.selection;this.dataSync.setPresence({data:{...this.dataSync.presence?.data||{}},positions:zR(o.value.document,this.dataSync.doc,n)})}o.value.selection.isBlurred&&this.dataSync.flushBatchUpdates()}async change(o){let e=this.value.change();return o(e),this.applyChange(e),this.waitForSync()}updateSelections(){this.dataSync.state!=="open"?this.selections=Pa.create():this.selections=Pa.create(this.dataSync.presences.map(o=>{let e=this.createSelectionFromRelatives(this.value.document,o.positions);return e?e.merge({data:Wu.create({clientId:o.clientId,...o.data})}):null}).filter(se)),this.events.emit("selections")}undo(){return this.dataSync.undo()}redo(){return this.dataSync.redo()}createSelectionFromRelatives(o,e){let n=this.dataSync.doc;return FR(o,{anchor:e.anchor&&Sw(e.anchor,n)||void 0,focus:e.focus&&Sw(e.focus,n)||void 0})}};c();var Lh=class{constructor(o,e={}){this.browserCache=e.browserCache,this.cache=nr({getKey:n=>n,getValue:async n=>{let r=await o(n),i=Array.isArray(r)?r:[r],a={};if(i.forEach(s=>{let l=tI(s),u={token:s,metadata:l};Object.keys(l.payload.content).forEach(d=>{a[d]=u,n!==d&&this.cache.write(d,u)})}),!a[n])throw new Yi.Forbidden(`No authentication for content "${n}"`);return a[n]},ttl:n=>n.metadata.expiration-(Date.now()+5*60*1e3),effects:this.browserCache?[this.browserCache.effect]:[]})}async getParsedToken(o){return await this.cache.readAsync(o)}async getToken(o){let{token:e}=await this.getParsedToken(o);return e}async clearCache(){this.cache.clearAll(),this.browserCache&&await this.browserCache.clearCache()}};c();c();c();var Ah=Symbol("HiveDataSyncCacheOrigin"),Nh=class{};var k8="hive-docs",Tc=Ze("hive:browsercache"),x8=100,Dh=class extends Nh{constructor(){super();this.updateCountByGuid=new Map;this.db=new Nx(k8),this.db.version(1).stores({updates:"++id,guid,at,state"})}get updates(){return this.db.table("updates")}async clear(){await this.db.delete()}registerDoc(e){let n=()=>{let r=(a,s)=>{s!==Ah&&this.pushUpdate(e,a).catch(l=>{Tc.error(`error pushing update for ${e.guid}`,l)})},i=()=>{e.off("updateV2",r),e.off("destroy",i)};e.on("updateV2",r),e.on("destroy",i),this.fetchUpdates(e).catch(a=>{Tc.error(`error fetching updates for ${e.guid}`,a)})};this.db.isOpen()?n():(this.db.on("ready",n),this.db.open().catch(r=>{Tc.error("error opening IndexedDB",r)}))}async fetchUpdates(e){let n=await this.updates.where("guid").equals(e.guid).toArray();if(!n.length){Tc.info(`no updates found for ${e.guid}`);return}Tc.info(`fetched ${n.length} updates for ${e.guid}`);let r=0;PO(e,()=>{for(let i of n)e.transact(()=>{r+=i.value.byteLength,Rg(e,i.value,Ah)})},Ah,!1),Tc.info(`loaded ${n.length} updates (${r} bytes) for ${e.guid}`),e.emit("load",[]),this.updateCountByGuid.set(e.guid,n.length)}async pushUpdate(e,n){let r=this.updateCountByGuid.get(e.guid)??0;if(r>=x8){await this.resetDoc(e);return}Tc.info(`push update for ${e.guid} (${n.byteLength} bytes, ${r+1} updates)`);let i=Date.now();await this.updates.add({guid:e.guid,value:n,at:i,state:!1}),this.updateCountByGuid.set(e.guid,(this.updateCountByGuid.get(e.guid)??0)+1)}async resetDoc(e){let n=Ig(e);Tc.info(`reset cache for ${e.guid} with ${n.byteLength} bytes`),await this.db.transaction("rw",this.updates,async r=>{await this.updates.where("guid").equals(e.guid).delete();let i=Date.now();await this.updates.add({guid:e.guid,value:n,at:i,state:!0})}),this.updateCountByGuid.set(e.guid,0)}};var SI=Ze("hive:datasync-manager"),Qw=2,Bh=class{constructor(o,e={}){this.syncs=new Map;this.ids=new WeakMap;this.gcClock=0;this.cache=new Dh;this.client=o,this.ttl=e.ttl??1e3*60*5}async clearCache(){await this.cache.clear()}close(o){let e=this.ids.get(o);if(!e)throw new Error("Unknown sync client");let n=this.syncs.get(e);if(!n)throw new Error("Expected sync client to be registered");n.sync.destroy(),this.syncs.delete(e),this.ids.delete(o)}closeAll(){this.stopGarbageCollect(),[...this.syncs.values()].map(o=>o.sync.close()),this.syncs=new Map,this.ids=new WeakMap}touch(o){let e=this.ids.get(o);if(!e)return!1;let n=this.syncs.get(e);if(!n)throw new Error("Expected sync client to be registered");return n.clock=this.gcClock,!0}keepAlive(o){this.touch(o);let e=setInterval(()=>{this.touch(o)||n()},this.ttl/2),n=()=>{e&&clearInterval(e),e=void 0};return n}branch(o,e,n){let r=n?.readOnly??!1,i=this.getSync(`content/${o}/branches/${e}/datasync`,a=>new vm(this,a,{contentId:o,branchId:e},{readOnly:r}),n);if(i&&!(i instanceof vm))throw new Error(`Expected HiveBranchRevision, got ${i.constructor.name}`);return i}pageDocument(o,e,n,r){let i=this.getSync(`content/${o}/branches/${e}/pages/${n}/document/datasync`,a=>new bm(this,a,{contentId:o,branchId:e,pageId:n},r),r);if(i&&!(i instanceof bm))throw new Error(`Expected HiveBranchDocument, got ${i.constructor.name}`);return i}getSync(o,e,n){let r=n?.readOnly??!1,i=this.syncs.get(o);if(i)return i.sync.dataSync.setReadOnly(r),i.sync;if(n?.autoInit===!1)return;let a=e(o);return this.syncs.set(o,{sync:a,clock:this.gcClock}),this.ids.set(a,o),a.dataSync.listen("clientId",s=>{this.clientId=s}),this.cache.registerDoc(a.dataSync.doc),SI.info(`initialize sync for "${o}"`),this.startGarbageCollect(),a}garbageCollect(){this.gcClock+=1;for(let[o,{sync:e,clock:n}]of this.syncs.entries())if(nthis.garbageCollect(),this.ttl/Qw))}stopGarbageCollect(){this.gcInterval&&(clearInterval(this.gcInterval),this.gcInterval=void 0)}};c();var Wh=class{constructor(o){this.branchesCache=nr({getValue:async o=>{try{return await this.client.getBranch(o.contentId,o.branchId)}catch(e){if(e.statusCode===404)return;throw e}}});this.revisionsCache=nr({getValue:async o=>{try{return await this.client.getRevision(o.contentId,o.revisionId)}catch(e){if(e.statusCode===404)return;throw e}}});this.branchesHistoryCache=nr({getValue:async o=>await this.client.getBranchHistory(o.contentId,o.branchId,{page:o.initialRevisionId,limit:o.size,...o.git!==void 0?{git:o.git}:{}})});this.documentsCache=nr({getValue:async o=>{try{return await this.client.getDocument(o.contentId,o.documentId)}catch(e){if(e.statusCode===404)return;throw e}},toJS:o=>o!==void 0?rO(o):"undefined",fromJS:o=>o!=="undefined"?nO(o):void 0});this.client=o}getBranchHistory(o,e,n){return Du(this.branchesHistoryCache.readCacheState({contentId:o,branchId:e,initialRevisionId:n.page,size:n.limit,...n.git!==void 0?{git:n.git}:{}}))}getBranchRevision(o,e){let n=this.client.sync.branch(o,e,{autoInit:!1});return n?n.revision:ng(Du(this.branchesCache.readCacheState({contentId:o,branchId:e})),r=>{if(r)return this.getRevision(o,r.revision)})}getBranchPageDocument(o,e,n){let r=this.client.sync.pageDocument(o,e,n,{autoInit:!1});return r?r.value.document:ng(Du(this.branchesCache.readCacheState({contentId:o,branchId:e})),i=>{if(i)return ng(this.getRevision(o,i.revision),a=>{if(a){let s=a.pages[n];return s?.type!=="document"?void 0:s.document?this.getDocument(o,s.document):Gu(s.id).document}})})}getRevision(o,e){return Du(this.revisionsCache.readCacheState({contentId:o,revisionId:e}))}getDocument(o,e){return Du(this.documentsCache.readCacheState({contentId:o,documentId:e}))}toJSON(){return{documents:this.documentsCache.toJS(),revisions:this.revisionsCache.toJS(),branches:this.branchesCache.toJS()}}fromJSON(o){o.documents&&this.documentsCache.fromJS(o.documents),o.revisions&&this.revisionsCache.fromJS(o.revisions),o.branches&&this.branchesCache.fromJS(o.branches)}};c();c();var CI={},kI=globalThis.fetch;c();var xI=b(Fp(),1);var zh=class{constructor(o,e,n,r,i){this.id=void 0;this.state=null;this.events=new xI.default;this.client=o,this.contentId=e,this.path=n,this.pathParams=r,i&&(this.id=i)}async start(o={}){if(this.id)throw new Error("Operation already started");let n=await(await this.client.request(this.contentId,this.path,{path:this.pathParams},{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(o)})).json();return this.setState(n),n}async update(o){if(!this.id)throw new Error("Operation not started or HiveContentOperation() is called without an existing operation ID");let n=await(await this.client.request(this.contentId,this.path,{path:this.pathParams},{method:"PUT",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({...o,id:this.id})})).json();return this.setState(n),n}async markAsSucceeded(){return this.update({status:2})}setState(o){this.id=o.id,this.state=o,this.events.emit("update",o)}listen(o){return this.events.on("update",o),()=>{this.events.off("update",o)}}};var O8=Ze("hive:client"),OI=typeof globalThis.window<"u"||!1,Fh=class{constructor(o,e,n={}){this.isRunningAtEdge=OI;let r;this.getEndpoint=typeof o=="string"?()=>Promise.resolve(o):async()=>(r||(r=await o()),r),this.auth=new Lh(e,{browserCache:n.tokensBrowserCache}),this.store=new Wh(this),this.sync=new Bh(this),this.clientId=Ma(),n.locationHint&&(this.isRunningAtEdge=n.locationHint)}close(){this.sync.closeAll()}async clearAuthCache(){await Promise.all([this.auth.clearCache(),this.sync.clearCache()]),this.close()}getSocket(o,e,n,r){if(!this.isRunningAtEdge||!OI)throw new Error("HiveClient#getSocket can only be called from the edge");let i=async()=>{let a=_I(o,e,n),s=await this.auth.getToken(o),l=await this.getEndpoint(),u=new URL(a,l);if(u.protocol=u.protocol.replace("http","ws"),r)for(let[d,p]of Object.entries(r))u.searchParams.set(d,p);return u.searchParams.set("authToken",s),u.toString()};return new Mh(i)}async getBranch(o,e){return await(await this.request(o,"/branches/:branchId",{path:{branchId:e}})).json()}async getBranchRevision(o,e,n){return await(await this.request(o,"/branches/:branchId/save",{path:{branchId:e},query:n?{mask:n.join(",")}:{}},{method:"POST"})).json()}async saveBranch(o,e){return{revisionId:(await this.getBranchRevision(o,e,["id"])).id}}async getBranchHistory(o,e,n={}){let{limit:r=10,page:i,git:a,refresh:s}=n;return await(await this.request(o,"/branches/:branchId/history",{path:{branchId:e},query:{limit:r.toString(),...i?{page:i}:{},...a!==void 0?{git:`${a}`}:{},...s!==void 0?{refresh:`${s}`}:{}}})).json()}async getRevision(o,e,n){return await(await this.request(o,"/revisions/:revisionId",{path:{revisionId:e},query:n?{mask:n.join(",")}:{}})).json()}getRevisionInfo(o,e){return this.getRevision(o,e,wO)}async mergeBranch(o,e){if(!this.isRunningAtEdge)throw new Error("HiveClient#mergeBranch can only be called from the edge");return await(await this.request(o,"/branches/:branchId/merge",{path:{branchId:e}},{method:"POST"})).json()}async rollbackBranch(o,e,n){await this.request(o,"/branches/:branchId/rollback",{path:{branchId:e}},{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(n)})}async updateBranch(o,e){return await(await this.request(o,"/branches/:branchId/update",{path:{branchId:e}},{method:"POST"})).json()}async checkoutBranch(o,e,n,r={}){return(await this.request(o,"/branches/:branchId/checkout",{path:{branchId:e}},{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",..._8(r.operationId)},body:JSON.stringify(n)})).json()}async getDocument(o,e){let r=await(await this.request(o,"/documents/:documentId",{path:{documentId:e}},{method:"GET",headers:{Accept:"application/json","Content-Type":"application/json"}})).arrayBuffer();return hw(new Uint8Array(r))}async getPageDocument(o,e,n){if(!this.isRunningAtEdge)throw new Error("HiveClient#getPageDocument can only be called from the edge");let i=await(await this.request(o,"/branches/:branchId/pages/:pageId/document",{path:{branchId:e,pageId:n}})).arrayBuffer();return hw(new Uint8Array(i))}async createDocument(o,e,n={}){return await(await this.request(o,"/documents",{query:n.documentId?{documentId:n.documentId}:{}},{method:"POST",headers:{Accept:"application/json","Content-Type":"application/octet-stream"},body:iO(n.skipNormalization?e:bO(e),{preserveKeys:!0})})).json()}async createRevision(o,e){return await(await this.request(o,"/revisions",{},{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(e)})).json()}getContentOperation(o,e,n,r){return new zh(this,o,e,n,r)}getBranchContentOperation(o,e,n){return this.getContentOperation(o,"/branches/:branchId/operation",{branchId:e},n)}async createFileBlob(o,e,n){let r=await this.request(o,"/blobs",{query:{name:e.name}},{method:"POST",headers:{Accept:"application/json","Content-Type":e.contentType},body:n}),{blobId:i}=await r.json();return{blobId:i,downloadURL:eR(await this.getEndpoint(),o,{blobId:i,name:e.name})}}async updateRevisionMetadata(o,e,n){return await(await this.request(o,"/revisions/:revisionId",{path:{revisionId:e}},{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(n)})).json()}async duplicateContent(o,e){return(await this.request(o.contentId,"/branches/:branchId/duplicate",{path:{branchId:o.branchId}},{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({origin:e,page:o.pageId})})).json()}async triggerAlarm(o,e={force:!1}){o.pageId?await this.request(o.contentId,"/branches/:branchId/pages/:pageId/document/alarm",{path:{branchId:o.branchId,pageId:o.pageId},query:{force:String(e.force)}},{method:"POST"}):await this.request(o.contentId,"/branches/:branchId/alarm",{path:{branchId:o.branchId},query:{force:String(e.force)}},{method:"POST"})}async request(o,e,n,r={},i={}){let{retries:a=3}=i,{path:s={},query:l={}}=n,u=Ma(),d=new hs(`hive:request:${(r.method||"GET").toLowerCase()}:${e}`);return d.label("contentId",o),d.setLabels({requestId:u,clientId:this.clientId,locationHint:this.isRunningAtEdge,...n}),d.wrap(async()=>{let p=_I(o,e,s),f=await this.auth.getToken(o),m=await this.getEndpoint(),h=new URL(p,m);h.search=new URLSearchParams(l).toString();let y=new Headers(r.headers||{});y.set("Authorization",`Bearer ${f}`),y.set("X-Request-Id",u),y.set("X-Client-Id",this.clientId),typeof this.isRunningAtEdge=="string"&&y.set("X-Hive-Location-Hint",this.isRunningAtEdge);let S=await RI(()=>kI(h.toString(),{...CI,...r,headers:y}),a),C=S.headers.get("cf-ray");if(d.label("rayId",C),!S.ok)try{let k="";try{k=(await S.clone().json()).error.message}catch{k=`Unexpected text response: ${await S.text()}`}throw Yi.fromStatusCode(S.status,k)}catch(k){throw k.statusCode?k:new Error(`Unexpected response with status code ${S.status}: ${k.message}`)}return S})}};function _I(t,o,e){for(let[n,r]of Object.entries(e))o=o.replace(`:${n}`,r);return`content/${t}${o}`}function _8(t){return t?{"X-Content-Operation-Id":t}:{}}async function RI(t,o=3,e=500){if(o<=0)return t();try{let n=await t();if(n.status===504||n.status===503)throw Yi.fromStatusCode(n.status,n.statusText);return n}catch(n){if(O8.error("retry because of error",n,{attemptsLeft:o,delay:e}),o>0)return await new Promise(r=>setTimeout(r,e)),RI(t,o-1,e*2);throw n}}function eS(t){let{children:o}=t,e=Vh.useMemo(()=>{if(t.client)return t.client;let n=new Fh(t.endpoint,t.fetchContentAuthToken,{tokensBrowserCache:t.tokensBrowserCache});return t.store&&n.store.fromJSON(t.store),n},[t.client,t.endpoint,t.fetchContentAuthToken,t.store]);return Vh.createElement(i1.Provider,{value:e},o)}c();var fd=b(x());var R8=fd.createContext(null);function Zt(){return fd.useContext(R8)}c();var II=b(x());function PI(t){let e=Ce().sync.pageDocument(t.branch.contentId,t.branch.branchId,t.pageId,{readOnly:t.readOnly}),n=e.open(t.presence);if(n)throw n;return II.useEffect(()=>{let r=e.keepAlive();return()=>{e.dataSync.state==="open"&&e.dataSync.setPresence({positions:{}}),r()}},[e]),e}c();var Mc=b(x());function EI(t){let o=Mc.useMemo(()=>({getCurrentValue:()=>t.value,subscribe:a=>t.listen("value",a)}),[t]),e=Mc.useMemo(()=>({getCurrentValue:()=>t.selections,subscribe:a=>t.listen("selections",a)}),[t]),n=Mc.useSyncExternalStore(o.subscribe,o.getCurrentValue),r=Mc.useSyncExternalStore(e.subscribe,e.getCurrentValue),i=Mc.useCallback(a=>{t.applyChange(a)},[t]);return[n,r,i]}c();var qh=b(x());function TI(t){let o=t.dataSync,e=qh.useMemo(()=>({getCurrentValue:()=>o.presences,subscribe:n=>o.listen("presences",n)}),[o]);return qh.useSyncExternalStore(e.subscribe,e.getCurrentValue)}c();var MI=b(x());function LI(t){return MI.useMemo(()=>({onKeyDown(o,e){if(Rw.isRedo(o))return t.redo(),o.preventDefault(),e;if(Rw.isUndo(o))return t.undo(),o.preventDefault(),e}}),[t])}c();var tS=b(x());function NI(t){let o=tS.default.useMemo(()=>({getCurrentValue:()=>{if(t)return t.clock},subscribe:e=>t?t.listen("update",e):()=>{}}),[t]);return tS.default.useSyncExternalStore(o.subscribe,o.getCurrentValue,()=>{})}c();function AI(t){let{r:o,g:e,b:n}=m1(t);return Math.sqrt(.299*(o*o)+.587*(e*e)+.114*(n*n))}function Ga(t){return AI(t)>150?"light":"dark"}function Gh(t){let o=AI(t);return o>240?"lightest":o>215?"light":o>190?"semiLight":o>165?"medium":o>140?"semiDark":o>115?"dark":"darkest"}c();function DI(t){return t.charAt(0).toUpperCase()+t.slice(1)}c();var gd=b(x()),Hh=b(MD());function BI(t=2e3){let[o,e]=gd.useState(!1),n=gd.useRef(null);return gd.useEffect(()=>(!o&&typeof window<"u"&&(n.current=setTimeout(()=>(0,Hh.unstable_runWithPriority)(Hh.unstable_IdlePriority,()=>e(!0)),t)),()=>{n.current&&clearTimeout(n.current)}),[]),o}c();var WI=b(x());function zI(){let t=WI.useRef();return Yu(()=>{t.current=window},[]),t}c();var hd=b(x());function FI(){let t=hd.useRef(new WeakMap);return hd.useCallback(o=>(t.current.has(o)||t.current.set(o,hd.createRef()),t.current.get(o)),[])}c();var VI=b(x());function Kh(t,o){let e=Yo(t);VI.default.useEffect(()=>{let n=()=>e.current(),r=window.setTimeout(n,o);return()=>window.clearTimeout(r)},[o])}c();var wm=b(x());c();var qI=b(x());function Xh(t,o=500){let e=qI.useRef(0);return n=>e.current&&Date.now()-e.current{if(!t)return;let i=a=>{(n?a.target===e:e.contains(a.target))&&a.key==="Tab"&&(a.defaultPrevented||a.preventDefault(),r.current?.(a.shiftKey))};return document.addEventListener("keydown",i),()=>{document.removeEventListener("keydown",i)}},[r,!!t,e,n])}function KI(t){let{anchor:o,children:e,wrapper:n,onClose:r,...i}=t,a=wm.useRef(null);return yc({...i,onClose:r},a),wm.createElement(Ba,{ref:a,opened:i.opened,anchor:o,wrapper:n},wm.createElement(Hg.Provider,{value:r},e))}c();var Ha=b(x()),XI=b(z());function Uh(t,o={}){let e=Ha.createContext(null);function n(i){let{children:a,...s}=i,l=typeof t=="object"?t:t(i),[u,d]=Ha.useState(l),[p,f]=Ha.useState(!1),m=h=>{let{layout:y}=h.nativeEvent;(!u||o.width!==!1&&y.width!==u.width||o.height!==!1&&y.height!==u.height)&&(d(y),f(!0))};return Ha.createElement(e.Provider,{value:{ready:p,dimensions:u}},Ha.createElement(XI.View,{...s,onLayout:m},a))}function r(){let i=Ha.useContext(e);if(!i||!i.dimensions)throw new Error("Dimensions not available");return[i.dimensions,i.ready]}return{View:n,useDimensions:r}}c();var Bl=b(x()),$h=b(z());c();var Yh=b(x()),jh=b(z());var I8=J.createResponsiveComponent(jh.TouchableOpacity);function UI(t){let[,o]=_(T8),{close:e}=go(),n=$u()==="mobile",r=t.closeable||n,i=()=>{t.onClose&&t.onClose(),e(t.id)},a=Rl({mount:P8,unmount:E8});return Yh.createElement(jh.View,{ref:a},Yh.createElement(I8,{mobileStyle:o.toastMobile,desktopStyle:o.toastDesktop,onPress:()=>{t.onOpen&&t.onOpen(),r&&i()}},Yh.createElement(ki,{...t,onClose:r?i:void 0,style:o.alert,mainBackground:!0})))}var P8={duration:Wa.TRANSITION_DURATION_SHORT,frames:{0:{opacity:0,transform:[{translateY:100}]},1:{opacity:1,transform:[{translateY:0}]}}},E8={duration:Wa.TRANSITION_DURATION_SHORT,frames:{0:{opacity:1,transform:[{translateY:0}]},1:{opacity:0,transform:[{translateY:100}]}}},T8=F.create({toastDesktop:{width:"auto",minWidth:420,maxWidth:720,marginBottom:g.small},toastMobile:{width:"100%",minWidth:0},alert:t=>({...t.shadows.pop,borderColor:t.colors.border.main})});function YI(t){let o=tr(N1),e=tr(L1),n=Bl.useRef(null),r=N8[o];return Bl.createElement(Tn,{ref:n},Bl.createElement(J.View,{style:[L8.toaster],mobileStyle:r.mobile,desktopStyle:r.desktop},Bl.createElement(P1,null,e.map(i=>Bl.createElement(UI,{...i,key:i.id})))))}var L8=$h.StyleSheet.create({toaster:{position:"fixed",zIndex:200}}),N8={"bottom-right":$h.StyleSheet.create({desktop:{bottom:g.medium,right:g.medium},mobile:{bottom:g.medium,right:g.medium,left:g.medium}}),"bottom-right-with-bar":$h.StyleSheet.create({desktop:{bottom:g.xxlarge,right:g.medium},mobile:{bottom:g.xxlarge+g.xlarge+g.medium,right:g.medium,left:g.medium}})};c();var ei=b(x()),zs=b(z());var A8=V.createInteractiveComponent($r);function Ka(t){let{icon:o,title:e,subtitle:n,details:r,style:i,buttons:a=[],...s}=t,[,l]=_(D);return ei.createElement(Ps,{style:[w.alignCenter,g.Padding.medium,i],...s},o?ei.createElement(D8,{icon:o}):null,ei.createElement(zs.View,{style:[w.flex1]},ei.createElement(zs.View,{style:[w.directionRow,w.alignCenter]},ei.createElement(A8.Child,{style:[l.Body,l.Medium,l.text],activeStyle:l.primary,descendantOf:Ps.interactiveHandle},e),n?ei.createElement($r,{style:[l.Label,l.textMuted,g.Margin.mediumLeft]},n):null),r?ei.createElement(zs.View,null,ei.createElement(zs.Text,{style:[l.Label,l.textMid]},r)):null),a.length>0?ei.createElement(zs.View,{style:[w.directionRow,w.alignCenter,g.Margin.mediumLeft]},a.map((u,d)=>u?ei.createElement(zs.View,{style:[g.Margin.smallLeft],key:d},u):null)):null)}function D8(t){let{icon:o}=t,[,e]=_(D),n=V.useInteractiveComponent(o);return ei.createElement(zs.View,{style:[g.Margin.mediumRight]},ei.createElement(n.Child,{size:M.S,style:[e.textMuted],hoverStyle:e.primary}))}c();async function jI(t){let o=()=>{let n=t;for(;n&&(n=n.parentElement,!(n===document.querySelector("body")||n?.hasAttribute("data-virtualparent"))););return n},e;return new Promise(n=>{let r=o();if(!r||!r.firstChild)return;let i=()=>{e.disconnect(),n()},a=!1;e=new IntersectionObserver(l=>{let[u]=l;u.isIntersecting&&requestAnimationFrame(()=>{i(),a=!0})},{rootMargin:"-50% 0% -50% 0%"});let s=()=>{Qg(r,{scrollMode:"if-needed",block:"center",inline:"center",behavior:"smooth"}),setTimeout(()=>{a||s()},500)};s(),e.observe(r)})}c();var aS=b(x());c();var Xt=b(x()),oP=b(z());c();var ot=b(x()),Nn=b(z());c();var Ee=b(x()),Jt=b(z());var $I=Ee.forwardRef(function(o,e){let{command:n,query:r,active:i,executeCommand:a,onHoverIn:s}=o,[l,u]=_(D),[,d]=_(B8),[p,f]=En(!1),m=u.text,h=u.textMid,y=u.primary,S=l.colors.background.main;i&&(m=u.textStandout,h=u.textMid,S=l.colors.background.muted);let C=[u.Bold],k=Ee.useCallback(()=>{let I=a(n);I instanceof Promise&&f(()=>I)},[n,a]),O=Ee.useCallback(()=>s(n),[n,s]),R=V.useInteractiveState({onHoverIn:O});return Ee.createElement(Ir,{ref:e,component:Jt.TouchableOpacity,...R.events,onMouseDown:I=>{I.preventDefault()},onPress:k,backgroundColor:S,style:[w.directionRow,w.alignCenter,d.commandItem,g.Margin.smallHorizontal,g.Padding.xsmallVertical,g.Padding.smallHorizontal,{height:oS(n)}],testID:n.testID},p?Ee.createElement(Jt.View,{style:[g.Padding.mediumRight]},Ee.createElement(Re,{size:"medium"})):n.icon?Ee.createElement(Jt.View,{style:[g.Padding.mediumRight]},Ee.createElement(Ee.Suspense,{fallback:Ee.createElement(Jt.View,{style:{width:M.ICON_M,height:M.ICON_M}})},Ee.createElement(n.icon,{size:M.ICON_M,style:y}))):null,Ee.createElement(Jt.View,{style:w.flex1},Ee.createElement(Jt.View,{style:w.directionRow},Ee.createElement(Jt.View,{style:w.flex1},n.title?Ee.createElement(Jt.View,null,Ee.createElement(Jt.Text,{style:[u.Label,m,n.subtitle?u.Bold:u.Medium],numberOfLines:1},Ee.createElement(rh,{query:r,text:n.title,highlight:C}))):null,n.subtitle?Ee.createElement(Jt.View,null,Ee.createElement(Jt.Text,{style:[u.Caption,h],numberOfLines:1},Ee.createElement(rh,{query:r,text:n.subtitle,highlight:C}))):null)),n.body?Ee.createElement(Jt.View,{style:[d.commandBody,g.Padding.smallLeft,g.Margin.smallTop]},n.body.map((I,E)=>Ee.createElement(Jt.View,{key:E},Ee.createElement(Jt.Text,{style:[u.Caption,u.textMid],numberOfLines:1},Ee.createElement(rh,{query:r,text:I,highlight:C}))))):null),n.label?Ee.createElement(Jt.View,null,Ee.createElement(D1,{size:"medium",kind:n.label.kind,icon:n.label.icon},n.label.title)):Ee.createElement(Ee.Fragment,null,n.descendant?Ee.createElement(Jt.View,{style:[g.Padding.mediumLeft]},Ee.createElement(v.ChevronRight,{size:M.ICON_S,style:[u.textMuted]})):null,n.type===1?Ee.createElement(Jt.View,{style:[g.Padding.mediumLeft]},Ee.createElement(Sc,{value:n.selected,onValueChange:k,size:M.ICON_S})):null,n.type===0?Ee.createElement(Jt.View,{style:[g.Padding.mediumLeft]},Ee.createElement(nh,{value:n.selected,onValueChange:k,size:M.ICON_S})):null,n.type===2?Ee.createElement(Jt.View,{style:[g.Padding.mediumLeft]},Ee.createElement(oh,{value:n.enabled,onValueChange:()=>{}})):null))});function oS(t){let o=0;return o+=2*g.small,o+=Math.max(t.title&&Ue.Label.lineHeight||0,t.icon?M.ICON_M:0,typeof t.selected=="boolean"||typeof t.enabled=="boolean"?M.ICON_S:0),t.subtitle&&(o+=Ue.Caption.lineHeight||0),t.body&&(o+=g.small,o+=t.body.length*(Ue.Caption.lineHeight||0)),o}var B8=F.create({commandItem:t=>({borderRadius:t.radiuses.medium}),commandBody:t=>({borderLeftWidth:1,borderLeftColor:t.colors.border.mid})});c();function Zh({getItemHeight:t,getItemSeparatorHeight:o=()=>0,getSectionSeparatorHeight:e=()=>0,getSectionHeaderHeight:n=()=>0,getSectionFooterHeight:r=()=>0,listHeaderHeight:i=0,stickySectionHeadersEnabled:a}){return(s,l)=>{let u=0,d=typeof i=="function"?i():i,p=0,f=s.length;for(let m=0;m0&&I{let H=await t_(a,T);H?s(H):l(null)},[s,l]),m=ot.useCallback(T=>{s(H=>{if(!H)return null;let U=p(T),K=o_(H,T,U);return K||(H.descendant?{...H,descendant:void 0}:H)})},[s,p]),h=ot.useCallback(()=>{s(T=>T?.parent?null:T)},[s]),y=ot.useCallback(T=>{let H=-1;return{sectionIndex:n.findIndex(K=>(H=K.data.findIndex(Y=>Y.key===T),H>=0)),itemIndex:H,viewPosition:.5}},[n]),S=ot.useCallback(T=>d.current?.scrollToLocation(y(T.key)),[y]),C=r_({active:i,items:e,onSelect:f,onOpen:m,onClose:h,scrollTo:S}),k=n.length>1,O=ot.useCallback(T=>{C.hoverItem(T),m(T)},[C.hoverItem,m]),R=ot.useMemo(()=>Zh({getItemHeight:({item:T})=>oS(T),getSectionSeparatorHeight:({section:T,leadingItem:H,leadingSection:U,trailingItem:K,trailingSection:Y})=>U&&!H&&!T.group.title?2*(g.small-1)+1:Y&&!K?M.S/4:0,getSectionHeaderHeight:({section:T})=>k&&T.group.title?M.S:0}),[k]),I=ot.useMemo(()=>k?({section:T})=>T.group.title?ot.createElement(z8,{group:T.group}):null:void 0,[k]),E=ot.useCallback(T=>ot.createElement(F8,{...T}),[]),P=ot.useCallback(({item:T})=>ot.createElement($I,{ref:p(T),active:u==="desktop"&&T.key===C.cursor.current?.key,command:T,query:a.query.text,executeCommand:f,onHoverIn:O}),[f,p,C.cursor.current?.key,O,u,a.query.text]),L=r;if(!L&&e.length===0){let T=a.placeholder||(sm(a)?null:"No items found");return T?ot.createElement(W8,{placeholder:T}):null}return ot.createElement(Nn.View,{style:[w.flex1]},ot.createElement(Nn.SectionList,{key:o,ref:d,sections:n,extraData:C.cursor,getItemLayout:R,renderItem:P,SectionSeparatorComponent:E,renderSectionHeader:I,contentContainerStyle:[g.Padding.smallVertical],ListFooterComponent:L?ot.createElement(Nn.View,{style:[w.directionRow,w.justifyContentCenter,g.Padding.medium]},ot.createElement(Re,{size:"large"})):null}))}function W8(t){let{placeholder:o}=t,[,e]=_(D);return ot.createElement(Nn.View,{style:[g.Padding.smallHorizontal,g.Padding.mediumVertical]},ot.createElement(Nn.View,{style:[g.Padding.mediumHorizontal]},ot.createElement(Nn.Text,{style:[e.Caption,e.textMuted]},o)))}function z8(t){let{group:o}=t,[,e]=_(D);return ot.createElement(Nn.View,{style:[V8.paletteGroupHeader,w.directionRow,w.alignCenter,g.Padding.smallHorizontal]},ot.createElement(Nn.View,{style:[g.Padding.smallHorizontal]},ot.createElement(Nn.Text,{style:[e.GroupTitle,e.textMuted]},o.title)))}function F8(t){let{leadingSection:o,section:e,leadingItem:n,trailingSection:r,trailingItem:i}=t,[,a]=_(q8);return o&&!n&&!e.group.title?ot.createElement(Nn.View,{style:a.paletteDividerUntitled}):(r&&!i&&(Nn.View,a.paletteDividerFooter),null)}var V8=Nn.StyleSheet.create({paletteGroupHeader:{height:M.S}}),q8=F.create({paletteDividerUntitled:(t,o)=>({marginTop:g.small-1,marginBottom:g.small-1,borderTopColor:o.color==="light"?t.colors.border.mid:t.colors.sidebar.itemBorder,borderTopWidth:1}),paletteDividerFooter:{height:M.S/4}});c();var yd=b(x()),vd=b(z());function JI(t){let{error:o}=t,[,e]=_(D);return console.error(o),yd.createElement(vd.View,{style:[w.directionRow,w.alignCenter,g.Padding.smallVertical,g.Padding.mediumHorizontal]},yd.createElement(vd.View,{style:[g.Padding.mediumRight,g.Padding.xsmallTop]},yd.createElement(v.Warning,{size:M.ICON_S,style:e.danger})),yd.createElement(vd.View,{style:[w.flex1,w.directionRow,w.alignCenter]},yd.createElement(vd.Text,{style:[e.danger,e.Label]},ji(o))))}c();var Tr=b(x()),Fs=b(z());var QI=Tr.forwardRef(function(o,e){let{palette:n,setPalette:r,withItems:i,placement:a}=o,[,s]=_(G8),[l,u]=_(D),[d,p]=Uu(n.query.text,[n]),f=h=>{p(h),r(y=>!n||!y?n:ed({...y,descendant:void 0},h))},m=h=>{(h.nativeEvent.key==="Escape"||h.nativeEvent.key==="Backspace"&&n.query.text.length===0)&&r(null)};return Tr.createElement(Fs.View,{style:i&&s.paletteInputWrapperWithBottomBorder},Tr.createElement(Fs.View,{style:[w.directionRow,w.alignCenter]},n.parent&&a==="right"?Tr.createElement(Fs.View,{style:[g.Padding.smallLeft]},Tr.createElement(v.ChevronLeft,{size:M.ICON_M,style:u.textMuted})):null,Tr.createElement(Fs.View,{style:[w.flex1,w.directionRow,w.alignCenter,s.paletteInput,g.Margin.small]},Tr.createElement(Fs.View,{style:[w.flex1]},Tr.createElement(Fs.TextInput,{ref:e,value:d,placeholder:n.search,placeholderTextColor:l.colors.text.muted,onChangeText:f,onKeyPress:m,style:[u.Caption,u.text,g.Padding.mediumHorizontal,g.Padding.smallVertical]})),Tr.createElement(J.View,{mobileStyle:"visible",desktopStyle:"hidden",style:[g.Margin.smallHorizontal]},Tr.createElement(W,{icon:v.X,size:"large",onPress:()=>r(null)}))),n.parent&&a==="left"?Tr.createElement(Fs.View,{style:[g.Padding.smallRight]},Tr.createElement(v.ChevronRight,{size:M.ICON_M,style:u.textMuted})):null))}),G8=F.create({paletteInputWrapperWithBottomBorder:(t,o)=>({borderBottomColor:o.color==="light"?t.colors.border.mid:t.colors.sidebar.itemBorder,borderBottomWidth:1}),paletteInput:t=>({backgroundColor:t.colors.background.muted,borderRadius:t.radiuses.large})});c();var bd=b(x());function eP(t){let[o,e]=bd.useState(!1),n=nm(()=>new WeakMap),r=bd.useRef(null);return bd.useMemo(()=>{let i=[],a=[],s;t.groups.forEach(d=>{let p;try{p=H8(t,d)}catch(f){s=f;return}if(p instanceof Promise){let f=n.current.get(d);f&&i.push(f),a.push(p)}else p&&(n.current.set(d,p),i.push(p))});let l=i.filter(d=>d.data.length>0).sort((d,p)=>d.priority>p.priority?-1:d.priority(d.push(...p.data),d),[]);if(a.length>0){e(!0);let d=r.current=Promise.all(a);d.then(()=>{d===r.current&&(e(!1),r.current=null)}).catch(p=>Au(new Error(p)))}return{listId:Date.now(),items:u,sections:l,areMoreLoading:o,error:s}},[t.groups,t.query,o,n])}function H8(t,o){try{let e=typeof o.commands=="function"?o.commands(t):o.commands,n=typeof o.commands!="function"||o.commands.length===0,r=o.priority||5;if(n){let i=K8(t.query.text,e);r=i.reduce((a,s)=>typeof s.score<"u"?Math.max((1-s.score)*10,a):a,r),e=i.map(a=>a.item)}return{group:o,priority:r,data:e}}catch(e){if(e instanceof Promise)return e;throw e}}function K8(t,o){return t?new td(o,{threshold:.3,location:0,distance:100,shouldSort:!0,includeScore:!0,minMatchCharLength:1,isCaseSensitive:!1,keys:["title","keywords"]}).search(t):o.map(n=>({item:n,score:void 0}))}c();var iS=b(ug()),ty=b(x());var nS=204,Jh=246,rS=384,X8=630,Qh=180,ey=355;function tP(t,o,e){let n=ty.useMemo(()=>Y8(o,e),[o.position,!!o.parent,e]),r=ty.useCallback(l=>U8(l,o.position),[o.position]),[i,a,s]=w1(t,r,n);return[i,a,s]}function U8(t,o){let e,n=o?.width||"medium";switch(n){case"small":e={width:nS,maxWidth:nS,minWidth:nS,minHeight:0,height:Qh,maxHeight:ey};break;case"medium":e={width:Jh,maxWidth:Jh,minWidth:Jh,minHeight:0,height:Qh,maxHeight:ey};break;case"large":e={width:rS,maxWidth:rS,minWidth:rS,minHeight:0,height:Qh,maxHeight:ey};break;case"anchor":let r=Math.max(Jh,t.width),i=(0,iS.default)(t.width,r,X8);e={width:(0,iS.default)(t.width,r,i),maxWidth:i,minWidth:r,minHeight:0,height:Qh,maxHeight:ey};break;default:Oe(n)}return e}function Y8(t,o){let e={cover:t.position?.cover,spacingWithAnchor:g.small};return t.parent?(e.offset={top:-g.small},e.spacingWithAnchor=g.medium,e.allowedPlacements=o==="left"?["left","right"]:["right","left"]):t.position?.width==="anchor"&&(e.allowedPlacements=["bottom","top"]),e}var j8=J.createResponsiveComponent(Ir);function nP(t){let{paletteState:{palette:o},setPaletteState:e}=t,n=Xt.useRef(null),r=()=>e(null),i=R1({mount:N.animations.fadeIn,unmount:N.animations.fadeOut});yc({opened:!0,closeOnEsc:!sm(o),closeOnClick:!1,closeOnOutsideClick:!1,closeOnScroll:!1,onClose:r},n),b1();let a=Xt.useRef(null);return l1({ref:a,onInteractOutside:r}),Xt.createElement(Tn,{ref:n},Xt.createElement(j,{ref:i,style:[N.position.fixed,N.floating.backdrop]},Xt.createElement(j,{ref:a},Xt.createElement(rP,{...t,setTopPaletteState:e}))))}function rP(t){let{paletteState:{palette:o,anchorRef:e},setPaletteState:n,setTopPaletteState:r,parentPlacement:i}=t,[a,s]=tP(e,o,i),l=Rl(Wa.slideToL[s]);return Xt.createElement(Xt.Fragment,null,Xt.createElement($8,{ref:l,palette:o,setPalette:p=>{n(f=>{if(!f)return null;let m=typeof p=="function"?p(f.palette):p;return m?{...f,palette:m}:null})},setTopPalette:p=>{r(f=>{if(!f)return null;let m=typeof p=="function"?p(f.palette):p;return m?{...f,palette:m}:null})},positionStyle:a,placement:s}),o.descendant?Xt.createElement(rP,{paletteState:o.descendant,setTopPaletteState:r,setPaletteState:p=>{n(f=>f?{...f,palette:{...f.palette,descendant:(typeof p=="function"?p(f.palette.descendant||null):p)||void 0}}:null)},parentPlacement:s}):null)}var $8=Xt.forwardRef(function(o,e){let{palette:n,setPalette:r,setTopPalette:i,positionStyle:a,placement:s}=o,l=Xt.useRef(null),[u,d]=_(Z8),p=eP(n),f=!n.descendant;return Xt.useEffect(()=>{if(n.descendant)return;let m=l.current;m&&(document.activeElement===m||(m.select(),m.focus()))},[n]),Xt.createElement(oP.TouchableWithoutFeedback,{onPress:m=>m.preventDefault()},Xt.createElement(j8,{ref:e,backgroundColor:u.colors.background.main,style:[d.palette],mobileStyle:d.paletteMobile,desktopStyle:[d.paletteInline,a],onStartShouldSetResponder:()=>!0},sm(n)?Xt.createElement(QI,{ref:l,palette:n,setPalette:r,withItems:p.items.length>0,placement:s}):null,p.error?Xt.createElement(JI,{error:p.error}):Xt.createElement(ZI,{computed:p,palette:n,withKeyboardInteractions:f,setPalette:r,setTopPalette:i})))}),Z8=F.create({palette:t=>({borderRadius:t.radiuses.xlarge,borderColor:t.colors.border.main,borderWidth:1,overflow:"hidden",...t.shadows.pop}),paletteMobile:{position:"absolute",marginTop:0,top:g.small,left:g.small,right:g.small,maxHeight:440,width:"auto",maxWidth:"100%",minWidth:"auto"},paletteInline:{position:"absolute"}});function iP(t){let[o,e]=or(e_);return aS.createElement(_1,null,o?aS.createElement(nP,{paletteState:o,setPaletteState:e}):null)}c();var aP=b(x());c();var J8=new td(ch,{shouldSort:!0,threshold:.4,distance:100,keys:[{name:"name",weight:.7},{name:"keywords",weight:.3}]});function oy(t){return J8.search(t).map(o=>o.item)}var Q8=[Il["1f44d"],Il["1f389"],Il["1f604"],Il["1f602"],Il["1f44f"],Il["1f44e"]];function wd(t,o={}){let{withSearch:e=!0,max:n=5}=o;return ae({search:e?"Select an emoji\u2026":void 0,groups:[{key:"emojis",commands:r=>(r.query.text?oy(r.query.text):Q8).slice(0,n).map(a=>({key:a.code,title:a.shortname,icon:s=>aP.createElement(Lo,{...s,code:a.code}),trigger:()=>t(a.code)}))}]})}c();var Lc=b(x()),Vs=b(z());var qs=Lc.forwardRef(function(o,e){let{displayMode:n="inline",value:r,style:i,placeholder:a,readOnly:s,onChangeText:l,...u}=o,[d]=_(),p=!s&&l,f=Lc.useMemo(()=>p&&n==="inline"?th(r||a||"",Vs.StyleSheet.flatten([i])):0,[n,r,a,i,p]);if(!p){let m=Lc.createElement(Vs.Text,{style:[i],selectable:!0},r);return n==="inline"?m:Lc.createElement(Vs.View,{style:sP.inputModeBlock},m)}return Lc.createElement(Vs.TextInput,{ref:e,placeholderTextColor:d.colors.text.muted,...u,value:r,onChangeText:l,placeholder:a,style:[i,n==="inline"?{width:f}:sP.inputModeBlock]})}),sP=Vs.StyleSheet.create({inputModeBlock:{width:"100%"}});c();var ny=b(x()),cP=b(z()),sS=ny.default.forwardRef(function(o,e){let{style:n,...r}=o,[i,a]=ny.default.useState(void 0);return ny.default.createElement(cP.TextInput,{ref:e,...r,multiline:!0,style:[n,typeof i<"u"?{height:i}:void 0],onContentSizeChange:l=>{l.nativeEvent.contentSize.height!==i&&a(l.nativeEvent.contentSize.height)}})});c();var ry=[{key:"blue",color:Z.primary.base,title:"Blue"},{key:"purple",color:Z.violet.base,title:"Purple"},{key:"orange",color:Z.orange.base,title:"Orange"},{key:"red",color:Z.scarlet.base,title:"Red"},{key:"yellow",color:Z.YELLOW,title:"Yellow"},{key:"green",color:Z.green.base,title:"Green"}],iy=[{key:"blue",color:Z.primary.xlight,title:"Blue"},{key:"purple",color:Z.violet.xlight,title:"Purple"},{key:"orange",color:Z.orange.xlight,title:"Orange"},{key:"red",color:Z.scarlet.xlight,title:"Red"},{key:"yellow",color:Z.YELLOW_XXLIGHT,title:"Yellow"},{key:"green",color:Z.green.xlight,title:"Green"}],Uce=[Z.primary.light,Z.violet.light,Z.fuchsia.light,Z.scarlet.light,Z.orange.light,Z.green.light];c();var He=b(x()),Oi=b(z());c();var mP=9,lS=ch.reduce((t,o)=>{let e=t.find(r=>r.key===o.category);if(!e)return console.warn("Unknown emoji category","emoji"),t;(!e.data.length||e.data[e.data.length-1].emojis.length===mP)&&e.data.push({key:"",emojis:[]});let n=e.data[e.data.length-1];return n.key+=o.code,n.emojis.push(o),t},[{key:"people",title:"People",Icon:v.EmojiReaction,data:[]},{key:"nature",title:"Nature",Icon:v.RoleEditor,data:[]},{key:"food",title:"Food",Icon:v.Food,data:[]},{key:"activity",title:"Activity",Icon:v.Music,data:[]},{key:"travel",title:"Travel",Icon:v.EmojiBike,data:[]},{key:"objects",title:"Objects",Icon:v.EmojiWatch,data:[]},{key:"symbols",title:"Symbols",Icon:v.HeartOutlined,data:[]},{key:"flags",title:"Flags",Icon:v.EmojiFlag,data:[]}]);function fP(t){let o=oy(t);return{key:"search",title:"Results",data:l3(o,mP),Icon:v.Search}}function l3(t,o){let e=t.length;if(e===0)return[];let n=Math.ceil(e/o);return Array.from({length:n},(r,i)=>{let a=i*o,s=t.slice(a,a+o);return{key:s.map(l=>l.code).join("-"),emojis:s}})}function sy(t){let{onPick:o,onRemove:e}=t,[n,r]=He.useState(""),[i,a]=He.useState(""),s=He.useRef(null);He.useEffect(()=>{let u=requestAnimationFrame(()=>{s.current&&s.current.focus()});return()=>{cancelAnimationFrame(u)}},[s]);let l=u=>{r(u),a(u)};return He.createElement(Oi.View,{style:Sm.emojiPicker},He.createElement(Oi.View,{style:[Sm.emojiPickerSearch,w.directionRow]},He.createElement(oo,{kind:"search",size:"medium",ref:s,icon:v.Search,placeholder:"Search",value:n,onChangeText:l,cleareable:!0,style:w.flex1}),e?He.createElement(W,{icon:v.Trashcan,onPress:e,title:"Remove Emoji",size:"medium",kind:"secondary",style:g.Margin.smallLeft}):null),He.createElement(p3,{query:i,onPick:o}))}var u3=Zh({getItemHeight:()=>ay,getSectionHeaderHeight:()=>gP,stickySectionHeadersEnabled:!0}),d3=({section:t})=>He.createElement(m3,{category:t}),p3=He.memo(function(o){let{query:e,onPick:n}=o,r=He.useRef(null),i=e?[fP(e)]:lS,a=l=>{r.current&&r.current.scrollToLocation({sectionIndex:l,itemIndex:0})},s=He.useCallback(({item:l})=>He.createElement(f3,{row:l,onPick:n}),[n]);return He.createElement(He.Fragment,null,!e&&He.createElement(Oi.View,{style:Sm.emojiPickerCategories},lS.map((l,u)=>He.createElement(W,{key:l.key,icon:l.Icon,onPress:()=>{a(u)}}))),He.createElement(Oi.SectionList,{ref:r,sections:i,stickySectionHeadersEnabled:!0,renderItem:s,renderSectionHeader:d3,getItemLayout:u3}))}),m3=He.memo(function(o){let{category:e}=o,[,n]=_(hP),[,r]=_(D);return He.createElement(Oi.View,{style:[n.emojiCategoryHeader]},He.createElement(Oi.Text,{style:[r.GroupTitle,r.text]},e.title))},(t,o)=>t.category.title===o.category.title),f3=He.memo(function(o){let{row:e,onPick:n}=o;return He.createElement(Oi.View,{style:Sm.emojiRow},e.emojis.map(r=>He.createElement(g3,{key:r.code,code:r.code,onPick:n})))},(t,o)=>t.row.key===o.row.key&&t.onPick===o.onPick),g3=He.memo(function(o){let{code:e,onPick:n}=o,[,r]=_(hP);return He.createElement(V.TouchableOpacity,{onPress:()=>n(e),style:[Sm.emojiItem],activeStyle:r.emojiItemHovered},He.createElement(Lo,{code:e,size:24}))}),ay=40,gP=26,hP=F.create({emojiCategoryHeader:t=>({height:gP,backgroundColor:t.colors.background.main,paddingLeft:g.medium,paddingRight:g.medium,paddingTop:g.small,paddingBottom:g.small}),emojiItemHovered:t=>({backgroundColor:t.colors.itemHover})}),Sm=Oi.StyleSheet.create({emojiPicker:{display:"flex",width:376,height:314},emojiPickerSearch:{padding:g.small},emojiPickerCategories:{display:"flex",flexDirection:"row",justifyContent:"space-between",padding:g.small,paddingBottom:0,paddingTop:0},emojiRow:{display:"flex",flexDirection:"row",paddingLeft:g.small,paddingRight:g.small},emojiItem:{width:ay,height:ay,borderRadius:ay,display:"flex",alignItems:"center",justifyContent:"center",outlineStyle:"none"}});c();var Cm=b(x());c();var Gs=JSON.parse('{"container":"container_UPXwU","darkestParentBackground":"darkestParentBackground_8TVPV","darkParentBackground":"darkParentBackground_ziFwB","semiDarkParentBackground":"semiDarkParentBackground_wgu6B","mediumParentBackground":"mediumParentBackground_BIBSL","semiLightParentBackground":"semiLightParentBackground_Yx9Vw","lightParentBackground":"lightParentBackground_INb4a","lightestParentBackground":"lightestParentBackground_FL4je","toggle":"toggle_siihR","toggleLightMode":"toggleLightMode_-FLG4","toggleDarkMode":"toggleDarkMode_uS4t3","toggleSwitch":"toggleSwitch_NtUzX","toggleButton":"toggleButton_ePBfn","toggleIcon":"toggleIcon_-vIfn"}');function yP(t){let{onValueChange:o,value:e=!1,backgroundColor:n,mode:r="switch",accesibilityLabel:i="Switch to dark mode"}=t,a=()=>{o()},s=r==="switch"?e?v.ThemeDark.CSS:v.ThemeLight.CSS:e?v.ThemeLight.CSS:v.ThemeDark.CSS,l=Gh(n);return r==="switch"?Cm.default.createElement(j,{as:"button",type:"button",role:"switch","aria-label":i,"aria-checked":e,onClick:a,style:[Gs.container,Gs[`${l}ParentBackground`]]},Cm.default.createElement(j,{style:[Gs.toggle,Gs.toggleSwitch,N.backgroundColor.main,N.margin.xsmall,e?Gs.toggleDarkMode:Gs.toggleLightMode]},Cm.default.createElement(s,{style:[Gs.toggleIcon,N.padding.xsmall]}))):Cm.default.createElement(bt,{label:i,role:"switch",iconOnly:!0,leadingIcon:s,rounded:!0,style:Gs.toggleButton,kind:"muted",onClick:a,"aria-checked":e,"aria-label":i,preventFocusOnPress:!0})}c();c();c();function km(t,o,e){return o in t?Object.defineProperty(t,o,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[o]=e,t}var Ct=b(x(),1);function h3(t){if(c1()==="virtual"){let o=document.activeElement;a1(()=>{document.activeElement===o&&document.contains(t)&&Iw(t)})}else Iw(t)}function y3(t){if(!(t instanceof HTMLElement)&&!(t instanceof SVGElement))return!1;let{display:o,visibility:e}=t.style,n=o!=="none"&&e!=="hidden"&&e!=="collapse";if(n){let{getComputedStyle:r}=t.ownerDocument.defaultView,{display:i,visibility:a}=r(t);n=i!=="none"&&a!=="hidden"&&a!=="collapse"}return n}function v3(t,o){return!t.hasAttribute("hidden")&&(t.nodeName==="DETAILS"&&o&&o.nodeName!=="SUMMARY"?t.hasAttribute("open"):!0)}function vP(t,o){return t.nodeName!=="#comment"&&y3(t)&&v3(t,o)&&(!t.parentElement||vP(t.parentElement,t))}var uS=Ct.default.createContext(null),Wt=null;function bP(t){let{children:o,contain:e,restoreFocus:n,autoFocus:r}=t,i=(0,Ct.useRef)(),a=(0,Ct.useRef)(),s=(0,Ct.useRef)([]),{parentNode:l}=(0,Ct.useContext)(uS)||{},u=(0,Ct.useMemo)(()=>new Om({scopeRef:s}),[s]);hc(()=>{let f=l||no.root;if(no.getTreeNode(f.scopeRef)&&Wt&&!ly(Wt,f.scopeRef)){let m=no.getTreeNode(Wt);m&&(f=m)}f.addChild(u),no.addNode(u)},[u,l]),hc(()=>{let f=no.getTreeNode(s);f.contain=e},[e]),hc(()=>{let f=i.current.nextSibling,m=[];for(;f&&f!==a.current;)m.push(f),f=f.nextSibling;s.current=m},[o]),x3(s,n,e),C3(s,e),_3(s,n,e),k3(s,r),(0,Ct.useEffect)(()=>{if(s){let f=document.activeElement,m=null;if(An(f,s.current)){for(let h of no.traverse())An(f,h.scopeRef.current)&&(m=h);m===no.getTreeNode(s)&&(Wt=m.scopeRef)}return()=>{let h=no.getTreeNode(s).parent.scopeRef;(s===Wt||ly(s,Wt))&&(!h||no.getTreeNode(h))&&(Wt=h),no.removeTreeNode(s)}}},[s]);let d=(0,Ct.useMemo)(()=>b3(s),[]),p=(0,Ct.useMemo)(()=>({focusManager:d,parentNode:u}),[u,d]);return Ct.default.createElement(uS.Provider,{value:p},Ct.default.createElement("span",{"data-focus-scope-start":!0,hidden:!0,ref:i}),o,Ct.default.createElement("span",{"data-focus-scope-end":!0,hidden:!0,ref:a}))}function wP(){var t;return(t=(0,Ct.useContext)(uS))===null||t===void 0?void 0:t.focusManager}function b3(t){return{focusNext(o={}){let e=t.current,{from:n,tabbable:r,wrap:i,accept:a}=o,s=n||document.activeElement,l=e[0].previousElementSibling,u=Nc(Wl(e),{tabbable:r,accept:a},e);u.currentNode=An(s,e)?s:l;let d=u.nextNode();return!d&&i&&(u.currentNode=l,d=u.nextNode()),d&&Hs(d,!0),d},focusPrevious(o={}){let e=t.current,{from:n,tabbable:r,wrap:i,accept:a}=o,s=n||document.activeElement,l=e[e.length-1].nextElementSibling,u=Nc(Wl(e),{tabbable:r,accept:a},e);u.currentNode=An(s,e)?s:l;let d=u.previousNode();return!d&&i&&(u.currentNode=l,d=u.previousNode()),d&&Hs(d,!0),d},focusFirst(o={}){let e=t.current,{tabbable:n,accept:r}=o,i=Nc(Wl(e),{tabbable:n,accept:r},e);i.currentNode=e[0].previousElementSibling;let a=i.nextNode();return a&&Hs(a,!0),a},focusLast(o={}){let e=t.current,{tabbable:n,accept:r}=o,i=Nc(Wl(e),{tabbable:n,accept:r},e);i.currentNode=e[e.length-1].nextElementSibling;let a=i.previousNode();return a&&Hs(a,!0),a}}}var pS=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[contenteditable]"],w3=pS.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";pS.push('[tabindex]:not([tabindex="-1"]):not([disabled])');var S3=pS.join(':not([hidden]):not([tabindex="-1"]),');function Wl(t){return t[0].parentElement}function cy(t){let o=no.getTreeNode(Wt);for(;o&&o.scopeRef!==t;){if(o.contain)return!1;o=o.parent}return!0}function C3(t,o){let e=(0,Ct.useRef)(),n=(0,Ct.useRef)(null);hc(()=>{let r=t.current;if(!o){n.current&&(cancelAnimationFrame(n.current),n.current=null);return}let i=l=>{if(l.key!=="Tab"||l.altKey||l.ctrlKey||l.metaKey||!cy(t))return;let u=document.activeElement,d=t.current;if(!An(u,d))return;let p=Nc(Wl(d),{tabbable:!0},d);p.currentNode=u;let f=l.shiftKey?p.previousNode():p.nextNode();f||(p.currentNode=l.shiftKey?d[d.length-1].nextElementSibling:d[0].previousElementSibling,f=l.shiftKey?p.previousNode():p.nextNode()),l.preventDefault(),f&&Hs(f,!0)},a=l=>{(!Wt||ly(Wt,t))&&An(l.target,t.current)?(Wt=t,e.current=l.target):cy(t)&&!dS(l.target,t)?e.current?e.current.focus():Wt&&uy(Wt.current):cy(t)&&(e.current=l.target)},s=l=>{n.current&&cancelAnimationFrame(n.current),n.current=requestAnimationFrame(()=>{cy(t)&&!dS(document.activeElement,t)&&(Wt=t,document.body.contains(l.target)?(e.current=l.target,e.current.focus()):Wt&&uy(Wt.current))})};return document.addEventListener("keydown",i,!1),document.addEventListener("focusin",a,!1),r.forEach(l=>l.addEventListener("focusin",a,!1)),r.forEach(l=>l.addEventListener("focusout",s,!1)),()=>{document.removeEventListener("keydown",i,!1),document.removeEventListener("focusin",a,!1),r.forEach(l=>l.removeEventListener("focusin",a,!1)),r.forEach(l=>l.removeEventListener("focusout",s,!1))}},[t,o]),(0,Ct.useEffect)(()=>()=>{n.current&&cancelAnimationFrame(n.current)},[n])}function SP(t){return dS(t)}function An(t,o){return o.some(e=>e.contains(t))}function dS(t,o=null){if(t instanceof Element&&t.closest("[data-react-aria-top-layer]"))return!0;for(let{scopeRef:e}of no.traverse(no.getTreeNode(o)))if(An(t,e.current))return!0;return!1}function ly(t,o){var e;let n=(e=no.getTreeNode(o))===null||e===void 0?void 0:e.parent;for(;n;){if(n.scopeRef===t)return!0;n=n.parent}return!1}function Hs(t,o=!1){if(t!=null&&!o)try{h3(t)}catch{}else if(t!=null)try{t.focus()}catch{}}function uy(t,o=!0){let e=t[0].previousElementSibling,n=Nc(Wl(t),{tabbable:o},t);n.currentNode=e;let r=n.nextNode();o&&!r&&(n=Nc(Wl(t),{tabbable:!1},t),n.currentNode=e,r=n.nextNode()),Hs(r)}function k3(t,o){let e=Ct.default.useRef(o);(0,Ct.useEffect)(()=>{e.current&&(Wt=t,An(document.activeElement,Wt.current)||uy(t.current)),e.current=!1},[t])}function x3(t,o,e){hc(()=>{if(o||e)return;let n=t.current,r=i=>{let a=i.target;An(a,t.current)?Wt=t:SP(a)||(Wt=null)};return document.addEventListener("focusin",r,!1),n.forEach(i=>i.addEventListener("focusin",r,!1)),()=>{document.removeEventListener("focusin",r,!1),n.forEach(i=>i.removeEventListener("focusin",r,!1))}},[t,o,e])}function O3(t){let o=no.getTreeNode(Wt);for(;o&&o.scopeRef!==t;){if(o.nodeToRestore)return!1;o=o.parent}return o?.scopeRef===t}function _3(t,o,e){let n=(0,Ct.useRef)(typeof document<"u"?document.activeElement:null);hc(()=>{let r=t.current;if(!o||e)return;let i=()=>{(!Wt||ly(Wt,t))&&An(document.activeElement,t.current)&&(Wt=t)};return document.addEventListener("focusin",i,!1),r.forEach(a=>a.addEventListener("focusin",i,!1)),()=>{document.removeEventListener("focusin",i,!1),r.forEach(a=>a.removeEventListener("focusin",i,!1))}},[t,e]),hc(()=>{if(!o)return;no.getTreeNode(t).nodeToRestore=n.current;let r=i=>{if(i.key!=="Tab"||i.altKey||i.ctrlKey||i.metaKey)return;let a=document.activeElement;if(!An(a,t.current))return;let s=no.getTreeNode(t).nodeToRestore,l=Nc(document.body,{tabbable:!0});l.currentNode=a;let u=i.shiftKey?l.previousNode():l.nextNode();if((!document.body.contains(s)||s===document.body)&&(s=null,no.getTreeNode(t).nodeToRestore=null),(!u||!An(u,t.current))&&s){l.currentNode=s;do u=i.shiftKey?l.previousNode():l.nextNode();while(An(u,t.current));i.preventDefault(),i.stopPropagation(),u?Hs(u,!0):SP(s)?Hs(s,!0):a.blur()}};return e||document.addEventListener("keydown",r,!0),()=>{e||document.removeEventListener("keydown",r,!0);let i=no.getTreeNode(t).nodeToRestore;if(o&&i&&(An(document.activeElement,t.current)||document.activeElement===document.body&&O3(t))){let a=no.clone();requestAnimationFrame(()=>{if(document.activeElement===document.body){let s=a.getTreeNode(t);for(;s;){if(s.nodeToRestore&&document.body.contains(s.nodeToRestore)){Hs(s.nodeToRestore);return}s=s.parent}for(s=a.getTreeNode(t);s;){if(s.scopeRef&&no.getTreeNode(s.scopeRef)){uy(s.scopeRef.current,!0);return}s=s.parent}}})}}},[t,o,e])}function Nc(t,o,e){let n=o?.tabbable?S3:w3,r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode(i){var a;return!(o==null||(a=o.from)===null||a===void 0)&&a.contains(i)?NodeFilter.FILTER_REJECT:i.matches(n)&&vP(i)&&(!e||An(i,e))&&(!o?.accept||o.accept(i))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return o?.from&&(r.currentNode=o.from),r}var xm=class{get size(){return this.fastMap.size}getTreeNode(o){return this.fastMap.get(o)}addTreeNode(o,e,n){let r=this.fastMap.get(e??null),i=new Om({scopeRef:o});r.addChild(i),i.parent=r,this.fastMap.set(o,i),n&&(i.nodeToRestore=n)}addNode(o){this.fastMap.set(o.scopeRef,o)}removeTreeNode(o){if(o===null)return;let e=this.fastMap.get(o),n=e.parent;for(let i of this.traverse())i!==e&&e.nodeToRestore&&i.nodeToRestore&&e.scopeRef.current&&An(i.nodeToRestore,e.scopeRef.current)&&(i.nodeToRestore=e.nodeToRestore);let r=e.children;n.removeChild(e),r.size>0&&r.forEach(i=>n.addChild(i)),this.fastMap.delete(e.scopeRef)}*traverse(o=this.root){if(o.scopeRef!=null&&(yield o),o.children.size>0)for(let e of o.children)yield*this.traverse(e)}clone(){let o=new xm;for(let e of this.traverse())o.addTreeNode(e.scopeRef,e.parent.scopeRef,e.nodeToRestore);return o}constructor(){km(this,"fastMap",new Map),this.root=new Om({scopeRef:null}),this.fastMap.set(null,this.root)}},Om=class{addChild(o){this.children.add(o),o.parent=this}removeChild(o){this.children.delete(o),o.parent=void 0}constructor(o){km(this,"children",new Set),km(this,"contain",!1),this.scopeRef=o.scopeRef}},no=new xm;var _i=b(x());c();var mS=JSON.parse('{"toolbar":"toolbar_hJES6","toolbarGroup":"toolbarGroup_mD69e"}');var CP=_i.default.forwardRef(function(o,e){let{disabled:n=!1,orientation:r="horizontal",children:i,onTabToExit:a}=o;return _i.default.createElement(j,{role:"toolbar",style:mS.toolbar,ref:e,"aria-orientation":r},_i.default.createElement(bP,{restoreFocus:!0},_i.default.createElement(R3,{disabled:n,orientation:r,onTabToExit:a},i)))});function R3(t){let{children:o,disabled:e,orientation:n,onTabToExit:r}=t,i=wP();return _i.default.createElement(_i.default.Fragment,null,_i.default.Children.map(o,a=>a?typeof a=="object"?_i.default.cloneElement(a,{onKeyDown(s){({ArrowLeft:()=>{n==="horizontal"&&(i.focusPrevious(),s.preventDefault())},ArrowRight:()=>{n==="horizontal"&&(i.focusNext(),s.preventDefault())},ArrowUp:()=>{n==="vertical"&&(i.focusPrevious(),s.preventDefault())},ArrowDown:()=>{n==="vertical"&&(i.focusNext(),s.preventDefault())},Home:()=>{i.focusFirst(),s.preventDefault()},End:()=>{i.focusLast(),s.preventDefault()},Tab:()=>{r?.(s.shiftKey),s.preventDefault()}})[s.key]?.()},kind:a.props?.kind??"menuitem",disabled:a.props?.disabled||e}):a:null))}function _m(t){let{onKeyDown:o,label:e,disabled:n=!1,children:r}=t;return _i.default.createElement(j,{role:"group",as:"span",style:mS.toolbarGroup,"aria-label":e},_i.default.Children.map(r,i=>i?_i.default.cloneElement(i,{onKeyDown:o,kind:i.props.kind??"menuitem",disabled:i.props.disabled||n}):null))}c();var Sd=b(x());function kP(t){let{children:o,...e}=t;return Sd.createElement(h1,null,Sd.createElement(T1,null,Sd.createElement(k1,null,Sd.createElement(iP,{...e}),Sd.createElement(YI,null),o)))}c();var Rm=b(x());c();var fS=JSON.parse('{"grabber":"grabber_p72PX","grabberIcon":"grabberIcon_ebrbU"}');var xP=Rm.forwardRef(function(o,e){let{style:n,size:r="small"}=o;return Rm.createElement(j,{ref:e,style:[n,fS.grabber]},Rm.createElement(v.GrabberVertical.CSS,{style:[fS.grabberIcon,N.icons[r]]}))});c();var gS=1024,OP=gS*1024;function Im(t){return t>OP?`${(t/OP).toFixed(0)}MB`:t>gS?`${(t/gS).toFixed(0)}KB`:`${t}B`}function _P(t){return fc(t)?"Image":Xu(t)?"Code":t.contentType==="application/pdf"?"PDF":t.contentType.startsWith("text/")?"Text":"Binary"}c();var dy=b(x());function IP(t){let o=(0,dy.useContext)($o);I3(o,t),nm(()=>PP(o,t));let e=nm(()=>RP(o,t));(0,dy.useEffect)(()=>(e.current=RP(o,t),()=>{e.current&&window.gtag("config",e.current,{update:!0,groups:"not_tracking_views"})}),[t?.googleAnalytics?.enabled,t?.googleAnalytics?.trackingPrivateViews,t?.googleAnalytics?.trackingID,o])}function hS(t){return!!(t.googleAnalytics?.enabled&&typeof t.googleAnalytics.trackingID=="string")}function I3(t,o){ta(e=>{yS(t,o)||e.writeSafe({type:"script",src:`https://www.googletagmanager.com/gtag/js?l=dataLayer&id=${o?.googleAnalytics?.trackingID}`})})}function PP(t,o){yS(t,o)||typeof window>"u"||window?.gtag||(window.dataLayer=window.dataLayer||[],window.gtag=function(...e){window.dataLayer.push(arguments)},window.gtag("js",new Date),window.gtag("config",o.googleAnalytics.trackingID))}function RP(t,o){if(yS(t,o)||typeof window>"u")return;window?.gtag||PP(t,o),window.gtag("config",o.googleAnalytics.trackingID,{send_page_view:!1,anonymize_ip:!0,groups:"tracking_views"});let e=Wg()==="rejected";return window.gtag("consent","default",{ad_storage:e?"denied":"granted",analytics_storage:e?"denied":"granted"}),o?.googleAnalytics?.trackingID}function yS(t,o){return!o||!o.googleAnalytics||!hS(o)||t.preview||t.mode!=="public-content"&&!o?.googleAnalytics?.trackingPrivateViews}c();c();c();function Ks(){return Ks=Object.assign?Object.assign.bind():function(t){for(var o=1;o=0&&(o.hash=t.substr(e),t=t.substr(0,e));var n=t.indexOf("?");n>=0&&(o.search=t.substr(n),t=t.substr(0,n)),t&&(o.pathname=t)}return o}var wS=Ze("history");function AP(){let t=NP(),o=[],e=!1,n=()=>{let i=o.shift();return i?(i(),!1):!0},r=i=>{e?o.push(i):i()};return{get location(){return t.location},listen:i=>t.listen(a=>{i({location:a.location,action:a.action})}),push:i=>{let{state:a,...s}=i;r(()=>{wS.info("push",s,a),t.push(s,a)})},replace:i=>{let{state:a,...s}=i;r(()=>{wS.info("replace",s,a),t.replace(s,a)})},go:i=>{r(()=>{wS.info("go",i),t.go(i)})},transaction:i=>{if(e)i();else{let a=t.listen(()=>{n()&&a()});e=!0,i(),e=!1,n()&&a()}}}}c();function BP(t){let{basename:o="",location:e="/",context:n}=t,r=(a,s)=>{n.action=s,n.location=T3(o,DP(a)),n.url=vS(n.location)};return{staticContext:n,location:M3(o,DP(bS(e))),push:a=>{r(a,"PUSH")},replace:a=>{r(a,"REPLACE")},go:()=>{},listen:()=>()=>{},transaction:a=>{a()}}}function WP(t){return t.charAt(0)==="/"?t:`/${t}`}function T3(t,o){return t?{...o,pathname:WP(t)+o.pathname}:o}function M3(t,o){if(!t||!o.pathname)return o;let e=WP(t);return o.pathname.indexOf(e)!==0?o:{...o,pathname:o.pathname.substr(e.length)}}function DP(t){let o={hash:"",search:"",pathname:"",...t,key:"",state:void 0};return o.search&&o.search.charAt(0)!=="?"&&(o.search=`?${o.search}`),o.hash&&o.hash.charAt(0)!=="#"&&(o.hash=`#${o.hash}`),o}c();var zl=b(x()),zP=b(E1());function SS(t){let{history:o,children:e}=t,n=zl.useMemo(()=>o||AP(),[o]),r=zl.useMemo(()=>({getCurrentValue:()=>n.location,subscribe:a=>n.listen(a)}),[n]),i=(0,zP.useSubscription)(r);return zl.createElement(m_.Provider,{value:n},zl.createElement(f_.Provider,{value:i},e))}function FP(t){let{children:o,...e}=t,n=BP(e);return zl.createElement(SS,{history:n},o)}c();var CS=b(x());function VP(t,o){let{navigate:e}=we(),n=Va(),r=VO(t),i=(0,CS.useCallback)(l=>e({screen:{sideSheet:{type:t,tab:l}}},{replace:!0}),[e,t]),a=(0,CS.useCallback)(()=>e({screen:{sideSheet:void 0}}),[e]),s=("sideSheet"in n.screen&&n.screen.sideSheet&&"tab"in n.screen.sideSheet&&n.screen.sideSheet.tab?n.screen.sideSheet.tab:o)??r[0];return{opened:"sideSheet"in n.screen&&n.screen.sideSheet?.type===t,selectedTab:s,changeSelectedTab:i,close:a}}c();var py=b(x());var qP=Ze("auth"),kS=Tx(t=>{let{customToken:o,waitUserReady:e=!0}=t;if(typeof window>"u")throw new Error("initializeAuth should not be called during SSR");return!o&&!e?{customToken:o}:new hs("auth.initialize").wrap(async()=>{if(o)try{qP.info("authenticating with custom token before subscribing to auth"),await ig.auth().signInWithCustomToken(o),await ig.auth().currentUser?.getIdToken(!0)}catch(r){qP.critical("Error during auth with custom token",r)}return e!==!1&&await new Promise((r,i)=>{let a=ig.auth().onAuthStateChanged(()=>{a(),r()},i)}),{customToken:o}})});function GP(t){return kS.readAsync(t)}function my(t){let{children:o}=t;if(typeof window<"u"){if(kS.state==="unstarted")throw new Error("initializeAuth should have been called before useWaitFirebaseAuth");kS.read({})}return py.createElement(py.Fragment,null,o)}c();var L3=At({key:"firestoreReacheable",default:!0,effects:[t=>{typeof window>"u"||fetch("https://firestore.googleapis.com/$discovery/rest").catch(()=>{t.setSelf(!1)})}]});function HP(){return tr(L3)}c();var KP=b(x());var xS=At({key:"hoveredCommentNodeAtom",default:null}),dde=Cx({key:"newCommentValueAtom",default:()=>qu("","comment")});function XP(){let t=Kr(xS);return KP.useMemo(()=>({highlight:(o,e={highlighting:!0,postButton:!0})=>{let n=o?Ji.getOriginalKey(o):null;t(r=>n?(r&&r.node===n&&r.postButton&&(e.postButton=r.postButton),{node:n,...e}):null)}}),[t])}c();var YP=b(x());var UP=At({key:"filesManagerAtom",default:null});function fy(){let t=Kr(UP),o=xx();return YP.useMemo(()=>({prompt:e=>new Promise(n=>{t({options:e,onComplete:n})}),isOpen:()=>{let{isModified:e}=o(UP);return e}}),[t])}c();var jP=b(x());var OS=At({key:"mediaGalleryState",default:{medias:[],currentIndex:0}});function kd(){let t=Kr(OS);return jP.useMemo(()=>({open:(o,e=0)=>{t({medias:o,currentIndex:e})}}),[t])}c();var Pm=At({key:"mobileToCOpenedAtom",default:!1});c();function N3(t){return t.themePreset?Z.PRIMARY:t.primaryColor??Z.PRIMARY}function A3(t,o,e){let n=Z.WHITE,r=Z.darkModeGreyScale.dark;switch(t){case"default":return o==="dark"?r:n;case"bold":return e;case"contrast":return o==="dark"?n:r;case"custom":return Z.fuchsia.light;default:Oe(t)}}function D3(t,o,e){switch(t){case"default":case"contrast":return o;case"bold":case"custom":return Ga(e)==="light"?Z.lightModeText.base:Z.darkModeText.base;default:Oe(t)}}function $P(t){return jx(t.headerTheme,t.themeMode)==="none"}function B3(t,o){let{primaryColor:e,headerBackgroundColor:n,headerLinksColor:r}=t.themeCustomizations?.[o]||{},a=$P(t)?"default":$i(t),s=N3(t),l=e??s,u=A3(a,o,l),d=n??u,p=D3(a,l,d);return{primaryColor:l,headerBackgroundColor:d,headerLinksColor:r??p}}function W3(t,o){let e=o??t.themeMode??Vp,{headerLogoURL:n,footerLogoURL:r}=t.themeCustomizations?.[e]||{};return{headerLogoURL:n??t.logoURL,footerLogoURL:r??t.footer?.logoURL}}function gy(t,o){let e=o??t.themeMode??Vp;return{...B3(t,e),...W3(t,e),headerDisabled:$P(t)}}c();var ZP=b(x());var z3=Ze("app:events"),F3=t=>(t[0]==='"'&&(t=t.slice(1,-1)),t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent));function V3(){let t=document.cookie?document.cookie.split("; "):[],o={};for(let e=0;e{q3(t,o)},[t.key,o]),null}async function q3(t,o){if(!t.integrations||!o)return;let e=await r1(),n=V3(),r=window.location.href,i=document.referrer,a=window.navigator.userAgent;(await Ms()).analytics.trackViewInSpaceById(t.key,{pageId:o,visitor:{anonymousId:e,cookies:n,userAgent:a},url:r,referrer:i})}c();function QP(t,o){let e=o.type==="space"&&typeof o.changeRequest=="string"?o.changeRequest:void 0;return E_(t,e)}c();var hy=b(x());function eE(t){let o=hy.useContext($o),e=o.preview||o.mode!=="public-content"||!t?.intercom?.enabled?void 0:t?.intercom?.appID,n=BI();return ta(r=>{n&&e&&r.writeAsync({type:"script",src:`https://widget.intercom.io/widget/${e}`,onLoad:async()=>{window.Intercom&&window.Intercom("boot",{app_id:e})}})}),hy.useEffect(()=>()=>{window.Intercom&&(window.Intercom("shutdown"),window.Intercom=void 0)},[]),null}c();var Em=b(x());var _S=Em.default.createContext(()=>({getCurrentValue:()=>[],subscribe:()=>()=>{}})),Fl=new Map;function tE(t){let{withComments:o,spaceKey:e,pageKey:n,changeRequestKey:r,children:i}=t,a={space:e,page:n,changeRequest:r||null},[s]=xc([o?Ox(FO(a),_x("resolved","==",null),Rx("postedAt","asc")):null]);Em.default.useEffect(()=>{let u=(s||[]).reduce((d,p)=>p.node?{...d,[p.node]:[...d[p.node]??[],p]}:d,{});Fl.forEach((d,p)=>{let f=u[p]??[],[m,h]=d||[[],[]];G3(f,m)||(Fl.set(p,[f,h]),h.forEach(y=>y()))})},[s]);let l=Em.default.useCallback(u=>({getCurrentValue:()=>{let d=Fl.get(u);return d?d[0]:[]},subscribe:d=>{let p=Fl.get(u),[f,m]=p||[[],[]];return Fl.set(u,[f,[...m,d]]),()=>{let h=Fl.get(u),[y,S]=h||[[],[]],C=S.filter(k=>k!==d);Fl.set(u,[y,C])}}}),[]);return Em.default.createElement(_S.Provider,{value:l},i)}function G3(t,o){return t.length!==o.length?!1:t.every(e=>{let n=o.find(r=>e.key===r.key);return n?H3(e,n):!1})}function H3(t,o){return!(t.key!==o.key||t.resolved!==o.resolved||dw(t.replies)!==dw(o.replies))}c();var Dn=b(x()),xd=b(z());c();var nE=b(x());c();var oE=JSON.parse('{"commentHalo":"commentHalo_0AauK"}');function RS(t){let{node:o}=t,{screen:e}=Va(),n=tr(xS);if(!o)return null;let r=e.type==="space"&&e.sideSheet?.type==="comments"?e.sideSheet.node:null;return(n&&n.highlighting&&n.node!==r?n.node:null)===o||r===o?nE.default.createElement(j,{style:[oE.commentHalo],as:"span",contentEditable:!1}):null}RS.displayName="BlockCommentHalo";c();var Xa=b(x()),rE=b(E1());var iE=t=>{let{nodeKey:o,visible:e,buttonSize:n,style:r,shortcutsActive:i}=t,a=Xa.useContext(_S),{navigate:s}=we(),l=Xa.useMemo(()=>a(o),[o]),u=(0,rE.useSubscription)(l),d=Xa.useMemo(()=>(u??[]).reduce((S,C)=>{let k=Object.values(C.replies).reduce((O,R)=>O+R.count,0);return 1+S+k},0),[u]),p=d>0,f=u?.[0],m=()=>{f&&s({screen:{type:"space",space:f.space,sideSheet:{type:"comments",node:f.node??void 0,comment:f.key}}})},h=()=>{s({screen:{sideSheet:{type:"comments",node:o,context:"post",comment:void 0}}})},y=()=>p&&f?m():h();return Jr(i?{[qe.EDITOR_COMMENT]:y}:{},["editor-selection-collapsed","editor-selection-expanded"],[i,f]),Xa.createElement(ge,{editable:!1,style:[e||p?je.visible:je.hidden,r],"data-hide-on-drag":!0},Xa.createElement(A1,{kind:"secondary",size:"small"},Xa.createElement(bt,{leadingIcon:v.Comment.CSS,tooltipTitle:p?`${d} Comment${d>1?"s":""}`:"Comment",onPress:y,size:n,iconOnly:!p,label:p?`${d}`:"Comment"}),p?Xa.createElement(bt,{leadingIcon:v.Plus.CSS,size:n,tooltipTitle:"Leave another comment",label:"Leave another comment",iconOnly:!0,onPress:h}):null))};var Jo={};ED(Jo,{COMMENTS_COLUMN_EXPANDED_WIDTH:()=>vy,MAX_PAGE_OUTLINE_WIDTH:()=>Ac,PAGE_BODY_DESKTOP_H_PADDING:()=>zt,PAGE_BODY_DESKTOP_WIDTH:()=>yy,PAGE_BODY_MAX_WIDTH:()=>Mr,PAGE_BODY_MOBILE_H_PADDING:()=>Zo,PAGE_OUTLINE_WIDTH:()=>ES,PUBLIC_DESKTOP_HEADER_HEIGHT:()=>TS,PUBLIC_MOBILE_HEADER_HEIGHT:()=>K3,SPACE_HEADER_HEIGHT:()=>IS,TOC_DESKTOP_WIDTH:()=>PS,columnsWidthThreadhold:()=>Tm,getPageOutlineWrapperWidth:()=>MS,getToCWrapperDesktopWidth:()=>aE,pageSwitchThreadhold:()=>Dc});c();var IS=M.L,Mr=750,zt=110,Zo=g.medium,yy=Mr+2*zt,PS=300,vy=300,ES=220,Ac=300,TS=M.XL,K3=M.L;function Tm(t,o=0){let e=o+PS+yy+ES;return t===2||(e+=vy-Zo),e}function Dc(t=0){return t+yy}function aE(t){let o=`(100vw - ${yy}px) / 2 - ${t||0}px`;return`max(${PS}px, calc(${o}))`}function MS(t,o){let e=`100vw - ${aE(t)} - ${Mr}px - ${zt}px - ${typeof o>"u"?zt:o||0}px - ${t||0}px`;return`max(${ES}px, calc(${e}))`}function X3(t){let{children:o,renderMode:e,isDiffViewEnabled:n,isFullPage:r,isPDF:i,node:a,interactive:s}=t,{desktopSidebarWidth:l}=Dn.useContext(ra),{customBreakpointsPageBodyStyles:u}=Dn.useMemo(()=>({customBreakpointsPageBodyStyles:{[Tm(2,l)]:w.justifyContentCenter}}),[l]);if(e==="unstyled")return Dn.createElement(xd.View,{...s?.events},o);let d=e==="full-width"?Dn.Fragment:Od;return Dn.createElement(xd.View,{style:[w.flex1,i?sE.pdfContainer:null]},Dn.createElement(d,null,Dn.createElement(J.View,{style:[w.flex1,w.directionRow,r?w.justifyContentCenter:w.justifyContentEnd],mobileStyle:[w.justifyContentCenter],customBreakpointsStyles:u,...s?.events},Dn.createElement(xd.View,{style:[w.flex1]},Dn.createElement(RS,{node:a}),Dn.createElement(J.View,{mobileStyle:[n?sE.pageBodyMobileWithDiff:null]},o)))))}function cE(t){let{isCommentMarginVisible:o,isDiffViewEnabled:e,isFullPage:n}=t,r=Je();return Dn.useMemo(()=>[i=>Dn.createElement(X3,{...i,isPDF:r,isDiffViewEnabled:e,isCommentMarginVisible:o,isFullPage:n}),r||!o?void 0:iE],[e,n,o,r])}var sE=xd.StyleSheet.create({pdfContainer:{breakInside:"avoid",breakBefore:"auto"},pageBody:{maxWidth:Mr+2*zt},pageBodyWithComments:{maxWidth:Mr+zt,paddingRight:0},pageBodyMobileWithDiff:{marginLeft:Zo*2},pageBodyDesktopLeftMargin:{marginLeft:zt},pageBodyDesktopRightPadding:{paddingRight:zt},pageBodyMobileLeftMargin:{marginLeft:Zo},pageBodyMobileRightPadding:{paddingRight:Zo},pageBodyPDFLeftMargin:{marginLeft:Zo},pageBodyPDFRightPadding:{paddingRight:Zo}});c();c();var rt=b(x()),ya=b(z());c();var pr=b(x());c();var _d=JSON.parse('{"popover":"popover_41P2r","toolbar":"toolbar_EEKEO","annotatedText":"annotatedText_DZvL5","active":"active_mnp9Q"}');c();var Rd=b(x());function lE(t){let{node:o,editor:e}=t,{readOnly:n}=e,r=()=>{e.change(i=>{i.unwrapInlineByKey(o.key)})};return Rd.createElement(Mn,{preferredAlignment:"start",kind:"large"},Rd.createElement(j,{style:[_d.popover,N.flex.column,N.padding.mediumHorizontal,N.padding.mediumVertical]},Rd.createElement(ur,{fragment:Ta}),n?null:Rd.createElement(j,{style:[_d.toolbar]},Rd.createElement(bt,{size:"small",kind:"secondary",leadingIcon:v.Trashcan.CSS,label:"Remove annotation",iconOnly:!0,title:"Remove annotation",onPress:r,preventFocusOnPress:!0}))))}function uE(t){let{editor:o,node:e,children:n,attributes:r,isFocused:i}=t,{readOnly:a}=o,s=e.getFragmentByKey(Ta),{selection:l}=o.value,u=qt(l)&&!!l.hasAnchorIn(s),d=i&&u,[p,f]=pr.useState(!1),m=qt(l)&&(p||d),h=pr.useCallback(()=>{a||o.change(O=>{let R=e.getFragmentByKey(Ta);R&&(qt(O.value.selection)?(u&&O.blur(),O.collapseToEndOf(R).focus()):O.selectText(be.fromBlockRange(O.value.selection,O.value.document)).collapseToEndOf(R).focus())})},[u,a,o,e.key]),y=pr.useCallback(()=>{a||o.change(O=>{let R=O.value.document.getDescendant(e.key);if(R&&R.isInline()){let I=R.getFragmentByKey(Ta);I&&qt(O.value.selection)&&O.value.selection.hasEdgeIn(I)&&O.collapseToEndOf(R)}})},[a,o,e.key]);pr.useEffect(()=>{a||(m?h():y())},[m,a,h,y]),pr.useEffect(()=>{a||!u&&p&&f(!1)},[u,p,a]);let S=pr.useCallback(()=>{f(!0)},[]),C=pr.useCallback(()=>{f(!1)},[]),{pressProps:k}=s1({onPress:S});return pr.createElement(Hg.Provider,{value:C},pr.createElement(Ba,{closeOnClick:!1,closeOnEsc:!0,closeOnScroll:!1,closeOnClickInNestedPortals:!1,closeOnOutsideClick:!0,opened:m,anchor:({ref:O})=>pr.createElement(pe,{ref:O,style:[_d.annotatedText,{[_d.active]:m}],...r,...k},n)},pr.createElement(lE,{node:e,editor:o})))}c();var LS=b(vi());var dE={onKeyDown:(t,o,e)=>{if(!Po(o.value.selection)&&((0,LS.default)("mod+enter",t)||(0,LS.default)("esc",t))){let{value:n}=o,{startBlock:r,document:i}=n;if(!r)return;let a=i.getFragmentParent(r.key);if(a?.object!=="fragment"||a.type!==Ta)return;let s=i.getParent(a.key);return s?(o.collapseToEndOf(s),o):void 0}}};c();var Oo=b(x()),gv=b(z());c();var Wo=b(x());c();var NS=JSON.parse('{"hitArea":"hitArea_oHT6S","buttonWrapper":"buttonWrapper_3J38G","hideTransition":"hideTransition_k0Mlc"}');c();function nt(t,o,e=[]){return ae({groups:[...e,{key:"block",commands:[{key:"delete",title:"Delete",icon:v.Trashcan,trigger:()=>{t.change(n=>{if(Po(n.value.selection))return n.deleteBlockRangeForward();n.removeNodeByKey(o).focus()})}}]}]})}c();var Vn=b(x());c();var PE=[{key:"youtube",title:"Youtube",icon:pE()},{key:"soundcloud",title:"Soundcloud",icon:mE()},{key:"loom",title:"Loom",icon:fE()},{key:"github",title:"GitHub Gist",icon:gE(),iconDark:hE()},{key:"framer",title:"Framer",icon:yE(),iconDark:vE()},{key:"codepen",title:"Codepen",icon:bE(),iconDark:wE()},{key:"dribbble",title:"Dribbble",icon:SE()},{key:"trello",title:"Trello",icon:CE()},{key:"typeform",title:"Typeform",icon:kE(),iconDark:xE()},{key:"google-docs",title:"Google Docs",icon:OE()},{key:"google-sheets",title:"Google Sheets",icon:_E()},{key:"google-slides",title:"Google Slides",icon:RE()},{key:"google-form",title:"Google Forms",icon:IE()}];c();var Ua=b(x()),EE=b(z());c();var Xs=b(x());var Us=Uh(t=>t.isPDF?{width:793.92,height:1123.2}:{width:750,height:500},{height:!1}),AS={blocks:{},onContentPaste:{},suggestIntegrations:()=>({}),logAnalyticsEvent:()=>{},blockLayoutComponent:({children:t})=>Xs.createElement(Xs.Fragment,null,t),integrationBlocksContext:null,integrationBlocksRemote:T_(()=>{throw new Error("not implemented")}),integrationsBlocksSubscription:{getCurrentValue:()=>({}),subscribe:()=>()=>{}}},de=Xs.createContext(AS),Ri=Xs.createContext({sections:Vu(),active:null,selected:null,setActive:()=>{}}),Bc=Xs.createContext("left"),Lr=Xs.createContext("root");function TE(t){let{onInsert:o,onClose:e}=t,{logAnalyticsEvent:n}=Ua.useContext(de),[r,i]=Ua.useState(""),a=hi(r),s=()=>{if(!a)return;let l=ag(r);o(wg.createEmbedBlock(l)),n({type:"edit_page_document_insert_block",from:"embed",blockType:_n,embedHostname:new URL(l).hostname})};return Ua.createElement(yo,{title:"Embed a URL",subtitle:"Insert a URL to embed a live preview. Works with YouTube, Google Drive, Vimeo, and more.",onClose:e,footer:Ua.createElement(EE.View,{style:[w.directionRow,w.justifyContentEnd]},Ua.createElement(W,{kind:"secondary",onPress:e,style:g.Margin.smallRight},"Cancel"),Ua.createElement(W,{kind:"primary",disabled:!a,onPress:s},"Insert"))},Ua.createElement(oo,{autoFocus:!0,label:"URL",value:r,onChangeText:i,onSubmit:s,placeholder:"Paste a URL or type it",feedback:a||!r?{type:"none"}:{type:"danger"}}))}c();var yt=b(x()),Ys=b(z());c();var Mm=b(x()),ME=Mm.default.createContext(null);function LE(t){let{value:o,children:e}=t,n=Mm.default.useMemo(()=>({space:o.space,page:o.page,snippet:o.snippet,..."changeRequest"in o&&o.changeRequest?{changeRequest:o.changeRequest}:{},..."revision"in o&&o.revision?{revision:o.revision}:{}}),[o.space,o.page,o.snippet,"changeRequest"in o?o.changeRequest:void 0,"revision"in o?o.revision:void 0]);return Mm.default.createElement(ME.Provider,{value:n},e)}function lt(){let t=Mm.default.useContext(ME);if(t===null)throw new Error("useContentReferenceContext expects a ContentReferenceContextProvider above it");return t}c();var ZS=b(x());c();var sa=nr({getKey:t=>{let[,...o]=t;return lw(o)},getValue:async([t,o,e,n])=>{let r=[];return!o||!XO(o,e)?[null,r,!1]:await tm(async()=>[await KO(o,e,{hiveClient:t,firestoreReader:{getDocument:a=>(r.some(s=>ys(s)===ys(a))||r.push(a),El.readAsync(a)),getCollection:a=>(r.some(s=>ys(a)===ys(s))||r.push(a),El.readAsync(a))}}),r,!1],[null,r,!0])},toJS(t){return[t[0],t[1].map(pw),t[2]]},fromJS(t){return[t[0],t[1].map(mw),t[2]]}}),by=nr({getKey:t=>{let[,...o]=t;return lw(o)},getValue:async([t,o,e])=>{let n=[];return await tm(async()=>[await Lg(o,e,{hiveClient:t,firestoreReader:{getDocument:i=>(n.some(a=>ys(a)===ys(i))||n.push(i),El.readAsync(i)),getCollection:i=>(n.some(a=>ys(i)===ys(a))||n.push(i),El.readAsync(i))}}),n,!1],[null,n,!0])},toJS(t){return[t[0],t[1].map(pw),t[2]]},fromJS(t){return[t[0],t[1].map(mw),t[2]]}});c();c();var G=b(x()),zc=b(TD());c();var bo=b(x());var Lm=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Vl(t){let o=Object.prototype.toString.call(t);return o==="[object Window]"||o==="[object global]"}function wy(t){return"nodeType"in t}function Bn(t){var o,e;return t?Vl(t)?t:wy(t)&&(o=(e=t.ownerDocument)==null?void 0:e.defaultView)!=null?o:window:window}function Sy(t){let{Document:o}=Bn(t);return t instanceof o}function Pd(t){return Vl(t)?!1:t instanceof Bn(t).HTMLElement}function AE(t){return t instanceof Bn(t).SVGElement}function ql(t){return t?Vl(t)?t.document:wy(t)?Sy(t)?t:Pd(t)?t.ownerDocument:document:document:document}var ca=Lm?bo.useLayoutEffect:bo.useEffect;function Nm(t){let o=(0,bo.useRef)(t);return ca(()=>{o.current=t}),(0,bo.useCallback)(function(){for(var e=arguments.length,n=new Array(e),r=0;r{t.current=setInterval(n,r)},[]),e=(0,bo.useCallback)(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[o,e]}function Ed(t,o){o===void 0&&(o=[t]);let e=(0,bo.useRef)(t);return ca(()=>{e.current!==t&&(e.current=t)},o),e}function Td(t,o){let e=(0,bo.useRef)();return(0,bo.useMemo)(()=>{let n=t(e.current);return e.current=n,n},[...o])}function Am(t){let o=Nm(t),e=(0,bo.useRef)(null),n=(0,bo.useCallback)(r=>{r!==e.current&&o?.(r,e.current),e.current=r},[]);return[e,n]}function Dm(t){let o=(0,bo.useRef)();return(0,bo.useEffect)(()=>{o.current=t},[t]),o.current}var DS={};function Bm(t,o){return(0,bo.useMemo)(()=>{if(o)return o;let e=DS[t]==null?0:DS[t]+1;return DS[t]=e,t+"-"+e},[t,o])}function BE(t){return function(o){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r{let s=Object.entries(a);for(let[l,u]of s){let d=i[l];d!=null&&(i[l]=d+t*u)}return i},{...o})}}var Gl=BE(1),Wm=BE(-1);function uB(t){return"clientX"in t&&"clientY"in t}function Cy(t){if(!t)return!1;let{KeyboardEvent:o}=Bn(t.target);return o&&t instanceof o}function dB(t){if(!t)return!1;let{TouchEvent:o}=Bn(t.target);return o&&t instanceof o}function Hl(t){if(dB(t)){if(t.touches&&t.touches.length){let{clientX:o,clientY:e}=t.touches[0];return{x:o,y:e}}else if(t.changedTouches&&t.changedTouches.length){let{clientX:o,clientY:e}=t.changedTouches[0];return{x:o,y:e}}}return uB(t)?{x:t.clientX,y:t.clientY}:null}var Id=Object.freeze({Translate:{toString(t){if(!t)return;let{x:o,y:e}=t;return"translate3d("+(o?Math.round(o):0)+"px, "+(e?Math.round(e):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;let{scaleX:o,scaleY:e}=t;return"scaleX("+o+") scaleY("+e+")"}},Transform:{toString(t){if(t)return[Id.Translate.toString(t),Id.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:o,duration:e,easing:n}=t;return o+" "+e+"ms "+n}}}),NE="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function WE(t){return t.matches(NE)?t:t.querySelector(NE)}c();var Kl=b(x()),pB={display:"none"};function zE(t){let{id:o,value:e}=t;return Kl.default.createElement("div",{id:o,style:pB},e)}var mB={position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};function FE(t){let{id:o,announcement:e}=t;return Kl.default.createElement("div",{id:o,style:mB,role:"status","aria-live":"assertive","aria-atomic":!0},e)}function VE(){let[t,o]=(0,Kl.useState)("");return{announce:(0,Kl.useCallback)(n=>{n!=null&&o(n)},[]),announcement:t}}var JE=(0,G.createContext)(null);function KS(t){let o=(0,G.useContext)(JE);(0,G.useEffect)(()=>{if(!o)throw new Error("useDndMonitor must be used within a children of ");return o(t)},[t,o])}function fB(){let[t]=(0,G.useState)(()=>new Set),o=(0,G.useCallback)(n=>(t.add(n),()=>t.delete(n)),[t]);return[(0,G.useCallback)(n=>{let{type:r,event:i}=n;t.forEach(a=>{var s;return(s=a[r])==null?void 0:s.call(a,i)})},[t]),o]}var gB={draggable:` To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel. `},hB={onDragStart(t){let{active:o}=t;return"Picked up draggable item "+o.id+"."},onDragOver(t){let{active:o,over:e}=t;return e?"Draggable item "+o.id+" was moved over droppable area "+e.id+".":"Draggable item "+o.id+" is no longer over a droppable area."},onDragEnd(t){let{active:o,over:e}=t;return e?"Draggable item "+o.id+" was dropped over droppable area "+e.id:"Draggable item "+o.id+" was dropped."},onDragCancel(t){let{active:o}=t;return"Dragging was cancelled. Draggable item "+o.id+" was dropped."}};function yB(t){let{announcements:o=hB,container:e,hiddenTextDescribedById:n,screenReaderInstructions:r=gB}=t,{announce:i,announcement:a}=VE(),s=Bm("DndLiveRegion"),[l,u]=(0,G.useState)(!1);if((0,G.useEffect)(()=>{u(!0)},[]),KS((0,G.useMemo)(()=>({onDragStart(p){let{active:f}=p;i(o.onDragStart({active:f}))},onDragMove(p){let{active:f,over:m}=p;o.onDragMove&&i(o.onDragMove({active:f,over:m}))},onDragOver(p){let{active:f,over:m}=p;i(o.onDragOver({active:f,over:m}))},onDragEnd(p){let{active:f,over:m}=p;i(o.onDragEnd({active:f,over:m}))},onDragCancel(p){let{active:f,over:m}=p;i(o.onDragCancel({active:f,over:m}))}}),[i,o])),!l)return null;let d=G.default.createElement(G.default.Fragment,null,G.default.createElement(zE,{id:n,value:r.draggable}),G.default.createElement(FE,{id:s,announcement:a}));return e?(0,zc.createPortal)(d,e):d}var Ao;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(Ao||(Ao={}));function xy(){}function XS(t,o){return(0,G.useMemo)(()=>({sensor:t,options:o??{}}),[t,o])}var la=Object.freeze({x:0,y:0});function vB(t,o){return Math.sqrt(Math.pow(t.x-o.x,2)+Math.pow(t.y-o.y,2))}function bB(t,o){let e=Hl(t);if(!e)return"0 0";let n={x:(e.x-o.left)/o.width*100,y:(e.y-o.top)/o.height*100};return n.x+"% "+n.y+"%"}function wB(t,o){let{data:{value:e}}=t,{data:{value:n}}=o;return e-n}function SB(t,o){let{data:{value:e}}=t,{data:{value:n}}=o;return n-e}function CB(t){let{left:o,top:e,height:n,width:r}=t;return[{x:o,y:e},{x:o+r,y:e},{x:o,y:e+n},{x:o+r,y:e+n}]}function kB(t,o){if(!t||t.length===0)return null;let[e]=t;return o?e[o]:e}function xB(t,o){let e=Math.max(o.top,t.top),n=Math.max(o.left,t.left),r=Math.min(o.left+o.width,t.left+t.width),i=Math.min(o.top+o.height,t.top+t.height),a=r-n,s=i-e;if(n{let{collisionRect:o,droppableRects:e,droppableContainers:n}=t,r=[];for(let i of n){let{id:a}=i,s=e.get(a);if(s){let l=xB(s,o);l>0&&r.push({id:a,data:{droppableContainer:i,value:l}})}}return r.sort(SB)};function _B(t,o){let{top:e,left:n,bottom:r,right:i}=o;return e<=t.y&&t.y<=r&&n<=t.x&&t.x<=i}var QE=t=>{let{droppableContainers:o,droppableRects:e,pointerCoordinates:n}=t;if(!n)return[];let r=[];for(let i of o){let{id:a}=i,s=e.get(a);if(s&&_B(n,s)){let u=CB(s).reduce((p,f)=>p+vB(n,f),0),d=Number((u/4).toFixed(4));r.push({id:a,data:{droppableContainer:i,value:d}})}}return r.sort(wB)};function RB(t,o,e){return{...t,scaleX:o&&e?o.width/e.width:1,scaleY:o&&e?o.height/e.height:1}}function eT(t,o){return t&&o?{x:t.left-o.left,y:t.top-o.top}:la}function IB(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i({...a,top:a.top+t*s.y,bottom:a.bottom+t*s.y,left:a.left+t*s.x,right:a.right+t*s.x}),{...e})}}var PB=IB(1);function tT(t){if(t.startsWith("matrix3d(")){let o=t.slice(9,-1).split(/, /);return{x:+o[12],y:+o[13],scaleX:+o[0],scaleY:+o[5]}}else if(t.startsWith("matrix(")){let o=t.slice(7,-1).split(/, /);return{x:+o[4],y:+o[5],scaleX:+o[0],scaleY:+o[3]}}return null}function EB(t,o,e){let n=tT(o);if(!n)return t;let{scaleX:r,scaleY:i,x:a,y:s}=n,l=t.left-a-(1-r)*parseFloat(e),u=t.top-s-(1-i)*parseFloat(e.slice(e.indexOf(" ")+1)),d=r?t.width/r:t.width,p=i?t.height/i:t.height;return{width:d,height:p,top:u,right:l+d,bottom:u+p,left:l}}var TB={ignoreTransform:!1};function Hm(t,o){o===void 0&&(o=TB);let e=t.getBoundingClientRect();if(o.ignoreTransform){let{transform:u,transformOrigin:d}=Bn(t).getComputedStyle(t);u&&(e=EB(e,u,d))}let{top:n,left:r,width:i,height:a,bottom:s,right:l}=e;return{top:n,left:r,width:i,height:a,bottom:s,right:l}}function qE(t){return Hm(t,{ignoreTransform:!0})}function MB(t){let o=t.innerWidth,e=t.innerHeight;return{top:0,left:0,right:o,bottom:e,width:o,height:e}}function LB(t,o){return o===void 0&&(o=Bn(t).getComputedStyle(t)),o.position==="fixed"}function NB(t,o){o===void 0&&(o=Bn(t).getComputedStyle(t));let e=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(r=>{let i=o[r];return typeof i=="string"?e.test(i):!1})}function US(t,o){let e=[];function n(r){if(o!=null&&e.length>=o||!r)return e;if(Sy(r)&&r.scrollingElement!=null&&!e.includes(r.scrollingElement))return e.push(r.scrollingElement),e;if(!Pd(r)||AE(r)||e.includes(r))return e;let i=Bn(t).getComputedStyle(r);return r!==t&&NB(r,i)&&e.push(r),LB(r,i)?e:n(r.parentNode)}return t?n(t):e}function oT(t){let[o]=US(t,1);return o??null}function BS(t){return!Lm||!t?null:Vl(t)?t:wy(t)?Sy(t)||t===ql(t).scrollingElement?window:Pd(t)?t:null:null}function nT(t){return Vl(t)?t.scrollX:t.scrollLeft}function rT(t){return Vl(t)?t.scrollY:t.scrollTop}function VS(t){return{x:nT(t),y:rT(t)}}var Qo;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Qo||(Qo={}));function iT(t){return!Lm||!t?!1:t===document.scrollingElement}function aT(t){let o={x:0,y:0},e=iT(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},n={x:t.scrollWidth-e.width,y:t.scrollHeight-e.height},r=t.scrollTop<=o.y,i=t.scrollLeft<=o.x,a=t.scrollTop>=n.y,s=t.scrollLeft>=n.x;return{isTop:r,isLeft:i,isBottom:a,isRight:s,maxScroll:n,minScroll:o}}var AB={x:.2,y:.2};function DB(t,o,e,n,r){let{top:i,left:a,right:s,bottom:l}=e;n===void 0&&(n=10),r===void 0&&(r=AB);let{isTop:u,isBottom:d,isLeft:p,isRight:f}=aT(t),m={x:0,y:0},h={x:0,y:0},y={height:o.height*r.y,width:o.width*r.x};return!u&&i<=o.top+y.height?(m.y=Qo.Backward,h.y=n*Math.abs((o.top+y.height-i)/y.height)):!d&&l>=o.bottom-y.height&&(m.y=Qo.Forward,h.y=n*Math.abs((o.bottom-y.height-l)/y.height)),!f&&s>=o.right-y.width?(m.x=Qo.Forward,h.x=n*Math.abs((o.right-y.width-s)/y.width)):!p&&a<=o.left+y.width&&(m.x=Qo.Backward,h.x=n*Math.abs((o.left+y.width-a)/y.width)),{direction:m,speed:h}}function BB(t){if(t===document.scrollingElement){let{innerWidth:i,innerHeight:a}=window;return{top:0,left:0,right:i,bottom:a,width:i,height:a}}let{top:o,left:e,right:n,bottom:r}=t.getBoundingClientRect();return{top:o,left:e,right:n,bottom:r,width:t.clientWidth,height:t.clientHeight}}function sT(t){return t.reduce((o,e)=>Gl(o,VS(e)),la)}function WB(t){return t.reduce((o,e)=>o+nT(e),0)}function zB(t){return t.reduce((o,e)=>o+rT(e),0)}function cT(t,o){if(o===void 0&&(o=Hm),!t)return;let{top:e,left:n,bottom:r,right:i}=o(t);oT(t)&&(r<=0||i<=0||e>=window.innerHeight||n>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}var FB=[["x",["left","right"],WB],["y",["top","bottom"],zB]],Fm=class{constructor(o,e){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=US(e),r=sT(n);this.rect={...o},this.width=o.width,this.height=o.height;for(let[i,a,s]of FB)for(let l of a)Object.defineProperty(this,l,{get:()=>{let u=s(n),d=r[i]-u;return this.rect[l]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},Xl=class{constructor(o){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...e)})},this.target=o}add(o,e,n){var r;(r=this.target)==null||r.addEventListener(o,e,n),this.listeners.push([o,e,n])}};function VB(t){let{EventTarget:o}=Bn(t);return t instanceof o?t:ql(t)}function WS(t,o){let e=Math.abs(t.x),n=Math.abs(t.y);return typeof o=="number"?Math.sqrt(e**2+n**2)>o:"x"in o&&"y"in o?e>o.x&&n>o.y:"x"in o?e>o.x:"y"in o?n>o.y:!1}var Ii;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(Ii||(Ii={}));function GE(t){t.preventDefault()}function qB(t){t.stopPropagation()}var kt;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter"})(kt||(kt={}));var lT={start:[kt.Space,kt.Enter],cancel:[kt.Esc],end:[kt.Space,kt.Enter]},GB=(t,o)=>{let{currentCoordinates:e}=o;switch(t.code){case kt.Right:return{...e,x:e.x+25};case kt.Left:return{...e,x:e.x-25};case kt.Down:return{...e,y:e.y+25};case kt.Up:return{...e,y:e.y-25}}},Oy=class{constructor(o){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=o;let{event:{target:e}}=o;this.props=o,this.listeners=new Xl(ql(e)),this.windowListeners=new Xl(Bn(e)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Ii.Resize,this.handleCancel),this.windowListeners.add(Ii.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Ii.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:o,onStart:e}=this.props,n=o.node.current;n&&cT(n),e(la)}handleKeyDown(o){if(Cy(o)){let{active:e,context:n,options:r}=this.props,{keyboardCodes:i=lT,coordinateGetter:a=GB,scrollBehavior:s="smooth"}=r,{code:l}=o;if(i.end.includes(l)){this.handleEnd(o);return}if(i.cancel.includes(l)){this.handleCancel(o);return}let{collisionRect:u}=n.current,d=u?{x:u.left,y:u.top}:la;this.referenceCoordinates||(this.referenceCoordinates=d);let p=a(o,{active:e,context:n.current,currentCoordinates:d});if(p){let f=Wm(p,d),m={x:0,y:0},{scrollableAncestors:h}=n.current;for(let y of h){let S=o.code,{isTop:C,isRight:k,isLeft:O,isBottom:R,maxScroll:I,minScroll:E}=aT(y),P=BB(y),L={x:Math.min(S===kt.Right?P.right-P.width/2:P.right,Math.max(S===kt.Right?P.left:P.left+P.width/2,p.x)),y:Math.min(S===kt.Down?P.bottom-P.height/2:P.bottom,Math.max(S===kt.Down?P.top:P.top+P.height/2,p.y))},T=S===kt.Right&&!k||S===kt.Left&&!O,H=S===kt.Down&&!R||S===kt.Up&&!C;if(T&&L.x!==p.x){let U=y.scrollLeft+f.x,K=S===kt.Right&&U<=I.x||S===kt.Left&&U>=E.x;if(K&&!f.y){y.scrollTo({left:U,behavior:s});return}K?m.x=y.scrollLeft-U:m.x=S===kt.Right?y.scrollLeft-I.x:y.scrollLeft-E.x,m.x&&y.scrollBy({left:-m.x,behavior:s});break}else if(H&&L.y!==p.y){let U=y.scrollTop+f.y,K=S===kt.Down&&U<=I.y||S===kt.Up&&U>=E.y;if(K&&!f.x){y.scrollTo({top:U,behavior:s});return}K?m.y=y.scrollTop-U:m.y=S===kt.Down?y.scrollTop-I.y:y.scrollTop-E.y,m.y&&y.scrollBy({top:-m.y,behavior:s});break}}this.handleMove(o,Gl(Wm(p,this.referenceCoordinates),m))}}}handleMove(o,e){let{onMove:n}=this.props;o.preventDefault(),n(e)}handleEnd(o){let{onEnd:e}=this.props;o.preventDefault(),this.detach(),e()}handleCancel(o){let{onCancel:e}=this.props;o.preventDefault(),this.detach(),e()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};Oy.activators=[{eventName:"onKeyDown",handler:(t,o,e)=>{let{keyboardCodes:n=lT,onActivation:r}=o,{active:i}=e,{code:a}=t.nativeEvent;if(n.start.includes(a)){let s=i.activatorNode.current;return s&&t.target!==s?!1:(t.preventDefault(),r?.({event:t.nativeEvent}),!0)}return!1}}];function HE(t){return!!(t&&"distance"in t)}function KE(t){return!!(t&&"delay"in t)}var Vm=class{constructor(o,e,n){var r;n===void 0&&(n=VB(o.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=o,this.events=e;let{event:i}=o,{target:a}=i;this.props=o,this.events=e,this.document=ql(a),this.documentListeners=new Xl(this.document),this.listeners=new Xl(n),this.windowListeners=new Xl(Bn(a)),this.initialCoordinates=(r=Hl(i))!=null?r:la,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:o,props:{options:{activationConstraint:e}}}=this;if(this.listeners.add(o.move.name,this.handleMove,{passive:!1}),this.listeners.add(o.end.name,this.handleEnd),this.windowListeners.add(Ii.Resize,this.handleCancel),this.windowListeners.add(Ii.DragStart,GE),this.windowListeners.add(Ii.VisibilityChange,this.handleCancel),this.windowListeners.add(Ii.ContextMenu,GE),this.documentListeners.add(Ii.Keydown,this.handleKeydown),e){if(HE(e))return;if(KE(e)){this.timeoutId=setTimeout(this.handleStart,e.delay);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){let{initialCoordinates:o}=this,{onStart:e}=this.props;o&&(this.activated=!0,this.documentListeners.add(Ii.Click,qB,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Ii.SelectionChange,this.removeTextSelection),e(o))}handleMove(o){var e;let{activated:n,initialCoordinates:r,props:i}=this,{onMove:a,options:{activationConstraint:s}}=i;if(!r)return;let l=(e=Hl(o))!=null?e:la,u=Wm(r,l);if(!n&&s){if(KE(s))return WS(u,s.tolerance)?this.handleCancel():void 0;if(HE(s))return s.tolerance!=null&&WS(u,s.tolerance)?this.handleCancel():WS(u,s.distance)?this.handleStart():void 0}o.cancelable&&o.preventDefault(),a(l)}handleEnd(){let{onEnd:o}=this.props;this.detach(),o()}handleCancel(){let{onCancel:o}=this.props;this.detach(),o()}handleKeydown(o){o.code===kt.Esc&&this.handleCancel()}removeTextSelection(){var o;(o=this.document.getSelection())==null||o.removeAllRanges()}},HB={move:{name:"pointermove"},end:{name:"pointerup"}},Md=class extends Vm{constructor(o){let{event:e}=o,n=ql(e.target);super(o,HB,n)}};Md.activators=[{eventName:"onPointerDown",handler:(t,o)=>{let{nativeEvent:e}=t,{onActivation:n}=o;return!e.isPrimary||e.button!==0?!1:(n?.({event:e}),!0)}}];var KB={move:{name:"mousemove"},end:{name:"mouseup"}},qS;(function(t){t[t.RightClick=2]="RightClick"})(qS||(qS={}));var qm=class extends Vm{constructor(o){super(o,KB,ql(o.event.target))}};qm.activators=[{eventName:"onMouseDown",handler:(t,o)=>{let{nativeEvent:e}=t,{onActivation:n}=o;return e.button===qS.RightClick?!1:(n?.({event:e}),!0)}}];var zS={move:{name:"touchmove"},end:{name:"touchend"}},GS=class extends Vm{constructor(o){super(o,zS)}static setup(){return window.addEventListener(zS.move.name,o,{capture:!1,passive:!1}),function(){window.removeEventListener(zS.move.name,o)};function o(){}}};GS.activators=[{eventName:"onTouchStart",handler:(t,o)=>{let{nativeEvent:e}=t,{onActivation:n}=o,{touches:r}=e;return r.length>1?!1:(n?.({event:e}),!0)}}];var zm;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(zm||(zm={}));var _y;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(_y||(_y={}));function XB(t){let{acceleration:o,activator:e=zm.Pointer,canScroll:n,draggingRect:r,enabled:i,interval:a=5,order:s=_y.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:d,delta:p,threshold:f}=t,m=YB({delta:p,disabled:!i}),[h,y]=DE(),S=(0,G.useRef)({x:0,y:0}),C=(0,G.useRef)({x:0,y:0}),k=(0,G.useMemo)(()=>{switch(e){case zm.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case zm.DraggableRect:return r}},[e,r,l]),O=(0,G.useRef)(null),R=(0,G.useCallback)(()=>{let E=O.current;if(!E)return;let P=S.current.x*C.current.x,L=S.current.y*C.current.y;E.scrollBy(P,L)},[]),I=(0,G.useMemo)(()=>s===_y.TreeOrder?[...u].reverse():u,[s,u]);(0,G.useEffect)(()=>{if(!i||!u.length||!k){y();return}for(let E of I){if(n?.(E)===!1)continue;let P=u.indexOf(E),L=d[P];if(!L)continue;let{direction:T,speed:H}=DB(E,L,k,o,f);for(let U of["x","y"])m[U][T[U]]||(H[U]=0,T[U]=0);if(H.x>0||H.y>0){y(),O.current=E,h(R,a),S.current=H,C.current=T;return}}S.current={x:0,y:0},C.current={x:0,y:0},y()},[o,R,n,y,i,a,JSON.stringify(k),JSON.stringify(m),h,u,I,d,JSON.stringify(f)])}var UB={x:{[Qo.Backward]:!1,[Qo.Forward]:!1},y:{[Qo.Backward]:!1,[Qo.Forward]:!1}};function YB(t){let{delta:o,disabled:e}=t,n=Dm(o);return Td(r=>{if(e||!n||!r)return UB;let i={x:Math.sign(o.x-n.x),y:Math.sign(o.y-n.y)};return{x:{[Qo.Backward]:r.x[Qo.Backward]||i.x===-1,[Qo.Forward]:r.x[Qo.Forward]||i.x===1},y:{[Qo.Backward]:r.y[Qo.Backward]||i.y===-1,[Qo.Forward]:r.y[Qo.Forward]||i.y===1}}},[e,o,n])}function jB(t,o){let e=o!==null?t.get(o):void 0,n=e?e.node.current:null;return Td(r=>{var i;return o===null?null:(i=n??r)!=null?i:null},[n,o])}function $B(t,o){return(0,G.useMemo)(()=>t.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(a=>({eventName:a.eventName,handler:o(a.handler,n)}));return[...e,...i]},[]),[t,o])}var Gm;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(Gm||(Gm={}));var HS;(function(t){t.Optimized="optimized"})(HS||(HS={}));var XE=new Map;function ZB(t,o){let{dragging:e,dependencies:n,config:r}=o,[i,a]=(0,G.useState)(null),{frequency:s,measure:l,strategy:u}=r,d=(0,G.useRef)(t),p=S(),f=Ed(p),m=(0,G.useCallback)(function(C){C===void 0&&(C=[]),!f.current&&a(k=>k===null?C:k.concat(C.filter(O=>!k.includes(O))))},[f]),h=(0,G.useRef)(null),y=Td(C=>{if(p&&!e)return XE;if(!C||C===XE||d.current!==t||i!=null){let k=new Map;for(let O of t){if(!O)continue;if(i&&i.length>0&&!i.includes(O.id)&&O.rect.current){k.set(O.id,O.rect.current);continue}let R=O.node.current,I=R?new Fm(l(R),R):null;O.rect.current=I,I&&k.set(O.id,I)}return k}return C},[t,i,e,p,l]);return(0,G.useEffect)(()=>{d.current=t},[t]),(0,G.useEffect)(()=>{p||m()},[e,p]),(0,G.useEffect)(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),(0,G.useEffect)(()=>{p||typeof s!="number"||h.current!==null||(h.current=setTimeout(()=>{m(),h.current=null},s))},[s,p,m,...n]),{droppableRects:y,measureDroppableContainers:m,measuringScheduled:i!=null};function S(){switch(u){case Gm.Always:return!1;case Gm.BeforeDragging:return e;default:return!e}}}function YS(t,o){return Td(e=>t?e||(typeof o=="function"?o(t):t):null,[o,t])}function JB(t,o){return YS(t,o)}function QB(t){let{callback:o,disabled:e}=t,n=Nm(o),r=(0,G.useMemo)(()=>{if(e||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:i}=window;return new i(n)},[n,e]);return(0,G.useEffect)(()=>()=>r?.disconnect(),[r]),r}function Ry(t){let{callback:o,disabled:e}=t,n=Nm(o),r=(0,G.useMemo)(()=>{if(e||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:i}=window;return new i(n)},[e]);return(0,G.useEffect)(()=>()=>r?.disconnect(),[r]),r}function e5(t){return new Fm(Hm(t),t)}function UE(t,o,e){o===void 0&&(o=e5);let[n,r]=(0,G.useReducer)(s,null),i=QB({callback(l){if(t)for(let u of l){let{type:d,target:p}=u;if(d==="childList"&&p instanceof HTMLElement&&p.contains(t)){r();break}}}}),a=Ry({callback:r});return ca(()=>{r(),t?(a?.observe(t),i?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),i?.disconnect())},[t]),n;function s(l){if(!t)return null;if(t.isConnected===!1){var u;return(u=l??e)!=null?u:null}let d=o(t);return JSON.stringify(l)===JSON.stringify(d)?l:d}}function t5(t){let o=YS(t);return eT(t,o)}var YE=[];function o5(t){let o=(0,G.useRef)(t),e=Td(n=>t?n&&n!==YE&&t&&o.current&&t.parentNode===o.current.parentNode?n:US(t):YE,[t]);return(0,G.useEffect)(()=>{o.current=t},[t]),e}function n5(t){let[o,e]=(0,G.useState)(null),n=(0,G.useRef)(t),r=(0,G.useCallback)(i=>{let a=BS(i.target);a&&e(s=>s?(s.set(a,VS(a)),new Map(s)):null)},[]);return(0,G.useEffect)(()=>{let i=n.current;if(t!==i){a(i);let s=t.map(l=>{let u=BS(l);return u?(u.addEventListener("scroll",r,{passive:!0}),[u,VS(u)]):null}).filter(l=>l!=null);e(s.length?new Map(s):null),n.current=t}return()=>{a(t),a(i)};function a(s){s.forEach(l=>{let u=BS(l);u?.removeEventListener("scroll",r)})}},[r,t]),(0,G.useMemo)(()=>t.length?o?Array.from(o.values()).reduce((i,a)=>Gl(i,a),la):sT(t):la,[t,o])}function jE(t,o){o===void 0&&(o=[]);let e=(0,G.useRef)(null);return(0,G.useEffect)(()=>{e.current=null},o),(0,G.useEffect)(()=>{let n=t!==la;n&&!e.current&&(e.current=t),!n&&e.current&&(e.current=null)},[t]),e.current?Wm(t,e.current):la}function r5(t){(0,G.useEffect)(()=>{if(!Lm)return;let o=t.map(e=>{let{sensor:n}=e;return n.setup==null?void 0:n.setup()});return()=>{for(let e of o)e?.()}},t.map(o=>{let{sensor:e}=o;return e}))}function i5(t,o){return(0,G.useMemo)(()=>t.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=a=>{i(a,o)},e},{}),[t,o])}function uT(t){return(0,G.useMemo)(()=>t?MB(t):null,[t])}var FS=[];function a5(t,o){o===void 0&&(o=Hm);let[e]=t,n=uT(e?Bn(e):null),[r,i]=(0,G.useReducer)(s,FS),a=Ry({callback:i});return t.length>0&&r===FS&&i(),ca(()=>{t.length?t.forEach(l=>a?.observe(l)):(a?.disconnect(),i())},[t]),r;function s(){return t.length?t.map(l=>iT(l)?n:new Fm(o(l),l)):FS}}function dT(t){if(!t)return null;if(t.children.length>1)return t;let o=t.children[0];return Pd(o)?o:t}function s5(t){let{measure:o}=t,[e,n]=(0,G.useState)(null),r=(0,G.useCallback)(u=>{for(let{target:d}of u)if(Pd(d)){n(p=>{let f=o(d);return p?{...p,width:f.width,height:f.height}:f});break}},[o]),i=Ry({callback:r}),a=(0,G.useCallback)(u=>{let d=dT(u);i?.disconnect(),d&&i?.observe(d),n(d?o(d):null)},[o,i]),[s,l]=Am(a);return(0,G.useMemo)(()=>({nodeRef:s,rect:e,setRef:l}),[e,s,l])}var c5=[{sensor:Md,options:{}},{sensor:Oy,options:{}}],l5={current:{}},ky={draggable:{measure:qE},droppable:{measure:qE,strategy:Gm.WhileDragging,frequency:HS.Optimized},dragOverlay:{measure:Hm}},Ul=class extends Map{get(o){var e;return o!=null&&(e=super.get(o))!=null?e:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(o=>{let{disabled:e}=o;return!e})}getNodeFor(o){var e,n;return(e=(n=this.get(o))==null?void 0:n.node.current)!=null?e:void 0}},u5={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ul,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:xy},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ky,measureDroppableContainers:xy,windowRect:null,measuringScheduled:!1},pT={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:xy,draggableNodes:new Map,over:null,measureDroppableContainers:xy},Km=(0,G.createContext)(pT),mT=(0,G.createContext)(u5);function d5(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ul}}}function p5(t,o){switch(o.type){case Ao.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:o.initialCoordinates,active:o.active}};case Ao.DragMove:return t.draggable.active?{...t,draggable:{...t.draggable,translate:{x:o.coordinates.x-t.draggable.initialCoordinates.x,y:o.coordinates.y-t.draggable.initialCoordinates.y}}}:t;case Ao.DragEnd:case Ao.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ao.RegisterDroppable:{let{element:e}=o,{id:n}=e,r=new Ul(t.droppable.containers);return r.set(n,e),{...t,droppable:{...t.droppable,containers:r}}}case Ao.SetDroppableDisabled:{let{id:e,key:n,disabled:r}=o,i=t.droppable.containers.get(e);if(!i||n!==i.key)return t;let a=new Ul(t.droppable.containers);return a.set(e,{...i,disabled:r}),{...t,droppable:{...t.droppable,containers:a}}}case Ao.UnregisterDroppable:{let{id:e,key:n}=o,r=t.droppable.containers.get(e);if(!r||n!==r.key)return t;let i=new Ul(t.droppable.containers);return i.delete(e),{...t,droppable:{...t.droppable,containers:i}}}default:return t}}function m5(t){let{disabled:o}=t,{active:e,activatorEvent:n,draggableNodes:r}=(0,G.useContext)(Km),i=Dm(n),a=Dm(e?.id);return(0,G.useEffect)(()=>{if(!o&&!n&&i&&a!=null){if(!Cy(i)||document.activeElement===i.target)return;let s=r.get(a);if(!s)return;let{activatorNode:l,node:u}=s;if(!l.current&&!u.current)return;requestAnimationFrame(()=>{for(let d of[l.current,u.current]){if(!d)continue;let p=WE(d);if(p){p.focus();break}}})}},[n,o,r,a,i]),null}function fT(t,o){let{transform:e,...n}=o;return t!=null&&t.length?t.reduce((r,i)=>i({transform:r,...n}),e):e}function f5(t){return(0,G.useMemo)(()=>({draggable:{...ky.draggable,...t?.draggable},droppable:{...ky.droppable,...t?.droppable},dragOverlay:{...ky.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function g5(t){let{activeNode:o,measure:e,initialRect:n,config:r=!0}=t,i=(0,G.useRef)(!1),{x:a,y:s}=typeof r=="boolean"?{x:r,y:r}:r;ca(()=>{if(!a&&!s||!o){i.current=!1;return}if(i.current||!n)return;let u=o?.node.current;if(!u||u.isConnected===!1)return;let d=e(u),p=eT(d,n);if(a||(p.x=0),s||(p.y=0),i.current=!0,Math.abs(p.x)>0||Math.abs(p.y)>0){let f=oT(u);f&&f.scrollBy({top:p.y,left:p.x})}},[o,a,s,n,e])}var Iy=(0,G.createContext)({...la,scaleX:1,scaleY:1}),Wc;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(Wc||(Wc={}));var gT=(0,G.memo)(function(o){var e,n,r,i;let{id:a,accessibility:s,autoScroll:l=!0,children:u,sensors:d=c5,collisionDetection:p=OB,measuring:f,modifiers:m,...h}=o,y=(0,G.useReducer)(p5,void 0,d5),[S,C]=y,[k,O]=fB(),[R,I]=(0,G.useState)(Wc.Uninitialized),E=R===Wc.Initialized,{draggable:{active:P,nodes:L,translate:T},droppable:{containers:H}}=S,U=P?L.get(P):null,K=(0,G.useRef)({initial:null,translated:null}),Y=(0,G.useMemo)(()=>{var ln;return P!=null?{id:P,data:(ln=U?.data)!=null?ln:l5,rect:K}:null},[P,U]),X=(0,G.useRef)(null),[re,me]=(0,G.useState)(null),[Be,Ie]=(0,G.useState)(null),ut=Ed(h,Object.values(h)),Ro=Bm("DndDescribedBy",a),Fr=(0,G.useMemo)(()=>H.getEnabled(),[H]),an=f5(f),{droppableRects:Qn,measureDroppableContainers:Vr,measuringScheduled:qr}=ZB(Fr,{dragging:E,dependencies:[T.x,T.y],config:an.droppable}),Io=jB(L,P),sn=(0,G.useMemo)(()=>Be?Hl(Be):null,[Be]),cn=PD(),fi=JB(Io,an.draggable.measure);g5({activeNode:P?L.get(P):null,config:cn.layoutShiftCompensation,initialRect:fi,measure:an.draggable.measure});let q=UE(Io,an.draggable.measure,fi),oe=UE(Io?Io.parentElement:null),$=(0,G.useRef)({activatorEvent:null,active:null,activeNode:Io,collisionRect:null,collisions:null,droppableRects:Qn,draggableNodes:L,draggingNode:null,draggingNodeRect:null,droppableContainers:H,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),te=H.getNodeFor((e=$.current.over)==null?void 0:e.id),he=s5({measure:an.dragOverlay.measure}),Me=(n=he.nodeRef.current)!=null?n:Io,at=E?(r=he.rect)!=null?r:q:null,Ye=!!(he.nodeRef.current&&he.rect),st=t5(Ye?null:q),ct=uT(Me?Bn(Me):null),et=o5(E?te??Io:null),co=a5(et),Nt=fT(m,{transform:{x:T.x-st.x,y:T.y-st.y,scaleX:1,scaleY:1},activatorEvent:Be,active:Y,activeNodeRect:q,containerNodeRect:oe,draggingNodeRect:at,over:$.current.over,overlayNodeRect:he.rect,scrollableAncestors:et,scrollableAncestorRects:co,windowRect:ct}),er=sn?Gl(sn,T):null,ms=n5(et),Lu=jE(ms),bl=jE(ms,[q]),Hi=Gl(Nt,Lu),fs=at?PB(at,Nt):null,wl=Y&&fs?p({active:Y,collisionRect:fs,droppableRects:Qn,droppableContainers:Fr,pointerCoordinates:er}):null,Jf=kB(wl,"id"),[_a,Qf]=(0,G.useState)(null),dt=Ye?Nt:Gl(Nt,bl),Ki=RB(dt,(i=_a?.rect)!=null?i:null,q),gs=(0,G.useCallback)((ln,Gr)=>{let{sensor:Hr,options:dc}=Gr;if(X.current==null)return;let gi=L.get(X.current);if(!gi)return;let Xi=ln.nativeEvent,Ra=new Hr({active:X.current,activeNode:gi,event:Xi,options:dc,context:$,onStart(Ui){let Dp=X.current;if(Dp==null)return;let Bp=L.get(Dp);if(!Bp)return;let{onDragStart:eg}=ut.current,tg={active:{id:Dp,data:Bp.data,rect:K}};(0,zc.unstable_batchedUpdates)(()=>{eg?.(tg),I(Wc.Initializing),C({type:Ao.DragStart,initialCoordinates:Ui,active:Dp}),k({type:"onDragStart",event:tg})})},onMove(Ui){C({type:Ao.DragMove,coordinates:Ui})},onEnd:Nu(Ao.DragEnd),onCancel:Nu(Ao.DragCancel)});(0,zc.unstable_batchedUpdates)(()=>{me(Ra),Ie(ln.nativeEvent)});function Nu(Ui){return async function(){let{active:Bp,collisions:eg,over:tg,scrollAdjustedTranslate:wx}=$.current,Wp=null;if(Bp&&wx){let{cancelDrop:zp}=ut.current;Wp={activatorEvent:Xi,active:Bp,collisions:eg,delta:wx,over:tg},Ui===Ao.DragEnd&&typeof zp=="function"&&await Promise.resolve(zp(Wp))&&(Ui=Ao.DragCancel)}X.current=null,(0,zc.unstable_batchedUpdates)(()=>{C({type:Ui}),I(Wc.Uninitialized),Qf(null),me(null),Ie(null);let zp=Ui===Ao.DragEnd?"onDragEnd":"onDragCancel";if(Wp){let cw=ut.current[zp];cw?.(Wp),k({type:zp,event:Wp})}})}}},[L]),_D=(0,G.useCallback)((ln,Gr)=>(Hr,dc)=>{let gi=Hr.nativeEvent,Xi=L.get(dc);if(X.current!==null||!Xi||gi.dndKit||gi.defaultPrevented)return;let Ra={active:Xi};ln(Hr,Gr.options,Ra)===!0&&(gi.dndKit={capturedBy:Gr.sensor},X.current=dc,gs(Hr,Gr))},[L,gs]),bx=$B(d,_D);r5(d),ca(()=>{q&&R===Wc.Initializing&&I(Wc.Initialized)},[q,R]),(0,G.useEffect)(()=>{let{onDragMove:ln}=ut.current,{active:Gr,activatorEvent:Hr,collisions:dc,over:gi}=$.current;if(!Gr||!Hr)return;let Xi={active:Gr,activatorEvent:Hr,collisions:dc,delta:{x:Hi.x,y:Hi.y},over:gi};(0,zc.unstable_batchedUpdates)(()=>{ln?.(Xi),k({type:"onDragMove",event:Xi})})},[Hi.x,Hi.y]),(0,G.useEffect)(()=>{let{active:ln,activatorEvent:Gr,collisions:Hr,droppableContainers:dc,scrollAdjustedTranslate:gi}=$.current;if(!ln||X.current==null||!Gr||!gi)return;let{onDragOver:Xi}=ut.current,Ra=dc.get(Jf),Nu=Ra&&Ra.rect.current?{id:Ra.id,rect:Ra.rect.current,data:Ra.data,disabled:Ra.disabled}:null,Ui={active:ln,activatorEvent:Gr,collisions:Hr,delta:{x:gi.x,y:gi.y},over:Nu};(0,zc.unstable_batchedUpdates)(()=>{Qf(Nu),Xi?.(Ui),k({type:"onDragOver",event:Ui})})},[Jf]),ca(()=>{$.current={activatorEvent:Be,active:Y,activeNode:Io,collisionRect:fs,collisions:wl,droppableRects:Qn,draggableNodes:L,draggingNode:Me,draggingNodeRect:at,droppableContainers:H,over:_a,scrollableAncestors:et,scrollAdjustedTranslate:Hi},K.current={initial:at,translated:fs}},[Y,Io,wl,fs,L,Me,at,Qn,H,_a,et,Hi]),XB({...cn,delta:T,draggingRect:fs,pointerCoordinates:er,scrollableAncestors:et,scrollableAncestorRects:co});let RD=(0,G.useMemo)(()=>({active:Y,activeNode:Io,activeNodeRect:q,activatorEvent:Be,collisions:wl,containerNodeRect:oe,dragOverlay:he,draggableNodes:L,droppableContainers:H,droppableRects:Qn,over:_a,measureDroppableContainers:Vr,scrollableAncestors:et,scrollableAncestorRects:co,measuringConfiguration:an,measuringScheduled:qr,windowRect:ct}),[Y,Io,q,Be,wl,oe,he,L,H,Qn,_a,Vr,et,co,an,qr,ct]),ID=(0,G.useMemo)(()=>({activatorEvent:Be,activators:bx,active:Y,activeNodeRect:q,ariaDescribedById:{draggable:Ro},dispatch:C,draggableNodes:L,over:_a,measureDroppableContainers:Vr}),[Be,bx,Y,q,C,Ro,L,_a,Vr]);return G.default.createElement(JE.Provider,{value:O},G.default.createElement(Km.Provider,{value:ID},G.default.createElement(mT.Provider,{value:RD},G.default.createElement(Iy.Provider,{value:Ki},u)),G.default.createElement(m5,{disabled:s?.restoreFocus===!1})),G.default.createElement(yB,{...s,hiddenTextDescribedById:Ro}));function PD(){let ln=re?.autoScrollEnabled===!1,Gr=typeof l=="object"?l.enabled===!1:l===!1,Hr=E&&!ln&&!Gr;return typeof l=="object"?{...l,enabled:Hr}:{enabled:Hr}}}),h5=(0,G.createContext)(null),$E="button",y5="Droppable";function gn(t){let{id:o,data:e,disabled:n=!1,attributes:r}=t,i=Bm(y5),{activators:a,activatorEvent:s,active:l,activeNodeRect:u,ariaDescribedById:d,draggableNodes:p,over:f}=(0,G.useContext)(Km),{role:m=$E,roleDescription:h="draggable",tabIndex:y=0}=r??{},S=l?.id===o,C=(0,G.useContext)(S?Iy:h5),[k,O]=Am(),[R,I]=Am(),E=i5(a,o),P=Ed(e);ca(()=>(p.set(o,{id:o,key:i,node:k,activatorNode:R,data:P}),()=>{let T=p.get(o);T&&T.key===i&&p.delete(o)}),[p,o]);let L=(0,G.useMemo)(()=>({role:m,tabIndex:y,"aria-disabled":n,"aria-pressed":S&&m===$E?!0:void 0,"aria-roledescription":h,"aria-describedby":d.draggable}),[n,m,y,S,h,d.draggable]);return{active:l,activatorEvent:s,activeNodeRect:u,attributes:L,isDragging:S,listeners:n?void 0:E,node:k,over:f,setNodeRef:O,setActivatorNodeRef:I,transform:C}}function v5(){return(0,G.useContext)(mT)}var b5="Droppable",w5={timeout:25};function hT(t){let{data:o,disabled:e=!1,id:n,resizeObserverConfig:r}=t,i=Bm(b5),{active:a,dispatch:s,over:l,measureDroppableContainers:u}=(0,G.useContext)(Km),d=(0,G.useRef)({disabled:e}),p=(0,G.useRef)(!1),f=(0,G.useRef)(null),m=(0,G.useRef)(null),{disabled:h,updateMeasurementsFor:y,timeout:S}={...w5,...r},C=Ed(y??n),k=(0,G.useCallback)(()=>{if(!p.current){p.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{u(Array.isArray(C.current)?C.current:[C.current]),m.current=null},S)},[S]),O=Ry({callback:k,disabled:h||!a}),R=(0,G.useCallback)((L,T)=>{O&&(T&&(O.unobserve(T),p.current=!1),L&&O.observe(L))},[O]),[I,E]=Am(R),P=Ed(o);return(0,G.useEffect)(()=>{!O||!I.current||(O.disconnect(),p.current=!1,O.observe(I.current))},[I,O]),ca(()=>(s({type:Ao.RegisterDroppable,element:{id:n,key:i,disabled:e,node:I,rect:f,data:P}}),()=>s({type:Ao.UnregisterDroppable,key:i,id:n})),[n]),(0,G.useEffect)(()=>{e!==d.current.disabled&&(s({type:Ao.SetDroppableDisabled,id:n,key:i,disabled:e}),d.current.disabled=e)},[n,i,e,s]),{active:a,rect:f,isOver:l?.id===n,node:I,over:l,setNodeRef:E}}function S5(t){let{animation:o,children:e}=t,[n,r]=(0,G.useState)(null),[i,a]=(0,G.useState)(null),s=Dm(e);return!e&&!n&&s&&r(s),ca(()=>{if(!i)return;let l=n?.key,u=n?.props.id;if(l==null||u==null){r(null);return}Promise.resolve(o(u,i)).then(()=>{r(null)})},[o,n,i]),G.default.createElement(G.default.Fragment,null,e,n?(0,G.cloneElement)(n,{ref:a}):null)}var C5={x:0,y:0,scaleX:1,scaleY:1};function k5(t){let{children:o}=t;return G.default.createElement(Km.Provider,{value:pT},G.default.createElement(Iy.Provider,{value:C5},o))}var x5={position:"fixed",touchAction:"none"},O5=t=>Cy(t)?"transform 250ms ease":void 0,_5=(0,G.forwardRef)((t,o)=>{let{as:e,activatorEvent:n,adjustScale:r,children:i,className:a,rect:s,style:l,transform:u,transition:d=O5}=t;if(!s)return null;let p=r?u:{...u,scaleX:1,scaleY:1},f={...x5,width:s.width,height:s.height,top:s.top,left:s.left,transform:Id.Transform.toString(p),transformOrigin:r&&n?bB(n,s):void 0,transition:typeof d=="function"?d(n):d,...l};return G.default.createElement(e,{className:a,style:f,ref:o},i)}),R5=t=>o=>{let{active:e,dragOverlay:n}=o,r={},{styles:i,className:a}=t;if(i!=null&&i.active)for(let[s,l]of Object.entries(i.active))l!==void 0&&(r[s]=e.node.style.getPropertyValue(s),e.node.style.setProperty(s,l));if(i!=null&&i.dragOverlay)for(let[s,l]of Object.entries(i.dragOverlay))l!==void 0&&n.node.style.setProperty(s,l);return a!=null&&a.active&&e.node.classList.add(a.active),a!=null&&a.dragOverlay&&n.node.classList.add(a.dragOverlay),function(){for(let[l,u]of Object.entries(r))e.node.style.setProperty(l,u);a!=null&&a.active&&e.node.classList.remove(a.active)}},I5=t=>{let{transform:{initial:o,final:e}}=t;return[{transform:Id.Transform.toString(o)},{transform:Id.Transform.toString(e)}]},P5={duration:250,easing:"ease",keyframes:I5,sideEffects:R5({styles:{active:{opacity:"0"}}})};function E5(t){let{config:o,draggableNodes:e,droppableContainers:n,measuringConfiguration:r}=t;return Nm((i,a)=>{if(o===null)return;let s=e.get(i);if(!s)return;let l=s.node.current;if(!l)return;let u=dT(a);if(!u)return;let{transform:d}=Bn(a).getComputedStyle(a),p=tT(d);if(!p)return;let f=typeof o=="function"?o:T5(o);return cT(l,r.draggable.measure),f({active:{id:i,data:s.data,node:l,rect:r.draggable.measure(l)},draggableNodes:e,dragOverlay:{node:a,rect:r.dragOverlay.measure(u)},droppableContainers:n,measuringConfiguration:r,transform:p})})}function T5(t){let{duration:o,easing:e,sideEffects:n,keyframes:r}={...P5,...t};return i=>{let{active:a,dragOverlay:s,transform:l,...u}=i;if(!o)return;let d={x:s.rect.left-a.rect.left,y:s.rect.top-a.rect.top},p={scaleX:l.scaleX!==1?a.rect.width*l.scaleX/s.rect.width:1,scaleY:l.scaleY!==1?a.rect.height*l.scaleY/s.rect.height:1},f={x:l.x-d.x,y:l.y-d.y,...p},m=r({...u,active:a,dragOverlay:s,transform:{initial:l,final:f}}),[h]=m,y=m[m.length-1];if(JSON.stringify(h)===JSON.stringify(y))return;let S=n?.({active:a,dragOverlay:s,...u}),C=s.node.animate(m,{duration:o,easing:e,fill:"forwards"});return new Promise(k=>{C.onfinish=()=>{S?.(),k()}})}}var ZE=0;function M5(t){return(0,G.useMemo)(()=>{if(t!=null)return ZE++,ZE},[t])}var yT=G.default.memo(t=>{let{adjustScale:o=!1,children:e,dropAnimation:n,style:r,transition:i,modifiers:a,wrapperElement:s="div",className:l,zIndex:u=999}=t,{activatorEvent:d,active:p,activeNodeRect:f,containerNodeRect:m,draggableNodes:h,droppableContainers:y,dragOverlay:S,over:C,measuringConfiguration:k,scrollableAncestors:O,scrollableAncestorRects:R,windowRect:I}=v5(),E=(0,G.useContext)(Iy),P=M5(p?.id),L=fT(a,{activatorEvent:d,active:p,activeNodeRect:f,containerNodeRect:m,draggingNodeRect:S.rect,over:C,overlayNodeRect:S.rect,scrollableAncestors:O,scrollableAncestorRects:R,transform:E,windowRect:I}),T=YS(f),H=E5({config:n,draggableNodes:h,droppableContainers:y,measuringConfiguration:k}),U=T?S.setRef:void 0;return G.default.createElement(k5,null,G.default.createElement(S5,{animation:H},p&&P?G.default.createElement(_5,{key:P,id:p.id,ref:U,as:s,activatorEvent:d,adjustScale:o,className:l,transition:i,rect:T,style:{zIndex:u,...r},transform:L},e):null))});var xT=b(x());c();c();var vT=t=>{let{activatorEvent:o,draggingNodeRect:e,transform:n}=t;if(e&&o){let r=Hl(o);if(!r)return n;let i=r.x-e.left,a=r.y-e.top;return{...n,x:n.x+i-e.width/2,y:n.y+a-e.height/2}}return n};var Ya=b(x());c();var Xm=b(x());c();var bT=JSON.parse('{"cardWrapper":"cardWrapper_6Hr4m"}');function wT(t){let{item:o}=t;return Xm.createElement(j,{style:[N.padding.mediumHorizontal,N.padding.smallVertical,N.backgroundColor.primaryMain,N.borderRadius.medium,bT.cardWrapper]},o.previewIcon?Xm.createElement(j,{style:[N.margin.mediumRight]},Xm.createElement(v[o.previewIcon].CSS,{style:[N.textColor.primaryTextInside,N.icons.small]})):null,Xm.createElement(pe,{style:[N.text.label,N.textColor.primaryTextInside]},o.previewLabel||"Drop to insert"))}function ST(t){let[o,e]=Ya.useState(null),n=XS(Md,{activationConstraint:{distance:10}}),r=XS(qm,{activationConstraint:{distance:10}}),i=Ya.useCallback(({active:s})=>{window.document.body.classList.add("dragging"),e(s.data.current)},[]),a=Ya.useCallback(()=>{window.document.body.classList.remove("dragging"),e(null)},[]);return Ya.createElement(gT,{sensors:[n,r],onDragStart:i,onDragEnd:a,onDragCancel:a,collisionDetection:QE},t.children,Ya.createElement(Tn,null,Ya.createElement(yT,{modifiers:[vT],dropAnimation:null},o?Ya.createElement(wT,{item:o}):null)))}c();function CT(t){switch(t.type){case"space":return{kind:"space",space:t.id};case"collection":return{kind:"collection",collection:t.id};case"page":return{kind:"page",space:t.space,page:t.id};case"block":case"block-range":case"tab":case"swagger-response":case"swagger-parameter":case"table-record":case"table-definition":throw new Error(`Invalid DND item "${t.type}"`);default:Oe(t)}}c();function Wn(t){return{id:`${t.type}/${t.id}`,data:t}}c();var jS=b(x()),kT=0;function mr(t){let{disabled:o,shouldAccept:e,onDrop:n,onHoverMove:r}=t,i=jS.useMemo(()=>(kT+=1,`${kT}`),[]),a=hT({id:i,disabled:o}),s=jS.useMemo(()=>!a.over||!a.isOver||!a.active?!1:e(a.active.data.current),[a.over,a.isOver,e]);return KS({onDragEnd:l=>{s&&a.active&&n(l.active.data.current)},onDragMove:r?({active:l,over:u})=>{if(!u||u.id!==i||u.disabled||!l.rect.current||l.rect.current.translated===null)return;let d=l.rect.current.translated,p=u.rect,f={x:d.left,y:d.top},m=f.x>p.left+p.width/2?"right":"left",h=f.y>p.top+p.height/2?"bottom":"top";r({item:l.data.current,draggable:d,over:p,xPosition:m,yPosition:h})}:void 0}),{isOver:a.isOver&&s,setNodeRef:a.setNodeRef}}function OT(t){let o=nd(),{navigate:e}=we(),n=go(),r=__(),i=P_(t),a=I_(t),s=Yo(i),l=Ow(a,"create-space"),u=Ow(a,"create-collection")&&L5(t,r);return xT.default.useMemo(()=>({createSpace:l?async(d=!0)=>{let p=await Ms(),f;try{f=(await p.spaces.createSpace(t.organization,{parent:t.collection})).data}catch(m){throw n.notify({title:"Error while creating space",details:ji(m),kind:"danger"}),m}return ne(Dt(f,{type:"space_create"})),d&&e({screen:{type:"space",space:f.id,organization:t.organization,page:""}}),f}:void 0,createCollection:u?async(d=!0)=>{let p=await Ms(),f;try{f=(await p.collections.createCollection(t.organization,{parent:t.collection})).data}catch(m){throw n.notify({title:"Error while creating collection",details:ji(m),kind:"danger"}),m}return ne(t1(f,{type:"collection_create",restricted:!1})),d&&e({screen:{type:"collection",collection:f.id,organization:f.organization}}),f}:void 0}),[t.organization,t.collection,o.uid,s,e,l,u])}function L5(t,o){let e=0,n=t.collection;for(;n;){let r=o.collections.find(i=>i.key===n);n=r?r.collection:void 0,e++}return e{let r=(l,u)=>{let d=to(l,u);if(d!==null)return o({current:$S(d)})},i=(l,u)=>{let d=to(l,u);if(d!==null)return e({current:$S(d)})},a=(l,u={})=>{let{replace:d=!1}=u;t({current:$S(l,u)},{replace:d})};return{getNavigationHref:r,getNavigationProps:i,navigateToPagePath:a,navigateToPage:(l,u,d)=>{let p=to(l,u);p!==null&&a(p,d)}}},[t])}function $S(t,o={}){let{preserveSideSheet:e=!1,preserveComments:n=!0,sideSheet:r}=o;return i=>({page:t,...!e&&!r?{sideSheet:void 0}:{},...r?{sideSheet:r}:{},comments:n&&i.type==="space"&&i.sideSheet?.type==="comments"?{...i.sideSheet,node:void 0}:void 0})}function _T(t){let{to:o}=t;return Py.createElement(ph,{to:{screen:{page:o,sideSheet:void 0}}})}function Fn(t,o,e,n={}){let{document:r,...i}=o,{space:a}=o,{withSearch:s=!0,accept:l=["url","user","anchor","page","space","collection","file"],position:u}=n,d=[];return l.includes("url")&&d.push({key:"url",commands:p=>{let{text:f}=p.query;if(!f||!Bu(f))return[];let m=Mg(f);if(m){let[h]=by.read([e,m,i]),[y]=sa.read([e,h,i]);if(h&&y)return[{key:f,title:y.text,icon:v.ArrowUpRight,trigger:()=>{t(h)}}]}return[{key:f,title:`Link to "${f}"`,icon:v.Link,trigger:()=>{t({kind:"url",url:f})}}]}}),l.includes("anchor")&&r&&!o.snippet&&d.push({key:"anchors",commands:()=>IT(r,{},t)}),l.includes("page")&&o.space&&d.push(RT({spaceId:o.space,changeRequestId:"changeRequest"in o?o.changeRequest:void 0},e,t,{accept:l,withSearch:s,targetCurrentSpace:!0})),l.includes("space")&&d.push({key:"spaces",commands:p=>Tl.read({query:p.query.text,types:["spaces"]}).map(m=>m.index!=="spaces"?null:{key:m.object.objectID,icon:({size:h})=>ZS.createElement(bh,{space:m.object,size:h}),title:m.object.title,trigger:()=>{t({kind:"space",space:m.object.objectID})},descendant:l.includes("page")?()=>ae({search:s?"Select page\u2026":void 0,groups:[RT({spaceId:m.object.objectID,changeRequestId:void 0},e,t,{accept:l,withSearch:s,targetCurrentSpace:m.object.objectID===a})]}):void 0}).filter(se)}),l.includes("collection")&&d.push({key:"collections",commands:p=>Tl.read({query:p.query.text,types:["collections"]}).map(m=>m.index!=="collections"?null:{key:m.object.objectID,title:m.object.title,trigger:()=>{t({kind:"collection",collection:m.object.objectID})}}).filter(se)}),l.includes("user")&&d.push({key:"users",commands:p=>Tl.read({query:p.query.text,hitsPerPage:8,types:["users"]}).map(m=>m.index!=="users"?null:{key:m.object.objectID,icon:({size:h})=>ZS.createElement(Ml,{user:m.object,size:h}),title:m.object.displayName,subtitle:m.object.email,trigger:()=>{t({kind:"user",user:m.object.objectID})}}).filter(se)}),ae({search:s?"Type url or reference\u2026":void 0,groups:d,position:u})}function N5(t,o,e,n,r){return ae({search:"Select page or heading\u2026",groups:[{key:"page",commands:[{key:"pick",title:`Link to "${o.title}"`,icon:v.Page,trigger:()=>{n({kind:"page",page:o.id,space:r.targetCurrentSpace?void 0:t})}}]},{key:"anchors",commands:()=>A5(t,o,e,{page:o.id,space:r.targetCurrentSpace?void 0:t},n)}]})}function RT(t,o,e,n){let{accept:r,withSearch:i,targetCurrentSpace:a}=n;return{key:"space",commands:()=>{let s=Xr(o.store.getBranchRevision(t.spaceId,t.changeRequestId?Eg(t.changeRequestId):_g));return s?Object.values(s.pages).filter(l=>l.type!=="link").map(l=>({key:l.id,title:l.title,subtitle:to(s,l.id),icon:l.type==="group"?v.AddPageGroup:v.Page,trigger:()=>{e({kind:"page",page:l.id,space:a?void 0:t.spaceId})},descendant:r&&r.includes("anchor")&&l.type==="document"?()=>({...N5(t.spaceId,l,o,e,{targetCurrentSpace:a}),...i?{}:{search:void 0}}):void 0})):[]}}}function A5(t,o,e,n,r){if(!o.document)return[];let i=Xr(e.store.getDocument(t,o.document));return i?IT(i,n,r):[]}function IT(t,o,e){return xg(t).filter(r=>!!r.anchor).map(r=>{let i=(()=>{switch(r.type){case Ve:return v.Heading1;case Ge:return v.Heading2;case tt:return v.Heading3;case Eo:return v.Swagger;case Ur:return v.BlockExpandable;case Or:case ir:return v.Tabs;case null:return v.Hash;default:Oe(r.type)}})();return{key:r.key,icon:i,title:r.title,trigger:()=>{e({kind:"anchor",anchor:r.anchor,...o})}}})}c();var Nd=b(x());c();var Yl=b(x()),PT=b(z());function Ld(t){let{file:o,size:e=M.ICON_M}=t,[,n]=_(B5);return Yl.createElement(PT.View,{style:[n.fileTileIcon,{width:e,height:e}]},o&&fc(o)?Yl.createElement(jo,{style:n.fileTilePreview,source:{uri:na(o.downloadURL,{width:e})},accessibilityLabel:o.name}):Yl.createElement(D5,{file:o,size:e*.65}))}function D5(t){let{file:o,...e}=t;return o?Xu(o)?Yl.createElement(v.Swagger,{...e}):Yl.createElement(v.Paperclip,{...e}):Yl.createElement(v.Trashcan,{...e})}var B5=F.create({fileTileIcon:t=>({backgroundColor:t.colors.background.muted,color:t.colors.text.muted,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:M.RADIUS_M}),fileTilePreview:{width:"100%",height:"100%",resizeMode:"cover",borderRadius:M.RADIUS_M,objectFit:"contain"}});function JS(t){let{navigate:o,getNavigationURL:e}=we(),n=Ce(),r=lt(),[i,a]=Nd.useState(""),s=t.map(h=>[n,h,r,i]),l=sa.readMultiple(s),u=sa.readCacheUpdatesKey(s),d=x_(l.map(h=>h[1]).flat()),p=Zt(),f=NI(p?.dataSync),m=typeof f<"u"?`${f}`:"";return Nd.useEffect(()=>{a(`${d}${m}`)},[d,m]),Nd.useMemo(()=>l.map(([h,y,S],C)=>{let k=t[C];return h?{title:h.text,icon:W5(k,h),secondaryIcon:z5(k),secondaryIconDescription:F5(k,h),href:typeof h.target=="string"?h.target:e({screen:h.target}),open:()=>{typeof h.target=="string"?lh(h.target):o({screen:h.target})},resolution:h}:{title:S?"Access denied":"Broken link",icon:void 0,href:"",open:()=>{}}}),[u,e,o])}function Qe(t){return JS(t?[t]:[])[0]||{title:"Broken link",icon:null,href:"",open:()=>{}}}function W5(t,o){if(t.kind==="url")return v.ExternalLink;if(o.extra?.user)return mt(Ml,{user:o.extra.user});if(o.extra?.file)return mt(Ld,{file:o.extra.file});if(o.extra?.space)return mt(bh,{space:o.extra.space});if(o.extra?.page&&o.extra.page.emoji)return mt(Lo,{code:o.extra.page.emoji})}function z5(t){switch(t.kind){case"user":return v.AtSign;case"anchor":return v.Hash;case"page":return v.Page;case"space":return v.Space;case"collection":return v.Collection;case"url":return v.ExternalLink}}function F5(t,o){switch(t.kind){case"user":return"User mention";case"anchor":return"Link to a page's anchor";case"page":return"Link to a page";case"space":return"Link to a space";case"collection":return"Link to a acollection";case"url":return"External URL"}}function Ty(t){let{label:o,labelDescription:e,value:n,onChangeValue:r,placeholder:i,accept:a,size:s="large",disabled:l=!1}=t,[u,d]=yt.useState(!1),[p,f]=yt.useState(!1),[m,h]=yt.useState(""),y=yt.useRef(null),S=yt.useRef(null),[,C]=_(q5),k=le(y),O=Ce(),R=lt();yt.useEffect(()=>{if(!m||!u||u&&!p){k.close();return}k.opened?k.typeQuery(m):k.open(ed(Fn(P=>{r(P),f(!1),S.current&&S.current.blur()},R,O,{withSearch:!1,position:{width:"anchor"},accept:a}),m))},[m,u]),yt.useEffect(()=>{u&&S.current&&S.current.focus()},[u]);let I=P=>{h(P),f(!0)},E=()=>{m||(f(!1),r()),Bu(m)&&(r({kind:"url",url:m}),f(!1)),d(!1)};return yt.createElement(Ys.View,null,o?yt.createElement(Ys.View,{style:g.Margin.smallBottom},yt.createElement(Qu,null,o),e?yt.createElement(Ys.View,{style:g.Margin.xsmallTop},yt.createElement(eh,null,e)):null):null,u||!n?yt.createElement(oo,{testID:"contentRef.input",ref:S,wrapperRef:y,size:s,value:m,onChangeText:I,onBlur:E,onFocus:()=>d(!0),placeholder:i,disabled:l}):yt.createElement(Ys.TouchableOpacity,{testID:"contentRef.fakeInput",onPress:()=>d(!0),style:[C.input,J1[s],w.directionRow,w.alignCenter]},yt.createElement(yt.Suspense,{fallback:yt.createElement(Re,{size:"small"})},yt.createElement(V5,{value:n,size:s}))))}function V5(t){let{value:o,size:e}=t,[,n]=_(D),r=Qe(o);return yt.createElement(Ys.View,{style:[w.flex1,w.directionRow,w.alignCenter]},r.icon?yt.createElement(Ys.View,{style:[g.Margin.smallRight]},yt.createElement(r.icon,{size:M.ICON_S,style:n.textMuted})):null,yt.createElement(Ys.View,{style:[w.flex1]},yt.createElement($r,{style:[Z1[e],n.text],testID:"contentRef.resolvedTitle"},r.title)))}var q5=F.create({input:t=>({backgroundColor:t.colors.background.main,borderWidth:1,borderColor:t.colors.border.main})});c();async function ET(t,o,e){let[n]=await sa.readAsync([t,o,e]);return{uri:n?.target}}function My(t,o){let n=(Rs().color==="light"?null:o)||t,r=Qe(n);if(!r.href)return null;let i=r.resolution?.extra?.file;return{uri:r.href,width:i?.dimensions?.width,height:i?.dimensions?.height}}c();function Vc(t,o){return{href:t.href,onPress:e=>{if(o&&o(e),e){if(e.isDefaultPrevented()||e.nativeEvent.metaKey||e.nativeEvent.ctrlKey)return;e.preventDefault()}t.open()}}}c();var QS=b(x());function TT(t){let{block:o,style:e,size:n=M.ICON_M}=t;return o.icon?QS.createElement(jo,{source:{uri:na(o.icon,{width:n})},style:[{width:n,height:n,borderRadius:n/8}]}):QS.createElement(v.Integrations,{size:n,style:e})}c();c();var Ar=b(x());c();var Gc=b(x());c();var wo=b(x()),$l=b(z());c();var Ly=b(x()),MT=b(z());function LT(t){let{description:o,readOnly:e,blockProps:n}=t,{node:r}=n;return!o||e&&"fragment"in o&&xs(r.fragments.get(o.fragment))?null:Ly.createElement(MT.View,{style:g.Margin.mediumTop},"text"in o?Ly.createElement(od,{markdown:o.text}):Ly.createElement(ur,{fragment:o.fragment}))}c();var Um=b(x()),NT=b(z());c();var jl={get:Z.primary.base,post:Z.green.base,put:Z.orange.base,options:Z.violet.base,head:Z.orange.base,delete:Z.scarlet.base,patch:Z.orange.base,connect:Z.orange.base,trace:Z.orange.base};var G5=J.createResponsiveComponent(Ir);function Ny(t){let{readOnly:o,method:e,setMethod:n}=t,[,r]=_(D),[,i]=_(H5),a=Um.default.useRef(null),s=le(a),l=ae({groups:[{key:"methods",commands:sd.map(p=>({key:p,title:p.toUpperCase(),trigger:()=>{n&&n(p)}}))}]}),u=()=>{s.open(l)},d=Um.default.createElement(G5,{style:i.badge,backgroundColor:jl[e]||Z.orange.base,mobileStyle:[i.mobileMethodBadge],desktopStyle:[i.httpMethodBadge]},Um.default.createElement(J.Text,{desktopStyle:[r.GroupTitle,r.Bold],mobileStyle:[r.MobileCaption,r.Bold],style:[r.textInsideColor,r.Bold,r.Uppercase]},e));return o?d:Um.default.createElement(NT.TouchableOpacity,{ref:a,onPress:u},d)}var H5=F.create({badge:{width:"fit-content"},httpMethodBadge:{borderRadius:M.XS,height:M.XS,paddingHorizontal:g.small,justifyContent:"center"},mobileMethodBadge:{borderRadius:M.XXS,height:M.XXS,paddingHorizontal:g.small,justifyContent:"center"}});var AT=J.createResponsiveComponent(V.View),K5=J.createResponsiveComponent(V.View.Child);function DT(t){let{readOnly:o,blockProps:e,baseUrl:n,summary:r,path:i,method:a,description:s,opened:l,setOpened:u}=t,{node:d,editor:p}=e,[,f]=_(D),m=wo.default.useRef(),h=wo.default.useRef(),y=wo.default.useRef();function S(){u(!l)}let C=V.useInteractiveComponent(l?v.ChevronDown:v.ChevronRight);return wo.default.createElement($l.View,{style:[w.directionColumn,w.flex1,g.Padding.smallBottom]},wo.default.createElement(J.View,{style:[w.alignCenter,g.Padding.medium,w.wrap],mobileStyle:w.flex1,desktopStyle:w.directionRow},wo.default.createElement(V.TouchableOpacity,{style:g.Padding.mediumRight,onPress:S},wo.default.createElement(C.Child,{size:M.ICON_M,style:f.textMuted,activeStyle:f.primary})),wo.default.createElement($l.View,{style:[g.Margin.mediumRight]},wo.default.createElement(Ny,{readOnly:o,method:a,setMethod:k=>{p.change(O=>{Pe.setMethod(O,d.key,k)})}})),wo.default.createElement(AT,{style:[w.wrap],mobileStyle:[w.flex1]},wo.default.createElement(Zr,{ref:m,component:qs,value:n,placeholder:"https://api.gitbook.com/v1",onChangeText:k=>{p.change(O=>{Pe.setBaseUrl(O,d.key,k)})},style:[f.Label,f.textMuted,Ay.breakWord],selectTextOnFocus:!0,readOnly:o,onSubmitEditing:()=>{h.current&&h.current.focus()}})),wo.default.createElement(AT,{style:[w.directionRow],mobileStyle:[Ay.mobileEndpoint,g.Padding.xsmallTop]},wo.default.createElement(Zr,{ref:h,component:qs,value:i,placeholder:"/users",onChangeText:k=>{p.change(O=>{Pe.setPath(O,d.key,k)})},style:[f.Label,f.text,f.Bold,Ay.breakWord],selectTextOnFocus:!0,readOnly:t.readOnly,onSubmitEditing:()=>{y.current&&y.current.focus()}}),wo.default.createElement(K5,{style:[g.Margin.xsmallLeft,je.hidden],hoverStyle:[je.visible],mobileStyle:{display:"none"}},wo.default.createElement(Xg,{size:"xsmall",content:`${n}${i}`})))),wo.default.createElement($l.View,{style:Ay.headerBody},wo.default.createElement($l.View,null,wo.default.createElement(Zr,{ref:y,component:qs,value:r,placeholder:"Operation summary",onChangeText:k=>{p.change(O=>{Pe.setSummary(O,d.key,k)})},style:[f.Heading3,f.text],readOnly:o,displayMode:"block",onSubmitEditing:()=>{p.change(k=>{if(l&&s&&"fragment"in s){let O=d.fragments.get(s.fragment);O&&k.collapseToStartOf(O)}else wt(k,d);k.focus()})}})),l?wo.default.createElement(LT,{readOnly:o,description:s,blockProps:e}):null))}var Ay=$l.StyleSheet.create({breakWord:{wordWrap:"anywhere"},mobileEndpoint:{paddingLeft:g.medium+M.ICON_M,flexBasis:"100%",flexGrow:1},headerBody:{paddingLeft:g.medium+M.ICON_M+g.medium}});c();var Zm=b(x());c();var Ym=b(x()),BT=b(z());function WT(t){let{blockProps:o}=t,{editor:e,node:n}=o,r=Ym.useRef(null),i=le(r),a=ae({groups:[{key:"parameters",commands:eC.map(({location:l,title:u,description:d})=>({key:l,title:u,subtitle:d,trigger:()=>{e.change(p=>{Pe.addParameter(p,n.key,l)})}}))}]}),s=()=>{i.open(a)};return Ym.createElement(BT.View,null,Ym.createElement(W,{ref:r,title:"Add Parameter",icon:i.opened?v.X:v.Plus,kind:i.opened?"primary":"secondary",size:"small",rounded:!0,onPress:()=>s()}))}var eC=[{location:"path",title:"Path",description:"Params in the URL path"},{location:"query",title:"Query",description:"Params in the query string"},{location:"header",title:"Header",description:"Params sent in headers"},{location:"cookie",title:"Cookie",description:"Params set via cookie"},{location:"body",title:"Body",description:"Params passed in body"}];c();var jm=b(x()),$m=b(z());c();var So=b(x()),Bd=b(z());c();var hn=b(x()),Ad=b(z());var zT=V.createInteractiveHandle("swagger-row");function Dy(t){let{dragItem:o,columns:e,isLast:n,children:r,palette:i,onDropBefore:a,onDropAfter:s,onInsertBefore:l,onInsertAfter:u,readOnly:d,opened:p,setOpened:f,node:m,ancestors:h}=t,[,y]=_(X5),S=Dd({node:m,ancestors:h}),C=gn({disabled:t.readOnly,...Wn(o)}),k=mr({shouldAccept:P=>o.type!==P.type?!1:o.id!==P.id&&o.blockKey===P.blockKey,onDrop:P=>{a(P)}}),O=mr({shouldAccept:P=>o.type!==P.type?!1:o.id!==P.id&&o.blockKey===P.blockKey,onDrop:P=>{s(P)}}),R=hn.useRef(null),I=Si(R,C.setNodeRef),E=le(R);return hn.createElement(Ad.View,null,hn.createElement(Ad.View,null,hn.createElement(V.View,{handle:zT,style:[w.directionRow,w.alignCenter,g.Padding.largeRight,C.isDragging?je.translucent:je.visible]},d?null:hn.createElement(J.View,{style:[w.justifyContentCenter,S.controlButtons?.position],mobileStyle:"hidden"},hn.createElement(V.View.Child,{descendantOf:zT,activeStyle:je.visible,inactiveStyle:E.opened?{}:je.hidden},hn.createElement(W,{ref:I,icon:v.GrabberVertical,size:S.controlButtons?.size,rounded:!0,kind:"secondary",title:`Click for options. Drag to move.`,onPress:()=>{E.open(i())},...C.listeners}))),hn.createElement(J.View,{style:[w.flex1,w.directionRow],mobileStyle:[w.wrap,w.alignStart,g.Padding.smallVertical],desktopStyle:[w.alignStart,g.Padding.mediumVertical]},e.map((P,L)=>hn.createElement(J.View,{key:L,style:[g.Padding.smallRight],desktopStyle:[P.desktopSize],mobileStyle:[y.columnResetWidth,P.mobileSize]},P.content))),r&&f?hn.createElement(Ad.View,{style:[g.Margin.mediumLeft]},hn.createElement(W,{icon:p?v.ChevronDown:v.ChevronRight,onPress:()=>f(!p)})):null),p?hn.createElement(Ad.View,null,r):null,n?null:hn.createElement(Ad.View,{style:y.borderLine})),d?null:hn.createElement(am,{ref:k.setNodeRef,position:"top",dropHovered:k.isOver,button:{kind:"secondary",icon:v.Plus,onPress:l}}),n&&!d?hn.createElement(am,{ref:O.setNodeRef,position:"bottom",dropHovered:O.isOver,button:{kind:"secondary",icon:v.Plus,onPress:u}}):null)}var X5=F.create({borderLine:t=>({height:1,backgroundColor:t.colors.border.muted}),controlButtonWrapper:{position:"absolute",top:0,bottom:0,left:-M.BUTTON_S/2,width:M.BUTTON_S},columnResetWidth:{width:"auto"}});c();var Zl=b(x()),qc=b(z());function By(t){let{title:o,button:e,children:n}=t,[,r]=_(D);return Zl.createElement(qc.View,{style:g.Margin.largeTop},Zl.createElement(qc.View,{style:[w.directionRow,w.alignCenter,g.Padding.mediumBottom]},Zl.createElement(qc.View,{style:w.flex1},Zl.createElement(qc.Text,{style:[r.Heading3,r.text]},o)),e?Zl.createElement(qc.View,{style:g.Padding.smallHorizontal},e):null),Zl.createElement(qc.View,null,n))}function Wy(t){let{readOnly:o,blockProps:e,parameter:n,isLast:r,beforeOrderIndex:i,afterOrderIndex:a}=t,{node:s,editor:l}=e,[,u]=_(D),d=So.useRef(),p={id:n.key,type:"swagger-parameter",blockKey:s.key,previewLabel:"Move parameter"},{name:f="",type:m="",required:h,description:y,properties:S={},items:C}=n.value,[,k]=_(j5),[O,R]=So.useState(!1),I=Object.keys(S).length,E=I>0||!!C,P=s.fragments.get(n.key),L=Y=>{l.change(X=>{Pe.setParameterName(X,s.key,n.key,Y)})},T=Y=>{l.change(X=>{Pe.setParameterType(X,s.key,n.key,Y)})},H=Y=>{l.change(X=>{Pe.setParameterRequired(X,s.key,n.key,Y)})},U=()=>{l.change(Y=>{Pe.removeParameter(Y,s.key,n.key)})},K=m==="object"&&I>0?Object.entries(S).map(([Y,X],re)=>So.createElement(Wy,{key:Y,...t,isLast:re===I-1,parameter:{key:Y,value:X}})):m==="array"&&C?So.createElement(Wy,{...t,isLast:!0,parameter:{key:"items",value:C}}):null;return So.createElement(Dy,{...E?{opened:O,setOpened:R}:{},...e,readOnly:t.readOnly,dragItem:p,isLast:r,palette:()=>ae({groups:[{key:"edit-parameter",commands:[{key:"delete-parameter",title:"Delete",icon:v.Trashcan,trigger:U}]}]}),columns:[{content:o?So.createElement(Bd.Text,{selectable:!0,style:[u.Code,u.textMid]},f,h?So.createElement(Bd.Text,{style:[u.danger]},"*"):null):So.createElement(qs,{placeholder:"id",onChangeText:L,value:f,style:[u.Code,u.textMid],selectTextOnFocus:!0,displayMode:"block",onSubmitEditing:()=>{d.current&&d.current.focus()}}),desktopSize:k.parameterColumnNameDesktop,mobileSize:k.parameterColumnNameMobile},{content:So.createElement(qs,{ref:d,placeholder:"String",onChangeText:T,value:m,style:[u.Label,u.textMid],readOnly:o,selectTextOnFocus:!0,displayMode:"block",onSubmitEditing:()=>{l.change(Y=>{P&&Y.collapseToStartOf(P).focus()})}}),desktopSize:k.parameterColumnTypeDesktop,mobileSize:k.parameterColumnTypeMobile},{content:So.createElement(So.Fragment,null,y?So.createElement(Bd.Text,{style:[u.Label,u.textMid]},y):P?So.createElement(Lr.Provider,{value:"swaggerParameter"},So.createElement(ur,{fragment:n.key})):null),desktopSize:w.flex1,mobileSize:!y&&(!P||P.isEmpty)?k.parameterDescriptionEmptyColumnMobile:null},o?null:{content:So.createElement(c_,{value:h?"required":"optional",items:[{label:"Required",value:"required"},{label:"Optional",value:"optional"}],onValueChange:Y=>H(Y==="required")})}].filter(se),onInsertBefore:()=>{l.change(Y=>{Pe.addParameter(Y,s.key,n.value.in,{before:i,after:n.value.orderIndex})})},onDropBefore:Y=>{l.change(X=>{Pe.moveParameter(X,s.key,Y.id,n.value.in,{before:i,after:n.value.orderIndex})})},onInsertAfter:()=>{l.change(Y=>{Pe.addParameter(Y,s.key,n.value.in,{before:n.value.orderIndex,after:a})})},onDropAfter:Y=>{l.change(X=>{Pe.moveParameter(X,s.key,Y.id,n.value.in,{after:a,before:n.value.orderIndex})})}},K&&So.createElement(Bd.View,{style:[k.borderTop]},K))}var j5=F.create({parameterColumnNameDesktop:{width:200},parameterColumnNameMobile:{flexGrow:1,flexShrink:1,flexBasis:"50%",marginBottom:g.small},parameterColumnTypeDesktop:{width:90},parameterColumnTypeMobile:{flexGrow:1,flexShrink:1,flexBasis:"50%"},parameterDescriptionEmptyColumnMobile:{display:"none"},borderTop:t=>({borderTopWidth:1,borderTopColor:t.colors.border.muted})});function FT(t){let{parametersGroup:o,location:e,isLast:n,...r}=t,[,i]=_(D),a=eC.find(({location:s})=>s===e);return jm.createElement($m.View,{style:g.Margin.smallTop},jm.createElement($m.View,null,jm.createElement($m.Text,{style:[i.Label,i.Bold,i.text]},a.title)),o.map((s,l)=>{let u=o[l-1],d=o[l+1],p=l===o.length-1;return jm.createElement(Wy,{key:s.key,...r,parameter:s,isLast:p,beforeOrderIndex:u?.value.orderIndex,afterOrderIndex:d?.value.orderIndex})}))}function VT(t){let{parameters:o,readOnly:e,blockProps:n}=t,r=$5(o),i=Object.keys(r).length,a=Pe.SORTED_PARAMETERS_LOCATIONS.filter(s=>!!r[s]);return Zm.createElement(By,{title:"Parameters",button:t.readOnly?null:Zm.createElement(WT,{blockProps:n})},a.length>0?a.map((s,l)=>{let u=r[s];return Zm.createElement(FT,{key:s,readOnly:e,blockProps:n,location:s,parametersGroup:u,isLast:l===i-1})}):Zm.createElement(pe,null,"No parameters"))}function $5(t){return t.reduce((o,e)=>{let n=o[e.value.in]||[];return o[e.value.in]=[...n,e],o},{})}c();var Jm=b(x()),YT=b(z());c();var zy=b(KT());var tW={2:Z.green.base,3:Z.primary.base,4:Z.orange.base,5:Z.scarlet.base},oW=Object.entries(zy.message).map(([t,o])=>({code:t,message:o})),nW=new td(oW,{shouldSort:!0,threshold:.4,distance:100,keys:[{name:"code",weight:.6},{name:"message",weight:.4}]});function oC(t){return tW[Math.floor(t/100)]||Z.lightModeGreyScale.dark}function rW(t){return nW.search(t).map(o=>o.item)}function nC({code:t,message:o}){let e=o||zy.message[t];return e?`${t}: ${e}`:`${t}`}function UT(t){let[o,e]=t.split(": ");return{code:Number(o),message:e}}var XT=[200,201,204,400,401,403,404,500].map(t=>{let o=String(t),e=zy.message[o];return{code:o,message:e}});function Fy(t,o){let e={key:"responses",commands:r=>(r.query.text?rW(r.query.text):XT).slice(0,XT.length).map(a=>{let s=nC(a);return{key:a.code,title:s,icon:mt(v.Dot,{style:{color:oC(parseInt(a.code,10))}}),trigger:()=>{t(s)}}})},n=o?[{key:"edit-response",commands:[{key:"delete-response",title:"Delete response",icon:v.Trashcan,trigger:()=>{o()}}]},e]:[e];return ae({search:"Type status code\u2026",groups:n})}function jT(t){let{blockProps:o}=t,{node:e,editor:n}=o,r=Jm.useRef(null),i=le(r),a=Fy(l=>{n.change(u=>{Pe.addResponse(u,e.key,l)})}),s=()=>{i.open(a)};return Jm.createElement(YT.View,null,Jm.createElement(W,{ref:r,title:"Add Response",icon:i.opened?v.X:v.Plus,kind:i.opened?"primary":"secondary",size:"small",rounded:!0,onPress:()=>s()}))}c();var yn=b(x()),$s=b(z());c();var js=b(x()),oM=b(z());c();var Jl=b(x());function $T(t){let{examples:o}=t,e=Object.keys(o),n=Jl.useRef(null),r=le(n),[i,a]=Jl.useState(e[0]);return i?Jl.createElement(X1,{code:o[i],syntax:iW(i),showToolbar:r.opened,toolbar:e.length>1?Jl.createElement(W,{kind:"secondary",size:"small",ref:n,rightIcon:v.ChevronDown,onPress:()=>{r.open(ae({groups:[{key:"media-types",commands:e.map(s=>({key:s,title:s,trigger:()=>{a(s)}}))}]}))}},i):null}):null}function iW(t){return t.includes("json")?"js":t.includes("xml")?"xml":"js"}c();var Te=b(x()),Co=b(z());function ZT(t){let[,o]=_(tM);return Te.createElement(Co.ScrollView,{style:[o.container],horizontal:!0},Te.createElement(rC,{...t,isRoot:!0}))}function rC(t){let{schema:o}=t;if(o.type){let e=o.description||o.title;switch(o.type){case"object":return Te.createElement(JT,{name:"",properties:o.properties,requiredProperties:o.required,description:e,...t});case"array":return Te.createElement(QT,{name:"",items:o.items,description:e,...t});default:return Te.createElement(eM,{name:"",type:o.type,description:e,...t})}}else return o.anyOf?Te.createElement(Vy,{type:"anyOf",options:o.anyOf}):o.oneOf?Te.createElement(Vy,{type:"oneOf",options:o.oneOf}):o.allOf?Te.createElement(Vy,{type:"allOf",options:o.allOf}):null}function JT(t){let{name:o,isRequired:e=!1,isRoot:n=!1,properties:r={},requiredProperties:i=[],description:a=""}=t,[s,l]=Te.useState(!1);return Te.createElement(Gy,{name:o,type:"object",expandable:{expanded:s,setExpanded:l},required:e,isRoot:n,description:a},s?Object.entries(r).map(([u,d])=>{switch(d.type){case"object":let p=d.anyOf||d.oneOf||d.allOf;return p?Te.createElement(Vy,{key:u,name:u,description:d.description||d.title,type:d.anyOf?"anyOf":d.oneOff?"oneOf":"allOf",options:p}):Te.createElement(JT,{key:u,name:u,properties:d.properties,requiredProperties:d.required,isRequired:i.includes(u),description:d.description});case"array":return Te.createElement(QT,{key:u,name:u,items:d.items,isRequired:i.includes(u),description:d.description});default:return Te.createElement(eM,{key:u,name:u,type:d.type,isRequired:i.includes(u),description:d.description})}}):null)}function QT(t){let{name:o,isRequired:e=!1,isRoot:n=!1,items:r={},description:i=""}=t,[a,s]=Te.useState(!1);return Te.createElement(Gy,{name:o,type:`array[${r.type||""}]`,expandable:{expanded:a,setExpanded:s},description:i,required:e,isRoot:n},a?Te.createElement(rC,{schema:r}):null)}var qy=M.ICON_S;function Vy(t){let{name:o,type:e,options:n=[],isRoot:r=!1,description:i="",isRequired:a=!1}=t,[s,l]=Te.useState(!1);return Te.createElement(Gy,{type:o?e:"",name:o||e,expandable:{expanded:s,setExpanded:l},description:i,isRoot:r,required:a,specialKeyword:!0},s?n.map((u,d)=>Te.createElement(rC,{key:d,schema:u})):null)}function eM(t){let{name:o,type:e,isRequired:n=!1,isRoot:r=!1,description:i=""}=t;return Te.createElement(Gy,{name:o,type:e,isRoot:r,required:n,description:i})}function Gy(t){let{name:o,type:e,description:n,required:r,isRoot:i,expandable:a,specialKeyword:s,children:l}=t,[,u]=_(D),[,d]=_(tM),p=[u.Body,u.Bold,u.text],f=[g.Margin.xsmallLeft];return Te.createElement(Co.View,{style:[w.directionColumn,i?null:g.Margin.mediumTop]},Te.createElement(Co.View,{style:[w.directionRow,w.alignCenter]},Te.createElement(Co.TouchableOpacity,{onPress:a?()=>a.setExpanded(m=>!m):void 0},a?a.expanded?Te.createElement(v.ChevronDown,{size:qy,style:[u.textMuted]}):Te.createElement(v.ChevronRight,{size:qy,style:[u.textMuted]}):Te.createElement(Co.View,{style:[d.placeholderIconWidth,d.placeHolderIconHeight]})),Te.createElement(Co.View,{style:[w.directionRow,f]},o?Te.createElement(Co.View,{style:[g.Margin.mediumRight]},s?Te.createElement(Co.Text,{style:p},o):Te.createElement(Co.Text,{selectable:!0,style:p},o,r?Te.createElement(Co.Text,{style:[u.danger,d.textFontCode]},"*"):null)):null,e?Te.createElement(Co.Text,{style:[u.Body,u.primary,d.textFontCode]},e):null)),Te.createElement(Co.View,{style:[w.directionRow]},Te.createElement(Co.View,{style:d.placeholderIconWidth},a?.expanded?Te.createElement(Co.View,{style:d.verticalLine}):null),Te.createElement(Co.View,{style:[w.directionColumn,f,g.Padding.mediumRight,d.descriptionWidth]},n?Te.createElement(Co.View,{style:[g.Margin.xsmallTop]},Te.createElement(od,{markdown:n,kind:"secondary"})):null,l)))}var tM=F.create({container:t=>({backgroundColor:t.colors.background.muted,padding:g.medium,borderRadius:t.radiuses.medium}),textFontCode:{fontFamily:zg},placeholderIconWidth:{width:qy},placeHolderIconHeight:{height:qy},verticalLine:t=>({width:1,height:"100%",backgroundColor:t.colors.border.main,marginHorizontal:"auto"}),descriptionWidth:{maxWidth:600}});function Hy(t){let{examples:o,schema:e}=t,[n,r]=js.useState("example");return js.createElement(oM.View,null,js.createElement(Cc,null,js.createElement(Cc.Tab,{active:n==="example",onPress:()=>r("example")},"Example"),e?js.createElement(Cc.Tab,{active:n==="schema",onPress:()=>r("schema")},"Schema"):null),n==="example"?js.createElement($T,{examples:o||{}}):null,n==="schema"&&e?js.createElement(ZT,{schema:e}):null)}function rM(t){let{response:o,isLast:e,beforeOrderIndex:n,afterOrderIndex:r,blockProps:i}=t,{node:a,editor:s}=i,[,l]=_(D),[u,d]=yn.useState(!1),p={id:o.key,type:"swagger-response",blockKey:a.key,previewLabel:"Move response"},{status:f,description:m}=o.value,h="Response description",{code:y}=UT(f),S=a.fragments.get(o.key),C=S?xs(S):!1,k=o.value.examples||{},O=o.value.schema,R=!t.readOnly||S&&!C||Object.keys(k).length>0||typeof O<"u",I=E=>{s.change(P=>{Pe.setResponseDescription(P,a.key,o.key,E)})};return yn.createElement(Dy,{...i,readOnly:t.readOnly,dragItem:p,isLast:e,opened:u,setOpened:d,palette:()=>Fy(E=>{s.change(P=>{Pe.setResponseStatus(P,a.key,o.key,E)})},()=>{s.change(E=>{Pe.removeResponse(E,a.key,o.key)})}),columns:[{content:yn.createElement($s.View,{style:[w.directionRow,w.alignCenter]},yn.createElement($s.View,{style:[g.Margin.smallRight]},yn.createElement(v.Dot,{style:{color:oC(y)},size:M.ICON_M})),yn.createElement($s.View,{style:w.flex1},yn.createElement($s.Text,{style:[l.Label,l.Bold,l.text]},f))),desktopSize:nM.responseColumnStatusDesktop,mobileSize:nM.responseColumnStatusMobile},{content:yn.createElement(Zr,{component:qs,placeholder:t.readOnly?void 0:h,onChangeText:I,value:m,style:[l.Label,l.textMid],readOnly:t.readOnly,displayMode:"block",onSubmitEditing:()=>{s.change(E=>{u&&S?E.collapseToStartOf(S):wt(E,a),E.focus()})}}),desktopSize:w.flex1}],onDropAfter:E=>{s.change(P=>{Pe.moveResponse(P,a.key,E.id,{before:o.value.orderIndex,after:r})})},onDropBefore:E=>{s.change(P=>{Pe.moveResponse(P,a.key,E.id,{before:n,after:o.value.orderIndex})})},onInsertBefore:()=>{s.change(E=>{Pe.addResponse(E,a.key,parseInt(o.value.status,10)-1,{before:n,after:o.value.orderIndex})})},onInsertAfter:()=>{s.change(E=>{Pe.addResponse(E,a.key,parseInt(o.value.status,10)+1,{before:o.value.orderIndex,after:r})})}},R?yn.createElement($s.View,{style:[w.flex1,g.Margin.mediumVertical]},S?yn.createElement(yn.Fragment,null,yn.createElement(Lr.Provider,{value:"swaggerResponse"},yn.createElement(ur,{fragment:o.key}))):yn.createElement(Hy,{examples:k,schema:O})):null)}var nM=$s.StyleSheet.create({responseColumnStatusDesktop:{width:290},responseColumnStatusMobile:{flexBasis:"100%",flexGrow:1,flexShrink:0}});c();var Qm=b(x()),iM=b(z());function aM(t){let{readOnly:o,responses:e,blockProps:n}=t;return Qm.createElement(By,{title:"Responses",button:o?null:Qm.createElement(jT,{blockProps:n})},Qm.createElement(iM.View,{style:e.length>0&&g.Padding.mediumBottom},e.map((r,i)=>{let a=e[i-1],s=e[i+1];return Qm.createElement(rM,{key:r.key,...t,response:r,isLast:i===e.length-1,beforeOrderIndex:a?.value.orderIndex,afterOrderIndex:s?.value.orderIndex})})))}c();var Do=b(x()),Nr=b(z());c();c();c();var sM=$g("429837f8b383ed2c4f85d02026ce73e42335b6233c1dc303af2b0f50fedfe256",()=>import("https://app.gitbook.com/public/app/chunks/parseSwaggerFile.lazy-MPU27FQE.min.js"));var cM=sM;var Ql=nr({getValue:async t=>{let o=(await cM.load()).default;return await o(t)},toJS:t=>sW(t),fromJS:t=>cW(t)});function ef(t,o){if(!t)return null;o||(o={path:Object.keys(t.paths)[0],method:"get"},o.method=Object.keys(t.paths[o.path])[0]);let n=t.paths[o.path]?.[o.method];if(!n)return null;let r=Object.keys(t.paths).indexOf(o.path),i=sd.indexOf(o.method);return i=i>-1?i:sd.length,{operation:n,path:o.path,httpMethod:o.method,index:r*sd.length+i}}function sW(t){return JSON.parse(JSON.stringify(t,z_()))}function cW(t){return JSON.parse(JSON.stringify(t),F_())}function tf(t){let{onClose:o,data:e,multi:n,buttonText:r,onSelect:i,onRequestChangeSource:a}=t,s=Ce();if(!("ref"in e))throw new Error("SwaggerConfigurationOperation used with a manual API block, only OpenAPI is supported");let l=lt(),[u]=sa.read([s,e.ref,l]);if(typeof u?.target!="string")throw new Error("SwaggerConfigurationOperation only handles refs with target as string");let{result:d}=Ql.readSafe(u.target),p=d?.paths||{},f=Object.keys(p).reduce((k,O)=>{let R=p[O];return k.concat(Object.keys(R).map(I=>({path:O,method:I})))},[]),m=ef(d,e.method&&e.path?{method:e.method,path:e.path}:void 0),[h,y]=Do.default.useState(m?{[m.index]:{path:m.path,method:m.httpMethod}}:{}),S=()=>{let k=Object.keys(h).map(Number).sort((O,R)=>O-R);i(k.map(O=>h[O])),o()},C=(k,O,R)=>{if(!n){y({[O]:k});return}if(R&&y({...h,[O]:k}),!R){let I={...h};delete I[O],y(I)}};return Do.default.createElement(yo,{onClose:o,title:"Choose API operation",footer:Do.default.createElement(Nr.View,{style:[w.directionRow,w.justifySpaceBetween]},Do.default.createElement(Nr.View,{style:[w.directionRow,w.justifyContentStart]},a?Do.default.createElement(W,{size:"large",kind:"secondary",onPress:()=>{a()}},"Change API source"):null),Do.default.createElement(Nr.View,{style:[w.directionRow,w.flex1,w.justifyContentEnd]},Do.default.createElement(W,{size:"large",kind:"primary",onPress:()=>{S()}},typeof r=="string"?r:r(Object.keys(h).length))))},Do.default.createElement(Nr.FlatList,{data:f,renderItem:({item:k})=>{let O=ef(d,k);if(!O)return null;let R=!!h[O.index];return Do.default.createElement(lW,{key:O.index,index:O.index,item:k,operation:O.operation,multi:n,selected:R,onSelect:C})}}))}function lW(t){let{item:o,selected:e,onSelect:n,operation:r,index:i,multi:a}=t,[,s]=_(D);return Do.default.createElement(Es,{style:g.Padding.smallHorizontal,onPress:()=>n(o,i,a?!e:!0),layout:"wide",title:Do.default.createElement(Nr.View,{style:[w.directionRow,w.flex1,w.alignCenter]},Do.default.createElement(Nr.View,{style:[{minWidth:M.L},g.Margin.smallRight]},Do.default.createElement(Ny,{readOnly:!0,method:o.method})),Do.default.createElement(Nr.View,{style:[w.flex1]},Do.default.createElement(Nr.Text,{style:[s.Code,s.text,uW.apiPath]},o.path),Do.default.createElement(Nr.Text,{style:[s.Caption,s.textMuted]},r?.summary))),buttons:[a?Do.default.createElement(Sc,{value:e,onValueChange:l=>n(o,i,l)}):Do.default.createElement(nh,{value:e,onValueChange:()=>n(o,i,!0)})]})}var uW=Nr.StyleSheet.create({apiPath:{fontSize:Fg.xsmall,wordWrap:"anywhere"}});function lM(t,o){let e=wc(),[n,r]=Gc.useState(null),[i,a]=Gc.useState(o),s=Pi(e,t),{blocks:{withAPIs:l}}=Gc.useContext(de),u=p=>{let m=e.value.document.assertBlock(p).data.toFrozenObject();return[{key:"swagger",commands:[l?{key:"pickSource",title:"Choose OpenAPI source\u2026",icon:v.Paperclip,trigger:()=>{l.filesManager.prompt({title:"Choose OpenAPI source",accept:"swagger",acceptURL:!0}).then(([h])=>{h&&(a({ref:h}),r("swagger"))})}}:null,i&&"ref"in i?{key:"pickMethod",title:"Choose API operation",icon:v.Swagger,trigger:()=>{r("swagger")}}:null,{key:"defaultExpanded",icon:v.ChevronsVertical,type:2,enabled:!!m.expanded,title:"Expanded",trigger:()=>(e.change(h=>{m.expanded?h.setDataByKey(p,["expanded"],!1):h.setDataByKey(p,["expanded"],!0)}),nt(e,p,u(p)))}].filter(se)},...s?[s]:[]]};return[nt(e,t,u(t)),Gc.createElement(St,null,n==="swagger"?Gc.createElement(tf,{data:i,buttonText:"Update Block",onRequestChangeSource:l?()=>{r(null),l.filesManager.prompt({title:"Choose OpenAPI source",accept:"swagger",acceptURL:!0}).then(([p])=>{p&&a({ref:p}),r("swagger")})}:void 0,onSelect:([p])=>{e.change(f=>{f.setNodeByKey(t,{data:{...i,method:p?.method,path:p?.path}})})},onClose:()=>r(null)}):null)]}c();var Xy=b(x());c();var ti=b(x()),Hc=b(z());function Ky(t){let{opened:o,setOpened:e,readOnly:n,parameters:r,header:i,requestBody:a,responses:s,blockProps:l,description:u}=t,[,d]=_(D);return ti.default.createElement(ti.default.Fragment,null,ti.default.createElement(DT,{blockProps:l,readOnly:n,opened:o,setOpened:e,description:u.description,...i}),ti.default.createElement(Hc.View,{style:dW.operationBody},o?ti.default.createElement(ti.default.Fragment,null,ti.default.createElement(VT,{blockProps:l,readOnly:n,...r}),a?ti.default.createElement(Hc.View,{style:g.Margin.largeTop},ti.default.createElement(Hc.View,null,ti.default.createElement(Hc.Text,{style:[d.Label,d.Bold,d.text]},"Body")),ti.default.createElement(Hy,{examples:a.examples,schema:a.schema})):null,ti.default.createElement(aM,{blockProps:l,readOnly:n,...s})):null))}var dW=Hc.StyleSheet.create({operationBody:{padding:g.medium,paddingLeft:g.medium+M.ICON_M+g.medium,paddingTop:0}});function uM(t){let{blockProps:o,data:e,opened:n,setOpened:r}=t,{editor:i}=o;if("ref"in e)throw new Error("trying to render a swagger block that is refering to a swagger file");let{readOnly:a}=i,{baseUrl:s,method:l,path:u,summary:d}=e,{parameters:p={},responses:f={}}=e,m=Xy.default.useMemo(()=>Pe.defaultParameterSortedKeys(p).map(S=>({key:S,value:p[S]})),[p]),h=Xy.default.useMemo(()=>Pe.defaultResponseSortedKeys(f).map(S=>({key:S,value:f[S]})),[f]);return Xy.default.createElement(Ky,{blockProps:o,readOnly:a,opened:n,setOpened:r,header:{baseUrl:s,method:l,summary:d,path:u},parameters:{parameters:m},description:{description:{fragment:"description"}},responses:{responses:h}})}c();var Kc=b(x());function dM(t){let{blockProps:o,data:e,opened:n,setOpened:r,readOnly:i}=t;if(!("ref"in e))throw new Error("trying to render a swagger block that is not refering to a swagger file");let s=Qe(e.ref).href,{result:l,error:u}=Ql.readSafe(s),d=ef(l,e.path&&e.method?{path:e.path,method:e.method}:void 0),{operation:p,path:f,httpMethod:m}=d||{operation:{parameters:[],responses:[],summary:"",description:""},httpMethod:"",path:""},h=Kc.default.useMemo(()=>p.parameters.sort(({in:S},{in:C})=>Pe.SORTED_PARAMETERS_LOCATIONS.indexOf(S){let O=S[k-1],R=fw(O?{before:O.value.orderIndex}:{});return S.push({key:uw(),value:{...C,orderIndex:R}}),S},[]),[p.parameters]),y=Kc.default.useMemo(()=>p.responses.sort(({status:S},{status:C})=>S{let O=S[k-1],R=fw(O?{before:O.value.orderIndex}:{});return S.push({key:uw(),value:{...C,status:nC({code:C.status}),orderIndex:R}}),S},[]),[p.responses]);if(u)return i?Kc.default.createElement(of,null):Kc.default.createElement(ki,{kind:"danger",title:"Error while parsing the OpenAPI file.",details:ji(u)});if(!d){if(i)return Kc.default.createElement(of,null);let S=e.method&&e.path?`${e.method?.toUpperCase()} "${e.path}"`:"";return Kc.default.createElement(ki,{kind:"danger",title:"Error while parsing the OpenAPI file.",details:`Could not find the operation ${S} in the OpenAPI file.`})}return Kc.default.createElement(Ky,{blockProps:o,readOnly:!0,opened:n,setOpened:r,header:{baseUrl:l?.baseUrl||"",method:m,summary:p.summary||"",path:f},parameters:{parameters:h},requestBody:p.requestBody,responses:{responses:y},description:{description:p.description?{text:p.description}:void 0}})}function pM(t){let{node:o,isFocused:e,editor:n}=t,r=o.data.toFrozenObject(),[i,a]=lM(o.key,r),[s,l]=_(pW),{sections:u}=Ar.default.useContext(Ri),{current:d}=Gg(),p=u.get(o.key),f=Je(),[m,h]=Ar.default.useState(f||e||!!r.expanded);Ar.default.useEffect(()=>{d&&r.expanded&&h(!0)},[r.expanded]);let y=Ar.default.createElement(Ir,{style:[l.blockSwagger,m&&l.blockSwaggerOpened],backgroundColor:s.colors.background.main,nativeID:p},Ar.default.createElement(Ar.default.Suspense,{fallback:Ar.default.createElement(Mo,{size:"small"})},"ref"in r?Ar.default.createElement(dM,{readOnly:n?.readOnly,blockProps:t,data:r,opened:m,setOpened:h}):Ar.default.createElement(uM,{blockProps:t,data:r,opened:m,setOpened:h})));return Ar.default.createElement(Ar.default.Fragment,null,a,Ar.default.createElement(Se,{palette:i,...t},!("ref"in r)&&m||n.readOnly?y:Ar.default.createElement(Ut,{...t},y)))}var pW=F.create({blockSwagger:t=>({borderRadius:t.radiuses.large,borderColor:t.colors.border.mid,borderWidth:1}),blockSwaggerOpened:t=>({...t.shadows.spread})});c();var mM=b(x());var mW=At({key:"lastSwaggerReference",default:{}});function fM(t){let[o,e]=or(mW),n=lt(),r=Ce(),i=n.space?Xr(r.store.getBranchRevision(n.space,"changeRequest"in n&&n.changeRequest?Eg(n.changeRequest):_g)):void 0,a=i?o[i.contentId]:null,s=mM.default.useCallback(d=>{i&&e({...o,[i.contentId]:d})},[i?.contentId,e]);if(a?.kind==="url")return[a,s];if(a?.kind==="file"&&i?.files[a.file])return[a,s];let l=Pe.getProbableRef(t.value.document);if(l)return[l,s];let u=Object.values(i?.files||{}).filter(d=>Xu(d)).sort((d,p)=>{let f=Zp(d.edits)?.updatedAt;return(Zp(p.edits)?.updatedAt||0)-(f||0)});return[u.length?{kind:"file",file:u[0].id}:null,s]}c();var iC=b(x());c();c();var kM=b(hM()),Bo=b(x()),tu=b(z());c();var ko=b(x());c();var nf=b(x()),bM=b(z());function wM(t){return ae({search:"Pick a color\u2026",groups:[{key:"text",title:"Color",commands:ry.map(o=>yM(t,o,!1))},{key:"background",title:"Background",commands:iy.map(o=>yM(t,o,!0))}]})}function yM(t,o,e){let n=t.value.activeMarks.find(a=>a.type===Kp),r=e?"background":"text",i=n&&n.data.get(r)===o.key;return{key:`${e?"background_":"foreground_"}${o.key}`,title:o.title,type:1,selected:!!i,icon:({size:a})=>e?nf.createElement(vM,{size:a,backgroundColor:o.color,color:Z.BLACK}):nf.createElement(vM,{size:a,backgroundColor:Z.WHITE,color:o.color}),trigger:()=>{t.change(a=>{n&&a.removeMark(n),i||a.addMark({type:Kp,data:{background:"default",text:"default",...n?n.data.toObject():{},[r]:o.key}})})}}}function vM(t){let{size:o=M.ICON_S,color:e,backgroundColor:n}=t;return nf.createElement(bM.View,{style:[w.directionRow,w.alignCenter,w.justifyContentCenter,{width:o+2,height:o+2,borderRadius:M.RADIUS_M,backgroundColor:n}]},nf.createElement(v.Type,{style:{color:e,fontSize:o*.9}}))}c();var Dr=({type:t,editor:o})=>()=>{o.change(e=>{e.toggleMark(t),e.focus()})},eu=({palette:t,editor:o,contentReferenceContext:e,isInLink:n,hiveClient:r,insertAtRange:i})=>()=>{if(n){o.change(s=>{s.unwrapInline({type:Rn}).focus()});return}o.change(s=>{jy(s)});let a=Fn(s=>{o.change(l=>{i?xl.insertContentReferenceAtRange(l,s,i):xl.insertContentReference(l,s)})},{...e,document:o.value.document},r);return t.open(a),a},Yy=({editor:t})=>()=>{t.change(o=>{bg.wrapWithAnnotation(o)})};function SM(t){let{value:o,editor:e,palette:n}=t,r=Ce(),i=lt(),a=o.activeMarks.map(h=>h.type),{startBlock:s,document:l}=o;Fe(s);let u=o.hasInline(Rn),p=!(s.type===Ea),f=()=>{e.change(h=>{jy(h)}),n.open(wM(e))},m=()=>{e.change(h=>{h.removeAllMarks().focus()})};return ko.createElement(CP,{onTabToExit:()=>{e.change(h=>{h.focus()})}},p?ko.createElement(_m,null,yg(s)?null:ko.createElement(bt,{leadingIcon:v.Bold.CSS,active:a.has(ar),onPress:Dr({type:ar,editor:e}),tooltipTitle:"*Bold*",tooltipBadge:ko.createElement(Pn,{inverted:!0,shortcut:qe.EDITOR_BOLD}),label:"Bold",iconOnly:!0,preventFocusOnPress:!0}),ko.createElement(bt,{leadingIcon:v.Italic.CSS,active:a.has(sr),onPress:Dr({type:sr,editor:e}),tooltipTitle:"_Italic_",tooltipBadge:ko.createElement(Pn,{inverted:!0,shortcut:qe.EDITOR_ITALIC}),label:"Italic",iconOnly:!0,preventFocusOnPress:!0}),ko.createElement(bt,{leadingIcon:v.Strikethrough.CSS,active:a.has(jr),onPress:Dr({type:jr,editor:e}),tooltipTitle:"~~Strikethrough~~",tooltipBadge:ko.createElement(Pn,{inverted:!0,shortcut:qe.EDITOR_STRIKETHROUGH}),label:"Strikethrough",iconOnly:!0,preventFocusOnPress:!0}),ko.createElement(bt,{leadingIcon:v.Code.CSS,active:a.has(mo),onPress:Dr({type:mo,editor:e}),tooltipTitle:"`Code`",tooltipBadge:ko.createElement(Pn,{inverted:!0,shortcut:qe.EDITOR_CODE}),label:"Code",iconOnly:!0,preventFocusOnPress:!0})):null,ko.createElement(_m,null,Os({document:l,block:s},Rn)?ko.createElement(bt,{leadingIcon:v.Link.CSS,onPress:eu({palette:n,editor:e,contentReferenceContext:i,isInLink:u,hiveClient:r}),active:u,tooltipTitle:"Link",tooltipBadge:ko.createElement(Pn,{inverted:!0,shortcut:qe.EDITOR_LINK}),label:"Link",iconOnly:!0,preventFocusOnPress:!0}):null,Os({document:l,block:s},mg)&&bg.isSelectionAnnotable(o)?ko.createElement(bt,{leadingIcon:v.Annotation.CSS,onPress:Yy({editor:e}),active:u,tooltipTitle:"Annotate",tooltipBadge:ko.createElement(Pn,{inverted:!0,shortcut:qe.EDITOR_ANNOTATION}),label:"Annotate",iconOnly:!0,preventFocusOnPress:!0}):null),p?ko.createElement(_m,null,ko.createElement(bt,{tooltipTitle:"Color",leadingIcon:v.Highlight.CSS,onPress:f,label:"Color",iconOnly:!0,preventFocusOnPress:!0})):null,ko.createElement(_m,{disabled:a.isEmpty()},ko.createElement(bt,{leadingIcon:v.PublishStatusUnpublished.CSS,onPress:m,tooltipTitle:"Clear formatting",label:"Clear formatting",iconOnly:!0,preventFocusOnPress:!0})))}function xM(t){let{value:o,selection:e}=t,n=wc(),r=Ce(),i=lt(),[a,s]=Bo.useState(null),[l,u]=Bo.useState(!1),d=Bo.useRef(null),p=Yo(a),f=Bo.useRef(null),m=Bo.useRef(null),h=le(d,{onClose:()=>{n.change(T=>{_M(T),T.focus()})}}),{width:y,height:S}=(0,tu.useWindowDimensions)(),C=V.useInteractiveState(),k=!o.isInVoid,O=o.hasInline(Rn),R=!yg(o.startBlock),I=!!k,E=I&&a,P=l&&e.isFocused&&e.isExpanded;Jr(k?{...R?{[qe.EDITOR_BOLD]:Dr({type:ar,editor:n})}:{},[qe.EDITOR_ITALIC]:Dr({type:sr,editor:n}),[qe.EDITOR_CODE]:Dr({type:mo,editor:n}),[qe.EDITOR_STRIKETHROUGH]:Dr({type:jr,editor:n}),[qe.EDITOR_LINK]:eu({palette:h,editor:n,contentReferenceContext:i,hiveClient:r,isInLink:O}),[qe.EDITOR_ANNOTATION]:Yy({editor:n})}:{},"editor-selection-expanded",[e,i,R,n,O,k,h]),Jr(k?{...R?{[qe.EDITOR_BOLD]:Dr({type:ar,editor:n})}:{},[qe.EDITOR_ITALIC]:Dr({type:sr,editor:n}),[qe.EDITOR_CODE]:Dr({type:mo,editor:n}),[qe.EDITOR_STRIKETHROUGH]:Dr({type:jr,editor:n})}:{},"editor-selection-collapsed",[e,R,n,k]),Bo.useEffect(()=>{!I||h.opened||(f.current=e,s(CM(n)))},[e]);let L=v1(200);return Bo.useEffect(()=>{if(!I)return;let T=()=>{h.opened||(p.current&&s(null),L(()=>{s(CM(n))}))};return window.addEventListener("scroll",T,!0),()=>{window.removeEventListener("scroll",T,!0)}},[h,I,p,L]),Bo.useLayoutEffect(()=>{m.current?.updatePosition()},[y,S]),Bo.useLayoutEffect(()=>{let T=setTimeout(()=>{u(e.isExpanded)},200);return()=>{u(!1),clearTimeout(T)}},[e.isExpanded]),E?Bo.createElement(Tn,null,Bo.createElement(tu.View,{ref:d,pointerEvents:"none",style:[fW.formattingMenuWrapper,a],dataSet:{"hide-on-drag":!0}},P?Bo.createElement(Mn,{ref:m,kind:"menu",preferredPlacement:"top",chromeless:!0},Bo.createElement(tu.View,{style:[w.directionRow,g.Padding.xsmall],...C.events},Bo.createElement(SM,{value:o,editor:n,palette:h}))):null)):null}function CM(t){let o=window.getSelection();if(!o||o.rangeCount<1)return null;let e=o.getRangeAt(0),n=kM.default.getBoundingClientRect(e);if(!n)return null;let r=o.anchorNode;if(!r||!U1(t,r))return null;let i=r?OM(r):null,a=15,s={top:n.top+window.pageYOffset,left:n.left+window.scrollX,width:n.width,height:n.height};if(s.widthl.bottom)return null}return s}function OM(t){if(t instanceof HTMLElement){let o=getComputedStyle(t,null);if(o.getPropertyValue("overflow")==="auto"||o.getPropertyValue("overflow")==="scroll"||o.getPropertyValue("overflow-y")==="auto"||o.getPropertyValue("overflow-y")==="scroll")return t}return t.parentNode?OM(t.parentNode):null}var fW=tu.StyleSheet.create({formattingMenuWrapper:{position:"absolute",zIndex:100,animationDelay:"250ms"}});function $y(t){let{anchorRef:o,editor:e,range:n}=t,r=Ce(),{blocks:{withImages:i}}=iC.default.useContext(de),a=lt(),s=le(o,{onClose:()=>{s.close(),!i?.filesManager.isOpen()&&e.change(l=>l.focus())}});return iC.default.useMemo(()=>{let l=[];return i&&l.push({key:"inline-image",title:"Inline image",icon:v.Image,trigger:()=>{e.change(u=>u.blur()),i.filesManager.prompt({title:"Select image",accept:"images",acceptURL:!0}).then(u=>{e.change(d=>{if(Po(d.value.selection))return d;let p=n??d.value.textSelection;u.forEach(f=>{d.insertInlineAtRange(p,Uo.createImageInline(f))}),d.focus()})})}}),l.push({key:"emoji",title:"Emoji",icon:v.EmojiReaction,trigger:()=>wd(u=>{e.change(d=>{if(Po(d.value.selection))return d;let p=n??d.value.textSelection;d.insertInlineAtRange(p,Sg.createEmoji(u)).focus()})})},{key:"link",title:"Link",icon:v.Link,trigger:eu({hiveClient:r,palette:s,editor:e,contentReferenceContext:a,isInLink:!1,insertAtRange:n})},{key:"inline-math",title:"Math & TeX",icon:v.MathTeX,trigger:()=>{e.change(u=>{if(Po(u.value.selection))return u;let d=n??u.value.textSelection;u.insertInlineAtRange(d,Ol.createMathInline()).focus()})}}),l},[n,e,e.value.selection,s,a,i,r])}function RM(t,o,e,n="replace",r){let[i,a]=Vn.useState(null),s=nd(),{integrationsBlocksSubscription:l,logAnalyticsEvent:u,blocks:d,suggestIntegrations:p}=Vn.useContext(de),{withImages:f,withAPIs:m,withDrawings:h,withFiles:y,withTables:S}=d,C=l.getCurrentValue,k=bi(),[O,R]=fM(t),I=lt(),E=Ce(),P=$y({anchorRef:r,editor:t}),L=Vn.useCallback(()=>{a(null)},[]),T=Vn.useCallback((Y,X="end")=>{L(),Wd(t,e.key,Y,n,X)},[L,t,e.key,n]),H=Vn.useCallback((Y,X="end")=>{L();let re;Y.forEach((me,Be)=>{Wd(t,re||e.key,me,Be===0?n:"after",X),re=me.key})},[L,t,o.key,e.key,n]),U=Vn.useCallback(Y=>{let{blockType:X,...re}=Y;u({type:"edit_page_document_insert_block",from:"palette",blockType:X,...re})},[u]),K=Vn.useMemo(()=>{let Y=(X,re=()=>!0)=>Object.entries(X).map(([me,Be])=>re(me)?Be.map(Ie=>({key:`${me}.${Ie.id}`,title:Ie.title,icon:mt(TT,{block:Ie}),trigger:()=>{Ie.urlUnfurl&&Ie.urlUnfurl.length>0?a("embed"):(T(Og.createIntegrationBlock(me,Ie.id)),U({blockType:Yr,integration:me,integrationBlock:Ie.id}))}})):[]).flat();return ae({search:"Insert block\u2026",groups:[{key:"inline-controls",commands:n==="replace"&&e.isEmpty?P:[]},{key:"texts",commands:[We(o,fe)?{key:"paragraph",title:"Paragraph",icon:v.Paragraph,trigger:()=>{T(Gt.create({type:fe})),U({blockType:fe})}}:null].filter(se)},{key:"headings",commands:[We(o,Ve)?{key:"heading_1",title:"Heading 1",icon:v.Heading1,keywords:["h1","Title 1","Header 1"],trigger:()=>{T(Gt.create({type:Ve})),U({blockType:Ve})}}:null,We(o,Ge)?{key:"heading_2",title:"Heading 2",icon:v.Heading2,keywords:["h2","Title 2","Header 2"],trigger:()=>{T(Gt.create({type:Ge})),U({blockType:Ge})}}:null,We(o,tt)?{key:"heading_3",title:"Heading 3",keywords:["h3","Title 3","Header 3"],icon:v.Heading3,trigger:()=>{T(Gt.create({type:tt})),U({blockType:tt})}}:null].filter(se)},{key:"lists",commands:[We(o,uo)?{key:"list_ul",title:"Unordered list",keywords:["ul","Bullet list","Dot list"],icon:v.ListUnordered,trigger:()=>{T(pt.createList(uo)),U({blockType:uo})}}:null,We(o,Ht)?{key:"list_ol",title:"Ordered list",keywords:["ol","Numbered List"],icon:v.ListOrdered,trigger:()=>{T(pt.createList(Ht)),U({blockType:Ht})}}:null,We(o,po)?{key:"list_tasks",title:"Task list",keywords:["Checkbox","Checklist","Tick","Todo list"],icon:v.ListTasks,trigger:()=>{T(pt.createList(po)),U({blockType:po})}}:null].filter(se)},{key:"dividers",commands:[We(o,ws)?{key:"divider",title:"Divider",keywords:["Horizontal rule","Separator","Thematic break","hr"],icon:v.Divider,trigger:()=>{T(Gt.create({type:ws})),U({blockType:ws})}}:null].filter(se)},{key:"panels",commands:[We(o,lo)?{key:"hint",title:"Hint",keywords:["Info","Alert","Callout"],icon:v.InfoCircle,trigger:()=>{T(hO.create()),U({blockType:lo})}}:null,We(o,Kt)?{key:"quote",title:"Quote",keywords:["Blockquote","Citation"],icon:v.Quote,trigger:()=>{T(yO.create()),U({blockType:Kt})}}:null,We(o,rr)?{key:"code",title:"Code Block",keywords:["Syntax","Snippet"],icon:v.Code,trigger:()=>{T(eo.createCodeBlock("// Some code")),U({blockType:rr})}}:null].filter(se)},{key:"others",commands:[y&&We(o,bs)?{key:"files",title:"Insert files\u2026",keywords:["Assets","Upload"],icon:v.Files,trigger:()=>{y.filesManager.prompt({title:"Files"}).then(X=>{let re=X.map(me=>me.kind==="file"?Cg.createFileBlock(me):null).filter(se);H(re,"end"),U({blockType:bs,files:re.length})})}}:null,f&&We(o,dn)?{key:"images",title:"Insert images\u2026",keywords:["Photo","Picture","JPEG","jpg","png","GIF"],icon:v.Image,trigger:()=>{f.filesManager.prompt({title:"Select images",accept:"images",acceptURL:!0}).then(X=>{T(Gt.create({type:dn,isVoid:!0,nodes:X.map(re=>Uo.createImageBlock(re))})),U({blockType:dn,images:X.length})})}}:null,We(o,_n)?{key:"embed",title:"Embed a url\u2026",keywords:["music","video","audio","design","iframe"],icon:v.ExternalLink,trigger:()=>{a("embed")}}:null,S&&We(o,_r)?{key:"table",title:"Table",keywords:["Spreadsheet"],icon:v.Table,trigger:()=>{T(ee.createTable()),U({blockType:_r,tableView:"grid"})}}:null,S&&We(o,_r)?{key:"table-cards",title:"Cards",keywords:["Grid"],icon:v.Cards,trigger:()=>{T(ee.createTable({view:"cards"})),U({blockType:_r,tableView:"cards"})}}:null,We(o,ir)?{key:"tabs",title:"Tabs",icon:v.Tabs,trigger:()=>{T(Qi.createTabs(),"start"),U({blockType:ir})}}:null,We(o,Ur)?{key:"expandable",title:"Expandable",keywords:["collapsible","toggle"],icon:v.BlockExpandable,trigger:()=>{T(_s.createExpandableBlock(),(X,re)=>{X.collapseToStartOf(_s.getTitleFragment(re)).focus()}),U({blockType:Ur})}}:null,h&&We(o,vs)?{key:"drawing",title:"Drawing",keywords:["sketch","draw","excalidraw"],icon:v.EditDrawing,trigger:()=>{T(fO.createDrawingBlock()),U({blockType:vs})}}:null,We(o,Cl)?{key:"math",title:"Math & TeX",keywords:["Formula"],icon:v.MathTeX,trigger:()=>{T(Ol.createMathBlock()),U({blockType:Cl})}}:null,We(o,Eo)?{key:"api-method",title:"API Method",icon:v.Swagger,keywords:["api"],trigger:()=>{T(Pe.createBlock()),U({blockType:Eo})}}:null,m&&We(o,Eo)?{key:"swagger",title:"OpenAPI",icon:v.Swagger,keywords:["api","swagger"],trigger:()=>{O?a({ref:O}):m.filesManager.prompt({title:"Choose OpenAPI source",accept:"swagger",acceptURL:!0}).then(([X])=>{X&&(R(X),a({ref:X}))})}}:null,We(o,Cs)?{key:"content-ref",title:"Page Link",icon:v.PageLink,keywords:["references"],trigger:()=>Fn(X=>{T(xl.createContentRefBlock(X)),U({blockType:Cs,contentRefKind:X.kind})},I,E,{accept:["page","space","collection"]})}:null].filter(se)},We(o,Yr)?{key:"integrations",commands:()=>{let X=C();return Y(X)}}:null,We(o,Yr)?{key:"integrations",commands:()=>{let X=p();if(!Object.keys(X).length)return[];let re=C();return Y(X,me=>!re[me])}}:null,We(o,_n)?{key:"embeds",commands:PE.map(X=>({key:X.key,title:X.title,icon:({size:re})=>Vn.createElement(jo,{source:{uri:(k.color==="dark"?X.iconDark:null)||X.icon},style:{width:re,height:re}}),trigger:()=>{a("embed")}}))}:null].filter(se)})},[T,s.uid,I,t,k.color,C,p,f,m,h,y,S]);return[Vn.createElement(St,null,i==="embed"?Vn.createElement(TE,{onInsert:T,onClose:L}):i&&"ref"in i&&m?Vn.createElement(tf,{onClose:L,data:i,multi:!0,buttonText:Y=>`Insert ${Y} blocks`,onRequestChangeSource:()=>{a(null),m.filesManager.prompt({title:"Choose OpenAPI source",accept:"swagger",acceptURL:!0}).then(([Y])=>{Y&&a({ref:Y})})},onSelect:Y=>{U({blockType:Eo,swaggerOperations:Y.map.length,swaggerSource:i.ref.kind}),H(Y.map(X=>Pe.createBlockWithRef(i.ref,X.path,X.method))),L()}}):null),K]}function Wd(t,o,e,n,r){t.change(i=>{let a=t.value.document.getParent(o);if(!a)return;let s=a.getChildIndex(o);if(s<0)return;if(n==="replace")e.object==="block"?i.replaceNodeByKey(o,e):i.replaceWithDocumentByKey(o,e);else{let u=n==="after"?s+1:s;e.object==="block"?i.insertNodeByKey(a.key,u,e):i.insertDocumentByKey(a.key,u,e)}let l=i.value.document.getNode(e.object==="block"?e.key:e.nodes.first().key);l&&(qt(i.value.selection)?r==="start"?i.collapseToStartOf(l).focus():r==="end"?i.collapseToEndOf(l).focus():r(i,l):i.selectBlock(qp.create({anchorBlock:l.key,focusBlock:l.key})))})}var Zy={insert:{label:"Insert block",title:`Click to add below ${Ew("alt")} + click to add above`},options:{label:"Block controls",title:`Click for options. ${Ew(qe.EDITOR_MODIFIER_PALETTE)} Drag to move.`}};function IM(t){let{optionsPalette:o,node:e,editor:n,parent:r,layout:i,drag:a,isDragging:s,isFocused:l,isHovered:u}=t,d=x1(),p=Wo.useRef(!1),[f,m]=Wo.useState("replace"),h=Wo.useRef(null),y=le(h),[S,C]=RM(n,r,e,f,h),k=Wo.useRef(null),O=le(k,{onClose:()=>{n.change(X=>{X.focus()})}}),R=()=>{p.current=!!d.current,e.isEmpty&&p.current?y.open(C):O.open((typeof o=="function"?o():o)||nt(n,e.key)),n.change(X=>{e&&qt(X.value.selection)&&!X.value.selection.hasEdgeIn(e)&&X.collapseToStartOf(e),X.blur()})},I=Si(k,a.setNodeRef);Jr(l?{...e.isEmpty?{[qe.EDITOR_PALETTE]:R,[qe.EDITOR_I18N_PALETTE]:R}:{},[qe.EDITOR_MODIFIER_PALETTE]:()=>i.withOptionsButton?O.open((typeof o=="function"?o():o)||nt(n,e.key)):!1}:{},"editor-selection-collapsed",[l,O,o,n,e.isEmpty,e.key]);let E=u||O.opened||y.opened,[P,L]=Wo.useState(!1),T=Wo.useRef(null),H=i.withInsertButton,U=H?["fade","slide"]:["fade"],K=Tw(N.animations,["distance-s","enter","right",...U],E),Y=Tw(N.animations,["distance-s","exit","right",...U],P&&!E);return Wo.useEffect(()=>{function X(me){L(me.animationName.includes("Enter"))}function re(){L(!1)}return H&&(T.current?.addEventListener("animationend",X),T.current?.addEventListener("animationcancel",re)),()=>{T.current?.removeEventListener("animationcancel",re),T.current?.removeEventListener("animationend",X)}},[H]),Wo.createElement(j,{contentEditable:!1,style:[NS.hitArea],inlineStyle:i.hitArea.inlineStyle},S,Wo.createElement(j,{ref:T,style:[NS.buttonWrapper,K,Y,H?N.flex.justifyContentEnd:N.flex.justifyContentStart],inlineStyle:i.position},i.withInsertButton?Wo.createElement(Wo.Fragment,null,Wo.createElement(bt,{contentEditable:!1,kind:"muted",iconOnly:!0,leadingIcon:v.Plus.CSS,label:Zy.insert.label,preventFocusOnPress:!0,tooltipTitle:Zy.insert.title,onPressStart:X=>m(X.altKey?"before":"after"),onPress:X=>{y.open(C)},onPressEnd:()=>m("replace"),size:i.size,style:Mw,ref:h})):Wo.createElement(j,{ref:h,id:"palette-ref--"}),i.withOptionsButton?Wo.createElement(bt,{contentEditable:!1,kind:"muted",ref:I,size:i.size,iconOnly:!0,label:Zy.options.label,leadingIcon:v.GrabberVertical.CSS,tooltipTitle:Zy.options.title,preventFocusOnPress:!0,tooltipDisabled:s,onPress:()=>R(),style:Mw,...a.listeners}):null))}c();var ft=b(x()),JM=b(z());c();var zd=b(x()),EM=b(z());c();var PM=b(z());var ou={added:Z.green.base,deleted:Z.scarlet.base,modified:Z.primary.base},Jy=PM.StyleSheet.create({added:{color:ou.added},deleted:{color:ou.deleted},modified:{color:ou.modified}});function Qy(t){let{diff:o,style:e,size:n,highlighted:r}=t,[,i]=_(gW),a=V.useInteractiveState(),s=o==="added"?v.DiffAdded:o==="deleted"?v.DiffRemoved:o==="modified_inside"?v.DiffModifiedInside:v.DiffModified;return zd.createElement(ge,{editable:!1,style:[e,rf.avoidCalculatingBounds],...a.events,"data-hide-on-drag":!0},zd.createElement(za,{tooltip:o==="modified_inside"?"This block contains nested changes":`This block has been ${o} in this change request`,preferredPlacement:"top"},(l,u)=>zd.createElement(V.TouchableOpacity,{ref:u,style:[rf.diffContainer,r||a.hovered?rf.diffContainerHighlighted:null],...l.events},zd.createElement(s,{style:[rf.diffIcon,Jy[o]],size:n}),o!=="modified_inside"?zd.createElement(ge,{style:[rf.diffLine,i.bodyColor]}):void 0)))}var rf=EM.StyleSheet.create({diffContainer:{display:"flex",flexDirection:"column",alignItems:"center",height:"100%",opacity:.5,userSelect:"none"},diffContainerHighlighted:{opacity:1},diffIcon:{flexShrink:0},diffLine:{width:1,flexGrow:1,flexShrink:1,marginTop:g.xsmall},avoidCalculatingBounds:{width:0,overflow:"visible"}}),gW=F.create({bodyColor:(t,o)=>({backgroundColor:o.color==="dark"?Z.darkModeText.xdark:Z.lightModeText.xlight})});c();var TM=b(x());c();var ev=JSON.parse('{"halo":"halo_oiCij","ready":"ready_81z1f","show":"show_byjur"}');function aC(t){let{isSelected:o=!1,isBlockSelection:e=!1}=t;return TM.default.createElement(j,{style:[ev.halo,{[ev.ready]:e,[ev.show]:o}],as:"span",contentEditable:!1})}aC.displayName="BlockSelectionHalo";c();var sC=4,cC=g.medium,lC=4,uC=g.xlarge+g.small,dC=g.large,hW=-96,MM=hW+g.large,tv=MM+g.small,af={[Kt]:-(cC+sC/2),[lo]:-(uC+lC/2),[Or]:-dC},pC={[Kt]:af[Kt],[lo]:af[lo],[Or]:af[Or]},mC=M.ICON_XS,nu=MM,LM=g.large+4,NM=g.large+8,AM=g.large+8,DM=28,BM=32,WM=34,ru=g.small;c();var GM=b(x()),HM=b(z());c();c();var Fd=g.medium;function yW(t,o){return o.nodes.find(e=>e.type===zu&&e.nodes.some(n=>n.key===t.key))||t}function Ei(t,o,e){let n=o.getChildIndex(e?yW(t,o).key:t.key),r=n===0,i=n===o.nodes.size-1,a=(()=>{switch(o.type){case lo:return{paddingTop:r?g.medium:g.xsmall,paddingBottom:i?g.medium:g.xsmall};case Kt:return{paddingTop:g.xsmall,paddingBottom:g.xsmall};case Xo:{if(!ks.includes(t?.type))return{paddingTop:0,paddingBottom:0};let l={paddingTop:g.small,paddingBottom:g.small};return r&&(l.paddingTop=0),i&&(l.paddingBottom=0),l}case Ss:return{paddingTop:g.medium,paddingBottom:g.medium}}return{}})();return{...(()=>{switch(t.type){case Ve:return{paddingTop:g.large,paddingBottom:g.small};case Ge:return{paddingTop:g.large,paddingBottom:g.small};case tt:return{paddingTop:g.large,paddingBottom:g.small};case fe:return{paddingTop:g.small,paddingBottom:g.small};case Ht:case uo:case po:return{paddingTop:g.medium,paddingBottom:g.medium};case lo:return{paddingTop:g.medium,paddingBottom:g.medium};case rr:return{paddingTop:g.medium,paddingBottom:g.medium};case Xo:return{paddingTop:r?0:g.xsmall,paddingBottom:i?0:g.xsmall};default:return{paddingTop:Fd,paddingBottom:Fd}}})(),...a}}c();var zM=b(ug()),sf=b(z()),Xc=100,ov=40,cf=800;function nv(t,o,e=!1){if(!t.useNewSizing)return vW(t,o,e);let n=new Map,r=0;t.columns.forEach(d=>{r+=t.columnWidths?.[d]||0});let i=Math.max(o-r,0),a=t.columns.length-Object.keys(t.columnWidths||{}).length,s=a===0?0:Math.floor(i/a),l=a===0?0:i-s*a,u=0;return t.columns.forEach(d=>{let p=typeof t.columnWidths?.[d]>"u",f=t.columnWidths?.[d]||0,m=p?s:f;d===t.columns[t.columns.length-1]&&(m+=l),m=(0,zM.default)(m,p?Xc:ov,cf),u+=m;let h=new sf.Animated.Value(0);h.setOffset(m),n.set(d,{controller:h,animated:sf.Animated.diffClamp(h,e?0:p?Xc:ov,cf),width:m})}),{widths:n,totalWidth:u}}function vW(t,o,e=!1){let i=new Map,a=0;t.columns.forEach(l=>{let u=t.columnWidths?.[l]||200;a+=u,i.set(l,u)});let s=1;return(a{let d=new sf.Animated.Value(0);d.setOffset(l*s),i.set(u,{controller:d,animated:sf.Animated.diffClamp(d,e?0:150,cf),width:l*s})}),{widths:i,totalWidth:a}}function iu(t,o,e){let{blockSpacing:n={paddingTop:0,paddingBottom:0},contentSize:r=750}=e||{};if(t?.object!=="block")throw new Error(`invalid node passed to "getBlockEstimatedHeight" ${t.object}#${t.type} with parent ${t.object}#${o?o.type:"no-parent"}`);switch(t.type){case _r:return n.paddingTop+n.paddingBottom+wW(t,r);case ir:return n.paddingTop+n.paddingBottom+iu(t.nodes.first(),t);case fe:case Ge:case tt:case Ve:{let a=n.paddingTop+n.paddingBottom+lf(t.text,{lineHeight:gr(t),fontSize:rv(t),contentWidth:r});return t.type===Ve&&o.object==="document"&&o.getChildIndex(t.key)!==0?a+g.medium+g.large+1:a}case Ea:return lf(t.text,{lineHeight:gr(t),fontSize:rv(t),contentWidth:r});case dn:case _n:case Zi:case Eo:case vs:case Yr:return n.paddingTop+n.paddingBottom+200;case Cl:case bs:case Cs:return n.paddingTop+n.paddingBottom+100;case Ur:return n.paddingTop+n.paddingBottom+gr(t);case ws:return n.paddingTop+n.paddingBottom+1;default:let i=bW(t,r);return n.paddingTop+n.paddingBottom+t.nodes.reduce((a,s)=>{let l=Ei(s,t),u=s.object==="block"?iu(s,t,{contentSize:i}):lf(s.text,{contentWidth:i});return a+u+l.paddingTop+l.paddingBottom},0)}}function bW(t,o){switch(t.type){case Kt:return o-cC-sC;case lo:return o-uC-lC;default:return o}}function gr(t){if(!t)return Ue.Body.lineHeight;switch(t.type){case Xo:return gr(t.nodes.first());case Ve:return Ue.Heading1.lineHeight;case Ge:return Ue.Heading2.lineHeight;case tt:return Ue.Heading3.lineHeight;case rr:return Ue.Code.lineHeight+2*g.small;case Ea:return Ue.Code.lineHeight;case ir:return Ue.Label.lineHeight+2*g.small;case _r:return Ue.Label.lineHeight+2*g.small;case Ur:return g.medium*2+Ue.Heading3.lineHeight;case ws:return 1;case fe:default:return Ue.Body.lineHeight}}function rv(t){if(!t)return Ue.Body.fontSize;switch(t.type){case Xo:return gr(t.nodes.first());case Ve:return Ue.Heading1.fontSize;case Ge:return Ue.Heading2.fontSize;case tt:return Ue.Heading3.fontSize;case Ea:return Ue.Code.fontSize;case fe:default:return Ue.Body.fontSize}}function wW(t,o){let e=ee.getTableData(t);switch(e.view.type){case"grid":{let{widths:n}=nv(e.view,o,!1),r=CW(e,n),i=Object.keys(e.records).reduce((a,s,l)=>{let u=fC(t,s,n);return a+u},0);return r+i}case"cards":{let n=Object.keys(e.records).length,r=e.view.cardSize==="large"?2:3,i=(750-r*g.medium)/r,a=SW(t,e,i),s=Math.ceil(n/r);return s*a+(s-1)*g.medium}default:Oe(e.view)}}function fC(t,o,e){if(!t)return 0;let n=ee.getTableData(t),r=n.records[o];return n.view.columns.reduce((i,a)=>{let s=r.values[a],l=n.definition[a],u=VM(s,l,FM(l.id,e),t);return u>i?u:i},g.medium)}function SW(t,o,e){let n=Object.values(o.records)[0];if(!n)return 0;let r=o.view.type==="cards"&&o.view.coverDefinition?135:0;return o.view.columns.reduce((i,a)=>{let s=n.values[a],l=o.definition[a],u=VM(s,l,e,t);return i+u},2*g.small+r)}function CW(t,o){return t.view.type!=="grid"||t.view.hideHeader?0:Object.keys(t.definition).reduce((e,n)=>{let r=FM(n,o),i=t.definition[n].title,a=lf(i,{contentWidth:r});return a>e?a:e},g.medium)}function FM(t,o){return(o.get(t)?.width||Xc)-g.medium*2}function VM(t,o,e,n){return(()=>{switch(o.type){case"text":let i=n.fragments.get(String(t));return i?i.nodes.reduce((u,d)=>u+iu(d,n,{contentSize:e}),0):0;case"number":return lf(String(t),{contentWidth:e});case"files":case"users":let a=Array.isArray(t)?t.length:1,s=o.type==="files"?xW:kW;return(a<=1?1:Math.max(1,Math.ceil(s*a/e)))*Ue.Body.lineHeight;case"checkbox":case"rating":case"select":default:return Ue.Body.lineHeight}})()+g.small*2+1}function lf(t,o){let{lineHeight:e=Ue.Body.lineHeight,contentWidth:n=750}=o||{},r=gC(t,o),i=Math.max(1,Math.ceil(r/n));return e*i}function gC(t="",o){let{fontSize:e=Ue.Body.fontSize}=o||{};return e*.5*t.length}var kW=gC("Steven Smithson")+g.large+g.small*2,xW=gC("this_is_a_file_of_mine.json")+g.large+g.small*2;function Dd(t){let{ancestors:o,node:e,diff:n,isBlockSelection:r=!1}=t,i=o.last(),a=i.type,s=i.getChildIndex(e.key),l=s===0,u=s===i.nodes.size-1,d=e.data.get("fullWidth"),f=typeof d=="boolean"&&d===!0;return GM.default.useMemo(()=>{let m=i.object==="document",h=o.size===1||o.size===2&&Gt.isBlock(i)&&pt.isList(i),y=i.object==="document"&&Ji.isConflictKey(e.key),S=gr(e),C=Ei(e,i,typeof n=="boolean");y&&(C.paddingTop+=g.medium);let k=!y&&PW(e,o),O=k?EW(e,o):0,R=g.small;return{blockStyle:LW(C.paddingTop,C.paddingBottom),diffLine:n?{style:{position:"absolute",left:MW(e,o),top:(typeof n!="boolean"?C.paddingTop:0)+(S-mC)/2,bottom:C.paddingBottom+g.small},size:mC}:void 0,diffBefore:typeof n!="boolean"&&n?.deletedBlocksBefore?{style:qM.diffDeletedBeforeLine,size:M.ICON_XS}:void 0,diffAfter:typeof n!="boolean"&&n?.deletedBlocksAfter?{style:qM.diffDeletedAfterLine,size:M.ICON_XS}:void 0,controlButtons:OW({node:e,ancestors:o,lineHeight:S,blockSpacing:C,isTopLevelBlock:h,isBlockSelection:r}),rightGutterComponent:k?{size:k.buttonSize,style:{top:(S-k.height)/2,marginLeft:O+R},hitArea:{right:0,width:O+R,marginRight:-O-R,top:0,position:"absolute",height:"100%",paddingTop:C.paddingTop,paddingBottom:C.paddingBottom}}:void 0,renderMode:m?f?"full-width":"centered":"unstyled"}},[e.type,i.object,a,l,u,n,r,f])}var KM={shouldNodeComponentUpdate(t,o){if(t.node.object==="inline"||o.node.object==="inline")return null;let e=Ei(t.node,t.parent),n=Ei(o.node,o.parent);return e.paddingTop!==n.paddingTop||e.paddingBottom!==n.paddingBottom?!0:null}};function OW({node:t,ancestors:o,lineHeight:e,blockSpacing:n,isTopLevelBlock:r,isBlockSelection:i}){let a=IW({isTopLevelBlock:r}),s=o.last(),l=_W({node:t,isTopLevelBlock:r,isBlockSelection:i}),u=RW({node:t,parent:s,isBlockSelection:i}),d=[l,u].reduce((y,S)=>S?y+a.width:y,0),p=TW(t,o),f=p-d/2,m=d===0?0:r?p:f,h=e/2-a.height/2;return{size:a.size,position:{top:h},withInsertButton:l,withOptionsButton:u,hitArea:{inlineStyle:{width:Math.abs(m),paddingTop:n.paddingTop,paddingBottom:n.paddingBottom,paddingLeft:r?g.xsmall:0,paddingRight:r?g.xsmall:0,left:m}}}}function _W({node:t,isBlockSelection:o,isTopLevelBlock:e}){return o||Or===t.type?!1:e}function RW({node:t,parent:o,isBlockSelection:e}){return!(t.type===fe&&t.isEmpty||Or===t.type||!e&&ks.includes(t.type)||Gt.isBlock(o)&&o.type===Xo&&t.type!==dn)}function IW({isTopLevelBlock:t}){return t?{size:"small",width:M.BUTTON_S,height:M.BUTTON_S}:{size:"xsmall",width:M.BUTTON_XS,height:M.BUTTON_XS}}function PW(t,o){return Or===t.type||ks.includes(t.type)||[lo,Ur,Kt].includes(t.type)?null:{buttonSize:"small",width:M.BUTTON_S,height:M.BUTTON_S}}function EW(t,o){let e=o.last();return Gt.isBlock(e)&&[lo].includes(e.type)?24:Gt.isBlock(e)&&e.type===Ur?g.medium+1:0}function TW(t,o){let e=o.last(),n=o.get(o.size-2);if(t.type===Xo){if(!n||n?.object==="document")return tv;if(Gt.isBlock(n)&&n.type===Xo)switch(e?.type){case uo:return-(g.small+6);case Ht:return-(g.small+8);case po:return-(g.small+M.ICON_M/2);default:return tv}e=n,n=o.get(o.size-3)}return n&&Gt.isBlock(n)&&pC[n.type]?pC[n.type]:(Gt.isBlock(e)?af[e.type]:0)||tv}function MW(t,o){let e=o.last(),n=o.get(o.size-2),r=o.some(l=>l.type===ir)?-g.large:0,i=o.some(l=>l.type===lo)?nu+10:0,a=o.some(l=>l.type===Kt)?-20:0,s=o.filter(l=>ks.includes(l?.type||"")).size;if(s>0){let l=(r?r-2:0)+i+a+nu,u=s-1,d;switch(ks.includes(n?.type||"")?d=n?.type:(d=e.type,u--),d){case uo:return l-LM-DM*u;case Ht:return l-NM-BM*u;case po:return l-AM-WM*u;default:return nu}}return a+i+r+nu}var qM=HM.StyleSheet.create({block:{paddingVertical:Fd},defaultTopPadding:{paddingTop:Fd},defaultBottomPadding:{paddingBottom:Fd},insertionLine:{height:ru,left:0,right:0},diffDeletedBeforeLine:{top:-ru,left:nu},diffDeletedAfterLine:{bottom:-ru,left:nu}});function LW(t,o){let e={0:"none",[g.xsmall]:"xsmall",[g.small]:"small",[g.medium]:"medium",[g.large]:"large",[g.xlarge]:"xlarge",[g.xxlarge]:"xxlarge"},n=[N.padding.mediumVertical],r={},i=e[t],a=e[o];return i&&n.push(N.padding[`${i}Top`]),a&&n.push(N.padding[`${a}Bottom`]),!i&&t!==0&&(r.paddingTop=t),!a&&o!==0&&(r.paddingBottom=o),{inlineStyle:r,style:n}}c();var Vd=b(x());var XM=Vd.default.createContext({current:new Map});function UM(t){let{original:o,modified:e,children:n}=t,r=Vd.default.useRef(new Map),i=Vd.default.useMemo(()=>o?mO(o||pc.create(),e):new Map,[o,e]);return r.current=i,Vd.default.createElement(XM.Provider,{value:r},n)}function YM(t){let o=Vd.default.useContext(XM);return o.current instanceof Map?o.current.get(t.key):o.current}c();var xo=b(x());c();var Ti=JSON.parse('{"conflicts":"conflicts_NH0YT","toolbarConnector":"toolbarConnector_rKw9X","conflictBase":"conflictBase_F-gkn","conflictHead":"conflictHead_qDgkT","verticalConnector":"verticalConnector_6gQQw","conflictBadge":"conflictBadge_rJISv","highlightContainer":"highlightContainer_T2jbl","highlight":"highlight_r-5El","main":"main_K0HuP","current":"current_-GeKS"}');function $M(t){let{node:o,editor:e,children:n}=t,{blockLayoutComponent:r}=xo.useContext(de),i=Ji.hasBlockConflictFrom(o,"base"),a=Ji.hasBlockConflictFrom(o,"head");return!a&&!i?xo.createElement(xo.Fragment,null,n):xo.createElement(j,{style:[Ti.conflicts,N.flex.column]},i?xo.createElement(r,{renderMode:"centered"},xo.createElement(jM,{node:o,editor:e,style:[Ti.conflictBase,N.margin.smallBottom,N.margin.mediumTop]})):null,xo.createElement(j,{style:Ti.highlightContainer},xo.createElement(j,{style:[Ti.highlight,{[Ti.main]:i,[Ti.current]:a}]}),i?xo.createElement(j,{style:[Ti.verticalConnector]}):null,n,a?xo.createElement(j,{style:[Ti.verticalConnector]},xo.createElement(j,{style:[Ti.conflictBadge]},xo.createElement(ho,{kind:"secondary",icon:v.Conflict}))):null),a?xo.createElement(r,{renderMode:"centered"},xo.createElement(jM,{node:o,editor:e,style:[Ti.conflictHead,N.margin.smallTop,N.margin.mediumBottom]})):null)}function jM(t){let{node:o,editor:e,style:n}=t,[,r]=_(D),i=()=>{e.change(a=>{Ji.pickConflict(a,o.key)})};return xo.createElement(j,{contentEditable:!1,style:[Ti.toolbarConnector,N.flex.row,n]},Ji.isConflictKeyFrom(o.key,"base")?xo.createElement(W,{icon:mt(v.Check,{style:[r.merge]}),rounded:!0,size:"small",kind:"secondary",style:[g.Margin.mediumRight],title:"Pick recent edits made on the main content",tooltipPreferredPlacement:"top",onPress:i},"Keep primary"):xo.createElement(W,{icon:mt(v.Check,{style:[r.primary]}),rounded:!0,size:"small",kind:"secondary",title:"Pick edits made on this change request",tooltipPreferredPlacement:"bottom",onPress:i},"Keep changed"))}var QM=At({key:"hoveredBlocks",default:[]}),NW=kx({key:"isSelectedHoveredBlock",get:t=>({get:o})=>{let e=o(QM),n=e.length?e[e.length-1]:void 0;return!!n&&n===t}});function Se(t){let{tag:o,contentProps:e={},commandIcon:n,commandIconAnimatedAngle:r,palette:i,...a}=t,{node:s,parent:l,ancestors:u,editor:d,attributes:p,isFocused:f,children:m,isSelectedBlock:h,isBlockSelection:y}=a,{readOnly:S}=d,C=YM(s),k=Je(),O=Kr(QM),R=tr(NW(s.key)),{blockLayoutComponent:I,rightGutterComponent:E,logAnalyticsEvent:P,onBlockHover:L}=ft.useContext(de),T=Dd({node:s,ancestors:u,diff:C,isBlockSelection:y}),H=V.useInteractiveState({onHoverIn:()=>{ks.includes(s.type)||O(Y=>[...Y,s.key]),L?.(s.key)},onHoverOut:()=>{O(Y=>Y.filter(X=>X!==s.key)),L?.(null)}}),U=H.hovered&&R,K=ft.createElement(ge,{"data-block-content":s.key,...e,style:[w.flex1,e.style]},S?null:ft.createElement(aC,{isBlockSelection:y,isSelected:h}),m);return S?ft.createElement(I,{node:s?.key,renderMode:T.renderMode,interactive:H},ft.createElement(Us.View,{isPDF:k},ft.createElement(j,{as:o,...p,...H.domEvents,style:[N.position.relative,N.flex.column,(l.object!=="block"||l.type!==zu)&&T.blockStyle.style],inlineStyle:T.blockStyle.inlineStyle},K,E&&T.rightGutterComponent?ft.createElement(ge,{style:[T.rightGutterComponent.hitArea,Uc.hitArea]},ft.createElement(E,{nodeKey:s.key,visible:U,shortcutsActive:f,buttonSize:T.rightGutterComponent.size,style:T.rightGutterComponent.style,readOnly:S})):null))):ft.createElement(AW,{key:s.key,interactive:H,layout:T,isPDF:k,isHovered:U,BlockLayoutComponent:I,RightGutterComponent:E,logAnalyticsEvent:P,diff:C,...t},K)}function AW(t){let{tag:o,commandIcon:e,commandIconAnimatedAngle:n,palette:r,interactive:i,layout:a,isPDF:s,isHovered:l,BlockLayoutComponent:u,RightGutterComponent:d,logAnalyticsEvent:p,diff:f,...m}=t,{node:h,parent:y,editor:S,attributes:C,isFocused:k,children:O,isSelectedBlock:R,isBlockSelection:I}=m,{readOnly:E}=S,P=I&&S.value.selection.isExpanded,L=gn({disabled:E,...Wn(P?{type:"block-range",id:h.key,previewLabel:"Move blocks"}:{type:"block",id:h.key,blockType:h.type,previewLabel:"Move block"})}),[T,H]=ft.useState(),U=mr({shouldAccept:re=>!(!["block","block-range","page","space","collection"].includes(re.type)||!We(y,re.type==="block"?re.blockType:Cs)||re.type==="block"&&re.id===h.key||re.type==="block-range"&&S.value.blocks.find(me=>me.key===h.key)),onDrop:re=>{S.change(me=>{if(re.type==="block-range")me.moveBlockRangeSelectionTo(h.key,T==="after"?1:0),p({type:"edit_page_document_move_block_range",method:"dnd",rangeSize:me.value.blocks.size});else if(re.type==="block"){T==="before"?me.moveBeforeNodeByKey(re.id,h.key):me.moveAfterNodeByKey(re.id,h.key);let Be=S.value.document.getParent(re.id);p({type:"edit_page_document_move_block",blockType:re.blockType,method:"dnd",toParent:y.object==="block"?y.type:y.object,fromParent:Be?.object==="block"?Be?.type:Be?.object})}else{let Be=xl.createContentRefBlock(CT(re));T==="before"?me.insertNodeBeforeByKey(h.key,Be):me.insertNodeAfterByKey(h.key,Be)}})},onHoverMove:({yPosition:re})=>{let me=re==="bottom"?"after":"before";T!==me&&H(me)}}),{rightGutter:K,controls:Y,diff:X}=DW({isBlockSelection:I,isDragging:L.isDragging,isSelectedBlock:R,readOnly:E,value:S.value});return ft.createElement($M,{node:h,editor:S},ft.createElement(u,{node:h?.key,renderMode:a.renderMode,interactive:i},ft.createElement(Us.View,{isPDF:s},ft.createElement(j,{as:o,...C,style:[N.position.relative,N.flex.row,L.isDragging&&N.opacity.translucent,a.blockStyle.style,jg,U.isOver&&{[Yg]:T==="before",[Zu]:T==="after"}],inlineStyle:a.blockStyle.inlineStyle,ref:U.setNodeRef},X&&f&&a.diffLine&&f.type!==pO?ft.createElement(Qy,{diff:f.type,highlighted:l,...a.diffLine,style:[a.diffLine?.style,Uc.noSelect]}):null,Y&&a.controlButtons?ft.createElement(IM,{isDragging:L.isDragging,drag:L,isFocused:k,isHovered:l,optionsPalette:P?void 0:r,layout:a.controlButtons,node:h,editor:S,parent:y}):null,O,K&&d&&a.rightGutterComponent?ft.createElement(ge,{style:[a.rightGutterComponent.hitArea,Uc.hitArea]},ft.createElement(d,{nodeKey:h.key,visible:l,shortcutsActive:k,buttonSize:a.rightGutterComponent.size,style:[a.rightGutterComponent.style,Uc.hideTransition],readOnly:E})):null,a.diffBefore?ft.createElement(ZM,{style:a.diffBefore.style,size:a.diffBefore.size}):null,a.diffAfter?ft.createElement(ZM,{style:a.diffAfter.style,size:a.diffAfter.size}):null))))}function ZM(t){let{style:o,size:e}=t;return ft.createElement(ge,{editable:!1,style:[o,Uc.avoidCalculatingBounds,Uc.diffRemoved,Uc.noSelect],"data-hide-on-drag":!0},ft.createElement(za,{tooltip:"A block has been removed in this change request",preferredPlacement:"top"},(n,r)=>ft.createElement(V.TouchableOpacity,{ref:r,style:Uc.diffContainer,...n.events},ft.createElement(v.DiffRemoved,{size:e,style:[Jy.deleted]}))))}function DW(t){let{isDragging:o,isBlockSelection:e,isSelectedBlock:n,readOnly:r,value:i}=t,{selection:a}=i;return ft.useMemo(()=>r?{controls:!1,diff:!1,rightGutter:!0}:e?{controls:n,diff:!0,rightGutter:!1}:{controls:!a.isExpanded,diff:!0,rightGutter:!a.isExpanded},[a.isExpanded,o,e,n,r])}var Uc=JM.StyleSheet.create({diffContainer:{display:"flex",flexDirection:"column",alignItems:"center",height:"100%",opacity:.5},diffRemoved:{paddingTop:(ru*2-M.ICON_XS)/2,height:ru*2,position:"absolute"},hideTransition:{transition:"opacity 0.2s ease-in-out"},hitArea:{position:"absolute",backgroundColor:"transparent"},avoidCalculatingBounds:{width:0,overflow:"visible"},noSelect:{userSelect:"none"}});c();var gt=b(x());c();var iv=JSON.parse('{"placeholder":"placeholder_HCCie","instructions":"instructions_YvYKU","shortcuts":"shortcuts_v-WHU"}');var au={instructions:{message:gt.createElement(gt.Fragment,null,"Type"," ",gt.createElement(Pn,{size:"medium",style:[N.flex.inline],shortcut:qe.EDITOR_PALETTE})," ","for commands"),embed:" or paste a link to embed content"},imagePrompt:{title:"Select images"},image:{label:"Insert image"},code:{label:"Insert code block",placeholder:"// Some code"},list:{label:"Insert unordered list"}};function e0(t){let{node:o,parent:e,editor:n,children:r,placeholder:i}=t,{selection:a}=n.value,s=be.isTextRange(a)&&a.hasOnlyNodeFocused(o),{logAnalyticsEvent:l,blocks:{withImages:u}}=gt.useContext(de),d=We(e,_n),p=gt.useMemo(()=>[u?{key:"image",label:au.image.label,icon:v.BlockImage.CSS,trigger(){u.filesManager.prompt({title:au.imagePrompt.title,accept:"images",acceptURL:!0}).then(f=>{f.length!==0&&(Wd(n,o.key,Gt.create({type:dn,isVoid:!0,nodes:f.map(m=>Uo.createImageBlock(m))}),"replace","end"),l({type:"edit_page_document_insert_block",from:"quick-insert",blockType:dn,images:f.length}))})}}:null,{key:"code",label:au.code.label,icon:v.Code.CSS,trigger(){Wd(n,o.key,eo.createCodeBlock(au.code.placeholder),"replace","end"),l({type:"edit_page_document_insert_block",from:"quick-insert",blockType:rr})}},{key:"list-unordered",label:au.list.label,icon:v.ListUnordered.CSS,trigger(){Wd(n,o.key,pt.createList(uo),"replace","end"),l({type:"edit_page_document_insert_block",from:"quick-insert",blockType:uo})}}].filter(se),[n,o.key]);return gt.createElement(gt.Fragment,null,gt.createElement(Se,{...t},gt.createElement(j,{as:"p",contentEditable:!1,style:[iv.placeholder,N.text.base,N.text.body,N.textColor.muted,N.flex.row,N.flex.alignCenter,N.flex.justifySpaceBetween,s||i?N.opacity.visible:N.opacity.hidden]},s?gt.createElement(gt.Fragment,null,gt.createElement(pe,{style:[iv.instructions]},au.instructions.message,d?au.instructions.embed:""),p?.length>0?gt.createElement(BW,{blocks:p,editor:n,node:o}):null):gt.createElement(gt.Fragment,null,vg(e)?i:null)),r))}function BW(t){let{blocks:o,editor:e,node:n}=t,[r,i]=gt.useState(0),a=gt.useRef(r),s=gt.useRef(null);return HI(l=>{!s.current||l||s.current?.focus()},{scope:e.elementRef?.current,exact:!0}),gt.useEffect(()=>{a?.current!==r&&(s.current?.focus(),a.current=r)},[r]),gt.useEffect(()=>()=>{s?.current?.blur()},[]),gt.createElement(j,{as:"span",role:"toolbar","aria-orientation":"horizontal",style:[iv.shortcuts,N.flex.row,N.flex.alignEnd]},o.map(({trigger:l,label:u,icon:d},p)=>gt.createElement(bt,{ref:p===r?s:void 0,label:u,tooltipTitle:u,iconOnly:!0,leadingIcon:d,kind:"muted",size:"small",onPress:()=>l?.(),preventFocusOnPress:!0,tabIndex:p===r?0:-1,key:`${n.key}_${p}`,onKeyDown:f=>{(f.key==="Tab"||f.key==="Escape")&&(e.elementRef?.current?.focus(),f.preventDefault()),f.key==="ArrowLeft"&&(i(m=>Math.max(0,m-1)),f.preventDefault()),f.key==="ArrowRight"&&(i(m=>Math.min(o.length-1,m+1)),f.preventDefault())}})))}c();var t0=b(x());var WW=[rr,_n,Yr,dn,Eo,_r];function Pi(t,o){let{logAnalyticsEvent:e}=t0.useContext(de),n=t.value.document.assertBlock(o);if(!WW.includes(n.type))return null;let r=n.data.get("fullWidth");return{key:"layout-width",commands:[typeof r=="boolean"&&r===!0?{key:"default",title:"Default width",icon:v.DefaultWidth,trigger:()=>{t.change(s=>{s.setDataByKey(o,["fullWidth"],!1)}),e({type:"edit_page_document_edit_block_property",blockType:n.type,blockProperty:"layout",fromValue:"full",toValue:"default"})}}:{key:"full",title:"Full width",icon:v.FullWidth,trigger:()=>{t.change(s=>{s.setDataByKey(o,["fullWidth"],!0)}),e({type:"edit_page_document_edit_block_property",blockType:n.type,blockProperty:"layout",fromValue:"default",toValue:"full"})}}]}}c();var o0=b(x());function sv(t,o){return o0.useMemo(()=>zW(t.value.document,o),[t,o])}function zW(t,o){let e=t.getPath(o);return e?e[0]o)return av.set(t,n),n}return av.set(t,t.nodes.size),t.nodes.size}c();var qd=b(x()),uf=b(z());var Gd=qd.forwardRef(function(o,e){let{node:n,children:r,editor:i,isFocused:a,isSelected:s,attributes:l,onPress:u,style:d}=o,{readOnly:p}=i,f=V.useInteractiveState(),[,m]=_(VW);return p?u?qd.createElement(uf.TouchableOpacity,{style:[m.frameInlineVoid],onPress:u},r):qd.createElement(uf.View,{style:[m.frameInlineVoid]},r):qd.createElement(uf.TouchableOpacity,{ref:e,...l,...f.events,style:[m.frameInlineVoid,f.hovered&&m.frameEditableHovered,s&&m.frameSelected,a&&m.frameFocused,d],onPress:h=>{i.change(y=>{qt(y.value.selection)?y.collapseToStartOf(n).focus():y.selectText(be.fromBlockRange(y.value.selection,y.value.document)).collapseToStartOf(n).focus()}),u&&u(h)}},r)}),VW=F.create({frameInlineVoid:t=>({borderWidth:2,borderColor:"transparent",borderRadius:t.radiuses.medium,textAlignVertical:"middle"}),frameEditableHovered:t=>({borderColor:t.colors.primary.muted}),frameSelected:t=>({borderColor:t.colors.primary.muted}),frameFocused:t=>({borderColor:t.colors.primary.main})});c();var xt=b(x()),vn=b(z());c();var a0=b(ug()),s0=b(x());c();var hC={BLUE:{light:"#0074D9",dark:"#0074D9"},AQUA:{light:"#7FDBFF",dark:"#7FDBFF"},TEAL:{light:"#39CCCC",dark:"#39CCCC"},OLIVE:{light:"#3D9970",dark:"#3D9970"},GREEN:{light:"#2ECC40",dark:"#2ECC40"},LIME:{light:"#01FF70",dark:"#01FF70"},YELLOW:{light:"#FFDC00",dark:"#FFDC00"},ORANGE:{light:"#FF851B",dark:"#FF851B"},RED:{light:"#FF4136",dark:"#FF4136"},MAROON:{light:"#85144b",dark:"#85144b"},FUCHSIA:{light:"#F012BE",dark:"#F012BE"},PURPLE:{light:"#B10DC9",dark:"#B10DC9"}},n0=Object.keys(hC).sort((t,o)=>Math.random()-.5),cv=new Map;function r0(t){if(cv.has(t))return cv.get(t);let o=n0[cv.size%n0.length];return cv.set(t,o),o}function $a(t){let o=bi(),[e]=_();return s0.useMemo(()=>{if(!t)return{base:e.colors.primary.main,faded:i0(e.colors.primary.main,.2)};let n=r0(t),r=hC[n][o.color];return{base:r,faded:i0(r,.2)}},[o.color,t,e.colors.primary.main])}function i0(t,o){let e=Math.round((0,a0.default)(o||1,0,1)*255);return t+e.toString(16).toUpperCase()}var Ut=xt.forwardRef(function(o,e){let{onPress:n,onSelect:r=()=>{s.change(y=>{qt(y.value.selection)&&y.collapseToStartOf(i).focus()})},node:i,children:a,editor:s,selections:l,isFocused:u,selectable:d=!0}=o,{readOnly:p}=s,f=i.getFirstText(),m=xt.useMemo(()=>{if(u)return;let y=l.get(0);if(y)return y.data.get("clientId")},[l,u,f?.key]),h=$a(m);return xt.createElement(yC,{ref:e,onPress:n,readOnly:p,selectable:d,selected:u||!!m,selectionColor:h.base,onSelect:r},a)}),yC=xt.forwardRef(function(o,e){let{onPress:n,selected:r,readOnly:i=!1,selectable:a=!0,selectionColor:s,style:l,children:u,onSelect:d}=o,p=V.useInteractiveState({hoverDelayIn:50}),[f,m]=_(qW);if(i)return xt.createElement(xt.Fragment,null,u);let h=C=>{C.stopPropagation(),d()},y=s||f.colors.primary.main,S=xt.createElement(vn.View,{ref:e,style:l},u,xt.createElement(vn.View,{style:[m.frameBorder,m.frameBorderRight,p.hovered&&m.frameBorderHovered,r&&[m.frameBorderRightSelected,{borderRightColor:y}]],pointerEvents:"none"}),xt.createElement(vn.View,{style:[m.frameBorder,m.frameBorderLeft,p.hovered&&m.frameBorderHovered,r&&[m.frameBorderLeftSelected,{borderLeftColor:y}]],pointerEvents:"none"}),xt.createElement(vn.View,{style:[m.frameBorder,m.frameBorderTop,p.hovered&&m.frameBorderHovered,r&&[m.frameBorderTopSelected,{borderTopColor:y}]],pointerEvents:"none"}),xt.createElement(vn.View,{style:[m.frameBorder,m.frameBorderBottom,p.hovered&&m.frameBorderHovered,r&&[m.frameBorderBottomSelected,{borderBottomColor:y}]],pointerEvents:"none"}),a?xt.createElement(xt.Fragment,null,xt.createElement(vn.TouchableWithoutFeedback,{onPress:h},xt.createElement(vn.View,{...p.events,style:[m.hoverableFrameBorder,m.hoverableFrameBorderRight]})),xt.createElement(vn.TouchableWithoutFeedback,{onPress:h},xt.createElement(vn.View,{...p.events,style:[m.hoverableFrameBorder,m.hoverableFrameBorderLeft]})),xt.createElement(vn.TouchableWithoutFeedback,{onPress:h},xt.createElement(vn.View,{...p.events,style:[m.hoverableFrameBorder,m.hoverableFrameBorderTop]})),xt.createElement(vn.TouchableWithoutFeedback,{onPress:h},xt.createElement(vn.View,{...p.events,style:[m.hoverableFrameBorder,m.hoverableFrameBorderBottom]}))):null);return n?xt.createElement(vn.TouchableOpacity,{onPress:n},S):S}),lv=18,vt=8,Yc=4,uv=2,qW=F.create({frameBorder:{position:"absolute"},hoverableFrameBorder:{position:"absolute",cursor:"pointer"},frameBorderHovered:t=>({backgroundColor:t.colors.primary.muted}),hoverableFrameBorderTop:{top:-vt/2,left:-vt/2,right:-vt/2,height:lv},frameBorderTop:{top:-vt/2,left:-vt/2,right:-vt/2,height:vt,borderTopLeftRadius:Yc,borderTopRightRadius:Yc},frameBorderTopSelected:t=>({backgroundColor:"transparent",borderTopColor:t.colors.primary.main,borderTopWidth:uv}),hoverableFrameBorderBottom:{bottom:-vt/2,left:-vt/2,right:-vt/2,height:lv},frameBorderBottom:{bottom:-vt/2,left:-vt/2,right:-vt/2,height:vt,borderBottomLeftRadius:Yc,borderBottomRightRadius:Yc},frameBorderBottomSelected:t=>({backgroundColor:"transparent",borderBottomColor:t.colors.primary.main,borderBottomWidth:uv}),hoverableFrameBorderLeft:{top:-vt/2,bottom:-vt/2,left:-vt/2,width:lv},frameBorderLeft:{top:-vt/2,bottom:-vt/2,left:-vt/2,width:vt,borderBottomLeftRadius:Yc,borderTopLeftRadius:Yc},frameBorderLeftSelected:t=>({backgroundColor:"transparent",borderLeftColor:t.colors.primary.main,borderLeftWidth:uv}),hoverableFrameBorderRight:{top:-vt/2,bottom:-vt/2,right:-vt/2,width:lv},frameBorderRight:{top:-vt/2,bottom:-vt/2,right:-vt/2,width:vt,borderTopRightRadius:Yc,borderBottomRightRadius:Yc},frameBorderRightSelected:t=>({backgroundColor:"transparent",borderRightColor:t.colors.primary.main,borderRightWidth:uv})});c();var dv=b(x());function pv(t,o){let[,e]=_(D),[,n]=_(GW),{navigateToHash:r}=we(),{sections:i,active:a,setActive:s}=dv.default.useContext(Ri),l=V.useInteractiveState(),u=i.get(t.key),d=()=>{u&&s(a!==u?u:null)},p=()=>{u&&(r(u,{scroll:!0}),d())},f={accessibilityRole:"presentation"};return{anchorElement:dv.default.createElement(V.Text,{href:`#${u}`,onPress:p,style:[n.anchorLink,g.Margin.smallLeft,a===u||l.focused||l.hovered?je.visible:je.hidden],inactiveStyle:e.textMuted,activeStyle:e.primary,accessibilityLabel:o.accessibilityLabel},dv.default.createElement(v.Hash,{size:o.anchorIconSize||M.ICON_S,...f})),anchoredBlockId:u,anchoredBlockInteractiveState:l,onAnchoredBlockPress:()=>{o.onBlockPress&&o.onBlockPress(),d()}}}var GW=F.create({anchorLink:{display:"inline-flex",alignItems:"center"}});c();var l0=b(x());function u0(t){let{notify:o,notifyProgress:e,notifyOrUpdate:n,close:r}=go(),{logAnalyticsEvent:i,onContentPaste:a,blocks:{withImages:s,withFiles:l}}=t;return l0.useMemo(()=>{function u(f){Au(f),o({kind:"danger",title:"Error while pasting content",icon:v.Alert.CSS,details:ji(f,"Please try again or contact support if the problem persists.")})}function d(f){n({id:"upload-files",title:`Uploading ${f} file${f!==1?"s":""}\u2026`,details:"This might take a moment.",kind:"default",timeout:0,closeable:!1,icon:Re})}function p(f,m,h){let y=Ju(f),S=0,C=async(k,O)=>{if(Bu(k))return{kind:"url",url:k};if(Hx(k)){if(!a.uploadFiles)return null;let R=await(await fetch(k)).blob(),I=k.split(";")[0]?.split("/")[1],E=O?.fileName||`unknown.${I}`,P=new File([R],E);return S+=1,d(S),(await a.uploadFiles([P]))[0]}return null};if(y.type==="html"&&y.html!==null)return l_(y.html,{...Lw,resolveFile:C}).then(({document:k})=>uO(k)&&y.text?Nw(y.text).then(({document:O})=>({document:O,type:"text"})):{document:k,type:"html"}).then(({document:k,type:O})=>{h.change(I=>{I.insertDocument(k)}),r("upload-files");let R=c0(O==="html"?y.html:y.text,O);i(df(f,O,{document:k,sourceIncludes:R}))}).catch(k=>{throw u(k),k}),!0;if(y.type==="text"&&y.text!==null)return Nw(y.text,{...Lw,resolveFile:C}).then(({document:k})=>{h.change(R=>{R.insertDocument(k)}),r("upload-files");let O=c0(y.text,"text");i(df(f,"text",{document:k,sourceIncludes:O}))}).catch(k=>{throw u(k),k}),!0;if(y.type==="files"&&typeof y.files<"u"){if(!y.files||y.files.length===0)return;let[k,O]=y.files.reduce(([R,I],E)=>fc(E)?[R.concat(E),I]:[R,I.concat(E)],[[],[]]);e(Promise.all([s?s.onPaste(k):Promise.resolve([]),l?l.onPaste(O):Promise.resolve([])]),{title:`Uploading ${y.files.length} files\u2026`,details:"This might take a moment.",kind:"default"}).then(([R,I])=>{let E=R.length+I.length;if(E===0){o({kind:"danger",title:"Some files failed to upload, please try again",icon:v.Alert.CSS});return}let P=R.length&&!I.length;h.change(L=>{if(P){if(bw(L.value,dn,{allowSplitBlock:!1})){L.insertOrReplaceBlock(Uo.createImagesBlock(R)).focus();return}if(!lO(L.value,mc)){o({kind:"info",title:"Cannot insert an image here",icon:v.InfoCircle.CSS});return}R.reduce((U,K)=>U.insertInline(Uo.createImageInline(K)),L);return}[...R,...I].forEach(T=>{if(T.kind!=="file")return;let H=Cg.createFileBlock(T);if(bw(L.value,H.type)){L.insertOrReplaceBlock(H).focus();return}o({kind:"info",title:"Cannot insert a file here",icon:v.InfoCircle.CSS})})}),i(df(f,"files",{uploadedFiles:E,sourceIncludes:["file"]}))}).catch(R=>{throw u(R),R})}}return{onPaste:p,onDrop:p}},[o,e])}function c0(t,o){let e=[];switch(o){case"text":t.includes("![")&&e.push("image"),t.match(/\|\s*\:?---/)&&e.push("table");break;case"html":t.includes("{s+=1,l.type&&a.add(l.type)}),{type:"edit_paste_content",paste:t.type,sourceTypes:[...i?.types||[]],sourceIncludes:[...new Set(r)],transformType:o,transformSize:s,uploadedFiles:n,transformNodes:[...a]}}c();var vC=b(vi());var d0={onKeyDown:HW};function HW(t,o){if((0,vC.default)("enter",t)||(0,vC.default)("shift+enter",t)){let{value:e}=o,{startBlock:n,startInline:r,startText:i}=e;if(r&&r.isVoid&&i){let a=e.document.getNextText(i.key);return a?(o.collapseToStartOf(a),o):void 0}if(n&&n.isVoid)return wt(o),o}}c();var bC=b(x()),mv="selectionHighlighting",p0={renderMark:KW};function KW(t){let{mark:o}=t;switch(o.type){case mv:return bC.createElement(XW,{...t})}}function XW(t){let{attributes:o,children:e}=t;return bC.createElement("span",{...o,style:{backgroundColor:"Highlight",color:"HighlightText"}},e)}c();function _M(t){t.value.decorations.forEach(o=>{o.marks?.some(e=>e.type===mv)&&t.removeValueDecoration(o)})}function jy(t,o=t.value.selection){be.isTextRange(o)&&t.setValueDecoration(be.create({anchorKey:o.anchorKey,anchorOffset:o.anchorOffset,focusKey:o.focusKey,focusOffset:o.focusOffset,marks:[{type:mv,data:{}}],isAtomic:!0}))}c();var m0={shouldNodeComponentUpdate:UW};function UW(t,o){let e=t.parent.nodes.size-1,n=t.parent.getChildIndex(t.node.key),r=o.parent.getChildIndex(t.node.key);return(n===e||r===e)&&r!==n?!0:null}c();var Hd=b(x()),Kd=b(z());function oi(t){let[,o]=_(YW),[,e]=_(D);return Hd.createElement(Kd.View,{style:[o.blockLoading,g.Padding.largeHorizontal,g.Padding.mediumVertical,w.directionRow,w.alignCenter]},Hd.createElement(Kd.View,null,Hd.createElement(Re,{size:"medium"})),Hd.createElement(Kd.View,{style:[g.Margin.mediumLeft]},Hd.createElement(Kd.Text,{style:[e.Caption,e.textMid]},"Loading...")))}var YW=F.create({blockLoading:t=>({backgroundColor:t.colors.background.muted,borderRadius:t.radiuses.large})});c();var g0=b(x());c();var Mi=b(x());var f0={en:{something_wrong:"Something went wrong.",reload:"Reload",let_us_know:"Let us know what happened",we_have_been_notified:"Our team has been notified. If you'd like to help, you can describe what happened below.",search:"Search",search_ask:"Ask",search_placeholder:"Search content\u2026",search_placeholder_ask:"Ask or search\u2026",search_blankslate:"Type something to search",search_blankslate_ai:"We'll answer the question with an AI model trained on the content.",search_blankslate_recent_searches:"Recent searches",search_blankslate_recent_questions:"Recently asked",search_blankslate_recommended_questions:"You might be interested in",search_blankslate_query:'No results for "${1}"',search_answer_sources:"Answer based on ${1} sources",search_answer_copy:"Copy answer",search_answer_feedback_upvote:"Mark as useful",search_answer_feedback_downvote:"Mark as not relevant",search_answer_feedback_title:"Thanks for your feedback!",search_answer_feedback_details:"This will help us improve the answering engine.",search_answer_loading:"Analysing the content to answer your question\u2026",search_answer_loading_wait:"It might take a few more seconds.",search_answer_none_title:"We need more knowledge to answer this.",search_answer_none_details_beta:"Connect more integrations or use an existing integration to capture your own answer",search_answer_none_details:"It can indicate that no content is relevant to your question or answer cannot be evaluated with enough confidence.",search_answer_error_title:"Unexpected error",search_answer_error_details:"Something went wrong. Please try again later.",search_goto_section:"Go to section",search_goto_page:"Go to page",page_not_found:"Page not found",back_to_home:"Back to front page",page_not_found_long:"Sorry, but the page you were looking for could not be found.",outline:"On this page",last_modified:"Last modified ${1}",was_it_helpful:"Was this page helpful?",poor_content:"Poor content",ok_content:"OK content",excellent_content:"Excellent content",powered_by:"Powered By ${1}",previous:"Previous",next:"Next",export_pdf:"Export as PDF",copy_link:"Copy link",switch_to_dark_theme:"Switch to dark theme",switch_to_light_theme:"Switch to light theme",edit_on_github:"Edit on ${1}",page_articles_section:"Here are the articles in this section:",main:"Main",cookie_policy:"cookie policy",cookie_prompt:"This site uses cookies to deliver its service and to analyse traffic. By browsing this site, you accept the ${1}.",cookies:"Cookies",reject_all:"Reject all",theme_change_appearance:"Change appearance",new_page:"New page",untitled_page:"Untitled page",page_description:"Page description (optional)",connection_lost:"Connection lost",network_troubleshooting:"Network troubleshooting",device_offline:"Your device might be offline, or GitBook might be experiencing issues.",missing_content_title:"Oops, something is missing.",missing_content_description:"We could not find the original source to display this content.",table_of_contents:"Table of contents",page_outline:"Page outline"},fr:{something_wrong:"Il y a eu un probl\xE8me.",reload:"Actualiser",let_us_know:"Dites-nous ce qui s'est pass\xE9",we_have_been_notified:"Notre \xE9quipe a \xE9t\xE9 inform\xE9e. Si vous souhaitez nous aider, vous pouvez d\xE9crire ce qui s'est pass\xE9 ci-dessous.",search:"Rechercher",search_ask:"Poser une question",search_placeholder:"Rechercher dans le contenu\u2026",search_placeholder_ask:"Poser une question\u2026",search_blankslate:"Tapez quelque chose pour rechercher",search_blankslate_ai:"Nous r\xE9pondrons \xE0 la question avec un mod\xE8le d'IA entra\xEEn\xE9 sur le contenu.",search_blankslate_recent_searches:"Recherches r\xE9centes",search_blankslate_recent_questions:"Questions r\xE9centes",search_blankslate_recommended_questions:"Vous pourriez \xEAtre int\xE9ress\xE9 par",search_blankslate_query:'Aucun r\xE9sultat pour "${1}"',search_answer_sources:"R\xE9ponse bas\xE9e sur ${1} sources",search_answer_copy:"Copier la r\xE9ponse",search_answer_feedback_upvote:"Marquer comme utile",search_answer_feedback_downvote:"Marquer comme non pertinent",search_answer_feedback_title:"Merci pour votre retour !",search_answer_feedback_details:"Cela nous aidera \xE0 am\xE9liorer le moteur de r\xE9ponse.",search_answer_loading:"Analyse du contenu pour r\xE9pondre \xE0 votre question\u2026",search_answer_loading_wait:"Cela peut prendre quelques secondes suppl\xE9mentaires.",search_answer_none_title:"Aucune r\xE9ponse trouv\xE9e pour votre question.",search_answer_none_details:"Cela peut indiquer qu'aucun contenu n'est pertinent pour votre question ou que la r\xE9ponse ne peut pas \xEAtre \xE9valu\xE9e avec suffisamment de confiance.",search_answer_error_title:"Erreur inattendue",search_answer_error_details:"Une erreur s'est produite. Veuillez r\xE9essayer plus tard.",search_goto_section:"Aller \xE0 la section",search_goto_page:"Aller \xE0 la page",page_not_found:"Page non trouv\xE9e",back_to_home:"Retour \xE0 la page d'accueil",page_not_found_long:"D\xE9sol\xE9, mais la page que vous cherchiez n'a pas pu \xEAtre trouv\xE9e.",outline:"Sommaire",last_modified:"Derni\xE8re mise \xE0 jour ${1}",was_it_helpful:"Cette page vous a t-elle aid\xE9e ?",poor_content:"Contenu m\xE9diocre",ok_content:"Contenu OK",excellent_content:"Contenu excellent",powered_by:"Propuls\xE9 par ${1}",previous:"Pr\xE9c\xE9dent",next:"Suivant",export_pdf:"Exporter en PDF",copy_link:"Copier le lien",switch_to_dark_theme:"Switch to dark theme",switch_to_light_theme:"Switch to light theme",edit_on_github:"\xC9diter sur ${1}",page_articles_section:"Voici les articles de cette section :",main:"Principale",cookie_policy:"politique en mati\xE8re de cookies",cookie_prompt:"Ce site utilise des cookies pour fournir son service et analyser le trafic. En naviguant sur ce site, vous acceptez le ${1}.",cookies:"Cookies",reject_all:"Rejeter tout",theme_change_appearance:"Changer l\u2019apparence",connection_lost:"Hors connexion",network_troubleshooting:"D\xE9pannage r\xE9seau",device_offline:"Votre appareil est hors-ligne, ou GitBook rencontre des probl\xE8mes.",missing_content_title:"Oups, il manque quelque chose.",missing_content_description:"Nous n'avons pas pu trouver la source d'origine pour afficher ce contenu.",table_of_contents:"Table des mati\xE8res",page_outline:"Sommaire de la page"},es:{something_wrong:"Algo sali\xF3 mal.",reload:"Recarga",let_us_know:"Cu\xE9ntanos lo que ha sucedido",we_have_been_notified:"Nuestro equipo ha sido notificado. Si quieres ayudar, puedes describir lo sucedido a continuaci\xF3n.",search:"Buscar",search_ask:"Hacer una pregunta",search_placeholder:"Buscar en el contenido\u2026",search_placeholder_ask:"Hacer una pregunta\u2026",search_blankslate:"Escribe algo para buscar",search_blankslate_ai:"Responderemos a la pregunta con un modelo de IA entrenado en el contenido.",search_blankslate_recent_searches:"B\xFAsquedas recientes",search_blankslate_recent_questions:"Preguntas recientes",search_blankslate_recommended_questions:"Quiz\xE1s te interese",search_blankslate_query:'No se encontraron resultados para "${1}"',search_answer_sources:"Respuesta basada en ${1} fuentes",search_answer_copy:"Copiar respuesta",search_answer_feedback_upvote:"Marcar como \xFAtil",search_answer_feedback_downvote:"Marcar como no relevante",search_answer_feedback_title:"\xA1Gracias por tu retroalimentaci\xF3n!",search_answer_feedback_details:"Esto nos ayudar\xE1 a mejorar el motor de respuesta.",search_answer_loading:"Analizando el contenido para responder tu pregunta\u2026",search_answer_loading_wait:"Esto puede tomar unos segundos m\xE1s.",search_answer_none_title:"No se encontr\xF3 respuesta para tu pregunta.",search_answer_none_details:"Esto puede indicar que no hay contenido relevante para tu pregunta o que la respuesta no se puede evaluar con suficiente confianza.",search_answer_error_title:"Error inesperado",search_answer_error_details:"Ha ocurrido un error. Por favor, int\xE9ntalo de nuevo m\xE1s tarde.",search_goto_section:"Ir a la secci\xF3n",search_goto_page:"Ir a la p\xE1gina",page_not_found:"P\xE1gina no encontrada",back_to_home:"Volver a la primera p\xE1gina",page_not_found_long:"Lo sentimos, pero no se ha podido encontrar la p\xE1gina que buscaba.",outline:"Esquema",last_modified:"\xDAltima actualizaci\xF3n ${1}",was_it_helpful:"\xBFTe ha sido \xFAtil esta p\xE1gina?",poor_content:"Contenido mediocre",ok_content:"Contenido OK",excellent_content:"Contenido excelente",powered_by:"Accionado por ${1}",previous:"Anterior",next:"Pr\xF3ximo",export_pdf:"Exportar como PDF",copy_link:"Copiar enlace",switch_to_dark_theme:"Switch to dark theme",switch_to_light_theme:"Switch to light theme",edit_on_github:"Editar en ${1}",page_articles_section:"Aqu\xED est\xE1n los art\xEDculos de esta secci\xF3n:",main:"Principal",cookie_policy:"pol\xEDtica de cookies",cookie_prompt:"Este sitio utiliza cookies para prestar su servicio y analizar el tr\xE1fico. Al navegar por este sitio, usted acepta la ${1}.",cookies:"Cookies",reject_all:"Rechazar todo",theme_change_appearance:"Cambiar apariencia",connection_lost:"Desconectado",network_troubleshooting:"Resoluci\xF3n de problemas de red",device_offline:"Su dispositivo puede estar desconectado, o GitBook esta experimentando problemas.",missing_content_title:"Ups, algo falta.",missing_content_description:"No pudimos encontrar la fuente original para mostrar este contenido.",table_of_contents:"Tabla de contenido",page_outline:"\xCDndice de p\xE1gina"},zh:{something_wrong:"\u51FA\u4E86\u70B9\u95EE\u9898\u3002",reload:"\u91CD\u88C5",let_us_know:"\u8BA9\u6211\u4EEC\u77E5\u9053\u53D1\u751F\u4E86\u4EC0\u4E48\u4E8B",we_have_been_notified:"\u6211\u4EEC\u7684\u56E2\u961F\u5DF2\u7ECF\u63A5\u5230\u901A\u77E5\u3002\u5982\u679C\u4F60\u60F3\u5E2E\u5FD9\uFF0C\u4F60\u53EF\u4EE5\u5728\u4E0B\u9762\u63CF\u8FF0\u53D1\u751F\u4E86\u4EC0\u4E48\u3002",search:"\u641C\u7D22",search_ask:"\u63D0\u95EE",search_placeholder:"\u641C\u7D22\u5185\u5BB9\u2026",search_placeholder_ask:"\u63D0\u95EE\u2026",search_blankslate:"\u8F93\u5165\u5173\u952E\u8BCD\u641C\u7D22",search_blankslate_ai:"\u6211\u4EEC\u5C06\u7528\u8BAD\u7EC3\u8FC7\u7684 AI \u6A21\u578B\u6765\u56DE\u7B54\u4F60\u7684\u95EE\u9898\u3002",search_blankslate_recent_searches:"\u6700\u8FD1\u641C\u7D22",search_blankslate_recent_questions:"\u6700\u8FD1\u63D0\u95EE",search_blankslate_recommended_questions:"\u4F60\u53EF\u80FD\u611F\u5174\u8DA3\u7684\u95EE\u9898",search_blankslate_query:'\u6CA1\u6709\u627E\u5230\u4E0E "${1}" \u76F8\u5173\u7684\u5185\u5BB9',search_answer_sources:"\u56DE\u7B54\u57FA\u4E8E ${1} \u6765\u6E90",search_answer_copy:"\u590D\u5236\u56DE\u7B54",search_answer_feedback_upvote:"\u6807\u8BB0\u4E3A\u6709\u7528",search_answer_feedback_downvote:"\u6807\u8BB0\u4E3A\u65E0\u7528",search_answer_feedback_title:"\u611F\u8C22\u60A8\u7684\u53CD\u9988\uFF01",search_answer_feedback_details:"\u8FD9\u5C06\u5E2E\u52A9\u6211\u4EEC\u6539\u8FDB\u56DE\u7B54\u5F15\u64CE\u3002",search_answer_loading:"\u6B63\u5728\u5206\u6790\u5185\u5BB9\u4EE5\u56DE\u7B54\u60A8\u7684\u95EE\u9898\u2026",search_answer_loading_wait:"\u8FD9\u53EF\u80FD\u9700\u8981\u51E0\u79D2\u949F\u3002",search_answer_none_title:"\u6CA1\u6709\u627E\u5230\u4E0E\u60A8\u7684\u95EE\u9898\u76F8\u5173\u7684\u56DE\u7B54\u3002",search_answer_none_details:"\u8FD9\u53EF\u80FD\u662F\u7531\u4E8E\u6CA1\u6709\u4E0E\u60A8\u7684\u95EE\u9898\u76F8\u5173\u7684\u5185\u5BB9\uFF0C\u6216\u8005\u56DE\u7B54\u4E0D\u80FD\u88AB\u5145\u5206\u4FE1\u4EFB\u3002",search_answer_error_title:"\u610F\u5916\u9519\u8BEF",search_answer_error_details:"\u53D1\u751F\u4E86\u4E00\u4E2A\u9519\u8BEF\u3002\u8BF7\u7A0D\u540E\u518D\u8BD5\u3002",search_goto_section:"\u8DF3\u8F6C\u5230\u7AE0\u8282",search_goto_page:"\u8DF3\u8F6C\u5230\u9875\u9762",page_not_found:"\u672A\u627E\u5230\u7F51\u9875",back_to_home:"\u8FD4\u56DE\u9996\u9875",page_not_found_long:"\u62B1\u6B49\uFF0C\u60A8\u8981\u627E\u7684\u9875\u9762\u65E0\u6CD5\u627E\u5230\u3002",outline:"\u5927\u7EB2",last_modified:"\u6700\u8FD1\u66F4\u65B0 ${1}",was_it_helpful:"\u6B64\u9875\u9762\u662F\u5426\u6709\u5E2E\u52A9\uFF1F",poor_content:"\u5185\u5BB9\u5DEE",ok_content:"\u597D\u7684\u5185\u5BB9",excellent_content:"\u4F18\u79C0\u7684\u5185\u5BB9",powered_by:"\u7531 ${1} \u63D0\u4F9B\u652F\u6301",previous:"\u4EE5\u524D",next:"\u4E0B\u4E00\u4E2A",export_pdf:"\u5BFC\u51FA\u4E3APDF",copy_link:"\u590D\u5236\u94FE\u63A5",switch_to_dark_theme:"Switch to dark theme",switch_to_light_theme:"Switch to light theme",edit_on_github:"\u5728 ${1} \u4E0A\u7F16\u8F91",page_articles_section:"\u4EE5\u4E0B\u662F\u672C\u8282\u4E2D\u7684\u6587\u7AE0\uFF1A",main:"\u4E3B\u8981",cookie_policy:"cookie\u653F\u7B56",cookie_prompt:"\u672C\u7F51\u7AD9\u4F7F\u7528cookies\u6765\u63D0\u4F9B\u670D\u52A1\u548C\u5206\u6790\u6D41\u91CF\u3002\u901A\u8FC7\u6D4F\u89C8\u672C\u7F51\u7AD9\uFF0C\u60A8\u63A5\u53D7\u6211\u4EEC\u7684${1}\u3002",cookies:"Cookies",reject_all:"\u62D2\u7EDD\u6240\u6709",theme_change_appearance:"\u6539\u53D8\u5916\u89C2",connection_lost:"\u8FDE\u63A5\u4E22\u5931",network_troubleshooting:"\u7F51\u7EDC\u6545\u969C\u6392\u9664",device_offline:"\u60A8\u7684\u8BBE\u5907\u53EF\u80FD\u5904\u4E8E\u79BB\u7EBF\u72B6\u6001\uFF0C\u6216\u8005 GitBook \u53EF\u80FD\u9047\u5230\u95EE\u9898\u3002",missing_content_title:"\u54CE\u5440\uFF0C\u6709\u4E9B\u4E1C\u897F\u4E22\u5931\u4E86\u3002",missing_content_description:"\u6211\u4EEC\u65E0\u6CD5\u627E\u5230\u539F\u59CB\u6765\u6E90\u4EE5\u663E\u793A\u6B64\u5185\u5BB9\u3002",table_of_contents:"\u76EE\u5F55",page_outline:"\u9875\u9762\u5927\u7EB2"},ja:{something_wrong:"\u4F55\u304B\u554F\u984C\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002",reload:"\u30EA\u30ED\u30FC\u30C9",let_us_know:"\u4F55\u304C\u8D77\u3053\u3063\u305F\u306E\u304B\u3092\u6559\u3048\u3066\u304F\u3060\u3055\u3044",we_have_been_notified:"\u79C1\u305F\u3061\u306E\u30C1\u30FC\u30E0\u306F\u901A\u77E5\u3092\u53D7\u3051\u307E\u3057\u305F\u3002\u3054\u5354\u529B\u3044\u305F\u3060\u3051\u308B\u5834\u5408\u306F\u3001\u4F55\u304C\u8D77\u3053\u3063\u305F\u304B\u3092\u4EE5\u4E0B\u306B\u3054\u8A18\u5165\u304F\u3060\u3055\u3044\u3002",search:"\u691C\u7D22",search_ask:"\u8CEA\u554F\u3059\u308B",search_placeholder:"\u691C\u7D22\u2026",search_placeholder_ask:"\u8CEA\u554F\u2026",search_blankslate:"\u30AD\u30FC\u30EF\u30FC\u30C9\u3092\u5165\u529B\u3057\u3066\u691C\u7D22",search_blankslate_ai:"\u8CEA\u554F\u306B\u5BFE\u3059\u308B\u56DE\u7B54\u306F\u3001AI\u30E2\u30C7\u30EB\u306B\u3088\u3063\u3066\u884C\u308F\u308C\u307E\u3059\u3002",search_blankslate_recent_searches:"\u6700\u8FD1\u306E\u691C\u7D22",search_blankslate_recent_questions:"\u6700\u8FD1\u306E\u8CEA\u554F",search_blankslate_recommended_questions:"\u304A\u3059\u3059\u3081\u306E\u8CEA\u554F",search_blankslate_query:'"${1}" \u306B\u95A2\u3059\u308B\u30B3\u30F3\u30C6\u30F3\u30C4\u306F\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F',search_answer_sources:"\u56DE\u7B54\u306F ${1} \u304B\u3089\u306E\u60C5\u5831\u3092\u5143\u306B\u3057\u3066\u3044\u307E\u3059",search_answer_copy:"\u56DE\u7B54\u3092\u30B3\u30D4\u30FC",search_answer_feedback_upvote:"\u5F79\u306B\u7ACB\u3063\u305F\u3068\u30DE\u30FC\u30AF",search_answer_feedback_downvote:"\u5F79\u306B\u7ACB\u305F\u306A\u304B\u3063\u305F\u3068\u30DE\u30FC\u30AF",search_answer_feedback_title:"\u30D5\u30A3\u30FC\u30C9\u30D0\u30C3\u30AF\u3042\u308A\u304C\u3068\u3046\u3054\u3056\u3044\u307E\u3059\uFF01",search_answer_feedback_details:"\u3053\u308C\u306B\u3088\u308A\u3001\u56DE\u7B54\u30A8\u30F3\u30B8\u30F3\u3092\u6539\u5584\u3067\u304D\u307E\u3059\u3002",search_answer_loading:"\u8CEA\u554F\u306B\u56DE\u7B54\u3059\u308B\u305F\u3081\u306B\u30B3\u30F3\u30C6\u30F3\u30C4\u3092\u5206\u6790\u3057\u3066\u3044\u307E\u3059\u2026",search_answer_loading_wait:"\u3053\u308C\u306B\u306F\u6570\u79D2\u304B\u304B\u308B\u5834\u5408\u304C\u3042\u308A\u307E\u3059\u3002",search_answer_none_title:"\u8CEA\u554F\u306B\u5BFE\u3059\u308B\u56DE\u7B54\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002",search_answer_none_details:"\u3053\u308C\u306F\u3001\u8CEA\u554F\u306B\u95A2\u9023\u3059\u308B\u30B3\u30F3\u30C6\u30F3\u30C4\u304C\u306A\u3044\u304B\u3001\u56DE\u7B54\u304C\u4FE1\u983C\u3067\u304D\u306A\u3044\u305F\u3081\u304B\u3082\u3057\u308C\u307E\u305B\u3093\u3002",search_answer_error_title:"\u30A8\u30E9\u30FC",search_answer_error_details:"\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u5F8C\u3067\u3082\u3046\u4E00\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002",search_goto_section:"Go to section",search_goto_page:"Go to page",page_not_found:"\u30DA\u30FC\u30B8\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093",back_to_home:"\u30D5\u30ED\u30F3\u30C8\u30DA\u30FC\u30B8\u306B\u623B\u308B",page_not_found_long:"\u7533\u3057\u8A33\u3042\u308A\u307E\u305B\u3093\u304C\u3001\u304A\u63A2\u3057\u306E\u30DA\u30FC\u30B8\u306F\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002",outline:"\u6982\u8981",last_modified:"\u6700\u7D42\u66F4\u65B0 ${1}",was_it_helpful:"\u3053\u306E\u30DA\u30FC\u30B8\u306F\u5F79\u306B\u7ACB\u3061\u307E\u3057\u305F\u304B\uFF1F",poor_content:"\u60AA\u3044\u5185\u5BB9",ok_content:"OK\u30B3\u30F3\u30C6\u30F3\u30C4",excellent_content:"\u512A\u308C\u305F\u5185\u5BB9",powered_by:"${1} \u4E0A\u3067\u52D5\u4F5C\u3057\u3066\u3044\u307E\u3059",previous:"\u524D",next:"\u6B21",export_pdf:"PDF\u306B\u51FA\u529B",copy_link:"\u30EA\u30F3\u30AF\u306E\u30B3\u30D4\u30FC",switch_to_dark_theme:"Switch to dark theme",switch_to_light_theme:"Switch to light theme",edit_on_github:"${1}\u3067\u7DE8\u96C6",page_articles_section:"\u3053\u306E\u30BB\u30AF\u30B7\u30E7\u30F3\u306E\u8A18\u4E8B\u306F\u6B21\u306E\u3068\u304A\u308A\u3067\u3059:",main:"\u4E00\u6B21",cookie_policy:"\u30AF\u30C3\u30AD\u30FC\u30DD\u30EA\u30B7\u30FC",cookie_prompt:"\u3053\u306E\u30B5\u30A4\u30C8\u3067\u306F\u3001\u30B5\u30FC\u30D3\u30B9\u306E\u63D0\u4F9B\u3084\u30C8\u30E9\u30D5\u30A3\u30C3\u30AF\u306E\u5206\u6790\u306E\u305F\u3081\u306B\u30AF\u30C3\u30AD\u30FC\u3092\u4F7F\u7528\u3057\u3066\u3044\u307E\u3059\u3002\u3053\u306E\u30B5\u30A4\u30C8\u3092\u95B2\u89A7\u3059\u308B\u3053\u3068\u3067\u3001\u304A\u5BA2\u69D8\u306F\u5F53\u793E\u306E${1}\u306B\u540C\u610F\u3057\u305F\u3053\u3068\u306B\u306A\u308A\u307E\u3059\u3002",cookies:"\u30AF\u30C3\u30AD\u30FC",reject_all:"\u5168\u3066\u3092\u62D2\u5426\u3059\u308B",theme_change_appearance:"\u5916\u89B3\u3092\u5909\u66F4\u3059\u308B",connection_lost:"\u63A5\u7D9A\u5207\u65AD",network_troubleshooting:"\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u306E\u30C8\u30E9\u30D6\u30EB\u30B7\u30E5\u30FC\u30C6\u30A3\u30F3\u30B0",device_offline:"\u30C7\u30D0\u30A4\u30B9\u304C\u30AA\u30D5\u30E9\u30A4\u30F3\u3067\u3042\u308B\u304B\u3001GitBook\u3067\u554F\u984C\u304C\u767A\u751F\u3057\u3066\u3044\u308B\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002",missing_content_title:"\u304A\u3063\u3068\u3001\u4F55\u304B\u304C\u5931\u308F\u308C\u3066\u3044\u307E\u3059\u3002",missing_content_description:"\u3053\u306E\u30B3\u30F3\u30C6\u30F3\u30C4\u3092\u8868\u793A\u3059\u308B\u305F\u3081\u306E\u5143\u306E\u30BD\u30FC\u30B9\u3092\u898B\u3064\u3051\u308B\u3053\u3068\u304C\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002",table_of_contents:"\u76EE\u6B21",page_outline:"\u30DA\u30FC\u30B8\u6982\u8981"}};function ce(){let{locale:t}=Mi.useContext($o),o=f0[t];return Mi.useCallback((e,...n)=>{let r=o[e]||f0.en[e],i=[],a=r;return n.forEach((s,l)=>{if(typeof s=="string")a=a.replace(`\${${l+1}}`,s);else{let[u,d]=a.split(`\${${l+1}}`);i.push(Mi.createElement(Mi.Fragment,{key:`string-${l}`},u)),i.push(Mi.createElement(Mi.Fragment,{key:`arg-${l}`},s)),a=d}}),i.length?Mi.createElement(Mi.Fragment,null,i,a):a},[t])}function of(){let t=ce();return g0.createElement(ki,{kind:"default",title:t("missing_content_title"),details:t("missing_content_description")})}c();var Xd=b(x());function fv(t){let{mark:o,node:e,offset:n,attributes:r,children:i,editor:a,getPalette:s}=t,l=o.data.toObject(),{value:u}=l,d=Xd.useRef(null),p=Yo(u),f=le(d);return Kh(()=>{if(!f.opened&&a.value.isFocused){let m=()=>be.create({anchorKey:e.key,anchorOffset:n,focusKey:e.key,focusOffset:n+p.current.length+1});f.open(ed(s(l,m),u))}},150),Xd.useEffect(()=>{f.opened&&f.typeQuery(u)},[f,u]),Xd.createElement(Bt,{ref:d,...r},i)}function h0(t){let{editor:o,node:e,children:n}=t,{readOnly:r}=o,i=e.data.toFrozenObject(),a=Je(),s=Jg(i.syntax||"text"),l=typeof i.title=="string",u=Oo.useRef(null),d=le(u),p=Oo.useRef(null),f=le(p),m=(S,C)=>{o.change(k=>{k.insertDataByKey(e.key,["title"],S)})},h=()=>eo.getCodeText(e),y=$W(e.key);return Oo.createElement(Se,{...t,palette:y},Oo.createElement(q1,{overflow:i.overflow||aO,lineNumbers:!!i.lineNumbers,header:l?Oo.createElement(jW,{title:i.title,isEditable:!r,onTitleChange:m}):null,showToolbar:d.opened||f.opened,translate:!1,toolbar:a?null:Oo.createElement(Oo.Fragment,null,r?null:Oo.createElement(W,{ref:u,active:d.opened,kind:"secondary",size:"small",style:g.Margin.xsmallRight,rightIcon:v.ChevronDown,onPress:()=>{d.open(y0(o,e.key))}},s.title),Oo.createElement(Xg,{kind:"secondary",size:"small",content:h}),r?null:Oo.createElement(W,{ref:p,icon:v.MoreVertical,kind:"secondary",size:"small",style:g.Margin.xsmallLeft,title:"More options",onPress:()=>{f.open(y)}}))},n))}function jW(t){let{title:o,isEditable:e,onTitleChange:n}=t,[r,i]=Oo.useState(o),[a,s]=_(D);Oo.useEffect(()=>{i(o)},[o]);let l=d=>{n(r||"",d)},u=[s.Body,s.textMuted];return Oo.createElement(Ug,{style:[w.directionRow,w.alignCenter,g.Padding.mediumLeft]},e?Oo.createElement(gv.TextInput,{value:r,placeholder:"Enter a filename",placeholderTextColor:a.colors.text.muted,onChangeText:d=>i(d),style:u,onBlur:l}):Oo.createElement(gv.Text,{style:u},o))}function $W(t){let o=wc(),e=Pi(o,t),n=r=>{let i=o.value.document.assertBlock(r),a=i.data.toFrozenObject(),s=typeof a.title=="string";return[{key:"code",commands:[{key:"syntax",title:"Set syntax\u2026",icon:v.Code,descendant:()=>y0(o,i.key)}]},{key:"code-options",commands:[{key:"with-line-numbers",icon:v.CodeLineNumbers,type:2,enabled:!!a.lineNumbers,title:"With line numbers",trigger:()=>(o.change(l=>{a.lineNumbers?l.removeDataPathByKey(i.key,["lineNumbers"]):l.setDataByKey(i.key,["lineNumbers"],!0)}),nt(o,i.key,n(i.key)))},{key:"with-title",icon:v.CodeCaption,type:2,enabled:s,title:"With caption",trigger:()=>(o.change(l=>{s?l.removeDataPathByKey(i.key,["title"]):l.insertDataByKey(i.key,["title"],"")}),nt(o,i.key,n(i.key)))},{key:"with-wrap",icon:v.CodeWrap,type:2,enabled:a.overflow==="wrap",title:"Wrap code",trigger:()=>(o.change(l=>{a.overflow==="wrap"?l.removeDataPathByKey(i.key,["overflow"]):l.setDataByKey(i.key,["overflow"],"wrap")}),nt(o,i.key,n(i.key)))}]},...e?[e]:[]]};return nt(o,t,n(t))}function y0(t,o){let e=t.value.document.assertBlock(o),n=e.data.get("syntax");return ae({search:"Select a syntax\u2026",groups:[{key:"syntaxes",commands:H1().map(r=>({type:1,key:r.key,selected:n===r.key,title:r.title,trigger:()=>{t.change(i=>{i.setDataByKey(e.key,["syntax"],r.key)})}}))}]})}c();var v0=b(x());function b0(t){let{node:o,parent:e,children:n,editor:r}=t,{diff:i,highlighted:a}=o.data.toFrozenObject(),s=()=>{r.change(l=>{l.setDataByKey(o.key,["highlighted"],!a)})};return v0.createElement(F1,{number:e.getChildIndex(o.key)+1,highlighting:i==="added"||i==="deleted"||i==="modified"?i:a?"highlighted":void 0,onPressGutter:r.readOnly?void 0:s},n)}c();var su=b(vi());var ZW=(0,su.isKeyHotkey)("mod+a"),JW=(0,su.isKeyHotkey)("shift+tab"),QW=(0,su.isKeyHotkey)("tab"),ez=(0,su.isKeyHotkey)("mod+enter"),tz=(0,su.isKeyHotkey)("enter"),oz=(0,su.isKeyHotkey)("backspace"),w0={onKeyDown:nz,onPaste:rz};function nz(t,o,e){let{value:n}=o;if(Po(n.selection))return;let r=eo.getCurrentCode(n);if(r){if(ZW(t))return iz(r,t,o,e);if(JW(t))return sz(r,t,o,e);if(QW(t))return az(r,t,o,e);if(ez(t))return lz(r,t,o,e);if(tz(t))return cz(r,t,o,e);if(oz(t))return uz(r,t,o,e)}}function rz(t,o,e){let{value:n}=o;if(Po(n.selection))return;let r=eo.getCurrentCode(o.value),{endBlock:i}=n;if(!r||!i||!r.hasDescendant(i.key))return;let a=Ju(t),s;a.type==="fragment"&&a.fragment?s=a.fragment.getTexts().map(d=>d.text).join(` `):s=a.text||"";let l=eo.createCodeBlock(s).blockNodes,u=pc.create({nodes:l});return o.insertDocument(u)}function iz(t,o,e,n){o.preventDefault();let r=t.getFirstText(),i=t.getLastText();if(!(!r||!i))return e.collapseToStartOf(r).extendToEndOf(i)}function az(t,o,e,n){let{value:r}=e;o.preventDefault(),o.stopPropagation();let{isCollapsed:i}=r,a=eo.getIndent(eo.getCodeText(t));return i?e.insertText(a).focus():eo.indentLines(e,a)}function sz(t,o,e,n){o.preventDefault(),o.stopPropagation();let r=eo.getIndent(eo.getCodeText(t));return eo.dedentLines(e,r)}function cz(t,o,e,n){let{value:r}=e;if(!r.isCollapsed)return;o.preventDefault();let{startBlock:i}=r;if(!i)return;let a=i.text,s=eo.getIndent(a,"");return e.splitBlock().insertText(s).focus()}function lz(t,o,e,n){let{value:r}=e;if(r.isCollapsed)return o.preventDefault(),wt(e,t),e}function uz(t,o,e,n){let{value:r}=e;if(r.isExpanded)return;let{startOffset:i,startText:a}=r,s=r.startBlock;if(!s)return;let l=eo.getIndent(eo.getCodeText(t));if(s.text.slice(0,i).endsWith(l))return o.preventDefault(),e.deleteBackward(l.length).focus();let d=i===0&&t.getFirstText()===a,p=t.nodes.size===1&&s.text.length===0;if(d&&p)return o.preventDefault(),e.setBlocks(fe,{normalize:!1}).unwrapNodeByKey(s.key)}c();var Za=b(x()),pf=b(z());c();var S0=b(x());function C0(t){let o=t?new URL(t).hostname:null,[{data:e}]=xi([o?No("listIntegrations",{},{query:{blockDomain:o}}):null],{suspend:!1});return S0.useMemo(()=>{if(!e||!t)return;let n=Ag(Ng(e.items),t);if(!n)return;let r=e.items.find(i=>i.name===n.integrationKey);if(r)return{integration:r,block:n.block}},[e?.items,t])}function hv(t){let{url:o,readOnly:e}=t,[{data:n}]=xi([No("getEmbedByUrl",{},{query:{url:o}})],{throwOnError:!1}),r=C0(e?null:o),i=r?Za.createElement(dz,{...r}):null;if(!n)return Za.createElement(oi,null);if(n.type==="rich"&&n.html){let a=Za.createElement("div",{dangerouslySetInnerHTML:{__html:n.html}});return i?Za.createElement(pf.View,null,a,Za.createElement(pf.View,{style:pz.overlayInstallButton},i)):a}return Za.createElement(Ka,{href:o,title:n.title,details:n.site,icon:n.icon?mt(Da,{source:{uri:n.icon}}):void 0,onPress:a=>{a.preventDefault(),Ts(o)},buttons:i?[i]:[]})}function dz(t){let{integration:o}=t,{navigate:e}=we(),{logAnalyticsEvent:n}=Za.useContext(de),r=i=>{i.stopPropagation(),i.preventDefault(),n({type:"edit_open_integration",integration:o.name,reason:"embed"}),e({overlay:{type:"integrations",integration:o.name}})};return Za.createElement(W,{kind:"secondary",size:"medium",icon:mt(ad,{integration:o}),title:`Install the ${o.title} integration to supercharge this block`,tooltipPreferredPlacement:"left",onPress:r},"Install ",o.title)}var pz=pf.StyleSheet.create({overlayInstallButton:{position:"absolute",bottom:g.medium,right:g.medium}});c();var zo=b(x());c();var jc=b(x()),Zs=b(z());function $c(t){let{node:o,editor:e,isSelected:n}=t,{readOnly:r}=e,[,i]=_(D),a=V.useInteractiveState(),s=o.fragments.get(sO),l=s?.isEmpty;return s?(n||a.hovered)&&!r||!l?jc.createElement(Zs.View,{style:[k0.editableCaption,g.Padding.smallTop],...a.events},l?jc.createElement(Zs.View,{style:[Zs.StyleSheet.absoluteFill,w.alignCenter,w.justifyContentCenter,g.Padding.smallTop]},jc.createElement(Zs.Text,{style:[i.Italic,i.Body,i.textMuted]},"Write a caption")):null,jc.createElement(Lr.Provider,{value:"caption"},jc.createElement(Bc.Provider,{value:"center"},jc.createElement(ur,{fragment:"caption"})))):r?null:jc.createElement(Zs.View,{style:[g.Padding.smallTop,k0.blankPlaceHolder],...a.events}):null}var k0=Zs.StyleSheet.create({editableCaption:{position:"relative",textAlign:"center"},blankPlaceHolder:{height:g.small+Vg.xsmall}});c();var en=b(x());c();var Zc=b(x());function yv(t){let{children:o}=t,[e,n]=Zc.useState(!1);return Zc.useEffect(()=>{n(!0)},[]),e?Zc.createElement(Zc.Fragment,null,o):null}c();var vv=b(x());function x0(t){let{children:o,statusCode:e}=t,n=g_();return n.staticContext&&(n.staticContext.statusCode=e),vv.createElement(vv.Fragment,null,o)}var bv=en.forwardRef(function(o,e){let{data:n,readOnly:r,onDataChange:i}=o,{integrationBlocksRemote:a,integrationBlocksContext:s}=en.useContext(de),l=en.useRef(null);if(!s)throw new Error("Expected integration blocks context to be defined");let u={integrationId:n.integration,componentId:n.block,props:n.props,action:n.action,context:s},[d,p]=M_(async f=>l.current?.dispatchAction(f));return en.useImperativeHandle(e,()=>({getPaletteGroups:()=>{let{result:f}=a.readCacheState(u);return f&&f.element.type==="block"?d(f.element):[]}})),en.createElement(en.Fragment,null,p,en.createElement(en.Suspense,{fallback:en.createElement(oi,null)},en.createElement(yv,null,en.createElement(L_,{ref:l,mode:"block",remote:a,input:u,security:{firstPartyDomains:[Ia.integrations.domain]},onPropsChange:f=>{r||i({...n,action:void 0,props:f})}}))))});function O0(t){let{node:o,editor:e}=t,n=Pi(e,o.key);return zo.createElement(Se,{palette:()=>nt(e,o.key,n?[n]:[]),...t},zo.createElement(Ut,{...t},zo.createElement(zo.Suspense,{fallback:zo.createElement(oi,null)},zo.createElement(mz,{...t}))),zo.createElement($c,{...t}))}function mz(t){let{node:o,editor:e}=t,{readOnly:n}=e,r=o.data.toFrozenObject(),{integrationsBlocksSubscription:i}=zo.useContext(de),a=zo.useSyncExternalStore(i.subscribe,i.getCurrentValue,()=>i.getCurrentValue()),s=zo.useMemo(()=>{let l=Ag(a,r.url);return l?Og.createIntegrationBlockDataForLinkUnfurl(l.integrationKey,l.block.id,r.url):null},[a,r.url]);return zo.useEffect(()=>{!s||n||e.change(l=>{l.setNodeByKey(o.key,{type:Yr,data:s})})},[e,n,s,o.key]),s?zo.createElement(bv,{data:s,readOnly:n,onDataChange:l=>{e.change(u=>{u.setNodeByKey(o.key,{type:Yr,data:l})})}}):zo.createElement(hv,{url:r.url,readOnly:n})}c();var Ft=b(x());c();var Ud=b(x());function _0(t){let{integrationName:o}=t,[{data:e}]=xi([No("getIntegrationByName",{integrationName:o})],{throwOnError:!1});return e?Ud.createElement(fz,{integration:e}):Ud.createElement(ki,{kind:"default",title:`Integration ${o} no longer exist or has been unpublished.`})}function fz(t){let{integration:o}=t,e=ju(To(ad,{integration:o},[o])),{navigate:n}=we(),{logAnalyticsEvent:r}=Ud.useContext(de);return Ud.createElement(ki,{kind:"default",icon:e,title:`Integration ${o.title} is not configured. Install it to get started.`,actions:[{label:"Install",onPress:()=>{r({type:"edit_open_integration",integration:o.name,reason:"empty"}),n({overlay:{type:"integrations",integration:o.name}})}}]})}function R0(t){let{node:o,editor:e}=t,{readOnly:n}=e,r=Ft.useRef(null),{integrationsBlocksSubscription:i}=Ft.useContext(de),{navigate:a}=we(),s=Ft.useSyncExternalStore(i.subscribe,i.getCurrentValue,()=>i.getCurrentValue()),l=o.data.toFrozenObject(),u=Pi(e,o.key),d=()=>nt(e,o.key,[...r?.current?.getPaletteGroups()||[],{key:"integration",commands:()=>{let{data:f}=Pl(No("getIntegrationByName",{integrationName:l.integration}));return f?[{key:"integration.settings",icon:mt(ad,{integration:f}),title:`Configure ${f.title}`,trigger:()=>{a({overlay:{type:"integrations",integration:f.name}})}}]:[]}},...u?[u]:[]]);return Ft.useMemo(()=>JO(s,l.integration,l.block),[s,l.integration,l.block])?Ft.createElement(Se,{...t,palette:d},Ft.createElement(Ut,{...t},Ft.createElement(Ft.Suspense,{fallback:Ft.createElement(oi,null)},Ft.createElement(bv,{ref:r,data:l,readOnly:n,onDataChange:f=>{e.change(m=>{m.setNodeByKey(o.key,{data:f})})}})))):Ft.createElement(Se,{...t,palette:d},Ft.createElement(Ut,{...t},Ft.createElement(Ft.Suspense,{fallback:Ft.createElement(oi,null)},l.url?Ft.createElement(hv,{url:l.url,readOnly:n}):n?Ft.createElement(of,null):Ft.createElement(_0,{integrationName:l.integration}))))}c();var wv=b(vi());var I0={onKeyDown:(t,o,e)=>{let{value:n}=o;if(!n.isCollapsed||!(0,wv.default)("enter",t))return;let{startBlock:r,selection:i}=n;if(!be.isTextRange(i)||!r||r.type!==fe||!i.isAtEndOf(r))return;let{text:a}=r;if(!hi(a))return;let s=n.document.getParent(r.key);if(!s||!We(s,_n))return;let l=ag(a,{sortQueryParameters:!1}),u=wg.createEmbedBlock(l);o.replaceNodeByKey(r.key,u).collapseToStartOf(u)}},P0={onKeyDown:(t,o,e)=>{if((0,wv.default)("enter",t)||(0,wv.default)("shift+enter",t)){let{value:n}=o,{startBlock:r,document:i}=n;if(!r||r.type!==fe)return;let a=i.getFragmentParent(r.key);if(a?.object!=="fragment")return;let s=i.getParent(a.key);if(!s||!s.isBlock()||![_n,Zi,bs,vs].includes(s.type))return;let l=s.type===Zi?i.getParent(s.key):s;return wt(o,l),o}}};c();var wC=b(x());c();var Sv=b(x());function E0(t){let{editor:o}=t,e=Sv.useCallback((n,r)=>wd(a=>{o.change(s=>{s.insertInlineAtRange(r(),Sg.createEmoji(a)).focus()})},{withSearch:!1}),[o]);return Sv.createElement(fv,{...t,getPalette:e})}c();var mf=b(x());function T0(t){let{editor:o,node:e,parent:n}=t,r=mf.useRef(null),i=le(r),a=rv(n.object==="block"?n:null),s=Xh(()=>{i.open(wd(l=>{o.change(u=>{u.setNodeByKey(e.key,{data:{code:l}})})}))});return mf.createElement(Gd,{ref:r,...t,onPress:o.readOnly?void 0:s},mf.createElement(Lo,{code:e.data.get("code"),size:a}))}var M0="emojiContext",gz=/(^|\s):(\w*)$/,L0={renderMark:yz,renderNode:vz,decorateValue:hz};function hz(t){let{selection:o}=t,e=bz(t),n=[];return e!==null&&be.isTextRange(o)&&n.push(be.create({anchorKey:o.startKey,anchorOffset:o.startOffset-e.length-1,focusKey:o.startKey,focusOffset:o.startOffset,marks:[{type:M0,data:{value:e}}],isAtomic:!0})),n}function yz(t){let{mark:o}=t;switch(o.type){case M0:return wC.createElement(E0,{...t})}}function vz(t){let{node:o}=t;switch(o.type){case Xp:return wC.createElement(T0,{...t})}}function bz(t){if(!t.isCollapsed)return null;let{document:o,startText:e,startBlock:n,selection:r}=t;if(!be.isTextRange(r)||!e||!n||!Os({document:o,block:n},Xp))return null;let{startOffset:i}=r,a=e.text.slice(0,i),s=gz.exec(a);return s==null?null:s[2]}c();var Pt=b(x()),Yd=b(z());function wz(t,o,e){for(let[n,r]of t.entries())if(r===e){let i=o.getNode(n);return i?{key:n,id:r,node:i}:null}}function N0(t){let o=V.useInteractiveState(),{node:e,isFocused:n,editor:r}=t,[,i]=_(Sz),[,a]=_(D),{sections:s,selected:l}=Pt.useContext(Ri),u=Je(),d=Pt.useRef(""),[p,f]=Pt.useState("unset");Pt.useEffect(()=>{d.current="",f("unset")},[l]);let m=l&&s.get(e.key)===l,h=Pt.useMemo(()=>!m&&!!wz(s,e,l),[m,s,e,l]);m&&(d.current=l);let{selection:y}=r.value,S=be.isTextRange(y)&&y.hasEdgeIn(_s.getBodyFragment(e)),C=n&&be.isTextRange(y)&&!y.hasFocusInFragmentOf(e),k=u||(p==="unset"?m||h||l===d.current:p==="expanded"),O=k?v.ChevronDown:v.ChevronRight,R=()=>{k&&S&&r.change(me=>{me.collapseToStartOf(_s.getTitleFragment(e))}),f(k?"collapsed":"expanded")},{anchoredBlockId:I,onAnchoredBlockPress:E,anchorElement:P,anchoredBlockInteractiveState:L}=pv(e,{accessibilityLabel:"Direct link to expandable block",onBlockPress:R}),T=Pt.useId(),H={id:T,controls:{accessibilityRole:"button",accessibilityExpanded:k,accessibilityControls:`expandable-body-${T}`,accessibilityLabelledBy:`expandable-title-${T}`},chevron:{accessibilityRole:"presentation"},body:{accessibilityRole:"region",accessibilityLabelledBy:`expandable-title-${T}`}},U=e.fragments.get(Ss),K=U?.nodes.first(),Y=Ei(K,U||e),X=M.ICON_M,re=Y.paddingTop+(gr(K)-X)/2;return Pt.createElement(Se,{...t},Pt.createElement(Ut,{...t,isFocused:C},Pt.createElement(Yd.View,{...o.events,style:[i.expandable,o.active&&i.expandableActive],nativeID:I},Pt.createElement(Yd.View,{style:[w.directionRow,g.Padding.mediumRight],...L.events},Pt.createElement(V.TouchableOpacity,{onPress:E,style:[g.Padding.mediumHorizontal,w.directionRow,w.justifyContentCenter,{paddingTop:re}],...H.controls},Pt.createElement(O,{size:X,style:[o.active?a.primary:a.textMuted],...H.chevron})),Pt.createElement(Yd.View,{style:[w.flex1,{paddingTop:Y.paddingTop,paddingBottom:k?g.small:Y.paddingBottom}],nativeID:`expandable-title-${T}`},Pt.createElement(Lr.Provider,{value:"expandableTitle"},Pt.createElement(ur,{fragment:Ss}))),Pt.createElement(Yd.View,{style:{paddingTop:re}},P)),Pt.createElement(Yd.View,{style:[i.expandableBody,!k&&i.hidden],nativeID:`expandable-body-${T}`,...H.body},Pt.createElement(ur,{fragment:kl})))))}var Sz=F.create({hidden:{visibility:"hidden",height:0,padding:0,overflow:"hidden"},expandable:t=>({breakInside:"avoid",borderWidth:1,borderColor:t.colors.border.main,borderRadius:t.radiuses.large}),expandableActive:t=>({borderColor:t.colors.primary.main}),expandableBody:{padding:g.medium,paddingLeft:g.medium+M.ICON_M+g.medium,paddingTop:0}});c();var SC=b(vi());var A0={onKeyDown:Cz};function Cz(t,o){if(!Po(o.value.selection)){if((0,SC.default)("mod+enter",t))return xz(t,o);if((0,SC.default)("enter",t))return kz(t,o)}}function kz(t,o){let e=_s.getCurrentExpandable(o.value);if(e&&e.fragment?.type===Ss)return o.collapseToStartOf(e.expandable.getFragmentByKey(kl)).focus()}function xz(t,o){let{value:e}=o,n=_s.getCurrentExpandable(o.value);if(!(!n||!e.isCollapsed))return t.preventDefault(),wt(o,n.expandable),o}c();var B0=b(vi()),W0=b(x());c();var Cv=b(x());function D0(t){let{mark:o,node:e,offset:n,attributes:r,children:i,editor:a}=t,{value:s}=o.data.toObject(),l=Cv.useRef(null),u=be.create({anchorKey:e.key,anchorOffset:n,focusKey:e.key,focusOffset:n+1}),d=$y({anchorRef:l,range:u,editor:a}),p=le(l,{onClose:()=>{p.close(),a.change(f=>f.focus())}});return Kh(()=>{!p.opened&&a.value.isFocused&&p.open(ae({groups:[{key:"inline-controls",commands:d.filter(f=>s.includes(f.key))}]}))},150),Cv.createElement(Bt,{ref:l,...r},i)}var Oz=[mc,Xp,Rn,pg],z0="inlineControlsContext",_z=/(^|\s)\/$/,F0={renderMark:Iz,decorateValue:Rz,onKeyDown:(t,o,e)=>{if(V0(e.value)&&(0,B0.default)("esc",t))return o}};function Rz(t){let{selection:o}=t,e=V0(t),n=[];return qt(o)&&e!==null&&n.push(be.create({anchorKey:o.startKey,anchorOffset:o.startOffset-1,focusKey:o.startKey,focusOffset:o.startOffset,marks:[{type:z0,data:{value:e}}],isAtomic:!0})),n}function Iz(t){let{mark:o}=t;switch(o.type){case z0:return W0.createElement(D0,{...t})}}function V0(t){if(!t.isCollapsed)return null;let{startText:o,startBlock:e,selection:n}=t;if(!qt(n)||!o||!e)return null;let{startOffset:r}=n,i=o.text.slice(0,r);if(_z.exec(i)==null)return null;let s=Oz.filter(l=>Os({document:t.document,block:e},l));return s.length===0?null:s}c();var Ja=b(x()),K0=b(z());c();var bn=b(x()),Jc=b(z());function q0(t){let{resolved:o,node:e,editor:n,children:r}=t,i=lt(),a=bn.useRef(null),s=bn.useRef(null),[l,u]=bn.useState(!1),[d,p]=bn.useState(!1),[,f]=_(G0),m=Ce(),h=l||d,y=V.useInteractiveState({hoverDelay:500,onHoverIn:()=>{u(!0)},onHoverOut:()=>{u(!1)}}),S=V.useInteractiveState({onHoverIn:()=>{p(!0)},onHoverOut:()=>{p(!1)}});yc({opened:h,closeOnClick:!1,closeOnScroll:!0,onClose:()=>{u(!1),p(!1)}},s);let C=le(a),k=()=>{n.change(R=>{R.unwrapInlineByKey(e.key)})},O=()=>{C.open(Fn(R=>{n.change(I=>{I.setDataByKey(e.key,["ref"],R)})},{...i,document:n.value.document},m))};return bn.createElement(Ba,{ref:s,anchorRef:a,wrapper:Ci,opened:h,updateOnScroll:!1,anchor:({ref:R})=>r(R,{...y.events,style:C.opened?f.linkBeingEdited:null})},bn.createElement(Jc.View,{style:[Jc.StyleSheet.absoluteFill],...S.events},bn.createElement(O1,{kind:"tooltip",preferredAlignment:"start"},bn.createElement(Jc.View,null,bn.createElement(Pz,{resolved:o,onPressEdit:O,onPressRemove:k})))))}function Pz(t){let{resolved:o,onPressEdit:e,onPressRemove:n}=t,r=o.icon||o.secondaryIcon,[,i]=_(G0);return bn.createElement(Jc.View,{style:[w.directionRow,w.alignCenter,g.Padding.xsmall]},bn.createElement(Jc.View,{style:[i.buttonWrapper,w.directionRow]},bn.createElement(W,{title:"Edit link",icon:r,size:"small",kind:"default_inverted",onPress:e,style:w.flex1},o.title)),bn.createElement(Jc.View,null,bn.createElement(W,{title:"Remove link",kind:"default_inverted",icon:v.Trashcan,size:"small",onPress:n})))}var G0=F.create({buttonWrapper:{maxWidth:200},linkBeingEdited:t=>({backgroundColor:t.colors.background.standout})});var Ez=V.createInteractiveComponent(Bt);function X0(t){return Ja.createElement(Ja.Suspense,{fallback:Ja.createElement(U0,{...t,resolved:null})},Ja.createElement(Tz,{...t}))}function Tz(t){let{node:o}=t,{ref:e}=o.data.toFrozenObject(),n=Qe(e);return Ja.createElement(U0,{...t,resolved:n})}var H0=V.createInteractiveHandle("link");function U0(t){let{node:o,attributes:e,children:n,resolved:r,editor:i}=t,{readOnly:a}=i,[,s]=_(D),l=(u,d={})=>Ja.createElement(V.TouchableOpacity,{ref:u,handle:H0,...r?Vc(r):{},...d,style:[Mz.wrapper,d.style]},Ja.createElement(Ez.Child,{...e,descendantOf:H0,hoverStyle:[s.primaryStandout,s.Underline],inactiveStyle:s.primary},n));return a||!r?l():Ja.createElement(q0,{resolved:r,editor:i,node:o},l)}var Mz=K0.StyleSheet.create({wrapper:{display:"inline"}});c();var Y0=b(x());function j0(t){let o=lt(),e=Ce(),{logAnalyticsEvent:n}=t;return Y0.useMemo(()=>({onPaste:(r,i,a)=>{let s=Ju(r);if(!((s.type==="text"||s.type==="html")&&typeof s.text=="string"&&(hi(s.text)||Gx(s.text))))return;let l=s.text,{value:u}=i;if(u.isCollapsed){if(u.isInVoidBlock)return;i.insertText(l).extend(-l.length)}let d={kind:"url",url:l};i.wrapInline({type:Rn,data:{ref:d}});let p=i.value.inlines.filter(m=>m.type===Rn&&m.data.has("ref")&&sg(m.data.get("ref"),d)===!1);i.collapseToEnd();let f=Mg(l);return f&&tm(()=>Lg(f,o,{hiveClient:e}),null).then(m=>{m&&a.change(h=>{p.forEach(y=>{let S=h.value.document.getByKey(y.key);S&&h.setDataByKey(S.key,["ref"],m)})})}),n(df(r,"link")),i}}),[o,e])}c();var xv=b(x());c();var $0=b(x());var kv=$0.createContext(Ht);function Z0(t){let{node:o,children:e,attributes:n}=t;return xv.createElement(Se,{...t},xv.createElement(ge,{tag:o.type===Ht?"ol":"ul",...n},xv.createElement(kv.Provider,{value:o.type},e)))}c();var Li=b(x()),Ov=b(z());function J0(t){let{node:o,parent:e,children:n,editor:r}=t,{readOnly:i}=r,[,a]=_(D),s=Li.useContext(kv),l=o.data.toFrozenObject(),u=s===uo,d=s===Ht,p=s===po,f=Li.useMemo(()=>nt(r,o.key,[{key:"list",commands:[{key:"ul",type:1,title:"Unordered List",icon:v.ListUnordered,selected:e.type===uo,trigger:()=>{r.change(S=>{S.setNodeByKey(e.key,{type:uo})})}},{key:"ol",type:1,title:"Ordered List",icon:v.ListOrdered,selected:e.type===Ht,trigger:()=>{r.change(S=>{S.setNodeByKey(e.key,{type:Ht})})}},{key:"tasks",type:1,title:"Tasks List",icon:v.ListTasks,selected:e.type===po,trigger:()=>{r.change(S=>{S.setNodeByKey(e.key,{type:po})})}}]}]),[r,o.key,e.type]),m=S=>{r.change(C=>{pt.checkTaskItem(C,o.key,S)})},h=gr(o.nodes.first()),y=S=>S<10?g.medium:S<100?g.large:"auto";return Li.createElement(Se,{tag:"li",palette:f,contentProps:{style:ff.blockListItem},...t},p&&Li.createElement(ge,{editable:!1,style:[ff.blockListItemPrefix,{height:h}]},Li.createElement(Sc,{value:!!l.checked,onValueChange:m,readOnly:i,size:M.ICON_M})),u&&Li.createElement(ge,{editable:!1,style:[ff.blockListItemPrefix,{height:h}]},Li.createElement(v.Dot,{size:12,style:a.text})),d&&Li.createElement(Bt,{editable:!1,style:[ff.blockListItemPrefix,{height:h,width:y(e.getChildIndex(o.key)+1)},a.Body,a.text]},Lz(e,o)),Li.createElement(Ov.View,{style:ff.blockListItemContent},n))}function Lz(t,o){let e=t.data.toFrozenObject(),n=t.getChildIndex(o.key);return`${(e.start||1)+n}.`}var ff=Ov.StyleSheet.create({blockListItem:{position:"relative",display:"flex",flexDirection:"row"},blockListItemPrefix:{display:"flex",flexDirection:"row",alignItems:"center",marginLeft:g.small,marginRight:g.small},blockListItemContent:{flex:1}});c();var gf=b(vi());var Nz=(0,gf.isKeyHotkey)("tab"),Az=(0,gf.isKeyHotkey)("shift+tab"),Dz=(0,gf.isKeyHotkey)("enter"),Bz=(0,gf.isKeyHotkey)("backspace"),Q0={onKeyDown:zz,shouldNodeComponentUpdate:Wz};function Wz(t,o){if(t.node.type===Xo){let{parent:e,node:n}=t,{parent:r,node:i}=o;if(e.object!=="block"||r.object!=="block")throw new Error("Parent of list-item must be a block");if(e.type===Ht&&e.getChildIndex(n.key)!==r.getChildIndex(i.key))return!0}return null}function zz(t,o,e){if(Dz(t))return Fz(t,o,e);if(Nz(t)||Az(t))return qz(t,o,e);if(Bz(t))return Vz(t,o,e)}function Fz(t,o,e){if(t.shiftKey)return;let{value:n}=o,r=pt.getCurrentItem(n);if(!r)return;if(t.preventDefault(),n.isExpanded&&o.delete(),r.isEmpty)return pt.getItemDepth(n)>1?pt.decreaseItemsDepth(o):pt.unwrapList(o);pt.splitListItem(o);let i=pt.getListForItem(o.value,r);if(i&&i.type===po){let a=o.value.document.getNextSibling(r.key);return a?pt.checkTaskItem(o,a.key,!1):o}return o}function Vz(t,o,e){let{value:n}=o,{startOffset:r,selection:i}=n;if(!be.isTextRange(i)||i.isExpanded||r>0)return;let a=pt.getCurrentItem(n);if(a&&i.isAtStartOf(a))return t.preventDefault(),pt.unwrapList(o)}function qz(t,o,e){return t.shiftKey?(t.preventDefault(),pt.decreaseItemsDepth(o)):(t.preventDefault(),pt.increaseItemsDepth(o))}c();c();var tL=b(vi());function Gz(t){let{transform:o}=t,e=t.onHotkey?(0,tL.isKeyHotkey)(t.onHotkey):()=>!1,n=t.onInput?Hz(t.onInput):()=>!1,r=t.ignoreIn?eL(t.ignoreIn):null,i=t.onlyIn?eL(t.onlyIn):null;function a(p,f,m){if(!e(p))return;let h=u(f.value);if(h)return l(h,p,f,m),!0}function s(p,f,m){if(p.inputType!=="insertText"||!n(p))return;let h=u(f.value);if(h)return l(h,p,f,m),!0}function l(p,f,m,h){let{value:y}=m,{startOffset:S}=y,C=0;return d(p,S).forEach(O=>{m.moveOffsetsTo(O.start,O.end).delete(),C+=O.total}),S-=C,m.moveOffsetsTo(S,S),m.call(o,f,p,h),f.preventDefault(),!0}function u(p){if(p.isExpanded)return null;let{startBlock:f}=p;if(!f)return null;let{type:m}=f;if(i&&!i(m)||r&&r(m))return null;let{startText:h,startOffset:y}=p;Fe(h);let{text:S}=h,C=null,k=null;return t.after&&(C=S.slice(y).match(t.after)),t.before&&(k=S.slice(0,y).match(t.before)),t.before&&t.after&&!k&&(C=null),t.before&&t.after&&!C&&(k=null),!k&&!C?null:(C&&(C[0]=C[0].replace(/\s+$/,"")),k&&(k[0]=k[0].replace(/^\s+/,"")),{before:k,after:C})}function d(p,f){let{before:m,after:h}=p,y=[],S=0;if(m){let C=m[0],k=0,O=0;m.slice(1,m.length).forEach(R=>{R!==void 0&&(O=C.indexOf(R,O),k=f-S+O-C.length,y.push({start:k,end:k+R.length,total:R.length}),S+=R.length,O+=R.length)})}if(h){let C=h[0],k=0,O=0;h.slice(1,h.length).forEach(R=>{R!==void 0&&(O=C.indexOf(R,O),k=f-S+O,y.push({start:k,end:k+R.length,total:0}),S+=R.length,O+=R.length)})}return y}return{onKeyDown:a,onBeforeInput:s}}function Hz(t){if(typeof t=="string")return o=>!!(o.data&&o.data===t);if(typeof t=="function")return t;if(t instanceof RegExp)return o=>!!(o.data&&o.data.match(t));throw new Error("Invalid onInput option")}function eL(t){if(Array.isArray(t))return o=>t.includes(o);if(typeof t=="string")return o=>o===t;if(typeof t=="function")return t;throw new Error("Invalid matcher type")}var ni=Gz;var Kz=ni({onlyIn:[fe],onInput:"*",before:/\*\*[^*]+?\*$/,transform:(t,o,e)=>{if(jd(t.value,[ar,mo])||_v(t.value))return t.insertText("*");let n=e.before[0].slice(2).slice(0,-1);return hf(t.value,n,[mo,sr])?t.insertText("*"):t.deleteBackward(n.length+3).addMark(ar).insertText(n).removeMark(ar)}}),Xz=ni({onlyIn:[fe],onInput:"_",before:/\b_[^_]+?$/,transform:(t,o,e)=>{if(jd(t.value,[sr,mo])||_v(t.value))return t.insertText("_");let n=e.before[0].slice(1);return hf(t.value,n,[ar,mo])?t.insertText("_"):t.deleteBackward(n.length+1).addMark(sr).insertText(n).removeMark(sr)}}),Uz=ni({onlyIn:[fe],onInput:"~",before:/\~\~[^*]+?\~$/,transform:(t,o,e)=>{if(jd(t.value,[jr,mo])||_v(t.value))return t.insertText("~");let n=e.before[0].slice(2).slice(0,-1);return hf(t.value,n,[jr,mo])?t.insertText("~"):t.deleteBackward(n.length+3).addMark(jr).insertText(n).removeMark(jr)}}),Yz=ni({onlyIn:[fe],onInput:/`/,before:/`[^`]+?$/,transform:(t,o,e)=>{if(jd(t.value,mo))return t.insertText("`");let n=e.before[0].slice(1);return hf(t.value,n,[ar,sr])?t.insertText("`"):t.deleteBackward(n.length+1).addMark(mo).insertText(n).removeMark(mo)}}),jz=ni({onlyIn:[fe],onInput:"$",before:/\$\$[^*]+?\$$/,transform:(t,o,e)=>{if(jd(t.value,mo)||_v(t.value))return t.insertText("$");let n=e.before[0].slice(2).slice(0,-1);if(hf(t.value,n,[ar,mo,sr]))return t.insertText("$");t.deleteBackward(n.length+3);let r=Ol.createMathInline(n);return t.insertInline(r),t}}),$z=ni({onlyIn:[fe],onHotkey:"enter",before:/^\$\$$/,transform:(t,o,e)=>{let n=Ol.createMathBlock();return nL(t,n)}}),Zz=ni({onlyIn:[fe],onInput:" ",before:/^(-|\*)$/,transform:t=>oL(t.value)?t:pt.wrapInList(t,uo)}),Jz=ni({onlyIn:fe,onInput:" ",before:/^(([1-9]{1}\d*)\.)$/,transform:(t,o,e)=>{if(oL(t.value))return t;let n=parseInt(e.before[1],10);return pt.wrapInList(t,Ht,n&&n!==1?{start:n}:{})}}),Qz=ni({onlyIn:fe,onInput:"]",before:/^(\[[ xX])$/,transform:(t,o,e)=>{let n=pt.getCurrentList(t.value);if(n)t.setNodeByKey(n.key,{type:po});else{if(!t.value.isEmpty)return t.insertText(`${e.before[0]}]`);t=pt.wrapInList(t,po)}let r=pt.getCurrentItem(t.value),i=e.before[0][1]!==" ";return r?pt.checkTaskItem(t,r.key,i):t}}),e4=ni({onlyIn:fe,onHotkey:"enter",before:/^(```\S*\s*)$/,transform:(t,o,e)=>{let[n]=e.before,r=n.replace(/^```/,"").trim(),i=Jg(r),a=eo.createCodeBlock("",{syntax:i.key});return nL(t,a)}}),t4=ni({onlyIn:fe,onInput:" ",before:/^(>)$/,transform:(t,o,e)=>t.wrapBlock(Kt)});function oL(t){let{startBlock:o,document:e}=t;return o?e.getParent(o.key)?.type===Xo:!1}var o4=[Ve,Ge,tt],n4=ni({onlyIn:fe,onInput:" ",before:/^(#{1,3})$/,transform:(t,o,e)=>{let[n]=e.before,r=n.length,i=o4[r-1];return t.setBlocks({type:i})}});function jd(t,o){let e=typeof o=="string"?[o]:o;return t.marks.some(n=>e.includes(n.type))}function hf(t,o,e){let{startText:n,startOffset:r}=t;if(!n)return!1;let i=r-o.length,{leaf:a}=n.searchLeafAtOffset(i);return a?jd(a,e):!1}function _v(t){let{startText:o,startOffset:e}=t;if(!o)return!1;let n=o.text.slice(0,e);return!(!n||n.match(/^[^`]+$/))}function nL(t,o){let{startBlock:e}=t.value;if(e)return t.insertBlock(o).collapseToStartOf(o).removeNodeByKey(e.key)}var rL=[Kz,Xz,Uz,Yz,Zz,Jz,Qz,n4,jz,$z,e4,t4];c();var CC=b(x());c();var Ni=b(x()),$d=b(z());var Rv={[fe]:M.ICON_S,[Ve]:M.ICON_XL,[Ge]:M.ICON_L,[tt]:M.ICON_S};function iL(t){let{node:o,attributes:e,isSelected:n,parent:r}=t,i=o.data.toFrozenObject();return Ni.createElement(Ni.Suspense,{fallback:Ni.createElement(r4,{selected:n,attributes:e,parentType:r.type})},Ni.createElement(i4,{reference:i.ref,selected:n,attributes:e,parentType:r.type}))}function r4(t){let{selected:o,attributes:e,parentType:n}=t,[,r]=_(aL),i=o?N.textColor.primaryStandout:N.text.base,a=Rv[n||fe]||Rv[fe];return Ni.createElement($d.View,{style:[r.mention,o&&r.mentionSelected],...e},Ni.createElement(Re,{size:a,style:i}))}function i4(t){let{reference:o,selected:e,attributes:n,parentType:r}=t,[,i]=_(aL),[,a]=_(D),s=V.useInteractiveState(),l=Qe(o),u=Rv[r||fe]||Rv[fe],d=e?a.primaryStandout:a.text;return Ni.createElement($d.TouchableOpacity,{...s.events,...Vc(l)},Ni.createElement(ge,{tag:"span",style:[i.mention,s.hovered&&i.mentionHovered,e&&i.mentionSelected,w.directionRow,w.alignCenter],...n},l.secondaryIcon?Ni.createElement(l.secondaryIcon,{size:u,style:[d,i.mentionIcon]}):null,Ni.createElement($d.Text,{style:[d,a.Bold]},l.title)))}var aL=F.create({mention:t=>({borderRadius:t.radiuses.medium,paddingHorizontal:g.xsmall/2}),mentionHovered:t=>({backgroundColor:t.colors.background.muted}),mentionSelected:t=>({backgroundColor:t.colors.primary.muted}),mentionIcon:{marginRight:g.xsmall/2}});c();var Zd=b(x());function sL(t){let{editor:o}=t,{logAnalyticsEvent:e}=Zd.useContext(de),n=lt(),r=Ce(),i=Zd.useCallback((a,s)=>Fn(u=>{o.change(d=>{d.insertInlineAtRange(s(),{type:Up,data:{ref:u},isVoid:!0}).focus()}),e({type:"edit_page_document_insert_mention",kind:u.kind})},{...n,document:o.value.document},r,{withSearch:!1,accept:a.symbol==="@"?["user"]:["url","anchor","page","space","collection","file"]}),[o,r]);return Zd.createElement(fv,{...t,getPalette:i})}var cL="mentionContext",a4=/(^|\s)(@|#)(\w*)$/,lL={renderMark:l4,renderNode:c4,decorateValue:s4};function s4(t){let{selection:o}=t,e=u4(t),n=[];return be.isTextRange(o)&&e!==null&&n.push(be.create({anchorKey:o.startKey,anchorOffset:o.startOffset-e.value.length-1,focusKey:o.startKey,focusOffset:o.startOffset,marks:[{type:cL,data:{value:e.value,symbol:e.symbol}}],isAtomic:!0})),n}function c4(t){let{node:o}=t;switch(o.type){case Up:return CC.createElement(iL,{...t})}}function l4(t){let{mark:o}=t;switch(o.type){case cL:return CC.createElement(sL,{...t})}}function u4(t){if(!t.isCollapsed)return null;let{document:o,startText:e,startBlock:n,selection:r}=t;if(!be.isTextRange(r)||!e||!n||!Os({document:o,block:n},Up))return null;let{startOffset:i}=r,a=e.text.slice(0,i),s=a4.exec(a);return s?{symbol:s[2],value:s[3]}:null}c();var Ai=b(x()),yf=b(z());c();function Iv(t,o,e=[]){return nt(t,o,[{key:"types",commands:()=>{let n=t.value.document.assertBlock(o),r=t.value.document.getParent(o);if(!r)return[];let i=a=>{t.change(s=>{s.setNodeByKey(n.key,{type:a}).focus()})};return[{key:fe,title:"Paragraph",type:1,selected:n.type===fe,icon:v.Paragraph,trigger:()=>{i(fe)}},We(r,Ve)?{key:Ve,title:"Heading 1",type:1,selected:n.type===Ve,icon:v.Heading1,trigger:()=>{i(Ve)}}:null,We(r,Ge)?{key:Ge,title:"Heading 2",type:1,selected:n.type===Ge,icon:v.Heading2,trigger:()=>{i(Ge)}}:null,We(r,tt)?{key:tt,title:"Heading 3",type:1,selected:n.type===tt,icon:v.Heading3,trigger:()=>{i(tt)}}:null].filter(se)}},...e])}function uL(t){let{editor:o,node:e,parent:n,children:r,attributes:i}=t,[,a]=_(D),[,s]=_(m4),l=Ai.useContext(Bc),u=Ai.useContext(Lr),d=p4(n),p=[a.Body,a.text,s[l],s[u]],f=Ai.createElement(yf.Text,{selectable:!0,style:p},r),m=Ai.useMemo(()=>Iv(o,e.key),[o,e.key]),h=Yp(e);return d4(n)?!o.readOnly&&h?Ai.createElement(e0,{...t,placeholder:d},f):Ai.createElement(Se,{...t,palette:m},f):Ai.createElement(ge,{...i},!o.readOnly&&d&&h&&vg(n)?Ai.createElement(ge,{editable:!1,pointerEvents:"none",style:[yf.StyleSheet.absoluteFill]},Ai.createElement(yf.Text,{selectable:!0,style:[p,a.textMuted]},d)):null,f)}function d4(t){return t.type===vw||t.type===yw||t.type===kl?!0:!(t.object==="fragment"||t.type===Xo)}function p4(t){return t.type===cO?"Parameter description (optional)":t.type===vw?"Response description (optional)":t.type===yw?"Operation description (optional)":t.type===Ss?"Title":t.type===kl?"Expandable content":t.type===Ta?"Annotate this text":t.type===Or?"Tab content":""}var m4=F.create({left:{textAlign:"left"},center:{textAlign:"center"},right:{textAlign:"right"},root:{},quote:t=>({color:t.colors.text.mid}),swaggerParameter:t=>({color:t.colors.text.mid,...Ue.Label}),swaggerResponse:t=>({color:t.colors.text.mid}),caption:t=>({...Ue.Caption,color:t.colors.text.muted}),expandableTitle:t=>({...Ue.Heading3,color:t.colors.text.main})});c();var vf=b(vi());var dL={onKeyDown:f4};function f4(t,o){if((0,vf.default)("enter",t)||(0,vf.default)("shift+enter",t))return g4(t,o);if((0,vf.default)("backspace",t))return pL(t,o)}function g4(t,o){let{value:e}=o;if(e.isExpanded)return;let{startBlock:n,startOffset:r,endOffset:i}=e;if(n&&!n.isVoid)if(n.type===fe){if((0,vf.default)("shift+enter",t))return o.insertText(` `)}else{let a=n.text.length;if(r===0&&a===0)return pL(t,o);if(i===a)return t.preventDefault(),o.splitBlock().setBlocks({type:fe,data:{}})}}function pL(t,o){let{value:e}=o;if(e.isExpanded||e.startOffset>0)return;let{startBlock:n,startText:r}=e;if(!(!n||!(n.getFirstText()===r))){if(n.type===fe){let a=e.document.getParent(n.key);return a&&Pe.isSwaggerFragment(a)&&a.getChildIndex(n.key)===0?o:void 0}if(!(n.type===_r||n.type===Ea))return t.preventDefault(),n.isVoid?o.removeNodeByKey(n.key):o.setNodeByKey(n.key,{type:fe,isVoid:!1})}}c();var Pv=b(x()),mL=b(z());c();var Qc=JSON.parse('{"quote":"quote_5I59h","hint":"hint_rnF2j","iconWrapper":"iconWrapper_NJPs7","icon":"icon_abDxV","info":"info_-xeCE","warning":"warning_5BM-F","danger":"danger_UUfHb","success":"success_3o6RV"}');function fL(t){let{children:o}=t;return Pv.default.createElement(Se,{tag:"blockquote",...t,contentProps:{style:h4.blockQuote}},Pv.default.createElement(j,{style:[N.flex.column,Qc.quote]},Pv.default.createElement(Lr.Provider,{value:"quote"},o)))}var h4=mL.StyleSheet.create({blockQuote:{position:"relative",width:"100%"}});c();var Qa=b(x()),Ev=b(z());c();var bf={info:{title:"Info",cssIcon:v.InfoCircle.CSS,icon:v.InfoCircle},warning:{title:"Warning",cssIcon:v.Warning.CSS,icon:v.Warning},success:{title:"Success",cssIcon:v.CheckCircle.CSS,icon:v.CheckCircle},danger:{title:"Danger",cssIcon:v.Alert.CSS,icon:v.Alert}};c();function gL(t,o){let e=["info","warning","danger","success"];return nt(t,o,[{key:"levels",commands:()=>{let n=t.value.document.assertBlock(o),r=n.data.get("style");return e.map(i=>({key:i,type:1,selected:r===i,title:bf[i].title,icon:bf[i].icon,trigger:()=>{t.change(a=>{a.setNodeByKey(n.key,{data:{style:i}})})}}))}}])}function hL(t){let{node:o,children:e,editor:n}=t,{readOnly:r}=n,i=o.data.toFrozenObject(),a=bf[i.style],s=()=>{let h=["info","warning","danger","success"],y=i.style===h[h.length-1]?h[0]:h[h.indexOf(i.style)+1];n.change(S=>S.setNodeByKey(o.key,{data:{style:y}}))},l=Qa.useMemo(()=>gL(n,o.key),[n,o.key]),u=o.nodes.first(),d=Ei(u,o),p=M.ICON_L,f=d.paddingTop+(gr(u)-p)/2,m=a.cssIcon;return Qa.createElement(Se,{...t,palette:l,contentProps:{style:[y4.blockHint]}},Qa.createElement(j,{style:[Qc.hint,N.flex.row,Qc[i.style]]},Qa.createElement(j,{style:[Qc.iconWrapper,N.flex.row,N.flex.justifyContentCenter],inlineStyle:{paddingTop:f,"--icon-size":`${p}px`}},r?Qa.createElement(m,{style:Qc.icon}):Qa.createElement(Ev.TouchableOpacity,{onPress:s},Qa.createElement(m,{style:Qc.icon}))),Qa.createElement(j,{style:[N.flex.column,N.flex.flex1]},e)))}var y4=Ev.StyleSheet.create({blockHint:{position:"relative",width:"100%"}});c();var Tv=b(vi());var vL={onKeyDown:S4},v4=(0,Tv.isKeyHotkey)("backspace"),b4=(0,Tv.isKeyHotkey)("enter"),w4=(0,Tv.isKeyHotkey)("mod+enter");function S4(t,o,e){let{value:n}=o;if(!Po(n.selection)){if(v4(t)&&n.isCollapsed)return C4(t,o);if(b4(t))return k4(t,o);if(w4(t))return x4(t,o);if(t.key===">")return O4(t,o)}}function C4(t,o){let{value:e}=o,{startOffset:n,selection:r}=e;if(!be.isTextRange(r)||n>0)return;let i=kC(e);if(!i)return;let a=r.anchorKey?i.getClosestBlock(r.anchorKey):null;if(!(!a||!r.isAtStartOf(a))&&i.nodes.size===1)return t.preventDefault(),o.unwrapBlock(i.type)}function k4(t,o){let{value:e}=o,{startBlock:n,selection:r}=e;if(!be.isTextRange(r))return;let i=kC(e);if(i&&!(n&&n.text.length!==0))return t.preventDefault(),o.unwrapBlock(i.type)}function x4(t,o){let{value:e}=o,n=kC(e);if(n)return t.preventDefault(),wt(o,n),o}function O4(t,o){let{value:e}=o,{selection:n}=e;if(be.isTextRange(n)&&!(n.startOffset!==0||n.isCollapsed))return t.preventDefault(),o.wrapBlock(Kt),o}function kC(t,o=null){let{document:e,selection:n}=t;if(!be.isTextRange(n)||(o??=t.startBlock,!o))return null;let r=e.getAncestors(o.key);if(!r)return null;let i=r.reverse().find(yL);return i&&yL(i)?i:null}function yL(t){return"type"in t&&(t.type===Kt||t.type===lo)}c();var xC=b(x());c();var ri=b(x()),Js=b(z());var Jd=2,_4=250;function bL(t){let{selection:o}=t,[e,n]=ri.useState(!1),r={"data-cursor":!0},i=o.data.toFrozenObject(),a=$a(i.clientId),s={backgroundColor:a.base};return ri.createElement(ge,{tag:"span",editable:!1,...r,style:[Qd.cursor]},ri.createElement(vc,{wrapper:Ci,onOpen:()=>n(!0),onClose:()=>n(!1),anchor:({ref:l,open:u,close:d})=>ri.createElement(V.WithInteractiveState,{onHoverIn:u,onHoverOut:d},({events:p})=>ri.createElement(Js.View,{ref:l,...p,style:[Qd.carret,s]},ri.createElement(Js.View,{style:[Qd.carretTop,s]})))},ri.createElement(Js.View,{style:[Qd.bubble,e&&Qd.bubbleVisible]},ri.createElement(Js.View,{style:[Qd.bubbleContent,s,g.Padding.smallHorizontal]},ri.createElement(wi,{theme:{color:Ga(a.base)}},ri.createElement(R4,{userName:i.userDisplayName}))))))}function R4({userName:t}){let[,o]=_(D);return ri.createElement(Js.Text,{numberOfLines:1,style:[o.Caption,o.text]},t)}var Qd=Js.StyleSheet.create({cursor:{position:"absolute"},carret:{userSelect:"none",width:Jd,top:3,height:"1.2em"},carretTop:{position:"absolute",top:-Jd*3,left:-Jd,borderRadius:100,width:Jd*3,height:Jd*3},bubble:{position:"absolute",left:-Jd,top:"-1.2em",width:_4,opacity:0,transition:`opacity ${Wa.TRANSITION_DURATION_LONG}ms ease`},bubbleVisible:{opacity:1},bubbleContent:{position:"absolute",borderRadius:M.RADIUS_M}});c();var wL=b(x());function SL(t){let{children:o,selection:e}=t,n=e.data.toFrozenObject(),r=$a(n.clientId);return wL.createElement(Bt,{style:[{backgroundColor:r.faded}]},o)}c();var CL="focus",kL="range";var xL={renderSelection:I4};function I4(t){let{type:o}=t;switch(o){case CL:return xC.createElement(bL,{...t});case kL:return xC.createElement(SL,{...t})}}c();var Xe=b(x());c();var da=b(x());function OL(t){let{editor:o,node:e}=t,n=Ce(),r=lt(),i=da.useMemo(()=>nt(o,e.key,[{key:"edit",commands:[{key:"edit_ref",title:"Edit link target",icon:v.PageLink,trigger:()=>Fn(a=>{o.change(s=>{s.setDataByKey(e.key,["ref"],a)})},r,n,{accept:["page","space","collection"]})}]}]),[o,e.key,r]);return da.createElement(Se,{...t,palette:i},da.createElement(Ut,{...t},da.createElement(da.Suspense,{fallback:da.createElement(Ka,{icon:Re,title:""})},da.createElement(P4,{contentRef:e.data.get("ref")}))))}function P4(t){let{contentRef:o}=t,e=Qe(o);return da.createElement(Ka,{title:e.title,icon:e.icon||e.secondaryIcon,...Vc(e)})}c();var el=b(x()),_L=b(z());function RL(t){let{ancestors:o,node:e,children:n,attributes:r}=t,i=e.data.toFrozenObject(),{blockLayoutComponent:a}=el.useContext(de),s=Je(),l=Dd({ancestors:o,node:e.blockNodes.first(),diff:!0});return el.createElement(a,{renderMode:l.renderMode},el.createElement(Us.View,{isPDF:s},el.createElement(j,{style:[N.position.relative,N.flex.column,l.blockStyle.style],inlineStyle:l.blockStyle.inlineStyle},el.createElement(_L.View,{...r},l.diffLine?el.createElement(Qy,{diff:i.type,...l.diffLine}):null,n))))}c();var IL=b(x()),PL=b(z());function EL(t){let{mark:o,attributes:e,children:n}=t;return IL.createElement(Bt,{style:E4[o.type],...e},n)}var E4=PL.StyleSheet.create({[fg]:{color:ou.added},[gg]:{color:ou.deleted,textDecorationLine:"line-through"},[hg]:{color:ou.modified}});c();var Mv=b(x());c();var TL=JSON.parse('{"divider":"divider_osV0o"}');function ML(t){let{attributes:o}=t;return Mv.createElement(Se,{...t},Mv.createElement(Ut,{...t},Mv.createElement(j,{as:"hr",style:TL.divider,...o})))}c();var Ke=b(x());c();var wn=b(x()),wf=b(z());c();var Fo=b(x());function LL(t){let{onClose:o}=t,[e,n]=En(),r=Fo.useRef(null),[i,a]=Fo.useState(!1),s=Yo(i),l=Yo(o),u=Yo(e),d=Fo.useCallback(()=>{u.current||n(()=>l.current())},[l,u]);return Fo.useEffect(()=>vh("editor-block-modal"),[]),Jr({[qe.EDITOR_SAVE]:p=>{d()}},"editor-block-modal",[]),Fo.useEffect(()=>{let p=null,f=m=>{m.key==="Escape"&&(s.current?(p&&clearTimeout(p),d()):(a(!0),p=setTimeout(()=>{a(!1)},2e3)))};return document.addEventListener("keydown",f),()=>{document.removeEventListener("keydown",f),p&&clearTimeout(p)}},[s,d]),Fo.useEffect(()=>{i?r.current?.open():r.current?.close()},[i,r]),Fo.createElement(W,{tooltipRef:r,icon:v.X,disabled:e,onPress:d,title:i?Fo.createElement(Fo.Fragment,null,"Press ",Fo.createElement(Pn,{inverted:!0,shortcut:"ESC"})," again to save & close"):Fo.createElement(Fo.Fragment,null,"Save & Close ",Fo.createElement(Pn,{inverted:!0,shortcut:qe.EDITOR_SAVE})),tooltipPreferredPlacement:"left"})}c();c();c();var NL=$g("05ab87fa95f4c5a09220a4e1067733011498ba1a47c8b145f5ec78dcb9ffe75d",()=>import("https://app.gitbook.com/public/app/chunks/excalidraw.lazy-PVBHQ7IL.min.js"));var cu=NL;async function AL(t){let{default:{exportToSvg:o}}=await cu.load(),e=await o({appState:{exportEmbedScene:!0},elements:t.elements,files:t.files});return new XMLSerializer().serializeToString(e)}c();var OC=nr({getValue:async t=>{if(!t)return{elements:[],files:{}};let{default:{loadFromBlob:o}}=await cu.load(),n=await(await fetch(t)).blob(),r=await o(n,null,null);return{elements:r.elements,files:r.files}}}),DL=nr({getValue:async({downloadURL:t,theme:o})=>{let{default:{exportToSvg:e}}=await cu.load(),n=await OC.readAsync(t),r=await e({appState:{viewBackgroundColor:"transparent",exportWithDarkMode:o==="dark"},elements:n.elements,files:n.files});return r.style.maxWidth="100%",r.removeAttribute("width"),r.removeAttribute("height"),r}});function BL(t){let{blockData:o,onClose:e}=t,[,n]=_(L4),r=wn.useRef(),i=Rl(Wa.fade),a=Rl(Wa.pop,{onEnd:()=>{r.current?.refresh()}});return wn.createElement(Tn,null,wn.createElement(wf.View,{ref:i,style:[F.absoluteFill,n.modalBackdrop]},wn.createElement(wf.View,{ref:a,style:n.modalBody},wn.createElement(wn.Suspense,{fallback:wn.createElement(Mo,{size:"large"})},wn.createElement(T4,{blockData:o,onClose:e,excalidrawRef:r})))))}function T4(t){let{excalidrawRef:o,blockData:e,onClose:n}=t,r=Rs(),i=go(),{Excalidraw:a,useExcalidrawStyle:s}=cu.loadSuspense().default;s();let u=Qe(e.ref).resolution?.extra?.file,{result:d,error:p}=OC.readSafe(u?.downloadURL||null),f=async()=>{let m=o.current;if(!m){n(void 0);return}let h=m.getSceneElements(),y=m.getFiles();if(d&&d.elements&&!M4(d.elements,h)){n(void 0);return}let S=await AL({elements:h,files:y});n(new File([new Blob([S])],u?.name||"file.excalidraw.svg",{type:"image/svg+xml"}))};return wn.useEffect(()=>{p&&i.notify({kind:"danger",icon:v.Warning.CSS,title:"Error loading drawing",details:p.expose?p.message:"An unexpected error occurred while loading the drawing"})},[p]),wn.createElement(wf.View,{style:[F.absoluteFill]},wn.createElement(a,{ref:o,initialData:{...d,scrollToContent:!0},theme:r.color,UIOptions:{canvasActions:{export:!1,loadScene:!1,saveToActiveFile:!1,toggleTheme:!1,saveAsImage:!1,changeViewBackgroundColor:!1,clearCanvas:!1}},renderTopRightUI:(m,h)=>wn.createElement(wf.View,null,wn.createElement(LL,{onClose:f}))}))}function M4(t,o){return t.length!==o.length?!0:t.some((e,n)=>{let r=o[n];return e.version!==r.version})}var L4=F.create({modalBackdrop:t=>({backgroundColor:t.colors.backdrop.background}),modalBody:t=>({position:"absolute",top:g.large,bottom:g.large,right:g.xlarge,left:g.xlarge,borderRadius:M.RADIUS_L,backgroundColor:t.colors.background.main,overflow:"hidden"})});c();var ro=b(x()),lu=b(z());var zL=ro.forwardRef(function(o,e){let{readOnly:n,contentRef:r}=o,i=ro.useRef(null),a=Rs(),s=kd(),[,l]=_(FL),[u,d]=ro.useState(null),f=Qe(r).href,m=u;return r&&!f&&(m=new Yi.NotFound("Drawing file not found, the file may have been deleted")),ro.useImperativeHandle(e,()=>({openInGallery:()=>{s.open([{url:f}])}})),ro.useEffect(()=>{let h=!0;return DL.readAsync({downloadURL:f,theme:a.color}).then(y=>{let S=i.current;S&&y&&h&&(S.innerHTML="",S.appendChild(y.cloneNode(!0)))},y=>{h&&d(y)}),()=>{h=!1}},[f,a.color]),m?ro.createElement(WL,{kind:"danger",icon:v.Warning,message:m.expose?m.message:"An error occurred while rendering this drawing file."}):ro.createElement(lu.View,{style:l.wrapper},f?ro.createElement("div",{ref:i},ro.createElement("img",{src:f,style:{width:"100%"}})):ro.createElement(WL,{icon:v.EditDrawing,message:n?"Drawing file not found":"Double click to start sketching out your thoughts."}))});function WL(t){let{icon:o,message:e,kind:n="default"}=t,[,r]=_(FL),[,i]=_(D);return ro.createElement(lu.View,{style:[r.fallback,g.Padding.large,w.alignCenter,w.justifyContentCenter]},ro.createElement(lu.View,null,ro.createElement(o,{size:M.ICON_XL,style:n==="danger"?i.danger:i.textMuted})),ro.createElement(lu.View,{style:g.Margin.mediumTop},ro.createElement(lu.Text,{style:[n==="danger"?i.danger:i.textMuted,i.Body]},e)))}var FL=F.create({wrapper:{},fallback:t=>({height:200,borderWidth:1,backgroundColor:t.colors.background.main,borderColor:t.colors.border.mid,borderRadius:M.RADIUS_M,borderStyle:"dashed"})});var VL=V.createInteractiveHandle("drawing-block");function qL(t){let{node:o,editor:e,isSelected:n}=t,{readOnly:r}=e,{blocks:{withDrawings:i}}=Ke.useContext(de),[a,s]=Ke.useState(null),[l,u]=En(),d=Ke.useRef(),p=Ke.useRef(null),f=o.data.toFrozenObject(),m=()=>{h.current?.close(),s("edit")},h=Ke.useRef(null),y=Ke.useRef(null);Ke.useEffect(()=>()=>{y.current&&clearTimeout(y.current)},[]);let S=Xh(m),C=R=>{r?p.current?.openInGallery():(y.current&&clearTimeout(y.current),S(R)?h.current?.close():(h.current?.open(),y.current=setTimeout(()=>{h.current?.close()},1e3)))},k=R=>{d.current=R?URL.createObjectURL(R):void 0,R&&i&&u(async()=>{let I=f.ref;f.ref&&I?await i.updateDrawing(I,R):I=(await i.uploadDrawings([R]))[0],sg(I,f.ref)&&e.change(E=>{E.setDataByKey(o.key,["ref"],I)})}),s(null)},O=nt(e,o.key,[{key:"types",commands:[{key:"edit",title:"Edit drawing",icon:v.EditDrawing,trigger:()=>{m()}},i?{key:"files",title:"Replace file\u2026",icon:v.Replace,trigger:async()=>{let[R]=await i.filesManager.prompt({title:"Replace drawing file",acceptURL:!1,accept:"drawings"});R?.kind==="file"&&e.change(I=>{I.insertDataByKey(o.key,["ref"],R)})}}:null].filter(se)}]);return Ke.createElement(Ke.Fragment,null,Ke.createElement(Se,{...t,palette:O},Ke.createElement(Ut,{...t},Ke.createElement(V.TouchableOpacity,{onPress:C},Ke.createElement(V.View,{handle:VL},Ke.createElement(Ke.Suspense,{fallback:Ke.createElement(oi,null)},Ke.createElement(zL,{ref:p,readOnly:r,contentRef:d.current&&l?{kind:"url",url:d.current}:f.ref})),r?null:Ke.createElement(wi,{theme:{color:"dark"}},Ke.createElement(za,{ref:h,preferredPlacement:"left",tooltip:"Double click to edit!"},(R,I)=>Ke.createElement(N4,{ref:I,saving:l,isSelected:n,palette:O})))))),Ke.createElement($c,{...t})),Ke.createElement(St,null,a==="edit"?Ke.createElement(BL,{blockData:f,onClose:k}):null))}var N4=Ke.forwardRef(function(o,e){let{isSelected:n,saving:r,palette:i}=o,[,a]=_(A4);return Ke.createElement(V.View.Child,{ref:e,descendantOf:VL,style:[a.blockToolbar,w.directionRow],inactiveStyle:n||r?je.visible:je.hidden,activeStyle:je.visible},r?Ke.createElement(W,{size:"small",icon:Re},"Saving"):i.groups.map(s=>Array.isArray(s.commands)?s.commands:[]).flat().map((s,l,u)=>Ke.createElement(W,{key:s.key,title:s.title,size:"small",icon:s.icon,style:[l{s.trigger?.(i)}})))}),A4=F.create({blockToolbar:t=>({position:"absolute",top:g.small,right:g.small,padding:g.small,borderRadius:M.RADIUS_M,backgroundColor:t.colors.background.mid,...t.shadows.base})});c();var Di=b(x());function GL(t){let{node:o,editor:e}=t,{blocks:{withFiles:n}}=Di.useContext(de),r=n?async()=>{let[a]=await n.filesManager.prompt({title:"Replace file"});a?.kind==="file"&&e.change(s=>{s.insertDataByKey(o.key,["ref"],a)})}:void 0,i=nt(e,o.key,[{key:"types",commands:()=>[r?{key:"files",title:"Replace file\u2026",icon:v.Paperclip,trigger:()=>{r()}}:null].filter(se)}]);return Di.createElement(Se,{...t,palette:i},Di.createElement(Ut,{...t},Di.createElement(Di.Suspense,{fallback:Di.createElement(Ka,{icon:Re,title:""})},Di.createElement(D4,{...t,onReplace:r}))),Di.createElement($c,{...t}))}function D4(t){let{node:o,editor:e,onReplace:n}=t,{ref:r}=o.data.toFrozenObject(),a=Qe(r).resolution?.extra?.file,s=()=>{a?Ts(gc(a.downloadURL)):!e.readOnly&&n&&n()},l=To(Ld,{file:a},[a]);return Di.createElement(Ka,{onPress:s,icon:l,title:a?a.name:"File has been deleted",subtitle:a?Im(a.size):void 0,details:a?_P(a):void 0})}c();var qn=b(x());c();var tl=b(x()),HL=b(z());function KL(t){let{node:o,editor:e,onClose:n}=t,r=kg(o.text),[i,a]=tl.useState(()=>o.data.get("id")||""),s=u=>{let d=kg(u);d.length===u.length?a(d):a(u)},l=()=>{e.change(u=>{i?u.setDataByKey(o.key,["id"],kg(i)):u.removeDataByKey(o.key,["id"])}),n()};return tl.createElement(yo,{size:"small",title:"Edit heading anchor",footer:tl.createElement(HL.View,{style:[w.directionRow,w.justifyContentEnd]},tl.createElement(W,{kind:"secondary",onPress:n,style:g.Margin.smallRight},"Close"),tl.createElement(W,{kind:"primary",onPress:l},"Save")),onClose:n},tl.createElement(oo,{autoFocus:!0,size:"large",icon:v.Hash,label:"Anchor",labelDescription:"Edit this anchor to customize a nice looking url for this heading.",value:i,onChangeText:s,onSubmit:l,placeholder:r}))}var B4=J.createResponsiveComponent(ge);function XL(t){let{editor:o,node:e,parent:n,children:r}=t,[,i]=_(D),[,a]=_(z4),[s,l]=qn.useState(null),u=qn.useContext(Bc),d=qn.useContext(Lr),p=qn.useMemo(()=>Iv(o,e.key,[{key:"edit",commands:[{key:"edit",title:"Edit anchor",icon:v.Link,trigger:()=>{l("edit")}}]}]),[o,e.key]),{anchorElement:f,anchoredBlockId:m,anchoredBlockInteractiveState:h,onAnchoredBlockPress:y}=pv(e,{accessibilityLabel:"Direct link to heading",anchorIconSize:q4[e.type]}),S=n.type===Kt;return qn.createElement(qn.Fragment,null,qn.createElement(Se,{...t,palette:p},qn.createElement(B4,{tag:W4(e.type),nativeID:m,onClick:S?()=>{}:()=>y(),...h.events,style:[w.directionRow,w.alignEnd]},qn.createElement(J.Text,{selectable:!0,mobileStyle:[V4[e.type]],desktopStyle:[F4[e.type]],nativeID:`text-${m}`,style:[i.text,a[u],a[d]]},r,S?null:f))),qn.createElement(St,null,s==="edit"?qn.createElement(KL,{node:e,editor:o,onClose:()=>l(null)}):null))}function W4(t){switch(t){case Ve:return"h2";case Ge:return"h3";case tt:return"h4";default:throw new Error(`invalid node type (${t}) for heading`)}}var z4=F.create({left:{textAlign:"left"},center:{textAlign:"center"},right:{textAlign:"right"},root:{},caption:{},quote:{},swaggerParameter:{}}),F4={[Ve]:fo.Heading1,[Ge]:fo.Heading2,[tt]:fo.Heading3},V4={[Ve]:fo.Heading2,[Ge]:fo.Heading3,[tt]:fo.Body},q4={[Ve]:M.ICON_L,[Ge]:M.ICON_S,[tt]:M.ICON_XXS};c();var Lv=b(x());function UL(t){let{node:o,children:e,style:n,attributes:r}=t,{sections:i}=Lv.useContext(Ri),a=i.get(o.key);return Lv.createElement("div",{id:a,...r,style:n},e)}c();var Sf=b(x()),YL=b(z());function jL(t){let{node:o,editor:e,children:n}=t,{align:r="center"}=o.data.toFrozenObject(),{blocks:{withImages:i}}=Sf.useContext(de),a=Pi(e,o.key),s=u=>{e.change(d=>{d.insertDataByKey(o.key,["align"],u)})},l=nt(e,o.key,[{key:"types",commands:()=>[i?{key:"files",title:"Add images\u2026",icon:v.Image,trigger:()=>{i.filesManager.prompt({accept:"images",title:"Select image",acceptURL:!0}).then(u=>{e.change(d=>{u.forEach(p=>{d.appendNodeByKey(o.key,Uo.createImageBlock(p))})})})}}:null].filter(se)},{key:"align",commands:[{key:"left",type:1,title:"Left align",selected:r==="left",icon:v.AlignTextLeft,trigger:()=>s("left")},{key:"center",type:1,title:"Center",selected:r==="center",icon:v.AlignTextCenter,trigger:()=>s("center")},{key:"right",type:1,title:"Right align",selected:r==="right",icon:v.AlignTextRight,trigger:()=>s("right")}]},...a?[a]:[]]);return Sf.createElement(Se,{palette:l,...t},Sf.createElement(J.View,{style:[w.directionRow,r==="center"&&w.justifyContentCenter,r==="left"&&w.justifyContentStart,r==="right"&&w.justifyContentEnd,G4.imagesWrapper],mobileStyle:[w.wrap,w.justifyContentCenter]},n))}var G4=YL.StyleSheet.create({imagesWrapper:{columnGap:g.medium,rowGap:g.medium}});c();var ye=b(x()),ts=b(z());c();var pa=b(x()),Nv=b(z());function Av(t){let{node:o,editor:e,onClose:n}=t,[r,i]=pa.useState(()=>Uo.getImageAltText(o)||""),a=()=>{e.change(s=>{s.insertDataByKey(o.key,["alt"],r)}),n()};return pa.createElement(yo,{title:"Set image alt text",onClose:n,footer:pa.createElement(Nv.View,{style:[w.directionRow,w.justifyContentEnd]},pa.createElement(W,{kind:"secondary",onPress:n,style:g.Margin.smallRight},"Cancel"),pa.createElement(W,{kind:"primary",onPress:a},"Save"))},pa.createElement(Nv.View,{style:[g.Margin.largeBottom]},pa.createElement(Nv.View,{style:[g.Margin.mediumBottom]},pa.createElement(eh,null,"This will be read out by screen readers when the image is encountered. Describe the image in detail \u2013 it's how visually impaired readers know what's in front of them.")),pa.createElement(oo,{autoFocus:!0,size:"large",value:r,placeholder:"Edit alt text",onChangeText:i,onSubmit:a})))}c();var ep=b(x());function Dv(t){let{editor:o,node:e,style:n}=t,r=ep.useRef(null),i=le(r),{blocks:{withImages:a}}=ep.useContext(de);if(!a)return null;let s=async(u,d,p=!1)=>{let[f]=await a.filesManager.prompt({title:d,accept:"images",acceptURL:!0});f&&o.change(m=>{m.insertDataByKey(e.key,[u],f),p&&m.removeDataByKey(e.key,["refDark"]),e.object==="block"&&(m.removeDataPathByKey(e.key,["height"]),m.removeDataPathByKey(e.key,["width"]))})},l=()=>{o.change(d=>d.focus());let u=e.data.toFrozenObject();i.open(ae({groups:[{key:"replace",commands:[{key:"all",icon:v.Replace,title:"Replace image",subtitle:"For both light and dark modes",trigger:()=>{s("ref","Replace image",!0)}}]},{key:"byTheme",commands:u.refDark?[{key:"light",icon:v.ThemeLight,title:"For Light mode",trigger:()=>{s("ref","Replace image for light mode")}},{key:"dark",icon:v.ThemeDark,title:"For Dark mode",trigger:()=>{s("refDark","Replace image for dark mode")}}]:[{key:"dark",icon:v.ThemeDark,title:"Add image for Dark mode",trigger:()=>{s("refDark","Add image for dark mode")}}]}]}))};return ep.createElement(bt,{ref:r,active:i.opened,size:"small",label:"Replace image",tooltipTitle:"Replace image",leadingIcon:v.Replace.CSS,trailingIcon:i.opened?v.ChevronUp.CSS:v.ChevronDown.CSS,onPress:l,style:n,iconOnly:!0})}c();c();c();var Br=b(x());var H4=V.createInteractiveComponent(v.EmojiReaction);function $L(t){let{analyticsContext:o,page:e,size:n,readOnly:r=!0}=t,i=Br.useRef(null),[,a]=_(D),[s,l]=En(),u=Zt(),d=async p=>{Fe(u),i.current?.close(),p!==e.emoji&&(await l(()=>u.change(f=>{f.updatePage(e.id,{emoji:p})})),ne({...o,...p?{type:"edit_pick_page_emoji",pageKind:e.type,emoji:p}:{type:"edit_remove_page_emoji",pageKind:e.type}}))};return r?e.emoji?Br.createElement(Lo,{code:e.emoji,size:n}):null:Br.createElement(vc,{ref:i,wrapper:Ci,anchor:({ref:p,opened:f,toggle:m})=>Br.createElement(V.TouchableOpacity,{ref:p,onPress:m},s?Br.createElement(Re,{size:n}):Br.createElement(Br.Fragment,null,e.emoji?Br.createElement(Lo,{code:e.emoji,size:n}):Br.createElement(H4.Child,{size:n,style:f?a.textMid:a.textMuted,activeStyle:a.textMid})))},Br.createElement(Mn,{kind:"wide",preferredAlignment:"middle"},Br.createElement(sy,{onPick:d,onRemove:e.emoji?()=>d(void 0):void 0})))}c();var ie=b(x()),ip=b(z());c();var ZL=JSON.parse('{"pageCoverBleedFull":"pageCoverBleedFull_eqtqd"}');c();var QL=b(x());var JL=new Set;function e6(t){let{hivePage:o,analyticsContext:e}=t;return QL.useCallback(()=>{let n=`${o.contentId}/${o.branchId}/${o.pageId}`;JL.has(n)||(JL.add(n),ne({...e,page:o.pageId,type:"edit_page_document_start",collaborators:o.dataSync.presences.length}))},[o,e])}c();var Bv=b(x());var Wv=Bv.createContext({baseRevision:void 0,pages:[],diffs:new Map,diffMode:null});c();var uu=b(x());var t6=uu.createContext({pages:[],setContentDiffPage:t=>{}});c();var du=b(x());var o6="hive-rtc-beta-notification-dismissed",n6=!1;function r6(t){let o=TI(t),e=v_(),n=go(),r="rtc-toaster",i=o.filter(a=>a.data.userId&&a.data.userId!==e?.uid);du.useEffect(()=>{n6||i.length===0||(n6=!0,!Pr.get(o6)&&n.notify({id:r,kind:"info",icon:v.Users.CSS,title:"Realtime Collaboration (Beta)",details:du.createElement(du.Fragment,null,du.createElement(pe,null,"Explore live editing with your team. Keep in mind, it's still in Beta so you may encounter some bugs. We appreciate your patience and feedback.")),timeout:1e4,actions:[{label:"Got it, dismiss",onPress:()=>{Pr.set(o6,!0),n.close(r)}}]}))},[i.length])}c();var ve=b(x()),tn=b(z());c();var _C=b(LD()),ht=b(x()),Bi=b(z());function i6(t){let{analyticsContext:o,parentPages:e,childPages:n,onClose:r,revision:i,page:a}=t,[,s]=_(U4),[l,u]=En(),d=Zt(),p=async(f=!0)=>{Fe(d),await u(async()=>{await d.change(m=>{[a,...f?e:[],...f?n:[]].forEach(h=>{m.resolveConflict(h.id)})}),await ne({...o,type:"edit_conflicts_keep_page",pageKind:a.type})}),r()};return ht.createElement(yo,{title:"Keep page",onClose:r,footer:ht.createElement(Bi.View,{style:[w.directionRow,w.justifyContentEnd]},ht.createElement(W,{kind:"secondary",onPress:()=>{},style:g.Margin.smallRight,disabled:l},"Cancel"),ht.createElement(rm,{kind:"secondary",onPress:()=>p(!1),style:g.Margin.smallRight},"Keep only this page"),ht.createElement(rm,{kind:"merge",onPress:()=>p()},"Keep"))},(0,_C.default)(e)?null:ht.createElement(Bi.View,{style:[(0,_C.default)(n)?null:s.parentPages]},ht.createElement(K4,{revision:i,pages:e,onClose:r})),ht.createElement(X4,{revision:i,pages:n,onClose:r}))}function K4(t){let{pages:o,revision:e}=t,{conflicts:n}=e,[,r]=_(D),i=o.length;return o.length?ht.createElement(Bi.View,{style:[g.Margin.mediumTop]},ht.createElement(Bi.View,{style:[w.directionRow,g.Margin.smallBottom]},ht.createElement(ho,{kind:"warning",icon:v.Warning}),ht.createElement(Bi.Text,{style:[g.Margin.mediumLeft,r.Label,r.text,r.Bold]},"There ",i>1?"are":"is"," ",o.length," conflicted parent"," ",ht.createElement(oa,{count:i,singular:"page",plural:"pages"}),". Keeping the current page, you would keep"," ",ht.createElement(oa,{count:i,singular:"it",plural:"all of them"}))),ht.createElement(Bi.View,null,o.map(a=>{let s=n?.pages[a.id];return ht.createElement(Es,{key:a.id,layout:"wide",icon:()=>s==="deleted-in-base-subtree-modified-in-head"||s==="deleted-in-head-subtree-modified-in-base"?ht.createElement(ho,{kind:"warning",icon:v.Conflict}):ht.createElement(ho,{kind:"danger",icon:v.Trashcan}),title:a.title})}))):null}function X4(t){let{pages:o,revision:e}=t,{conflicts:n}=e,[,r]=_(D),i=o.length;return o.length?ht.createElement(Bi.View,{style:[g.Margin.mediumTop]},ht.createElement(Bi.View,{style:[w.directionRow,g.Margin.smallBottom]},ht.createElement(ho,{kind:"warning",icon:v.Warning}),ht.createElement(Bi.Text,{style:[g.Margin.mediumLeft,r.Label,r.text,r.Bold]},"There ",o.length>1?"are":"is"," ",o.length," nested"," ",ht.createElement(oa,{count:i,singular:"page",plural:"pages"}),". Keeping the current page, you would keep"," ",ht.createElement(oa,{count:i,singular:"it",plural:"all of them"}))),ht.createElement(Bi.View,null,o.map(a=>{let s=n?.pages[a.id];return ht.createElement(Es,{key:a.id,layout:"wide",icon:()=>s==="deleted-in-base-subtree-modified-in-head"||s==="deleted-in-head-subtree-modified-in-base"?ht.createElement(ho,{kind:"warning",icon:v.Conflict}):ht.createElement(ho,{kind:"danger",icon:v.Trashcan}),title:a.title})}))):null}var U4=F.create({parentPages:t=>({borderBottomColor:t.colors.border.mid,borderBottomWidth:1,marginBottom:g.large,paddingBottom:g.large})});c();var Et=b(x()),ii=b(z());c();var Wr=b(x()),zv=b(z());var a6=4;function s6(t){let{space:o,page:e,readOnly:n,...r}=t,[i,a]=Wr.useState(!1),s=IC(o,e),l=RC();if(s.length===0)return null;let u=i?s:s.slice(0,a6),d=s.length-a6,p=!i&&d>0;return Wr.createElement(zv.View,{...r,style:[w.directionRow,w.wrap]},u.map(f=>Wr.createElement(zv.View,{key:f.key,style:[g.Margin.mediumRight,g.Margin.mediumTop]},Wr.createElement(W,{kind:"default",size:"small",icon:v.ArrowDownLeft,onPress:()=>l(f)},f.page.title))),p?Wr.createElement(zv.View,{style:[g.Margin.mediumTop]},Wr.createElement(W,{kind:"grey",size:"small",onPress:()=>a(!0),title:Wr.createElement(Wr.Fragment,null,"Show ",d," more"," ",Wr.createElement(oa,{count:d,singular:"backlink",plural:"backlinks"}))},`+${d} more`)):null)}function RC(){let{navigate:t}=we();return Wr.useCallback(o=>{let{page:e,revision:n}=o;if(e.type==="link")return;let r=to(n,e.id);t({screen:i=>i.type==="space"&&n.contentId===i.space?{page:r}:{type:"space",space:n.contentId,page:r,changeRequest:void 0,revision:void 0}})},[])}function IC(t,o){return Y4([{kind:"page",page:o.id},{kind:"page",page:o.id,space:t.key}]).filter(n=>n.page.id!==o.id||n.revision.contentId!==t.key)}function Y4(t){let o=t.map(i=>Xx(i)),[e]=xc([Ux(o)]),n=Ce(),r=Lx(e,i=>{let a=fh([ea(i.space)])[0]?.result;if(a)return Mx(()=>n.store.getRevision(a.key,a.revision))});return e.map((i,a)=>{let s=r[a];return s?Object.keys(i.pages).filter(u=>Object.keys(i.pages[u].references).some(d=>o.includes(d))).map(u=>{let d=s.pages[u];return d?{key:`${s.contentId}-${u}`,revision:s,page:d}:null}).filter(se):[]}).flat().sort((i,a)=>i.page.ida.page.id?1:0)}function Fv(t){let{space:o,analyticsContext:e,page:n,onClose:r,revision:i}=t,[,a]=_(D),s=Zt(),l=async u=>{Fe(s),u&&(await s.change(d=>{d.removePage(n.id,{deleteEmptyGroupParent:!0})}),ne({...e,type:"edit_remove_page",pageKind:n.type})),r()};return Et.createElement(cm,{title:n.type==="group"?"Delete group":"Delete page",kind:"danger",confirmButtonText:"Delete",onComplete:l},Et.createElement(ii.View,null,Et.createElement(ii.Text,{style:[a.Body,a.text]},"Confirming will delete all the content; however, it will still be available in the version history.")),Et.createElement(Et.Suspense,{fallback:null},Et.createElement(j4,{space:o,page:n,onClose:r})),n.type!=="link"?Et.createElement($4,{revision:i,page:n,onClose:r}):null)}function j4(t){let{space:o,page:e,onClose:n}=t,[,r]=_(D),i=RC(),a=IC(o,e);return a.length===0?null:Et.createElement(ii.View,{style:[g.Margin.mediumTop]},Et.createElement(ii.View,null,Et.createElement(ii.Text,{style:[r.Label,r.textMuted]},"Deleting this page will break links in the following ",a.length," pages:")),Et.createElement(ii.View,{style:[w.directionRow,w.wrap]},a.map(s=>Et.createElement(ii.View,{key:s.key,style:[g.Margin.smallRight,g.Margin.smallTop]},Et.createElement(W,{kind:"secondary",size:"small",icon:v.ArrowDownLeft,onPress:()=>{n(),i(s)}},s.page.title)))))}function $4(t){let{page:o,revision:e,onClose:n}=t,[,r]=_(D),{navigateToPage:i}=Fc(),s=_c(e,o.id).map(u=>e.conflicts?.pages[u.id]==="deleted-in-base"?u:null).filter(se),l=s.length;return l?Et.createElement(ii.View,{style:[g.Margin.mediumTop]},Et.createElement(ii.View,{style:[w.directionRow,g.Margin.mediumBottom]},Et.createElement(ho,{kind:"warning",icon:v.Warning}),Et.createElement(ii.Text,{style:[g.Margin.mediumLeft,r.Label,r.text,r.Bold]},"There ",l>1?"are":"is"," ",s.length," nested"," ",Et.createElement(oa,{count:Object.keys(s.length).length,singular:"page",plural:"pages"})," ","deleted in the primary content but modified in your change request.",Et.createElement("br",null),"Deleting the current page, you would delete ",l>1?"all of them":"it",".")),Et.createElement(ii.View,null,s.map(u=>Et.createElement(Es,{key:u.id,layout:"wide",icon:()=>Et.createElement(ho,{kind:"danger",icon:v.Trashcan}),title:u.title,buttons:[Et.createElement(W,{size:"medium",kind:"secondary",onPress:()=>{n(),i(e,u.id)}},"Open")]})))):null}function c6(t){let{page:o,document:e,conflictType:n,pageWithComments:r,pageIsDiff:i}=t,a=n===!1,[,s]=_(Q4),l=Zt(),[u,d]=En(),p=go(),f=Ji.getDocumentConflicts(e),m=f.isEmpty(),h=()=>{Fe(l),m&&d(async()=>{await l.change(S=>{S.resolveConflict(o.id)}),l.revision.conflicts||p.notify({kind:"success",icon:v.CheckCircle.CSS,title:"All conflicts have been resolved",details:"You can now merge this change request."})})},y=()=>{switch(n){case"deleted-in-head":case"deleted-in-base":case"deleted-in-base-subtree-modified-in-head":case"deleted-in-head-subtree-modified-in-base":return ve.createElement(J4,{...t,conflictType:n,onPressMarkAsResolved:h,loading:u,hasBeenResolved:a});case!1:case"document-conflict":return ve.createElement(Z4,{conflictNodes:f,canBeResolved:m,loading:u,onPressMarkAsResolved:h,hasBeenResolved:a,...t});default:Oe(n)}};return ve.createElement(tn.View,{style:[w.directionRow,w.justifyContentCenter,g.Margin.mediumBottom,s.alert]},ve.createElement(tn.View,{style:[w.flex1,r||i?s.alertWithComments:s.alertFullWidth]},ve.createElement(tn.View,{style:[w.directionRow,w.alignCenter,g.Padding.mediumVertical,g.Padding.mediumHorizontal,s.alertInner]},y())))}var Z4=t=>{let{hasBeenResolved:o,canBeResolved:e,loading:n,conflictNodes:r,onPressMarkAsResolved:i}=t,[,a]=_(D),s=ve.useRef(),l=f=>{let m=bc(f);m&&jI(m)},u=f=>{let h=(s.current?r.findIndex(S=>S.key===s.current):-1)+f;h<0?h=r.size-1:h>=r.size&&(h=0);let y=r.get(h)?.key;y&&(s.current=y,l(y))},d=()=>{u(1)},p=()=>{u(-1)};return ve.createElement(tn.View,{style:[w.flex1,w.directionColumn]},ve.createElement(tn.View,{style:[w.directionRow]},ve.createElement(tn.View,{style:g.Margin.mediumRight,testID:"conflictBanner.badge"},o?ve.createElement(ho,{kind:"success",size:"large",icon:v.Check}):ve.createElement(ho,{kind:"merge",size:"large",icon:v.Conflict})),ve.createElement(tn.View,{style:[w.flex1,w.directionColumn]},ve.createElement(tn.Text,{style:[a.Label,a.textMid],testID:"conflictBanner.message"},o?"All conflicts with the primary content have been resolved for this page.":ve.createElement(ve.Fragment,null,"This page has ",e?"no":r.size," ","unresolved"," ",ve.createElement(oa,{count:r.size,singular:"conflict",plural:"conflicts"})," ","with the primary content."," ",e?"Confirm by marking this page as resolved.":"Resolve them by editing this document.")),o?null:ve.createElement(tn.View,{style:[w.directionRow,w.wrap]},e?null:ve.createElement(tn.View,{style:[w.directionRow,w.wrap,g.Margin.smallBottom]},ve.createElement(W,{style:[g.Padding.noneLeft],size:"medium",rightIcon:v.ChevronUp,onPress:p,testID:"conflictBanner.prevButton"},"Prev"),ve.createElement(W,{size:"medium",rightIcon:v.ChevronDown,onPress:d,style:g.Margin.smallRight,testID:"conflictBanner.nextButton"},"Next")),ve.createElement(tn.View,{style:[{marginLeft:"auto"}]},ve.createElement(W,{size:"medium",kind:"secondary",title:e?"Confirm resolution of all conflicts in this page":"You need to first resolve conflicts in the document",disabled:n||!e,icon:n?Re:v.Check,onPress:i,testID:"conflictBanner.resolveButton"},"Mark as resolved"))))))},J4=t=>{let{hasBeenResolved:o,loading:e,onPressMarkAsResolved:n,page:r,space:i,analyticsContext:a,revision:s,conflictType:l}=t,[u,d]=ve.useState(!1),[p,f]=ve.useState(!1),[,m]=_(D),h=_c(s,r.id).filter(I=>s?.conflicts?.pages[I.id]==="deleted-in-head"||s?.conflicts?.pages[I.id]==="deleted-in-base"),y=()=>{let I="Do you want to keep the modified page or delete it?",E=h.length>1?"pages":"page";switch(l){case"deleted-in-base":return`This page has been deleted in the primary content, but has been modified in this change request. ${I}`;case"deleted-in-head":return`This page has been deleted in this change request, but has been modified in the primary content ${I}`;case"deleted-in-base-subtree-modified-in-head":return`This page has been deleted in the primary content but has ${h.length} conflicted child ${E}. Do you want to keep or delete it?`;case"deleted-in-head-subtree-modified-in-base":return`This page has been deleted in your change request but has ${h.length} conflicted child ${E}. Do you want to keep or delete it?`}},C=(I=>{let E=[];function P(L){let T=In(s,L.id);T&&s.conflicts?.pages[T.id]&&(E.push(T),P(T))}return P(I),E})(r),k=_c(s,r.id),O=()=>f(!0),R=()=>{if(C.length||k.length){d(!0);return}n()};return ve.createElement(ve.Fragment,null,ve.createElement(ve.Fragment,null,ve.createElement(tn.View,{style:g.Margin.mediumRight,testID:"conflictBanner.badge"},o?ve.createElement(ho,{kind:"success",size:"large",icon:v.Check}):l==="deleted-in-base-subtree-modified-in-head"||l==="deleted-in-head-subtree-modified-in-base"?ve.createElement(ho,{kind:"warning",size:"large",icon:v.Conflict}):ve.createElement(ho,{kind:"danger",size:"large",icon:v.Trashcan})),ve.createElement(tn.View,{style:[w.flex1]},ve.createElement(tn.Text,{style:[m.Label,m.textMid],testID:"conflictBanner.message"},o?"All conflicts with the primary content have been resolved for this page.":y())),o?null:ve.createElement(tn.View,{style:[g.Margin.mediumLeft,w.directionRow]},ve.createElement(tn.View,{style:[g.Margin.mediumLeft,w.directionRow]},ve.createElement(W,{size:"medium",icon:e?Re:v.Copy,onPress:R,testID:"conflictBanner.keepButton"},"Keep"),ve.createElement(W,{size:"medium",icon:e?Re:v.Trashcan,onPress:O,testID:"conflictBanner.deleteButton"},"Delete")))),ve.createElement(St,null,u?ve.createElement(i6,{page:r,revision:s,analyticsContext:a,onClose:()=>d(!1),parentPages:C,childPages:k}):null),ve.createElement(St,null,p?ve.createElement(Fv,{space:i,page:r,revision:s,analyticsContext:a,onClose:()=>f(!1)}):null))},Q4=F.create({alert:t=>({position:"sticky",top:-M.RADIUS_L,right:0,left:0,zIndex:1}),alertInner:t=>({borderRadius:M.RADIUS_L,borderWidth:1,borderColor:t.colors.border.mid,backgroundColor:t.colors.background.main,...t.shadows.tight}),alertFullWidth:{maxWidth:Mr+2*zt},alertWithComments:{maxWidth:Mr+zt}});c();var _e=b(x()),Gn=b(z());var u6=Uh({width:1448,height:240}),tF=V.createInteractiveComponent(u6.View);function PC(t){let{page:o}=t;return o.cover?_e.createElement(_e.Suspense,{fallback:_e.createElement(oF,null)},_e.createElement(nF,{...t,page:o})):null}function oF(t){return _e.createElement(Gn.View,{style:[Qs.pageCover]},_e.createElement(d6,null))}function nF(t){let{page:o,revision:e,readOnly:n,rounded:r,analyticsContext:i}=t,[a,s]=_e.useState(!1),l=fy(),u=Zt(),d=Je(),[p,f]=En(),m=l6(),h=null;if(o.cover.ref){let H=o.cover.ref.kind==="file"?e.files[o.cover.ref.file]:null;m=(o.cover.ref.kind==="file"?H?gc(H?.downloadURL):null:o.cover.ref.url)||m,H?.dimensions&&(h=H.dimensions)}let y=o.cover.yPos||0,S=_e.useMemo(()=>new Gn.Animated.Value(y),[o.id,o.cover.yPos]),C=_e.useRef(y);_e.useEffect(()=>{let H=S.addListener(({value:U})=>{C.current=U});return()=>{S.removeListener(H)}},[S]);let k=async()=>{Fe(u),s(!1),await u.change(H=>{H.movePageCover(o.id,C.current)}),ne({...i,type:"edit_reposition_cover"})},O=()=>{s(!1),S.flattenOffset(),S.setValue(y)},R=_e.useRef(null),I=le(R),E=_e.useCallback(async()=>{Fe(u);let[H]=await l.prompt({title:"Select cover image",accept:"images",acceptURL:!0});H&&(await f(()=>u.change(U=>{U.addPageCover(o.id,H)})),ne({...i,type:"edit_upload_cover"}))},[i,u,o.id]),P=_e.useCallback(async()=>{Fe(u),await f(()=>u.change(H=>{H.removePageCover(o.id)})),ne({...i,type:"edit_remove_cover"})},[i,u,o.id]),L=_e.useCallback(H=>{Fe(u),u.change(U=>{U.updatePageLayout(o.id,{coverSize:H})}),ne({...i,type:"edit_cover_size",coverSize:H})},[i,u,o.id]),T=_e.useMemo(()=>{if(n)return;let H=ud(o).coverSize;return ae({groups:[{key:"pageCover",commands:[{key:"pageCover.select",icon:v.Image,title:"Select image",trigger:()=>{E()}},{key:"pageCover.reposition",icon:v.ImageSizeBlock,title:"Reposition",trigger:()=>{s(!0)}}]},{key:"pageCoverSize",commands:[{key:"pageCoverSize.full",icon:v.FullWidth,title:"Full width",type:1,selected:H==="full",trigger:()=>L("full")},{key:"pageCoverSize.hero",icon:v.DefaultWidth,title:"Hero width",type:1,selected:H==="hero",trigger:()=>L("hero")}]},{key:"pageCoverDanger",commands:[{key:"pageCoverDanger.remove",icon:v.Trashcan,title:"Remove cover",trigger:()=>P()}]}]})},[i,P,n,E,L,o]);return _e.createElement(tF,{style:[Qs.pageCover],isPDF:d},_e.createElement(rF,{coverUrl:m,animatedY:S,repositioning:a,rounded:r,isPDF:d,coverFileDimensions:h}),p?_e.createElement(d6,null):null,n||d?null:_e.createElement(V.View.Child,{style:[Qs.pageCoverButton,w.directionRow],activeStyle:"visible",inactiveStyle:a||I.opened?"visible":"hidden"},a?_e.createElement(_e.Fragment,null,_e.createElement(W,{kind:"secondary",size:"medium",style:[g.Margin.smallRight],onPress:O},"Cancel"),_e.createElement(W,{kind:"primary",size:"medium",onPress:k},"Save")):_e.createElement(_e.Fragment,null,o.cover?null:_e.createElement(W,{icon:v.Image,kind:"secondary",size:"medium",style:[g.Margin.smallRight],onPress:()=>{E()}},"Change cover"),_e.createElement(W,{ref:R,icon:v.MoreVertical,rounded:!0,size:"medium",kind:"secondary",active:I.opened,onPress:()=>{T&&I.open(T)}}))))}function rF(t){let{coverUrl:o,animatedY:e,repositioning:n,isPDF:r,rounded:i,coverFileDimensions:a}=t,s=bi(),l=_e.useRef(null),[u,d]=_e.useState(a),[p,f]=u6.useDimensions(),m=u?iF(p,u):0,[,{pageCoverRounded:h}]=_(sF),y=_e.useMemo(()=>Gn.PanResponder.create({onStartShouldSetPanResponder:(R,I)=>!1,onStartShouldSetPanResponderCapture:(R,I)=>!1,onMoveShouldSetPanResponder:(R,{dx:I})=>n,onMoveShouldSetPanResponderCapture:(R,I)=>!1,onPanResponderGrant:(R,{dx:I})=>{e.extractOffset()},onPanResponderMove:(R,{dy:I})=>{e.setValue(I/m)},onPanResponderTerminationRequest:(R,I)=>!0,onPanResponderRelease:(R,{dy:I})=>{e.flattenOffset()}}),[m,n]),S=u?u.width*m:0,C=u?u.height*m:0,k=(p.height-C)/2,O=!!u&&f;return _e.createElement(Gn.View,{...y.panHandlers,style:[Gn.StyleSheet.absoluteFill,Qs.pageCoverInner,n&&aF.pageCoverRepositioning,i&&h],...O?{testID:"page.cover"}:{}},!r&&_e.createElement(Gn.View,{style:[Qs.pageCoverOverlay,s.color==="dark"&&Qs.pageCoverOverlayDark,O&&Qs.pageCoverOverlayReady]}),_e.createElement(S1,{ref:l,source:{uri:o},loading:"priority",style:[Qs.pageCoverImage,S&&C?{top:r?0:Gn.Animated.diffClamp(Gn.Animated.add(k,Gn.Animated.multiply(e,m)),-(C-p.height),0),left:(p.width-S)/2,width:S,height:C}:{width:"100%",top:e}],onLoad:()=>{d({width:l.current?.width??0,height:l.current?.height??0})}}))}function d6(){return _e.createElement(Gn.View,{style:Qs.pageCoverLoadingOverlay},_e.createElement(Re,{size:"large"}))}function iF(t,o){let e=t.width/o.width,n=t.height/o.height;return o.height*e({borderRadius:t.radiuses.xlarge})}),Qs=Gn.StyleSheet.create({pageCoverOverlay:{position:"absolute",inset:0,opacity:1,zIndex:1,transitionDelay:"200ms",transition:"opacity 500ms ease-in, z-index 1000ms ease-in",backgroundColor:"rgba(255,255,255,.2)",backdropFilter:"blur(10px)"},pageCoverOverlayDark:{backgroundColor:"rgba(0,0,0,.2)"},pageCoverOverlayReady:{zIndex:-1,opacity:0},pageCover:{position:"relative",width:"100%",height:240},pageCoverInner:{overflow:"hidden"},pageCoverImage:{position:"absolute",left:0,right:0,objectFit:"cover",pointerEvents:"none"},pageCoverButton:{position:"absolute",bottom:g.medium,right:g.medium},pageCoverLoadingOverlay:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:Z.GREY_BLUE_LIGHT,justifyContent:"center",alignItems:"center"}});c();var ze=b(x()),ol=b(z());c();var pu=JSON.parse('{"pageHeaderContainer":"pageHeaderContainer_f8iPF","pageControls":"pageControls_65PGe","hiddenIcon":"hiddenIcon_MYEiw","revealOnHover":"revealOnHover_QTUA-"}');c();var cF=At({key:"pageOptionsAtom",default:null});function Wi(t){let o=tr(cF);return o===null?ud(t):o.layoutOptions}var tp={mobile:"MobileMainTitle",desktop:"MainTitle"},lF=J.createResponsiveComponent(Zr),C0e=J.createResponsiveComponent(s6),uF=J.createResponsiveComponent(Bt),m6=ze.memo(function(o){let{space:e,revision:n,page:r,changeRequest:i,readOnly:a,onSubmitDescription:s,analyticsContext:l,withDiff:u,toolbar:d}=o,p=hh("CUSTOM_FIELDS"),[f,m]=_(D),[,h]=_(dF),y=Je(),S=ce(),{navigate:C}=we(),[k,O]=En(),R=Zt(),I=ze.useRef(null),E=[m.Description,m.textMuted],P=Wi(r),L=async Ie=>{Fe(R),await R.change(ut=>{ut.renamePage(r.id,Ie)}),ne({...l,type:"edit_page_title",pageKind:r.type})},T=async Ie=>{Fe(R),await R.change(ut=>{ut.setPageDescription(r.id,Ie)}),ne({...l,type:"edit_page_description",pageKind:r.type})},H=Ie=>{Ie.nativeEvent.key==="Enter"&&(Ie.preventDefault(),I.current&&I.current.focus())},U=Ie=>{Ie.nativeEvent.key==="Enter"&&(Ie.preventDefault(),s&&s())},K=()=>{O(async()=>{Fe(R),await R.change(Ie=>{Ie.addPageCover(r.id)}),ne({...l,type:"edit_add_cover"})})},Y=!P.title,X=!P.description,re=Y&&X||!Y,me=Y&&!X,Be=[pu.pageControls,pu.revealOnHover,N.margin.smallTop,N.flex.row,N.gap.xsmallColumnGap];return ze.createElement(j,{style:[N.position.relative,N.flex.column,a&&!p?N.padding.xlargeTop:pu.pageHeaderContainer,Y&&X?null:N.margin.largeBottom]},a?p?ze.createElement(j,{style:Be},ze.createElement(p6,{style:[g.Padding.noneLeft]})):null:ze.createElement(j,{style:Be},ze.createElement(W,{kind:"default",size:"xsmall",style:[g.Padding.noneLeft],icon:v.Options,onPress:()=>C({screen:{sideSheet:{type:"page"}}})},"Page options"),p?ze.createElement(p6,null):null,cd(r)?null:ze.createElement(W,{kind:"default",size:"xsmall",icon:k?Re:v.Image,disabled:k,onPress:K},"Page cover")),!a&&(Y||X)?ze.createElement(j,{style:[pu.revealOnHover,N.margin.smallTop,N.gap.smallColumnGap]},Y?ze.createElement(j,{style:[N.flex.alignCenter,N.gap.xsmallColumnGap]},ze.createElement(v.EyeOff.CSS,{style:[pu.hiddenIcon]}),ze.createElement(pe,{style:[N.text.label,N.textColor.muted]},"Page title hidden")):null,X?ze.createElement(j,{style:[N.flex.alignCenter,N.gap.xsmallColumnGap]},ze.createElement(v.EyeOff.CSS,{style:[pu.hiddenIcon]}),ze.createElement(pe,{style:[N.text.label,N.textColor.muted]},"Page description hidden")):null):null,ze.createElement(j,{style:[N.flex.row,N.flex.justifySpaceBetween,N.flex.alignCenter,Y&&X?N.margin.autoLeft:null]},Y?null:ze.createElement(ol.View,{style:[w.directionRow,w.flex1]},ze.createElement(J.View,{style:[w.directionRow,w.justifyContentEnd,w.alignCenter],mobileStyle:h.emojiWrapperMobile,desktopStyle:h.emojiWrapperDesktop},r.emoji||!a?ze.createElement(J.View,{mobileStyle:[EC.pageEmojiRelative,g.Padding.noneLeft,g.Padding.mediumRight],desktopStyle:[EC.pageEmojiAbsolute,g.Padding.mediumLeft,g.Padding.mediumRight]},ze.createElement($L,{analyticsContext:l,page:r,readOnly:a,size:M.ICON_XL})):null),a?ze.createElement(ol.View,{style:[w.flex1]},ze.createElement(uF,{testID:"page.title",tag:"h1",style:[m.text],selectable:!0,mobileStyle:m[tp.mobile],desktopStyle:m[tp.desktop]},r.title)):ze.createElement(lF,{key:r.id,testID:"page.title",component:sS,value:r.title,maxLength:dm,style:[m.text,w.flex1,m.Body],onChangeText:L,onKeyPress:H,placeholder:S("untitled_page"),placeholderTextColor:f.colors.text.muted,mobileStyle:m[tp.mobile],desktopStyle:m[tp.desktop]})),y||!d?null:re&&ze.createElement(d,{space:e,changeRequest:i,revision:n,page:r,analyticsContext:l,readOnly:a})),ze.createElement(j,{style:[N.flex.row,N.flex.justifySpaceBetween,N.flex.alignCenter,Y&&X?N.margin.autoLeft:null]},X?null:ze.createElement(J.View,{style:[Y?null:g.Margin.mediumTop,w.flex1]},a?r.description?ze.createElement(ol.View,null,ze.createElement(ol.Text,{style:E,selectable:!0},r.description)):u?ze.createElement(J.View,{style:EC.pageDescriptionDiffPlaceholder,mobileStyle:"hidden"}):null:ze.createElement(Zr,{key:r.id,ref:I,component:sS,value:r.description,style:E,maxLength:Bw,onChangeText:T,onSubmitEditing:s,onKeyPress:U,placeholder:S("page_description"),placeholderTextColor:f.colors.text.muted})),y||!d?null:me&&ze.createElement(d,{space:e,changeRequest:i,revision:n,page:r,analyticsContext:l,readOnly:a})),null)});function p6(t){let{navigate:o}=we();return ze.createElement(W,{kind:"default",size:"xsmall",icon:v.Metadata,onPress:()=>o({screen:{sideSheet:{type:"page-metadata"}}}),...t},"Page metadata")}var EC=ol.StyleSheet.create({pageEmojiRelative:{position:"relative"},pageEmojiAbsolute:{position:"absolute"},pageDescriptionDiffPlaceholder:{height:Vg.mediumLarge}}),dF=F.create({emojiWrapperMobile:{width:"auto",height:Ue[tp.mobile].lineHeight},emojiWrapperDesktop:{height:Ue[tp.desktop].lineHeight},pageBodyDesktopLeftMargin:{marginLeft:zt},pageBodyMobileLeftMargin:{marginLeft:Zo}});c();var Yt=b(x()),es=b(z());var f6=J.createResponsiveComponent(Ps),g6=V.createInteractiveComponent($r),h6=Yt.memo(function(o){let{revision:e,page:n,style:r}=o,{getNavigationLinkProps:i}=we(),[,a]=_(D),s=ce(),l=Je(),u=V.useInteractiveComponent(v.ArrowLeft),d=V.useInteractiveComponent(v.ArrowRight),{desktopSidebarWidth:p}=Yt.useContext(ra),{nextPage:f,previousPage:m}=Yt.useMemo(()=>{let k=pF(e),O=k.findIndex(R=>R.id===n.id);return O===-1?{nextPage:null,previousPage:null}:{nextPage:TC(k,O,1),previousPage:TC(k,O,-1)}},[e,n.id]),{previousLinkProps:h,previousGroup:y,nextLinkProps:S,nextGroup:C}=Yt.useMemo(()=>({previousLinkProps:m?i({screen:{page:to(e,m.id)}}):void 0,previousGroup:m?In(e,m.id):null,nextLinkProps:f?i({screen:{page:to(e,f.id)}}):void 0,nextGroup:f?In(e,f.id):null}),[e,f,m]);return!f&&!m||l?null:Yt.createElement(J.View,{style:r,desktopStyle:w.directionRow,customBreakpointsStyles:{[Dc(p)]:w.directionColumn}},m?Yt.createElement(f6,{...h,style:[w.alignCenter,g.Padding.medium,w.flex1],desktopStyle:f?g.Margin.smallRight:null,customBreakpointsStyles:f?{[Dc(p)]:[g.Margin.noneRight,g.Margin.smallBottom]}:void 0},Yt.createElement(es.View,{style:[g.Margin.mediumRight]},Yt.createElement(u.Child,{size:M.XS,style:[a.textMuted],hoverStyle:a.primary})),Yt.createElement(es.View,{style:[w.flex1,w.alignEnd]},Yt.createElement(es.View,null,Yt.createElement(es.Text,{style:[a.Caption,a.textMuted]},y&&y.type==="group"?`${y.title} - `:"",s("previous"))),Yt.createElement(g6.Child,{style:[a.Body,a.Medium,a.text],activeStyle:a.primary},m.title))):null,f?Yt.createElement(f6,{...S,style:[w.alignCenter,g.Padding.medium,w.flex1],desktopStyle:m?g.Margin.smallLeft:null,customBreakpointsStyles:m?{[Dc(p)]:[g.Margin.noneLeft,g.Margin.smallTop]}:void 0},Yt.createElement(es.View,{style:[w.flex1]},Yt.createElement(es.View,null,Yt.createElement(es.Text,{style:[a.Caption,a.textMuted]},s("next"),C&&C.type==="group"?` - ${C.title}`:"")),Yt.createElement(g6.Child,{style:[a.Body,a.Medium,a.text],activeStyle:a.primary},f.title)),Yt.createElement(es.View,{style:[g.Margin.mediumLeft]},Yt.createElement(d.Child,{size:M.XS,style:[a.textMuted],hoverStyle:a.primary}))):null)});function pF(t){let o=[];function e(n){let r=t.pages[n];o.push(r),r.type!=="link"&&r.pages.length&&r.pages.forEach(e)}return t.rootPages.forEach(e),o}function TC(t,o,e){let n=t[o+e];if(n)return n.type!=="document"?TC(t,o+e,e):n}c();var Vo=b(x()),op=b(z());var mF=J.createResponsiveComponent(Ps),fF=V.createInteractiveComponent($r);function y6(t){let{subPages:o,revision:e}=t,{desktopSidebarWidth:n}=Vo.useContext(ra),r=ce(),[,i]=_(D);return Je()?null:Vo.createElement(op.View,null,Vo.createElement(op.Text,{style:[i.Body,i.text]},r("page_articles_section")),Vo.createElement(J.View,{style:[g.Padding.largeTop,w.wrap],desktopStyle:w.directionRow,customBreakpointsStyles:{[Dc(n)]:w.directionColumn}},o.map((s,l)=>Vo.createElement(Vo.Suspense,{fallback:Vo.createElement(v6,{page:s,revision:e,index:l,totalPageNumber:o.length}),key:s.id},Vo.createElement(gF,{page:s,revision:e,index:l,totalPageNumber:o.length})))))}function gF(t){let{page:o}=t,e=Qe(o.type==="link"?o.target:void 0);return Vo.createElement(v6,{...t,contentRef:e})}function v6(t){let{page:o,revision:e,index:n,totalPageNumber:r,contentRef:i}=t,{desktopSidebarWidth:a}=Vo.useContext(ra),{getNavigationLinkProps:s}=we(),[,l]=_(D),u=o.emoji?V.createInteractiveComponent(mt(Lo,{code:o.emoji})):null,d=V.createInteractiveComponent(i?.secondaryIcon||Re),p=r%2===0;return Vo.createElement(mF,{...o.type==="link"?i?Vc(i):{}:s({screen:{page:to(e,o.id)}}),style:[w.alignCenter,g.Padding.medium,w.flex1,{minWidth:`calc(50% - ${g.small}px)`}],desktopStyle:[n%2===0?p?g.Margin.smallRight:null:g.Margin.smallLeft,n{d(null)}}):null),ai.createElement(w6.View,{style:[g.Padding.smallHorizontal,g.Padding.smallVertical,g.Margin.mediumTop,s.blankslateBox,w.directionRow,w.wrap]},ai.createElement(W,{icon:v.Download,size:"medium",style:g.Margin.xsmallRight,iconTint:a.colors.primary.main,onPress:()=>{d("import"),ne({...n,type:"space_blank_slate_initiate",kind:"import"})}},"Import content"),ai.createElement(W,{icon:v.Page,size:"medium",style:g.Margin.xsmallRight,iconTint:a.colors.primary.main,onPress:()=>{r({overlay:{type:"template",space:o.key,organization:o.organization}}),ne({...n,type:"space_blank_slate_initiate",kind:"template"})}},"Use a template"),ai.createElement(W,{icon:v.GitHub,size:"medium",style:g.Margin.xsmallRight,iconTint:a.colors.primary.main,onPress:()=>{i(),ne({...n,type:"space_blank_slate_initiate",kind:"gitsync"})}},"Sync with GitHub / GitLab"),ai.createElement(W,{icon:v.User,size:"medium",style:g.Margin.xsmallRight,iconTint:a.colors.primary.main,onPress:()=>{r({screen:{sideSheet:{type:"share",tab:"invite"}}}),ne({...n,type:"space_blank_slate_initiate",kind:"invite-members"})}},"Add members")))}var hF=F.create({blankslateBox:t=>({borderRadius:M.RADIUS_L,borderWidth:1,borderColor:t.colors.border.mid})});c();var C6=b(x());function k6(t,o,e){let n=Je(),r=Gg();C6.useEffect(()=>{if(o&&!n&&r.current)if(o.hash){let i=window.document.getElementById(o.hash);i&&i.scrollIntoView({behavior:"auto",block:"start",inline:"nearest"})}else e?.current?.scrollTo(0,0)},[t,o?.hash,e,n])}c();var nl=b(x());c();var ma=b(x()),rp=b(z());var vF=V.createInteractiveComponent($r),bF={[Ve]:null,[Ge]:g.Margin.smallLeft,[Eo]:null},pLe=ma.memo(function(o){let{sections:e,activeSection:n}=o,[,r]=_(D),[,i]=_(x6),a=ce();return ma.createElement(rp.View,{style:[i.pageOutline]},ma.createElement(rp.View,{style:[w.directionRow,w.alignCenter,g.Padding.largeHorizontal,g.Margin.smallBottom]},ma.createElement(rp.Text,{style:[r.GroupTitle,r.textMuted,r.Bold]},a("outline"))),e.map(s=>ma.createElement(wF,{key:s.key,section:s,active:n===s.key})))});function wF(t){let{section:o,active:e}=t,[,n]=_(D),[,r]=_(x6),{navigateToHash:i}=we();return ma.createElement(V.TouchableOpacity,{style:[w.directionRow,g.Padding.largeHorizontal,r.sectionItem,e&&r.sectionItemActive],onPress:()=>{i(o.anchor)}},o.tag?ma.createElement(Ir,{backgroundColor:jl[o.tag]||Z.orange.base,style:[r.sectionTag,g.Margin.xsmallRight,w.alignSelfCenter]},ma.createElement(rp.Text,{style:[n.textInsideColor,n.MobileCaption,n.Bold,n.Uppercase]},o.tag)):null,ma.createElement(vF.Child,{style:[n.Label,n.textMid,o.type&&bF[o.type],e&&n.primary],hoverStyle:n.primary},o.title))}var x6=F.create({pageOutline:t=>({borderLeftWidth:1,borderLeftColor:t.colors.border.main,maxWidth:Ac}),sectionItem:{paddingTop:g.xsmall,paddingBottom:g.xsmall,marginLeft:-1,borderLeftWidth:2,borderLeftColor:"transparent",width:"fit-content",maxWidth:"100%"},sectionItemActive:t=>({borderLeftColor:t.colors.primary.main}),sectionTag:{borderRadius:M.XXS,height:M.XXS,paddingHorizontal:g.small,justifyContent:"center"}});function O6(t,o){let e=g.large,n=t.length,r=Math.floor(Math.log2(n)+1),i=0,a=n-1,s=Math.ceil((i+a)/2),l=-1,u=null;for(let d=0;de)a=s,s=Math.floor((i+a)/2);else{if(m>=-e&&m<=e)return t[s].key;mu)&&(u=m,l=s),i=s,s=Math.ceil((i+a)/2))}}return l!==-1?t[l].key:null}var _6=.9;function R6(t,o){let[e,n]=nl.useState(null),r=uh(),i=nl.useRef(0),a=nl.useRef(null),s=nl.useRef(new Map),l=t.length>1,u=SF(()=>{typeof i.current!="number"&&(i.current=o.current.getBoundingClientRect().top);let p=O6(t,i.current);p!==e&&n(p)},500),d=p=>{p.forEach(m=>{let h=m.target.getAttribute("data-key");h&&s.current.set(h,m.isIntersecting&&m.intersectionRatio>=_6)});let f=Array.from(s.current.entries()).find(([,m])=>m);f&&n(f[0])};return nl.useEffect(()=>{if(!(!o?.current||!l)){if(!r)o.current?.addEventListener("scroll",u);else{let p=t.map(f=>bc(f.key)).filter(se);a.current=new IntersectionObserver(d,{rootMargin:`-${TS}px 0px -40% 0px`,threshold:_6}),p.forEach(f=>{a.current?.observe(f)})}return()=>{o.current?.removeEventListener("scroll",u),a.current?.disconnect()}}},[o?.current,l]),e}function SF(t,o){let e=!1;return(...n)=>{e||(t.apply(this,n),e=!0,setTimeout(()=>e=!1,o))}}c();var Cf=b(x());function LC(t,o,e){let{baseRevision:n,diffMode:r,diffs:i}=Cf.useContext(Wv),a=Ce(),s=Cf.useMemo(()=>{if(!r)return null;let l;switch(r){case"quick":let d=n?.pages[o];l=d&&d.type==="document"?d.document:void 0;break;case"full":let p=i.get(o);if(!p||p.type!=="modified"||p.before.page.type!=="document")return null;l=p.before.page.document;break}if(!l)return Gu(o);let u=Xr(a.store.getDocument(t,l));if(!u)throw new Error(`Original page document "${l}" not found`);return qu(u)},[r,n,t,o,i]);return Cf.useMemo(()=>r!=="full"?[e,s]:[s?Hp.create({document:dO(s.document,e.document)}):e,s],[r,s,e])}var CF=Ze("sheet"),kF=J.createResponsiveComponent(ge);function Vv(t){let o=Zt(),{page:e,screen:n,scrollRef:r,changeRequest:i}=t;return k6(e.id,n,r),!o||n&&n.revision!==void 0||n?.changeRequest&&i&&["merged","archived"].includes(i.status)?ie.createElement(xF,{...t}):ie.createElement(OF,{...t,hiveBranch:o})}function xF(t){let{space:o,page:e}=t,n=Ce(),r=e.document?Xr(n.store.getDocument(o.key,e.document)):void 0,i=ie.useMemo(()=>r?qu(r):Gu(e.id),[r]),[a,s]=LC(o.key,e.id,i);return ie.createElement(I6,{...t,value:a,baseValue:s,onChange:()=>{}})}function OF(t){let{hiveBranch:o,space:e,page:n,analyticsContext:r,readOnly:i}=t,a=nd();Fe(o),r6(o);let s=PI({branch:o,pageId:n.id,presence:{userId:a.uid,userDisplayName:Vx(a)},readOnly:i});ie.useEffect(()=>()=>{s.dataSync.flushBatchUpdates()},[s]),ie.useEffect(()=>{o.openPage(s.pageId)},[]);let l=e6({analyticsContext:r,hivePage:s}),u=LI(s),d=ie.useMemo(()=>[u],[u]),[p,f,m]=EI(s),[h,y]=LC(e.key,n.id,p),S=ie.useCallback(O=>{m(O),O.value.document!==O.initialValue.document&&l()},[m]),C=ie.useCallback(async O=>{let R=[],I=await xw({kind:"space_file",space:e.key},O);return await o.change(E=>{I.forEach(P=>{let L=Q_(P,a.uid);R.push({kind:"file",file:L.id}),E.insertFile(L)})}),R.forEach((E,P)=>{CF.info(`file ${E.file} uploaded (${P+1} / ${R.length})`)}),R},[e.key,a.uid,o]),k=ie.useCallback(async(O,R)=>{let[I]=await xw({kind:"space_file",space:e.key},[R]);await o.change(E=>{E.updateFile(O.file,I)})},[e.key,o]);return ie.createElement(I6,{...t,value:h,baseValue:y,onChange:S,selections:f,uploadFiles:C,updateFile:k,editorPlugins:d})}function I6(t){let{space:o,revision:e,page:n,changeRequest:r,readOnly:i=!0,value:a,baseValue:s,onChange:l,selections:u,uploadFiles:d,updateFile:p,withComments:f,analyticsContext:m,withToC:h,outline:y,toolbar:S,footer:C,withDiff:k,scrollRef:O,sideColumnStickyTop:R,editorPlugins:I}=t,{color:E}=bi(),{mode:P}=ie.useContext($o),L=ie.useRef(null),{pages:T,setContentDiffPage:H}=ie.useContext(t6),U=Va(),K=N_(),Y=ce(),X=Je(),re=ie.useRef(),{sections:me,sectionIDs:Be}=ie.useMemo(()=>{let dt=gO(a.document,re.current),Ki=xg(a.document,dt).filter(gs=>gs.parentType==="document"&&gs.type!==null&&[Ve,Ge,Eo].includes(gs.type));return{sectionIDs:dt,sections:Ki}},[a.document,re]);re.current=Be;let Ie=U.screen.type==="space"&&U.screen.sideSheet?.type==="comments"?{commentKey:U.screen.sideSheet.comment,nodeKey:U.screen.sideSheet.node}:void 0;ie.useEffect(()=>{Ie?.commentKey&&Ie?.nodeKey&&bc(Ie.nodeKey)?.scrollIntoView()},[Ie?.commentKey]);let ut=ie.useRef(null),Ro=ie.useCallback(()=>{let dt=ut.current;if(!dt)return;let Ki=dt.value.change();xs(Ki.value.document)||Ki.collapseToStartOf(dt.value.document),Ki.focus(),l(Ki)},[ut]),Fr=ie.useMemo(()=>T.find(dt=>dt.page.id===n.id&&dt.diff),[T,n.id]),an=dt=>{l(dt),!Fr&&r&&!a.document.equals(dt.value.document)&&H({diff:"modified",page:n})},Qn=Ro,Vr=me.length>1,qr=!y||X,Io=R6(me,O),sn=ie.useCallback(dt=>{ne({...m,...dt})},[m]),{desktopSidebarWidth:cn}=ie.useContext(ra),{customBreakpointsOutlineStyles:fi,customBreakpointsPageBodyStyles:q}=ie.useMemo(()=>{let dt=P==="public-content"?1280:Tm(2,cn);return{customBreakpointsOutlineStyles:{[dt]:"hidden"},customBreakpointsPageBodyStyles:{[dt]:w.justifyContentCenter}}},[P,cn]),oe=MS(cn,vy),$=e.conflicts?.pages[n.id],te=xs(a.document),Me=te&&Object.keys(e.pages).length===1&&!i,{diffs:at}=ie.useContext(Wv),Ye=at.has(n.id),[st,ct]=cE({isDiffViewEnabled:k,isCommentMarginVisible:f,isFullPage:h||qr}),et=XP(),co=ie.useCallback(dt=>{dt?et.highlight(dt,{highlighting:!1,postButton:!0}):et.highlight(null)},[et]),Nt=fy(),er=ie.useMemo(()=>({withImages:{filesManager:Nt,onPaste:d||(async()=>[])},withAPIs:{filesManager:Nt},withDrawings:{filesManager:Nt,updateDrawing:p||(async()=>{}),uploadDrawings:d||(async()=>[])},withFiles:{filesManager:Nt,onPaste:d||(async()=>[])},withTables:{cards:{coverImageFilesManager:Nt},columnTypes:{files:{filesManager:Nt}}}}),[Nt,d,p]),ms=ie.useMemo(()=>({uploadFiles:d}),[d]),Lu=!U.overlay&&te&&!i;ie.useEffect(()=>{Lu&&Ro()},[n.id,Lu,Ro]);let bl=Wi(n),Hi=cd(n)&&!!bl.cover,fs=bl.coverSize,wl=!bl.pagination||o.showPagination===!1,Jf=ie.useMemo(()=>({type:"document",editable:!i,spaceId:o.key,theme:E}),[o.key,E,i]),_a=C_(No("listSpaceIntegrationsBlocks",{spaceId:o.key}),ie.useCallback(dt=>{let Ki={};return dt.forEach(gs=>{Ki[gs.name]=gs.blocks}),Ki},[])),Qf=ie.useCallback(()=>{let{data:dt}=Pl(No("listIntegrations"));return dt?Ng(dt.items):{}},[]);return ie.createElement(ie.Fragment,null,Hi&&fs==="full"?ie.createElement(j,{style:P==="public-content"&&!h?ZL.pageCoverBleedFull:null},ie.createElement(PC,{revision:e,page:n,readOnly:i,analyticsContext:m})):null,ie.createElement(ip.View,{ref:L,style:[w.flex1,w.directionRow]},ie.createElement(E6,{style:[N.flex.flex1,N.flex.column]},Hi&&fs==="hero"?ie.createElement(Od,null,ie.createElement(j,{style:[N.flex.flex1,N.margin.mediumTop]},ie.createElement(PC,{revision:e,page:n,readOnly:i,analyticsContext:m,rounded:!0}))):null,ie.createElement(ge,{tag:"main",style:[w.flex1,w.directionColumn]},ie.createElement(Od,null,ie.createElement(J.View,{style:[w.flex1,w.directionRow],customBreakpointsStyles:q},ie.createElement(ip.View,{style:[w.flex1]},ie.createElement(m6,{space:o,revision:e,page:n,changeRequest:r,readOnly:i,onSubmitDescription:Qn,analyticsContext:m,withDiff:k,toolbar:S})))),ie.createElement(J.View,{desktopStyle:X?void 0:g.Padding.xlargeBottom},$!==void 0?ie.createElement(st,{renderMode:"marginless-centered"},ie.createElement(c6,{space:o,page:n,revision:e,document:a.document,pageIsDiff:k,conflictType:$,analyticsContext:m})):null,i&&te&&n.pages.length?ie.createElement(st,{renderMode:"centered"},ie.createElement(y6,{subPages:n.pages.map(dt=>e.pages[dt]),revision:e})):ie.createElement(tE,{withComments:f,spaceKey:o.key,pageKey:n.id,changeRequestKey:r?.key},ie.createElement(P6,{ref:ut,value:a,baseValue:s,selections:u,onChange:an,readOnly:i,isDiff:Ye,logAnalyticsEvent:sn,blocks:er,onContentPaste:ms,placeholder:"Enter your content here\u2026",sectionIDs:Be,selectedSection:U.screen.hash||null,blockLayoutComponent:st,rightGutterComponent:ct,integrationBlocksContext:Jf,integrationsBlocksSubscription:_a,integrationBlocksRemote:K,suggestIntegrations:Qf,onBlockHover:co,plugins:I}),Me?ie.createElement(st,{renderMode:"centered"},ie.createElement(S6,{space:o,analyticsContext:m,changeRequest:r})):null),Me?null:ie.createElement(Od,{style:N.margin.largeTop},ie.createElement(J.View,{style:[w.flex1,w.directionRow],customBreakpointsStyles:q},ie.createElement(ip.View,{style:[w.flex1]},ie.createElement(J.View,null,wl?null:ie.createElement(h6,{analyticsContext:m,space:o,revision:e,page:n,style:g.Margin.largeBottom}),C||null))))))),qr?null:ie.createElement(kF,{tag:"aside",accessibilityLabel:Y("page_outline"),testID:"page.outline",style:[NC.pageSideColumn,g.Margin.largeVertical,{top:R!==void 0?R:g.large,maxHeight:R!==void 0?`calc(100vh - ${R}px)`:`calc(100vh - ${IS+g.large}px)`},P==="app"?NC.pageSideMaxWidth:NC.pageSidePublicMaxWidth],mobileStyle:"hidden",desktopStyle:{width:oe},customBreakpointsStyles:fi},Vr?ie.createElement(y,{sections:me,activeSection:Io}):null)))}var NC=ip.StyleSheet.create({pageSideMaxWidth:{maxWidth:Ac},pageSidePublicMaxWidth:{maxWidth:Ac},pageSideColumn:{position:"sticky",overflowY:"auto",alignSelf:"flex-start"},pageBody:{maxWidth:Mr+2*zt},pageBodyWithComments:{maxWidth:Mr+zt,marginRight:0},pageBodyDesktopRightPadding:{paddingRight:zt},pageBodyMobileRightPadding:{paddingRight:Zo},pageBodyPDFRightPadding:{paddingRight:Zo},pageBodyDesktopLeftMargin:{marginLeft:zt},pageBodyMobileLeftMargin:{marginLeft:Zo},pageBodyPDFLeftMargin:{marginLeft:Zo}});c();var AC=b(x()),T6=b(z());function Gv(t){let{withPageOutline:o=!0}=t;return AC.createElement(J.View,{style:[w.directionRow,w.justifyContentCenter],desktopStyle:[g.Padding.xxlargeTop,qv.pageSheetLoadingDesktop,o&&qv.pageSheetLoadingDesktopWithOutline],mobileStyle:[g.Padding.mediumTop,qv.pageSheetLoadingMobile]},AC.createElement(Mo,{size:"xlarge",style:qv.pageBody}))}var qv=T6.StyleSheet.create({pageSheetLoadingDesktop:{paddingRight:zt,paddingLeft:zt},pageSheetLoadingDesktopWithOutline:{paddingRight:Ac+zt},pageSheetLoadingMobile:{paddingLeft:Zo,paddingRight:Zo},pageBody:{maxWidth:Mr+2*zt}});c();var Hn=b(x());c();var $e=b(x()),fa=b(z());function M6(t){let{revision:o,analyticsContext:e,page:n,onClose:r}=t,i=$e.useRef(null),[,a]=_(D),[s,l]=$e.useState(n.title),[u,d]=$e.useState(n.emoji),[p,f]=$e.useState("slug"in n&&n.slug?n.slug:""),[m,h]=$e.useState(n.type==="link"?n.target:void 0),y=Zt(),S=s.length>0&&(n.type==="link"?!!m:!0),C=In(o,n.id),k=C?to(o,C.id):"",O=n.type!=="link"?zO(o,n.id,s):"",R=async()=>{S&&(Fe(y),await y.change(P=>{P.updatePage(n.id,n.type!=="link"?{title:s,emoji:u,slug:p?gw(p):void 0}:{title:s,emoji:u,target:m})}),n.title!==s&&ne({...e,type:"edit_page_title",pageKind:n.type}),n.type!=="link"&&p&&n.slug!==p&&ne({...e,type:"edit_page_path",pageKind:n.type}),n.emoji!==u&&ne({...e,...u?{type:"edit_pick_page_emoji",pageKind:n.type,emoji:u}:{type:"edit_remove_page_emoji",pageKind:n.type}}),r())},I=P=>{i.current?.close(),d(P)},E=$e.useMemo(()=>u?mt(Lo,{code:u}):null,[u]);return $e.createElement(yo,{title:"Edit page",onClose:r,footer:$e.createElement(fa.View,{style:[w.directionRow,w.justifyContentEnd]},$e.createElement(W,{kind:"secondary",onPress:r,style:g.Margin.smallRight},"Cancel"),$e.createElement(rm,{disabled:!S,kind:"primary",onPress:R},"Save"))},$e.createElement(fa.View,{style:[g.Margin.largeBottom]},$e.createElement(fa.View,{style:[g.Margin.smallBottom]},$e.createElement(Qu,null,"Title")),$e.createElement(fa.View,{style:[w.directionRow,w.alignEnd]},$e.createElement(fa.View,{style:[g.Margin.mediumRight]},$e.createElement(vc,{ref:i,wrapper:Ci,anchor:({ref:P,opened:L,toggle:T})=>$e.createElement(W,{ref:P,active:L,onPress:T,kind:"secondary",size:"large",icon:E||v.EmojiReaction})},$e.createElement(Mn,{kind:"wide"},$e.createElement(sy,{onPick:I,onRemove:u?()=>I(void 0):void 0})))),$e.createElement(fa.View,{style:[w.flex1]},$e.createElement(oo,{size:"large",value:s,onChangeText:l,onSubmit:R})))),n.type==="link"?$e.createElement(fa.View,null,$e.createElement(Ty,{label:"Reference",size:"large",value:m,onChangeValue:h})):$e.createElement(fa.View,null,$e.createElement(oo,{label:"Slug",size:"large",prefix:`${k}/`,value:p,placeholder:O,onChangeText:f,onSubmit:R,feedback:p&&!qx(p)?{type:"warning",message:$e.createElement($e.Fragment,null,"The page slug contains unsupported characters for an URL. Saving will replace it by"," ",$e.createElement(fa.Text,{style:[a.Bold]},gw(p)),".")}:void 0})))}c();var hr=b(x());c();var ga=b(x()),DC=b(z());function L6(t){let{onClose:o,onSubmit:e}=t,[n,r]=ga.useState(""),[i,a]=ga.useState(),s=async()=>{i?e(j_({title:n,target:i})):o()};return ga.createElement(yo,{title:"Insert link",onClose:o,subtitle:"Insert a link to external content in your content navigation, this link will open in a new tab.",footer:ga.createElement(DC.View,{style:[w.directionRow,w.justifyContentEnd]},ga.createElement(W,{kind:"secondary",onPress:o,style:g.Margin.smallRight},"Cancel"),ga.createElement(W,{kind:"primary",onPress:s,disabled:!i},"Insert"))},ga.createElement(DC.View,{style:[g.Margin.largeBottom]},ga.createElement(oo,{autoFocus:!0,label:"Title",size:"large",placeholder:"Enter title to display",value:n,onChangeText:r})),ga.createElement(Ty,{label:"To",size:"large",placeholder:"Paste in or type a url",value:i,onChangeValue:a}))}function N6(t){let{space:o,revision:e,changeRequest:n,analyticsContext:r,parent:i}=t,{navigateToPage:a}=Fc(),[s,l]=hr.useState(null),u=Zt(),d=hr.useCallback(y=>{Fe(u);let S=u.syncChange(C=>{let k=typeof y=="function"?y(C):y;return C.insertPage(k,{into:i}),k});ne({...r,type:"edit_create_page",pageKind:S.type}),S.type!=="link"&&a(u.revision,S.id,{preserveSideSheet:!0})},[u,a]),p=hr.useCallback(()=>{Fe(u);let y=u.syncChange(S=>{let C=AO({title:S.getUniquePageTitle("Group",!0)}),k=Qp({title:S.getUniquePageTitle("Page",!0)});return S.insertPage(C,{into:i}),S.insertPage(k,{into:C.id}),k});ne({...r,type:"edit_create_page",pageKind:"group"}),a(u.revision,y.id,{preserveSideSheet:!0})},[e,u,a]),f=hr.useMemo(()=>ae({groups:[{key:"insertPage",commands:[{key:"insertPage.sheet",icon:v.Page,title:"New document page",trigger:()=>{d(y=>Qp({title:y.getUniquePageTitle("Page",!0)}))}},i?null:{key:"insertPage.group",icon:v.AddPageGroup,title:"New group",trigger:()=>{p()}},{key:"insertPage.link",icon:v.Link,title:"New link",trigger:()=>{l("link")}}].filter(se)},{key:"insertExisting",commands:[{key:"insertExisting.import",icon:v.Download,title:"Import new pages",trigger:()=>{l("import")}}].filter(se)}]}),[e,i,p,d]),m=()=>{l(null)};return[hr.createElement(hr.Fragment,null,hr.createElement(St,null,s==="link"?hr.createElement(L6,{onClose:m,onSubmit:y=>{d(y),l(null)}}):null),hr.createElement(St,null,s==="import"?hr.createElement(np,{space:o,changeRequest:n,page:i,analyticsContext:r,onClose:m}):null)),f,d]}function Hv(t,o=[]){let{space:e,revision:n,changeRequest:r,page:i,analyticsContext:a,readOnly:s}=t,[l,u]=Hn.useState(null),d=Ce(),p=Zt(),{getNavigationHref:f,navigateToPage:m}=Fc(),{navigate:h}=we(),y=Hn.useContext($o),S=ce(),C=Kg(),[k,O,R]=N6({space:e,revision:n,changeRequest:r,parent:i.id,analyticsContext:a}),I=Object.keys(n.pages).length>1,E=Hn.useMemo(()=>ae({groups:[s?null:{key:"pageEdit",commands:[i.type!=="link"?{key:"pageEdit.insert",icon:v.AddPageGroup,title:"Insert subpage",descendant:()=>O,trigger:()=>{R(L=>Qp({title:L.getUniquePageTitle("Page",!0)}))}}:null,i.type!=="link"?{key:"pageEdit.import",icon:v.Download,title:"Import subpages",trigger:()=>{u("import")}}:null,i.type==="document"&&cd(i)?{key:"pageEdit.addCover",icon:v.Image,title:"Add cover",trigger:async()=>{Fe(p),await p.change(L=>{L.addPageCover(i.id)}),ne({...a,type:"edit_add_cover"})}}:null,{key:"pageEdit.edit",icon:v.Type,title:i.type==="link"?"Edit":"Rename",trigger:()=>{u("edit")}},{key:"pageEdit.duplicate",icon:v.PageDuplicate,title:"Duplicate",trigger:async()=>{Fe(p);let L=await d.duplicateContent({contentId:p.contentId,branchId:p.branchId},{contentId:p.contentId,branchId:p.branchId,pageId:i.id});ne(Bg(e,i,{...a,type:"edit_duplicate_page",pageKind:i.type})),i.type!=="link"&&m(p.revision,L.pageId)}},i.type==="document"?{key:"pageEdit.options",icon:v.Options,title:"Options",trigger:()=>{h({screen:{sideSheet:{type:"page"}}})}}:null,I?{key:"pageEdit.delete",icon:v.Trashcan,title:"Delete",trigger:()=>{u("delete")}}:null].filter(se)},{key:"pageRead",commands:[i.type==="document"&&(e.hasPDFExport||y.mode!=="public-content")?{key:"pageRead.export",icon:v.PDF,title:S("export_pdf"),testID:"page.exportButton",trigger:()=>{m(n,i.id,{sideSheet:{type:"share",tab:"pdf"}})}}:null,i.type!=="link"?{key:"pageRead.copyURL",icon:v.Link,title:S("copy_link"),trigger:()=>{let L=f(n,i.id),T=`${window.location.origin}${L}`;C.writeTextAndNotify(T,{title:"Page URL copied to clipboard"})}}:null,i.type!=="link"&&e.showEditOnGitProvider&&e.git?.url&&e.git?.installationProvider&&i.git?.filePath&&y.mode==="public-content"?{key:"pageRead.editOnGitHub",icon:V_[e.git?.installationProvider],title:S("edit_on_github",q_[e.git?.installationProvider]),trigger:()=>{window.location.assign(`${e.git?.url}/${i.git?.filePath}`)}}:null,...o].filter(se)}].filter(se)}),[s,e,n,i,I,y.mode,f,m,r,o,d,p]),P=()=>{u(null)};return[Hn.createElement(Hn.Fragment,null,k,Hn.createElement(St,null,l==="edit"?Hn.createElement(M6,{revision:n,page:i,analyticsContext:a,onClose:P}):null),Hn.createElement(St,null,l==="delete"?Hn.createElement(Fv,{space:e,page:i,revision:n,analyticsContext:a,onClose:P}):null),Hn.createElement(St,null,l==="import"?Hn.createElement(np,{space:e,changeRequest:r,page:i.id,analyticsContext:a,onClose:P}):null)),E]}var _F=[{size:25,label:"Small"},{size:50,label:"Medium"},{size:75,label:"Large"},{size:100,label:"Fit"}];function A6(t,o){let e=typeof t=="number"?t:t?.value,n=typeof t=="number"?"px":t?.unit;return`${e||100}${n||o}`}function D6(t,o){return typeof t=="number"?`${t}px`:t?.unit==="px"?`${t.value}${t.unit}`:o}async function RF(t,o,e,n){let r=o.nodes.toArray().map(s=>{let{ref:l,refDark:u}=s.data.toFrozenObject();return n==="dark"&&u?u:l}),i={url:"",broken:!0},a=r.map(s=>ET(t,s,e).then(({uri:l})=>typeof l!="string"||l===""?i:{url:l,broken:!1}).catch(()=>i));return Promise.all(a)}function B6(t){let{node:o,parent:e,isSelected:n,attributes:r,editor:i}=t,{readOnly:a}=i,{ref:s,refDark:l,height:u,width:d}=o.data.toFrozenObject(),p=sv(i,o.key),{logAnalyticsEvent:f}=ye.useContext(de),m=My(s,l),h=Ce(),y=lt(),[,S]=_(BC),C=kd(),k=V.useInteractiveState(),O=e.nodes.size>1,R=gn({disabled:!O,...Wn({id:o.key,type:"block",blockType:o.type,previewLabel:"Move image"})}),I=V.useInteractiveState(),E=Rs(),[P,L]=ye.useState(null),T=Uo.getImageAltText(o),H=A6(d,"%"),U=A6(u,"%"),K=D6(u,"auto"),Y=D6(d,"100%"),X=()=>{L("alt")},re=()=>{L(null)},me=async()=>{if(!m||!m.uri)return;let Ie=await RF(h,e,y,E.color),ut=e.getChildIndex(o.key);C.open(Ie,ut)},Be=Ie=>{if(!m)return;f({type:"edit_page_document_edit_block_property",blockType:Zi,blockProperty:"size",fromValue:void 0,toValue:Ie.label});let ut=TF(m,Ie.size);i.change(Ro=>{u&&Ro.removeDataPathByKey(o.key,["height"]),ut?Ro.insertDataByKey(o.key,["width"],ut):Ro.removeDataPathByKey(o.key,["width"])})};return ye.createElement(ye.Fragment,null,ye.createElement(St,null,P==="alt"?ye.createElement(Av,{...t,onClose:re}):null),ye.createElement(ts.View,{style:[w.alignCenter,w.flex1]},ye.createElement(ts.View,{ref:R.setNodeRef,style:[S.imageWrapper,{maxWidth:H,maxHeight:U}],...k.events,...r},ye.createElement(Ut,{...t},m?ye.createElement(V.TouchableOpacity,{onPress:me,style:w.alignCenter},ye.createElement(jo,{width:Y,height:K,source:m,accessibilityLabel:T,loading:p?"priority":"lazy",style:[S.image,R.isDragging&&je.translucent]})):ye.createElement(IF,{accessibilityLabel:T})),a?null:ye.createElement(ye.Fragment,null,(n||k.hovered)&&!R.isDragging?ye.createElement(PF,{...t,openAltTextModal:X,setSize:Be}):null,ye.createElement(wi,{theme:{color:"dark"}},O?ye.createElement(ts.View,{ref:R.setActivatorNodeRef,style:[S.imageDragHandle,{display:(k.hovered||I.hovered)&&!R.isDragging?"flex":"none"}],...I.events,...R.listeners},ye.createElement(v.GrabberVertical,{size:M.ICON_S,style:[S.imageDragHandleIcon]})):null)))),ye.createElement($c,{...t,isSelected:t.isSelected||k.hovered}))}function IF(t){let{style:o,...e}=t,[,n]=_(D),[,r]=_(BC);return ye.createElement(ts.View,{style:[w.alignCenter,w.justifyContentCenter,r.brokenImage,g.Padding.large,o],...e},ye.createElement(ts.View,null,ye.createElement(v.CloudOff,{size:M.ICON_L,style:[n.textMuted]})),ye.createElement(ts.View,{style:[g.Margin.mediumTop]},ye.createElement(ts.Text,{style:[n.Caption,n.textMuted]},"Could not load image")))}function PF(t){let{editor:o,node:e,openAltTextModal:n,setSize:r}=t,i=Rs(),[,a]=_(BC),[s,l]=ye.useState(!1),u=Kr(R_),d=e.data.toFrozenObject(),p=()=>{o.change(f=>{e&&be.isTextRange(f.value.selection)&&!f.value.selection.hasEdgeIn(e)&&f.collapseToStartOf(e),f.focus()}),l(!0)};return ye.createElement(ye.Fragment,null,ye.createElement(ts.View,{style:[a.imageToolbar,d.refDark?a.imageToolbarWith2Buttons:null,w.directionRow,s?a.imageToolbarOpen:null]},s?ye.createElement(ye.Fragment,null,ye.createElement(EF,{onPress:r,...t}),ye.createElement(W,{title:"ALT text",size:"small",icon:v.AltText,style:[g.Margin.smallRight],onPress:n}),ye.createElement(Dv,{editor:o,node:e,style:N.margin.smallRight}),ye.createElement(W,{size:"small",icon:v.X,onPress:()=>l(!1)})):ye.createElement(ye.Fragment,null,d.refDark?ye.createElement(W,{size:"small",icon:i.color==="light"?v.ThemeDark:v.ThemeLight,title:`Image has a ${i.color==="light"?"dark":"light"} mode alternative. Toggle theme to see it.`,onPress:()=>{u(i.color==="light"?"dark":"light")},style:[g.Margin.smallRight]}):null,ye.createElement(W,{size:"small",icon:v.MoreVertical,onPress:p}))))}function EF(t){let{editor:o,node:e,onPress:n}=t,r=ye.useRef(null),i=_F.map(({size:l,label:u})=>({key:`${l}`,title:u,trigger:()=>{n({size:l,label:u})}})),a=le(r),s=()=>{a.open(ae({position:{width:"anchor"},groups:[{key:"image.resize",commands:i}].filter(se)})),o.change(l=>{e&&be.isTextRange(l.value.selection)&&!l.value.selection.hasEdgeIn(e)&&l.collapseToStartOf(e),l.focus()})};return ye.createElement(ye.Fragment,null,ye.createElement(W,{ref:r,active:a.opened,size:"small",rightIcon:v.ChevronDown,onPress:s},"Size"))}function TF(t,o){let e=t.width||Jo.PAGE_BODY_MAX_WIDTH;if(o===100)return;let n=Math.min(e,Jo.PAGE_BODY_MAX_WIDTH);return Math.round(n*(o/100))}var BC=F.create({imageWrapper:{position:"relative",borderRadius:M.RADIUS_M},imageCaption:{position:"relative",textAlign:"center"},image:{borderRadius:M.RADIUS_M,maxWidth:"100%"},imageToolbar:t=>({position:"absolute",top:g.small,right:g.small,padding:g.small,borderRadius:M.RADIUS_M,borderColor:t.colors.border.mid,borderWidth:1,borderStyle:"solid",backgroundColor:t.colors.background.mid,overflow:"hidden",width:42,transition:"width 50ms ease-in-out"}),imageToolbarWith2Buttons:{width:76},imageToolbarOpen:{width:188},imageDragHandle:{position:"absolute",top:g.small,left:g.small,cursor:"grab"},imageDragHandleIcon:{textShadowColor:Z.BLACK,textShadowRadius:3,color:Z.WHITE},brokenImage:t=>({borderRadius:M.RADIUS_M,backgroundColor:t.colors.background.muted})});c();var De=b(x());c();var WC=JSON.parse('{"tooltip":"tooltip_8qsEs","brokenImage":"brokenImage_F5FWc"}');function W6(t){let{editor:o,node:e,parent:n,ancestors:r}=t,i=sv(o,e.key),a=De.useRef(null),s=gr(n.object==="block"?n:null),l=e.data.get("size","original"),[,u]=_(AF),d=r.some(f=>f.object==="inline"&&f.type===Rn),p=f=>De.createElement(Gd,{...f,...t,style:[u.inlineFrame,l==="line"?w.alignCenter:null]},De.createElement(De.Suspense,{fallback:De.createElement(Re,{size:"small"})},De.createElement(MF,{node:e,parentLineHeight:s,size:l,ref:a,withPriorityLoading:i})));return o.readOnly?p(d?{}:{onPress:()=>{a.current?.openInGallery()}}):De.createElement(NF,{...t,anchor:p})}var MF=De.forwardRef(function(o,e){let{node:n,parentLineHeight:r,size:i,withPriorityLoading:a}=o,{ref:s,refDark:l}=n.data.toFrozenObject(),u=Uo.getImageAltText(n),d=My(s,l),p=kd();De.useImperativeHandle(e,()=>({openInGallery:()=>{d?.uri&&p.open([{url:d.uri}])}}),[d?.uri]);let f={};i==="original"?f={maxWidth:300}:f={maxHeight:r,height:r,width:"auto"};let m=De.createElement(LF,{accessibilityLabel:u});return d?De.createElement(jo,{accessibilityLabel:u,source:d,style:f,errorFallback:m,loading:a?"priority":"lazy"}):m});function LF(t){let{accessibilityLabel:o}=t,[,e]=_(D);return De.createElement(j,{style:WC.brokenImage,"aria-label":o},De.createElement(v.CloudOff,{size:M.ICON_M,style:e.textMuted}))}function NF(t){let{node:o,anchor:e,isFocused:n,editor:r}=t,{logAnalyticsEvent:i}=De.useContext(de),a=De.useRef(null),[s,l]=De.useState(null),u=n&&r.value.selection.isCollapsed,[d,p]=De.useState(!1);De.useEffect(()=>{if(u){p(!0);return}let y=setTimeout(()=>{p(!1)},300);return()=>{clearTimeout(y)}},[u]);let f=()=>{r.change(y=>{y.collapseToStartOf(o).focus()})},m=y=>{r.change(S=>{S.insertDataByKey(o.key,["size"],y),S.collapseToStartOf(o).focus()})},h=()=>{i({type:"edit_page_document_edit_block_type",fromType:mc,toType:Zi}),r.change(y=>{Uo.replaceInlineImageWithBlock(y,o)})};return Yu(()=>{a.current?.updatePosition()},[o.data]),De.createElement(De.Fragment,null,De.createElement(St,null,s==="alt"?De.createElement(Av,{...t,onClose:()=>l(null)}):null),De.createElement(Ba,{ref:a,opened:u||d,anchor:({ref:y})=>e({ref:y,onPress:f})},De.createElement(Mn,{kind:"tooltip"},De.createElement(j,{style:WC.tooltip},De.createElement(W,{size:"small",title:"Inline size",onPress:()=>m("line"),icon:v.ImageSizeSmall}),De.createElement(W,{size:"small",title:"Original size",onPress:()=>m("original"),icon:v.ImageSizeLarge}),De.createElement(W,{size:"small",title:"Convert to block",onPress:h,icon:v.ImageSizeBlock}),De.createElement(Dv,{editor:r,node:o}),De.createElement(W,{size:"small",title:"ALT text",onPress:()=>l("alt"),icon:v.AltText})))))}var AF=F.create({inlineFrame:{maxWidth:"100%"}});c();var z6=b(x());function F6(t){let{children:o,attributes:e}=t;return z6.createElement(Bt,{tag:"strong",style:fo.Bold,...e},o)}c();var V6=b(x());function q6(t){let{children:o,attributes:e}=t;return V6.createElement(Bt,{tag:"em",style:fo.Italic,...e},o)}c();var G6=b(x());function H6(t){let{children:o,attributes:e}=t;return G6.createElement(Bt,{tag:"span",style:fo.Strikethrough,...e},o)}c();var K6=b(x());function X6(t){let{children:o,attributes:e}=t,[,n]=_(DF);return V1(),K6.createElement(Bt,{tag:"code",style:[n.markCode],...e},o)}var DF=F.create({markCode:t=>({backgroundColor:t.colors.background.muted,borderRadius:t.radiuses.medium,paddingLeft:g.xsmall,paddingRight:g.xsmall,fontFamily:zg})});c();var U6=b(x());function Y6(t){let{children:o,mark:e,attributes:n}=t,r=e.data.toObject(),i=bi(),a=r.background&&r.background!=="default",s=r.text&&r.text!=="default",l=a&&i.color==="dark"?{color:Z.lightModeText.base}:null;s&&(l=ry.find(d=>d.key===r.text)||null);let u=a?iy.find(d=>d.key===r.background):null;return U6.createElement(Bt,{tag:"mark",style:[{color:l?l.color:"inherit",backgroundColor:u?u.color:"inherit"}],...n},o)}c();var os=b(x()),Uv=b(z());c();var qo=b(x()),kf=b(z());c();var j6=JSON.parse('{"exitHint":"exitHint_xASL-","show":"show_HIlHf"}');function Kv(t){let{node:o,anchor:e,isSelected:n,isOnlyNodeSelected:r,isFocused:i,editor:a}=t,{formula:s}=o.data.toFrozenObject(),l=qo.useRef(null),[u,d]=qo.useState(!1),[p,f]=qo.useState(!1),[m,h]=Uu(s,[s]),[,y]=_(D),S=()=>{d(!1),f(!1)},C=()=>{u||(a.change(I=>{qt(I.value.selection)&&I.collapseToStartOf(o).focus()}),d(!0))};qo.useEffect(()=>{u&&l.current?.focus()},[u]),qo.useEffect(()=>{r&&C()},[r]);let k=I=>{h(I),f(!1)},O=()=>{S(),a.change(I=>{I.blur(),I.insertDataByKey(o.key,["formula"],o.object==="inline"?m.replace(/\n/g," "):m)})},R=()=>{S(),a.change(I=>{if(I.blur(),I.insertDataByKey(o.key,["formula"],o.object==="inline"?m.replace(/\n/g," "):m),o.object==="block")wt(I);else{let E=o.getFirstText()?.key;if(E){let P=I.value.document.getNextText(E);P&&I.collapseToStartOf(P)}}I.focus()})};return a.readOnly?e({formula:s}):qo.createElement(KI,{opened:u,onClose:O,wrapper:M1,anchor:({ref:I})=>e({ref:I,isFocused:n&&i||u,onPress:C,formula:m,onError:()=>{f(!0)}})},qo.createElement(Mn,{kind:"tooltip"},qo.createElement(kf.View,null,qo.createElement(oo,{ref:l,multiline:!0,numberOfLines:3,autoFocus:!0,selectTextOnFocus:!0,value:m,onChangeText:k,placeholder:"Enter your TeX formula",onSubmit:R,kind:"inverted",textStyle:p?[y.danger]:void 0}),qo.createElement(BF,null),p?qo.createElement(za,{tooltip:"There is an error in your math formula",preferredPlacement:"bottom"},(I,E)=>qo.createElement(kf.View,{ref:E,style:WF.blockErrorBadge,...I.events},qo.createElement(ho,{icon:v.ExclamationCircle,kind:"danger"}))):null)))}function BF(){return qo.createElement(pe,{style:[j6.exitHint,N.text.label,N.textColor.muted,N.text.notSelectable],contentEditable:!1},"Exit with"," ",qo.createElement(Pn,{inverted:!0,style:[N.flex.inline],shortcut:qe.EDITOR_EXIT_BLOCK}))}var WF=kf.StyleSheet.create({blockErrorBadge:{position:"absolute",bottom:g.small,left:g.small}});c();var Xv=Zg("f1a718ae5a0b5d0a680254c13fabc0ed4b38f7b4037704dda83756645a7f1027",()=>import("https://app.gitbook.com/public/app/chunks/MathTeXView.lazycomponent-YGRCHIY6.min.js"));function $6(t){return os.createElement(Kv,{anchor:({formula:o,onError:e,...n})=>os.createElement(Se,{...t},os.createElement(Ut,{...t,...n},os.createElement(os.Suspense,{fallback:os.createElement(oi,null)},os.createElement(Uv.ScrollView,{horizontal:!0,showsVerticalScrollIndicator:!1,contentContainerStyle:zF.container},os.createElement(Xv,{formula:o,inline:!1,onError:e}))))),...t})}var zF=Uv.StyleSheet.create({container:{marginLeft:"auto",marginRight:"auto"}});c();var rl=b(x());function Z6(t){return rl.createElement(Kv,{anchor:({formula:o,onError:e,...n})=>rl.createElement(Gd,{...t,...n},rl.createElement(rl.Suspense,{fallback:rl.createElement(Re,{size:"small"})},rl.createElement(Xv,{formula:o,inline:!0,onError:e}))),...t})}c();var jt=b(x());c();var J6=b(x()),Yv=J6.createContext(new Map);c();c();var VC=b(x());c();c();var zC=b(x()),Q6=b(z());var e7={title:"Checkbox",description:"A single checkbox that can be checked or unchecked.",IconComponent:v.ColumnTypeCheckbox,ValueComponent:FF,onKeyDown:(t,o,e)=>{switch(t){case"backspace":o&&e(!1);break;case"enter":e(!o);break}}};function FF(t){let{value:o,readOnly:e,onValueChange:n,style:r}=t;return zC.default.createElement(Q6.View,{style:[r,w.flex1,w.directionRow,w.alignCenter]},zC.default.createElement(Sc,{value:o,onValueChange:n,readOnly:e}))}c();var si=b(x()),xf=b(z());var t7={title:"Link",description:"Reference another page, file, space or collection.",IconComponent:v.PageLink,ValueComponent:VF};function VF(t){let{value:o,selected:e,readOnly:n,displayMode:r,style:i,onValueChange:a}=t,s=si.default.useRef(null),l=le(s),u=lt(),d=Ce(),p=()=>{l.open(Fn(a,u,d,{accept:["page","file","space","collection","anchor","url"]}))};return si.default.createElement(xf.View,{ref:s,style:[w.directionRow,w.wrap,w.flex1,w.alignCenter,i]},si.default.createElement(si.default.Suspense,{fallback:si.default.createElement(Re,null)},o?si.default.createElement(xf.View,{style:[w.flex1,w.directionRow]},si.default.createElement(qF,{contentRef:o})):null,(r==="block"||e)&&!n?si.default.createElement(W,{icon:v.MoreVertical,title:r!=="block"?"Select target":null,kind:"secondary",size:"small",onPress:p},r==="block"?"Select target":null):null))}function qF(t){let{contentRef:o}=t,[e]=JS([o]),[,n]=_(D);return e?si.default.createElement(xf.View,{style:[w.directionRow,w.alignCenter]},e.icon?si.default.createElement(xf.View,{style:[g.Margin.smallRight]},si.default.createElement(e.icon,{size:M.ICON_M,style:[n.textMuted]})):null,si.default.createElement(Fa,{url:e.href,onPress:r=>{r.preventDefault(),e.open()},style:[n.Body]},e.title)):null}c();var yr=b(x()),ha=b(z());var o7={title:"Files",description:"Attachments allow you to add images, documents, or other files which can then be viewed or downloaded.",IconComponent:v.ColumnTypeFile,ValueComponent:GF};function GF(t){let{value:o,selected:e,readOnly:n,displayMode:r,onValueChange:i,style:a}=t,{blocks:{withTables:s}}=yr.default.useContext(de),l=s?async()=>{let d=await s.columnTypes.files.filesManager.prompt({title:"Select file"});i([...o,...d.filter(p=>p.kind==="file").map(p=>p.file)])}:null,u=s?d=>{let p=[...o];p.splice(d,1),i(p)}:null;return yr.default.createElement(ha.View,{style:[w.directionRow,w.wrap,w.flex1,o.length>0?KF.filesList:null,a]},yr.default.createElement(yr.default.Suspense,{fallback:yr.default.createElement(Re,null)},o.map((d,p)=>yr.default.createElement(HF,{key:d,fileId:d,editable:n||!u?void 0:{onRemove:()=>u(p)}}))),(r==="block"||e)&&!n&&l?yr.default.createElement(W,{icon:v.Plus,title:"Add attachment",kind:"secondary",size:"small",onPress:l},r==="block"?"Add file":null):null)}function HF(t){let{fileId:o,editable:e}=t,[,n]=_(D),r=V.useInteractiveState(),i=yr.default.useRef(null),a=le(i),s=Qe({kind:"file",file:o}),l=s.resolution?.extra?.file;return yr.default.createElement(ha.TouchableOpacity,{onPress:()=>{e?a.open(ae({groups:[{key:"file",commands:[{key:"remove",title:"Remove",icon:v.Trashcan,trigger:()=>{e.onRemove()}},l?{key:"download",title:"Download",icon:v.Download,trigger:()=>{Ts(s.href)}}:null].filter(se)}]})):s.href&&Ts(s.href)},...r.events},yr.default.createElement(ha.View,{ref:i,style:[w.directionRow,w.alignCenter,g.Margin.smallRight]},yr.default.createElement(ha.View,{style:[g.Margin.smallRight]},yr.default.createElement(Ld,{file:l,size:M.BUTTON_S})),yr.default.createElement(ha.View,null,yr.default.createElement(ha.Text,{style:[n.Body,r.active||a.opened?n.primary:n.text]},l?.name||"Deleted"))))}var KF=ha.StyleSheet.create({filesList:{gap:g.small}});c();var FC=b(x()),ap=b(z());var n7={title:"Number",description:"",IconComponent:v.Numbers,ValueComponent:XF,onKeyDown:(t,o,e)=>{switch(t){case"backspace":e(null);break;case"enter":typeof o!="number"&&e(0);break}}};function XF(t){let{readOnly:o,value:e,onValueChange:n,onSelectionChange:r,style:i}=t,[,a]=_(D),s=[a.Body,UF.numberInput,a.textMid,i],l=()=>{r(!0)};return o?FC.default.createElement(ap.Text,{style:s},typeof e=="number"?String(e):""):FC.default.createElement(ap.TextInput,{style:s,value:typeof e=="number"?String(e):"",onChangeText:u=>n(Number(u)),onFocus:l})}var UF=ap.StyleSheet.create({numberInput:{height:"auto",padding:0,width:"100%",borderWidth:0}});c();var mu=b(x()),Of=b(z());var YF=8,jF={info:Z.primary.light,merge:Z.violet.light,upgrade:Z.fuchsia.light,danger:Z.scarlet.light},r7={title:"Rating",description:"",IconComponent:v.ColumnTypeRating,ValueComponent:ZF,commands:$F,onKeyDown:(t,o,e)=>{switch(t){case"backspace":e(0);break;case"enter":break}}};function $F(t){let{definition:o,setDefinition:e}=t;return[{key:"rating",commands:[{key:"rating.max_value",title:"Max",icon:v.MaximumValue,descendant:()=>ae({search:"Select max rating\u2026",groups:[{key:"max_values",commands:[...Array(5).keys()].map(n=>({key:`${n+1}`,title:`${n+1}`,type:1,selected:o.max===n+1,trigger:()=>{e({...o,max:n+1})}}))}]})}]}]}function ZF(t){let{value:o,definition:e,definitionColorKind:n,onValueChange:r,readOnly:i,style:a}=t,[s,l]=_(QF),[u,d]=mu.default.useState(0),p=[...Array(e.max+1).keys()].slice(1),f=S=>{r(S===o?null:S)},m=S=>{i||d(S)},h=l.circleBase,y=n?{backgroundColor:jF[n]}:l.circleActiveDefault;return mu.default.createElement(Of.View,{style:[w.directionRow,w.flex1,w.alignCenter,a]},p.map(S=>mu.default.createElement(V.WithInteractiveState,{key:String(S),onHoverIn:()=>m(S),onHoverOut:()=>m(0)},({events:C})=>mu.default.createElement(Of.TouchableOpacity,{...C,onPress:()=>f(S)},mu.default.createElement(JF,{size:YF+2*(S-1),style:[u===0&&o&&o>=S||u>=S?y:h,{marginRight:g.xsmall}]})))))}function JF({size:t,style:o}){return mu.default.createElement(Of.View,{style:[{width:t,height:t,borderRadius:t/2},o]})}var QF=F.create({circleBase:t=>({backgroundColor:t.colors.background.standout}),circleActiveDefault:()=>({backgroundColor:Z.primary.light})});c();var i7=b(DD()),Kn=b(x()),ns=b(z());var a7={title:"Select",description:"Select allows you to select an option from predefined options in a dropdown.",IconComponent:v.ColumnTypeSelect,ValueComponent:oV,commands:eV,onKeyDown:(t,o,e)=>{switch(t){case"backspace":o.length>0&&e([]);break}}};function eV(t){let{definition:o,setDefinition:e}=t;return[{key:"select",commands:[{key:"select.allow_multiple",title:"Allow multiple",icon:v.OptionAdd,type:2,enabled:o.multiple,trigger:()=>{let[n]=e({...o,multiple:!o.multiple});return n}},{key:"select.options",title:"Manage options",icon:v.OptionManage,descendant:()=>s7(t)}]}]}function s7(t){let{definition:o,setDefinition:e,openModal:n}=t,{options:r}=o,i=r.map((a,s)=>{let l=u=>{let d=[...r];d[s]={...a,label:u},e({...o,options:d})};return{key:a.value,title:a.label,descendant:()=>ae({groups:[{key:"select.options.manageOption",commands:[{key:"editOption",title:"Edit option",icon:v.Edit,trigger:()=>{n(u=>Kn.default.createElement(tV,{...u,option:a,onSave:l}))}},{key:"deleteOption",title:"Delete option",icon:v.Trashcan,trigger:()=>{let u=[...r];u.splice(s,1),e({...o,options:u})}}]}]})}});return ae({search:"Search options or type to add",groups:[{key:"select.options.manage",commands:a=>{let s=a.query.text.trim();return a.query.text&&!i.find(l=>l.title===s)?[{key:"add_new_option",title:s,icon:v.Plus,trigger:()=>{let u={value:lg(),label:s,color:"blue"},[,d]=e({...o,options:[...r,u]});return s7(d)}},...i]:i}}]})}function tV(t){let{option:o,definition:e,onSave:n,onClose:r}=t,{options:i}=e,a=[...i].filter(m=>m.label!==o.label),[s,l]=Kn.default.useState(o),u=m=>m.length===0?"The label can not be empty":a.filter(y=>y.label===m).length>0?"Another option already exists with this label":null,d=()=>{n(s.label),r()},p=m=>{l({...s,label:m})},f=u(s.label);return Kn.default.createElement(yo,{title:"Edit option",footer:Kn.default.createElement(ns.View,{style:[w.directionRow,w.justifyContentEnd]},Kn.default.createElement(W,{kind:"secondary",onPress:r,style:g.Margin.smallRight},"Cancel"),Kn.default.createElement(W,{kind:"primary",onPress:d,disabled:!!f},"Save")),onClose:r},Kn.default.createElement(ns.View,null,Kn.default.createElement(oo,{autoFocus:!0,value:s.label,label:"Label",onChangeText:p,feedback:f?{type:"danger",message:f}:void 0})))}function oV(t){let{value:o,selected:e,definition:n,onValueChange:r,definitionColorKind:i,readOnly:a,displayMode:s,style:l}=t,u=Kn.default.useRef(null),d=le(u),[,p]=_(D),f=()=>{d.open(nV(n,o,r))},m=Kn.default.createElement(ns.View,{style:[w.directionRow,w.wrap,w.flex1,o.length>0?rV.optionsList:null]},o.map(h=>{let y=n.options.find(S=>S.value===h);return y?Kn.default.createElement(Q1,{key:y.value,deletable:!a&&n.multiple,kind:i??"info",onPress:()=>n.multiple?r(o.filter(S=>S!==y.value)):null,size:"small"},y.label):null}));return a||s==="inline"&&!e?m:Kn.default.createElement(ns.TouchableOpacity,{ref:u,onPress:f,style:[l]},Kn.default.createElement(ns.View,{style:[w.directionRow,w.flex1,w.alignCenter]},m,s==="inline"?Kn.default.createElement(ns.View,{style:[g.Margin.smallLeft]},Kn.default.createElement(v.ChevronDown,{size:M.ICON_XS,style:p.textMuted})):null))}function nV(t,o,e){return ae({search:"Find an option\u2026",position:{width:"small"},groups:[{key:"options",commands:t.options.map(n=>{let r=o.includes(n.value);return{key:n.value,title:n.label,...t.multiple?{type:1,selected:r}:{selected:void 0},trigger:()=>{e(r?o.filter(i=>i!==n.value):(0,i7.default)(t.multiple?[...o,n.value]:[n.value]))}}})}]})}var rV=ns.StyleSheet.create({optionsList:{gap:g.small}});c();var jv=b(x()),$v=b(z());var c7={title:"Text",description:"",IconComponent:v.ColumnTypeText,ValueComponent:aV,commands:iV};function iV(t){let{definition:o}=t,{textAlignment:e}=o,n={left:v.AlignTextLeft,center:v.AlignTextCenter,right:v.AlignTextRight};return[{key:"text.alignment",commands:[{key:"text.alignment",title:"Alignment",descendant:()=>l7(t),icon:n[e]}]}]}function l7(t){let{definition:o,setDefinition:e}=t;return ae({groups:[{key:"text.alignment.select",commands:[{label:"Left",value:"left",icon:v.AlignTextLeft},{label:"Center",value:"center",icon:v.AlignTextCenter},{label:"Right",value:"right",icon:v.AlignTextRight}].map(n=>({key:`text.alignment.${n.value}`,title:n.label,type:1,selected:o.textAlignment===n.value,icon:n.icon,trigger:()=>{let[,r]=e({...o,textAlignment:n.value});return l7(r)}}))}]})}function aV(t){let{value:o,definition:e,style:n,readOnly:r}=t;return o==null?null:jv.default.createElement($v.View,{style:[w.flex1,!r&&sV.editableFragment,n]},jv.default.createElement(Bc.Provider,{value:e.textAlignment},jv.default.createElement(ur,{fragment:o})))}var sV=$v.StyleSheet.create({editableFragment:{cursor:"text"}});c();var Xn=b(x()),zi=b(z());var u7={title:"Users",description:"A user field lets you add collaborators to your records.",IconComponent:v.Users,ValueComponent:lV,commands:cV};function cV(t){let{definition:o,setDefinition:e}=t;return[{key:"users",commands:[{key:"users.allow_multiple",title:"Allow multiple",icon:v.Team,type:2,enabled:o.multiple,trigger:()=>{let[n]=e({...o,multiple:!o.multiple});return n}}]}]}function lV(t){let{value:o,selected:e,readOnly:n,displayMode:r,definition:i,onValueChange:a,style:s}=t,l=Xn.default.useRef(null),u=le(l),d=m=>{let h=[...o];h.splice(m,1),a(h)},p=()=>{u.open(ae({search:"Search users\u2026",position:{width:"small"},groups:[{key:"users",commands:m=>Tl.read({query:m.query.text,types:["users"]}).map(y=>y.index!=="users"?null:{key:y.object.objectID,title:y.object.displayName,icon:({size:S})=>Xn.default.createElement(Ml,{user:y.object,size:S}),trigger:()=>{a([...o,y.object.objectID])}}).filter(se)}]}))},f=i.multiple?"Add users":"Replace";return Xn.default.createElement(zi.View,{style:[w.flex1,w.directionRow,s]},Xn.default.createElement(zi.View,{style:[w.directionRow,w.wrap,w.flex1,o.length>0?dV.filesList:null]},Xn.default.createElement(Xn.default.Suspense,{fallback:null},o.map((m,h)=>Xn.default.createElement(uV,{key:m,userId:m,readOnly:n,onRemove:()=>d(h)})))),(r==="block"||e)&&!n?Xn.default.createElement(W,{ref:l,icon:i.multiple?v.Plus:v.ChevronDown,title:r==="block"?void 0:f,kind:"secondary",size:"small",onPress:p,active:u.opened},r==="block"?f:null):null)}function uV(t){let{userId:o,readOnly:e,onRemove:n}=t,[,r]=_(D),i=V.useInteractiveState(),a=Xn.default.useRef(null),s=le(a),[l]=xc([Fx(o)]);return Xn.default.createElement(zi.TouchableOpacity,{onPress:()=>{s.open(ae({position:{width:"small"},groups:[{key:"user",commands:[e?null:{key:"remove",title:"Remove",icon:v.Trashcan,trigger:()=>{n()}}].filter(se)}]}))},...i.events},Xn.default.createElement(zi.View,{ref:a,style:[w.directionRow,w.alignCenter,g.Margin.smallRight]},l?Xn.default.createElement(zi.View,{style:[g.Margin.smallRight]},Xn.default.createElement(Ml,{user:l,size:M.BUTTON_S})):null,Xn.default.createElement(zi.View,null,Xn.default.createElement(zi.Text,{style:[r.Body,i.active||s.opened?r.primary:r.text]},l?.displayName||"Deleted"))))}var dV=zi.StyleSheet.create({filesList:{gap:g.small}});var ci={checkbox:e7,number:n7,text:c7,files:o7,select:a7,users:u7,rating:r7,"content-ref":t7},d7=["text","number","checkbox","select","users","files","content-ref","rating"];function rs(t){return t.title||ci[t.type].title}function sp(t){let{record:o,definition:e,readOnly:n,displayMode:r="inline",editor:i,nodeKey:a,selected:s,definitionColorKind:l,style:u}=t,{ValueComponent:d}=ci[t.definition.type],p=h=>{i.change(y=>{ee.setRecordValue(y,a,o.key,e.id,h)})},f=h=>{h&&i.change(y=>{ee.moveTableSelection(y,a,{recordId:o.key,definitionId:e.id})})},m=VC.createElement(d,{editor:i,nodeKey:a,readOnly:n,displayMode:r,selected:s,value:o.value.values[e.id],definitionColorKind:l,definition:e,onValueChange:p,onSelectionChange:f,style:u});return e.type==="text"?m:VC.createElement(ge,{style:w.flex1,onClick:h=>{h.stopPropagation(),f(!0)}},m)}c();function ec(t,o={}){return ae({search:"Select column type",groups:[{key:"types",commands:d7.map(e=>{let n=ci[e];return{key:e,icon:n.IconComponent,title:n.title,...o.selectedType?{type:1,selected:o.selectedType===e}:{selected:void 0},trigger:()=>{t(e)}}})}]})}c();var il=b(x()),fu=b(z());function p7(t){return t.readOnly?il.createElement(pV,{...t}):il.createElement(mV,{...t})}function pV(t){let{definition:o,style:e}=t,[,n]=_(D);return il.createElement(fu.Text,{style:[w.directionRow,o.type==="text"?Zv[o.textAlignment]:null,n.Body,n.textMid,n.Medium,Zv.columnHeader,e],selectable:!0},rs(o))}function mV(t){let{editor:o,nodeKey:e,definition:n,style:r}=t,[i,a]=_(D),s=f=>{o.change(m=>{ee.renameColumn(m,e,n.id,f)})},l=n.title||"",u=rs(n),d=il.useMemo(()=>fu.StyleSheet.flatten([r,a.Body,a.textMid,a.Medium,Zv.columnHeader,n.type==="text"?Zv[n.textAlignment]:null]),[r,n]),p=il.useMemo(()=>th(l||u||"",d),[l,u,d]);return il.createElement(Zr,{component:fu.TextInput,value:l,placeholder:u,placeholderTextColor:i.colors.text.muted,onChangeText:s,style:[d,p===void 0?{}:{width:p,maxWidth:"100%"}]})}var Zv=fu.StyleSheet.create({columnHeader:{wordWrap:"anywhere"},left:{textAlign:"left"},center:{textAlign:"center"},right:{textAlign:"right"}});c();var f7=b(x()),m7=["info","merge","upgrade","danger"];function fV(t,o){let{definitionColorsKindsMap:e}=o.reduce((n,r)=>{let i=t[r];if(i.type==="rating"||i.type==="select"){let a=m7[n.colorIndexToBeClaimed];n.definitionColorsKindsMap[r]=a,n.colorIndexToBeClaimed=(n.colorIndexToBeClaimed+1)%m7.length}return n},{colorIndexToBeClaimed:0,definitionColorsKindsMap:{}});return e}function g7(t,o){return f7.default.useMemo(()=>fV(t,o),[t])}c();var ui=b(x());c();c();c();var qC=b(x());function h7(t){return qC.default.createElement(qC.default.Fragment,null)}c();c();function cp(t,o,e={}){let{selected:n=[],search:r="Select columns\u2026",multiple:i=!1,filterDefinition:a=()=>!0}=e;return ae({search:r,groups:[{key:"columns",commands:Object.entries(t).filter(([s,l])=>a(l)).map(([s,l])=>{let u=ci[l.type],d=n.includes(s);return{key:s,title:rs(l),icon:u.IconComponent,type:1,selected:d,trigger:()=>o(i?d?n.filter(p=>p!==s):[...n,s]:d?[]:[s])}})}]})}c();function Sn(t,o,e,n){let{focus:r="end",definition:i,record:a}=n;if(!e.selection.definitionId)return!1;let s=e.records.findIndex(p=>p.key===e.selection.recordId),l=e.view.columns.indexOf(e.selection.definitionId),u=e.records["relative"in a?s+a.relative:a.absolute],d=e.view.columns["relative"in i?l+i.relative:i.absolute];return!d||!u?!1:(ee.moveTableSelection(t,o,{recordId:u.key,definitionId:d},r),!0)}function gu(t,o,e,n){let r=e.records.findIndex(a=>a.key===e.selection.recordId),i=e.records["relative"in n?r+n.relative:n.absolute];return i?(ee.moveTableSelection(t,o,{recordId:i.key,definitionId:void 0}),!0):!1}var y7=(t,o,e,n)=>{if(!e.selection.definitionId&&e.selection.recordId)return hV(t,o,e,n);if(e.selection.definitionId&&e.selection.recordId)return gV(t,o,e,n)},gV=(t,o,e,n)=>{let r=e.view.cardSize==="medium"?3:2;switch(t){case"move-up":case"move-down":{Sn(n,o,e,{definition:{relative:t==="move-up"?-1:1},record:{relative:0},focus:t==="move-up"?"end":"start"})||Sn(n,o,e,{definition:{absolute:t==="move-up"?e.view.columns.length-1:0},record:{relative:t==="move-up"?-r:r},focus:t==="move-up"?"end":"start"})||(t==="move-up"?Fu(n,o):wt(n,o));break}case"move-left":case"move-right":{Sn(n,o,e,{definition:{absolute:0},record:{relative:t==="move-left"?-1:1},focus:t==="move-left"?"end":"start"});break}case"tab":case"enter":{if(!Sn(n,o,e,{definition:{relative:1},record:{relative:0},focus:"end"})&&!Sn(n,o,e,{definition:{absolute:0},record:{relative:1},focus:"end"})){let i=ee.insertEmptyRecord(n,o.key);ee.moveTableSelection(n,o,{recordId:i,definitionId:e.view.columns[0]},"start")}break}case"backspace":{Sn(n,o,e,{definition:{relative:-1},record:{relative:0},focus:"end"})||ee.moveTableSelection(n,o,{recordId:e.selection.recordId,definitionId:void 0});break}}},hV=(t,o,e,n)=>{let r=e.view.cardSize==="medium"?3:2;switch(t){case"tab":{gu(n,o,e,{relative:1});break}case"shift+tab":{gu(n,o,e,{relative:-1});break}case"move-left":case"move-right":{gu(n,o,e,{relative:t==="move-left"?-1:1})||(t==="move-left"?Fu(n,o):wt(n,o));break}case"move-up":case"move-down":{gu(n,o,e,{relative:t==="move-up"?-r:r})||(t==="move-up"?Fu(n,o):wt(n,o));break}case"backspace":{gu(n,o,e,{relative:-1})||gu(n,o,e,{relative:1}),ee.removeRecord(n,o.key,e.selection.recordId);break}case"enter":{Sn(n,o,e,{definition:{absolute:0},record:{relative:0},focus:"start"});break}}};c();var tc=b(x());c();var Jv=b(x());function v7(t){let{editor:o,nodeKey:e,defaultTextDefinitionId:n}=t,[,r]=_(yV),[,i]=_(D),a=()=>{o.change(s=>{let l=ee.insertEmptyRecord(s,e);ee.moveTableSelection(s,e,{recordId:l,definitionId:n})})};return Jv.createElement(V.TouchableOpacity,{style:[w.flex1,r.cardPlaceholder,w.directionRow,w.alignCenter,w.justifyContentCenter,g.Padding.medium],activeStyle:r.cardPlaceholderActive,onPress:a},Jv.createElement(V.Text.Child,{style:[i.Body,i.textMuted],activeStyle:i.primary},Jv.createElement(v.Plus,{size:M.ICON_M,style:[g.Margin.smallRight]}),"New card"))}var yV=F.create({cardPlaceholder:t=>({borderRadius:t.radiuses.large,borderColor:t.colors.border.mid,borderWidth:1,borderStyle:"dashed"}),cardPlaceholderActive:t=>({borderColor:t.colors.primary.main})});c();var on=b(x()),sl=b(z());c();var Qv=JSON.parse('{"targetCard":"targetCard_YoeqR","controlButtons":"controlButtons_l18tz","grab":"grab_y1-pK","grabbing":"grabbing_fDPig"}');c();var al=b(x()),b7=b(z());function w7(t){let{nodeKey:o,editor:e,record:n,view:r,visible:i,onExpand:a,draggableState:s,filesManager:l}=t,{setNodeRef:u,isDragging:d,listeners:p}=s,f=al.useRef(null),m=Si(f,u),h=le(f),y=lt(),S=Ce(),C=r.coverDefinition?n.value.values[r.coverDefinition]?.length>0:!1,k=r.targetDefinition?!!n.value.values[r.targetDefinition]:!1,O=async()=>{let[E]=await l.prompt({title:"Select file",accept:"images",acceptURL:!1});!E||E.kind!=="file"||e.change(P=>{ee.cards.setCardCoverForRecord(P,o,n.key,E)})},R=()=>Fn(E=>{e.change(P=>{ee.cards.setCardTargetForRecord(P,o,n.key,E)})},y,S,{accept:["page","file","space","collection","anchor","url"]}),I=E=>{E.preventDefault(),E.stopPropagation(),h.open(ae({groups:[{key:"actions",commands:[{key:"actions.target",icon:v.PageLink,...k?{title:"Target link",descendant:()=>ae({groups:[{key:"target",commands:[{key:"target.set",title:"Replace target",icon:v.Replace,trigger:()=>R()},{key:"target.remove",title:"Remove target",icon:v.Trashcan,trigger:()=>{e.change(P=>{ee.cards.removeCardTargetForRecord(P,o,n.key)})}}]}]})}:{title:"Add target link",trigger:()=>R()}},{key:"actions.cover",icon:v.Image,...C?{title:"Cover",descendant:()=>ae({groups:[{key:"cover",commands:[{key:"cover.set",title:"Replace cover",icon:v.Replace,trigger:()=>{O()}},{key:"cover.remove",title:"Remove cover",icon:v.Trashcan,trigger:()=>{e.change(P=>{ee.cards.removeCardCoverForRecord(P,o,n.key)})}}]}]})}:{title:"Add cover",trigger:()=>{O()}}},{key:"actions.delete",title:"Delete",icon:v.Trashcan,trigger:()=>{e.change(P=>{ee.removeRecord(P,o,n.key)})}}]}]}))};return al.createElement(b7.TouchableWithoutFeedback,{onPressIn:E=>{E.preventDefault(),E.stopPropagation()}},al.createElement(j,{style:[N.flex.row,N.flex.alignCenter,Qv.controlButtons,d&&N.opacity.translucent],inlineStyle:h.opened||i?{opacity:1}:void 0},al.createElement(bt,{ref:m,kind:"secondary",size:"small",leadingIcon:v.GrabberVertical.CSS,iconOnly:!0,rounded:!0,label:"Drag card",tooltipTitle:d?void 0:`Click for options. Drag to move.`,onClick:I,preventFocusOnPress:!0,style:{cursor:d?"grabbing":"grab"},...p}),al.createElement(j,{style:[N.gap.smallColumnGap,N.margin.autoLeft]},al.createElement(W,{kind:"secondary",size:"small",rounded:!0,icon:v.Maximize,onPress:a,title:"Open card",tooltipDelay:300}))))}c();var GC=b(x()),eb=b(z());function S7(t){let{coverRef:o}=t,[,e]=_(vV),n=Qe(o),r=n.resolution?.extra?.file,i=n&&r&&fc(r)?na(r.downloadURL,{width:371}):null;return i?GC.createElement(eb.View,{style:e.cardCover},GC.createElement(eb.Image,{source:{uri:i},style:e.cardImage})):null}var vV=F.create({cardCover:t=>({backgroundColor:t.colors.background.muted}),cardImage:{width:"100%",aspectRatio:16/9}});function C7(t){let{nodeKey:o,definition:e,editor:n,readOnly:r,record:i,view:a,selected:s,selectedBy:l,isLastInRow:u,beforeOrderIndex:d,afterOrderIndex:p,onExpand:f}=t,[,m]=_(bV),[,h]=_(D),y=$a(l),[S,C]=on.useState(),k=Yo(S),{blocks:{withTables:O}}=on.useContext(de),R={type:"table-record",id:i.key,blockKey:o,previewLabel:"Move card"},I=gn({disabled:r,...Wn(R)}),E=mr({shouldAccept:on.useCallback(K=>K.type==="table-record"&&i.key!==K.id&&o===K.blockKey,[i.key]),onDrop:K=>{n.change(Y=>{ee.moveRecord(Y,o,K.id,k.current==="before"?{before:d,after:i.value.orderIndex}:{before:i.value.orderIndex,after:p})})},onHoverMove:({xPosition:K})=>{let Y=K==="right"?"after":"before";S!==Y&&C(Y)}}),P=a.targetDefinition?i.value.values[a.targetDefinition]:void 0,L=Qe(P),T=()=>{n.change(K=>{ee.moveTableSelection(K,o,{recordId:i.key}),K.focus()})},H=a.coverDefinition&&i.value.values[a.coverDefinition]?.[0]?i.value.values[a.coverDefinition]?.[0]:null,U=on.createElement(sl.View,{style:[w.flex1,g.Padding.medium,!H&&!r&&g.Margin.mediumVertical,!r&&m.editableArea]},a.columns.map((K,Y)=>{let X=e[K],re=on.createElement(sp,{record:i,selected:!1,definition:X,nodeKey:o,editor:n,readOnly:r});return on.createElement(sl.View,{key:K,style:[Y{K.preventDefault(),L?.open()}}:{component:V.View}},H?on.createElement(S7,{coverRef:{kind:"file",file:H}}):null,r?U:on.createElement(sl.TouchableWithoutFeedback,{onPressIn:K=>{K.preventDefault(),K.stopPropagation()}},U),!O?.cards||r?null:on.createElement(w7,{nodeKey:o,editor:n,record:i,view:a,visible:s,onExpand:f,draggableState:I,filesManager:O.cards.coverImageFilesManager}))))}var bV=F.create({editableArea:{cursor:"text"}});function k7(t){let{nodeKey:o,editor:e,readOnly:n,definition:r,records:i,view:a,selection:s,selections:l,openRecord:u}=t,d=$u(),p=tc.useMemo(()=>a.columns.find(h=>r[h].type==="text")||void 0,[a.columns,r]),f=tc.useMemo(()=>{switch(a.cardSize){case"medium":return{mobile:1,tablet:2,desktop:3};case"large":return{mobile:1,tablet:1,desktop:2};default:Oe(a.cardSize)}},[a.cardSize]),m=tc.useCallback(({item:h,index:y})=>{if(h.key==="new")return tc.createElement(v7,{editor:e,nodeKey:o,defaultTextDefinitionId:p});let S=!s.definitionId&&s.recordId===h.key,C=l.find(k=>k.recordId===h.key&&!k.definitionId);return tc.createElement(C7,{nodeKey:o,editor:e,readOnly:n,definition:r,record:h,view:a,selected:S||!!C,selectedBy:S?void 0:C?.clientId,isLastInRow:f[d]===1||(y+1)%f[d]===0,beforeOrderIndex:y>0?i[y-1].value.orderIndex:void 0,afterOrderIndex:yu(h.key)})},[o,e,n,r,a,s.recordId,!!s.definitionId,p,u,l]);return tc.createElement(B1,{data:n?i:[...i,{key:"new"}],renderItem:m,numColumnsPerScreen:f,columnSpacing:g.medium,rowSpacing:g.medium})}var x7={IconComponent:v.Cards3Columns,title:"Cards",recordName:"card",definitionName:"field",selectableView:!1,ViewComponent:k7,DefinitionSettingsComponent:h7,commands:wV,onKeyDown:y7};function wV(t){let{view:o,setView:e}=t;return[{key:"cards.definitions",commands:[{key:"cards.selectCover",title:"Cover image",icon:v.Image,descendant:()=>SV(t)},{key:"cards.selectTarget",title:"Target link",icon:v.PageLink,descendant:()=>CV(t)}]},{key:"cards.size",commands:[{key:"cards.size.medium",title:"Medium",icon:v.Cards3Columns,type:1,selected:o.cardSize==="medium",trigger:()=>{let[n]=e({...o,cardSize:"medium"});return n}},{key:"cards.size.large",title:"Large",icon:v.Cards2Columns,type:1,selected:o.cardSize==="large",trigger:()=>{let[n]=e({...o,cardSize:"large"});return n}}]},{key:"cards.options",commands:[{key:"cards.hideColumnTitle",title:"Show labels",icon:v.EyeOff,type:2,enabled:!o.hideColumnTitle,trigger:()=>{let[n]=e({...o,hideColumnTitle:!o.hideColumnTitle});return n}},{key:"cards.definitions",title:"Fields",icon:v.EyeOff,descendant:()=>O7(t)}]}]}function SV(t){let{view:o,definition:e,setView:n}=t;return cp(e,r=>{n({...o,coverDefinition:r[0]})},{multiple:!1,search:"Select column for cover\u2026",selected:o.coverDefinition?[o.coverDefinition]:[],filterDefinition:r=>r.type==="files"})}function CV(t){let{view:o,definition:e,setView:n}=t;return cp(e,r=>{n({...o,targetDefinition:r[0]})},{multiple:!1,search:"Select column for target\u2026",selected:o.targetDefinition?[o.targetDefinition]:[],filterDefinition:r=>r.type==="content-ref"})}function O7(t){let{view:o,definition:e,setView:n}=t;return cp(e,r=>{let[,i]=n({...o,columns:r});return O7(i)},{multiple:!0,search:"Select visible columns\u2026",selected:o.columns})}c();c();var _f=b(x());c();var R7=b(ug()),Tt=b(x()),Fi=b(z());var oc=Tt.createContext(new Map),I7=Tt.forwardRef((t,o)=>{let{nodeKey:e,editor:n,view:r,children:i}=t,{readOnly:a}=n,[,s]=_(P7),[l]=Us.useDimensions(),u=Je(),d=u?l.width:l.width-2,{widths:p,totalWidth:f}=Tt.useMemo(()=>nv(r,d,u),[d,r.columns,r.columnWidths]),[m,h]=Tt.useState({left:!1,right:!1});Tt.useEffect(()=>{h(O=>({left:f>d?O.left:!1,right:f>d?O.right:!1}))},[f,d]);let y=Yo(m),S=Tt.useCallback(O=>{let{contentOffset:R,contentSize:I,layoutMeasurement:E}=O.nativeEvent,P=R.x>0,L=R.x{let I=p.get(O);Fe(I),n.change(E=>{E.setDataByKey(e,["view","columnWidths",O],(0,R7.default)(I.width+R,ov,cf),{normalize:!1}),E.setDataByKey(e,["view","useNewSizing"],!0,{normalize:!1})})},[p]),k=(O,R)=>{n.change(I=>{ee.moveColumn(I,e,R.id,O)})};return Tt.createElement(Fi.View,{ref:o},Tt.createElement(oc.Provider,{value:p},Tt.createElement(Fi.ScrollView,{horizontal:!0,style:s.tableScrollWrapper,onScroll:S,scrollEventThrottle:100,contentContainerStyle:s.tableWrapper},i,a?null:[...r.columns].reverse().reduce((O,R,I,E)=>{let P=p.get(R);return Fe(P),Tt.createElement(kV,{key:R,columnId:R,columnAfterId:E[I-1],tableKey:e,controller:P.controller,width:P.animated,onResizeComplete:C,onDropBefore:L=>k(R,L)},O)},null))),!u&&m.left?Tt.createElement(Fi.View,{style:s.tableScrollIndicatorLeft,pointerEvents:"none"}):null,!u&&m.right?Tt.createElement(Fi.View,{style:s.tableScrollIndicatorRight,pointerEvents:"none"}):null)});function kV(t){let{tableKey:o,columnId:e,columnAfterId:n,controller:r,width:i,children:a,onDropBefore:s,onResizeComplete:l}=t,[u,d]=_(P7),p=Tt.useMemo(()=>Fi.PanResponder.create({onStartShouldSetPanResponder:(h,y)=>!1,onStartShouldSetPanResponderCapture:(h,y)=>!1,onMoveShouldSetPanResponder:(h,{dx:y})=>!0,onMoveShouldSetPanResponderCapture:(h,y)=>!1,onPanResponderGrant:(h,{dx:y})=>{},onPanResponderMove:(h,{dx:y})=>{r.setValue(y)},onPanResponderTerminationRequest:(h,y)=>!1,onPanResponderRelease:(h,{dx:y})=>{l(e,y)},onPanResponderTerminate:(h,y)=>{}}),[e,r,l]),f=V.useInteractiveState(p.panHandlers),m=mr({shouldAccept:Tt.useCallback(h=>h.type==="table-definition"&&e!==h.id&&n!==h.id&&o===h.blockKey,[e,n,o]),onDrop:h=>{h.type==="table-definition"&&s(h)}});return Tt.createElement(Fi.Animated.View,{style:[d.columnLine,{left:i}]},Tt.createElement(Fi.View,{ref:m.setNodeRef,style:d.blockGrabber,...f.events},Tt.createElement(Fi.View,{style:[d.blockGrabberBar,(f.hovered||f.dragging||m.isOver)&&{backgroundColor:u.colors.primary.main}]})),a)}var tb=10,_7=3,P7=F.create({tableScrollWrapper:{borderWidth:0},tableScrollIndicatorLeft:t=>({position:"absolute",left:-1,top:0,bottom:0,width:1,shadowColor:Z.BLACK,shadowOffset:{width:5,height:0},shadowOpacity:.6,shadowRadius:7,elevation:4}),tableScrollIndicatorRight:t=>({position:"absolute",right:-1,top:0,bottom:0,width:1,shadowColor:Z.BLACK,shadowOffset:{width:-5,height:0},shadowOpacity:.6,shadowRadius:7,elevation:4}),tableWrapper:{position:"relative",overflow:"hidden",flexDirection:"column"},columnLine:{position:"absolute",top:0,bottom:0},blockGrabber:{position:"absolute",top:0,right:-(tb/2),bottom:0,width:tb,cursor:"ew-resize"},blockGrabberBar:{position:"absolute",top:0,right:tb/2-_7/2,bottom:0,width:_7,borderRadius:M.RADIUS_M},blockGrabberPlus:{position:"absolute",top:g.small,left:-(M.BUTTON_XS/2)+tb/2}});function E7(t){let{view:o,columnId:e,setView:n}=t,r=_f.default.useContext(oc);function i(a){if(a){let{[e]:s,...l}=o.columnWidths||{};n({...o,useNewSizing:!0,columnWidths:l})}else n({...o,useNewSizing:!0,columnWidths:{...o.columnWidths,[e]:r.get(e)?.width||Xc}})}return _f.default.createElement(_f.default.Fragment,null,_f.default.createElement(oh,{value:typeof o.columnWidths?.[e]>"u",onValueChange:i,label:"Fill available space",labelDescription:"Expand this column to fill the available horizontal space"}))}c();var T7=(t,o,e,n)=>{let r=(i=e.selection.definitionId)=>{if(!i)return;let a=e.records.findIndex(d=>d.key===e.selection.recordId),s=e.records[a],l=e.records[a+1],u=ee.insertEmptyRecord(n,o.key,{before:s.value.orderIndex,after:l?.value.orderIndex});ee.moveTableSelection(n,o,{recordId:u,definitionId:i},"start")};switch(t){case"move-up":case"move-down":{Sn(n,o,e,{definition:{relative:0},record:{relative:t==="move-up"?-1:1},focus:t==="move-up"?"end":"start"})||(t==="move-up"?Fu(n,o):wt(n,o));break}case"tab":case"move-right":{let i=t==="tab"?"select":"start";Sn(n,o,e,{definition:{relative:1},record:{relative:0},focus:i})||!Sn(n,o,e,{definition:{absolute:0},record:{relative:1},focus:i})&&t==="tab"&&r(e.view.columns[0]);break}case"shift+tab":case"move-left":{let i=t==="shift+tab"?"select":"end";Sn(n,o,e,{definition:{relative:-1},record:{relative:0},focus:i})||Sn(n,o,e,{definition:{absolute:e.view.columns.length-1},record:{relative:-1},focus:i});break}case"enter":{r();break}case"backspace":{if(Sn(n,o,e,{definition:{relative:-1},record:{relative:0},focus:"end"}))break;e.selection.recordId&&ee.isRowEmpty(o,e.selection.recordId)?(Sn(n,o,e,{definition:{absolute:e.view.columns.length-1},record:{relative:-1},focus:"end"}),ee.removeRecord(n,o.key,e.selection.recordId)):Sn(n,o,e,{definition:{absolute:e.view.columns.length-1},record:{relative:-1},focus:"end"});break}}};c();var Yn=b(x()),ab=b(z());c();var Vi=b(x());c();var ob=g.Padding.mediumLeft;c();var vr=b(x()),nc=b(z());var nb=vr.default.forwardRef(function(o,e){let{recordKey:n,columnId:r,selected:i,selectedBy:a,width:s,children:l,header:u=!1,isFirstColumn:d=!1,isFirstRow:p=!1,isLastColumn:f=!1,isLastRow:m=!1,onPress:h,readOnly:y,...S}=o,C=vr.default.useRef(null),k=Si(C,e),[,O]=_(xV),I={backgroundColor:$a(a).base};vr.default.useEffect(()=>{i&&C.current&&Qg(C.current,{behavior:"smooth",scrollMode:"if-needed"})},[i]);let E=vr.default.createElement(nc.Animated.View,{ref:k,style:[O.cell,w.directionRow,w.alignCenter,d?O.farLeftCell:{},p?O.topCell:{},m?O.bottomCell:{},p&&d?O.topLeftCell:{},p&&f?O.topRightCell:{},m&&d?O.bottomLeftCell:{},m&&f?O.bottomRightCell:{},u?O.columnHeader:{},p?fo.Bold:{},{width:s}]},l,i?vr.default.createElement(vr.default.Fragment,null,vr.default.createElement(nc.View,{style:[O.cellSelectionBorderTop,I]}),vr.default.createElement(nc.View,{style:[O.cellSelectionBorderBottom,I]}),vr.default.createElement(nc.View,{style:[O.cellSelectionBorderRight,I]}),vr.default.createElement(nc.View,{style:[O.cellSelectionBorderLeft,I]})):null);return vr.default.createElement(ge,{style:[O.unsetDefaultTH,w.directionRow,w.justifyContentCenter],tag:u?"th":"td"},y?vr.default.createElement(vr.default.Fragment,null,E):vr.default.createElement(nc.TouchableWithoutFeedback,{...S},E))}),Un=1,xV=F.create({unsetDefaultTH:{textAlign:"left"},cell:t=>({position:"relative",paddingVertical:g.small,paddingHorizontal:g.medium,borderLeftWidth:1,borderTopWidth:1,borderColor:t.colors.border.mid}),cellSelectionBorderTop:{position:"absolute",top:-Math.floor(Un/2),left:-Math.floor(Un/2),right:-Math.floor(Un/2),height:Un},cellSelectionBorderBottom:{position:"absolute",bottom:-Math.floor(Un/2),left:-Math.floor(Un/2),right:-Math.floor(Un/2),height:Un},cellSelectionBorderRight:{position:"absolute",bottom:-Math.floor(Un/2),top:-Math.floor(Un/2),right:-Math.floor(Un/2),width:Un},cellSelectionBorderLeft:{position:"absolute",bottom:-Math.floor(Un/2),top:-Math.floor(Un/2),left:-Math.floor(Un/2),width:Un},topCell:{borderTopWidth:0},farLeftCell:{borderLeftWidth:0},topLeftCell:{},bottomLeftCell:{},topRightCell:{},bottomRightCell:{},bottomCell:{borderBottomWidth:1},columnHeader:t=>({backgroundColor:"transparent"})});var L7=Vi.memo(function(o){let{editor:e,nodeKey:n,readOnly:r,definition:i,view:a}=o,s=Vi.useContext(oc),[,l]=_(RV);return Vi.createElement(ge,{tag:"thead"},Vi.createElement(ge,{style:[w.directionRow,l.background],tag:"tr"},a.columns.map((u,d)=>{let p=i[u],f=s.get(u);return Fe(f),Vi.createElement(_V,{key:u,columnId:u,editor:e,nodeKey:n,columnDef:p,view:a,readOnly:r,width:f.animated,isFirstColumn:d===0,isLastColumn:d===a.columns.length-1,isFirstRow:!0,header:!0})})))}),M7=V.createInteractiveHandle("table-column"),OV=V.createInteractiveComponent(ge);function _V(t){let{columnDef:o,readOnly:e,editor:n,nodeKey:r,view:i,...a}=t;return Vi.createElement(OV,{handle:M7},Vi.createElement(nb,{focusable:!1,readOnly:e,...a},Vi.createElement(p7,{editor:n,nodeKey:r,definition:o,readOnly:e,style:[w.flex1,a.isFirstColumn&&!e?ob:null]}),e?null:Vi.createElement(rb,{editor:n,nodeKey:r,view:i,definition:o,descendantOf:M7,icon:v.GrabberVertical,rounded:!0})))}var RV=F.create({background:t=>({backgroundColor:t.colors.background.mid,borderBottomColor:t.colors.border.mid,borderBottomWidth:2})});c();var Ot=b(x()),Rf=b(z());var N7=V.createInteractiveHandle("table-row"),IV=V.createInteractiveComponent(ge),B7=Ot.memo(Ot.forwardRef(function(o,e){let{nodeKey:n,editor:r,readOnly:i,record:a,definition:s,view:l,isFirstRow:u,isLastRow:d,beforeOrderIndex:p,afterOrderIndex:f,selectedColumnId:m,selections:h,definitionColorKinds:y,openRecord:S,style:C}=o,k=Ot.useContext(oc),O=li[l.type],R={id:a.key,type:"table-record",blockKey:n,previewLabel:"Move record",previewIcon:"TableRecord"},I=gn({...Wn(R),disabled:i}),E=(K,Y)=>{r.change(X=>{ee.moveRecord(X,n,K.id,Y)})},P=Ot.useRef(null),L=le(P),T=()=>{L.open(ae({search:"Select action\u2026",groups:[{key:"table.row",commands:[{key:"table.row.open",title:`Open ${O.recordName}`,icon:v.Maximize,trigger:()=>{S(a.key)}},{key:"table.row.insertAbove",title:"Insert above",icon:v.TableInsertRowAbove,trigger:()=>{r.change(K=>{ee.insertEmptyRecord(K,n,{after:a.value.orderIndex,before:p})})}},{key:"table.row.insertBelow",title:"Insert below",icon:v.TableInsertRow,trigger:()=>{r.change(K=>{ee.insertEmptyRecord(K,n,d?{before:a.value.orderIndex}:{after:a.value.orderIndex,before:f})})}},{key:"table.row.addColumn",icon:v.TableInsertColumn,title:`Add ${O.definitionName}`,trigger:()=>{r.change(K=>{ee.insertColumn(K,n,ee.createColumnFromType("text"))})},descendant:()=>ec(K=>{r.change(Y=>{ee.insertColumn(Y,n,ee.createColumnFromType(K))})})},{key:"table.row.remove",title:`Delete ${O.recordName}`,icon:v.Trashcan,trigger:()=>{r.change(K=>{ee.removeRecord(K,n,a.key)})}}]}]}))},[,H]=_(W7),U=Ot.createElement(IV,{ref:e,handle:N7,style:[w.directionRow,I.isDragging&&je.translucent,C],tag:"tr"},l.columns.map((K,Y)=>{let X=s[K],re=m===K,me=h?.find(ut=>ut.definitionId===K),Be=y[K],Ie=Ot.createElement(sp,{definitionColorKind:Be,record:a,selected:re,definition:X,nodeKey:n,editor:r,readOnly:i});return Ot.createElement(nb,{key:K,recordKey:a.key,columnId:K,width:k.get(K).animated,selected:re||!!me,selectedBy:re?void 0:me?.clientId,isFirstColumn:Y===0,isLastColumn:Y===l.columns.length-1,isFirstRow:u,isLastRow:d,onPressIn:ut=>{ut.type!=="keydown"&&(ut.preventDefault(),r.change(Ro=>{ee.moveTableSelection(Ro,n,{recordId:a.key,definitionId:K})}))},readOnly:i},Y>0||i?Ie:Ot.createElement(Ot.Fragment,null,Ot.createElement(V.View.Child,{descendantOf:N7,ref:I.setNodeRef,style:[w.justifyContentCenter,H.rowGrabber],inactiveStyle:L.opened?{}:je.hidden,activeStyle:je.visible},Ot.createElement(W,{ref:P,size:"xsmall",rounded:!0,kind:"grey",active:L.opened,title:`Click for options. Drag to move.`,icon:v.GrabberVertical,onPress:T,...I.listeners})),Ot.createElement(Rf.View,{style:[w.flex1,w.justifyContentCenter,ob]},Ie)))}));return i?U:Ot.createElement(Rf.View,null,U,Ot.createElement(A7,{currentItem:R,position:"before",onDrop:K=>E(K,{before:p,after:a.value.orderIndex})}),d?Ot.createElement(A7,{currentItem:R,position:"after",onDrop:K=>E(K,{before:a.value.orderIndex,after:f})}):null)}));function A7(t){let{currentItem:o,position:e,onDrop:n}=t,r=V.useInteractiveState(),[,i]=_(W7),{logAnalyticsEvent:a}=Ot.useContext(de),s=mr({shouldAccept:Ot.useCallback(l=>l.type==="table-record"&&o.id!==l.id&&o.blockKey===l.blockKey,[o.id,o.blockKey]),onDrop:l=>{l.type==="table-record"&&(a({type:"edit_page_document_move_block",method:"dnd",blockType:"table-row",toParent:"table",fromParent:"table"}),n(l))}});return Ot.createElement(Rf.View,{ref:s.setNodeRef,style:[i.insertionLineWrapper,e==="after"?i.insertionLineAfter:i.insertionLineBefore],...r.events},Ot.createElement(Rf.View,{style:[i.insertionLineBar,(r.hovered&&r.dragging||s.isOver)&&i.insertionLineBarHovered]}))}var ib=10,D7=3,W7=F.create({insertionLineWrapper:{position:"absolute",left:0,right:0,height:ib},insertionLineBefore:{top:-(ib/2)},insertionLineAfter:{bottom:-(ib/2)},insertionLineBar:{position:"absolute",left:0,right:0,top:ib/2-D7/2,height:D7,borderRadius:M.RADIUS_M},insertionLineBarHovered:t=>({backgroundColor:t.colors.primary.main}),rowGrabber:{position:"absolute",left:g.xsmall,bottom:"auto",zIndex:10}});var PV=20;function z7(t){let{view:o,editor:e,nodeKey:n}=t,[r,i]=Yn.useState(),a=Yn.useCallback(s=>{s!==null&&i(s)},[]);return Yn.createElement(I7,{editor:e,nodeKey:n,view:o,ref:a},Yn.createElement(EV,{...t,parentRef:r}))}function EV(t){let{selection:o,selections:e,records:n,definition:r,view:i,readOnly:a,editor:s,nodeKey:l,parentRef:u,openRecord:d}=t,{mode:p}=Yn.useContext($o),f=s.value.document.getNode(l),m=Yn.useContext(oc),h=j1({enabled:p==="app"&&n.length>PV,parentRef:u?{current:u}:void 0,getEstimatedItemHeight:k=>fC(f,String(k.key),m),list:n.map(k=>({key:k.key}))}),y=g7(r,i.columns),C=!(i.hideHeader||a&&ee.isHeaderEmpty({definition:r,view:i,records:{}}))||!!o.recordId;return Yn.createElement(ge,{tag:"table"},C?Yn.createElement(L7,{definition:r,view:i,editor:s,nodeKey:l,readOnly:a}):null,Yn.createElement(ge,{tag:"tbody"},h.map(([k,O,R],I)=>{let E=n[I],P=I>0?n[I-1]:void 0,L=n[I+1],T=e.filter(H=>H.recordId===E.key);return O?Yn.createElement(B7,{key:E.key,ref:k.nodeRef,selectedColumnId:o.recordId===E.key?o.definitionId:void 0,selections:T.length>0?T:void 0,record:E,definition:r,view:i,readOnly:a,editor:s,nodeKey:l,isFirstRow:!C&&I===0,isLastRow:I===n.length-1,beforeOrderIndex:P?.value.orderIndex,afterOrderIndex:L?.value.orderIndex,definitionColorKinds:y,openRecord:d,...k.nodeProps}):Yn.createElement(ab.View,{key:E.key,style:{height:R},ref:k.nodeRef},Yn.createElement(ab.Text,null,ee.getTableRowPlainText(f,E.value)))})))}var F7={IconComponent:v.Table,title:"Table",recordName:"row",definitionName:"column",selectableView:!0,ViewComponent:z7,DefinitionSettingsComponent:E7,commands:MV,definitionCommands:TV,onKeyDown:T7};function TV(t){let{view:o,definition:e,setView:n}=t,r=typeof o.columnWidths?.[e.id]>"u";return[{key:"grid",commands:[{key:"grid.autoSize",title:"Auto size",icon:v.AutoSize,type:2,enabled:r,trigger:()=>{if(r)n({...o,useNewSizing:!0,columnWidths:{...o.columnWidths,[e.id]:Xc}});else{let{[e.id]:i,...a}=o.columnWidths||{};n({...o,useNewSizing:!0,columnWidths:a})}}}]}]}function MV(t){let{view:o,setView:e}=t;return[{key:"grid",commands:[{key:"grid.toggleHeader",title:"Show header",type:2,enabled:!o.hideHeader,trigger:()=>{let[n]=e({...o,hideHeader:!o.hideHeader});return n}},{key:"grid.resetSizing",title:"Reset column sizing",trigger:()=>{let{columnWidths:n,...r}=o;e({...r,useNewSizing:!0})}},{key:"grid.columns",title:"Hide Columns",icon:v.EyeOff,descendant:()=>V7(t)}]}]}function V7(t){let{view:o,definition:e,setView:n}=t;return cp(e,r=>{let[,i]=n({...o,columns:r});return V7(i)},{multiple:!0,search:"Select visible columns",selected:o.columns})}var li={grid:F7,cards:x7};function rb(t){let{nodeKey:o,editor:e,view:n,definition:r,descendantOf:i,icon:a,rightIcon:s,rounded:l}=t,[,u]=_(LV),d=ui.useRef(null),p=le(d),f=V.useInteractiveState(),m=gn({...Wn({id:r.id,type:"table-definition",blockKey:o,previewLabel:rs(r)})}),[h,y]=ui.useState(null),S=P=>{e.change(L=>{ee.setColumnDefinition(L,o,r.id,P)})},C=()=>{let L=e.value.document.assertBlock(o).data.toFrozenObject(),T=L.definition[r.id];return[O(L.view,T),k(L.view,T)]},k=(P,L)=>({definition:L,view:P,setView:T=>(e.change(H=>{ee.setView(H,o,T)}),C()),setDefinition:T=>(S(T),C()),openModal:T=>{y({type:"command",modal:ui.createElement(T,{definition:L,onClose:()=>y(null)})})}}),O=(P,L)=>{let T=ci[L.type],H=li[P.type],U=k(P,L);return ae({search:"Select action\u2026",groups:[{key:"definition.type",commands:[{key:"definition.type.change",title:T.title,icon:T.IconComponent,descendant:()=>ec(K=>{y({type:"change_type",columnType:K})},{selectedType:L.type})}]},...T.commands?T.commands(U):[],...H.definitionCommands?H.definitionCommands(U):[],{key:"definition.danger",commands:[{key:"definition.add",title:`Add ${H.definitionName}`,icon:v.TableInsertColumn,trigger:()=>{e.change(K=>{let Y=[...P.columns].findIndex(X=>L.id===X);ee.insertColumn(K,o,ee.createColumnFromType("text"),Y+1)})},descendant:()=>ec(K=>{let Y=[...P.columns].findIndex(X=>L.id===X);e.change(X=>{ee.insertColumn(X,o,ee.createColumnFromType(K),Y+1)})})},{key:"definition.hide",title:`Hide ${H.definitionName}`,icon:v.EyeOff,trigger:()=>{e.change(K=>{ee.hideColumn(K,o,L.id)})}},{key:"definition.delete",title:`Delete ${H.definitionName}`,icon:v.Trashcan,trigger:()=>{y({type:"delete"})}}]}]})},R=()=>{p.open(O(n,r))},I=P=>{y(null),P&&e.change(L=>{ee.removeColumn(L,o,r.id)})},E=P=>{y(null),P&&h?.type==="change_type"&&S(ee.changeColumnType(r,h.columnType))};return ui.createElement(ui.Fragment,null,h?.type==="delete"?ui.createElement(cm,{kind:"danger",title:"Delete column",confirmButtonText:"Delete",onComplete:I},"Do you really want to delete this column and all of its data?"):null,h?.type==="change_type"?ui.createElement(cm,{title:"Change column type",confirmButtonText:"Change",onComplete:E},"You are about to change this column type from ",r.type," to"," ",h.columnType,". We will try to convert any value automatically, but you may lose data if we cannot convert them."):null,h?.type==="command"?h.modal:null,ui.createElement(V.View.Child,{...f.events,descendantOf:i,ref:m.setNodeRef,style:[w.justifyContentCenter,u.columnGrabber],inactiveStyle:p.opened||f.focused?{}:je.hidden,activeStyle:je.visible,focusStyle:je.translucent,...m.listeners},ui.createElement(W,{kind:"grey",size:"small",ref:d,title:`Click for options. Drag to move.`,active:p.opened,icon:a,rightIcon:s,rounded:l,onPress:R})))}var LV=F.create({columnGrabber:{position:"absolute",right:g.xsmall,bottom:"auto"}});function sb(t,o,e){let n=o.data.toFrozenObject(),r=li[n.view.type],i=r.commands?r.commands(q7(t,n,o.key,e)):[];return{...nt(t,o.key,[{key:"views",commands:Object.entries(li).map(([a,s])=>({key:a,title:s.title,icon:s.IconComponent,type:1,selected:a===n.view.type,trigger:()=>{t.change(u=>{ee.setView(u,o.key,{type:a})});let l=t.value.document.assertBlock(o.key);return sb(t,l,e)}}))},{key:"table",commands:[{key:"addColumn",icon:v.ArrowRight,title:`Add ${r.definitionName}`,trigger:()=>{t.change(a=>{ee.insertColumn(a,o.key,ee.createColumnFromType("text"))})},descendant:()=>ec(a=>{t.change(s=>{ee.insertColumn(s,o.key,ee.createColumnFromType(a))})})},{key:"insertRow",icon:v.ArrowDown,title:`Insert ${r.recordName}`,trigger:()=>{t.change(a=>{ee.insertEmptyRecord(a,o.key)})}}]},...i,...e]),search:"Select action\u2026"}}function q7(t,o,e,n){return{view:o.view,definition:o.definition,setView:r=>{t.change(a=>{ee.setView(a,e,r)});let i=t.value.document.assertBlock(e);return[sb(t,i,n),q7(t,i.data.toFrozenObject(),e,n)]}}}c();var H7=b(AD()),io=b(x()),rc=b(z());c();var qi=b(x()),KC=b(z());c();var HC=JSON.parse('{"definitionWrapper":"definitionWrapper_0vx5U","grabberWrapper":"grabberWrapper_WLh-V"}');var G7=V.createInteractiveHandle("record-column-value-line");function XC(t){let{nodeKey:o,editor:e,readOnly:n,record:r,view:i,definition:a,style:s}=t,[,l]=_(NV),u=gn({...Wn({id:a.id,type:"table-definition",blockKey:o,previewLabel:rs(a)}),disabled:n}),d=mr({shouldAccept:qi.useCallback(p=>p.type!=="table-definition"?!1:a.id!==p.id&&o===p.blockKey,[a.id,o]),onDrop:p=>{e.change(f=>{ee.moveColumn(f,o,p.id,a.id)})}});return qi.createElement(j,{ref:d.setNodeRef,style:[N.flex.column,N.flex.flex1,HC.definitionWrapper,u.isDragging&&N.opacity.translucent,jg,{[Zu]:d.isOver}]},qi.createElement(V.View,{handle:G7,style:s},qi.createElement(KC.View,{style:[w.directionRow,w.alignCenter,g.Margin.xsmallBottom]},qi.createElement(j,{style:[N.position.relative,N.flex.alignCenter]},qi.createElement(xP,{style:[N.padding.smallRight,HC.grabberWrapper],ref:u.setNodeRef,size:"medium"}),qi.createElement(KC.View,{style:[w.flex1]},qi.createElement(Qu,null,rs(a)))),n?null:qi.createElement(rb,{nodeKey:o,editor:e,view:i,definition:a,descendantOf:G7,icon:ci[a.type].IconComponent,rightIcon:v.ChevronDown})),qi.createElement(sp,{nodeKey:o,editor:e,readOnly:n,record:r,definition:a,selected:!1,displayMode:"block",style:[l.recordValueBox,g.Padding.smallVertical,g.Padding.mediumHorizontal]})))}var NV=F.create({recordValueBox:t=>({borderWidth:1,borderColor:t.colors.border.mid,backgroundColor:t.colors.background.main,borderRadius:t.radiuses.large,minHeight:M.BUTTON_L})});function K7(t){let{nodeKey:o,editor:e,readOnly:n,record:r,records:i,view:a,definition:s,openRecord:l,onClose:u}=t,[,d]=_(D),[,p]=_(AV),[f,m]=io.useState(!1),h=li[a.type],y=a.columns,S=io.useMemo(()=>(0,H7.default)(Object.keys(s),y),[y,a,s]),C=io.useMemo(()=>i.findIndex(R=>R.key===r.key),[i,r.key]),k=i[C-1],O=i[C+1];return io.createElement(yo,{title:`Edit ${h.recordName}`,size:"large",footer:io.createElement(rc.View,{style:[w.directionRow,w.alignCenter,w.justifySpaceBetween]},n?null:io.createElement(W,{icon:v.Trashcan,kind:"secondary",size:"medium",onPress:()=>{e.change(R=>{ee.removeRecord(R,o,r.key)}),u()}},`Delete ${h.recordName}`),io.createElement(rc.View,{style:[w.directionRow,w.alignCenter]},io.createElement(W,{icon:v.ChevronLeft,kind:"secondary",size:"medium",title:`Previous ${h.recordName}`,disabled:!k,onPress:()=>{k&&l(k.key)}}),io.createElement(rc.View,{style:[g.Padding.mediumHorizontal]},io.createElement(rc.Text,{style:[d.Body,d.textMuted]},`${C+1} of ${i.length}`)),io.createElement(W,{icon:v.ChevronRight,kind:"secondary",size:"medium",title:`Next ${h.recordName}`,disabled:!O,onPress:()=>{O&&l(O.key)}}))),onClose:u},io.createElement(rc.View,null,y.map((R,I)=>io.createElement(XC,{key:R,nodeKey:o,editor:e,readOnly:n,view:a,record:r,definition:s[R],style:[g.Margin.mediumBottom,I===0?null:g.Margin.xsmallTop]}))),S.length>0||!n?io.createElement(rc.View,{style:[w.directionRow,w.justifySpaceBetween]},S.length>0?io.createElement(W,{icon:f?v.ChevronUp:v.ChevronDown,kind:"grey",size:"medium",onPress:()=>{m(R=>!R)}},f?"Hide":`Show hidden ${h.definitionName}s`):null,n?null:io.createElement(sh,{icon:v.Plus,kind:"grey",size:"medium",palette:()=>ec(R=>{e.change(I=>{ee.insertColumn(I,o,ee.createColumnFromType(R))})})},"Add ",h.definitionName)):null,f?io.createElement(rc.View,{style:[p.hiddenColumnsGroup,g.Margin.mediumTop,g.Padding.mediumTop]},S.map((R,I)=>io.createElement(XC,{key:R,nodeKey:o,editor:e,readOnly:n,view:a,record:r,definition:s[R],style:[g.Margin.mediumBottom,I===0?null:g.Margin.xsmallTop]}))):null)}var AV=F.create({hiddenColumnsGroup:t=>({borderTopWidth:1,borderTopColor:t.colors.border.mid,borderTopStyle:"dashed"})});c();function X7(t){return ee.defaultRecordSortedKeys(t).map(e=>({key:e,value:t.records[e]}))}function U7(t){let{node:o,editor:e,isFocused:n,selections:r}=t,i=o.data.toFrozenObject(),{blocks:{withTables:a}}=jt.useContext(de),s=e.readOnly||typeof a>"u",l=jt.useMemo(()=>X7(i),[i]),[u,d]=jt.useState(null),p=jt.useMemo(()=>u===null?null:l.find(O=>O.key===u),[l,u]),f=jt.useCallback(O=>{d(O)},[d]),m=jt.useMemo(()=>{let O=[],R=[];return r.forEach(I=>{let E=ee.getTableSelection(e.value.document,I,o);O.push(E),!E.recordId&&!E.definitionId&&R.push(I)}),{states:O,filtered:Pa.create(R)}},[l,o,s,r]),h=jt.useMemo(()=>s?{}:ee.getTableSelection(e.value.document,e.value.selection,o),[l,o,s,e.value.selection]),y={view:i.view,definition:i.definition,records:l,selection:h,selections:m.states},S=jt.useContext(Yv);S.set(o.key,y),jt.useEffect(()=>()=>{S.delete(o.key)},[S,o.key]);let C=li[y.view.type],k=Pi(e,o.key);return jt.createElement(jt.Fragment,null,jt.createElement(Se,{...t,palette:sb(e,o,k?[k]:[])},jt.createElement(Ut,{...t,selectable:C.selectableView,isFocused:n&&!h.definitionId&&!h.recordId,selections:m.filtered,onSelect:()=>{e.change(O=>{ee.moveTableSelection(O,o,{}),O.focus()})}},jt.createElement(Y1,{readOnly:!!p},jt.createElement(C.ViewComponent,{editor:t.editor,nodeKey:o.key,readOnly:s,openRecord:f,...y})))),p?jt.createElement(K7,{editor:t.editor,nodeKey:o.key,readOnly:s,view:y.view,records:y.records,definition:y.definition,record:p,openRecord:f,onClose:()=>{d(null)}}):null)}c();var hu=b(vi()),lb=b(x());var Y7=(0,hu.isKeyHotkey)("enter"),DV=(0,hu.isKeyHotkey)("shift+enter"),j7=(0,hu.isKeyHotkey)("mod+enter"),UC=(0,hu.isKeyHotkey)("tab"),cb=(0,hu.isKeyHotkey)("shift+tab"),$7=(0,hu.isKeyHotkey)("backspace");function Z7(){let t=lb.useContext(Yv);return[lb.useMemo(()=>({onKeyDown:(...e)=>BV(t,...e)}),[t])]}function BV(t,o,e,n){if(o.key!=="ArrowUp"&&o.key!=="ArrowDown"&&o.key!=="ArrowRight"&&o.key!=="ArrowLeft"&&!(Y7(o)&&!DV(o))&&!j7(o)&&!$7(o)&&!UC(o)&&!cb(o))return;let{selection:r}=e.value;if(!qt(r)||!r.isCollapsed&&!UC(o)&&!cb(o))return;let i=ee.getCurrentTable(e.value);if(!i)return;let{table:a,fragment:s}=i;if(i.ancestorBlocks&&i.ancestorBlocks.size>0)return;if(j7(o))return o.preventDefault(),wt(e,a),e;let l=t.get(a.key);if(!l||!l.selection.recordId&&!l.selection.definitionId)return;let u=a.data.toFrozenObject(),d=l.selection.recordId?u.records[l.selection.recordId]:null,p=l.selection.definitionId?u.definition[l.selection.definitionId]:null,f=li[l.view.type],m=p?ci[p.type]:null,h=S=>{if(!m||!m.onKeyDown||!d||!p)return!1;let C=!1;return m.onKeyDown(S,d.values[p.id],k=>{C=!0,ee.setRecordValue(e,a.key,l.selection.recordId,l.selection.definitionId,k)}),C},y=S=>{f.onKeyDown&&f.onKeyDown(S,a,l,e)};if(Y7(o)){if(s&&!r.hasAnchorAtEndOf(s))return;o.preventDefault(),h("enter")||y("enter")}else if($7(o)){if(s&&!r.hasAnchorAtStartOf(s))return;o.preventDefault(),h("backspace")||y("backspace")}else if(UC(o)||cb(o))o.preventDefault(),y(cb(o)?"shift+tab":"tab");else if(o.key==="ArrowDown"){if(s&&!zV(s,r))return;o.preventDefault(),y("move-down")}else if(o.key==="ArrowUp"){if(s&&!WV(s,r))return;o.preventDefault(),y("move-up")}else if(o.key==="ArrowRight"){if(s&&!r.hasAnchorAtEndOf(s))return;o.preventDefault(),y("move-right")}else if(o.key==="ArrowLeft"){if(s&&!r.hasAnchorAtStartOf(s))return;o.preventDefault(),y("move-left")}return e}function WV(t,o){let e=t.nodes.first();return e?o.hasAnchorIn(e):!1}function zV(t,o){let e=t.nodes.last();return e?o.hasAnchorIn(e):!1}c();var ao=b(x()),mb=b(z());c();var J7=b(x()),Q7=b(z());function YC(t){let{children:o}=t,[,e]=_(FV);return J7.default.createElement(Q7.View,{style:[e.blockTabsBody]},o)}var FV=F.create({blockTabsBody:t=>({border:`1px solid ${t.colors.border.main}`,backgroundColor:t.colors.background.main,paddingHorizontal:dC,borderRadius:t.radiuses.medium,borderTopLeftRadius:0,"@media print":{padding:0,border:0}})});c();var ub=b(x()),jC=b(z());function $C(t){let{children:o}=t,[,e]=_(VV);return ub.default.createElement(jC.View,{style:e.blockTabsHeader},ub.default.createElement(Ug,{style:e.blockTabsHeaderContainer},ub.default.createElement(jC.View,{style:e.blockTabsHeaderContent},o)))}var VV=F.create({blockTabsHeader:{position:"relative",display:"flex",flexDirection:"row",width:"100%",alignItems:"center",whiteSpace:"nowrap",marginBottom:-1,"@media print":{display:"none"},zIndex:1},blockTabsHeaderContainer:{maxWidth:"100%",display:"flex"},blockTabsHeaderContent:t=>({maxWidth:"100%",display:"flex",flexDirection:"row",borderTopRightRadius:t.radiuses.medium,borderTopLeftRadius:t.radiuses.medium,pointerEvents:"auto"})});c();var _o=b(x()),vN=b(fN()),ic=b(z());c();var yu=b(x()),db=b(z());var yN=yu.default.forwardRef(function(o,e){let{active:n,editor:r,tab:i,isLast:a,onDropBefore:s,onDropAfter:l,onInsertLeft:u,onInsertRight:d,onDelete:p,children:f,...m}=o;return yu.default.createElement(db.View,{style:[hN.tabItemControls,n&&hN.tabItemControlsActive],...m,ref:e},yu.default.createElement(gN,{position:"before",onDrop:s,onInsert:u}),f,a?yu.default.createElement(gN,{position:"after",onDrop:l,onInsert:d}):null)});function gN(t){let{position:o,onDrop:e,onInsert:n}=t,r=mr({shouldAccept:yu.default.useCallback(i=>i.type==="tab",[]),onDrop:i=>{i.type==="tab"&&e(i.id)}});return yu.default.createElement(am,{ref:r.setNodeRef,dropHovered:r.isOver,position:o==="before"?"left":"right",button:{kind:"default",size:"xsmall",icon:v.Plus,onPress:n}})}var hN=db.StyleSheet.create({tabItemControls:{position:"relative",flexShrink:1},tabItemControlsActive:{flexShrink:0},tabItemInsertionLine:{flex:1,opacity:0,display:"flex",alignItems:"center",justifyContent:"center"},tabItemInsertionLineHovered:{opacity:1}});function tk(t){let{editor:o,tab:e,index:n,active:r,isFirst:i,isLast:a,onSelect:s}=t,{readOnly:l}=o,u=e.data?e.data.get("title"):"Untitled",d=gn({disabled:l,...Wn({type:"tab",id:e.key,previewLabel:"Move tab"})}),p=y=>{o.change(S=>{let C=S.value.document.getParent(e.key);if(!C)return;let k=Qi.createTabsItem("Untitled");S.insertNodeByKey(C.key,n+y,k);let O=S.value.document.getDescendant(k.key);O&&S.collapseToStartOf(O).focus(),s(k)})},f=y=>{o.change(S=>{S.setNodeByKey(e.key,{data:e.data.merge({title:y})})})},m=(y,S)=>{o.change(C=>{S==="before"?C.moveBeforeNodeByKey(y,e.key):C.moveAfterNodeByKey(y,e.key);let k=C.value.document.getDescendant(y);k&&C.collapseToStartOf(k).focus()})},h=()=>{o.change(y=>{y.removeNodeByKey(e.key)})};return l?_o.default.createElement(ic.TouchableWithoutFeedback,{onPress:()=>s(e)},_o.default.createElement(ek,{title:u,active:r,isFirst:i,isLast:a,isEditable:!1,withOptions:!1,editor:o,tab:e})):_o.default.createElement(ic.TouchableWithoutFeedback,{onPress:()=>s(e)},_o.default.createElement(yN,{onInsertLeft:()=>p(0),onInsertRight:()=>p(1),onDropBefore:y=>m(y,"before"),onDropAfter:y=>m(y,"after"),onDelete:h,...t},_o.default.createElement(ek,{title:u,active:r,isFirst:i,isLast:a,isEditable:r,onTitleChange:f,editor:o,tab:e,withOptions:!0,isDragging:d.isDragging,dragHandle:d})))}var ek=_o.default.forwardRef((t,o)=>{let{title:e,titlePlaceholder:n="Untitled",active:r=!1,isFirst:i=!1,isLast:a=!1,isDragging:s=!1,isEditable:l,withOptions:u,onTitleChange:d,editor:p,tab:f,dragHandle:m,...h}=t,[y,S]=_o.default.useState(e),[C,k]=_(JV),O=d?()=>{d(y||"")}:void 0;_o.default.useEffect(()=>{S(e)},[e]);let R=_o.default.useRef(null),I=Si(R,m?.setNodeRef),E=le(R),P=()=>{E.open(ae({position:{width:"small"},groups:[{key:"tab",commands:[{key:"delete",title:"Delete",icon:v.Trashcan,trigger:()=>{p.change(L=>{Qi.removeTab(L,f.key)})}}]}]}))};return _o.default.createElement(V.View,{ref:o,style:[k.blockTabsBodyItem,g.Padding.xsmallVertical,r&&k.blockTabsBodyItemActive,i&&k.blockTabsBodyItemFirst,a&&k.blockTabsBodyItemLast],...h},_o.default.createElement(ic.View,{style:k.flexPadding}),_o.default.createElement(ic.View,{style:[k.blockTabsBodyItemTitleContainer,s&&je.translucent,g.Padding.xsmallVertical]},l?_o.default.createElement(_o.default.Fragment,null,_o.default.createElement(vN.default,{value:y,inputStyle:{...Ue.Label,color:C.colors.text.main,backgroundColor:"transparent",border:"none",...qg.Bold,padding:0,margin:0,lineHeight:"22px"},title:y,placeholder:n,onChange:L=>S(L.target.value),onBlur:O})):_o.default.createElement(ic.Text,{style:[fo.Label,k.blockTabsBodyItemReadonlyTitle,r&&k.blockTabsBodyItemTitleReadonlyActive]},y||n)),u?_o.default.createElement(V.View.Child,{style:[k.tabItemOptions],inactiveStyle:E.opened||l?je.visible:je.hidden,activeStyle:je.visible},_o.default.createElement(W,{ref:I,kind:"grey",size:"small",rounded:!0,active:E.opened,onPress:P,icon:v.GrabberVertical,title:`Click for options. Drag to move.`,...m?.listeners})):null,_o.default.createElement(ic.View,{style:k.flexPadding}))});ek.displayName="TabItem";var JV=F.create({blockTabsBodyItem:t=>({flexGrow:0,flexShrink:1,flexBasis:"auto",textOverflow:"ellipsis",maxWidth:"100%",minWidth:0,borderWidth:1,borderColor:t.colors.border.main,borderLeftColor:"transparent",backgroundColor:t.colors.background.muted,flexDirection:"row",cursor:"pointer"}),blockTabsBodyItemFirst:t=>({borderLeftColor:t.colors.border.main,borderTopLeftRadius:t.radiuses.medium}),blockTabsBodyItemLast:t=>({borderTopRightRadius:t.radiuses.medium}),blockTabsBodyItemActive:t=>({flexGrow:0,flexShrink:0,flexBasis:"auto",cursor:"auto",backgroundColor:t.colors.background.main,borderBottomColor:t.colors.background.main}),flexPadding:{minWidth:8,width:16,flexGrow:1,flexShrink:1,flexBasis:"16px"},blockTabsBodyItemTitleContainer:{flexGrow:0,flexShrink:1,flexBasis:"auto",maxWidth:"100%",minWidth:0,display:"flex",textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",flexDirection:"row"},blockTabsBodyItemReadonlyTitle:t=>({color:t.colors.text.muted,textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap"}),blockTabsBodyItemTitleReadonlyActive:t=>({color:t.colors.text.main}),tabItemOptions:{marginLeft:g.medium,display:"flex",alignItems:"center",justifyContent:"center"}});c();var wN=b(x()),pb=b(z());function ok(t){let{active:o,children:e,...n}=t;return wN.default.createElement(pb.View,{style:[bN.blockTabsItem,o&&bN.blockTabsItemActive],...n},e)}var bN=pb.StyleSheet.create({blockTabsItem:{display:"none",pageBreakInside:"avoid"},blockTabsItemActive:{display:"flex"}});c();var Pf=b(x());var QV=5,SN={activeKeys:{},activeTitles:[]},eq=At({key:"tabsAtom",default:SN,effects:[Pr.recoilEffect("@recoil/tabsAtom",SN)]});function CN(t){let{sections:o,selected:e}=Pf.useContext(Ri),n=Pf.useMemo(()=>{let u=new Map;return t.blockNodes.forEach(d=>{let p=Vu();[...o.entries()].filter(([f])=>d.getNode(f)).forEach(([f,m])=>{p.set(f,m)}),u.set(d.key,p)}),u},[o,t]),[r,i]=or(eq),[a,s]=Uu(!1,[e]),l=wc();return Pf.useMemo(()=>{let{value:u,readOnly:d}=l;return[(d?null:oq(u,t))||tq(r,t,a,n,e)||(d?nq(r,t):null)||t.blockNodes.first(),f=>{let m=f.data.get("title");s(!0),i(h=>({activeKeys:{...h.activeKeys,[t.key]:f.key},activeTitles:m?h.activeTitles.filter(y=>y!==m).concat([m]).slice(-QV):h.activeTitles}))}]},[l,r,i,a,n,e])}function tq(t,o,e,n,r){let i=t.activeKeys[o.key];return e&&i?o.blockNodes.find(a=>a.key===i):o.blockNodes.find(a=>[...n.get(a.key)?.values()||[]].includes(r||""))}function oq(t,o){if(t.selection.isFocused)return o.blockNodes.find(e=>be.isTextRange(t.selection)&&(t.selection.hasAnchorIn(e)||t.selection.hasFocusIn(e)))}function nq(t,o){return o.blockNodes.map(e=>{let n=e.data.get("title");return{node:e,score:t.activeTitles.indexOf(n)}}).filter(({score:e})=>e>=0).sortBy(({score:e})=>-e).map(({node:e})=>e).first()||void 0}function kN(t){let{node:o,children:e,editor:n}=t,[r,i]=CN(o),a=o.getChildIndex(r.key),s=Je(),l=ao.default.useRef(null),u=ao.default.useRef(null),d=ao.default.useCallback(m=>{let h=l.current;h&&h.measureInWindow((y,S)=>{u.current=S}),n.readOnly||n.change(y=>{y.blur()}),i(m)},[n,i]);ao.default.useEffect(()=>{let{current:m}=u;m&&(u.current=null,window.requestAnimationFrame(()=>{let h=l.current;h&&h.measureInWindow((y,S)=>{window.scrollBy(0,S-m)})}))},[r]);let p=o.blockNodes.map((m,h)=>ao.default.createElement(tk,{key:m.key,editor:n,tab:m,index:h,active:h===a,isFirst:h===0,isLast:h===o.nodes.size-1,onSelect:y=>d(y)})),f=ao.default.Children.map(e,(m,h)=>ao.default.createElement(ok,{key:m&&typeof m=="object"&&"key"in m?m.key:h,active:h===a},m));return s?ao.default.createElement(Se,{...t},ao.default.createElement(mb.View,{ref:l},ao.default.Children.map(e,(m,h)=>{let y=o.nodes.toArray()[h];return ao.default.createElement(Se,{key:y.key,...t},ao.default.createElement(mb.View,{ref:l},ao.default.createElement($C,null,ao.default.createElement(tk,{editor:n,key:y.key,tab:y,index:h,active:!0,isFirst:!0,isLast:!1,onSelect:()=>{}})),ao.default.createElement(YC,null,ao.default.createElement(ok,{active:!0},m))))}))):ao.default.createElement(Se,{...t},ao.default.createElement(mb.View,{ref:l},ao.default.createElement($C,null,p),ao.default.createElement(YC,null,f)))}c();var nk=b(x()),xN=b(z());function ON(t){let{attributes:o,children:e}=t;return nk.default.createElement(Se,{...t},nk.default.createElement(xN.View,{...o},e))}c();var Ef=b(vi());var _N={onKeyDown:rq};function rq(t,o){let{value:e}=o;return Po(e.selection)?null:(0,Ef.default)("backspace",t)&&e.isCollapsed?iq(t,o):(0,Ef.default)("enter",t)?aq(t,o):(0,Ef.default)("mod+enter",t)?sq(t,o):(0,Ef.default)("mod+a",t)?cq(t,o):null}function iq(t,o){let{value:e}=o,n=Qi.getCurrentTab(e);return!n||!Yp(n)?null:(t.preventDefault(),Qi.removeTab(o,n.key))}function aq(t,o){let{value:e}=o,n=Qi.getCurrentTab(e);if(!n||n.nodes.size<=1||!Yp(n.blockNodes.last()))return null;let r=e.document.getClosest(e.startKey,u=>"type"in u&&u.type===ir);if(!r)throw new Error("Could not find parent of type BLOCK_TABS while exiting tab when enter is pressed twice");let i=e.document.getParent(r.key);if(!i)throw new Error("Could not find parent of tab while exiting tab when enter is pressed twice");let a=i.getChildIndex(r.key);if(a<0)throw new Error("Could not find child of parent while exiting tab when enter is pressed twice");t.preventDefault();let s=n.blockNodes.last();s&&o.removeNodeByKey(s.key);let l=Gt.create({type:fe,nodes:[dg.create("")]});return o.insertNodeByKey(i.key,a+1,l).collapseToStartOf(l)}function sq(t,o){let{value:e}=o;if(!Qi.getCurrentTab(e))return null;let r=e.document.getClosest(e.startKey,s=>"type"in s&&s.type===ir);if(!r)throw new Error("Could not find parent of type BLOCK_TABS while exiting tab when enter are pressed twice");let i=e.document.getParent(r.key);if(!i)throw new Error("Could not find parent of tab while exiting tab on mod+enter");if(i.getChildIndex(r.key)<0)throw new Error("Could not find child of parent while exiting tab on mod+enter");return t.preventDefault(),wt(o,r),o}function cq(t,o){let{value:e}=o,n=Qi.getCurrentTab(e);return n?(t.preventDefault(),o.collapseToStartOf(n).extendToEndOf(n)):null}var RN={renderNode:lq,renderVirtualNode:uq,renderMark:dq,estimateNodeSize:(t,o)=>{let e=Ei(t,o);return{height:iu(t,o,{blockSpacing:e})}}};function lq(t){if(Gt.isBlock(t.node)&&!Gp.isInline(t.parent)){let o=t;switch(t.node.type){case fe:return Xe.createElement(uL,{...o,node:t.node,parent:t.parent});case uo:case Ht:case po:return Xe.createElement(Z0,{...o,node:t.node,parent:t.parent});case Xo:return Xe.createElement(J0,{...o,node:t.node,parent:t.parent});case Ve:case Ge:case tt:return Xe.createElement(XL,{...o,node:t.node,parent:t.parent});case _r:return Xe.createElement(U7,{...o,node:t.node,parent:t.parent});case rr:return Xe.createElement(h0,{...o,node:t.node,parent:t.parent});case Ea:return Xe.createElement(b0,{...o,node:t.node,parent:t.parent});case dn:return Xe.createElement(jL,{...o,node:t.node,parent:t.parent});case Zi:return Xe.createElement(B6,{...o,node:t.node,parent:t.parent});case bs:return Xe.createElement(GL,{...o,node:t.node,parent:t.parent});case _n:return Xe.createElement(O0,{...o,node:t.node,parent:t.parent});case Eo:return Xe.createElement(pM,{...o,node:t.node,parent:t.parent});case lo:return Xe.createElement(hL,{...o,node:t.node,parent:t.parent});case Kt:return Xe.createElement(fL,{...o,node:t.node,parent:t.parent});case ir:return Xe.createElement(kN,{...o,node:t.node,parent:t.parent});case Or:return Xe.createElement(ON,{...o,node:t.node,parent:t.parent});case Cl:return Xe.createElement($6,{...o,node:t.node,parent:t.parent});case zu:return Xe.createElement(RL,{...o,node:t.node,parent:t.parent});case Cs:return Xe.createElement(OL,{...o,node:t.node,parent:t.parent});case Ur:return Xe.createElement(N0,{...o,node:t.node,parent:t.parent});case vs:return Xe.createElement(qL,{...o,node:t.node,parent:t.parent});case Yr:return Xe.createElement(R0,{...o,node:t.node,parent:t.parent});case ws:return Xe.createElement(ML,{...o,node:t.node,parent:t.parent})}}if(Gp.isInline(t.node)&&!pc.isDocument(t.parent))switch(t.node.type){case Rn:return Xe.createElement(X0,{...t,node:t.node,parent:t.parent});case mc:return Xe.createElement(W6,{...t,node:t.node,parent:t.parent});case pg:return Xe.createElement(Z6,{...t,node:t.node,parent:t.parent});case mg:return Xe.createElement(uE,{...t,node:t.node,parent:t.parent})}return null}function uq(t){switch(t.node.type){case Ve:case Ge:case tt:return Xe.createElement(UL,{...t,key:t.node.key})}}function dq(t){switch(t.mark.type){case ar:return Xe.createElement(F6,{...t});case sr:return Xe.createElement(q6,{...t});case jr:return Xe.createElement(H6,{...t});case mo:return Xe.createElement(X6,{...t});case Kp:return Xe.createElement(Y6,{...t});case fg:case hg:case gg:return Xe.createElement(EL,{...t})}return null}var P6=rt.forwardRef(function(o,e){let{value:n,baseValue:r,selections:i=Pa.create(),onChange:a,placeholder:s,logAnalyticsEvent:l,readOnly:u=!1,style:d,sectionIDs:p,selectedSection:f,isDiff:m,blockLayoutComponent:h,rightGutterComponent:y,integrationBlocksContext:S,integrationBlocksRemote:C,integrationsBlocksSubscription:k,onBlockHover:O,suggestIntegrations:R,blocks:I,onContentPaste:E,plugins:P}=o,{mode:L}=rt.useContext($o),T=rt.useRef(null),H=Si(T,e),U=rt.useMemo(()=>i.filter(qt).filter(sn=>sn.isSet),[i]),K=rt.useMemo(()=>({...AS,...h?{blockLayoutComponent:h}:{},...y?{rightGutterComponent:y}:{},...R?{suggestIntegrations:R}:{},onBlockHover:O,integrationBlocksContext:S,integrationsBlocksSubscription:k,blocks:I,onContentPaste:E}),[O,S,k,I,R,E]);l&&(K.logAnalyticsEvent=l),K.integrationBlocksRemote=C;let[,Y]=_(D),X=u0(K),[re]=Z7(),me=j0(K),Be=K1(n.document,rr),Ie=rt.useMemo(()=>[RN,re,d0,w0,vL,_N,dL,Q0,me,...rL,lL,L0,F0,I0,P0,A0,dE,Be,xL,X,m0,KM,p0,...P??[]],[X,me,Be,P]),ut=Je(),Ro=xs(n.document);rt.useEffect(()=>{if(T.current?.value.isFocused)return vh(T.current?.value.selection.isCollapsed?"editor-selection-collapsed":"editor-selection-expanded")},[T.current?.value.isFocused,T.current?.value.selection.isCollapsed]);let Fr=rt.useRef(null),an=T.current?.value?.selection?Po(T.current?.value?.selection):!1;rt.useEffect(()=>{let sn=an?"block":"text";Fr.current&&sn!==Fr.current&&l?.({type:"edit_switch_selection_mode",selectionMode:sn}),Fr.current=an?"block":"text"},[an]);let[Qn,Vr]=rt.useState(null),qr=rt.useMemo(()=>({sections:p||Vu(),active:Qn,selected:f,setActive:Vr}),[p,Qn]),Io=r===null?null:r===void 0?void 0:r.document;return rt.createElement(UM,{original:Io,modified:n.document},rt.createElement(Ri.Provider,{value:qr},rt.createElement(de.Provider,{value:K},rt.createElement(Us.View,{style:[lp.editor,d],isPDF:ut},u?null:rt.createElement(ya.TouchableWithoutFeedback,{onPress:()=>{T.current?.change(sn=>ww(sn,"DOCUMENT_START"))}},rt.createElement(ya.View,{style:[lp.editorFocusArea,lp.editorFocusAreaTop]})),Ro&&s&&!n.isFocused&&!u?rt.createElement(K.blockLayoutComponent,{renderMode:"centered"},rt.createElement(ya.View,{style:[lp.placeholder]},rt.createElement(ya.Text,{style:[Y.Body,Y.textMuted]},s))):null,rt.createElement($1,{ref:H,testID:"page.contentEditor",value:n,onChange:a,readOnly:u,selections:U,plugins:Ie,virtualize:L==="app",enableBlockContainment:u&&!m},!u&&qt(n.selection)?rt.createElement(xM,{value:n,selection:n.selection}):null),u?null:rt.createElement(ya.TouchableWithoutFeedback,{onPress:()=>{T.current?.change(sn=>ww(sn,"DOCUMENT_END"))}},rt.createElement(ya.View,{style:[lp.editorFocusArea,lp.editorFocusAreaBottom]}))))))}),lp=ya.StyleSheet.create({editor:{position:"relative"},editorFocusArea:{position:"absolute",cursor:"text",right:0,left:0},editorFocusAreaTop:{height:g.large,top:-g.large},editorFocusAreaBottom:{height:g.large,bottom:-g.large},placeholder:{position:"absolute",top:g.small}});c();var br=b(x());c();c();var Ff=b(x());c();var is=b(x());c();var jn=b(x());c();var vu="right-scroll-bar-position",bu="width-before-scroll-bar",rk="with-scroll-bars-hidden",ik="--removed-body-scroll-bar-size";c();c();function IN(t,o){return typeof t=="function"?t(o):t&&(t.current=o),t}c();var PN=b(x());function EN(t,o){var e=(0,PN.useState)(function(){return{value:t,callback:o,facade:{get current(){return e.value},set current(n){var r=e.value;r!==n&&(e.value=n,e.callback(n,r))}}}})[0];return e.callback=o,e.facade}c();function Tf(t,o){return EN(o||null,function(e){return t.forEach(function(n){return IN(n,e)})})}c();c();c();function TN(t){return t}function MN(t,o){o===void 0&&(o=TN);var e=[],n=!1,r={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return e.length?e[e.length-1]:t},useMedium:function(i){var a=o(i,n);return e.push(a),function(){e=e.filter(function(s){return s!==a})}},assignSyncMedium:function(i){for(n=!0;e.length;){var a=e;e=[],a.forEach(i)}e={push:function(s){return i(s)},filter:function(){return e}}},assignMedium:function(i){n=!0;var a=[];if(e.length){var s=e;e=[],s.forEach(i),a=e}var l=function(){var d=a;a=[],d.forEach(i)},u=function(){return Promise.resolve().then(l)};u(),e={push:function(d){a.push(d),u()},filter:function(d){return a=a.filter(d),e}}}};return r}function Mf(t,o){return o===void 0&&(o=TN),MN(t,o)}function wu(t){t===void 0&&(t={});var o=MN(null);return o.options=un({async:!0,ssr:!1},t),o}c();var LN=b(x()),NN=function(t){var o=t.sideCar,e=Sl(t,["sideCar"]);if(!o)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=o.read();if(!n)throw new Error("Sidecar medium not found");return LN.createElement(n,un({},e))};NN.isSideCarExport=!0;function Su(t,o){return t.useMedium(o),NN}var fb=wu();var ak=function(){},gb=jn.forwardRef(function(t,o){var e=jn.useRef(null),n=jn.useState({onScrollCapture:ak,onWheelCapture:ak,onTouchMoveCapture:ak}),r=n[0],i=n[1],a=t.forwardProps,s=t.children,l=t.className,u=t.removeScrollBar,d=t.enabled,p=t.shards,f=t.sideCar,m=t.noIsolation,h=t.inert,y=t.allowPinchZoom,S=t.as,C=S===void 0?"div":S,k=Sl(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),O=f,R=Tf([e,o]),I=un(un({},k),r);return jn.createElement(jn.Fragment,null,d&&jn.createElement(O,{sideCar:fb,removeScrollBar:u,shards:p,noIsolation:m,inert:h,setCallbacks:i,allowPinchZoom:!!y,lockRef:e}),a?jn.cloneElement(jn.Children.only(s),un(un({},I),{ref:R})):jn.createElement(C,un({},I,{className:l,ref:R}),s))});gb.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};gb.classNames={fullWidth:bu,zeroRight:vu};c();c();var Mt=b(x());c();var Lf="data-focus-lock",hb="data-focus-lock-disabled",AN="data-no-focus-lock",DN="data-autofocus-inside",BN="data-no-autofocus";var FN=b(x());c();var up=b(x());var dp={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"},WN=function(o){var e=o.children;return up.createElement(up.Fragment,null,up.createElement("div",{key:"guard-first","data-focus-guard":!0,"data-focus-auto-guard":!0,style:dp}),e,e&&up.createElement("div",{key:"guard-last","data-focus-guard":!0,"data-focus-auto-guard":!0,style:dp}))};WN.propTypes={};WN.defaultProps={children:null};c();var yb=Mf({},function(t){var o=t.target,e=t.currentTarget;return{target:o,currentTarget:e}}),vb=Mf(),zN=Mf(),bb=wu({async:!0});var mq=[],sk=Mt.forwardRef(function(o,e){var n,r=Mt.useState(),i=r[0],a=r[1],s=Mt.useRef(),l=Mt.useRef(!1),u=Mt.useRef(null),d=o.children,p=o.disabled,f=o.noFocusGuards,m=o.persistentFocus,h=o.crossFrame,y=o.autoFocus,S=o.allowTextSelection,C=o.group,k=o.className,O=o.whiteList,R=o.hasPositiveIndices,I=o.shards,E=I===void 0?mq:I,P=o.as,L=P===void 0?"div":P,T=o.lockProps,H=T===void 0?{}:T,U=o.sideCar,K=o.returnFocus,Y=o.focusOptions,X=o.onActivation,re=o.onDeactivation,me=Mt.useState({}),Be=me[0],Ie=Mt.useCallback(function(){u.current=u.current||document&&document.activeElement,s.current&&X&&X(s.current),l.current=!0},[X]),ut=Mt.useCallback(function(){l.current=!1,re&&re(s.current)},[re]);(0,FN.useEffect)(function(){p||(u.current=null)},[]);var Ro=Mt.useCallback(function(cn){var fi=u.current;if(fi&&fi.focus){var q=typeof K=="function"?K(fi):K;if(q){var oe=typeof q=="object"?q:void 0;u.current=null,cn?Promise.resolve().then(function(){return fi.focus(oe)}):fi.focus(oe)}}},[K]),Fr=Mt.useCallback(function(cn){l.current&&yb.useMedium(cn)},[]),an=vb.useMedium,Qn=Mt.useCallback(function(cn){s.current!==cn&&(s.current=cn,a(cn))},[]),Vr=Ks((n={},n[hb]=p&&"disabled",n[Lf]=C,n),H),qr=f!==!0,Io=qr&&f!=="tail",sn=Tf([e,Qn]);return Mt.createElement(Mt.Fragment,null,qr&&[Mt.createElement("div",{key:"guard-first","data-focus-guard":!0,tabIndex:p?-1:0,style:dp}),R?Mt.createElement("div",{key:"guard-nearest","data-focus-guard":!0,tabIndex:p?-1:1,style:dp}):null],!p&&Mt.createElement(U,{id:Be,sideCar:bb,observed:i,disabled:p,persistentFocus:m,crossFrame:h,autoFocus:y,whiteList:O,shards:E,onActivation:Ie,onDeactivation:ut,returnFocus:Ro,focusOptions:Y}),Mt.createElement(L,Ks({ref:sn},Vr,{className:k,onBlur:an,onFocus:Fr}),d),Io&&Mt.createElement("div",{"data-focus-guard":!0,tabIndex:p?-1:0,style:dp}))});sk.propTypes={};sk.defaultProps={children:void 0,disabled:!1,returnFocus:!1,focusOptions:void 0,noFocusGuards:!1,autoFocus:!0,persistentFocus:!1,crossFrame:!0,hasPositiveIndices:void 0,allowTextSelection:void 0,group:void 0,className:void 0,whiteList:void 0,shards:void 0,as:"div",lockProps:{},onActivation:void 0,onDeactivation:void 0};var VN=sk;c();function ck(t){var o=window,e=o.setImmediate;typeof e<"u"?e(t):setTimeout(t,1)}var qN=VN;c();var wb=wu(),Sb="data-focus-on-hidden";var GN=is.forwardRef(function(t,o){var e=is.useState(!1),n=e[0],r=e[1],i=t.children,a=t.autoFocus,s=t.shards,l=t.enabled,u=l===void 0?!0:l,d=t.scrollLock,p=d===void 0?!0:d,f=t.focusLock,m=f===void 0?!0:f,h=t.returnFocus,y=h===void 0?!0:h,S=t.inert,C=t.allowPinchZoom,k=t.sideCar,O=t.className,R=t.shouldIgnore,I=t.style,E=t.as,P=Sl(t,["children","autoFocus","shards","enabled","scrollLock","focusLock","returnFocus","inert","allowPinchZoom","sideCar","className","shouldIgnore","style","as"]),L=k,T=n.onActivation,H=n.onDeactivation,U=Sl(n,["onActivation","onDeactivation"]),K=un(un({},U),{sideCar:k,shards:s,allowPinchZoom:C,as:E,inert:S,style:I,enabled:u&&p});return is.createElement(is.Fragment,null,is.createElement(qN,{ref:o,sideCar:k,disabled:!(n&&u&&m),returnFocus:y,autoFocus:a,shards:s,onActivation:T,onDeactivation:H,className:O,whiteList:R,lockProps:K,as:gb},i),u&&is.createElement(L,un({},P,{sideCar:wb,setLockProps:r,shards:s})))});c();c();c();var l2=b(x());c();c();c();function Nf(t,o){return Nf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Nf(t,o)}function lk(t,o){t.prototype=Object.create(o.prototype),t.prototype.constructor=t,Nf(t,o)}var Cb=b(x());function fq(t,o){function e(n){return n.displayName||n.name||"Component"}return function(r){var i=[],a;function s(){a=t(i.map(function(u){return u.props})),o(a)}var l=function(u){lk(d,u);function d(){return u.apply(this,arguments)||this}d.peek=function(){return a};var p=d.prototype;return p.componentDidMount=function(){i.push(this),s()},p.componentDidUpdate=function(){s()},p.componentWillUnmount=function(){var m=i.indexOf(this);i.splice(m,1),s()},p.render=function(){return Cb.default.createElement(r,this.props)},d}(Cb.PureComponent);return g1(l,"displayName","SideEffect("+e(r)+")"),l}}var HN=fq;c();c();c();c();var $n=function(t){for(var o=Array(t.length),e=0;e=0}).sort(wq)};c();c();var $N=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"];var gk=$N.join(","),Sq="".concat(gk,", [data-focus-guard]"),ZN=function(t,o){var e;return $n(((e=t.shadowRoot)===null||e===void 0?void 0:e.children)||t.children).reduce(function(n,r){return n.concat(r.matches(o?Sq:gk)?[r]:[],ZN(r))},[])},kb=function(t,o){return t.reduce(function(e,n){return e.concat(ZN(n,o),n.parentNode?$n(n.parentNode.querySelectorAll(gk)).filter(function(r){return r===n}):[])},[])},JN=function(t){var o=t.querySelectorAll("[".concat(DN,"]"));return $n(o).map(function(e){return kb([e])}).reduce(function(e,n){return e.concat(n)},[])};var hk=function(t,o){return $n(t).filter(function(e){return uk(o,e)}).filter(function(e){return YN(e)})},yk=function(t,o){return o===void 0&&(o=new Map),$n(t).filter(function(e){return dk(o,e)})},Bf=function(t,o,e){return fk(hk(kb(t,e),o),!0,e)},vk=function(t,o){return fk(hk(kb(t),o),!1)},QN=function(t,o){return hk(JN(t),o)},cl=function(t,o){return t.shadowRoot?cl(t.shadowRoot,o):Object.getPrototypeOf(t).contains!==void 0&&Object.getPrototypeOf(t).contains.call(t,o)?!0:$n(t.children).some(function(e){return cl(e,o)})};c();var Cq=function(t){for(var o=new Set,e=t.length,n=0;n0&&o.add(r),(i&Node.DOCUMENT_POSITION_CONTAINS)>0&&o.add(n)}return t.filter(function(a,s){return!o.has(s)})},e2=function(t){return t.parentNode?e2(t.parentNode):t},mp=function(t){var o=Af(t);return o.filter(Boolean).reduce(function(e,n){var r=n.getAttribute(Lf);return e.push.apply(e,r?Cq($n(e2(n).querySelectorAll("[".concat(Lf,'="').concat(r,'"]:not([').concat(hb,'="disabled"])')))):[n]),e},[])};c();var t2=function(t){return t.activeElement?t.activeElement.shadowRoot?t2(t.activeElement.shadowRoot):t.activeElement:void 0},fp=function(){return document.activeElement?document.activeElement.shadowRoot?t2(document.activeElement.shadowRoot):document.activeElement:void 0};var kq=function(t){return t===document.activeElement},xq=function(t){return!!$n(t.querySelectorAll("iframe")).some(function(o){return kq(o)})},xb=function(t){var o=document&&fp();return!o||o.dataset&&o.dataset.focusGuard?!1:mp(t).some(function(e){return cl(e,o)||xq(e)})};c();var bk=function(){var t=document&&fp();return t?$n(document.querySelectorAll("[".concat(AN,"]"))).some(function(o){return cl(o,t)}):!1};c();c();c();var Oq=function(t,o){return o.filter(mk).filter(function(e){return e.name===t.name}).filter(function(e){return e.checked})[0]||t},Ob=function(t,o){return mk(t)&&t.name?Oq(t,o):t},o2=function(t){var o=new Set;return t.forEach(function(e){return o.add(Ob(e,t))}),t.filter(function(e){return o.has(e)})};c();var wk=function(t){return t[0]&&t.length>1?Ob(t[0],t):t[0]},Sk=function(t,o){return t.length>1?t.indexOf(Ob(t[o],t)):o};var Ck="NEW_FOCUS",n2=function(t,o,e,n){var r=t.length,i=t[0],a=t[r-1],s=Df(e);if(!(e&&t.indexOf(e)>=0)){var l=e!==void 0?o.indexOf(e):-1,u=n?o.indexOf(n):l,d=n?t.indexOf(n):-1,p=l-u,f=o.indexOf(i),m=o.indexOf(a),h=o2(o),y=e!==void 0?h.indexOf(e):-1,S=y-(n?h.indexOf(n):l),C=Sk(t,0),k=Sk(t,r-1);if(l===-1||d===-1)return Ck;if(!p&&d>=0)return d;if(l<=f&&s&&Math.abs(p)>1)return k;if(l>=m&&s&&Math.abs(p)>1)return C;if(p&&Math.abs(S)>1)return d;if(l<=f)return k;if(l>m)return C;if(p)return Math.abs(p)>1?d:(r+d+p)%r}};c();var _q=function(t){return function(o){var e,n=(e=pk(o))===null||e===void 0?void 0:e.autofocus;return o.autofocus||n!==void 0&&n!=="false"||t.indexOf(o)>=0}},r2=function(t,o,e){var n=t.map(function(i){var a=i.node;return a}),r=yk(n.filter(_q(e)));return r&&r.length?wk(r):wk(yk(o))};c();var xk=function(t,o){return o===void 0&&(o=[]),o.push(t),t.parentNode&&xk(t.parentNode.host||t.parentNode,o),o},kk=function(t,o){for(var e=xk(t),n=xk(o),r=0;r=0)return i}return!1},_b=function(t,o,e){var n=Af(t),r=Af(o),i=n[0],a=!1;return r.filter(Boolean).forEach(function(s){a=kk(a||s,s)||a,e.filter(Boolean).forEach(function(l){var u=kk(i,l);u&&(!a||cl(u,a)?a=u:a=kk(u,a))})}),a},i2=function(t,o){return t.reduce(function(e,n){return e.concat(QN(n,o))},[])};var Rq=function(t,o){var e=new Map;return o.forEach(function(n){return e.set(n.node,n)}),t.map(function(n){return e.get(n)}).filter(jN)},a2=function(t,o){var e=document&&fp(),n=mp(t).filter(pp),r=_b(e||t,t,n),i=new Map,a=vk(n,i),s=Bf(n,i).filter(function(f){var m=f.node;return pp(m)});if(!(!s[0]&&(s=a,!s[0]))){var l=vk([r],i).map(function(f){var m=f.node;return m}),u=Rq(l,s),d=u.map(function(f){var m=f.node;return m}),p=n2(d,l,e,o);return p===Ck?{node:r2(a,d,i2(n,i))}:p===void 0?p:u[p]}};c();var Ok=function(t){var o=mp(t).filter(pp),e=_b(t,t,o),n=new Map,r=Bf([e],n,!0),i=Bf(o,n).filter(function(a){var s=a.node;return pp(s)}).map(function(a){var s=a.node;return s});return r.map(function(a){var s=a.node,l=a.index;return{node:s,index:l,lockItem:i.indexOf(s)>=0,guard:Df(s)}})};c();var Iq=function(t,o){"focus"in t&&t.focus(o),"contentWindow"in t&&t.contentWindow&&t.contentWindow.focus()},_k=0,Rk=!1,s2=function(t,o,e){e===void 0&&(e={});var n=a2(t,o);if(!Rk&&n){if(_k>2){console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),Rk=!0,setTimeout(function(){Rk=!1},1);return}_k++,Iq(n.node,e.focusOptions),_k--}};var Ik=s2;var Pq=function(){return document&&document.activeElement===document.body},Eq=function(){return Pq()||bk()},hp=null,gp=null,yp=null,Wf=!1,Tq=function(){return!0},Mq=function(o){return(hp.whiteList||Tq)(o)},Lq=function(o,e){yp={observerNode:o,portaledElement:e}},Nq=function(o){return yp&&yp.portaledElement===o};function c2(t,o,e,n){var r=null,i=t;do{var a=n[i];if(a.guard)a.node.dataset.focusAutoGuard&&(r=a);else if(a.lockItem){if(i!==t)return;r=null}else break}while((i+=e)!==o);r&&(r.node.tabIndex=0)}var Aq=function(o){return o&&"current"in o?o.current:o},Dq=function(o){return o?!!Wf:Wf==="meanwhile"},Bq=function t(o,e,n){return e&&(e.host===o&&(!e.activeElement||n.contains(e.activeElement))||e.parentNode&&t(o,e.parentNode,n))},Wq=function(o,e){return e.some(function(n){return Bq(o,n,n)})},Rb=function(){var o=!1;if(hp){var e=hp,n=e.observed,r=e.persistentFocus,i=e.autoFocus,a=e.shards,s=e.crossFrame,l=e.focusOptions,u=n||yp&&yp.portaledElement,d=document&&document.activeElement;if(u){var p=[u].concat(a.map(Aq).filter(Boolean));if((!d||Mq(d))&&(r||Dq(s)||!Eq()||!gp&&i)&&(u&&!(xb(p)||d&&Wq(d,p)||Nq(d,u))&&(document&&!gp&&d&&!i?(d.blur&&d.blur(),document.body.focus()):(o=Ik(p,gp,{focusOptions:l}),yp={})),Wf=!1,gp=document&&document.activeElement),document){var f=document&&document.activeElement,m=Ok(p),h=m.map(function(y){var S=y.node;return S}).indexOf(f);h>-1&&(m.filter(function(y){var S=y.guard,C=y.node;return S&&C.dataset.focusAutoGuard}).forEach(function(y){var S=y.node;return S.removeAttribute("tabIndex")}),c2(h,m.length,1,m),c2(h,-1,-1,m))}}}return o},u2=function(o){Rb()&&o&&(o.stopPropagation(),o.preventDefault())},Ib=function(){return ck(Rb)},d2=function(o){var e=o.target,n=o.currentTarget;n.contains(e)||Lq(n,e)},zq=function(){return null},Fq=function(o){var e=o.children;return l2.createElement("div",{onBlur:Ib,onFocus:d2},e)};Fq.propTypes={};var p2=function(){Wf="just",setTimeout(function(){Wf="meanwhile"},0)},Vq=function(){document.addEventListener("focusin",u2),document.addEventListener("focusout",Ib),window.addEventListener("blur",p2)},qq=function(){document.removeEventListener("focusin",u2),document.removeEventListener("focusout",Ib),window.removeEventListener("blur",p2)};function Gq(t){return t.filter(function(o){var e=o.disabled;return!e})}function Hq(t){var o=t.slice(-1)[0];o&&!hp&&Vq();var e=hp,n=e&&o&&o.id===e.id;hp=o,e&&!n&&(e.onDeactivation(),t.filter(function(r){var i=r.id;return i===e.id}).length||e.returnFocus(!o)),o?(gp=null,(!n||e.observed!==o.observed)&&o.onActivation(),Rb(!0),ck(Rb)):(qq(),gp=null)}yb.assignSyncMedium(d2);vb.assignMedium(Ib);zN.assignMedium(function(t){return t({moveFocusInside:Ik,focusInside:xb})});var m2=HN(Gq,Hq)(zq);var WFe=Su(bb,m2);c();c();var Lt=b(x());c();c();var Pb=b(x());c();c();c();var h2=b(x());c();c();var f2;var g2=function(){if(f2)return f2;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Kq(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var o=g2();return o&&t.setAttribute("nonce",o),t}function Xq(t,o){t.styleSheet?t.styleSheet.cssText=o:t.appendChild(document.createTextNode(o))}function Uq(t){var o=document.head||document.getElementsByTagName("head")[0];o.appendChild(t)}var Pk=function(){var t=0,o=null;return{add:function(e){t==0&&(o=Kq())&&(Xq(o,e),Uq(o)),t++},remove:function(){t--,!t&&o&&(o.parentNode&&o.parentNode.removeChild(o),o=null)}}};var Ek=function(){var t=Pk();return function(o,e){h2.useEffect(function(){return t.add(o),function(){t.remove()}},[o&&e])}};var Cu=function(){var t=Ek(),o=function(e){var n=e.styles,r=e.dynamic;return t(n,r),null};return o};c();var Yq={left:0,top:0,right:0,gap:0},Tk=function(t){return parseInt(t||"",10)||0},jq=function(t){var o=window.getComputedStyle(document.body),e=o[t==="padding"?"paddingLeft":"marginLeft"],n=o[t==="padding"?"paddingTop":"marginTop"],r=o[t==="padding"?"paddingRight":"marginRight"];return[Tk(e),Tk(n),Tk(r)]},Mk=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return Yq;var o=jq(t),e=document.documentElement.clientWidth,n=window.innerWidth;return{left:o[0],top:o[1],right:o[2],gap:Math.max(0,n-e+o[2]-o[0])}};var $q=Cu(),Zq=function(t,o,e,n){var r=t.left,i=t.top,a=t.right,s=t.gap;return e===void 0&&(e="margin"),` .`.concat(rk,` { overflow: hidden `).concat(n,`; padding-right: `).concat(s,"px ").concat(n,`; } body { overflow: hidden `).concat(n,`; overscroll-behavior: contain; `).concat([o&&"position: relative ".concat(n,";"),e==="margin"&&` padding-left: `.concat(r,`px; padding-top: `).concat(i,`px; padding-right: `).concat(a,`px; margin-left:0; margin-top:0; margin-right: `).concat(s,"px ").concat(n,`; `),e==="padding"&&"padding-right: ".concat(s,"px ").concat(n,";")].filter(Boolean).join(""),` } .`).concat(vu,` { right: `).concat(s,"px ").concat(n,`; } .`).concat(bu,` { margin-right: `).concat(s,"px ").concat(n,`; } .`).concat(vu," .").concat(vu,` { right: 0 `).concat(n,`; } .`).concat(bu," .").concat(bu,` { margin-right: 0 `).concat(n,`; } body { `).concat(ik,": ").concat(s,`px; } `)},Lk=function(t){var o=t.noRelative,e=t.noImportant,n=t.gapMode,r=n===void 0?"margin":n,i=Pb.useMemo(function(){return Mk(r)},[r]);return Pb.createElement($q,{styles:Zq(i,!o,r,e?"":"!important")})};c();var Nk=!1;if(typeof window<"u")try{zf=Object.defineProperty({},"passive",{get:function(){return Nk=!0,!0}}),window.addEventListener("test",zf,zf),window.removeEventListener("test",zf,zf)}catch{Nk=!1}var zf,ku=Nk?{passive:!1}:!1;c();var Jq=function(t){return t.tagName==="TEXTAREA"},y2=function(t,o){var e=window.getComputedStyle(t);return e[o]!=="hidden"&&!(e.overflowY===e.overflowX&&!Jq(t)&&e[o]==="visible")},Qq=function(t){return y2(t,"overflowY")},eG=function(t){return y2(t,"overflowX")},Ak=function(t,o){var e=o;do{typeof ShadowRoot<"u"&&e instanceof ShadowRoot&&(e=e.host);var n=v2(t,e);if(n){var r=b2(t,e),i=r[1],a=r[2];if(i>a)return!0}e=e.parentNode}while(e&&e!==document.body);return!1},tG=function(t){var o=t.scrollTop,e=t.scrollHeight,n=t.clientHeight;return[o,e,n]},oG=function(t){var o=t.scrollLeft,e=t.scrollWidth,n=t.clientWidth;return[o,e,n]},v2=function(t,o){return t==="v"?Qq(o):eG(o)},b2=function(t,o){return t==="v"?tG(o):oG(o)},nG=function(t,o){return t==="h"&&o==="rtl"?-1:1},w2=function(t,o,e,n,r){var i=nG(t,window.getComputedStyle(o).direction),a=i*n,s=e.target,l=o.contains(s),u=!1,d=a>0,p=0,f=0;do{var m=b2(t,s),h=m[0],y=m[1],S=m[2],C=y-S-i*h;(h||C)&&v2(t,s)&&(p+=C,f+=h),s=s.parentNode}while(!l&&s!==document.body||l&&(o.contains(s)||o===s));return(d&&(r&&p===0||!r&&a>p)||!d&&(r&&f===0||!r&&-a>f))&&(u=!0),u};var Eb=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},S2=function(t){return[t.deltaX,t.deltaY]},C2=function(t){return t&&"current"in t?t.current:t},rG=function(t,o){return t[0]===o[0]&&t[1]===o[1]},iG=function(t){return` .block-interactivity-`.concat(t,` {pointer-events: none;} .allow-interactivity-`).concat(t,` {pointer-events: all;} `)},aG=0,vp=[];function k2(t){var o=Lt.useRef([]),e=Lt.useRef([0,0]),n=Lt.useRef(),r=Lt.useState(aG++)[0],i=Lt.useState(function(){return Cu()})[0],a=Lt.useRef(t);Lt.useEffect(function(){a.current=t},[t]),Lt.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(r));var y=Bx([t.lockRef.current],(t.shards||[]).map(C2),!0).filter(Boolean);return y.forEach(function(S){return S.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),y.forEach(function(S){return S.classList.remove("allow-interactivity-".concat(r))})}}},[t.inert,t.lockRef.current,t.shards]);var s=Lt.useCallback(function(y,S){if("touches"in y&&y.touches.length===2)return!a.current.allowPinchZoom;var C=Eb(y),k=e.current,O="deltaX"in y?y.deltaX:k[0]-C[0],R="deltaY"in y?y.deltaY:k[1]-C[1],I,E=y.target,P=Math.abs(O)>Math.abs(R)?"h":"v";if("touches"in y&&P==="h"&&E.type==="range")return!1;var L=Ak(P,E);if(!L)return!0;if(L?I=P:(I=P==="v"?"h":"v",L=Ak(P,E)),!L)return!1;if(!n.current&&"changedTouches"in y&&(O||R)&&(n.current=I),!I)return!0;var T=n.current||I;return w2(T,S,y,T==="h"?O:R,!0)},[]),l=Lt.useCallback(function(y){var S=y;if(!(!vp.length||vp[vp.length-1]!==i)){var C="deltaY"in S?S2(S):Eb(S),k=o.current.filter(function(I){return I.name===S.type&&I.target===S.target&&rG(I.delta,C)})[0];if(k&&k.should){S.cancelable&&S.preventDefault();return}if(!k){var O=(a.current.shards||[]).map(C2).filter(Boolean).filter(function(I){return I.contains(S.target)}),R=O.length>0?s(S,O[0]):!a.current.noIsolation;R&&S.cancelable&&S.preventDefault()}}},[]),u=Lt.useCallback(function(y,S,C,k){var O={name:y,delta:S,target:C,should:k};o.current.push(O),setTimeout(function(){o.current=o.current.filter(function(R){return R!==O})},1)},[]),d=Lt.useCallback(function(y){e.current=Eb(y),n.current=void 0},[]),p=Lt.useCallback(function(y){u(y.type,S2(y),y.target,s(y,t.lockRef.current))},[]),f=Lt.useCallback(function(y){u(y.type,Eb(y),y.target,s(y,t.lockRef.current))},[]);Lt.useEffect(function(){return vp.push(i),t.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:f}),document.addEventListener("wheel",l,ku),document.addEventListener("touchmove",l,ku),document.addEventListener("touchstart",d,ku),function(){vp=vp.filter(function(y){return y!==i}),document.removeEventListener("wheel",l,ku),document.removeEventListener("touchmove",l,ku),document.removeEventListener("touchstart",d,ku)}},[]);var m=t.removeScrollBar,h=t.inert;return Lt.createElement(Lt.Fragment,null,h?Lt.createElement(i,{styles:iG(r)}):null,m?Lt.createElement(Lk,{gapMode:"margin"}):null)}var PVe=Su(fb,k2);c();var Lb=b(x());c();var sG=function(t){if(typeof document>"u")return null;var o=Array.isArray(t)?t[0]:t;return o.ownerDocument.body},bp=new WeakMap,Tb=new WeakMap,Mb={},Dk=0,cG=function(t,o,e,n){var r=Array.isArray(t)?t:[t];Mb[e]||(Mb[e]=new WeakMap);var i=Mb[e],a=[],s=new Set,l=new Set(r),u=function(p){!p||s.has(p)||(s.add(p),u(p.parentNode))};r.forEach(u);var d=function(p){!p||l.has(p)||Array.prototype.forEach.call(p.children,function(f){if(s.has(f))d(f);else{var m=f.getAttribute(n),h=m!==null&&m!=="false",y=(bp.get(f)||0)+1,S=(i.get(f)||0)+1;bp.set(f,y),i.set(f,S),a.push(f),y===1&&h&&Tb.set(f,!0),S===1&&f.setAttribute(e,"true"),h||f.setAttribute(n,"true")}})};return d(o),s.clear(),Dk++,function(){a.forEach(function(p){var f=bp.get(p)-1,m=i.get(p)-1;bp.set(p,f),i.set(p,m),f||(Tb.has(p)||p.removeAttribute(n),Tb.delete(p)),m||p.removeAttribute(e)}),Dk--,Dk||(bp=new WeakMap,bp=new WeakMap,Tb=new WeakMap,Mb={})}},x2=function(t,o,e){e===void 0&&(e="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),r=o||sG(t);return r?(n.push.apply(n,Array.from(r.querySelectorAll("[aria-live]"))),cG(n,r,e,"aria-hidden")):function(){return null}};c();var O2=b(x());var lG=Cu(),uG=` [`+Sb+`] { pointer-events: none !important; } `,_2=function(){return O2.createElement(lG,{styles:uG})};var ll=b(x()),R2=function(t){return"current"in t?t.current:t};function I2(t){var o=t.setLockProps,e=t.onEscapeKey,n=t.onClickOutside,r=t.shards,i=t.onActivation,a=t.onDeactivation,s=t.noIsolation,l=(0,ll.useState)(void 0),u=l[0],d=l[1],p=(0,ll.useRef)(null),f=(0,ll.useRef)(0);return Lb.useEffect(function(){var m=function(C){C.defaultPrevented||(C.code==="Escape"||C.key==="Escape"||C.keyCode===27)&&e&&e(C)},h=function(C){C.defaultPrevented||C.target===p.current||C instanceof MouseEvent&&C.button!==0||r&&r.map(R2).some(function(k){return k&&k.contains(C.target)||k===C.target})||n&&n(C)},y=function(C){h(C),f.current=C.touches.length},S=function(C){f.current=C.touches.length};if(u)return document.addEventListener("keydown",m),document.addEventListener("mousedown",h),document.addEventListener("touchstart",y),document.addEventListener("touchend",S),function(){document.removeEventListener("keydown",m),document.removeEventListener("mousedown",h),document.removeEventListener("touchstart",y),document.removeEventListener("touchend",S)}},[u,n,e]),(0,ll.useEffect)(function(){if(u)return i&&i(u),function(){a&&a()}},[!!u]),(0,ll.useEffect)(function(){var m=function(){return null},h=!1,y=function(C){s||(m=x2(Dx([C],(r||[]).map(R2)),document.body,Sb)),d(function(){return C})},S=function(){m(),h||d(null)};return o({onMouseDown:function(C){p.current=C.target},onTouchStart:function(C){p.current=C.target},onActivation:y,onDeactivation:S}),function(){h=!0,o(!1)}},[]),Lb.createElement(_2,null)}var P2=Su(wb,I2);var dG=function(t){return Ff.createElement(P2,un({},t))},Bk=Ff.forwardRef(function(t,o){return Ff.createElement(GN,un({},t,{ref:o,sideCar:dG}))});var as=b(z()),F2=b(z2());function V2(t){let o=br.useRef(null),[e,n]=or(OS),{medias:r,currentIndex:i}=e,a=()=>{n({medias:[],currentIndex:0})},s=()=>{n(d=>({...d,currentIndex:Math.max(d.currentIndex-1,0)}))},l=()=>{n(d=>({...d,currentIndex:Math.min(d.currentIndex+1,d.medias.length-1)}))},u=d=>{n(p=>({...p,currentIndex:d}))};return yc({opened:r.length>0,closeOnClick:!1,closeOnOutsideClick:!1,closeOnScroll:!1,closeOnEsc:!0,onClose:a},o),Jr(r.length?{Left:()=>s(),Right:()=>l()}:{},"all",[n,!r.length]),r.length?br.createElement(Tn,{ref:o},br.createElement(Bk,null,br.createElement(as.View,{style:Sp.imagesZoonPortal},br.createElement(F2.default,{imageUrls:r.map(d=>({url:d.url})),index:i,renderIndicator:d=>br.createElement(as.View,{style:Sp.indactor},br.createElement(as.View,{style:Sp.indicatorElement}),br.createElement(as.View,{style:[Sp.indicatorElement,w.alignCenter,w.justifyContentCenter]},br.createElement(as.Text,{style:Sp.indicatorText},`${d}/${r.length}`)),br.createElement(as.View,{style:[Sp.indicatorElement,w.alignEnd,w.justifyContentCenter]},br.createElement(W,{icon:v.X,defaultTextStyle:{color:Z.WHITE},onPress:()=>a()}))),renderArrowLeft:()=>br.createElement(W,{icon:v.ChevronLeft,defaultTextStyle:{color:Z.WHITE},onPress:()=>s()}),renderArrowRight:()=>br.createElement(W,{icon:v.ChevronRight,defaultTextStyle:{color:Z.WHITE},onPress:()=>l()}),onChange:d=>u(d||0),onCancel:()=>a(),enableSwipeDown:!0})))):null}var Sp=as.StyleSheet.create({imagesZoonPortal:{position:"fixed",top:0,left:0,right:0,bottom:0},indactor:{height:48,position:"absolute",left:0,top:0,right:0,display:"flex",flexDirection:"row",zIndex:20},indicatorElement:{flex:1},indicatorText:{color:Z.WHITE}});c();var Kk=b(x());c();var Cp=JSON.parse('{"iconWrapper":"iconWrapper_x37cD","icon":"icon_TnMUQ","active":"active_CllGx","ok":"ok_V1sO-","interactive":"interactive_B2TwX","good":"good_nqe9w","bad":"bad_pz0f3"}');function q2(t){let{active:o=!0,interactive:e=!1,size:n,rating:r}=t,i=RG[r];return Kk.createElement(j,{style:[Cp.iconWrapper,Cp[r],o&&Cp.active,e&&Cp.interactive],inlineStyle:{"--rating-size":`${n}px`}},Kk.createElement(i,{style:[Cp.icon]}))}var RG={["ok"]:v.FeedbackOk.CSS,["good"]:v.FeedbackGood.CSS,["bad"]:v.FeedbackBad.CSS};c();var Rp=b(x());c();var Zn=b(x()),kp=b(z());function G2(t){return Zn.createElement(K2,{...t})}function H2(t){let{space:o,onClose:e}=t,n=yh(o);return Zn.createElement(K2,{onPressGitSync:()=>{e(),n()},...t})}function K2(t){let{sources:o,pickSource:e,onPressGitSync:n,onClose:r}=t,[,i]=_(X2);return Zn.createElement(ih,{size:"large",onClose:r,title:"Import your content",subtitle:"Choose a file type or platform below to get started importing your data.",footer:Zn.createElement(ki,{icon:v.GitHub.CSS,kind:"default",title:"Need to stay in sync?",details:n?"Set up GitHub or GitLab Sync and link a repo for two-way syncing.":"Start a new space, set up GitHub or GitLab Sync, and link a repo for two-way syncing.",actions:n?[{label:"Set up now",onPress:n}]:void 0})},Zn.createElement(kp.View,{style:[i.cardsWrapper]},o.map(({title:a,name:s,source:l,icon:u})=>Zn.createElement(IG,{key:a,title:s,onPress:()=>e(l),icon:u}))))}function IG(t){let{title:o,description:e,icon:n,onPress:r,style:i}=t,[,a]=_(D),[,s]=_(X2);return Zn.createElement(V.TouchableOpacity,{style:[w.directionRow,w.alignCenter,g.Padding.smallVertical,g.Padding.smallRight,s.importCard,i],onPress:r},Zn.createElement(kp.View,{style:g.Margin.smallLeft},typeof n=="function"?Zn.createElement(n,{size:M.ICON_L}):Zn.createElement(jo,{source:n,style:s.importCardImage})),Zn.createElement(kp.View,{style:g.Margin.smallLeft},Zn.createElement(kp.View,null,Zn.createElement(V.Text.Child,{style:[a.Label,a.text],activeStyle:a.primary},o)),Zn.createElement(kp.View,null,Zn.createElement(V.Text.Child,{style:[a.Body,a.textMuted],activeStyle:a.primary},e))))}var X2=F.create({importCard:t=>({borderWidth:1,borderColor:t.colors.border.main,borderRadius:4,flexShrink:0,flexGrow:0,flexBasis:"32%",padding:g.small,marginRight:g.small,marginBottom:g.small}),importCardImage:{width:M.ICON_L,height:M.ICON_L},cardsWrapper:{flexWrap:"wrap",flexDirection:"row",marginRight:-g.small}});c();function _u(t){return"organization"in t}c();var zb=b(x());c();var cs=b(x());c();var ba=b(x()),pl=b(z());c();var va=b(x()),xp=b(z());c();var dl=b(x()),U2=b(z());function Y2(t){let{fileIcon:o,files:e,setFiles:n}=t,[,r]=_(D),i=To(o,{style:r.primary},[o]),a=dl.useCallback(({item:s})=>{let l=()=>{n(u=>u.filter(d=>d.key!==s.key))};return dl.createElement(Es,{layout:"wide",icon:i,title:s.file.name,buttons:[s.uploaded||s.failed?null:dl.createElement(Re,{size:"medium"}),s.failed?dl.createElement(W,{tint:Z.scarlet.base,icon:v.Alert,title:"Failed to upload. Please try again.",onPress:l}):null,dl.createElement(W,{icon:v.X,title:"Remove",onPress:l})]})},[o,n]);return dl.createElement(U2.FlatList,{data:e,renderItem:a})}function Bb(t){let{getSpace:o,files:e,setFiles:n,fileIcon:r,fileExtension:i,limitWarning:a=!1,fileUploadsLimit:s=1/0}=t,[,l]=_(D),u=go(),d=(h,y)=>{n(S=>S.map(C=>C.key===h?{...C,...y}:C))},p=async h=>{let y=await o();try{let S=await GO({kind:"space_import",space:y.id},h.file);d(h.key,{uploaded:S})}catch(S){throw u.notify({kind:"danger",title:"Error while uploading files",details:"Please try again or contact support if the problem persists.",icon:v.Alert.CSS}),d(h.key,{failed:!0}),S}},f=h=>{let y=[];for(let S of h){if(e.length>=s){u.notify({kind:"danger",title:"Cannot upload file",details:`You can only upload ${s} file for this operation`,timeout:5e3});break}if(S.size>209715200){u.notify({kind:"danger",title:`Your file must be less than ${Im(209715200)}`,details:`Please try a different file that's below ${Im(209715200)}`,timeout:5e3});continue}let C={key:lg(),file:S};y.push(C)}n(S=>S.concat(y)),y.forEach(S=>p(S))};return va.createElement(va.Fragment,null,va.createElement(xp.View,null,va.createElement(W1,{icon:r,onDropFiles:f,onPress:async()=>{let h=await d_();f(h)},hint:`Drop your ${i} file here or choose a file`})),a?va.createElement(xp.View,{style:g.Margin.smallTop},va.createElement(xp.Text,{style:[l.Caption,l.textMuted]},"GitBook has limits for imported content,"," ",va.createElement(Fa,{url:"https://docs.gitbook.com/features/import#limits"},"read more here."))):null,e.length>0?va.createElement(xp.View,{style:[g.Margin.mediumTop]},va.createElement(Y2,{fileIcon:r,files:e,setFiles:n})):null)}c();var Gf=b(x()),$2=b(z());function Op(t){let{title:o,subtitle:e,onClose:n,onSubmit:r,children:i}=t;return Gf.default.createElement(ih,{title:o,subtitle:e,footer:Gf.default.createElement($2.View,{style:[w.directionRow,w.justifyContentEnd]},Gf.default.createElement(W,{kind:"secondary",onPress:n,style:g.Margin.smallRight},"Back"),Gf.default.createElement(W,{kind:"primary",onPress:r},"Start import")),onClose:n},i)}function Z2(t){let{getSpace:o,fileIcon:e,fileExtension:n,steps:r=[],startImport:i,limitWarning:a=!1,fileUploadsLimit:s}=t,[,l]=_(D),[u,d]=ba.useState([]),f=u.some(h=>!h.uploaded)||u.length===0;return ba.createElement(Op,{...t,onSubmit:async()=>{if(!f){let h=await o();i(u.map(y=>y.uploaded?.downloadURL).filter(se),h)}}},r.length>0?ba.createElement(pl.View,{style:[g.Margin.mediumBottom]},r.map((h,y)=>ba.createElement(pl.View,{key:y,style:[w.directionRow]},ba.createElement(pl.View,{style:[g.Margin.smallRight]},ba.createElement(pl.Text,{style:[l.Body,l.textMid]},`${y+1}.`)),ba.createElement(pl.View,{style:w.flex1},ba.createElement(pl.Text,{style:[l.Body,l.textMid]},h))))):null,ba.createElement(Bb,{getSpace:o,files:u,setFiles:d,fileIcon:e,fileExtension:n,limitWarning:a,fileUploadsLimit:s}))}c();var Wb=b(x());function J2(t){let o=Wb.useRef(),{createSpace:e}=OT({organization:t.organization});return Wb.useMemo(()=>async()=>{if(o.current)return o.current;if(!e)throw new Error("Cannot import into shared space due to incorrect hook usage");return o.current=await e(!1),o.current},[e,o])}c();var Ho=b(x()),ss=b(z());c();var wa=b(x()),Ru=b(z());function Q2(t){let{url:o,setURL:e,placeholder:n="e.g. https://mysite.com/file",supportedFormats:r=[],validate:i=hi}=t,[,a]=_(D),s=i(o);return wa.createElement(wa.Fragment,null,wa.createElement(Ru.View,null,wa.createElement(oo,{size:"large",placeholder:n,value:o,cleareable:!0,onChangeText:e,feedback:o&&!s?{type:"danger",message:"URL is invalid. It must be a valid absolute URL starting with https:// or http://"}:{type:"none"}})),r.length>1?wa.createElement(Ru.View,{style:[g.Margin.smallTop,w.directionRow,w.alignCenter]},wa.createElement(Ru.View,null,wa.createElement(v.InfoCircle,{size:M.ICON_S,style:a.info})),wa.createElement(Ru.View,{style:[g.Margin.smallLeft,w.flex1]},wa.createElement(Ru.Text,{style:[a.Caption,a.info]},`Supported formats: ${r.join(", ")}`))):null)}function eA(t){let{getSpace:o,fileIcon:e,fileExtension:n,steps:r=[],startImport:i,limitWarning:a=!1,fileUploadsLimit:s}=t,[,l]=_(D),[u,d]=Ho.useState([]),[p,f]=Ho.useState(""),[m,h]=Ho.useState("files"),y=u.some(O=>!O.uploaded),S=O=>hi(O),C=(y||u.length===0)&&(!p||!S(p));return Ho.createElement(Op,{...t,onSubmit:async()=>{if(!C){let O=await o();i(m==="files"?u.map(R=>R.uploaded?.downloadURL).filter(se):[p],O)}}},r.length>0?Ho.createElement(ss.View,{style:[g.Margin.mediumBottom]},r.map((O,R)=>Ho.createElement(ss.View,{key:R,style:[w.directionRow]},Ho.createElement(ss.View,{style:[g.Margin.smallRight]},Ho.createElement(ss.Text,{style:[l.Body,l.textMid]},`${R+1}.`)),Ho.createElement(ss.View,{style:w.flex1},Ho.createElement(ss.Text,{style:[l.Body,l.textMid]},O))))):null,Ho.createElement(ss.View,{style:[w.flex1,w.directionRow,w.alignCenter]},Ho.createElement(Cc,null,Ho.createElement(Cc.Tab,{active:m==="files",onPress:()=>h("files")},"Files"),Ho.createElement(Cc.Tab,{active:m==="url",onPress:()=>h("url")},"URL"))),Ho.createElement(ss.View,{style:[w.directionColumn,g.Margin.smallTop]},m==="files"?Ho.createElement(Bb,{getSpace:o,files:u,setFiles:d,fileIcon:e,fileExtension:n,limitWarning:a,fileUploadsLimit:s}):null,m==="url"?Ho.createElement(Q2,{url:p,validate:S,setURL:f,placeholder:"https://myapi.io/swagger.yaml",supportedFormats:["JSON","YAML"]}):null))}c();var wr=b(x()),_p=b(z());function tA(t){let{title:o="Import a Website",subtitle:e="Enter a link to a web page below to import it into your space.",getSpace:n,startImport:r}=t,[i,a]=wr.useState(""),[,s]=_(D),l=i?hi(i):!1,u=async()=>{if(l){let d=await n();r([i],d)}};return wr.createElement(Op,{...t,title:o,subtitle:e,onSubmit:u},wr.createElement(_p.View,{style:[g.Margin.smallBottom]},wr.createElement(Zr,{label:"URL",labelDescription:"We\u2019ll crawl your site and pull in as much of your content as possible.",placeholder:"https://docs.mycompany.com",value:i,onChangeText:a,onSubmit:u,feedback:i?{type:l?"success":"danger",message:l?"":"URL is not valid"}:void 0})),wr.createElement(_p.View,{style:g.Margin.mediumBottom},wr.createElement(_p.Text,{style:[s.Caption,s.textMuted]},"GitBook has limits for imported content,"," ",wr.createElement(Fa,{url:"https://docs.gitbook.com/features/import#limits"},"read more here."))),i&&l?wr.createElement(wr.Suspense,{fallback:null},wr.createElement(PG,{url:i})):null)}function PG(t){let{url:o}=t,[{data:e}]=xi([No("getEmbedByUrl",{},{query:{url:o}})],{throwOnError:!1});return e?wr.createElement(_p.View,{style:[g.Margin.mediumBottom]},wr.createElement(Ka,{title:e.title,details:e.site,icon:mt(Da,{source:{uri:e.icon||void 0}}),onPress:()=>{Ts(o)}})):null}function oA(t){return _u(t.target)?cs.createElement(TG,{...t,target:t.target}):cs.createElement(EG,{...t,target:t.target})}function EG(t){let o=cs.useCallback(async()=>"id"in t.target.space?t.target.space:S_(await w_({operationId:"getSpaceById",params:{spaceId:t.target.space.key}})).data,[t.target.space]);return cs.createElement(nA,{...t,getSpace:o})}function TG(t){let o=J2(t.target);return o?cs.createElement(nA,{...t,getSpace:o}):null}function nA(t){let{sourceInfo:o,startImport:e,target:n,setSource:r,getSpace:i,onBack:a}=t,{source:s}=o??{};if(o===void 0||s===void 0)return null;switch(s){case"website":case"github-wiki":return cs.createElement(tA,{target:n,title:o.title,subtitle:o.subtitle,getSpace:i,startImport:e,onClose:()=>{r(null)}});case"docx":case"markdown":case"html":case"zip":case"dropbox-paper":case"google-docs":case"confluence":case"quip":case"notion":{let l=s==="zip"||s==="confluence"||s==="notion";return cs.createElement(Z2,{target:n,getSpace:i,title:o.title,subtitle:o.subtitle,steps:o.steps,fileIcon:o.fileIcon,fileExtension:o.fileExtension,onClose:a,startImport:e,limitWarning:l})}case"open-api":return cs.createElement(eA,{target:n,getSpace:i,title:o.title,subtitle:o.subtitle,steps:o.steps,fileIcon:o.fileIcon,fileExtension:o.fileExtension,onClose:a,startImport:e,fileUploadsLimit:1,limitWarning:!0});default:Oe(s)}}c();var _t=b(x());c();var Xk="https://app.gitbook.com/public/app/assets/confluence-XZRVQN7T.png";var Uk="https://app.gitbook.com/public/app/assets/dropbox-paper-F627BIKK.png";var Yk="https://app.gitbook.com/public/app/assets/google-docs-T6C75XLR.png";var jk="https://app.gitbook.com/public/app/assets/openapi-H4Y5H3P5.png";var $k="https://app.gitbook.com/public/app/assets/quip-SHLUXOMG.png";function rA(){let[t]=_(),[,o]=_(D),e=To(v.FileCode,{style:o.primary}),n=To(v.FileText,{style:{color:Z.scarlet.light}}),r=To(v.FileWord,{style:{color:Z.primary.light}}),i=To(v.FileCode,{style:{color:Z.violet.light}}),a=To(v.FileZIP,{style:{color:Z.orange.light}}),s=To(v.GitHub,{style:{color:t.colors.text.main}}),l=To(v.Notion,{style:{color:t.colors.text.main}}),u=To(Da,{source:{uri:Xk}}),d=To(Da,{source:{uri:$k}}),p=To(Da,{source:{uri:Uk}}),f=To(Da,{source:{uri:Yk}}),m=To(Da,{source:{uri:jk}});return[{name:"Website",title:"Import a Website",subtitle:"Enter a link to a web page below to import it into your space.",source:"website",icon:e,type:"application"},{name:"Markdown",title:"Import a Markdown file",source:"markdown",icon:n,subtitle:"Drag and drop your .md file below to start the import.",fileIcon:v.FileText,fileExtension:".md",type:"file"},{name:"MS Word",title:"Import a Word document",source:"docx",icon:r,subtitle:"Drag and drop your .docx file below to start the import.",fileIcon:v.FileWord,fileExtension:".docx",type:"application"},{name:"HTML",title:"Import a HTML file",source:"html",subtitle:"Drag and drop your .html file below to start the import.",icon:i,fileIcon:v.FileCode,fileExtension:".html",type:"file"},{name:"ZIP",title:"Import a ZIP file",source:"zip",subtitle:"Drag and drop your .zip file below to start the import.",icon:a,fileIcon:v.FileZIP,fileExtension:".zip",type:"file"},{name:"Confluence",title:"Import from Confluence",icon:u,source:"confluence",type:"application",subtitle:"Export your space as ZIP to bring your content from Confluence.",fileExtension:".zip",fileIcon:v.FileZIP,steps:[_t.createElement(pe,null,"Go to ",_t.createElement(pe,{style:[It.uiEmphasize]},"Space Settings")," for the space you're looking to export and select the"," ",_t.createElement(pe,{style:[It.uiEmphasize]},"Content tools")," section."),_t.createElement(pe,null,"Click on the ",_t.createElement(pe,{style:[It.uiEmphasize]},"Export")," tab, and select ",_t.createElement(pe,{style:[It.uiEmphasize]},"HTML"),", then hit"," ",_t.createElement(pe,{style:[It.uiEmphasize]},"Next, and Export"),"."),_t.createElement(pe,null,"Choose ",_t.createElement(pe,{style:[It.uiEmphasize]},"Normal Export")," unless you want to choose specific pages to export.")]},{name:"Notion",title:"Import from Notion",icon:l,source:"notion",type:"application",subtitle:"Export your workspace as Markdown to bring your content from Notion.",steps:[_t.createElement(pe,null,"Go to the Workspace you're looking to export and select the"," ",_t.createElement(pe,{style:[It.uiEmphasize]},"\u2026")," button in the top right."),_t.createElement(pe,null,"Choose ",_t.createElement(pe,{style:[It.uiEmphasize]},"Export All as Markdown"))],fileIcon:v.FileText,fileExtension:".md"},{name:"GitHub Wiki",title:"Import from GitHub Wiki",subtitle:"Enter a link to a GitHub Wiki below to import it into your space.",icon:s,source:"github-wiki",type:"application"},{name:"Quip",title:"Import from Quip",icon:d,source:"quip",fileIcon:v.FileText,fileExtension:".md",type:"application"},{name:"Dropbox Paper",title:"Import from Dropbox Paper",icon:p,source:"dropbox-paper",steps:[_t.createElement(pe,null,`Click "\u2026" (ellipsis) in the Paper doc you're viewing.`),_t.createElement(pe,null,"Click ",_t.createElement(pe,{style:[It.uiEmphasize]},"Export"),"."),_t.createElement(pe,null,"Select ",_t.createElement(pe,{style:[It.uiEmphasize]},".docx")," and click"," ",_t.createElement(pe,{style:[It.uiEmphasize]},"Download"),"."),_t.createElement(pe,null,"Drag your downloaded files to the box below to import.")],fileIcon:v.FileWord,fileExtension:".docx",type:"application"},{name:"Google docs",title:"Import from Google Docs",icon:f,source:"google-docs",type:"application",subtitle:"Export your documents as .docx or webpage to bring your content from Google Docs.",steps:[_t.createElement(pe,null,"Click on ",_t.createElement(pe,{style:[It.uiEmphasize]},"File ",">"," Download"),"."),_t.createElement(pe,null,"Choose between ",_t.createElement(pe,{style:[It.uiEmphasize]},"Microsoft Word")," or"," ",_t.createElement(pe,{style:[It.uiEmphasize]},"Web Page"),".")],fileIcon:v.FileWord,fileExtension:".docx"},{name:"OpenAPI",title:"Import from OpenAPI",icon:m,source:"open-api",type:"application",subtitle:"Provide an OpenAPI specification file or URL to import your API.",fileIcon:v.FileText,fileExtension:".yaml or .json",fileUploadsLimit:1}]}function iA({target:t,onStartImport:o,onComplete:e,onBack:n}){let[r,i]=zb.useState(null),a=rA(),s=go(),l=f=>{f&&(_u(t)?ne(Dg(t.organization,{type:"templates_pick_import",source:f})):ne(Dt(t.space,{type:"edit_pick_import",source:f}))),i(f)},u=async(f,m)=>{if(!r)return;let h=await Ms(),y={url:f,source:r};if(_u(t)||!t.page&&!t.changeRequest)return h.spaces.importContent(m.id,y);if(t.page&&t.changeRequest)return h.spaces.importContentInChangeRequestPageById(m.id,t.changeRequest,t.page,y);if(t.page)return h.spaces.importContentInPageById(m.id,t.page,y);if(t.changeRequest)return h.spaces.importContentInChangeRequest(m.id,t.changeRequest,y)},d=async(f,m)=>{if(r){ne(o1(m,void 0,{type:"edit_import",source:r})),o?o(m):n();try{(await s.notifyProgress(DO(f,async S=>{let C=await u(S,m);return C?C.data:void 0},{concurrency:2,stopOnError:!1}),{title:"Importing docs",details:"We are importing your docs, this might take a while."})).some(S=>S&&S.totalResources!==S.importedResources)?s.notify({kind:"warning",title:"Incomplete import",timeout:0,icon:v.Alert.CSS,details:"Some of your docs were not imported due to file limits, try splitting them into several imports."}):(s.notify({icon:v.CheckCircle.CSS,kind:"success",title:"Imported docs",details:"Docs have been successfully imported. Enjoy!"}),e&&e(m))}catch(h){throw s.notify({kind:"danger",title:"Error while importing docs",details:ji(h,"Please try again or contact support if the problem persists."),icon:v.Alert.CSS}),h}}},p=a.find(({source:f})=>f===r);return{modals:zb.createElement(oA,{sourceInfo:p,startImport:d,target:t,setSource:i,onBack:n}),source:r,sources:a,onSelectSource:l}}function b6(t){let{target:o,onStartImport:e,onComplete:n,onClose:r}=t,{modals:i,source:a,sources:s,onSelectSource:l}=iA({onStartImport:d=>{e?e(d):r()},onComplete:n,onBack:()=>l(null),target:o}),[{result:u}]=gh([_u(o)?null:ea("key"in o.space?o.space.key:o.space.id)]);return Rp.createElement(Rp.Fragment,null,a?i:u?Rp.createElement(H2,{space:u,sources:s,pickSource:l,onClose:r}):Rp.createElement(G2,{sources:s,pickSource:l,onClose:r}))}c();var aA=b(x());var BG=5,sA=At({key:"recentSearches",default:[],effects:[Pr.recoilEffect("@recoil/recentSearches",[])]});function cA(){return tr(sA)}function lA(t){let o=Kr(sA);aA.useEffect(()=>{if(!t)return;let e=setTimeout(()=>{o(n=>n.includes(t)?n:[t,...n.slice(0,BG-1)])},3e3);return()=>clearTimeout(e)},[t])}c();var uA=b(x());function dA(t,o){let{space:e,organization:n}=o,r=uh();uA.useEffect(()=>{if(!t)return;let i=setTimeout(()=>{let a={type:r?"public_content_search_type":"search_type",query:t};e?ne(Dt(e,a)):n?ne(Dg(n,a)):ne(a)},700);return()=>{clearTimeout(i)}},[t])}c();var ls=b(x());c();var pA=Zg("0dc87861cc2f97f4b8aa90517de6c6f7d7add292c36eff9ffb4a127ad3126faa",()=>import("https://app.gitbook.com/public/app/chunks/ShareModalBody.lazycomponent-ETSPAX4E.min.js"));function mA(t){let{content:o}=t,{selectedTab:e,changeSelectedTab:n,opened:r,close:i}=VP("share");return ls.createElement(St,null,r?ls.createElement(yo,{size:"xlarge",onClose:i},ls.createElement(ls.Suspense,{fallback:ls.createElement(i_,{sidebar:ls.createElement(Mo,{size:"large"})},ls.createElement(Mo,{size:"large"}))},ls.createElement(pA,{tab:e||H_(o),onChangeTab:n,...t}))):null)}c();var Le=b(x());c();var Sr=JSON.parse('{"loadingDelayedText":"loadingDelayedText_WVBF7","loadingDelayedTextVisible":"loadingDelayedTextVisible_y5onq","fullResponse":"fullResponse_adSl0","prompts":"prompts_Th3zf","answerWrapper":"answerWrapper_Uizn-","queryHeading":"queryHeading_kpHvY","prompt":"prompt_F-9A-","promptText":"promptText_G-HnJ","icon":"icon_281MC","actions":"actions_FNzrP","relatedQueries":"relatedQueries_nIpkZ","relatedQueriesHeading":"relatedQueriesHeading_5XnJH","blankSlateNoAiAnswer":"blankSlateNoAiAnswer_rz6wQ","buttons":"buttons_Q48Sx"}');c();var di=b(x());c();var ml=b(x());function fA(t){let{answer:o,singleSpace:e,organization:n}=t,{navigate:r}=we(),i=Ce(),a=ml.useMemo(()=>WG(i,o,e,n),[i,o,e,n]),s=ml.useCallback(d=>{switch(ne({type:"ai_search_open_source"}),d.type){case"space":r({screen:{type:"space",space:d.space.key,organization:d.space.organization,page:"",query:void 0}});break;case"page":r({screen:{type:"space",space:d.space.key,organization:d.space.organization,page:d.path,query:void 0}});break;case"snippet":r({screen:{type:"snippet",snippet:d.snippet.id,organization:d.organization,query:void 0}});break;case"entity":d.targetURL&&lh(d.targetURL);break;default:Oe(d)}},[r]),l=ml.useCallback(d=>{switch(d.type){case"space":return{icon:ju(mt(Lo,{code:$O(d.space)})),title:d.space.title||Aa,action:"Go to space"};case"page":return{icon:v.Page.CSS,title:d.page.title,subtitle:d.ancestors.filter(f=>f.id!==d.page.id).map(f=>f.title).join(" \u203A "),nested:!e,action:"Go to page"};case"snippet":let p=A_(d.snippet);return{title:D_(d.snippet),icon:p.object==="user"?ju(mt(B_,{userId:p.id})):v.Snippet.CSS,action:"Go to snippet"};case"entity":return{icon:v.ArrowCurveDownRight.CSS,title:d.title,body:d.body,action:"Open"};default:Oe(d)}},[e]),u=ml.useCallback(d=>{if(d?.type==="entityType")return{icon:d.integration?ju(mt(W_,{integrationId:d.integration,bordered:!1})):v.Database.CSS,title:d.title}},[]);return ml.createElement(kc,{data:a,getKey:qG,renderItem:l,renderGroup:u,getGroupKey:GG,groupItem:HG,onOpen:s})}function WG(t,o,e,n){let r=new Map,i=[];p_(o.sources,s=>{switch(s.type){case"entity":let{entityType:l,entityId:u,integration:d}=s;if(!n)return null;let p=FG(u,l,n);if(!p)return null;let f=p.entityType.includes(`${d}:`)?p.entityType.split(`${d}:`)[1]:p.entityType;i.push({type:"entity",id:p.entityId,title:p.properties.title,body:p.properties.description,targetURL:p.properties.url,groups:[{type:"entityType",entityType:p.entityType,title:DI(f),integration:d}]});break;case"capture":let{captureId:m}=s;if(!n)return null;let h=zG(m,n);if(!h)return null;i.push({type:"snippet",snippet:h,organization:n});break;case"page":let y=VG(s.space,s.page,t);if(!y)return null;let S=Ku(y.revision,y.page.id),C={type:"page",space:y.space,page:y.page,ancestors:S,path:to(y.revision,y.page.id)};if(e){i.push(C);break}i.some(O=>O.type==="space"&&O.space.key===y.space.key)||i.push({type:"space",space:y.space}),r.set(y.space.key,(r.get(y.space.key)||[]).concat(C));break;default:Oe(s)}});let a=[];for(let s of i)s&&(a.push(s),s.type==="space"&&(r.get(s.space.key)||[]).forEach(u=>{a.push(u)}));return a}function zG(t,o){return Aw(Pl({operationId:"getCapture",params:{organizationId:o,captureId:t}}))?.data}function FG(t,o,e){return Aw(Pl({operationId:"getEntity",params:{organizationId:e,entityType:o,entityId:t}}))?.data}function VG(t,o,e){let n=fh([ea(t)])[0]?.result;if(!n)return;let r=Xr(e.store.getRevision(t,n.revision));if(!r)return;let i=r.pages[o];if(!(!i||i.type!=="document"))return{space:n,page:i,revision:r}}function qG(t){switch(t.type){case"space":return`space:${t.space.key}`;case"page":return`page:${t.space.key}/${t.page.id}`;case"snippet":return`snippet:${t.snippet.id}`;case"entity":return`entity:${t.groups[0].entityType}:${t.id}`;default:Oe(t)}}function GG(t){return t&&t.type==="entityType"?t.entityType:""}function HG(t){if(t.type==="entity")return t.groups[0]}c();var gA=JSON.parse('{"aiAnswerFooter":"aiAnswerFooter_pxFSA","sourcesHeadingButton":"sourcesHeadingButton_YdnnI"}');function hA(t){let{answer:o,singleSpace:e,organization:n}=t,[r,i]=di.useState(!1),a=ce();return di.createElement(j,{style:[N.flex.column]},di.createElement(j,{style:[N.flex.row]},di.createElement(j,{style:[N.flex.flex1]},di.createElement(bt,{size:"medium",trailingIcon:r?v.ChevronDown.CSS:v.ChevronRight.CSS,onPress:()=>{i(!r)},style:[gA.sourcesHeadingButton,It.uiSmall,It.colorMuted,N.backgroundColor.transparent,N.padding.none],preventFocusOnPress:!0,label:a("search_answer_sources",`${o.sources.length}`)}))),r?di.createElement(j,{style:N.margin.mediumTop},di.createElement(di.Suspense,{fallback:di.createElement(Mo,{size:"medium"})},di.createElement(fA,{answer:o,singleSpace:e,organization:n}))):null)}c();var us=b(x());function yA(t){let{query:o,answer:e,size:n="small"}=t,[r,i]=us.useState(!1),a=go(),s=Kg(),l=ce(),u=()=>{s.writeTextAndNotify(e.text)},d=()=>{ne({type:"ai_search_upvote_answer",query:o,answer:e.text}),i(!0),a.notify({icon:v.ThumbsUp.CSS,title:l("search_answer_feedback_title"),details:l("search_answer_feedback_details")})},p=()=>{ne({type:"ai_search_downvote_answer",query:o,answer:e.text}),i(!0),a.notify({icon:v.ThumbsUp.CSS,title:l("search_answer_feedback_title"),details:l("search_answer_feedback_details")})};return us.createElement(j,{style:[N.flex.row,N.gap.small]},us.createElement(W,{size:n,title:l("search_answer_copy"),icon:v.Copy,onPress:u}),r?null:us.createElement(us.Fragment,null,us.createElement(W,{size:n,icon:v.ThumbsUp,title:l("search_answer_feedback_upvote"),onPress:d,style:g.Margin.xsmallLeft}),us.createElement(W,{size:n,icon:v.ThumbsDown,title:l("search_answer_feedback_downvote"),onPress:p,style:g.Margin.xsmallLeft})))}c();var Jk=b(x());c();var Zk=JSON.parse('{"aiSearchSpinner":"aiSearchSpinner_cTH2Q","aiSearchSpinnerAnim":"aiSearchSpinnerAnim_75OX-","aiSearchSpinnerIcon":"aiSearchSpinnerIcon_MOqIL"}');function vA(t){let{size:o=M.ICON_L}=t;return Jk.createElement(j,{style:Zk.aiSearchSpinner,inlineStyle:{width:o,height:o}},Jk.createElement(v.AILens.CSS,{style:Zk.aiSearchSpinnerIcon}))}function bA(t){let{query:o,target:e}=t,n=Le.useCallback((r,i,a)=>{ne(e.space?Dt(e.space,{type:"ai_search_crash",query:o.query}):{type:"ai_search_crash",query:o.query})},[o]);return Le.createElement(og,{fallback:()=>Le.createElement(YG,null),onError:n},Le.createElement(Le.Suspense,{fallback:Le.createElement(XG,null)},Le.createElement(KG,{...t})))}function KG(t){let{target:o,query:e,onAnswerLoaded:n,onSubmitQuery:r}=t,[{data:{answer:i}}]=xi([o.space?No("askQueryInSpace",{spaceId:o.space.key},{query:{},body:{query:e.query}}):No("askInOrganization",{organizationId:o.organization},{query:{},body:{query:e.query}})]);if(Le.useEffect(()=>{ne(o.space?Dt(o.space,{type:"ai_search_view_answer",query:e.query,queriesInMemory:e.previousQueries.length,hasAnswer:!!i,hasFollowupQuestions:!!i&&i.followupQuestions.length>0}):{type:"ai_search_view_answer",query:e.query,queriesInMemory:e.previousQueries.length,hasAnswer:!!i,hasFollowupQuestions:!!i&&i.followupQuestions.length>0})},[e,i,o.space]),Le.useEffect(()=>{i&&n?.()},[i,n]),!i)return Le.createElement(UG,{organizationKey:o.organization});let a=s=>{ne(o.space?Dt(o.space,{type:"ai_search_pick_followup",query:e.query,followup:s,previousQueriesCount:e.previousQueries.length}):{type:"ai_search_pick_followup",query:e.query,followup:s,previousQueriesCount:e.previousQueries.length}),r(s)};return Le.createElement(j,{style:[N.flex.column,Sr.fullResponse]},Le.createElement(pe,{style:[Sr.queryHeading,N.text.capitalizeFirstLetter,It.uiHeadingMedium]},e.query),Le.createElement(j,{style:Sr.answerWrapper},Le.createElement(j,{style:[It.uiBase,It.colorMuted]},Le.createElement(od,{markdown:i.text}))),Le.createElement(j,{style:Sr.actions},Le.createElement(yA,{query:e.query,answer:i,size:"medium"})),Le.createElement(hA,{answer:i,singleSpace:!!o.space,organization:o.organization}),i.followupQuestions.length>0?Le.createElement(j,{style:Sr.relatedQueries},Le.createElement(pe,{style:Sr.relatedQueriesHeading},"Related queries"),Le.createElement(j,{style:Sr.prompts},i.followupQuestions.map(s=>Le.createElement(j,{key:s,style:Sr.prompt,as:"button",type:"button",onClick:l=>{l.preventDefault(),a(s)}},Le.createElement(v.SearchOrAsk.CSS,{style:Sr.icon}),Le.createElement(pe,{style:Sr.promptText},s))))):null)}function XG(t){let[o,e]=Le.useState(!1),n=ce();return Le.useEffect(()=>{let r=setTimeout(()=>{e(!0)},3e3);return()=>{clearTimeout(r)}},[]),Le.createElement(Is,{icon:vA,title:n("search_answer_loading")},Le.createElement(pe,{style:[Sr.loadingDelayedText,o&&Sr.loadingDelayedTextVisible]},n("search_answer_loading_wait")))}function UG(t){let{organizationKey:o}=t,e=ce(),n=hh("UI_REVAMP"),{navigate:r}=we();return Le.createElement(j,{style:Sr.blankSlateNoAiAnswer},Le.createElement(pe,{style:[It.uiHeadingMedium,It.colorStandout]},e("search_answer_none_title")),Le.createElement(pe,{style:[It.colorBase]},e(n?"search_answer_none_details_beta":"search_answer_none_details")),o&&n?Le.createElement(j,{style:Sr.buttons},Le.createElement(Pw,{kind:"primary",leadingIcon:v.Integrations.CSS,label:"Connect integrations",onPress:()=>{r({screen:{type:"home",organization:o,query:void 0}})}}),Le.createElement(Pw,{kind:"secondary",leadingIcon:v.VSCode.CSS,label:"Record with VSCode",onPress:()=>{window.open("vscode:extension/GitBook.gitbook-vscode","_blank","noopener, noreferer")}})):null)}function YG(t){let o=ce();return Le.createElement(Is,{icon:v.Alert,title:o("search_answer_error_title")},o("search_answer_error_details"))}c();var wA=b(x());function Fb(t){let[{data:o}]=xi([t===null||t.documents?.length===0?null:t.space?No("getRecommendedQuestionsInSpace",{spaceId:t.space.key},{query:{}}):No("getRecommendedQuestions",{},{query:{},body:{documents:t.documents}})],{suspend:!1,throwOnError:!1});return wA.useMemo(()=>o?o.questions.map(e=>({type:"recommended-question",question:e})):[],[o])}c();var jG=b(x());var $G=At({key:"recentAISearches",default:[],effects:[Pr.recoilEffect("@recoil/recentAISearches",[])]});function Vb(){return tr($G)}c();var sc=b(x());function SA(t){let{allowEnterToOpen:o,target:e,onSubmitAIQuery:n}=t,r=ce(),i=Vb(),a=Fb(e),s=sc.useCallback(p=>{switch(p.type){case"recent-search":return{icon:v.Search.CSS,title:p.query,action:r("search_ask")};case"recommended-question":return{icon:v.AILens.CSS,title:p.question,action:r("search_ask")};default:Oe(p)}},[r]),l=sc.useCallback(p=>{switch(p){case"recent-search":return{title:r("search_blankslate_recent_questions")};case"recommended-question":return{title:r("search_blankslate_recommended_questions")};default:return}},[r]),u=(p,f)=>{switch(p.type){case"recent-search":{n(p.query),ne({type:"ai_search_pick_suggestion_recent_search",suggestionIndex:f});break}case"recommended-question":ne({type:"ai_search_pick_suggestion_question"}),n(p.question);break;default:Oe(p)}},d=sc.useMemo(()=>[...i.map(f=>({type:"recent-search",query:f})),...a],[i,a]);return d.length===0?sc.createElement(Is,null,r("search_blankslate_ai")):sc.createElement(j,{style:[N.flex.flex1,N.flex.column]},sc.createElement(kc,{data:d,getKey:ZG,renderItem:s,renderGroup:l,groupItem:JG,getGroupKey:QG,onOpen:u,style:[N.padding.mediumHorizontal,N.padding.mediumVertical],allowEnterToOpen:o}))}function ZG(t){switch(t.type){case"recent-search":return`recent-search:${t.query}`;case"recommended-question":return`recommended-question:${t.question}`;default:Oe(t)}}function JG(t){return t.type}function QG(t){return t}c();var CA=b(x());var eH=10,tH=At({key:"aiSearchQuery",default:{query:"",previousQueries:[]},effects:[Pr.recoilEffect("@recoil/aiSearchQuery",{query:"",previousQueries:[]})]});function kA(){let[t,o]=or(tH),e=CA.useCallback(n=>{o(r=>r?{query:n,previousQueries:[...r.previousQueries.filter(i=>i!==n&&i!==r.query),...r.query?[r.query]:[]].slice(-eH)}:{query:n,previousQueries:[]})},[o]);return[t,e]}c();var Hf=b(x());function xA(t,o,e){let n=Hf.useCallback(a=>{switch(a.type){case"ask-gitbook":{o(a.query,"click_ask_gitbook");break}default:Oe(a.type)}},[o]),r=Hf.useCallback(a=>{switch(a.type){case"ask-gitbook":return{title:a.query,icon:v.SearchOrAsk.CSS,action:"Ask GitBook",standout:!0};default:Oe(a.type)}},[]);return{suggestion:Hf.useMemo(()=>{let a=t.trim();return!e||!rH(t)?null:{type:"ask-gitbook",key:`ask-gitbook:${a}`,query:a}},[t,e]),onOpenSuggestion:n,onRenderSuggestion:r}}var oH=["who","what","where","when","why","how","explain","is","are","was","were","do","does","did","which","whom","whose","can","have","give","tell","show","find"],nH=new Set(oH);function rH(t){if(t.length>25||t.includes("?")||t.includes(" "))return!0;let o=t.toLowerCase().trim().split(/\s+/);if(o.length===0)return!1;for(let e of o)if(nH.has(e))return!0;return!1}c();var OA=b(x());c();var qb=JSON.parse('{"blockWrapper":"blockWrapper_8BIg7","pageWrapper":"pageWrapper_BkhZI"}');function E6(t){let{children:o,style:e}=t;return OA.createElement(j,{style:[qb.pageWrapper,N.margin.noneVertical,N.margin.autoHorizontal,e]},o)}c();var _A=b(x());function Od(t){let{children:o,style:e}=t;return _A.createElement(j,{style:[qb.blockWrapper,N.margin.noneVertical,N.margin.autoHorizontal,e]},o)}c();var so=b(x()),RA=b(z());var iH=Ze("app:crash");function Kf(t){let{children:o}=t,e=so.useCallback((n,r,i)=>{iH.emergency(`An error occured during rendering: `,n,` The error is located at: `,r),ne({type:"crash",crashType:Qk(n),sentryEvent:i})},[]);return so.createElement(og,{fallback:n=>so.createElement(aH,{...n}),onError:e,beforeCapture:lH},o)}function aH(t){let{eventId:o,error:e}=t,[,n]=_(uH),r=()=>{Px({eventId:o||void 0})},i=()=>{window.location.reload()};so.useEffect(()=>{document.querySelector(".gitbook-splashscreen")?.remove()},[]);let a=()=>{switch(Qk(e)){case"network-crash":return so.createElement(cH,{onReload:i,...t});case"crash":default:return so.createElement(sH,{onShareFeedback:r,onReload:i,...t})}};return so.createElement(RA.View,{style:[n.background]},a())}function sH(t){let o=ce(),{onReload:e,onShareFeedback:n}=t;return so.createElement(im,{title:o("something_wrong"),action:so.createElement(so.Fragment,null,so.createElement(W,{kind:"primary",size:"medium",onPress:e,style:g.Margin.smallRight},o("reload")),so.createElement(W,{kind:"secondary",size:"medium",onPress:n},o("let_us_know")))},o("we_have_been_notified"))}function cH(t){let{onReload:o}=t,e=ce(),n=()=>{window.open("https://docs.gitbook.com/resources/firewall-safelist","_blank")};return so.createElement(im,{title:e("connection_lost"),icon:v.CloudOff,action:so.createElement(so.Fragment,null,so.createElement(W,{kind:"primary",size:"medium",onPress:o,style:g.Margin.smallRight},e("reload")),so.createElement(W,{size:"medium",icon:v.Link,onPress:n},e("network_troubleshooting")))},e("device_offline"))}function lH(t,o){switch(Qk(o)){case"network-crash":t.setTag("error_category","network-crash");break;case"crash":default:t.setTag("error_category","react-crash")}}function Qk(t){return t.name==="FirebaseError"&&t.code==="unavailable"?"network-crash":"crash"}var uH=F.create({background:t=>({backgroundColor:t.colors.background.main,minHeight:"100vh"})});c();var mi=b(x());c();var ex=b(x());function Gb(t){let{children:o,ssrRequestPath:e,ssrRouterContext:n}=t;return n?ex.createElement(FP,{location:e,context:n},o):ex.createElement(SS,null,o)}c();var Hb=b(x());function IA(t="https://policies.gitbook.com/privacy/cookies",o=!1){let e=go(),n=ce();Hb.useEffect(()=>{if(!o)return;let r=!1;if(Wg()!==null)return;let i=e.notify({title:n("cookies"),details:n("cookie_prompt",Hb.createElement(Fa,{url:t},n("cookie_policy"))),timeout:0,icon:v.Cookies.CSS,actions:[{label:n("reject_all"),onPress:()=>{r=!0,_w(!1),i()}}],onClose:()=>{r||_w(!0)}})},[])}c();var ue=b(x()),ds=b(z());c();var PA=JSON.parse('{"withStickyHeader":"withStickyHeader_HQiM-"}');c();var Cr=b(x()),Iu=b(z());var{TOC_DESKTOP_WIDTH:dH}=Jo,pH=J.createResponsiveComponent(Iu.TouchableOpacity),mH=V.createInteractiveComponent(pH),tx=dH-g.large-g.large;function Kb(t){let{space:o,collection:e,headerBackgroundColor:n,headerLogoURL:r,mobileStyle:i,desktopStyle:a}=t,[,s]=_(D),{getNavigationLinkProps:l}=we(),d={color:Ga(n)==="light"?Z.lightModeText.base:Z.darkModeText.base},p=(e?e?.publishedTitle||e?.title:o.publishedTitle||o.title)||Aa,f=p.length>14,m=f?2:1,h=$i(o);return Cr.createElement(mH,{style:[w.directionRow,w.alignCenter],mobileStyle:i,desktopStyle:a,...l({screen:{space:o.key,page:""}}),testID:"public.headerHomeLink",accessibilityLabel:p},r?Cr.createElement(J.View,{style:[w.flex1,w.directionRow,w.alignCenter,Xf.headerDesktop],mobileStyle:Xf.logoMobile,desktopStyle:Xf.logoDesktop},Cr.createElement(J.View,{desktopStyle:"visible",mobileStyle:"hidden"},Cr.createElement(jo,{source:{uri:na(r,{height:40,fit:"contain"})},loading:"priority",style:{maxHeight:40,maxWidth:tx,width:"auto",height:"auto"}})),Cr.createElement(J.View,{desktopStyle:"hidden",mobileStyle:"visible"},Cr.createElement(jo,{source:{uri:na(r,{height:30,fit:"contain"})},style:{maxHeight:30,maxWidth:tx,width:"auto",height:"auto"}}))):Cr.createElement(Iu.View,{style:[Xf.headerDesktop,w.flex1,w.directionRow,w.justifyContentStart,w.alignCenter]},Cr.createElement(Iu.View,null,Cr.createElement(J.View,{mobileStyle:"hidden",desktopStyle:"visible"},Cr.createElement(Dw,{content:e||o,renderFor:"public-content",size:M.BUTTON_L,style:[g.Margin.mediumRight]})),Cr.createElement(J.View,{mobileStyle:"visible",desktopStyle:"hidden"},Cr.createElement(Dw,{content:e||o,renderFor:"public-content",size:M.ICON_XL,style:[g.Margin.mediumRight]}))),Cr.createElement(J.Text,{style:Xf.textOverflow,mobileStyle:[s.Heading3],desktopStyle:[f?s.Heading3:s.Heading2]},Cr.createElement(V.Text.Child,{style:[d],numberOfLines:m,ellipsizeMode:"tail",inactiveStyle:s.text,activeStyle:h==="bold"?s.textStandout:s.primary},p))))}var Xf=Iu.StyleSheet.create({textOverflow:{overflow:"hidden"},logoMobile:{height:30},logoDesktop:{height:40},headerDesktop:{maxWidth:tx}});c();var Pu=b(x()),Uf=b(z());c();var pi=b(x()),fl=b(z());var fH=J.createResponsiveComponent(V.TouchableOpacity),gH=V.createInteractiveComponent(J.View);function ox(t){return`hsla(${f1(t.colors.text.primary).h}, 60%, 70%, 0.1)`}var EA=pi.forwardRef(function(o,e){let{isLast:n,leftIcon:r,icon:i,rightIcon:a,kind:s="primary",children:l,expanded:u=!1,onChevronPress:d,active:p=!1,onPress:f,textStyle:m,href:h}=o,y=V.useInteractiveState(),[S,C]=_(hH),[,k]=_(D),O=s==="primary"?k.textMid:k.textMuted,R=p?k.primary:O,I=f?fH:gH,E=u?v.ChevronDown:v.ChevronRight;return pi.createElement(I,{ref:e,...y.events,style:[C.tocMenuItem,g.Padding.smallHorizontal,g.Margin.smallRight,n?null:g.Margin.xsmallBottom,p?{backgroundColor:ox(S)}:null],hoverStyle:f&&!p?C.tocMenuItemHovered:null,mobileStyle:C.tocMenuItemMobile,desktopStyle:C.tocMenuItemDesktop,onPress:f,href:h&&f?h:void 0},r?pi.createElement(fl.View,{style:[g.Margin.mediumRight]},pi.createElement(r,{size:M.ICON_M,style:[R,m]})):null,i?pi.createElement(fl.View,{style:[g.Margin.mediumRight]},pi.createElement(i,{size:M.ICON_M,style:[R,m]})):null,pi.createElement(fl.Text,{style:[w.flex1,g.Padding.xsmallVertical,s==="group"?k.GroupTitle:k.Label,R,m,p?k.Bold:null]},l),d?pi.createElement(fl.TouchableOpacity,{style:[w.directionRow,w.alignCenter],onPress:d},pi.createElement(E,{size:M.ICON_S,style:R})):null,a?pi.createElement(fl.View,{style:C.tocMenuItemRightIcon},pi.createElement(a,{size:M.ICON_M,style:k.textMuted})):null)}),hH=F.create({tocMenuItem:t=>({flexDirection:"row",alignItems:"center",borderColor:"transparent",borderWidth:1,borderRadius:t.radiuses.medium,minHeight:M.XS}),tocMenuItemMobile:{borderRightWidth:1},tocMenuItemDesktop:{borderRightWidth:0},tocMenuItemHovered:t=>({backgroundColor:t.colors.background.standout}),tocMenuItemRightIcon:{marginLeft:g.small,marginRight:(M.S-M.ICON_M)/2}});var nx=150,yH=200,vH=150;function Xb(t){let[,o]=_(TA);return Pu.createElement(J.View,{style:o.wrapper,mobileStyle:[o.wrapperMobile,g.Margin.smallVertical,g.Margin.smallHorizontal],desktopStyle:[o.wrapperDesktop,g.Margin.smallVertical,g.Margin.xsmallHorizontal]},Pu.createElement(Uf.ScrollView,null,t.children))}function Ub(t){let{title:o,kind:e="default",active:n=!1,onPress:r,isLast:i}=t,[a,s]=_(TA),[,l]=_(D);return Pu.createElement(V.TouchableOpacity,{hoverStyle:s.menuItemHovered,style:[s.menuItem,g.Padding.xsmallVertical,g.Padding.smallHorizontal,i?null:g.Margin.xsmallBottom,n?{backgroundColor:ox(a)}:null],onPress:r},Pu.createElement(Uf.View,{style:[w.directionRow,w.alignCenter,w.justifySpaceBetween]},Pu.createElement(V.Text.Child,{hoverStyle:n?null:l.textStandout,style:[l.Label,e==="link"?l.SemiBold:null,...n?[l.primary,l.Bold]:[l.text]],numberOfLines:2,ellipsizeMode:"tail"},o),Pu.createElement(Uf.View,{style:[g.Margin.mediumLeft]},t.rightElement)))}var TA=F.create({wrapper:t=>({backgroundColor:t.colors.background.main}),wrapperDesktop:{minWidth:nx,maxWidth:yH,maxHeight:vH},wrapperMobile:{width:"auto",maxWidth:"100%",maxHeight:"100%"},menuItem:t=>({borderRadius:t.radiuses.large}),menuItemHovered:t=>({backgroundColor:t.colors.background.muted})});c();var Cn=b(x()),Eu=b(z());function Ip(t){let{backgroundColor:o,currentPage:e,collection:n,variants:r,currentVariant:i,revision:a}=t,{getNavigationLinkProps:s}=we(),l=ce(),u=Cn.useRef(null),[,d]=_(D),p=Cn.useMemo(()=>e?to(a,e.id):"",[e]);return Cn.createElement(vc,{ref:u,wrapper:Ci,closeOnClick:!0,closeOnOutsideClick:!0,anchor:({ref:f,toggle:m,opened:h})=>{let y=h?v.ChevronUp:v.ChevronDown;return Cn.createElement(W,{ref:f,size:"medium",rightIcon:y,kind:Ga(o||Z.WHITE)?"default_bold":"default",alignItems:"start",onPress:m,style:[g.Padding.noneHorizontal]},Cn.createElement(Eu.View,{style:[MA.variantsPicker]},Cn.createElement(Eu.Text,{numberOfLines:1,ellipsizeMode:"tail"},i.publishedTitle||i.title||Aa)))}},Cn.createElement(Mn,{kind:"menu",preferredAlignment:"start"},Cn.createElement(Cn.Suspense,{fallback:Cn.createElement(Mo,{size:"small"})},Cn.createElement(Xb,null,r.map((f,m,h)=>Cn.createElement(Ub,{key:f.key,title:f.title,active:f.key===i.key,isLast:m===h.length-1,rightElement:f.key===n.primarySpace?Cn.createElement(Eu.Text,{style:[d.textMuted,d.Uppercase,MA.mainLabel]},l("main")):null,...s({screen:{space:f.key,page:p}},()=>{u.current?.close()})}))))))}var MA=Eu.StyleSheet.create({mainLabel:{letterSpacing:1.2},variantsPicker:{maxWidth:nx}});c();var gl=b(x());var bH={color:Vp,radius:Yx},Sa=gl.createContext([bH,()=>{}]),LA="@gitbook/themeMode";function wH(t,o){let[e,n]=gl.useState(()=>{if(typeof window>"u"||!t.themeModeTogglable)return o;let i=Pr.get(LA);return i!==null?i:o});return{themeMode:e,toggleThemeMode:()=>{n(i=>{let a=i==="light"?"dark":"light";return Pr.set(LA,a),ne(e1(t,{type:"public_content_toggle_theme_mode",themeMode:a})),a})}}}function NA(t){let{content:o,isPreview:e,children:n}=t,{color:r,radius:i}=$x(o),{themeMode:a,toggleThemeMode:s}=wH(o,r);gl.useEffect(()=>{window?.document.body.classList.remove("theme-overlay")},[]);let l=e?r:a??r;return ta(u=>{u.setTheme([`${l?`theme-color-${l}`:""}`,`${i?`theme-radius-${i}`:""}`].join(" "))}),gl.createElement(Sa.Provider,{value:[{color:l,radius:i},s]},n)}c();var Yb=b(x());function kn(t){let[{color:o}]=Yb.useContext(Sa);return Yb.useMemo(()=>gy(t,o),[o,t])}c();var jb=b(x());var Yf=jb.forwardRef(function(o,e){let{contentRef:n,style:r,kind:i="default",...a}=o,s=Qe(n);return jb.createElement(Fa,{ref:e,url:s.href,onPress:l=>{l.nativeEvent.metaKey||l.nativeEvent.ctrlKey||(l.preventDefault(),s.open())},kind:i,sameWebTab:!1,style:[fo.Body,fo.SemiBold,r],numberOfLines:2,ellipsizeMode:"tail",accessibilityLabel:o.title,...a},o.title)});c();var $b=b(x());function Tu(t){let{content:o,mode:e="switch"}=t,[{color:n},r]=$b.useContext(Sa),{headerBackgroundColor:i}=kn(o);return $b.createElement(yP,{onValueChange:r,value:n==="dark",mode:e,backgroundColor:i})}c();var DA=b(x());c();var AA=JSON.parse('{"publicContainer":"publicContainer_11UZS"}');function Zb(t){let{children:o,style:e}=t;return DA.createElement(j,{style:[AA.publicContainer,e]},o)}c();var cc=b(x()),ix=b(z());c();function rx(t){switch(Gh(t)){case"lightest":return{backgroundColor:"rgba(59, 69, 78, 0.1)",textColor:Z.lightModeText.base};case"light":return{backgroundColor:"rgba(255, 255, 255, 0.6)",textColor:Z.lightModeText.base};case"semiLight":return{backgroundColor:"rgba(255, 255, 255, 0.55)",textColor:Z.lightModeText.base};case"medium":return{backgroundColor:"rgba(59, 69, 78, 0.25)",textColor:Z.darkModeText.base};case"semiDark":return{backgroundColor:"rgba(59, 69, 78, 0.3)",textColor:Z.darkModeText.base};case"dark":return{backgroundColor:"rgba(59, 69, 78, 0.5)",textColor:Z.darkModeText.base};case"darkest":default:return{backgroundColor:"rgba(255, 255, 255, 0.2)",textColor:Z.darkModeText.base}}}function BA(t){let[,{open:o}]=mh(),e=ce();return cc.createElement(W,{icon:v.SearchPublic,onPress:()=>o(),accessibilityLabel:e("search"),...t})}function WA(t){let{contentTheme:o,headerBackgroundColor:e}=t,[,{open:n}]=mh(),r=ce(),{textColor:i}=rx(e);return cc.createElement(W,{icon:v.SearchPublic,size:"medium",kind:o==="bold"?"default_bold":"default",alignItems:"start",onPress:()=>n(),style:[g.Padding.noneHorizontal],defaultTextStyle:[{color:i}],accessibilityLabel:r("search")})}function Jb(t){let{headerBackgroundColor:o=Z.WHITE,hasAISearch:e=!1}=t,[,{open:n}]=mh(),r=ce(),[,i]=_(D),[,a]=_(SH),{backgroundColor:s,textColor:l}=rx(o),u=r(e?"search_placeholder_ask":"search"),d=e?v.SearchOrAsk:v.SearchPublic;return cc.createElement(V.TouchableOpacity,{style:[{backgroundColor:s},a.searchBarButton,w.directionRow,w.justifySpaceBetween,w.alignCenter,g.Padding.mediumLeft,g.Padding.smallRight],activeStyle:a.searchBarButtonActive,accessibilityLabel:u,onPress:()=>n()},cc.createElement(ix.View,{style:[w.directionRow,w.alignCenter]},cc.createElement(d,{size:M.ICON_XS,style:[{color:l},g.Margin.smallRight]}),cc.createElement(V.Text.Child,{style:[i.Label,{color:l}],activeStyle:i.text},u)),cc.createElement(ix.View,null,cc.createElement(Pn,{shortcut:qe.SEARCH_OPEN})))}var SH=F.create({searchBarButton:t=>({width:"100%",height:M.BUTTON_L,borderRadius:t.radiuses.large,borderWidth:1,borderColor:"transparent"}),searchBarButtonActive:t=>({borderColor:t.colors.border.mid})});var{PAGE_BODY_DESKTOP_H_PADDING:CH,TOC_DESKTOP_WIDTH:kH,PUBLIC_DESKTOP_HEADER_HEIGHT:xH,PUBLIC_MOBILE_HEADER_HEIGHT:OH}=Jo,_H=J.createResponsiveComponent(W),RH=J.createResponsiveComponent(ge);function FA(t){let{space:o}=t,e=bi(),{headerBackgroundColor:n,headerDisabled:r,headerLinksColor:i,headerLogoURL:a}=kn(o),s=ue.useMemo(()=>({...e,color:Ga(n)}),[n,e]);return ue.createElement(wi,{theme:s},r?ue.createElement(J.View,{desktopStyle:"hidden",mobileStyle:"visible"},ue.createElement(zA,{...t,headerDisabled:r,headerBackgroundColor:n,headerLinksColor:i,headerLogoURL:a})):ue.createElement(zA,{...t,headerDisabled:r,headerBackgroundColor:n,headerLinksColor:i,headerLogoURL:a}))}function zA(t){let{space:o,headerDisabled:e,headerBackgroundColor:n,headerLogoURL:r,headerLinksColor:i,revision:a,collection:s,collectionSpaces:l,currentPage:u}=t,[,d]=_(MH[e?"none":$i(o)==="default"?"defaultWithBorder":"default"]),p=lm(or(Pm),ue.useState(!1)),m=Wi(u).tableOfContents,h=[hl.searchWrapper,g.Padding.largeLeft,g.Padding.smallRight],[y]=ue.useContext(Sa);return ue.createElement(ue.Fragment,null,ue.createElement(RH,{tag:"header",desktopStyle:hl.desktopHeight,mobileStyle:hl.mobileHeight,style:[d.spaceHeader,w.directionRow,w.alignCenter,e?null:{backgroundColor:n}]},ue.createElement(Zb,{style:[N.padding.smallHorizontal,N.flex.alignCenter,PA.withStickyHeader]},m?ue.createElement(_H,{desktopStyle:"hidden",mobileStyle:"visible",icon:v.Menu,style:g.Margin.smallRight,kind:"grey",rounded:!0,title:p.opened?"Hide Table of Content":"Show Table of Content",onPress:p.toggle}):null,ue.createElement(Kb,{space:o,collection:s,headerBackgroundColor:n,headerLogoURL:r,mobileStyle:[hl.autoWidth,g.Padding.noneLeft,g.Padding.mediumRight,w.flexShrink1,w.justifyContentStart,m?null:g.Margin.smallLeft],desktopStyle:[hl.autoWidth,g.Padding.mediumLeft,g.Padding.largeRight,w.justifyContentStart]}),l&&s?.publishingType==="variants"?ue.createElement(J.View,{mobileStyle:"hidden",desktopStyle:"visible"},ue.createElement(Ip,{key:"variants-picker",backgroundColor:n,currentPage:u,collection:s,revision:a,variants:l,currentVariant:o})):null,ue.createElement(IH,{space:o,linkColor:i}),o.themeModeTogglable?ue.createElement(J.View,{mobileStyle:"hidden",desktopStyle:"visible"},ue.createElement(Tu,{content:o})):null,ue.createElement(wi,{theme:y},ue.createElement(J.View,{mobileStyle:"hidden",desktopStyle:"visible",style:[h,hl.searchBarContainer,w.flex1]},ue.createElement(Jb,{contentTheme:$i(o),headerBackgroundColor:n,hasAISearch:o.hasAISearch})),ue.createElement(J.View,{mobileStyle:"visible",desktopStyle:"hidden",style:[h]},ue.createElement(WA,{contentTheme:$i(o),headerBackgroundColor:n}))))),ue.createElement(J.View,{mobileStyle:"visible",desktopStyle:"hidden"},ue.createElement(wi,{theme:y},ue.createElement(TH,{space:o}))))}function IH(t){let{space:o,linkColor:e}=t;return ue.createElement(J.View,{style:[w.directionRow,w.justifyContentEnd,w.alignCenter,w.flex1,g.Padding.mediumLeft],mobileStyle:"hidden"},(o.headerLinks||[]).map((n,r,i)=>n.title?ue.createElement(PH,{key:n.title,headerLink:n,linkColor:e}):null))}function PH(t){let{headerLink:o,linkColor:e}=t,n=V.useInteractiveState({hoverDelay:250}),r=V.useInteractiveState(),i=a=>ue.createElement(Yf,{ref:a.ref,style:[g.Padding.mediumHorizontal,e?{color:e}:null],title:o.title,contentRef:o.to,...a.events});return o.links&&o.links.length>0?ue.createElement(Ba,{opened:n.hovered||r.hovered,wrapper:Ci,anchor:({ref:a})=>i({ref:a,events:n.events})},ue.createElement(Mn,{kind:"menu",preferredAlignment:"start"},ue.createElement(ds.View,{...r.events},ue.createElement(Xb,null,o.links.map((a,s,l)=>ue.createElement(EH,{key:s,link:a,isLast:s===l.length-1})))))):i({})}function EH(t){let{link:o,isLast:e}=t,n=Qe(o.to);return ue.createElement(Ub,{kind:"link",title:o.title,isLast:e,onPress:r=>{r.nativeEvent.metaKey||r.nativeEvent.ctrlKey||(r.preventDefault(),n.open())}})}function TH(t){let{space:o}=t,[e,n]=ue.useState(!1),[,{headerLinksMobile:r}]=_(LH),i=e?v.ChevronDown:v.ChevronRight;return!o.headerLinks||o.headerLinks.length===0?null:ue.createElement(ds.View,{style:[hl.headerLinksMobile,r,w.justifyContentCenter,g.Padding.medium]},ue.createElement(ds.View,{style:[hl.headerLinksMobileButton]},ue.createElement(W,{size:"large",rightIcon:i,alignItems:"start",onPress:()=>n(a=>!a),style:[g.Padding.noneHorizontal]},"Links")),e?ue.createElement(ds.View,null,o.headerLinks.map((a,s,l)=>a.title?ue.createElement(VA,{space:o,link:a,isLast:s===l.length-1}):null)):null)}function VA(t){let{link:o,space:e,isLast:n}=t,[r,i]=ue.useState(!1),a="links"in o?o.links||[]:[],s=r?v.ChevronDown:v.ChevronRight,l=$i(e);return ue.createElement(ds.View,{style:[w.directionColumn]},ue.createElement(ds.View,{style:[w.directionRow,w.alignCenter]},ue.createElement(Yf,{style:[g.Padding.smallTop,n?null:g.Padding.smallBottom],kind:l==="bold"?"bold":"default",title:o.title,contentRef:o.to}),a.length>0?ue.createElement(W,{size:"large",kind:"link",rightIcon:s,alignItems:"start",onPress:()=>i(u=>!u),style:[g.Padding.noneHorizontal]}):null),r?ue.createElement(ds.View,{style:[g.Margin.smallLeft,g.Margin.smallBottom]},a.map((u,d,p)=>ue.createElement(VA,{key:d,space:e,link:u,isLast:d===p.length-1}))):null)}var MH={none:F.create({spaceHeader:t=>({borderBottomWidth:1,borderBottomColor:t.colors.border.mid,zIndex:1})}),default:F.create({spaceHeader:{zIndex:1,position:"sticky",top:0}}),defaultWithBorder:F.create({spaceHeader:t=>({borderBottomWidth:1,borderBottomColor:t.colors.border.mid,zIndex:1,position:"sticky",top:0})})},LH=F.create({headerLinksMobile:t=>({backgroundColor:t.colors.background.main,borderBottomWidth:1,borderBottomColor:t.colors.border.main})}),hl=ds.StyleSheet.create({searchWrapper:{marginLeft:"auto"},searchBarContainer:{maxWidth:233},autoWidth:{width:"auto"},tocDesktop:{width:kH},headerLinks:{paddingHorizontal:CH-g.medium},headerLinksMobile:{minHeight:M.M},headerLinksMobileButton:{marginRight:"auto"},mobileHeight:{height:OH},desktopHeight:{height:xH}});c();var Ko=b(x());c();var zr=b(x()),Qb=b(z());c();var Ca=b(x()),yl=b(z());function qA(t){let{space:o,revision:e,page:n,analyticsContext:r}=t,i=n1(),[,a]=_(D),s=ce(),[{result:l,error:u}]=gh([YO(o.key,n.id,i)]);if(u)return null;let d=p=>{p!==l?.rating&&(ne({...r,type:"public_content_page_feedback_post",rating:p}),Wx(f=>{jO(f,{space:o.key,page:n.id,revision:e.id,visitorId:i,rating:p,previousRating:l?.rating})}))};return Ca.createElement(yl.View,{style:[w.directionRow,w.alignCenter]},Ca.createElement(yl.View,null,Ca.createElement(yl.Text,{style:[a.GroupTitle,a.textMuted]},s("was_it_helpful"))),Ca.createElement(yl.View,{style:[w.directionRow,w.alignCenter]},Ca.createElement(ax,{tooltip:s("poor_content"),active:l?.rating==="bad",rating:"bad",onPress:d}),Ca.createElement(ax,{tooltip:s("ok_content"),active:l?.rating==="ok",rating:"ok",onPress:d}),Ca.createElement(ax,{tooltip:s("excellent_content"),active:l?.rating==="good",rating:"good",onPress:d})))}function ax(t){let{active:o,tooltip:e,rating:n,onPress:r}=t;return Ca.createElement(za,{tooltip:e},(i,a)=>Ca.createElement(yl.TouchableOpacity,{ref:a,onPress:()=>r(n),style:[g.Margin.smallLeft],accessibilityLabel:e,...i.events},Ca.createElement(q2,{active:o,interactive:!0,rating:n,size:M.BUTTON_S})))}c();var ka=b(x()),Pp=b(z()),GA=b(pP());var sx=40,NH=V.createInteractiveComponent(d1);function Ep(t){return ka.createElement(_l,null,ka.createElement(AH,{...t}))}function AH(t){let{space:o,floating:e}=t,[n,r]=_(DH),[,i]=_(D),a=ce(),s=new URLSearchParams({utm_source:"content",utm_medium:"trademark",utm_campaign:o.key}),l=`https://${Ia.homepage.domain}/?${s.toString()}`,u=()=>{ne(Dt(o,{type:"public_content_click_trademark"}))};return ka.createElement(Pp.View,{style:e&&r.floatingWrapper},e?ka.createElement(GA.default,{colors:[`${n.colors.background.main}00`,n.colors.background.main],style:r.floatingTopGradient}):null,ka.createElement(Pp.View,{style:e&&[g.Padding.mediumHorizontal,g.Padding.mediumBottom,r.floatingBackground]},ka.createElement(V.TouchableOpacity,{style:[w.directionRow,w.alignCenter,...e?[r.trademarkFloating,g.Padding.smallVertical,g.Padding.mediumHorizontal]:[r.tradeMarkDefault]],activeStyle:i.primary,onPress:u,href:l,target:"_blank"},ka.createElement(NH,{size:sx,style:i.textMuted,activeStyle:i.primary}),ka.createElement(Pp.View,{style:[w.flex1,g.Padding.mediumLeft]},ka.createElement(V.Text.Child,{style:[i.Label,i.textMuted],activeStyle:i.primary},a("powered_by",ka.createElement(Pp.Text,{style:i.Bold},"GitBook")))))))}var DH=F.create({floatingWrapper:{position:"absolute",bottom:0,zIndex:1,width:"100%"},floatingTopGradient:{height:g.medium},floatingBackground:t=>({backgroundColor:t.colors.background.main}),tradeMarkDefault:t=>({backgroundColor:"transparent"}),trademarkFloating:t=>({backgroundColor:t.colors.background.standout,borderRadius:t.radiuses.xlarge})});function HA(t){let{space:o,revision:e,page:n,analyticsContext:r}=t,[,i]=_(D),[,a]=_(BH),s=ce(),l=Zp(n.edits),u=ld(n),d=!!l,p=o.hasPublicFeedback,f=!o.hideTrademark&&(u==="editorial"||u==="landing");if(!d&&!p)return null;let m=zr.createElement(yv,null,zr.createElement(zr.Suspense,{fallback:null},zr.createElement(qA,{space:o,revision:e,page:n,analyticsContext:r})));return zr.createElement(Qb.View,{style:[g.Padding.largeTop,a.footer]},zr.createElement(J.View,{tabletStyle:w.directionColumn,desktopStyle:w.directionRow,style:[w.alignCenter,w.justifySpaceBetween]},d?zr.createElement(J.View,{tabletStyle:g.Margin.mediumBottom,style:f?[]:[w.flex1]},zr.createElement(Qb.Text,{style:[i.textMuted,i.Label]},s("last_modified",zr.createElement(n_,{value:new Date(l.updatedAt),onlyDate:!1})))):null,f?zr.createElement(Ep,{space:o,floating:!1}):null,p?zr.createElement(J.View,{tabletStyle:f?"hidden":"visible",desktopStyle:"visible"},m):null),f&&p?zr.createElement(J.View,{tabletStyle:"visible",desktopStyle:"hidden",style:[w.directionRow,w.flex1,w.justifyContentCenter,g.Margin.largeTop]},m):null)}var BH=F.create({footer:t=>({borderTopColor:t.colors.border.mid,borderTopWidth:1})});c();var xa=b(x()),Tp=b(z());var WH=V.createInteractiveComponent($r),zH={[Ve]:null,[Ge]:g.Margin.smallLeft,[Eo]:null},KA=xa.memo(function(o){let{sections:e,activeSection:n}=o,[,r]=_(D),[,i]=_(XA),a=ce();return xa.createElement(Tp.View,{style:[i.pageOutline]},xa.createElement(Tp.View,{style:[w.directionRow,w.alignCenter,g.Padding.largeHorizontal,g.Margin.smallBottom]},xa.createElement(Tp.Text,{style:[r.GroupTitle,r.textMuted,r.Bold]},a("outline"))),e.map(s=>s.type===null||s.type===tt?null:xa.createElement(FH,{key:s.key,section:s,active:n===s.key})))});function FH(t){let{section:o,active:e}=t,[,n]=_(D),[,r]=_(XA),{navigateToHash:i}=we();return xa.createElement(V.TouchableOpacity,{style:[w.directionRow,g.Padding.largeHorizontal,r.sectionItem,e&&r.sectionItemActive],onPress:()=>{i(o.anchor)}},o.tag?xa.createElement(Ir,{backgroundColor:jl[o.tag]||Z.orange.base,style:[r.sectionTag,g.Margin.xsmallRight,w.alignSelfCenter]},xa.createElement(Tp.Text,{style:[n.textInsideColor,n.MobileCaption,n.Bold,n.Uppercase]},o.tag)):null,xa.createElement(WH.Child,{style:[n.Label,n.textMid,o.type&&zH[o.type],...e?[n.primary,n.Medium]:[]],hoverStyle:n.primary},o.title))}var XA=F.create({pageOutline:t=>({maxWidth:Jo.MAX_PAGE_OUTLINE_WIDTH}),sectionItem:{marginTop:g.xsmall,marginBottom:g.xsmall,marginLeft:-1,borderLeftWidth:3,borderLeftColor:"transparent",width:"fit-content",maxWidth:"100%"},sectionItemActive:t=>({borderLeftColor:t.colors.primary.main}),sectionTag:{borderRadius:M.XXS,height:M.XXS,paddingHorizontal:g.small,justifyContent:"center"}});c();var vl=b(x());function UA(t){let{space:o,page:e}=t,[{color:n},r]=vl.useContext(Sa),i=ce(),{headerDisabled:a}=kn(o),{tableOfContents:s}=Wi(e),l=!s&&a,u=[l?{key:"pageRead.switchTheme",icon:n==="light"?v.ThemeDark:v.ThemeLight,title:i(n==="light"?"switch_to_dark_theme":"switch_to_light_theme"),trigger:r}:null].filter(se),[d,p]=Hv(t,u);return vl.createElement(vl.Fragment,null,d,l&&vl.createElement(BA,{kind:"grey",size:"large",title:"Search",rounded:!0}),vl.createElement(sh,{palette:p,icon:v.MoreVertical,kind:"grey",size:"large",title:"Page actions",rounded:!0,testID:"pageToolbar.paletteButton"}))}c();var Mp=b(x());c();var Oa=b(x()),rw=b(z());c();var VH=750,qH=g.xxlarge,GH=VH+2*qH,cx=300,HH=220;function YA(t=0){return t+cx+GH+HH}c();var $f=b(x()),ew=b(z());c();var xn=b(x()),jf=b(z());function lx(t){return xn.createElement(xn.Suspense,{fallback:xn.createElement(jA,{...t})},xn.createElement(KH,{...t}))}function KH(t){let{treePage:o}=t,{page:e}=o,n=Qe(e.type==="link"?e.target:void 0);return xn.createElement(jA,{...t,contentRef:n})}function jA(t){let{revision:o,treePage:e,parent:n,currentPage:r,contentRef:i,isLastPage:a}=t,{page:s}=e,{getNavigationHref:l,navigateToPage:u}=Fc(),d=r?r.id:null,p=d===s.id,f=!!d&&aR(o,s.id,d),[m,h]=xn.useState(f),[,y]=_(XH),S=C=>{C.isDefaultPrevented()||C.nativeEvent.metaKey||C.nativeEvent.ctrlKey||(C.preventDefault(),s.type==="document"?u(o,s.id):s.type==="link"&&i?.open())};return xn.useEffect(()=>{f&&h(!0)},[f]),xn.createElement(jf.View,{style:[s.type==="group"&&g.Margin.mediumVertical]},xn.createElement(EA,{isLast:a,kind:s.type==="group"?"group":!n||n.type==="group"?"primary":"secondary",icon:s.emoji?mt(Lo,{code:s.emoji}):void 0,rightIcon:s.type==="link"?i?i.secondaryIcon:Re:void 0,active:p,expanded:m,onPress:s.type==="group"?void 0:S,href:(()=>s.type==="link"?i?.href:l(o,s.id))(),onChevronPress:e.pages.length>0&&s.type==="document"?C=>{C.preventDefault(),h(k=>!k)}:void 0},s.title),(m||s.type==="group")&&e.pages.length>0?xn.createElement(jf.View,{style:[y.tocItemChildren,...s.type==="group"?[g.Margin.noneLeft]:[g.Margin.smallLeft,g.Margin.xsmallTop,g.Margin.smallBottom]]},e.pages.map((C,k)=>xn.createElement(jf.View,{style:s.type==="group"?null:g.Margin.smallLeft,key:C.renderKey},xn.createElement(lx,{...t,treePage:C,isLastPage:k===e.pages.length-1,parent:s}))),s.type==="group"?null:xn.createElement(jf.View,{style:y.tocItemChildrenLine})):null)}var XH=F.create({tocItemChildren:{position:"relative"},tocItemChildrenLine:t=>({position:"absolute",top:0,bottom:0,left:0,width:1,backgroundColor:t.colors.border.main})});function tw(t){let{showingTrademark:o,revision:e}=t,n=$f.useMemo(()=>Ww(e.pages,e.rootPages),[e]);return $f.createElement(ew.ScrollView,{style:w.flex1,contentContainerStyle:[g.Padding.mediumVertical,o?UH.scrollviewWithTrademark:null]},n.map((r,i)=>$f.createElement(lx,{key:r.renderKey,...t,treePage:r,isLastPage:i===n.length-1})))}var UH=ew.StyleSheet.create({scrollviewWithTrademark:{paddingBottom:g.medium+sx+2*g.medium}});c();var Jn=b(x()),ow=b(z());function nw(t){let{space:o,collection:e,collectionSpaces:n,currentPage:r,revision:i}=t,[,a]=_($A),{headerBackgroundColor:s,headerLogoURL:l,headerDisabled:u}=kn(o),d=n&&e?.publishingType==="variants"?Jn.createElement(Ip,{key:"variants-picker",currentVariant:o,collection:e,variants:n,revision:i,currentPage:r}):null;return Jn.createElement(Jn.Fragment,null,u?Jn.createElement(Jn.Fragment,null,Jn.createElement(YH,{key:"space-header",space:o,collection:e,headerBackgroundColor:s,headerLogoURL:l,variantsSwitcher:d}),Jn.createElement(J.View,{mobileStyle:"hidden",desktopStyle:"visible",style:[a.searchBarSection,w.directionRow,w.justifySpaceBetween,w.alignCenter,g.Margin.mediumRight]},Jn.createElement(ow.View,{style:[w.flex1,w.directionRow,g.Margin.mediumVertical]},Jn.createElement(Jb,{key:"search-bar",headerBackgroundColor:s,hasAISearch:o.hasAISearch})),o.themeModeTogglable?Jn.createElement(ow.View,{style:[g.Margin.mediumLeft]},Jn.createElement(Tu,{content:o,mode:"button"})):null)):null)}function YH(t){let{space:o,collection:e,headerBackgroundColor:n,headerLogoURL:r,variantsSwitcher:i}=t,[,a]=_($A);return Jn.createElement(J.View,{style:[a.spaceTitleWrapper,w.directionRow,w.justifyContentCenter,w.alignCenter],mobileStyle:"hidden",desktopStyle:"visible"},Jn.createElement(Kb,{space:o,collection:e,headerBackgroundColor:n,headerLogoURL:r,desktopStyle:w.flex1}),Jn.createElement(ow.View,{style:[w.alignSelfCenter,g.Margin.smallHorizontal]},i))}var $A=F.create({searchBarSection:t=>({borderColor:t.colors.border.mid,borderBottomWidth:1}),selectedTab:t=>({borderLeftColor:t.colors.primary.main,borderLeftWidth:2}),hoverTab:t=>({backgroundColor:t.colors.background.standout}),tab:{width:"100%",flexDirection:"row",justifyContent:"center",alignItems:"center",outlineStyle:"none",borderWidth:0,borderColor:"transparent",borderLeftWidth:2,height:M.BUTTON_M,lineHeight:M.BUTTON_M,borderRadius:0,paddingHorizontal:g.medium},mainBadge:{fontFamily:p1,fontSize:Fg.xxsmall,lineHeight:M.BUTTON_M,...qg.Bold,textTransform:"uppercase",letterSpacing:1},spaceTitleWrapper:t=>({height:M.L}),variantScrollView:{flexGrow:0,flexShrink:1,height:"fit-content"}});var{PUBLIC_DESKTOP_HEADER_HEIGHT:jH}=Jo;function ZA(t){let{space:o}=t,e=ce(),{headerDisabled:n}=kn(o),[,r]=_($H[n?"none":"default"]),{desktopSidebarWidth:i}=Oa.useContext(ra),a=Oa.useMemo(()=>({[YA(i)]:"visible"}),[i]),s=!o.hideTrademark;return Oa.createElement(J.View,{testID:"page.desktopTableOfContents",mobileStyle:"hidden",desktopStyle:"visible",customBreakpointsStyles:a,style:[r.tocDesktopWrapper,w.directionRow,w.justifyContentEnd]},Oa.createElement(ge,{tag:"nav",accessibilityLabel:e("table_of_contents"),style:[ZH.tocDesktop,w.directionColumn]},Oa.createElement(rw.View,{style:[w.flex1,g.Padding.largeLeft]},Oa.createElement(nw,{...t}),Oa.createElement(tw,{...t,showingTrademark:s})),s?Oa.createElement(Ep,{floating:!0,space:o}):null))}var $H={none:F.create({tocDesktopWrapper:t=>({position:"sticky",top:0,height:"100vh",overflowY:"auto",alignSelf:"flex-start",backgroundColor:t.colors.background.main,borderRightColor:t.colors.border.mid,borderRightWidth:1})}),default:F.create({tocDesktopWrapper:t=>({position:"sticky",top:g.xxlarge,height:`calc(100vh - ${jH}px)`,overflowY:"auto",alignSelf:"flex-start",backgroundColor:t.colors.background.main,borderRightColor:t.colors.border.mid,borderRightWidth:1})})},ZH=rw.StyleSheet.create({tocDesktop:{width:cx}});c();var Vt=b(x()),Gi=b(z());var JH=J.createResponsiveComponent(Gi.Animated.View),QH=J.createResponsiveComponent(Gi.Animated.createAnimatedComponent(Gi.TouchableOpacity));function QA(t){let{currentPage:o,space:e,collection:n,collectionSpaces:r,revision:i}=t,a=ce(),s=lm(or(Pm),Vt.useState(!1)),[,l]=_(D),{sidebarMobileLeft:u,showOverlay:d}=a_(s),[p,f]=_(eD);Vt.useEffect(()=>{s.close()},[o?.id]);let m=!e.hideTrademark,h=r&&n?.publishingType==="variants"?Vt.createElement(Ip,{key:"variants-picker",currentVariant:e,collection:n,variants:r,revision:i,currentPage:o}):null,y=!!e.themeModeTogglable,S=y?Vt.createElement(Gi.View,{style:[g.Margin.mediumRight]},Vt.createElement(Tu,{content:e,mode:"button"})):null;return Vt.createElement(Tn,null,Vt.createElement(JH,{style:[f.sidebar,{left:u}],mobileStyle:"visible",desktopStyle:"hidden"},Vt.createElement(ge,{tag:"nav",accessibilityLabel:a("table_of_contents"),style:[w.directionColumn,w.flex1]},Vt.createElement(Gi.View,{style:w.flex1},Vt.createElement(eK,{key:"mobile-closing-bar",switcher:h??S}),y&&h?Vt.createElement(Gi.View,{style:[w.directionRow,w.justifySpaceBetween,w.alignCenter,g.Padding.smallVertical,g.Padding.mediumHorizontal,f.mobileChangeAppearance]},Vt.createElement(Gi.Text,{style:[l.Label,l.text]},a("theme_change_appearance")),Vt.createElement(Tu,{content:e})):null,Vt.createElement(nw,{...t}),Vt.createElement(Gi.View,{style:[g.Padding.mediumLeft,w.flex1,f.sidebarWrapper]},Vt.createElement(tw,{...t,showingTrademark:m}))),m?Vt.createElement(Ep,{floating:!0,space:e}):null)),Vt.createElement(QH,{style:[f.screenOverlay,{backgroundColor:u.interpolate({inputRange:[-ah.WIDTH.MOBILE,0],outputRange:[p.colors.backdrop.transparent,p.colors.backdrop.background]})}],mobileStyle:d?"visible":"hidden",desktopStyle:"hidden",onPress:s.closeMobile}))}function eK(t){let[,o]=_(eD),e=lm(or(Pm),Vt.useState(!1));return Vt.createElement(J.View,{style:[o.mobileClosingBar,g.Padding.smallHorizontal,w.justifySpaceBetween,w.alignCenter,w.directionRow],mobileStyle:"visible",desktopStyle:"hidden"},Vt.createElement(W,{icon:v.X,size:"large",kind:"default",onPress:()=>e.closeMobile(),style:[w.alignSelfCenter,g.Padding.smallHorizontal],accessibilityLabel:"Close"}),t.switcher)}var JA=10,eD=F.create({sidebar:t=>({backgroundColor:t.colors.background.main,width:ah.WIDTH.MOBILE,maxWidth:"100%",height:"100%",flexDirection:"row",position:"fixed",top:0,bottom:0,zIndex:JA}),sidebarWrapper:t=>({borderRightWidth:1,borderRightColor:t.colors.border.mid}),sidebarCloseButton:{position:"absolute",width:M.BUTTON_M,height:M.BUTTON_M,top:(M.M-M.BUTTON_M)/2,left:ah.WIDTH.MOBILE+M.BUTTON_M/2},screenOverlay:{position:"absolute",top:0,bottom:0,left:0,right:0,zIndex:JA-1},mobileClosingBar:t=>({height:M.L,borderBottomWidth:1,borderBottomColor:t.colors.border.mid,backgroundColor:t.colors.background.main}),mobileChangeAppearance:t=>({borderBottomWidth:1,borderColor:t.colors.border.mid})});function tD(t){return Mp.createElement(Mp.Fragment,null,Mp.createElement(ZA,{...t}),Mp.createElement(QA,{...t}))}var{PUBLIC_DESKTOP_HEADER_HEIGHT:tK}=Jo;function oD(t){let{space:o,revision:e,screen:n,analyticsContext:r,collection:i,collectionSpaces:a,assetHostname:s,currentPage:l}=t,u=ce(),[d,p]=_(oK);IP(o);let{headerDisabled:f}=kn(o),m=Wi(l),h=zI();ta(C=>{C.writeAsync([{type:"meta",name:"description",content:l&&l.description?l.description:""},{type:"meta",name:"og:description",content:l&&l.description?l.description:""},{type:"meta",name:"og:image",content:o.socialPreviewURL?na(o.socialPreviewURL,{height:640,width:1280,fit:"contain"}):rK(o,e,l)},{type:"meta",name:"twitter:card",content:"summary_large_image"}]),o.visibility==="in-collection"?(C.setTitle(l?l.title:u("page_not_found"),i?.publishedTitle||i?.title||Aa),C.writeAsync([{type:"meta",name:"robots",content:i?.visibility!=="public"?"noindex, nofollow":"index"}])):(C.setTitle(l?l.title:u("page_not_found"),o.publishedTitle||o.title||Aa),C.writeAsync([{type:"meta",name:"robots",content:o.visibility!=="public"?"noindex, nofollow":"index"}]))}),rd(l?Bg(o,l,{screen:"space",visibility:o.visibility,pageLayout:ld(l),diffMode:!1}):Dt(o,{screen:"space_page_notfound",visibility:o.visibility}),[o.key,l?.id]),JP(o,l?.id??null);let y=!!m.tableOfContents,S=!!m.outline;if(!l&&n.page){let[C]=k_([QO(o.key,n.page)]);if(C&&e.pages[C.page])return Ko.default.createElement(_T,{to:to(e,C.page)})}return Ko.default.createElement(Ko.default.Fragment,null,Ko.default.createElement(iK,{space:i||o,assetHostname:s}),Ko.default.createElement(J.View,{style:[w.flex1,p.spacePageContainerBg],mobileStyle:w.directionColumn,desktopStyle:w.directionRow},Ko.default.createElement(Zb,null,y?Ko.default.createElement(tD,{space:o,revision:e,currentPage:l?.type==="document"?l:null,analyticsContext:r,collection:i,collectionSpaces:a}):null,Ko.default.createElement(Ir,{style:[p.spacePageBody],backgroundColor:d.colors.background.main},Ko.default.createElement(Ko.default.Suspense,{fallback:Ko.default.createElement(Gv,{withPageOutline:l?.layout!=="landing"})},l&&l.type==="document"?Ko.default.createElement(Vv,{screen:n,key:nK(n,e,l),space:o,changeRequest:void 0,revision:e,page:l,scrollRef:h,readOnly:!0,withComments:!1,withToC:y,analyticsContext:r,outline:S?KA:void 0,toolbar:UA,footer:Ko.default.createElement(HA,{space:o,revision:e,page:l,analyticsContext:r}),sideColumnStickyTop:g.large+(f?0:tK)}):Ko.default.createElement(x0,{statusCode:404},Ko.default.createElement(im,{title:u("page_not_found"),action:Ko.default.createElement(h_,{kind:"secondary",size:"medium",to:{screen:{type:"space",space:o.key,page:""}}},u("back_to_home"))},u("page_not_found_long"))))))))}var oK=F.create({spacePageContainerBg:t=>({backgroundColor:t.colors.background.main}),spacePageBody:{flex:1}});function nK(t,o,e){let n=t.space;return n+=`/${t.changeRequest||"main"}`,n+=`/${o.conflicts?"conflicts":"normal"}`,n+=`/${e.id}`,t.diff&&(n+="/diff"),t.revision&&(n+="/revision"),n}function rK(t,o,e){let n=e&&o.rootPages[0]!==e.id?`/page/${e.id}`:"",{primaryColor:r,headerLogoURL:i}=gy(t),a=$i(t),s=`color=${encodeURIComponent(r||"")}&logo=${encodeURIComponent(gc(i||t.iconURL||""))}&theme=${encodeURIComponent(a||"")}`;return`${rg()}/share/space/thumbnail/${t.key}${n}.png?${s}`}function iK(t){let{space:o,assetHostname:e}=t,n=ZO(o,"public-content"),[r]=_(),[i,a]=Ko.default.useState(n.iconURL||(n.emoji?`${e}${s_(n.emoji)}`:null));return Ko.default.useEffect(()=>{if(i)return;let s=192,l=document.createElement("canvas"),u=l.getContext("2d");if(!u)return;l.width=s,l.height=s,u.fillStyle=r.colors.background.main,u.fillRect(0,0,s,s);let d=.7;u.fillStyle=r.colors.text.main,u.font=`400 ${s*d}px gitbook-content-font`,u.textAlign="center",u.textBaseline="middle",u.fillText(o.title.slice(0,1),s/2,s/2),a(l.toDataURL("image/png"))},[o.title,a]),ta(s=>{s.writeAsync([{type:"link",rel:"icon",href:i?gc(i):`${e}/public/images/icon-512.png`},{type:"link",rel:"apple-touch-icon",href:i?gc(i):`${e}/public/images/icon-512.png`}])}),null}c();var Ne=b(x()),kr=b(z());var aK=J.createResponsiveComponent(ge),nD=200,sK=4*(nD+g.small);function rD(t){let{space:o,collection:e}=t,[,n]=_(D),[,r]=_(uK),i=Ne.useMemo(()=>o?.footer||e?.footer,[o,e]);return Ne.createElement(Ne.Fragment,null,i?Ne.createElement(aK,{tag:"footer",style:[w.alignCenter,r.footer]},Ne.createElement(J.View,{desktopStyle:[ps.desktopContainer]},Ne.createElement(J.View,{desktopStyle:w.directionRow,mobileStyle:w.directionColumn},i?.logoURL?Ne.createElement(J.View,{style:[w.directionRow,w.alignStart,g.Padding.xlargeTop,i?.copyright?null:g.Padding.xlargeBottom],desktopStyle:g.Margin.xxlargeHorizontal,mobileStyle:g.Margin.largeHorizontal},Ne.createElement(J.View,{desktopStyle:"visible",mobileStyle:"hidden"},Ne.createElement(jo,{source:{uri:i?.logoURL},style:ps.footerImageDesktop,loading:"lazy"})),Ne.createElement(J.View,{desktopStyle:"hidden",mobileStyle:"visible"},Ne.createElement(kr.View,{style:g.Margin.largeLeft},Ne.createElement(jo,{source:{uri:i?.logoURL},style:ps.footerImageMobile,loading:"lazy"})))):null,i?.linkGroups?Ne.createElement(J.View,{style:[g.Padding.xlargeTop,i.logoURL?w.alignStart:w.alignCenter,w.flex1,i?.copyright?null:g.Padding.xlargeBottom],mobileStyle:w.alignStart,tabletStyle:g.Padding.largeLeft},Ne.createElement(J.View,{mobileStyle:"hidden",tabletStyle:"hidden",desktopStyle:i.linkGroups.length<3&&!i.logoURL?"visible":"hidden"},Ne.createElement(cK,{linkGroups:i.linkGroups})),Ne.createElement(J.View,{mobileStyle:"visible",tabletStyle:"visible",desktopStyle:i.linkGroups.length>=3||i.logoURL?"visible":"hidden"},Ne.createElement(lK,{linkGroups:i.linkGroups}))):null),i?.copyright?Ne.createElement(J.View,{style:[w.flex1,g.Padding.xlargeVertical]},Ne.createElement(kr.Text,{style:[ps.copyright,n.textMuted]},i?.copyright)):null)):null)}function cK(t){let{linkGroups:o}=t,[,e]=_(D),n=[],r=o?.map(({title:i})=>i);return o?.forEach(i=>{i?.links?.forEach((a,s)=>{if(n[s]===void 0)return n[s]=[a];n[s].push(a)})}),Ne.createElement(kr.View,{style:[w.flex1,w.justifyContentStart,w.directionRow]},Ne.createElement(kr.View,{style:ps.linkGroupColumnDesktop},Ne.createElement(kr.View,{style:[w.flex1]},r?.map((i,a)=>Ne.createElement(kr.View,{key:i,style:[w.alignStart,a>0?g.Margin.smallTop:null]},Ne.createElement(kr.Text,{style:[e.text,e.Heading3]},i))))),n.map((i,a)=>Ne.createElement(kr.View,{key:a,style:ps.linkGroupColumnDesktop},Ne.createElement(iD,{links:i,renderMode:"horizontal"}))))}function lK(t){let{linkGroups:o}=t,[,e]=_(D);return Ne.createElement(J.View,{style:[w.flex1,w.justifyContentStart,w.directionRow],desktopStyle:[ps.linkGroupColumnsDesktop,w.directionRow,w.wrap,w.flexShrink1],mobileStyle:w.directionColumn},o.map((n,r)=>Ne.createElement(J.View,{key:r,desktopStyle:[ps.linkGroupColumnDesktop,g.Margin.xlargeTop],mobileStyle:[ps.linkGroupColumnMobile,g.Margin.xlargeTop,g.Margin.largeLeft]},Ne.createElement(kr.View,{style:w.alignStart},Ne.createElement(kr.Text,{style:[e.text,e.Heading3]},n.title)),Ne.createElement(iD,{links:n.links,renderMode:"vertical"}))))}function iD(t){let{links:o,renderMode:e}=t,[,n]=_(D);return Ne.createElement(J.View,{style:[w.alignStart,w.flex1,w.directionColumn],desktopStyle:e==="vertical"?g.Margin.largeTop:null,mobileStyle:g.Margin.smallTop},(o||[]).map((r,i)=>{let a=i===o.length-1;return r.title?Ne.createElement(Ne.Suspense,{fallback:null,key:r.title},Ne.createElement(kr.View,{style:[ps.referenceLink,e==="horizontal"&&i>0?g.Margin.smallTop:null]},Ne.createElement(Yf,{title:r.title,contentRef:r.to,style:[n.textMuted,n.Medium,e==="horizontal"?null:[g.Padding.smallTop,a?null:g.Padding.smallBottom]]}))):null}))}var uK=F.create({footer:t=>({backgroundColor:t.colors.background.mid})}),ps=kr.StyleSheet.create({linkGroupColumnsDesktop:{maxWidth:sK,marginTop:-g.xlarge},linkGroupColumnDesktop:{width:nD,marginLeft:g.small,paddingRight:g.xlarge},linkGroupColumnMobile:{width:"auto"},desktopContainer:{maxWidth:1280,width:"100%"},copyright:{textAlign:"center"},mobileHeight:{height:"auto"},referenceLink:{maxWidth:"100%"},footerImageDesktop:{maxHeight:150,maxWidth:150,objectFit:"contain"},footerImageMobile:{maxHeight:30,maxWidth:30,objectFit:"contain"}});c();var rn=b(x());c();var nn=b(x());c();var Zf=b(x());function aD(t){let{query:o,space:e,onUpdateQuery:n,onSubmitAIQuery:r,allowEnterToOpen:i}=t,a=Zf.useCallback(()=>{n("")},[n]);return o.query?Zf.createElement(bA,{target:{space:e},query:o,onAnswerLoaded:a,onSubmitQuery:r}):Zf.createElement(SA,{target:{space:e},onSubmitAIQuery:r,allowEnterToOpen:i})}c();var ux=b(x());c();var lc=b(x());function sD(t){let{space:o,onUpdateQuery:e,onSubmitAIQuery:n}=t,r=ce(),i=cA(),a=Vb(),s=Fb(o.hasAISearch?{space:o}:null),l=lc.useCallback(f=>{switch(f.type){case"recent-search":return{icon:v.Search.CSS,title:f.query,action:r("search")};case"recent-question":return{icon:v.SearchOrAsk.CSS,title:f.question,action:r("search_ask")};case"recommended-question":return{icon:v.SearchOrAsk.CSS,title:f.question,action:r("search_ask")};default:Oe(f)}},[r]),u=lc.useCallback(f=>{switch(f){case"recent-search":return{title:r("search_blankslate_recent_searches")};case"recent-question":return{title:r("search_blankslate_recent_questions")};case"recommended-question":return{title:r("search_blankslate_recommended_questions")};default:return}},[r]),d=(f,m)=>{switch(f.type){case"recent-search":{e(f.query),ne(Dt(o,{type:"search_pick_suggestion_recent_search",suggestionIndex:m}));break}case"recent-question":{n(f.question),ne(Dt(o,{type:"ai_search_pick_suggestion_recent_search",suggestionIndex:m}));break}case"recommended-question":ne(Dt(o,{type:"search_pick_suggestion_question"})),n(f.question);break;default:Oe(f)}},p=lc.useMemo(()=>{let f=o.hasAISearch?a.map(h=>({type:"recent-question",question:h})):[],m=i.filter(h=>!a.includes(h)).map(h=>({type:"recent-search",query:h}));return[...f,...m,...s]},[i,a,s,o.hasAISearch]);return p.length===0?lc.createElement(Is,null,r("search_blankslate")):lc.createElement(j,{style:[N.flex.flex1,N.flex.column]},lc.createElement(kc,{data:p,getKey:dK,renderItem:l,renderGroup:u,groupItem:pK,getGroupKey:mK,onOpen:d,style:[N.padding.mediumHorizontal,N.padding.mediumBottom]}))}function dK(t){switch(t.type){case"recent-search":return`recent-search:${t.query}`;case"recent-question":return`recent-question:${t.question}`;case"recommended-question":return`recommended-question:${t.question}`;default:Oe(t)}}function pK(t){return t.type}function mK(t){return t}c();var uc=b(x());function cD(t){let{space:o,hasAI:e,onSubmitAIQuery:n=()=>{}}=t,r=uc.useDeferredValue(t.query),i=ce(),{navigate:a}=we(),s=xA(r,n,e),l=G_({query:r,types:["pages","sections"],hitsPerPage:30,analyticsTags:[{type:"space",space:o.key}]}),u=s.suggestion?[s.suggestion,...l]:l,d=uc.useCallback(m=>{if(m.type==="ask-gitbook")return s.onRenderSuggestion(m);switch(m.type){case"page":return{title:m.title,icon:v.Page.CSS,subtitle:m.ancestors.filter(h=>h.type!=="group"&&h.id!==m.page.id).map(h=>h.title).join(" \u203A "),action:i("search_goto_page")};case"section":return{title:m.title,body:m.body,icon:v.Hash.CSS,nested:!0,action:i("search_goto_section")};default:throw new Error("Unexpected item type")}},[i,r,s.onRenderSuggestion]),p=uc.useCallback(m=>{if(m)return{title:m?.page?.title}},[]),f=uc.useCallback((m,h)=>{if(m.type==="ask-gitbook")return s.onOpenSuggestion(m);if(!(m.type!=="page"&&m.type!=="section"))switch(ne(Dt(o,{type:"public_content_search_open_result",resultType:m.type,resultIndex:h})),m.type){case"page":a({screen:{type:"space",space:m.space.key,page:m.path,hash:void 0,query:void 0}});break;case"section":a({screen:{type:"space",space:m.space.key,page:m.path,hash:m.anchor,query:void 0}});break;default:Oe(m)}},[r,s.onOpenSuggestion]);return u.length===0?uc.createElement(Is,null,i("search_blankslate_query",r)):uc.createElement(kc,{data:u,getKey:fK,renderItem:d,renderGroup:p,groupItem:hK,getGroupKey:gK,onOpen:f,style:[N.padding.mediumHorizontal,N.padding.mediumBottom]})}function fK(t){return t.key}function gK(t){return t?t.type==="ask-gitbook"?t.type:t.page.id:""}function hK(t){return t.type==="ask-gitbook"?{type:"ask-gitbook"}:t.groups.find(o=>o.type==="page")}function lD(t){let{space:o,query:e,onUpdateQuery:n,onSubmitAIQuery:r}=t;return lA(e),dA(e,{space:o}),e?ux.createElement(cD,{space:o,query:e,hasAI:o.hasAISearch,onSubmitAIQuery:r}):ux.createElement(sD,{space:o,onUpdateQuery:n,onSubmitAIQuery:r})}function uD(t){let{space:o}=t,[e,{open:n,close:r,setQuery:i}]=y_();return Jr({[qe.SEARCH_OPEN]:()=>{n()},"/":()=>{n()}},["all"],[]),nn.createElement(I1,null,typeof e=="string"?nn.createElement(yK,{space:o,query:e,setQuery:i,close:r}):null)}function yK(t){let{space:o,query:e,setQuery:n,close:r}=t,i=ce(),a=nn.useRef(null),[s,l]=kA(),[u,d]=nn.useState(!1);rd({screen:"search",searchType:"search"},[]);let p=nn.useCallback(h=>{n(h),a.current?.focus()},[n,a]),f=h=>{d(!1),n(h)},m=nn.useCallback(h=>{o.hasAISearch&&(d(!0),n(h),l(h),a.current?.focus(),ne(Dt(o,{type:"ai_search_submit",query:h,trigger:"press_enter"})))},[!o.hasAISearch,n,l,a]);return nn.createElement(u_,{ref:a,inputIcon:o.hasAISearch?v.SearchOrAsk.CSS:v.Search.CSS,rightButton:o.hasAISearch?nn.createElement(j,{style:[N.flex.row,N.flex.alignCenter]},u&&e&&e!==s.query?nn.createElement(j,{style:[N.margin.mediumRight,N.flex.row,N.flex.alignCenter]},nn.createElement(j,{style:N.margin.xsmallRight},nn.createElement(pe,{style:[N.text.caption,N.textColor.muted]},"Enter")),nn.createElement(v.ArrowEnter.CSS,{style:[N.icons.xsmall,N.textColor.muted]})):null):null,query:e,onQueryChange:f,onSubmitQuery:m,onClose:r,queryPlaceholder:o.hasAISearch?i("search_placeholder_ask"):i("search_placeholder")},!u||!o.hasAISearch?nn.createElement(lD,{query:e,space:o,onUpdateQuery:p,onSubmitAIQuery:m}):nn.createElement(aD,{query:s,space:o,onUpdateQuery:p,onSubmitAIQuery:m,allowEnterToOpen:e.length===0}))}c();var iw=b(x());var Lp=new Map;typeof window<"u"&&(window.GitBook=window.GitBook||{addEventListener:(t,o)=>{Lp.has(t)||Lp.set(t,[]),Lp.get(t).push(o)},removeEventListener:(t,o)=>{if(!Lp.has(t))return;let e=Lp.get(t),n=e.indexOf(o);n!==-1&&e.splice(n,1)}});function dD(t,...o){let e=Lp.get(t);e&&e.forEach(n=>{n(...o)})}function pD(t){if(iw.useContext($o).mode!=="public-content")throw new Error("useInjectIntegrationsScripts can only be used in public-content mode");iw.useEffect(()=>(dD("load"),()=>{dD("unload")}),[t.key])}function aw(t){let{space:o,assetHostname:e,collection:n,collectionSpaces:r,usesCookies:i}=t,{locale:a}=rn.useContext($o),{screen:s}=Va(),l=Ce(),u=QP(o.key,s),d=s.type==="space"&&typeof s.changeRequest=="string";if(d&&!u)throw new Yi.NotFound("Change request not found");let p=s.type==="space"&&s.revision,f=d&&u?u.revisionCurrent:p&&s.revision||o.revision,m=Xr(l.store.getRevision(o.key,f));if(!m)throw d?new Yi.NotFound("Change request not found"):s.type==="space"&&s.revision?new Yi.NotFound("Revision not found"):new Error("Expected revision");eE(o),pD(o);let h=rn.useMemo(()=>Dt(o,{}),[o.key,o.organization,o.collection]);if(s.type!=="space"||s.space!==o.key)throw new Error("screen should be the space we render");rn.useEffect(()=>{if(o.searchKey)return O_(o.searchKey)},[o.searchKey]),ta(k=>{k.write({type:"font",font:o.font||"Inter",fontFamilyName:"gitbook-content-font"}),(s.revision||s.changeRequest||s.sideSheet)&&k.write({type:"meta",name:"robots",content:"noindex"}),k.setLang(a)}),IA(o.privacyPolicyURL,hS(o)||i);let[y,S]=K_(m,s.page),C={space:o.key,...S?{page:S.id}:{},...u?{changeRequest:u.key}:{revision:m.id}};return rn.createElement(rn.Fragment,null,y?rn.createElement(ph,{to:{screen:y}}):null,rn.createElement(LE,{value:C},rn.createElement(FA,{space:o,revision:m,collection:n,currentPage:S,collectionSpaces:r}),rn.createElement(oD,{space:o,revision:m,screen:s,analyticsContext:h,collection:n,collectionSpaces:r,assetHostname:e,currentPage:S}),rn.createElement(rD,{space:o,collection:n}),rn.createElement(uD,{space:o}),rn.createElement(V2,null),rn.createElement(mA,{content:o,contentRef:ea(o.key)})))}c();var dx=b(x());c();function Np(t){return t?t.endsWith("/")?t:`${t}/`:""}function mD(t,o){return e=>{let n=`/${Np(t.basePath)}`;switch(e.type){case"back_office":case"account":case"error_notfound":case"org_invite":case"org_join":case"org_settings":case"root":case"join":case"account_verification":case"integrations":case"import":case"template":case"welcome":case"contentkit_builder":case"snippet":case"snippets":case"trash":throw new Error(`Cannot navigate to ${e.type} on public content`);case"home":{if(e.organization){let i=id.read({type:"organization",organization:e.organization});n=om(i);break}throw new Error("Cannot navigate to home without an org on public content")}case"user":{let i=UO(e.user);n=om(i);break}case"collection":{let i=id.read({type:"collection",collection:e.collection});n=om(i);break}case"space":{let i=id.read({type:"space",space:e.space});i.hostname===t.hostname&&(!t.basePath||i.pathname.startsWith(t.basePath))||o?(t.shareLink&&(n+=Np(t.shareLink)),i.pathname!==t.basePath&&(t.basePath?n+=Np(Kx(i.pathname,Np(t.basePath))):n+=Np(i.pathname))):n=om(i),n+=vK(e);break}case"legacy_space":case"legacy_account":throw new Error("Cannot navigate to legacy urls");default:Oe(e)}let r;if(typeof e.query=="string"){let i=new URLSearchParams;i.set("q",e.query),r=`?${i.toString()}`}return{pathname:n,hash:e.hash,search:r}}}function vK(t){let o="";return t.revision&&(o+=`~/revisions/${t.revision}/`),t.changeRequest&&(o+=`~/changes/${t.changeRequest}/`),o+=`${t.page[0]==="/"?t.page.slice(1):t.page}`,t.sideSheet&&(o=`${Np(o)}~/${t.sideSheet.type}${"tab"in t.sideSheet?`/${t.sideSheet.tab}`:""}`),o}c();function fD(t,o,e,n=[]){return r=>{let{spaceKey:i,pathname:a}=Jx({currentSpaceKey:o,collectionSpaces:n,collection:e,pathname:r.pathname,paths:t}),s={type:"space",space:i,page:""};bK(s,qO(a)),r.hash&&(s.hash=r.hash.replace(/^#/,""));let u=new URLSearchParams(r.search).get("q");return typeof u=="string"&&(s.query=u),s}}function bK(t,o){kw(o,[{path:`/~/revisions/:revision/:page${Tg}`,onMatch:e=>{Object.assign(t,{page:e.params.page,revision:e.params.revision}),Ap(t,e,o)}},{path:"/~/revisions/:revision",onMatch:e=>{Object.assign(t,{revision:e.params.revision,page:""}),Ap(t,e,o)}},{path:`/~/changes/:changeRequest/:page${Tg}`,onMatch:e=>{Object.assign(t,{changeRequest:e.params.changeRequest,revision:void 0,page:e.params.page}),Ap(t,e,o)}},{path:"/~/changes/:changeRequest",onMatch:e=>{Object.assign(t,{changeRequest:e.params.changeRequest,revision:void 0,page:""}),Ap(t,e,o)}},{path:`/:page${Tg}`,onMatch:e=>{Object.assign(t,{page:e.params.page,diff:!1}),Ap(t,e,o)}},{path:"/",onMatch:e=>{Object.assign(t,{diff:!1,page:""}),Ap(t,e,o)}}])}function Ap(t,o,e){kw(e,[{path:"/~/share/pdf",onMatch:n=>{Object.assign(t,{sideSheet:{type:"share",tab:"pdf"}})}}],{prefix:o.path})}function sw(t,o,e,n,r){let i=HP(),a=(0,dx.useMemo)(()=>fD(t,e,n,r),[t.hostname,t.basePath,t.shareLink,e,n,r]),s={hostname:t.hostname,pathname:t.basePath},l=(0,dx.useMemo)(()=>mD({hostname:s.hostname,basePath:s.pathname,shareLink:t.shareLink},o),[t.hostname,t.basePath,t.shareLink]);return{forceHardNavigation:!i,getNavigationScreenFromLocation:a,getLocationForNavigationScreen:l}}function gD(t){let{space:o,ssrRequestPath:e,ssrRouterContext:n,basePath:r,hostname:i,customToken:a,shareLink:s,assetHostname:l,preview:u=!1,usesCookies:d=!1}=t,p=sw({hostname:i,basePath:r,shareLink:s},u,o.key),{primaryColor:f}=kn(o);return mi.createElement(um,{mode:"public-content",preview:u,locale:o.language},mi.createElement(mi.Suspense,{fallback:mi.createElement(Mo,{size:"large"})},mi.createElement(_l,{primaryColor:f},mi.createElement(Kf,null,mi.createElement(Gb,{ssrRequestPath:e,ssrRouterContext:n},mi.createElement(dh,{persist:!1,...p},mi.createElement(my,null,a&&typeof window>"u"?mi.createElement(Mo,{size:"large"}):mi.createElement(aw,{space:o,assetHostname:l,usesCookies:d}))))))))}c();var On=b(x());function hD(t){let{collection:o,basePath:e,hostname:n,customToken:r,collectionSpaces:i,ssrRequestPath:a,ssrRouterContext:s,shareLink:l,assetHostname:u,preview:d=!1,usesCookies:p=!1}=t,f=sw({hostname:n,basePath:e,shareLink:l},d,void 0,o,i),{primaryColor:m}=kn(o);if(!d&&o.publishingType!=="variants")throw new Error("we do not know how to render anything else than variants for now");return On.createElement(um,{mode:"public-content",preview:d,locale:o.language},On.createElement(_l,{primaryColor:m},On.createElement(Kf,null,On.createElement(Gb,{ssrRequestPath:a,ssrRouterContext:s},On.createElement(dh,{persist:!1,...f},On.createElement(On.Suspense,{fallback:On.createElement(Mo,{size:"large"})},On.createElement(my,null,r&&typeof window>"u"?On.createElement(Mo,{size:"large"}):On.createElement(wK,{collection:o,collectionSpaces:i,assetHostname:u,usesCookies:p}))))))))}function wK(t){let{screen:o}=Va();if(o.type!=="space")throw new Error("screen should be a space");let[e]=xc([ea(o.space)]);if(!e)throw new Error("the space should exist");let{primaryColor:n}=kn(e);return On.createElement(um,{locale:e.language},On.createElement(_l,{primaryColor:n},On.createElement(Kf,null,On.createElement(aw,{...t,space:e}))))}c();var xr=b(x()),wD=b(z());c();var px=b(x());async function SK(t){let o=await Ms(),{data:e}=await o.hive.generateSpaceHiveReadAccessToken(t);return Object.values(e.contents)}function yD(t){return t.client?px.createElement(eS,{client:t.client},t.children):px.createElement(eS,{endpoint:X_(),fetchContentAuthToken:SK,store:t.store},t.children)}c();var Mu=b(x());var mx=Ze("preview:child");function vD(t,o){let[e,n]=Mu.useState(t),[r,i]=Mu.useState(void 0);return CK(e.footer),Mu.useEffect(()=>{o&&(window.addEventListener("message",a=>{if(a.data.source!=="gitbook-preview-parent"||(mx.info("receive message",a.origin,a.data),a.origin!==rg()&&a.origin!=="http://127.0.0.1:5001"))return;let s=zx(a.data.payload),l=a.data.previewID;mx.debug("update content with",s),n(s),i(l),window.parent.postMessage({source:"gitbook-preview-child"},"*")}),mx.info("notify parent that we are ready"),window.parent.postMessage({source:"gitbook-preview-child"},"*"))},[o]),[e,r]}function CK(t){let o=Mu.useRef(t);Yu(()=>{t&&t!==o.current&&window.scrollTo({left:0,top:document.body.scrollHeight,behavior:"smooth"}),o.current=t},[t])}c();var bD=b(x());function fx(){bD.useEffect(()=>{typeof window>"u"},[])}function gx(t){let o="collection"in t?t.collection:t.space,[e,n]=vD(o,!!t.preview),r=t.hive&&t.hive.client?{client:t.hive.client}:{store:t.hive?.contentStore};return fx(),xr.createElement(Sx,null,xr.createElement(NA,{content:e,isPreview:!!t.preview},xr.createElement(yD,{...r},xr.createElement(kK,{...t,content:e,previewID:n}))))}function kK(t){let{content:o,previewID:e}=t;fx();let[n]=xr.useContext(Sa);return xr.createElement(wi,{theme:n},xr.createElement(y1,{theme:n},xr.createElement(ST,null,xr.createElement(kP,null,xr.createElement(C1,{enabled:!0},"collection"in t?xr.createElement(hD,{...t,collection:o}):xr.createElement(gD,{...t,space:o})),e?xr.createElement(wD.View,{testID:e}):null))))}c();function hx(t){let o=new URLSearchParams(window.location.search),e=window.location.hash;if(o.has("jwt_token")){o.delete("jwt_token");let i=o.toString();window.history.replaceState({},"",`${window.location.pathname}${i?`?${i}`:""}${e||""}`)}let{dsn:n,tracesSampling:r}={...Ia.sentry,...Ia.sentry.publicContent};Ix({dsn:n,release:Ax,projectId:Ia.firebase.projectId,tracesSampling:r}),window.location.hostname!=="127.0.0.1"&&HO(t.hostname),GP({customToken:t.customToken,waitUserReady:!1})}c();function SD(t){t?.firestore&&El.fromJS(t.firestore),t?.head&&u1.cache.fromJS(t.head),t?.contentURLs&&id.fromJS(t.contentURLs),t?.contentRefs&&sa.fromJS(t.contentRefs),t?.screenToContentRefs&&by.fromJS(t.screenToContentRefs),t?.swaggers&&Ql.fromJS(t.swaggers),t?.api&&b_.fromJS(t.api)}c();var CD=Ze("browser-compatibility");function kD(){let t=["webcache.googleusercontent.com","translate.googleusercontent.com","translate.google.com"];return!window.location.hostname||t.includes(window.location.hostname)?(CD.warning("The application is served over an unsupported hostname and has been made static."),!1):xK()?!0:(CD.warning("Your browser is missing required features, the application has been made static."),!1)}function xK(){try{if("\u212B".normalize("NFKD")!=="A\u030A")return!1}catch{return!1}return!(!window.Intl||![].flat)}c();function xD(t){document.readyState==="interactive"||document.readyState==="complete"?t():document.addEventListener("DOMContentLoaded",()=>{t()})}c();var OD=b(BD());function yx(t){return new hs("ssr.deserializeFromHTML").wrapSync(()=>{let e=OD.default.decompress(t);return e?JSON.parse(e):null})}kD()&&xD(()=>{OK()});async function OK(){let t=window.__GITBOOK_INITIAL_PROPS__,o=yx(t);hx(o),window.__GITBOOK_LAZY_MODULES__&&await G1(window.__GITBOOK_LAZY_MODULES__);let e=window.__GITBOOK_INITIAL_STATE__,n=yx(e);n?(SD(n),vx.AppRegistry.registerComponent("PublicContentApplication",()=>gx),vx.AppRegistry.runApplication("PublicContentApplication",{hydrate:!0,rootTag:document.querySelector(".gitbook-root"),initialProps:o})):console.error("Invalid state received from server, content won't be interactive")} /*! Bundled license information: statuses/index.js: (*! * statuses * Copyright(c) 2014 Jonathan Ong * Copyright(c) 2016 Douglas Christopher Wilson * MIT Licensed *) rangefix/rangefix.js: (*! * RangeFix v0.2.9 * https://github.com/edg2s/rangefix * * Copyright 2014-17 Ed Sanders. * Released under the MIT license *) */ //# sourceMappingURL=https://app.gitbook.com/public/app/public-DA4XA2HC.min.js.map