@kizenapps/cli 0.12.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/dist/index.js +1374 -605
  2. package/dist/index.js.map +1 -1
  3. package/dist/viewer/assets/AppDetailPage-Bh4FLKqJ.js +1 -0
  4. package/dist/viewer/assets/AppDetailPage-BoFB93TE.js +1 -0
  5. package/dist/viewer/assets/AppDetailPage-Ck_VyLCS.js +1 -0
  6. package/dist/viewer/assets/BootstrapContext-CL_onTG7.js +1 -0
  7. package/dist/viewer/assets/BootstrapContext-c_1rWAfc.js +1 -0
  8. package/dist/viewer/assets/Card-BpDJPrPZ.js +1 -0
  9. package/dist/viewer/assets/Card-C7KVwKfm.js +1 -0
  10. package/dist/viewer/assets/CodeStepsPage-BHbbvjvr.js +1 -0
  11. package/dist/viewer/assets/CodeStepsPage-DnjVkPGB.js +1 -0
  12. package/dist/viewer/assets/CodeStepsPage-vHoGY4qA.js +1 -0
  13. package/dist/viewer/assets/CodeViewer--wbTev7Q.js +4 -0
  14. package/dist/viewer/assets/CodeViewer-Cm7Th9pG.js +4 -0
  15. package/dist/viewer/assets/ConfigurationPage-DAVSSfuO.js +1 -0
  16. package/dist/viewer/assets/ConfigurationPage-_PScSEXP.js +1 -0
  17. package/dist/viewer/assets/ConfigurationPage-zSJDg1f4.js +1 -0
  18. package/dist/viewer/assets/CredentialsContext-Rkt9WDIb.js +1 -0
  19. package/dist/viewer/assets/CredentialsContext-k-q4M-VC.js +1 -0
  20. package/dist/viewer/assets/{DevSidebar-BhTD2bBO.js → DevSidebar-CKdTotWS.js} +1 -1
  21. package/dist/viewer/assets/DevSidebar-CcSTChgY.js +1 -0
  22. package/dist/viewer/assets/IconReferencePage-BhQv3kD4.js +1 -0
  23. package/dist/viewer/assets/IconReferencePage-C_I2Fxnr.js +1 -0
  24. package/dist/viewer/assets/PluginIcon-CWkWM-Eu.js +1 -0
  25. package/dist/viewer/assets/SandboxPage-BMz04QVs.js +1 -0
  26. package/dist/viewer/assets/SandboxPage-BWtQb8kY.js +1 -0
  27. package/dist/viewer/assets/SandboxPage-DOBUc8VL.js +1 -0
  28. package/dist/viewer/assets/SidebarContext-Cn8QRb77.js +1 -0
  29. package/dist/viewer/assets/SidebarContext-DMhpPBf_.js +1 -0
  30. package/dist/viewer/assets/SourceBrowserPage-C-IhTiL0.js +1 -0
  31. package/dist/viewer/assets/SourceBrowserPage-Cr6XOIdV.js +1 -0
  32. package/dist/viewer/assets/VersionsPage-Bpj4_jPC.js +1 -0
  33. package/dist/viewer/assets/VersionsPage-DAm4Ozs0.js +1 -0
  34. package/dist/viewer/assets/VersionsPage-T8tsqgQx.js +1 -0
  35. package/dist/viewer/assets/{api-BOqcXygX.js → api-DFDquUsn.js} +1 -1
  36. package/dist/viewer/assets/{api-DqAiw0w9.js → api-bszpvP9L.js} +1 -1
  37. package/dist/viewer/assets/bundleQuery-BQLpZ06V.js +1 -0
  38. package/dist/viewer/assets/bundleQuery-CjbA01rb.js +1 -0
  39. package/dist/viewer/assets/fa-core-BoBqCOD3.js +558 -0
  40. package/dist/viewer/assets/{fa-core-wsCxaNB7.js → fa-core-C4eeAd4v.js} +1 -1
  41. package/dist/viewer/assets/formatBytes-BCP0hIUu.js +1 -0
  42. package/dist/viewer/assets/index-7CwR8Ogd.js +5 -0
  43. package/dist/viewer/assets/index-CCB9tECd.css +2 -0
  44. package/dist/viewer/assets/index-FEIsXxbf.js +5 -0
  45. package/dist/viewer/assets/index-fU82pXSW.js +5 -0
  46. package/dist/viewer/assets/{react-CyWK9rg5.js → react-CmC5kGa_.js} +1 -1
  47. package/dist/viewer/assets/{react-CkuOm_dq.js → react-csXWLXSE.js} +1 -1
  48. package/dist/viewer/assets/{recordDetail.worker-BIHPFt8Y.js → recordDetail.worker-C0-mQTaj.js} +1 -1
  49. package/dist/viewer/assets/useCriticalExceptionDialog-BeVl0uaO.js +14 -0
  50. package/dist/viewer/assets/useCriticalExceptionDialog-DseJ_u9B.js +14 -0
  51. package/dist/viewer/assets/useCurrentApp-CWtSEVC4.js +1 -0
  52. package/dist/viewer/assets/useCurrentApp-x1p8URhM.js +1 -0
  53. package/dist/viewer/assets/{useLocalStorage-BWwvt0nG.js → useLocalStorage-HYhrPUxS.js} +1 -1
  54. package/dist/viewer/assets/{useLocalStorage-BlZWItfY.js → useLocalStorage-eJ1PxgAP.js} +1 -1
  55. package/dist/viewer/assets/{useNavigate-9J1ZzN1J.js → useNavigate-BblEmQ3O.js} +1 -1
  56. package/dist/viewer/assets/{useNavigate-V8wjv5GQ.js → useNavigate-Ci7hClRo.js} +1 -1
  57. package/dist/viewer/assets/useQuery-5OkVbV1s.js +1 -0
  58. package/dist/viewer/assets/useQuery-B3Ek2Yet.js +1 -0
  59. package/dist/viewer/assets/{validIcons-UmfwFGTT.js → validIcons-BzGQ4tWD.js} +1 -1
  60. package/dist/viewer/assets/{validIcons-Dqgxgpv-.js → validIcons-CzxkK9y8.js} +1 -1
  61. package/dist/viewer/index.html +12 -10
  62. package/package.json +3 -6
  63. package/dist/viewer/assets/AppDetailPage-BPvWscWJ.js +0 -1
  64. package/dist/viewer/assets/AppDetailPage-DIuYKCTQ.js +0 -1
  65. package/dist/viewer/assets/AppDetailPage-r3jzO9Kf.js +0 -1
  66. package/dist/viewer/assets/BootstrapContext-CExPp3R2.js +0 -1
  67. package/dist/viewer/assets/BootstrapContext-CTQMWXf-.js +0 -1
  68. package/dist/viewer/assets/BootstrapContext-DbnbWmQT.js +0 -1
  69. package/dist/viewer/assets/Card-Bmn1HMWl.js +0 -1
  70. package/dist/viewer/assets/Card-DMz6T3VL.js +0 -1
  71. package/dist/viewer/assets/Card-DsqKctyM.js +0 -1
  72. package/dist/viewer/assets/CodeStepsPage-BHqLfCdV.js +0 -4
  73. package/dist/viewer/assets/CodeStepsPage-BymhEfzO.js +0 -4
  74. package/dist/viewer/assets/CodeStepsPage-CD_MhDwY.js +0 -4
  75. package/dist/viewer/assets/CodeStepsPage-CgI-LqEx.js +0 -4
  76. package/dist/viewer/assets/CodeStepsPage-Dak3saZE.js +0 -5
  77. package/dist/viewer/assets/CodeStepsPage-Zj6DscGd.js +0 -4
  78. package/dist/viewer/assets/ConfigurationPage-Cjy9TH3N.js +0 -1
  79. package/dist/viewer/assets/ConfigurationPage-DmX-6MM-.js +0 -1
  80. package/dist/viewer/assets/ConfigurationPage-J56kCD_e.js +0 -1
  81. package/dist/viewer/assets/CredentialsContext-Xbse1T0q.js +0 -1
  82. package/dist/viewer/assets/CredentialsContext-zl2e9kpM.js +0 -1
  83. package/dist/viewer/assets/DevSidebar-B30mgxSn.js +0 -1
  84. package/dist/viewer/assets/DevSidebar-CsEdCTej.js +0 -1
  85. package/dist/viewer/assets/IconReferencePage-B6j9wlte.js +0 -1
  86. package/dist/viewer/assets/IconReferencePage-CJa9yg9Z.js +0 -1
  87. package/dist/viewer/assets/IconReferencePage-Q5I-lMFQ.js +0 -1
  88. package/dist/viewer/assets/SandboxPage-C0h7GUkw.js +0 -1
  89. package/dist/viewer/assets/SandboxPage-GDcydJnJ.js +0 -1
  90. package/dist/viewer/assets/SandboxPage-JREBQ4id.js +0 -1
  91. package/dist/viewer/assets/SidebarContext-BPkYyxET.js +0 -1
  92. package/dist/viewer/assets/SidebarContext-DVDXFWJI.js +0 -1
  93. package/dist/viewer/assets/SidebarContext-HucmR353.js +0 -1
  94. package/dist/viewer/assets/VersionsPage-B76eugMm.js +0 -1
  95. package/dist/viewer/assets/VersionsPage-BIpB0iBz.js +0 -1
  96. package/dist/viewer/assets/VersionsPage-D0qenxK5.js +0 -1
  97. package/dist/viewer/assets/bundleQuery-206rQR6g.js +0 -1
  98. package/dist/viewer/assets/bundleQuery-L4H4wq5q.js +0 -1
  99. package/dist/viewer/assets/fa-core-DaD7O-yO.js +0 -558
  100. package/dist/viewer/assets/index-BPiwld5D.js +0 -5
  101. package/dist/viewer/assets/index-BiyeMU_r.css +0 -2
  102. package/dist/viewer/assets/index-BlJv_543.js +0 -5
  103. package/dist/viewer/assets/index-CAYNux5J.js +0 -5
  104. package/dist/viewer/assets/index-D4AnoAXz.js +0 -5
  105. package/dist/viewer/assets/index-D8Koqlb-.js +0 -5
  106. package/dist/viewer/assets/index-DKrC0qkC.js +0 -5
  107. package/dist/viewer/assets/useLocalStorage-CQO0VGQ6.js +0 -1
  108. package/dist/viewer/assets/useObjectLookups-BAqe9wvu.js +0 -14
  109. package/dist/viewer/assets/useObjectLookups-C65zm-bM.js +0 -14
  110. package/dist/viewer/assets/useObjectLookups-CslM2vSA.js +0 -14
  111. /package/dist/viewer/assets/{CodeStepsPage-DdKuH37F.css → CodeViewer-DdKuH37F.css} +0 -0
  112. /package/dist/viewer/assets/{fa-pro-icons-CiTC899m.js → fa-pro-icons-Dr3O0gTt.js} +0 -0
  113. /package/dist/viewer/assets/{fa-pro-icons-Dzkwxnip.js → fa-pro-icons-j8-_MCQ7.js} +0 -0
@@ -1,14 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{C as t,S as n,d as r,x as i}from"./fa-core-DaD7O-yO.js";import{n as a}from"./react-CkuOm_dq.js";import{L as o,N as s,a as c,c as l,d as u,f as d,i as f,j as p,k as m,l as h,m as g,o as _,p as v,r as y,s as b,u as x,y as S}from"./bundleQuery-206rQR6g.js";import{n as C,r as w}from"./BootstrapContext-CExPp3R2.js";import{r as T}from"./api-DqAiw0w9.js";function E(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function D(e,t,n){let r=e.slice(0);return r[t]=n,r}var O=class extends o{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,S.batch(()=>{let e=this.#i,t=this.#f(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,c=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!s(e,n)});!o&&!c||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(E(e,n).forEach(e=>{e.destroy()}),E(n,e).forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})),this.#m()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#f(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=p(this.#a,t(e))),this.#a}return e}#f(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new g(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#p(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=D(this.#t,n,t),this.#m())}#m(){if(this.hasListeners()){let e=this.#a,t=this.#u(this.#t,this.#l);e!==this.#d(t,this.#r?.combine)&&S.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},k=e(t(),1);function A({queries:e,...t},n){let r=v(n),i=x(),a=h(),o=k.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{y(e),_(e,a,r.getQueryCache().get(e.queryHash))}),l(a);let[s]=k.useState(()=>new O(r,o,t)),[u,d,p]=s.getOptimisticResult(o,t.combine),C=!i&&t.subscribed!==!1;k.useSyncExternalStore(k.useCallback(e=>C?s.subscribe(S.batchCalls(e)):m,[s,C]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),k.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let w=u.some((e,t)=>c(o[t],e))?u.flatMap((e,t)=>{let n=o[t];return n&&c(n,e)?f(n,new g(r,n),a):[]}):[];if(w.length>0)throw Promise.all(w);let T=u.find((e,t)=>{let n=o[t];return n&&b({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(T?.error)throw T.error;return d(p())}var j={QUERY_REQUEST:`query:request`,UI_OUTPUT:`outputui`,IFRAME_OUTPUT:`iframeoutput`,POSTFORMDATA_REQUEST:`postformdata:request`,SETSTATE:`setstate`,DONE:`done`,RUN:`run`,OPEN_WINDOW:`openwindow`,COMMUNICATE:`communicate`,HIDE:`hide`,SHOW:`show`,EXPAND:`expand`,COLLAPSE:`collapse`,HIDE_HEADER:`hideheader`,SHOW_HEADER:`showheader`,OPEN_CREATE_RECORD_MODAL_REQUEST:`opencreaterecordmodal:request`,OPEN_CREATE_RELATED_RECORD_MODAL_REQUEST:`opencreaterelatedrecordmodal:request`,SHOW_TOAST:`showtoast`,CLEAR_TOASTS:`cleartoasts`,REFRESH_TIMELINE:`refreshtimeline`,REFRESH_ENTITY:`refreshentity`,UPLOADFILE_REQUEST:`uploadfile:request`,UPDATE_SESSION_DATA:`updatesessiondata`,INSTALL_THIRD_PARTY_SCRIPT_REQUEST:`installthirdpartyscript:request`,PROMPT_REQUEST:`prompt:request`,DYNAMIC_PROMPT_REQUEST:`dynamicprompt:request`,RELEASE_BLOCKING_SCRIPT:`releaseblockingscript`,AUTHORIZE:`authorize`,COPY_TO_CLIPBOARD:`copytoclipboard`},M={QUERY_RESPONSE:`query:response`,POSTFORMDATA_RESPONSE:`postformdata:response`,ERROR:`error`,UPLOADFILE_RESPONSE:`uploadfile:response`,UPLOADFILE_PROGRESS:`uploadfile:progress`,INSTALL_THIRD_PARTY_SCRIPT_RESPONSE:`installthirdpartyscript:response`,PROMPT_RESPONSE:`prompt:response`,REFRESH_ENTITY_RESPONSE:`refreshentity:response`,CREATE_RECORD_RESPONSE:`createrecord:response`,CREATE_RELATED_RECORD_RESPONSE:`createrelatedrecord:response`},N={RUN_FRAME_SCRIPT:`runframescript`,SEND_MESSAGE_TO_FRAME:`sendmessagetoframe`,CALL_THIRD_PARTY_SCRIPT:`callthirdpartyscript`},P=`integration:route-change`,F=`kizen-route-change`,I=`kzn-integration-frame`,L=[`__plugin_engine`,`0.3.1`],R={CALENDAR_SOURCE_CALENDAR_LIST:(e,t)=>[...L,`calendar-source`,`calendar-list`,e,t],CALENDAR_SOURCE_EVENTS:(e,t,n,r)=>[...L,`calendar-source`,`events`,e,t,n,r]},z=/https:\/\/.*widget\.freshworks\.com\/.*\.js/,ee=/https:\/\/widget\.intercom\.io\/widget\/[a-z0-9]+/,B={FRESHWORKS:`freshworks`,INTERCOM:`intercom`},te=e=>{if(z.test(e))return B.FRESHWORKS;if(ee.test(e))return B.INTERCOM},V={[B.FRESHWORKS]:`FreshworksWidget`,[B.INTERCOM]:`Intercom`},ne={[B.FRESHWORKS]:e=>{window.fwSettings={widget_id:e.widgetId},(function(...e){if(typeof window[V[B.FRESHWORKS]]!=`function`){let t=function(){t.q.push(...e)};t.__kizen_pending=!0,t.q=[],window[V[B.FRESHWORKS]]=t}})()},[B.INTERCOM]:()=>{(function(){if(typeof window[V[B.INTERCOM]]!=`function`){let e=window,t=function(){t.c(arguments)};t.q=[],t.c=function(e){t.q.push(e)},t.__kizen_pending=!0,e[V[B.INTERCOM]]=t}})()}},re={[B.FRESHWORKS]:()=>window[V[B.FRESHWORKS]]?.__kizen_pending!==!0,[B.INTERCOM]:()=>window[V[B.INTERCOM]]?.__kizen_pending!==!0},ie=()=>({host:window.location.host,hash:window.location.hash,href:window.location.href,origin:window.location.origin,pathname:window.location.pathname,search:window.location.search,port:window.location.port,protocol:window.location.protocol}),ae=()=>{let e=new Date().getTime();return typeof performance<`u`&&typeof performance.now==`function`&&(e+=performance.now()),`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,t=>{let n=(e+Math.random()*16)%16|0;return e=Math.floor(e/16),(t===`x`?n:n&3|8).toString(16)})};Object.getPrototypeOf(async function(){}).constructor;var oe=e=>`${e?.plugin_api_name??``}-${e?.id??``}-${e?.api_name??``}-${e?.script_id??``}`,H=Object.create,se=Object.defineProperty,U=Object.getOwnPropertyDescriptor,ce=Object.getOwnPropertyNames,le=Object.getPrototypeOf,ue=Object.prototype.hasOwnProperty,W=(e,t)=>function(){return t||(0,e[ce(e)[0]])((t={exports:{}}).exports,t),t.exports},de=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of ce(t))!ue.call(e,i)&&i!==n&&se(e,i,{get:()=>t[i],enumerable:!(r=U(t,i))||r.enumerable});return e},fe=(e,t,n)=>(n=e==null?{}:H(le(e)),de(t||!e||!e.__esModule?se(n,`default`,{value:e,enumerable:!0}):n,e)),{entries:pe,setPrototypeOf:me,isFrozen:he,getPrototypeOf:ge,getOwnPropertyDescriptor:_e}=Object,{freeze:G,seal:K,create:ve}=Object,{apply:ye,construct:be}=typeof Reflect<`u`&&Reflect;G||=function(e){return e},K||=function(e){return e},ye||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},be||=function(e){return new e(...[...arguments].slice(1))};var xe=J(Array.prototype.forEach),Se=J(Array.prototype.lastIndexOf),Ce=J(Array.prototype.pop),we=J(Array.prototype.push),Te=J(Array.prototype.splice),Ee=J(String.prototype.toLowerCase),De=J(String.prototype.toString),Oe=J(String.prototype.match),ke=J(String.prototype.replace),Ae=J(String.prototype.indexOf),je=J(String.prototype.trim),Me=J(Object.prototype.hasOwnProperty),q=J(RegExp.prototype.test),Ne=Pe(TypeError);function J(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return ye(e,t,n)}}function Pe(e){return function(){return be(e,[...arguments])}}function Y(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ee;me&&me(e,null);let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(he(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Fe(e){for(let t=0;t<e.length;t++)Me(e,t)||(e[t]=null);return e}function Ie(e){let t=ve(null);for(let[n,r]of pe(e))Me(e,n)&&(Array.isArray(r)?t[n]=Fe(r):r&&typeof r==`object`&&r.constructor===Object?t[n]=Ie(r):t[n]=r);return t}function Le(e,t){for(;e!==null;){let n=_e(e,t);if(n){if(n.get)return J(n.get);if(typeof n.value==`function`)return J(n.value)}e=ge(e)}function n(){return null}return n}var Re=G(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),ze=G(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),Be=G([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),Ve=G([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),He=G(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),Ue=G([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),We=G([`#text`]),Ge=G(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns.slot`.split(`.`)),Ke=G(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),qe=G(`accent.accentunder.align.bevelled.close.columnsalign.columnlines.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lspace.lquote.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),Je=G([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Ye=K(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Xe=K(/<%[\w\W]*|[\w\W]*%>/gm),Ze=K(/\$\{[\w\W]*/gm),Qe=K(/^data-[\-\w.\u00B7-\uFFFF]+$/),$e=K(/^aria-[\-\w]+$/),et=K(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),tt=K(/^(?:\w+script|data):/i),nt=K(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),rt=K(/^html$/i),it=K(/^[a-z][.\w]*(-[.\w]+)+$/i),at=Object.freeze({__proto__:null,ARIA_ATTR:$e,ATTR_WHITESPACE:nt,CUSTOM_ELEMENT:it,DATA_ATTR:Qe,DOCTYPE_NAME:rt,ERB_EXPR:Xe,IS_ALLOWED_URI:et,IS_SCRIPT_OR_DATA:tt,MUSTACHE_EXPR:Ye,TMPLIT_EXPR:Ze}),ot={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},st=function(){return typeof window>`u`?null:window},ct=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},lt=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ut(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:st(),t=e=>ut(e);if(t.version=`3.3.3`,t.removed=[],!e||!e.document||e.document.nodeType!==ot.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e,r=n,i=r.currentScript,{DocumentFragment:a,HTMLTemplateElement:o,Node:s,Element:c,NodeFilter:l,NamedNodeMap:u=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:d,DOMParser:f,trustedTypes:p}=e,m=c.prototype,h=Le(m,`cloneNode`),g=Le(m,`remove`),_=Le(m,`nextSibling`),v=Le(m,`childNodes`),y=Le(m,`parentNode`);if(typeof o==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let b,x=``,{implementation:S,createNodeIterator:C,createDocumentFragment:w,getElementsByTagName:T}=n,{importNode:E}=r,D=lt();t.isSupported=typeof pe==`function`&&typeof y==`function`&&S&&S.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:O,ERB_EXPR:k,TMPLIT_EXPR:A,DATA_ATTR:j,ARIA_ATTR:M,IS_SCRIPT_OR_DATA:N,ATTR_WHITESPACE:P,CUSTOM_ELEMENT:F}=at,{IS_ALLOWED_URI:I}=at,L=null,R=Y({},[...Re,...ze,...Be,...He,...We]),z=null,ee=Y({},[...Ge,...Ke,...qe,...Je]),B=Object.seal(ve(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),te=null,V=null,ne=Object.seal(ve(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),re=!0,ie=!0,ae=!1,oe=!0,H=!1,se=!0,U=!1,ce=!1,le=!1,ue=!1,W=!1,de=!1,fe=!0,me=!1,he=!0,ge=!1,_e={},K=null,ye=Y({},[`annotation-xml`,`audio`,`colgroup`,`desc`,`foreignobject`,`head`,`iframe`,`math`,`mi`,`mn`,`mo`,`ms`,`mtext`,`noembed`,`noframes`,`noscript`,`plaintext`,`script`,`style`,`svg`,`template`,`thead`,`title`,`video`,`xmp`]),be=null,J=Y({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Pe=null,Fe=Y({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Ye=`http://www.w3.org/1998/Math/MathML`,Xe=`http://www.w3.org/2000/svg`,Ze=`http://www.w3.org/1999/xhtml`,Qe=Ze,$e=!1,tt=null,nt=Y({},[Ye,Xe,Ze],De),it=Y({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),dt=Y({},[`annotation-xml`]),ft=Y({},[`title`,`style`,`font`,`a`,`script`]),pt=null,mt=[`application/xhtml+xml`,`text/html`],X=null,ht=null,gt=n.createElement(`form`),_t=function(e){return e instanceof RegExp||e instanceof Function},vt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(ht&&ht===e)){if((!e||typeof e!=`object`)&&(e={}),e=Ie(e),pt=mt.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,X=pt===`application/xhtml+xml`?De:Ee,L=Me(e,`ALLOWED_TAGS`)?Y({},e.ALLOWED_TAGS,X):R,z=Me(e,`ALLOWED_ATTR`)?Y({},e.ALLOWED_ATTR,X):ee,tt=Me(e,`ALLOWED_NAMESPACES`)?Y({},e.ALLOWED_NAMESPACES,De):nt,Pe=Me(e,`ADD_URI_SAFE_ATTR`)?Y(Ie(Fe),e.ADD_URI_SAFE_ATTR,X):Fe,be=Me(e,`ADD_DATA_URI_TAGS`)?Y(Ie(J),e.ADD_DATA_URI_TAGS,X):J,K=Me(e,`FORBID_CONTENTS`)?Y({},e.FORBID_CONTENTS,X):ye,te=Me(e,`FORBID_TAGS`)?Y({},e.FORBID_TAGS,X):Ie({}),V=Me(e,`FORBID_ATTR`)?Y({},e.FORBID_ATTR,X):Ie({}),_e=Me(e,`USE_PROFILES`)?e.USE_PROFILES:!1,re=e.ALLOW_ARIA_ATTR!==!1,ie=e.ALLOW_DATA_ATTR!==!1,ae=e.ALLOW_UNKNOWN_PROTOCOLS||!1,oe=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,H=e.SAFE_FOR_TEMPLATES||!1,se=e.SAFE_FOR_XML!==!1,U=e.WHOLE_DOCUMENT||!1,ue=e.RETURN_DOM||!1,W=e.RETURN_DOM_FRAGMENT||!1,de=e.RETURN_TRUSTED_TYPE||!1,le=e.FORCE_BODY||!1,fe=e.SANITIZE_DOM!==!1,me=e.SANITIZE_NAMED_PROPS||!1,he=e.KEEP_CONTENT!==!1,ge=e.IN_PLACE||!1,I=e.ALLOWED_URI_REGEXP||et,Qe=e.NAMESPACE||Ze,it=e.MATHML_TEXT_INTEGRATION_POINTS||it,dt=e.HTML_INTEGRATION_POINTS||dt,B=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&_t(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(B.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&_t(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(B.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements==`boolean`&&(B.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),H&&(ie=!1),W&&(ue=!0),_e&&(L=Y({},We),z=ve(null),_e.html===!0&&(Y(L,Re),Y(z,Ge)),_e.svg===!0&&(Y(L,ze),Y(z,Ke),Y(z,Je)),_e.svgFilters===!0&&(Y(L,Be),Y(z,Ke),Y(z,Je)),_e.mathMl===!0&&(Y(L,He),Y(z,qe),Y(z,Je))),Me(e,`ADD_TAGS`)||(ne.tagCheck=null),Me(e,`ADD_ATTR`)||(ne.attributeCheck=null),e.ADD_TAGS&&(typeof e.ADD_TAGS==`function`?ne.tagCheck=e.ADD_TAGS:(L===R&&(L=Ie(L)),Y(L,e.ADD_TAGS,X))),e.ADD_ATTR&&(typeof e.ADD_ATTR==`function`?ne.attributeCheck=e.ADD_ATTR:(z===ee&&(z=Ie(z)),Y(z,e.ADD_ATTR,X))),e.ADD_URI_SAFE_ATTR&&Y(Pe,e.ADD_URI_SAFE_ATTR,X),e.FORBID_CONTENTS&&(K===ye&&(K=Ie(K)),Y(K,e.FORBID_CONTENTS,X)),e.ADD_FORBID_CONTENTS&&(K===ye&&(K=Ie(K)),Y(K,e.ADD_FORBID_CONTENTS,X)),he&&(L[`#text`]=!0),U&&Y(L,[`html`,`head`,`body`]),L.table&&(Y(L,[`tbody`]),delete te.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw Ne(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw Ne(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);b=e.TRUSTED_TYPES_POLICY,x=b.createHTML(``)}else b===void 0&&(b=ct(p,i)),b!==null&&typeof x==`string`&&(x=b.createHTML(``));G&&G(e),ht=e}},yt=Y({},[...ze,...Be,...Ve]),bt=Y({},[...He,...Ue]),xt=function(e){let t=y(e);(!t||!t.tagName)&&(t={namespaceURI:Qe,tagName:`template`});let n=Ee(e.tagName),r=Ee(t.tagName);return tt[e.namespaceURI]?e.namespaceURI===Xe?t.namespaceURI===Ze?n===`svg`:t.namespaceURI===Ye?n===`svg`&&(r===`annotation-xml`||it[r]):!!yt[n]:e.namespaceURI===Ye?t.namespaceURI===Ze?n===`math`:t.namespaceURI===Xe?n===`math`&&dt[r]:!!bt[n]:e.namespaceURI===Ze?t.namespaceURI===Xe&&!dt[r]||t.namespaceURI===Ye&&!it[r]?!1:!bt[n]&&(ft[n]||!yt[n]):!!(pt===`application/xhtml+xml`&&tt[e.namespaceURI]):!1},St=function(e){we(t.removed,{element:e});try{y(e).removeChild(e)}catch{g(e)}},Ct=function(e,n){try{we(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{we(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(ue||W)try{St(n)}catch{}else try{n.setAttribute(e,``)}catch{}},wt=function(e){let t=null,r=null;if(le)e=`<remove></remove>`+e;else{let t=Oe(e,/^[\r\n\t ]+/);r=t&&t[0]}pt===`application/xhtml+xml`&&Qe===Ze&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=b?b.createHTML(e):e;if(Qe===Ze)try{t=new f().parseFromString(i,pt)}catch{}if(!t||!t.documentElement){t=S.createDocument(Qe,`template`,null);try{t.documentElement.innerHTML=$e?x:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Qe===Ze?T.call(t,U?`html`:`body`)[0]:U?t.documentElement:a},Tt=function(e){return C.call(e.ownerDocument||e,e,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},Et=function(e){return e instanceof d&&(typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||!(e.attributes instanceof u)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`)},Dt=function(e){return typeof s==`function`&&e instanceof s};function Ot(e,n,r){xe(e,e=>{e.call(t,n,r,ht)})}let kt=function(e){let n=null;if(Ot(D.beforeSanitizeElements,e,null),Et(e))return St(e),!0;let r=X(e.nodeName);if(Ot(D.uponSanitizeElement,e,{tagName:r,allowedTags:L}),se&&e.hasChildNodes()&&!Dt(e.firstElementChild)&&q(/<[/\w!]/g,e.innerHTML)&&q(/<[/\w!]/g,e.textContent)||e.nodeType===ot.progressingInstruction||se&&e.nodeType===ot.comment&&q(/<[/\w]/g,e.data))return St(e),!0;if(!(ne.tagCheck instanceof Function&&ne.tagCheck(r))&&(!L[r]||te[r])){if(!te[r]&&jt(r)&&(B.tagNameCheck instanceof RegExp&&q(B.tagNameCheck,r)||B.tagNameCheck instanceof Function&&B.tagNameCheck(r)))return!1;if(he&&!K[r]){let t=y(e)||e.parentNode,n=v(e)||e.childNodes;if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=h(n[i],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,_(e))}}}return St(e),!0}return e instanceof c&&!xt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&q(/<\/no(script|embed|frames)/i,e.innerHTML)?(St(e),!0):(H&&e.nodeType===ot.text&&(n=e.textContent,xe([O,k,A],e=>{n=ke(n,e,` `)}),e.textContent!==n&&(we(t.removed,{element:e.cloneNode()}),e.textContent=n)),Ot(D.afterSanitizeElements,e,null),!1)},At=function(e,t,r){if(V[t]||fe&&(t===`id`||t===`name`)&&(r in n||r in gt))return!1;if(!(ie&&!V[t]&&q(j,t))&&!(re&&q(M,t))&&!(ne.attributeCheck instanceof Function&&ne.attributeCheck(t,e))){if(!z[t]||V[t]){if(!(jt(e)&&(B.tagNameCheck instanceof RegExp&&q(B.tagNameCheck,e)||B.tagNameCheck instanceof Function&&B.tagNameCheck(e))&&(B.attributeNameCheck instanceof RegExp&&q(B.attributeNameCheck,t)||B.attributeNameCheck instanceof Function&&B.attributeNameCheck(t,e))||t===`is`&&B.allowCustomizedBuiltInElements&&(B.tagNameCheck instanceof RegExp&&q(B.tagNameCheck,r)||B.tagNameCheck instanceof Function&&B.tagNameCheck(r))))return!1}else if(!Pe[t]&&!q(I,ke(r,P,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&Ae(r,`data:`)===0&&be[e])&&!(ae&&!q(N,ke(r,P,``)))&&r)return!1}return!0},jt=function(e){return e!==`annotation-xml`&&Oe(e,F)},Mt=function(e){Ot(D.beforeSanitizeAttributes,e,null);let{attributes:n}=e;if(!n||Et(e))return;let r={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:z,forceKeepAttr:void 0},i=n.length;for(;i--;){let{name:a,namespaceURI:o,value:s}=n[i],c=X(a),l=s,u=a===`value`?l:je(l);if(r.attrName=c,r.attrValue=u,r.keepAttr=!0,r.forceKeepAttr=void 0,Ot(D.uponSanitizeAttribute,e,r),u=r.attrValue,me&&(c===`id`||c===`name`)&&(Ct(a,e),u=`user-content-`+u),se&&q(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,u)){Ct(a,e);continue}if(c===`attributename`&&Oe(u,`href`)){Ct(a,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){Ct(a,e);continue}if(!oe&&q(/\/>/i,u)){Ct(a,e);continue}H&&xe([O,k,A],e=>{u=ke(u,e,` `)});let d=X(e.nodeName);if(!At(d,c,u)){Ct(a,e);continue}if(b&&typeof p==`object`&&typeof p.getAttributeType==`function`&&!o)switch(p.getAttributeType(d,c)){case`TrustedHTML`:u=b.createHTML(u);break;case`TrustedScriptURL`:u=b.createScriptURL(u);break}if(u!==l)try{o?e.setAttributeNS(o,a,u):e.setAttribute(a,u),Et(e)?St(e):Ce(t.removed)}catch{Ct(a,e)}}Ot(D.afterSanitizeAttributes,e,null)},Nt=function e(t){let n=null,r=Tt(t);for(Ot(D.beforeSanitizeShadowDOM,t,null);n=r.nextNode();)Ot(D.uponSanitizeShadowNode,n,null),kt(n),Mt(n),n.content instanceof a&&e(n.content);Ot(D.afterSanitizeShadowDOM,t,null)};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,o=null,c=null,l=null;if($e=!e,$e&&(e=`<!-->`),typeof e!=`string`&&!Dt(e))if(typeof e.toString==`function`){if(e=e.toString(),typeof e!=`string`)throw Ne(`dirty is not a string, aborting`)}else throw Ne(`toString is not a function`);if(!t.isSupported)return e;if(ce||vt(n),t.removed=[],typeof e==`string`&&(ge=!1),ge){if(e.nodeName){let t=X(e.nodeName);if(!L[t]||te[t])throw Ne(`root node is forbidden and cannot be sanitized in-place`)}}else if(e instanceof s)i=wt(`<!---->`),o=i.ownerDocument.importNode(e,!0),o.nodeType===ot.element&&o.nodeName===`BODY`||o.nodeName===`HTML`?i=o:i.appendChild(o);else{if(!ue&&!H&&!U&&e.indexOf(`<`)===-1)return b&&de?b.createHTML(e):e;if(i=wt(e),!i)return ue?null:de?x:``}i&&le&&St(i.firstChild);let u=Tt(ge?e:i);for(;c=u.nextNode();)kt(c),Mt(c),c.content instanceof a&&Nt(c.content);if(ge)return e;if(ue){if(W)for(l=w.call(i.ownerDocument);i.firstChild;)l.appendChild(i.firstChild);else l=i;return(z.shadowroot||z.shadowrootmode)&&(l=E.call(r,l,!0)),l}let d=U?i.outerHTML:i.innerHTML;return U&&L[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&q(rt,i.ownerDocument.doctype.name)&&(d=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
2
- `+d),H&&xe([O,k,A],e=>{d=ke(d,e,` `)}),b&&de?b.createHTML(d):d},t.setConfig=function(){vt(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),ce=!0},t.clearConfig=function(){ht=null,ce=!1},t.isValidAttribute=function(e,t,n){return ht||vt({}),At(X(e),X(t),n)},t.addHook=function(e,t){typeof t==`function`&&we(D[e],t)},t.removeHook=function(e,t){if(t!==void 0){let n=Se(D[e],t);return n===-1?void 0:Te(D[e],n,1)[0]}return Ce(D[e])},t.removeHooks=function(e){D[e]=[]},t.removeAllHooks=function(){D=lt()},t}var dt=ut(),ft=W({"node_modules/.pnpm/jsonify@0.0.1/node_modules/jsonify/lib/parse.js"(e,t){var n,r,i={'"':`"`,"\\":`\\`,"/":`/`,b:`\b`,f:`\f`,n:`
3
- `,r:`\r`,t:` `},a;function o(e){throw{name:`SyntaxError`,message:e,at:n,text:a}}function s(e){return e&&e!==r&&o(`Expected '`+e+`' instead of '`+r+`'`),r=a.charAt(n),n+=1,r}function c(){var e,t=``;for(r===`-`&&(t=`-`,s(`-`));r>=`0`&&r<=`9`;)t+=r,s();if(r===`.`)for(t+=`.`;s()&&r>=`0`&&r<=`9`;)t+=r;if(r===`e`||r===`E`)for(t+=r,s(),(r===`-`||r===`+`)&&(t+=r,s());r>=`0`&&r<=`9`;)t+=r,s();return e=Number(t),isFinite(e)||o(`Bad number`),e}function l(){var e,t,n=``,a;if(r===`"`)for(;s();)if(r===`"`)return s(),n;else if(r===`\\`)if(s(),r===`u`){for(a=0,t=0;t<4&&(e=parseInt(s(),16),isFinite(e));t+=1)a=a*16+e;n+=String.fromCharCode(a)}else if(typeof i[r]==`string`)n+=i[r];else break;else n+=r;o(`Bad string`)}function u(){for(;r&&r<=` `;)s()}function d(){switch(r){case`t`:return s(`t`),s(`r`),s(`u`),s(`e`),!0;case`f`:return s(`f`),s(`a`),s(`l`),s(`s`),s(`e`),!1;case`n`:return s(`n`),s(`u`),s(`l`),s(`l`),null;default:o(`Unexpected '`+r+`'`)}}function f(){var e=[];if(r===`[`){if(s(`[`),u(),r===`]`)return s(`]`),e;for(;r;){if(e.push(m()),u(),r===`]`)return s(`]`),e;s(`,`),u()}}o(`Bad array`)}function p(){var e,t={};if(r===`{`){if(s(`{`),u(),r===`}`)return s(`}`),t;for(;r;){if(e=l(),u(),s(`:`),Object.prototype.hasOwnProperty.call(t,e)&&o(`Duplicate key "`+e+`"`),t[e]=m(),u(),r===`}`)return s(`}`),t;s(`,`),u()}}o(`Bad object`)}function m(){switch(u(),r){case`{`:return p();case`[`:return f();case`"`:return l();case`-`:return c();default:return r>=`0`&&r<=`9`?c():d()}}t.exports=function(e,t){var i;return a=e,n=0,r=` `,i=m(),u(),r&&o(`Syntax error`),typeof t==`function`?(function e(n,r){var i,a,o=n[r];if(o&&typeof o==`object`)for(i in m)Object.prototype.hasOwnProperty.call(o,i)&&(a=e(o,i),a===void 0?delete o[i]:o[i]=a);return t.call(n,r,o)})({"":i},``):i}}}),pt=W({"node_modules/.pnpm/jsonify@0.0.1/node_modules/jsonify/lib/stringify.js"(e,t){var n=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,r,i,a={"\b":`\\b`," ":`\\t`,"\n":`\\n`,"\f":`\\f`,"\r":`\\r`,'"':`\\"`,"\\":`\\\\`},o;function s(e){return n.lastIndex=0,n.test(e)?`"`+e.replace(n,function(e){var t=a[e];return typeof t==`string`?t:`\\u`+(`0000`+e.charCodeAt(0).toString(16)).slice(-4)})+`"`:`"`+e+`"`}function c(e,t){var n,a,l,u,d=r,f,p=t[e];switch(p&&typeof p==`object`&&typeof p.toJSON==`function`&&(p=p.toJSON(e)),typeof o==`function`&&(p=o.call(t,e,p)),typeof p){case`string`:return s(p);case`number`:return isFinite(p)?String(p):`null`;case`boolean`:case`null`:return String(p);case`object`:if(!p)return`null`;if(r+=i,f=[],Object.prototype.toString.apply(p)===`[object Array]`){for(u=p.length,n=0;n<u;n+=1)f[n]=c(n,p)||`null`;return l=f.length===0?`[]`:r?`[
4
- `+r+f.join(`,
5
- `+r)+`
6
- `+d+`]`:`[`+f.join(`,`)+`]`,r=d,l}if(o&&typeof o==`object`)for(u=o.length,n=0;n<u;n+=1)a=o[n],typeof a==`string`&&(l=c(a,p),l&&f.push(s(a)+(r?`: `:`:`)+l));else for(a in p)Object.prototype.hasOwnProperty.call(p,a)&&(l=c(a,p),l&&f.push(s(a)+(r?`: `:`:`)+l));return l=f.length===0?`{}`:r?`{
7
- `+r+f.join(`,
8
- `+r)+`
9
- `+d+`}`:`{`+f.join(`,`)+`}`,r=d,l}}t.exports=function(e,t,n){var a;if(r=``,i=``,typeof n==`number`)for(a=0;a<n;a+=1)i+=` `;else typeof n==`string`&&(i=n);if(o=t,t&&typeof t!=`function`&&(typeof t!=`object`||typeof t.length!=`number`))throw Error(`JSON.stringify`);return c(``,{"":e})}}}),mt=W({"node_modules/.pnpm/jsonify@0.0.1/node_modules/jsonify/index.js"(e){e.parse=ft(),e.stringify=pt()}}),X=W({"node_modules/.pnpm/isarray@2.0.5/node_modules/isarray/index.js"(e,t){var n={}.toString;t.exports=Array.isArray||function(e){return n.call(e)==`[object Array]`}}}),ht=W({"node_modules/.pnpm/object-keys@1.1.1/node_modules/object-keys/isArguments.js"(e,t){var n=Object.prototype.toString;t.exports=function(e){var t=n.call(e),r=t===`[object Arguments]`;return r||=t!==`[object Array]`&&typeof e==`object`&&!!e&&typeof e.length==`number`&&e.length>=0&&n.call(e.callee)===`[object Function]`,r}}}),gt=W({"node_modules/.pnpm/object-keys@1.1.1/node_modules/object-keys/implementation.js"(e,t){var n;Object.keys||(r=Object.prototype.hasOwnProperty,i=Object.prototype.toString,a=ht(),o=Object.prototype.propertyIsEnumerable,s=!o.call({toString:null},`toString`),c=o.call(function(){},`prototype`),l=[`toString`,`toLocaleString`,`valueOf`,`hasOwnProperty`,`isPrototypeOf`,`propertyIsEnumerable`,`constructor`],u=function(e){var t=e.constructor;return t&&t.prototype===e},d={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},f=(function(){if(typeof window>`u`)return!1;for(var e in window)try{if(!d[`$`+e]&&r.call(window,e)&&window[e]!==null&&typeof window[e]==`object`)try{u(window[e])}catch{return!0}}catch{return!0}return!1})(),p=function(e){if(typeof window>`u`||!f)return u(e);try{return u(e)}catch{return!1}},n=function(e){var t=typeof e==`object`&&!!e,n=i.call(e)===`[object Function]`,o=a(e),u=t&&i.call(e)===`[object String]`,d=[];if(!t&&!n&&!o)throw TypeError(`Object.keys called on a non-object`);var f=c&&n;if(u&&e.length>0&&!r.call(e,0))for(var m=0;m<e.length;++m)d.push(String(m));if(o&&e.length>0)for(var h=0;h<e.length;++h)d.push(String(h));else for(var g in e)!(f&&g===`prototype`)&&r.call(e,g)&&d.push(String(g));if(s)for(var _=p(e),v=0;v<l.length;++v)!(_&&l[v]===`constructor`)&&r.call(e,l[v])&&d.push(l[v]);return d});var r,i,a,o,s,c,l,u,d,f,p;t.exports=n}}),_t=W({"node_modules/.pnpm/object-keys@1.1.1/node_modules/object-keys/index.js"(e,t){var n=Array.prototype.slice,r=ht(),i=Object.keys,a=i?function(e){return i(e)}:gt(),o=Object.keys;a.shim=function(){return Object.keys?(function(){var e=Object.keys(arguments);return e&&e.length===arguments.length})(1,2)||(Object.keys=function(e){return r(e)?o(n.call(e)):o(e)}):Object.keys=a,Object.keys||a},t.exports=a}}),vt=W({"node_modules/.pnpm/es-object-atoms@1.1.1/node_modules/es-object-atoms/index.js"(e,t){t.exports=Object}}),yt=W({"node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/index.js"(e,t){t.exports=Error}}),bt=W({"node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/eval.js"(e,t){t.exports=EvalError}}),xt=W({"node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/range.js"(e,t){t.exports=RangeError}}),St=W({"node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/ref.js"(e,t){t.exports=ReferenceError}}),Ct=W({"node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/syntax.js"(e,t){t.exports=SyntaxError}}),wt=W({"node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/type.js"(e,t){t.exports=TypeError}}),Tt=W({"node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/uri.js"(e,t){t.exports=URIError}}),Et=W({"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/abs.js"(e,t){t.exports=Math.abs}}),Dt=W({"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/floor.js"(e,t){t.exports=Math.floor}}),Ot=W({"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/max.js"(e,t){t.exports=Math.max}}),kt=W({"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/min.js"(e,t){t.exports=Math.min}}),At=W({"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/pow.js"(e,t){t.exports=Math.pow}}),jt=W({"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/round.js"(e,t){t.exports=Math.round}}),Mt=W({"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/isNaN.js"(e,t){t.exports=Number.isNaN||function(e){return e!==e}}}),Nt=W({"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/sign.js"(e,t){var n=Mt();t.exports=function(e){return n(e)||e===0?e:e<0?-1:1}}}),Pt=W({"node_modules/.pnpm/gopd@1.2.0/node_modules/gopd/gOPD.js"(e,t){t.exports=Object.getOwnPropertyDescriptor}}),Ft=W({"node_modules/.pnpm/gopd@1.2.0/node_modules/gopd/index.js"(e,t){var n=Pt();if(n)try{n([],`length`)}catch{n=null}t.exports=n}}),It=W({"node_modules/.pnpm/es-define-property@1.0.1/node_modules/es-define-property/index.js"(e,t){var n=Object.defineProperty||!1;if(n)try{n({},`a`,{value:1})}catch{n=!1}t.exports=n}}),Lt=W({"node_modules/.pnpm/has-symbols@1.1.0/node_modules/has-symbols/shams.js"(e,t){t.exports=function(){if(typeof Symbol!=`function`||typeof Object.getOwnPropertySymbols!=`function`)return!1;if(typeof Symbol.iterator==`symbol`)return!0;var e={},t=Symbol(`test`),n=Object(t);if(typeof t==`string`||Object.prototype.toString.call(t)!==`[object Symbol]`||Object.prototype.toString.call(n)!==`[object Symbol]`)return!1;var r=42;for(var i in e[t]=r,e)return!1;if(typeof Object.keys==`function`&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames==`function`&&Object.getOwnPropertyNames(e).length!==0)return!1;var a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor==`function`){var o=Object.getOwnPropertyDescriptor(e,t);if(o.value!==r||o.enumerable!==!0)return!1}return!0}}}),Rt=W({"node_modules/.pnpm/has-symbols@1.1.0/node_modules/has-symbols/index.js"(e,t){var n=typeof Symbol<`u`&&Symbol,r=Lt();t.exports=function(){return typeof n!=`function`||typeof Symbol!=`function`||typeof n(`foo`)!=`symbol`||typeof Symbol(`bar`)!=`symbol`?!1:r()}}}),zt=W({"node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/Reflect.getPrototypeOf.js"(e,t){t.exports=typeof Reflect<`u`&&Reflect.getPrototypeOf||null}}),Bt=W({"node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/Object.getPrototypeOf.js"(e,t){t.exports=vt().getPrototypeOf||null}}),Vt=W({"node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/implementation.js"(e,t){var n=`Function.prototype.bind called on incompatible `,r=Object.prototype.toString,i=Math.max,a=`[object Function]`,o=function(e,t){for(var n=[],r=0;r<e.length;r+=1)n[r]=e[r];for(var i=0;i<t.length;i+=1)n[i+e.length]=t[i];return n},s=function(e,t){for(var n=[],r=t,i=0;r<e.length;r+=1,i+=1)n[i]=e[r];return n},c=function(e,t){for(var n=``,r=0;r<e.length;r+=1)n+=e[r],r+1<e.length&&(n+=t);return n};t.exports=function(e){var t=this;if(typeof t!=`function`||r.apply(t)!==a)throw TypeError(n+t);for(var l=s(arguments,1),u,d=function(){if(this instanceof u){var n=t.apply(this,o(l,arguments));return Object(n)===n?n:this}return t.apply(e,o(l,arguments))},f=i(0,t.length-l.length),p=[],m=0;m<f;m++)p[m]=`$`+m;if(u=Function(`binder`,`return function (`+c(p,`,`)+`){ return binder.apply(this,arguments); }`)(d),t.prototype){var h=function(){};h.prototype=t.prototype,u.prototype=new h,h.prototype=null}return u}}}),Ht=W({"node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/index.js"(e,t){var n=Vt();t.exports=Function.prototype.bind||n}}),Ut=W({"node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/functionCall.js"(e,t){t.exports=Function.prototype.call}}),Wt=W({"node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/functionApply.js"(e,t){t.exports=Function.prototype.apply}}),Gt=W({"node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/reflectApply.js"(e,t){t.exports=typeof Reflect<`u`&&Reflect&&Reflect.apply}}),Kt=W({"node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/actualApply.js"(e,t){var n=Ht(),r=Wt(),i=Ut();t.exports=Gt()||n.call(i,r)}}),qt=W({"node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/index.js"(e,t){var n=Ht(),r=wt(),i=Ut(),a=Kt();t.exports=function(e){if(e.length<1||typeof e[0]!=`function`)throw new r(`a function is required`);return a(n,i,e)}}}),Jt=W({"node_modules/.pnpm/dunder-proto@1.0.1/node_modules/dunder-proto/get.js"(e,t){var n=qt(),r=Ft(),i;try{i=[].__proto__===Array.prototype}catch(e){if(!e||typeof e!=`object`||!(`code`in e)||e.code!==`ERR_PROTO_ACCESS`)throw e}var a=!!i&&r&&r(Object.prototype,`__proto__`),o=Object,s=o.getPrototypeOf;t.exports=a&&typeof a.get==`function`?n([a.get]):typeof s==`function`?(function(e){return s(e==null?e:o(e))}):!1}}),Yt=W({"node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/index.js"(e,t){var n=zt(),r=Bt(),i=Jt();t.exports=n?function(e){return n(e)}:r?function(e){if(!e||typeof e!=`object`&&typeof e!=`function`)throw TypeError(`getProto: not an object`);return r(e)}:i?function(e){return i(e)}:null}}),Xt=W({"node_modules/.pnpm/hasown@2.0.2/node_modules/hasown/index.js"(e,t){var n=Function.prototype.call,r=Object.prototype.hasOwnProperty;t.exports=Ht().call(n,r)}}),Zt=W({"node_modules/.pnpm/get-intrinsic@1.3.0/node_modules/get-intrinsic/index.js"(e,t){var n,r=vt(),i=yt(),a=bt(),o=xt(),s=St(),c=Ct(),l=wt(),u=Tt(),d=Et(),f=Dt(),p=Ot(),m=kt(),h=At(),g=jt(),_=Nt(),v=Function,y=function(e){try{return v(`"use strict"; return (`+e+`).constructor;`)()}catch{}},b=Ft(),x=It(),S=function(){throw new l},C=b?(function(){try{return arguments.callee,S}catch{try{return b(arguments,`callee`).get}catch{return S}}})():S,w=Rt()(),T=Yt(),E=Bt(),D=zt(),O=Wt(),k=Ut(),A={},j=typeof Uint8Array>`u`||!T?n:T(Uint8Array),M={__proto__:null,"%AggregateError%":typeof AggregateError>`u`?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>`u`?n:ArrayBuffer,"%ArrayIteratorPrototype%":w&&T?T([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":A,"%AsyncGenerator%":A,"%AsyncGeneratorFunction%":A,"%AsyncIteratorPrototype%":A,"%Atomics%":typeof Atomics>`u`?n:Atomics,"%BigInt%":typeof BigInt>`u`?n:BigInt,"%BigInt64Array%":typeof BigInt64Array>`u`?n:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>`u`?n:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>`u`?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":i,"%eval%":eval,"%EvalError%":a,"%Float16Array%":typeof Float16Array>`u`?n:Float16Array,"%Float32Array%":typeof Float32Array>`u`?n:Float32Array,"%Float64Array%":typeof Float64Array>`u`?n:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>`u`?n:FinalizationRegistry,"%Function%":v,"%GeneratorFunction%":A,"%Int8Array%":typeof Int8Array>`u`?n:Int8Array,"%Int16Array%":typeof Int16Array>`u`?n:Int16Array,"%Int32Array%":typeof Int32Array>`u`?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":w&&T?T(T([][Symbol.iterator]())):n,"%JSON%":typeof JSON==`object`?JSON:n,"%Map%":typeof Map>`u`?n:Map,"%MapIteratorPrototype%":typeof Map>`u`||!w||!T?n:T(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":r,"%Object.getOwnPropertyDescriptor%":b,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>`u`?n:Promise,"%Proxy%":typeof Proxy>`u`?n:Proxy,"%RangeError%":o,"%ReferenceError%":s,"%Reflect%":typeof Reflect>`u`?n:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>`u`?n:Set,"%SetIteratorPrototype%":typeof Set>`u`||!w||!T?n:T(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>`u`?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":w&&T?T(``[Symbol.iterator]()):n,"%Symbol%":w?Symbol:n,"%SyntaxError%":c,"%ThrowTypeError%":C,"%TypedArray%":j,"%TypeError%":l,"%Uint8Array%":typeof Uint8Array>`u`?n:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>`u`?n:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>`u`?n:Uint16Array,"%Uint32Array%":typeof Uint32Array>`u`?n:Uint32Array,"%URIError%":u,"%WeakMap%":typeof WeakMap>`u`?n:WeakMap,"%WeakRef%":typeof WeakRef>`u`?n:WeakRef,"%WeakSet%":typeof WeakSet>`u`?n:WeakSet,"%Function.prototype.call%":k,"%Function.prototype.apply%":O,"%Object.defineProperty%":x,"%Object.getPrototypeOf%":E,"%Math.abs%":d,"%Math.floor%":f,"%Math.max%":p,"%Math.min%":m,"%Math.pow%":h,"%Math.round%":g,"%Math.sign%":_,"%Reflect.getPrototypeOf%":D};if(T)try{null.error}catch(e){N=T(T(e)),M[`%Error.prototype%`]=N}var N,P=function e(t){var n;if(t===`%AsyncFunction%`)n=y(`async function () {}`);else if(t===`%GeneratorFunction%`)n=y(`function* () {}`);else if(t===`%AsyncGeneratorFunction%`)n=y(`async function* () {}`);else if(t===`%AsyncGenerator%`){var r=e(`%AsyncGeneratorFunction%`);r&&(n=r.prototype)}else if(t===`%AsyncIteratorPrototype%`){var i=e(`%AsyncGenerator%`);i&&T&&(n=T(i.prototype))}return M[t]=n,n},F={__proto__:null,"%ArrayBufferPrototype%":[`ArrayBuffer`,`prototype`],"%ArrayPrototype%":[`Array`,`prototype`],"%ArrayProto_entries%":[`Array`,`prototype`,`entries`],"%ArrayProto_forEach%":[`Array`,`prototype`,`forEach`],"%ArrayProto_keys%":[`Array`,`prototype`,`keys`],"%ArrayProto_values%":[`Array`,`prototype`,`values`],"%AsyncFunctionPrototype%":[`AsyncFunction`,`prototype`],"%AsyncGenerator%":[`AsyncGeneratorFunction`,`prototype`],"%AsyncGeneratorPrototype%":[`AsyncGeneratorFunction`,`prototype`,`prototype`],"%BooleanPrototype%":[`Boolean`,`prototype`],"%DataViewPrototype%":[`DataView`,`prototype`],"%DatePrototype%":[`Date`,`prototype`],"%ErrorPrototype%":[`Error`,`prototype`],"%EvalErrorPrototype%":[`EvalError`,`prototype`],"%Float32ArrayPrototype%":[`Float32Array`,`prototype`],"%Float64ArrayPrototype%":[`Float64Array`,`prototype`],"%FunctionPrototype%":[`Function`,`prototype`],"%Generator%":[`GeneratorFunction`,`prototype`],"%GeneratorPrototype%":[`GeneratorFunction`,`prototype`,`prototype`],"%Int8ArrayPrototype%":[`Int8Array`,`prototype`],"%Int16ArrayPrototype%":[`Int16Array`,`prototype`],"%Int32ArrayPrototype%":[`Int32Array`,`prototype`],"%JSONParse%":[`JSON`,`parse`],"%JSONStringify%":[`JSON`,`stringify`],"%MapPrototype%":[`Map`,`prototype`],"%NumberPrototype%":[`Number`,`prototype`],"%ObjectPrototype%":[`Object`,`prototype`],"%ObjProto_toString%":[`Object`,`prototype`,`toString`],"%ObjProto_valueOf%":[`Object`,`prototype`,`valueOf`],"%PromisePrototype%":[`Promise`,`prototype`],"%PromiseProto_then%":[`Promise`,`prototype`,`then`],"%Promise_all%":[`Promise`,`all`],"%Promise_reject%":[`Promise`,`reject`],"%Promise_resolve%":[`Promise`,`resolve`],"%RangeErrorPrototype%":[`RangeError`,`prototype`],"%ReferenceErrorPrototype%":[`ReferenceError`,`prototype`],"%RegExpPrototype%":[`RegExp`,`prototype`],"%SetPrototype%":[`Set`,`prototype`],"%SharedArrayBufferPrototype%":[`SharedArrayBuffer`,`prototype`],"%StringPrototype%":[`String`,`prototype`],"%SymbolPrototype%":[`Symbol`,`prototype`],"%SyntaxErrorPrototype%":[`SyntaxError`,`prototype`],"%TypedArrayPrototype%":[`TypedArray`,`prototype`],"%TypeErrorPrototype%":[`TypeError`,`prototype`],"%Uint8ArrayPrototype%":[`Uint8Array`,`prototype`],"%Uint8ClampedArrayPrototype%":[`Uint8ClampedArray`,`prototype`],"%Uint16ArrayPrototype%":[`Uint16Array`,`prototype`],"%Uint32ArrayPrototype%":[`Uint32Array`,`prototype`],"%URIErrorPrototype%":[`URIError`,`prototype`],"%WeakMapPrototype%":[`WeakMap`,`prototype`],"%WeakSetPrototype%":[`WeakSet`,`prototype`]},I=Ht(),L=Xt(),R=I.call(k,Array.prototype.concat),z=I.call(O,Array.prototype.splice),ee=I.call(k,String.prototype.replace),B=I.call(k,String.prototype.slice),te=I.call(k,RegExp.prototype.exec),V=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,ne=/\\(\\)?/g,re=function(e){var t=B(e,0,1),n=B(e,-1);if(t===`%`&&n!==`%`)throw new c("invalid intrinsic syntax, expected closing `%`");if(n===`%`&&t!==`%`)throw new c("invalid intrinsic syntax, expected opening `%`");var r=[];return ee(e,V,function(e,t,n,i){r[r.length]=n?ee(i,ne,`$1`):t||e}),r},ie=function(e,t){var n=e,r;if(L(F,n)&&(r=F[n],n=`%`+r[0]+`%`),L(M,n)){var i=M[n];if(i===A&&(i=P(n)),i===void 0&&!t)throw new l(`intrinsic `+e+` exists, but is not available. Please file an issue!`);return{alias:r,name:n,value:i}}throw new c(`intrinsic `+e+` does not exist!`)};t.exports=function(e,t){if(typeof e!=`string`||e.length===0)throw new l(`intrinsic name must be a non-empty string`);if(arguments.length>1&&typeof t!=`boolean`)throw new l(`"allowMissing" argument must be a boolean`);if(te(/^%?[^%]*%?$/,e)===null)throw new c("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=re(e),r=n.length>0?n[0]:``,i=ie(`%`+r+`%`,t),a=i.name,o=i.value,s=!1,u=i.alias;u&&(r=u[0],z(n,R([0,1],u)));for(var d=1,f=!0;d<n.length;d+=1){var p=n[d],m=B(p,0,1),h=B(p,-1);if((m===`"`||m===`'`||m==="`"||h===`"`||h===`'`||h==="`")&&m!==h)throw new c(`property names with quotes must have matching quotes`);if((p===`constructor`||!f)&&(s=!0),r+=`.`+p,a=`%`+r+`%`,L(M,a))o=M[a];else if(o!=null){if(!(p in o)){if(!t)throw new l(`base intrinsic for `+e+` exists, but the property is not available.`);return}if(b&&d+1>=n.length){var g=b(o,p);f=!!g,o=f&&`get`in g&&!(`originalValue`in g.get)?g.get:o[p]}else f=L(o,p),o=o[p];f&&!s&&(M[a]=o)}}return o}}}),Qt=W({"node_modules/.pnpm/define-data-property@1.1.4/node_modules/define-data-property/index.js"(e,t){var n=It(),r=Ct(),i=wt(),a=Ft();t.exports=function(e,t,o){if(!e||typeof e!=`object`&&typeof e!=`function`)throw new i("`obj` must be an object or a function`");if(typeof t!=`string`&&typeof t!=`symbol`)throw new i("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!=`boolean`&&arguments[3]!==null)throw new i("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!=`boolean`&&arguments[4]!==null)throw new i("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!=`boolean`&&arguments[5]!==null)throw new i("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!=`boolean`)throw new i("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,l=arguments.length>5?arguments[5]:null,u=arguments.length>6?arguments[6]:!1,d=!!a&&a(e,t);if(n)n(e,t,{configurable:l===null&&d?d.configurable:!l,enumerable:s===null&&d?d.enumerable:!s,value:o,writable:c===null&&d?d.writable:!c});else if(u||!s&&!c&&!l)e[t]=o;else throw new r(`This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.`)}}}),$t=W({"node_modules/.pnpm/has-property-descriptors@1.0.2/node_modules/has-property-descriptors/index.js"(e,t){var n=It(),r=function(){return!!n};r.hasArrayLengthDefineBug=function(){if(!n)return null;try{return n([],`length`,{value:1}).length!==1}catch{return!0}},t.exports=r}}),en=W({"node_modules/.pnpm/set-function-length@1.2.2/node_modules/set-function-length/index.js"(e,t){var n=Zt(),r=Qt(),i=$t()(),a=Ft(),o=wt(),s=n(`%Math.floor%`);t.exports=function(e,t){if(typeof e!=`function`)throw new o("`fn` is not a function");if(typeof t!=`number`||t<0||t>4294967295||s(t)!==t)throw new o("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],c=!0,l=!0;if(`length`in e&&a){var u=a(e,`length`);u&&!u.configurable&&(c=!1),u&&!u.writable&&(l=!1)}return(c||l||!n)&&(i?r(e,`length`,t,!0,!0):r(e,`length`,t)),e}}}),tn=W({"node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/applyBind.js"(e,t){var n=Ht(),r=Wt(),i=Kt();t.exports=function(){return i(n,r,arguments)}}}),nn=W({"node_modules/.pnpm/call-bind@1.0.8/node_modules/call-bind/index.js"(e,t){var n=en(),r=It(),i=qt(),a=tn();t.exports=function(e){var t=i(arguments),r=e.length-(arguments.length-1);return n(t,1+(r>0?r:0),!0)},r?r(t.exports,`apply`,{value:a}):t.exports.apply=a}}),rn=W({"node_modules/.pnpm/call-bound@1.0.4/node_modules/call-bound/index.js"(e,t){var n=Zt(),r=qt(),i=r([n(`%String.prototype.indexOf%`)]);t.exports=function(e,t){var a=n(e,!!t);return typeof a==`function`&&i(e,`.prototype.`)>-1?r([a]):a}}}),an=fe(W({"node_modules/.pnpm/json-stable-stringify@1.3.0/node_modules/json-stable-stringify/index.js"(e,t){var n=(typeof JSON<`u`?JSON:mt()).stringify,r=X(),i=_t(),a=nn(),o=rn(),s=o(`Array.prototype.join`),c=o(`Array.prototype.indexOf`),l=o(`Array.prototype.splice`),u=o(`Array.prototype.sort`),d=function(e,t){for(var n=``,r=0;r<e;r+=1)n+=t;return n},f=function(e,t,n){return n};t.exports=function(e){var t=arguments.length>1?arguments[1]:void 0,o=t&&t.space||``;typeof o==`number`&&(o=d(o,` `));var p=!!t&&typeof t.cycles==`boolean`&&t.cycles,m=t&&t.replacer?a(t.replacer):f;if(t&&t.collapseEmpty!==void 0&&typeof t.collapseEmpty!=`boolean`)throw TypeError("`collapseEmpty` must be a boolean, if provided");var h=!!t&&t.collapseEmpty,g=typeof t==`function`?t:t&&t.cmp,_=g&&function(e){var t=g.length>2&&function(t){return e[t]};return function(n,r){return g({key:n,value:e[n]},{key:r,value:e[r]},t?{__proto__:null,get:t}:void 0)}},v=[];return(function e(t,a,f,g){var y=o?`
10
- `+d(g,o):``,b=o?`: `:`:`;if(f&&f.toJSON&&typeof f.toJSON==`function`&&(f=f.toJSON()),f=m(t,a,f),f!==void 0){if(typeof f!=`object`||!f)return n(f);var x=function(e,t){return h&&e.length===0?t:(t===`[]`?`[`:`{`)+s(e,`,`)+y+(t===`[]`?`]`:`}`)};if(r(f)){for(var S=[],C=0;C<f.length;C++){var w=e(f,C,f[C],g+1)||n(null);S[S.length]=y+o+w}return x(S,`[]`)}if(c(v,f)!==-1){if(p)return n(`__cycle__`);throw TypeError(`Converting circular structure to JSON`)}else v[v.length]=f;for(var T=u(i(f),_&&_(f)),S=[],C=0;C<T.length;C++){var a=T[C],E=e(f,a,f[a],g+1);if(E){var D=n(a)+b+E;S[S.length]=y+o+D}}return l(v,c(v,f),1),x(S,`{}`)}})({"":e},``,e,0)}}})(),1),on=e=>localStorage.getItem(`kizen-flag-${e}`)===`true`,sn=(e=``)=>e.split(``).reduce((e,t)=>(e<<5)-e+t.charCodeAt(0)|0,0),cn=e=>{try{return sn((0,an.default)(e))}catch(e){return on(`script-runner-logging`)&&console.warn(`Failed to stringify object for hashing:`,e),sn(String(Math.random()))}},ln=e=>e.startsWith(`/`),un=[`microphone`,`speaker-selection`,`autoplay`,`camera`,`display-capture`,`hid`],dn=[`allow-popups`,`allow-scripts`,`allow-same-origin`],fn=3e4,pn=100,mn=class{worker;scriptUIRef;onStateChange;done;onError;waitForFrame=!1;plugin;executionPlugin;frameId;onShowToast;onClearToasts;sessionData={};setSessionData;pluginComponentId;onShowModal;onShowCreateRecordModal;onShowCreateRelatedRecordModal;onReleaseBlockingScript;pluginApiName;onNetworkError;onNetworkRequest;invalidateCache;getPendingCacheCount;createFileId;performFileUpload;pushHistory;appPath;constructor(e){this.scriptUIRef=e.scriptUIRef,this.onStateChange=e.onStateChange,this.done=e.done,this.onError=e.onError,this.onReleaseBlockingScript=e.onReleaseBlockingScript,this.worker=e.worker,this.worker.onmessage=this.handleMessage,this.plugin=e.plugin,this.executionPlugin=e.executionPlugin,this.onShowToast=e.onShowToast,this.onClearToasts=e.onClearToasts,this.pluginComponentId=e.pluginComponentId,this.onShowModal=e.onShowModal,this.onShowCreateRecordModal=e.onShowCreateRecordModal,this.onShowCreateRelatedRecordModal=e.onShowCreateRelatedRecordModal,this.onNetworkError=e.onNetworkError,this.onNetworkRequest=e.onNetworkRequest,this.invalidateCache=e.invalidateCache,this.getPendingCacheCount=e.getPendingCacheCount,this.createFileId=e.createFileId,this.performFileUpload=e.performFileUpload,this.pushHistory=e.pushHistory,this.appPath=e.appPath,this.plugin&&(this.frameId=`${I}-${this.plugin.plugin_api_name}-${this.plugin.api_name}`),this.pluginApiName=this.executionPlugin?.plugin_api_name??this.plugin?.plugin_api_name??``,this.pluginApiName?(this.sessionData=e.sessionData[this.pluginApiName],this.setSessionData=t=>{e.setSessionData?.(this.pluginApiName,t)}):this.setSessionData=()=>{this.onError?.({message:`Script must be associated with a plugin to use session data`})}}handleMessage=async e=>{let t=JSON.parse(e.data),{action:n}=t;switch(n){case j.QUERY_REQUEST:{let e=t;await this.handleQueryRequest(e.id,e.method,e.url,e.payload,e.options);return}case j.UI_OUTPUT:{let e=t;this.handleUIOutput(e.markup);return}case j.IFRAME_OUTPUT:{let e=t;this.handleIframeOutput(e.url,e.allow,e.sandbox,e.preserve);return}case j.POSTFORMDATA_REQUEST:{let e=t;this.handleFormPostRequest(e.id,e.url,e.payload,e.createNewTab);return}case j.UPLOADFILE_REQUEST:{let e=t;await this.handleUploadFileRequest(e.id,e.payload);return}case j.SETSTATE:{let e=t;this.onStateChange?.(e.state);return}case j.DONE:{let e=t;this.handleDone(e.preserve,e.result);return}case M.ERROR:{let e=t;this.onError?.({message:e.error});return}case j.OPEN_WINDOW:{let e=t;this.handleOpenWindow(e.url,e.target,e.features);return}case j.COMMUNICATE:{let e=t;this.handleCommunication(e.type,e.recipient,e.args,e.params);return}case j.HIDE:{let{config:e}=t,n=!1;e.hideTrigger&&(n=!0),this.onStateChange?.({hidden:!0,triggerHidden:n});return}case j.SHOW:{let{config:e}=t,n=!1;e.showTrigger===!1&&(n=!0),this.onStateChange?.({hidden:!1,triggerHidden:n});return}case j.EXPAND:this.onStateChange?.({minimized:!1});return;case j.COLLAPSE:this.onStateChange?.({minimized:!0});return;case j.HIDE_HEADER:this.onStateChange?.({hideHeader:!0});return;case j.SHOW_HEADER:this.onStateChange?.({hideHeader:!1});return;case j.COPY_TO_CLIPBOARD:{let e=t;await this.copyToClipboard(e.text);return}case j.OPEN_CREATE_RECORD_MODAL_REQUEST:{let e=t;this.handleCreateRecordRequest(e.id,e.entityId);return}case j.OPEN_CREATE_RELATED_RECORD_MODAL_REQUEST:{let e=t;this.handleCreateRelatedRecordRequest(e.id,e.objectId,e.relatedEntityId);return}case j.SHOW_TOAST:{let e=t;this.showToast(e.message,e.toastOptions);return}case j.CLEAR_TOASTS:this.clearToasts();return;case j.REFRESH_TIMELINE:{let e=t;this.handleRefreshTimeline(e.entityId);return}case j.REFRESH_ENTITY:{let e=t;await this.handleRefreshEntity(e.entityId,e.id);return}case j.UPDATE_SESSION_DATA:{let e=t;this.handleSetSessionData(e.update);return}case j.INSTALL_THIRD_PARTY_SCRIPT_REQUEST:{let e=t;this.handleInstallThirdPartyScriptRequest(e.id,e.url,e.args);return}case j.PROMPT_REQUEST:{let e=t;this.handlePromptRequest(e.id,e.config,!1);return}case j.DYNAMIC_PROMPT_REQUEST:{let e=t;this.handlePromptRequest(e.id,e.config,!0);return}case j.RELEASE_BLOCKING_SCRIPT:this.handleReleaseBlockingScript();return;case j.AUTHORIZE:{let e=t;this.handleAuthorize(e.serviceName,e.config);return}default:return}};handleCommunication=(e,t,n,r)=>{if(e===N.SEND_MESSAGE_TO_FRAME){if(this.frameId){let e=document.getElementById(this.frameId);e&&e.contentWindow?.postMessage({...n?.payload??{},__kizen:{recipient:t,frameId:this.frameId}},n?.path??`*`)}}else if(e===N.CALL_THIRD_PARTY_SCRIPT)this.handleCallThirdPartyScript(t.type,r);else{let r=this.executionPlugin?.plugin_api_name??this.plugin?.plugin_api_name,i=new CustomEvent(`integration:${e}`,{detail:{recipient:{...t,plugin:r},args:n}});window.dispatchEvent(i)}};handleDone=(e,t)=>{this.waitForFrame||this.done(e,t)};postMessage=(e,t)=>{this.worker.postMessage(JSON.stringify({action:e,...t}))};handleSetSessionData=e=>{this.setSessionData(e)};handleQueryRequest=async(e,t,n,r,i)=>{try{let a=await this.onNetworkRequest?.(t,n,r,i);this.postMessage(M.QUERY_RESPONSE,{data:a,id:e})}catch(t){this.onNetworkError?.(t),this.postMessage(M.QUERY_RESPONSE,{error:t,id:e})}};handleUIOutput=e=>{if(this.scriptUIRef?.current){let t=dt.sanitize(e);this.scriptUIRef.current.innerHTML=t}};onLoad=e=>{e.iframe&&(this.waitForFrame=!1,this.handleDone(e.preserve))};handleIframeOutput=(e,t=[],n=[],r=!1)=>{if(this.scriptUIRef?.current){let i=t.filter(e=>un.includes(e)),a=n.filter(e=>dn.includes(e));this.waitForFrame=!0;let o=document.createElement(`iframe`);o.src=e,o.allow=i.join(`; `),a.forEach(e=>{o.sandbox.add(e)}),o.style.border=`none`,o.style.width=`100%`,o.style.height=`100%`,o.onload=this.onLoad.bind(this,{iframe:o,preserve:r}),this.frameId&&(o.id=this.frameId),this.scriptUIRef.current.replaceChildren(o)}};handleCreateRecordRequest=(e,t)=>{this.onShowCreateRecordModal?.(t,t=>{this.postMessage(M.CREATE_RECORD_RESPONSE,{id:e,data:t})})};handleCreateRelatedRecordRequest=(e,t,n)=>{this.onShowCreateRelatedRecordModal?.(t,n,t=>{this.postMessage(M.CREATE_RELATED_RECORD_RESPONSE,{id:e,data:t})})};showToast=(e,t)=>{this.onShowToast?.({message:e,variant:t?.variant??`success`,autohide:t?.autohide??!0})};clearToasts=()=>{this.onClearToasts?.()};copyToClipboard=async e=>{try{await navigator.clipboard.writeText(e)}catch(e){this.onError?.({message:e.message})}};handleRefreshTimeline=e=>{this.invalidateCache?.(`timeline`,e)};waitForIdleState=e=>new Promise(t=>{let n=0,r=setInterval(()=>{(this.getPendingCacheCount?.(e)??0)===0?(clearInterval(r),t(!0)):(n+=1,n>Math.floor(fn/pn)&&(clearInterval(r),t(!1)))},pn)});handleRefreshEntity=async(e,t)=>{this.invalidateCache?.(`entity`,e);let n=await this.waitForIdleState(e);this.postMessage(M.REFRESH_ENTITY_RESPONSE,{id:t,data:{success:n}})};handleFormPostRequest=(e,t,n,r)=>{let i=document.createElement(`form`);i.method=`POST`,i.action=t,r&&(i.target=`_blank`);for(let e in n){let t=document.createElement(`input`);t.type=`hidden`,t.name=e,t.value=n[e],i.appendChild(t)}document.body.appendChild(i),i.submit(),r&&document.body.removeChild(i),this.postMessage(M.POSTFORMDATA_RESPONSE,{success:!0,id:e})};handleUploadFileRequest=async(e,t)=>{if(!this.performFileUpload){this.postMessage(M.UPLOADFILE_RESPONSE,{error:`File upload not supported`,id:e});return}let{file:n,isPublic:r=!1,fileName:i}=t,a=await(await fetch(n)).blob(),o=new File([a],i??`upload-${new Date().toISOString()}`,{type:a.type});o.$id=this.createFileId?.()??ae();let s=await this.performFileUpload({file:o,id:o.$id,publicFile:r,source:`field_value`,handleProgress:e=>{this.postMessage(M.UPLOADFILE_PROGRESS,{fileId:e.id,progress:e.progress})},businessId:void 0});this.postMessage(M.UPLOADFILE_RESPONSE,{data:s,id:e})};waitForReadyState=(e,t,n=0)=>{e||t?.(!0),e?.()?t?.(!0):n<20?setTimeout(()=>{this.waitForReadyState(e,t,n+1)},n*50):t?.(!1)};handleCallThirdPartyScript=(e,t=[])=>{if(e&&V[e]){let n=V[e],r=window[n];r?.(...t)}};handleReleaseBlockingScript=()=>this.onReleaseBlockingScript?.(this.executionPlugin);handlePromptRequest=(e,t,n=!1)=>{this.onShowModal?this.onShowModal({...t,pluginApiName:this.pluginApiName??``,dynamic:n},(t={})=>{this.postMessage(M.PROMPT_RESPONSE,{id:e,data:t})}):this.postMessage(M.PROMPT_RESPONSE,{id:e,data:{canceled:!0}})};handleInstallThirdPartyScriptRequest=(e,t,n={})=>{let r=te(t);if(!r){this.postMessage(M.INSTALL_THIRD_PARTY_SCRIPT_RESPONSE,{data:{success:!1,url:t},id:e});return}let i=ne[r];i(n);let a=document.createElement(`script`);a.onload=()=>{this.waitForReadyState(re[r],n=>{this.postMessage(M.INSTALL_THIRD_PARTY_SCRIPT_RESPONSE,{data:{success:!0,url:t,matched:n},id:e})})},a.onerror=()=>{this.postMessage(M.INSTALL_THIRD_PARTY_SCRIPT_RESPONSE,{data:{success:!1,url:t},id:e})},a.src=t,a.setAttribute(`data-script-url`,t),document.querySelectorAll(`[data-script-url="`+t+`"]`).length>0?this.waitForReadyState(re[r],n=>{this.postMessage(M.INSTALL_THIRD_PARTY_SCRIPT_RESPONSE,{data:{success:!0,url:t,reused:!0,matched:n},id:e})}):document.documentElement.firstChild?.appendChild(a)};handleOpenWindow=(e,t,n)=>{!ln(e)||t===`_blank`||!this.pushHistory?window.open(e,t,n):this.pushHistory(e)};handleAuthorize=(e,t={})=>{let n=new URLSearchParams;if(t.successRedirectPath&&n.append(`success_redirect_path`,t.successRedirectPath),t.errorRedirectPath&&n.append(`error_redirect_path`,t.errorRedirectPath),!this.appPath){this.onError?.({message:`App path is not defined.`});return}if(!this.pluginApiName){this.onError?.({message:`Plugin API name is not defined.`});return}let r=n.toString();this.handleOpenWindow(`${this.appPath}/external-integrations/business-plugin-apps/${this.pluginApiName}/services/${encodeURIComponent(e)}/authorize${r?`?${r}`:``}`,`_blank`,``)};run=(e,t,n)=>{let r=ie();this.postMessage(j.RUN,{script:e,setup:t,args:n,sessionData:this.sessionData,pluginComponentId:this.pluginComponentId,pluginApiName:this.pluginApiName,location:r})}},hn=async({scriptBody:e,user:t,teamMember:n,business:r,onError:i,onReleaseBlockingScript:a,setLoadingState:o,clientObject:s,scriptUIRef:c,onStateChange:l,workerName:u,context:d,args:f=``,plugin:p,onShowToast:m,onClearToasts:h,terminators:g,executionPlugin:_,sessionData:v,setSessionData:y,onShowModal:b,onShowCreateRecordModal:x,onShowCreateRelatedRecordModal:S,onNetworkError:C,onNetworkRequest:w,appPath:T,pushHistory:E,createFileId:D,performFileUpload:O,getPendingCacheCount:k,invalidateCache:A})=>{let j=on(`script-runner-logging`),M;return M=u===`recordDetail`?new Worker(new URL(`/assets/recordDetail.worker-BIHPFt8Y.js`,``+import.meta.url),{type:`module`}):u===`genericPlugin`?new Worker(new URL(`/assets/generic.worker-DRXu0-5B.js`,``+import.meta.url),{type:`module`}):u===`floatingFramePlugin`?new Worker(new URL(`/assets/floatingFrame.worker-CWLtchq3.js`,``+import.meta.url),{type:`module`}):new Worker(new URL(`/assets/calendarSource.worker-C9iglnKD.js`,``+import.meta.url),{type:`module`}),new Promise(u=>{let N=sn(e),P=sn(f),F=`${p?.plugin_api_name??``}-${p?.api_name??``}-${String(N)}-${String(P)}`,I=`${p?.plugin_api_name??``}-${p?.api_name??``}`;_?.field_type?(F=`${_.plugin_api_name??``}-${_.field_type}-${String(N)}-${String(P)}`,I=`${_.plugin_api_name??``}-${_.field_type??_.script_id}`):_&&(F=`${_.plugin_api_name??``}-${_.api_name}-${String(N)}-${String(P)}`,I=`${_.plugin_api_name??``}-${_.api_name}`),g.current[F]&&(g.current[F]?.forEach(e=>{e()}),g.current[F]=[]),g.current[F]??=[],g.current[F]?.push(()=>{M.terminate()});let L=new mn({worker:M,done:(e,t)=>{o(!1),e||(g.current[F]?.forEach(e=>{e()}),g.current[F]=[]),u(t)},onError:i,onReleaseBlockingScript:a,scriptUIRef:c,onStateChange:l,plugin:p,executionPlugin:_,onShowToast:m,onClearToasts:h,sessionData:v,setSessionData:y,pluginComponentId:I,onShowModal:b,onShowCreateRecordModal:x,onShowCreateRelatedRecordModal:S,onNetworkError:C,pushHistory:E,onNetworkRequest:w,appPath:T,createFileId:D,performFileUpload:O,getPendingCacheCount:k,invalidateCache:A});o(!0),L.run(e,{...d,user:t,teamMember:n,business:r,clientObject:s,appPath:T,isDebug:j},f)})},gn=(e,t)=>{let n=new Worker(new URL(`/assets/expression.worker-Cin-WNVB.js`,``+import.meta.url),{type:`module`});return new Promise(r=>{n.onmessage=e=>{let t=JSON.parse(e.data);n.terminate(),r(t.result)};let i=on(`script-runner-logging`);n.postMessage(JSON.stringify({expression:e,args:t,isDebug:i}))})},_n=async(e,t)=>await gn(e,t),vn=async(e,t)=>await gn(e,t),yn=async(e,t)=>await gn(e,t),bn=async(e,t)=>await gn(e,t),xn=e=>({key:`action__${e.api_name}`,type:`custom_object`,label:e.name,allow_multiple:!0}),Sn=(e,t)=>{let n=(e.fields??[]).filter(e=>e.type!==`container`&&e.type!==`description`).map(e=>({...e,when:t?`(${t}) && (${e.when??`true`})`:e.when})),r=(e.fields??[]).filter(e=>e.type===`container`).flatMap(e=>Sn(e,e.when)),i=e.actions?.filter(e=>e.hint_object_name)??[];return[...n,...r,...i.map(e=>({...xn(e),match_hint:e.hint_object_name??``}))]},Cn=(e,t)=>{let n=Sn(e).reduce((e,t)=>({...e,[t.key]:t}),{}),r=Object.keys(t),i={};return r.forEach(e=>{let r=t[e],a=n[e];if(a?.type){switch(a.type){case`boolean`:let t=r;if(!t)return;i[e]=t.value;return;case`custom_object`:{let t=r;if(!t)return;i[e]={objectId:t.value?.id,objectName:t.value?.objectName};return}case`field`:{let t=r;if(!t?.value)return;Array.isArray(t.value)?i[e]=t.value.map(e=>({fieldId:e.value,fieldName:e.label,objectId:t.associatedObject?.id,objectName:t.associatedObject?.name})):typeof t.value==`object`&&typeof t.associatedObject==`object`&&(i[e]={fieldId:t.value.value,fieldName:t.value.label,objectId:t.associatedObject.id,objectName:t.associatedObject.name});return}case`number`:{let t=r;if(!t)return;try{let n=Number(t.value);if(!n&&n!==0)return;i[e]=n}catch{i[e]=NaN}return}case`select`:{let t=r;if(!t)return;i[e]=t.value;return}case`text`:{let t=r?.value;if(t){i[e]=t;return}let n=a.default;n&&(i[e]=n);return}case`description`:case`container`:return}return r?.value}}),i},wn=`integration:${N.RUN_FRAME_SCRIPT}`,Tn={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},En=(e,t,n)=>{let r,i=Tn[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function Dn(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var On={date:Dn({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:Dn({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:Dn({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},kn={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},An=(e,t,n,r)=>kn[e];function jn(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}var Mn={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:jn({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:jn({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:jn({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:jn({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:jn({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function Nn(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?Fn(s,e=>e.test(o)):Pn(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function Pn(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function Fn(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function In(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}var Ln={code:`en-US`,formatDistance:En,formatLong:On,formatRelative:An,localize:Mn,match:{ordinalNumber:In({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:Nn({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:Nn({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:Nn({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:Nn({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:Nn({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}},Rn={};function zn(){return Rn}var Bn=365.2425,Vn=6048e5,Hn=864e5,Un=3600*24;Un*7,Un*Bn/12*3;var Wn=Symbol.for(`constructDateFrom`);function Gn(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&Wn in e?e[Wn](t):e instanceof Date?new e.constructor(t):new Date(t)}function Kn(e,t){return Gn(t||e,e)}function qn(e){let t=Kn(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function Jn(e,...t){let n=Gn.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function Yn(e,t){let n=Kn(e,t?.in);return n.setHours(0,0,0,0),n}function Xn(e,t,n){let[r,i]=Jn(n?.in,e,t),a=Yn(r),o=Yn(i),s=+a-qn(a),c=+o-qn(o);return Math.round((s-c)/Hn)}function Zn(e,t){let n=Kn(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function Qn(e,t){let n=Kn(e,t?.in);return Xn(n,Zn(n))+1}function $n(e,t){let n=zn(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Kn(e,t?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function er(e,t){return $n(e,{...t,weekStartsOn:1})}function tr(e,t){let n=Kn(e,t?.in),r=n.getFullYear(),i=Gn(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=er(i),o=Gn(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=er(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function nr(e,t){let n=tr(e,t),r=Gn(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),er(r)}function rr(e,t){let n=Kn(e,t?.in),r=er(n)-+nr(n);return Math.round(r/Vn)+1}function ir(e,t){let n=Kn(e,t?.in),r=n.getFullYear(),i=zn(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=Gn(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=$n(o,t),c=Gn(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=$n(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function ar(e,t){let n=zn(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=ir(e,t),a=Gn(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),$n(a,t)}function or(e,t){let n=Kn(e,t?.in),r=$n(n,t)-+ar(n,t);return Math.round(r/Vn)+1}function Z(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}var sr={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return Z(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):Z(n+1,2)},d(e,t){return Z(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return Z(e.getHours()%12||12,t.length)},H(e,t){return Z(e.getHours(),t.length)},m(e,t){return Z(e.getMinutes(),t.length)},s(e,t){return Z(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return Z(Math.trunc(r*10**(n-3)),t.length)}},cr={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},lr={G:function(e,t,n){let r=+(e.getFullYear()>0);switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return sr.y(e,t)},Y:function(e,t,n,r){let i=ir(e,r),a=i>0?i:1-i;return t===`YY`?Z(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):Z(a,t.length)},R:function(e,t){return Z(tr(e),t.length)},u:function(e,t){return Z(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return Z(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return Z(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return sr.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return Z(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=or(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):Z(i,t.length)},I:function(e,t,n){let r=rr(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):Z(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):sr.d(e,t)},D:function(e,t,n){let r=Qn(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):Z(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return Z(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return Z(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return Z(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?cr.noon:r===0?cr.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?cr.evening:r>=12?cr.afternoon:r>=4?cr.morning:cr.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return sr.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):sr.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):Z(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):Z(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):sr.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):sr.s(e,t)},S:function(e,t){return sr.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return dr(r);case`XXXX`:case`XX`:return fr(r);default:return fr(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return dr(r);case`xxxx`:case`xx`:return fr(r);default:return fr(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+ur(r,`:`);default:return`GMT`+fr(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+ur(r,`:`);default:return`GMT`+fr(r,`:`)}},t:function(e,t,n){return Z(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return Z(+e,t.length)}};function ur(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+Z(a,2)}function dr(e,t){return e%60==0?(e>0?`-`:`+`)+Z(Math.abs(e)/60,2):fr(e,t)}function fr(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Z(Math.trunc(r/60),2),a=Z(r%60,2);return n+i+t+a}var pr=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},mr=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},hr={p:mr,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return pr(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`});break}return a.replace(`{{date}}`,pr(r,t)).replace(`{{time}}`,mr(i,t))}},gr=/^D+$/,_r=/^Y+$/,vr=[`D`,`DD`,`YY`,`YYYY`];function yr(e){return gr.test(e)}function br(e){return _r.test(e)}function xr(e,t,n){let r=Sr(e,t,n);if(console.warn(r),vr.includes(e))throw RangeError(r)}function Sr(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}function Cr(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function wr(e){return!(!Cr(e)&&typeof e!=`number`||isNaN(+Kn(e)))}var Tr=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Er=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Dr=/^'([^]*?)'?$/,Or=/''/g,kr=/[a-zA-Z]/;function Ar(e,t,n){let r=zn(),i=n?.locale??r.locale??Ln,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=Kn(e,n?.in);if(!wr(s))throw RangeError(`Invalid time value`);let c=t.match(Er).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=hr[t];return n(e,i.formatLong)}return e}).join(``).match(Tr).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:jr(e)};if(lr[t])return{isToken:!0,value:e};if(t.match(kr))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));let l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&br(a)||!n?.useAdditionalDayOfYearTokens&&yr(a))&&xr(a,t,String(e));let o=lr[a[0]];return o(s,a,i.localize,l)}).join(``)}function jr(e){let t=e.match(Dr);return t?t[1].replace(Or,`'`):e}function Mr(e,t){let n=Kn(e,t?.in);return n.setHours(23,59,59,999),n}function Nr(){return Object.assign({},zn())}function Pr(e,t,n){let r=Nr(),i=Lr(e,n.timeZone,n.locale??r.locale);return`formatToParts`in i?Fr(i,t):Ir(i,t)}function Fr(e,t){let n=e.formatToParts(t);for(let e=n.length-1;e>=0;--e)if(n[e].type===`timeZoneName`)return n[e].value}function Ir(e,t){let n=e.format(t).replace(/\u200E/g,``),r=/ [\w-+ ]+$/.exec(n);return r?r[0].substr(1):``}function Lr(e,t,n){return new Intl.DateTimeFormat(n?[n.code,`en-US`]:void 0,{timeZone:t,timeZoneName:e})}function Rr(e,t){let n=Gr(t);return`formatToParts`in n?Br(n,e):Vr(n,e)}var zr={year:0,month:1,day:2,hour:3,minute:4,second:5};function Br(e,t){try{let n=e.formatToParts(t),r=[];for(let e=0;e<n.length;e++){let t=zr[n[e].type];t!==void 0&&(r[t]=parseInt(n[e].value,10))}return r}catch(e){if(e instanceof RangeError)return[NaN];throw e}}function Vr(e,t){let n=e.format(t),r=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(n);return[parseInt(r[3],10),parseInt(r[1],10),parseInt(r[2],10),parseInt(r[4],10),parseInt(r[5],10),parseInt(r[6],10)]}var Hr={},Ur=new Intl.DateTimeFormat(`en-US`,{hourCycle:`h23`,timeZone:`America/New_York`,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}).format(new Date(`2014-06-25T04:00:00.123Z`)),Wr=Ur===`06/25/2014, 00:00:00`||Ur===`‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00`;function Gr(e){return Hr[e]||(Hr[e]=Wr?new Intl.DateTimeFormat(`en-US`,{hourCycle:`h23`,timeZone:e,year:`numeric`,month:`numeric`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}):new Intl.DateTimeFormat(`en-US`,{hour12:!1,timeZone:e,year:`numeric`,month:`numeric`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`})),Hr[e]}function Kr(e,t,n,r,i,a,o){let s=new Date(0);return s.setUTCFullYear(e,t,n),s.setUTCHours(r,i,a,o),s}var qr=36e5,Jr=6e4,Yr={timezone:/([Z+-].*)$/,timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function Xr(e,t,n){if(!e)return 0;let r=Yr.timezoneZ.exec(e);if(r)return 0;let i,a;if(r=Yr.timezoneHH.exec(e),r)return i=parseInt(r[1],10),ei(i)?-(i*qr):NaN;if(r=Yr.timezoneHHMM.exec(e),r){i=parseInt(r[2],10);let e=parseInt(r[3],10);return ei(i,e)?(a=Math.abs(i)*qr+e*Jr,r[1]===`+`?-a:a):NaN}if(ni(e)){t=new Date(t||Date.now());let r=Qr(n?t:Zr(t),e);return-(n?r:$r(t,r,e))}return NaN}function Zr(e){return Kr(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}function Qr(e,t){let n=Rr(e,t),r=Kr(n[0],n[1]-1,n[2],n[3]%24,n[4],n[5],0).getTime(),i=e.getTime(),a=i%1e3;return i-=a>=0?a:1e3+a,r-i}function $r(e,t,n){let r=e.getTime()-t,i=Qr(new Date(r),n);if(t===i)return t;r-=i-t;let a=Qr(new Date(r),n);return i===a?i:Math.max(i,a)}function ei(e,t){return-23<=e&&e<=23&&(t==null||0<=t&&t<=59)}var ti={};function ni(e){if(ti[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),ti[e]=!0,!0}catch{return!1}}var ri=60*1e3,ii={X:function(e,t,n){let r=ai(n.timeZone,e);if(r===0)return`Z`;switch(t){case`X`:return ci(r);case`XXXX`:case`XX`:return si(r);default:return si(r,`:`)}},x:function(e,t,n){let r=ai(n.timeZone,e);switch(t){case`x`:return ci(r);case`xxxx`:case`xx`:return si(r);default:return si(r,`:`)}},O:function(e,t,n){let r=ai(n.timeZone,e);switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+li(r,`:`);default:return`GMT`+si(r,`:`)}},z:function(e,t,n){switch(t){case`z`:case`zz`:case`zzz`:return Pr(`short`,e,n);default:return Pr(`long`,e,n)}}};function ai(e,t){let n=e?Xr(e,t,!0)/ri:t?.getTimezoneOffset()??0;if(Number.isNaN(n))throw RangeError(`Invalid time zone specified: `+e);return n}function oi(e,t){let n=e<0?`-`:``,r=Math.abs(e).toString();for(;r.length<t;)r=`0`+r;return n+r}function si(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=oi(Math.floor(r/60),2),a=oi(Math.floor(r%60),2);return n+i+t+a}function ci(e,t){return e%60==0?(e>0?`-`:`+`)+oi(Math.abs(e)/60,2):si(e,t)}function li(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.floor(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+oi(a,2)}function ui(e){let t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e-+t}var di=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,fi=36e5,pi=6e4,mi=2,Q={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:di};function hi(e,t={}){if(arguments.length<1)throw TypeError(`1 argument required, but only `+arguments.length+` present`);if(e===null)return new Date(NaN);let n=t.additionalDigits==null?mi:Number(t.additionalDigits);if(n!==2&&n!==1&&n!==0)throw RangeError(`additionalDigits must be 0, 1 or 2`);if(e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`)return new Date(e.getTime());if(typeof e==`number`||Object.prototype.toString.call(e)===`[object Number]`)return new Date(e);if(Object.prototype.toString.call(e)!==`[object String]`)return new Date(NaN);let r=gi(e),{year:i,restDateString:a}=_i(r.date,n),o=vi(a,i);if(o===null||isNaN(o.getTime()))return new Date(NaN);if(o){let e=o.getTime(),n=0,i;if(r.time&&(n=yi(r.time),n===null||isNaN(n)))return new Date(NaN);if(r.timeZone||t.timeZone){if(i=Xr(r.timeZone||t.timeZone,new Date(e+n)),isNaN(i))return new Date(NaN)}else i=ui(new Date(e+n)),i=ui(new Date(e+n+i));return new Date(e+n+i)}else return new Date(NaN)}function gi(e){let t={},n=Q.dateTimePattern.exec(e),r;if(n?(t.date=n[1],r=n[3]):(n=Q.datePattern.exec(e),n?(t.date=n[1],r=n[2]):(t.date=null,r=e)),r){let e=Q.timeZone.exec(r);e?(t.time=r.replace(e[1],``),t.timeZone=e[1].trim()):t.time=r}return t}function _i(e,t){if(e){let n=Q.YYY[t],r=Q.YYYYY[t],i=Q.YYYY.exec(e)||r.exec(e);if(i){let t=i[1];return{year:parseInt(t,10),restDateString:e.slice(t.length)}}if(i=Q.YY.exec(e)||n.exec(e),i){let t=i[1];return{year:parseInt(t,10)*100,restDateString:e.slice(t.length)}}}return{year:null}}function vi(e,t){if(t===null)return null;let n,r,i;if(!e||!e.length)return n=new Date(0),n.setUTCFullYear(t),n;let a=Q.MM.exec(e);if(a)return n=new Date(0),r=parseInt(a[1],10)-1,wi(t,r)?(n.setUTCFullYear(t,r),n):new Date(NaN);if(a=Q.DDD.exec(e),a){n=new Date(0);let e=parseInt(a[1],10);return Ti(t,e)?(n.setUTCFullYear(t,0,e),n):new Date(NaN)}if(a=Q.MMDD.exec(e),a){n=new Date(0),r=parseInt(a[1],10)-1;let e=parseInt(a[2],10);return wi(t,r,e)?(n.setUTCFullYear(t,r,e),n):new Date(NaN)}if(a=Q.Www.exec(e),a)return i=parseInt(a[1],10)-1,Ei(i)?bi(t,i):new Date(NaN);if(a=Q.WwwD.exec(e),a){i=parseInt(a[1],10)-1;let e=parseInt(a[2],10)-1;return Ei(i,e)?bi(t,i,e):new Date(NaN)}return null}function yi(e){let t,n,r=Q.HH.exec(e);if(r)return t=parseFloat(r[1].replace(`,`,`.`)),Di(t)?t%24*fi:NaN;if(r=Q.HHMM.exec(e),r)return t=parseInt(r[1],10),n=parseFloat(r[2].replace(`,`,`.`)),Di(t,n)?t%24*fi+n*pi:NaN;if(r=Q.HHMMSS.exec(e),r){t=parseInt(r[1],10),n=parseInt(r[2],10);let e=parseFloat(r[3].replace(`,`,`.`));return Di(t,n,e)?t%24*fi+n*pi+e*1e3:NaN}return null}function bi(e,t,n){t||=0,n||=0;let r=new Date(0);r.setUTCFullYear(e,0,4);let i=r.getUTCDay()||7,a=t*7+n+1-i;return r.setUTCDate(r.getUTCDate()+a),r}var xi=[31,28,31,30,31,30,31,31,30,31,30,31],Si=[31,29,31,30,31,30,31,31,30,31,30,31];function Ci(e){return e%400==0||e%4==0&&e%100!=0}function wi(e,t,n){if(t<0||t>11)return!1;if(n!=null){if(n<1)return!1;let r=Ci(e);if(r&&n>Si[t]||!r&&n>xi[t])return!1}return!0}function Ti(e,t){if(t<1)return!1;let n=Ci(e);return!(n&&t>366||!n&&t>365)}function Ei(e,t){return!(e<0||e>52||t!=null&&(t<0||t>6))}function Di(e,t,n){return!(e<0||e>=25||t!=null&&(t<0||t>=60)||n!=null&&(n<0||n>=60))}var Oi=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function ki(e,t,n={}){t=String(t);let r=t.match(Oi);if(r){let i=hi(n.originalDate||e,n);t=r.reduce(function(e,t){if(t[0]===`'`)return e;let r=e.indexOf(t),a=e[r-1]===`'`,o=e.replace(t,`'`+ii[t[0]](i,t,n)+`'`);return a?o.substring(0,r-1)+o.substring(r+1):o},t)}return Ar(e,t,n)}function Ai(e,t,n){e=hi(e,n);let r=Xr(t,e,!0),i=new Date(e.getTime()-r),a=new Date(0);return a.setFullYear(i.getUTCFullYear(),i.getUTCMonth(),i.getUTCDate()),a.setHours(i.getUTCHours(),i.getUTCMinutes(),i.getUTCSeconds(),i.getUTCMilliseconds()),a}function ji(e,t,n,r){return r={...r,timeZone:t,originalDate:e},ki(Ai(e,t,{timeZone:r.timeZone}),n,r)}var $=n(),Mi=a(),Ni=(0,k.createContext)(null),Pi=({children:e})=>{let t=(0,k.useRef)({}),n=(0,k.useCallback)(()=>{Object.keys(t.current).forEach(e=>{t.current[e]?.forEach(e=>{e()}),t.current[e]=[]})},[]);return(0,k.useEffect)(()=>()=>{n()},[n]),(0,$.jsx)(Ni.Provider,{value:{terminators:t,cleanupWorkers:n},children:e})},Fi=()=>{let e=(0,k.useContext)(Ni);if(!e)throw Error(`useTerminators must be used within a TerminatorsWrapper`);return e},Ii=(0,k.createContext)(null),Li=({children:e})=>{let[t,n]=(0,k.useState)({}),r=(0,k.useCallback)((e,t)=>{n(n=>({...n,[e]:{...n[e],...t}}))},[]);return(0,$.jsx)(Ii.Provider,{value:{sessionData:t,setSessionData:r},children:e})},Ri=()=>{let e=(0,k.useContext)(Ii);if(!e)throw Error(`useSessionData must be used within a SessionDataWrapper`);return e},zi=(0,k.createContext)(null),Bi=({children:e,bootstrapPlugins:t=[],userConfigs:n=[],user:r,teamMember:i,business:a,clientObject:o,appPath:s})=>{let[c,l]=(0,k.useState)(!1),[u,d]=(0,k.useState)({}),f=(0,k.useMemo)(()=>Object.values(u).some(e=>e.waitingOnRouteScript),[u]),p=(0,k.useMemo)(()=>t.reduce((e,t)=>({...e,[t.api_name]:t.id}),{}),[t]),m=(0,k.useMemo)(()=>n.reduce((e,t)=>({...e,[t.api_name]:t.config}),{}),[n]),h=(0,k.useCallback)(()=>{l(!0)},[]);return(0,$.jsx)(zi.Provider,{value:{installedPluginAPINamesToIds:p,userConfigsByApiName:m,user:r,teamMember:i,business:a,clientObject:o,appPath:s,onInitialBootstrap:h,setRouteScriptRunState:d},children:e({waitingOnRouteScript:f,hasFinishedBootstrapping:c})})},Vi=()=>{let e=(0,k.useContext)(zi);if(!e)throw Error(`useAppState must be used within an AppStateWrapper`);return e},Hi=(0,k.createContext)(null),Ui=({children:e})=>{let[t,n]=(0,k.useState)({}),r=(0,k.useCallback)(e=>t=>{n(n=>({...n,[e]:t(n[e]??{indicator:`none`,hidden:!1,pending:!1})}))},[]),i=(0,k.useCallback)(e=>!e||!t[e]?{indicator:`none`,hidden:!1,pending:!1}:{...t[e]},[t]),a=(0,k.useMemo)(()=>{let e=Object.keys(t);return e.length>0&&e.some(e=>t[e]?.indicator===`block`)},[t]);return(0,$.jsx)(Hi.Provider,{value:{getRunnerStateUpdater:r,getRunnerState:i},children:e(a)})},Wi=()=>{let e=(0,k.useContext)(Hi);if(!e)throw Error(`useRunnerState must be used within a RunnerStateWrapper`);return e},Gi=(0,k.createContext)(null),Ki=({children:e,showing:t,showPrompt:n,show:r,onConfirm:i,onHide:a})=>{let[o,s]=(0,k.useState)([]),[c,l]=(0,k.useState)([]),[u,d]=(0,k.useState)([]),f=(0,k.useRef)(void 0),p=(0,k.useRef)(void 0),m=(0,k.useCallback)((e,t)=>{s(n=>[...n,{config:e,cb:t}])},[]),h=(0,k.useCallback)((e,t)=>{l(n=>[...n,{objectId:e,cb:t}])},[]),g=(0,k.useCallback)((e,t,n)=>{d(r=>[...r,{objectId:e,relatedEntityId:t,cb:n}])},[]),_=(0,k.useCallback)(e=>{c[0]?.cb(e),l(e=>e.slice(1))},[c]),v=(0,k.useCallback)(e=>{u[0]?.cb(e),d(e=>e.slice(1))},[u]);(0,k.useEffect)(()=>{o.length>0&&!t&&(f.current=o[0]?.config,p.current=o[0]?.cb,n())},[o,t,n]);let y=(0,k.useCallback)(()=>{f.current=void 0,p.current=void 0,s(e=>e.slice(1))},[]),b=(0,k.useMemo)(()=>({props:{show:r,onConfirm:e=>{i(),p.current&&p.current({canceled:!1,values:e}),y()},onHide:(e,...t)=>{a(...t),p.current&&p.current({canceled:!0,values:{},eventSource:e}),y()}},config:f.current??{}}),[i,a,r,y]);return(0,$.jsx)(Gi.Provider,{value:{modalState:b,showModal:m,showCreateRecordModal:h,showCreateRelatedRecordModal:g,onCreateRecordComplete:_,onCreateRelatedRecordComplete:v},children:e({showPluginModal:b.props.show,pluginApiName:b.config.pluginApiName??``,handleShowModal:m,handleShowCreateRecordModal:h,handleShowCreateRelatedRecordModal:g,derivedModalState:b,handleCreateRecordComplete:_,handleCreateRelatedRecordComplete:v,showCreateRecordModal:c.length>0,createRecordModalObjectId:c[0]?.objectId??``,showCreateRelatedRecordModal:u.length>0,createRelatedRecordModalObjectId:u[0]?.objectId??``,createRelatedRecordModalRelatedEntityId:u[0]?.relatedEntityId??``})})},qi=()=>{let e=(0,k.useContext)(Gi);if(!e)throw Error(`useModals must be used within a ModalsWrapper`);return e},Ji=(0,k.createContext)(null),Yi=({children:e,monitoringExceptionHelper:t})=>{let n=(0,k.useCallback)((e,n)=>{t(e,{extra:n})},[t]);return(0,$.jsx)(Ji.Provider,{value:{sendException:n},children:e})},Xi=()=>{let e=(0,k.useContext)(Ji);if(!e)throw Error(`useMonitoring must be used within an MonitoringWrapper`);return e},Zi=(0,k.createContext)(null),Qi=({children:e,onNavigate:t})=>{let n=(0,k.useCallback)(e=>{t(e,{replace:!1})},[t]),r=(0,k.useCallback)(e=>{t(e,{replace:!0})},[t]);return(0,$.jsx)(Zi.Provider,{value:{push:n,replace:r},children:e})},$i=()=>{let e=(0,k.useContext)(Zi);if(!e)throw Error(`useHistory must be used within an HistoryWrapper`);return e},ea=(0,k.createContext)(null),ta=({children:e,performRequest:t,createFileId:n,performFileUpload:r,getPendingCacheCount:i,invalidateCache:a})=>(0,$.jsx)(ea.Provider,{value:{performRequest:t,createFileId:n,performFileUpload:r,getPendingCacheCount:i,invalidateCache:a},children:e}),na=()=>{let e=(0,k.useContext)(ea);if(!e)throw Error(`useNetwork must be used within a NetworkWrapper`);return e},ra=e=>e,ia=(0,k.createContext)({t:ra}),aa=e=>{let{children:t,t:n=ra}=e;return(0,$.jsx)(ia.Provider,{value:{t:n},children:t})},oa=()=>(0,k.useContext)(ia),sa=(e,t)=>{if(!Array.isArray(e))throw Error(`Return value must be an array`);t.required.forEach(t=>{e.forEach((e,n)=>{if(!(t.key in e))throw Error(`Missing required field: ${t.key} in result row ${String(n)}`);let r=typeof e[t.key];if(r!==t.type)throw Error(`Invalid type for field: ${t.key} in result row ${String(n)}. Expected ${t.type}, got ${r}`)})}),t.optional.forEach(t=>{e.forEach((e,n)=>{if(t.key in e){let r=typeof e[t.key];if(r!==t.type)throw Error(`Invalid type for field: ${t.key} in result row ${String(n)}. Expected ${t.type}, got ${r}`)}})})},ca=({onError:e,showToast:t,clearToasts:n})=>{let{t:r}=oa(),[i,a]=(0,k.useState)(!1),[o,s]=(0,k.useState)(void 0),{terminators:c}=Fi(),{sessionData:l,setSessionData:u}=Ri(),{installedPluginAPINamesToIds:d,userConfigsByApiName:f,user:p,teamMember:m,business:h,clientObject:g,appPath:_}=Vi(),{getRunnerState:v,getRunnerStateUpdater:y}=Wi(),{showModal:b,showCreateRecordModal:x}=qi(),{sendException:S}=Xi(),C=$i(),{performRequest:w,createFileId:T,performFileUpload:E,getPendingCacheCount:D,invalidateCache:O}=na(),A=(0,k.useCallback)(t=>n=>{e?.(n);let r=n?.message??`Unknown plugin error`;S(Error(r),{error:n,workerName:`calendarSource`,pluginApiName:t?.plugin_api_name??``})},[e,S]);return[(0,k.useCallback)(async(i,o,v,S)=>{let k=``,j=oe(o);s(j);try{let e=d[o.plugin_api_name];k=JSON.stringify({...v,pluginId:e,__kizen_user_config:f[o.plugin_api_name]})}catch{A(o)({message:r(`Arguments passed to the script are invalid`)})}let M=!1,N=await hn({user:p,teamMember:m,business:h,onError:A(o),setLoadingState:a,scriptBody:i,clientObject:g,onStateChange:e=>{y(j)(t=>({...t,...e}))},workerName:`calendarSource`,args:k,pushHistory:C.push,onShowToast:t,onClearToasts:n,terminators:c,plugin:o,sessionData:l,setSessionData:u,onShowModal:b,onShowCreateRecordModal:x,onShowCreateRelatedRecordModal:()=>{},onNetworkError:e=>{e?.status===503&&(M=!0)},appPath:_,onNetworkRequest:w,createFileId:T,performFileUpload:E,getPendingCacheCount:D,invalidateCache:O});try{S&&sa(N,S)}catch(t){e?.(t)}return{result:N,authError:M}},[p,m,d,h,g,C,t,n,c,l,u,b,x,A,y,f,e,w,T,_,E,D,O,r]),{...v(o),pending:i}]},la=(0,k.createContext)(null),ua=({children:e,showToast:t,clearToasts:n})=>(0,$.jsx)(la.Provider,{value:{showToast:t,clearToasts:n},children:e}),da=()=>{let e=(0,k.useContext)(la);if(!e)throw Error(`useToast must be used within a ToastWrapper`);return e},fa=async(e,t,n,r)=>{let{result:i,authError:a}=await n(e,t,r,{required:[{key:`id`,type:`string`},{key:`name`,type:`string`}],optional:[{key:`description`,type:`string`}]});return Array.isArray(i)?{result:i,authError:a}:(console.warn(`Expected calendar source script to return an array, but got:`,i),{result:[],authError:a})},pa=async(e,t,n,r)=>{let{result:i,authError:a}=await n(e,t,r,{required:[{key:`id`,type:`string`},{key:`calendar_id`,type:`string`},{key:`title`,type:`string`},{key:`start_time`,type:`number`},{key:`end_time`,type:`number`}],optional:[{key:`description`,type:`string`},{key:`url`,type:`string`},{key:`activity_id`,type:`string`},{key:`all_day`,type:`boolean`},{key:`busy`,type:`boolean`}]});return Array.isArray(i)?{result:i,authError:a}:(console.warn(`Expected calendar event script to return an array, but got:`,i),{result:[],authError:a})},ma=(e,t,n={})=>{let{showToast:r,clearToasts:i}=da(),{t:a}=oa(),[o]=ca({onError:e=>{r({message:`${a(`Error fetching calendar options.`)} ${e?.message??``}`,variant:`failure`})},showToast:r,clearToasts:i}),s=A({queries:t.map(t=>({queryKey:R.CALENDAR_SOURCE_CALENDAR_LIST(t.plugin_api_name,t.api_name),queryFn:async()=>{let e=n[t.plugin_api_name]?.business_config??{},{result:r,authError:i}=await fa(t.calendars_script,t,o,e);return{source:t,calendars:r,authError:i}},enabled:e&&!!t.calendars_script}))}),c=s.some(e=>e.isLoading);return{calendars:(0,k.useMemo)(()=>c||!e?{}:s.reduce((e,t)=>{if(!t.data?.source.plugin_api_name||typeof t.data.source.plugin_api_name!=`string`)return e;let n=t.data.source.plugin_api_name;return e[n]??=[],e[n].push(...t.data.calendars.map(e=>({calendar:e,source:t.data.source}))),e},{}),[s,c,e]),errorServices:(0,k.useMemo)(()=>s.filter(e=>e.data?.authError).map(e=>e.data?.source.plugin_api_name),[s]),isLoading:c}},ha=`yyyy-MM-dd'T'HH:mm:ssXXX`,ga=e=>{if(!/^\d{4}-\d{2}-\d{2}$/.test(e))throw Error(`Invalid date string: ${e}. Expected format: YYYY-MM-DD`);let[t,n,r]=e.split(`-`).map(Number);return new Date(t,n-1,r)},_a=(e,t)=>ji(e,t,ha),va=(e,t,n={})=>{let r=Intl.DateTimeFormat().resolvedOptions().timeZone,i=_a(Yn(ga(t.rangeStart)),r),a=_a(Mr(ga(t.rangeEnd)),r),{showToast:o,clearToasts:s}=da(),{t:c}=oa(),[l]=ca({onError:e=>{o({message:`${c(`Error fetching calendar events.`)} ${e?.message??``}`,variant:`failure`})},showToast:o,clearToasts:s}),u=A({queries:e.map(({calendar:e,source:r})=>({queryKey:R.CALENDAR_SOURCE_EVENTS(r.plugin_api_name,r.api_name,e.id,t),queryFn:async()=>{let t=n[r.plugin_api_name]?.business_config??{},{result:o,authError:s}=await pa(r.events_script,r,l,{...t,calendar:{calendar_id:e.id,range_start:i,range_end:a}});return{calendarId:e.id,events:o,authError:s}}}))}),d=u.some(e=>e.isLoading),f=(0,k.useMemo)(()=>e.reduce((e,{calendar:t,source:n})=>(e[t.id]={source:n,calendar:t},e),{}),[e]);return{events:(0,k.useMemo)(()=>d?{}:u.reduce((e,t)=>(t.data?.calendarId&&(e[t.data.calendarId]=t.data.events),e),{}),[u,d]),sources:f,isLoading:d}},ya=({onError:e,scriptUIRef:t,plugin:n,onChangeMinimized:r})=>{let{terminators:i}=Fi(),{sessionData:a,setSessionData:o}=Ri(),{installedPluginAPINamesToIds:s,userConfigsByApiName:c,user:l,teamMember:u,business:d,clientObject:f,appPath:p}=Vi(),{showModal:m,showCreateRecordModal:h,showCreateRelatedRecordModal:g}=qi(),{sendException:_}=Xi(),{showToast:v,clearToasts:y}=da(),b=$i(),{performRequest:x,createFileId:S,performFileUpload:C,getPendingCacheCount:w,invalidateCache:T}=na(),{t:E}=oa(),[D,O]=(0,k.useState)(!1),[A,j]=(0,k.useState)({indicator:`none`,hidden:!0,triggerHidden:!1,hideHeader:!1}),M=(0,k.useRef)(!1),[N,P]=(0,k.useState)(!1);D&&!M.current&&(M.current=!0),!D&&M.current&&!N&&P(!0);let F=(0,k.useCallback)(t=>{e?.(t);let r=t?.message??`Unknown plugin error`;_(Error(r),{error:t,workerName:`floatingFrame`,pluginApiName:n.plugin_api_name})},[e,n,_]);return[(0,k.useCallback)((e,_)=>{let D=``;try{let e=s[n.plugin_api_name];D=JSON.stringify({..._,pluginId:e,__kizen_user_config:c[n.plugin_api_name]})}catch{F({message:E(`Arguments passed to the script are invalid`)})}return hn({user:l,teamMember:u,business:d,onError:F,setLoadingState:(...e)=>{(0,Mi.flushSync)(()=>{O(...e)})},scriptBody:e,clientObject:f,scriptUIRef:t,onStateChange:e=>{let{minimized:t,...n}=e;typeof t==`boolean`&&r?.(t),j(e=>({...e,...n}))},workerName:`floatingFramePlugin`,args:D,pushHistory:b.push,plugin:n,onShowToast:v,onClearToasts:y,terminators:i,sessionData:a,setSessionData:o,onShowModal:m,onShowCreateRecordModal:h,onShowCreateRelatedRecordModal:g,appPath:p,onNetworkRequest:x,createFileId:S,performFileUpload:C,getPendingCacheCount:w,invalidateCache:T})},[l,u,d,s,f,t,b,n,r,v,y,i,a,o,F,j,c,m,h,g,x,p,S,C,w,T,E]),{...A,pending:N?!1:D}]},ba=({onError:e,scriptUIRef:t,plugin:n})=>{let{terminators:r}=Fi(),{sessionData:i,setSessionData:a}=Ri(),{installedPluginAPINamesToIds:o,userConfigsByApiName:s,user:c,teamMember:l,business:u,clientObject:d,appPath:f}=Vi(),{getRunnerState:p,getRunnerStateUpdater:m}=Wi(),{showModal:h,showCreateRecordModal:g}=qi(),{sendException:_}=Xi(),{showToast:v,clearToasts:y}=da(),b=$i(),{performRequest:x,createFileId:S,performFileUpload:C,getPendingCacheCount:w,invalidateCache:T}=na(),{t:E}=oa(),[D,O]=(0,k.useState)(!1),[A,j]=(0,k.useState)(void 0),M=(0,k.useCallback)((t,r)=>{e?.(t);let i=t?.message??`Unknown plugin error`;_(Error(i),{error:t,workerName:`genericPlugin`,pluginApiName:n?.plugin_api_name??r?.plugin_api_name??``})},[e,n,_]);return[(0,k.useCallback)((e,p,_)=>{let D=``,k=oe(_);j(k);try{let e=o[n?.plugin_api_name??_?.plugin_api_name??``];D=JSON.stringify({...p,pluginId:e,__kizen_user_config:s[n?.plugin_api_name??_?.plugin_api_name??``]})}catch{M({message:E(`Arguments passed to the script are invalid`)})}return hn({user:c,teamMember:l,business:u,onError:M,setLoadingState:O,scriptBody:e,clientObject:d,scriptUIRef:t,onStateChange:e=>{m(k)(t=>({...t,...e}))},workerName:`genericPlugin`,args:D,pushHistory:b.push,onShowToast:v,onClearToasts:y,terminators:r,plugin:n,executionPlugin:_,sessionData:i,setSessionData:a,onShowModal:h,onShowCreateRecordModal:g,onShowCreateRelatedRecordModal:()=>{},appPath:f,onNetworkRequest:x,createFileId:S,performFileUpload:C,getPendingCacheCount:w,invalidateCache:T})},[c,l,o,u,d,t,b,v,y,r,n,i,a,M,m,s,h,g,x,f,S,C,w,T,E]),{...p(A),pending:D}]},xa=({entityId:e,objectId:t,onError:n,scriptUIRef:r,onReleaseBlockingScript:i})=>{let{terminators:a}=Fi(),{sessionData:o,setSessionData:s}=Ri(),{installedPluginAPINamesToIds:c,userConfigsByApiName:l,user:u,teamMember:d,business:f,clientObject:p,appPath:m}=Vi(),{getRunnerState:h,getRunnerStateUpdater:g}=Wi(),{showModal:_,showCreateRecordModal:v,showCreateRelatedRecordModal:y}=qi(),{sendException:b}=Xi(),{showToast:x,clearToasts:S}=da(),C=$i(),{performRequest:w,createFileId:T,performFileUpload:E,getPendingCacheCount:D,invalidateCache:O}=na(),{t:A}=oa(),[j,M]=(0,k.useState)(!1),[N,P]=(0,k.useState)(void 0),F=(0,k.useCallback)((r,i)=>{n?.(r);let a=r?.message??`Unknown plugin error`;b(Error(a),{error:r,workerName:`recordDetail`,pluginApiName:i?.plugin_api_name??``,objectId:t,entityId:e})},[n,t,e,b]);return[(0,k.useCallback)((n,h,b,k)=>{let j=``;try{let e=c[b?.plugin_api_name??``];j=JSON.stringify({...h,pluginId:e,__kizen_user_config:l[b?.plugin_api_name??``]})}catch{F({message:A(`Arguments passed to the script are invalid`)},b)}let N=oe(b);return P(N),hn({user:u,teamMember:d,business:f,onReleaseBlockingScript:i,onError:e=>{F(e,b)},setLoadingState:M,scriptBody:n,clientObject:p,scriptUIRef:r,onStateChange:e=>{g(N)(t=>({...t,...e}))},workerName:`recordDetail`,args:j,context:k??{entityId:e,objectId:t},pushHistory:C.push,onShowToast:x,onClearToasts:S,terminators:a,executionPlugin:b,sessionData:o,setSessionData:s,onShowModal:_,onShowCreateRecordModal:v,onShowCreateRelatedRecordModal:y,appPath:m,onNetworkRequest:w,createFileId:T,performFileUpload:E,getPendingCacheCount:D,invalidateCache:O})},[u,d,c,f,e,t,p,r,C,x,S,a,o,s,_,v,y,i,F,g,l,w,m,T,E,D,O,A]),{...h(N),pending:j}]},Sa=(e,t)=>{let{showToast:n}=da(),{t:r}=oa(),i=(0,k.useRef)(null),a=(0,k.useRef)(null),o=e?.css,s=(0,k.useMemo)(()=>{let t=e?.html;return t?dt.sanitize(t):null},[e]),c=(0,k.useMemo)(()=>e?.event_scripts??{},[e]),[l,{pending:u}]=ba({onError:e=>{n({message:`${r(`Script could not be executed:`)} ${e?.message??`Unknown Error`}`,variant:`failure`})},scriptUIRef:i,plugin:e}),d=(0,k.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),!u){let n=e.target.getAttribute(`data-script`);n&&c[n]&&l(c[n],t)}},[u,l,c,t]);return(0,k.useEffect)(()=>{let e=a.current;return e&&e.addEventListener(`click`,d),()=>{e&&e.removeEventListener(`click`,d)}},[d,e]),{scopedCss:`
11
- @scope {
12
- ${o??``}
13
- }
14
- `,sanitizedHtml:s,outputUIRef:i,interactableScriptRef:a}},Ca=(e,t,n,r,i={})=>{let a=(0,k.useMemo)(()=>t?.event_scripts??{},[t]),o=(0,k.useCallback)(t=>{if(t.preventDefault(),t.stopPropagation(),!r){let n=t.target.getAttribute(`data-script`);n&&a[n]&&e(a[n],{...i})}},[r,e,a,i]);(0,k.useEffect)(()=>{let e=n?.current;return e&&e.addEventListener(`click`,o),()=>{e&&e.removeEventListener(`click`,o)}},[o,t,n])},wa=(e,t,n)=>{let r=e?.iframe_url,i=e?.script,a=e?.callback,o=e?.args,{showToast:s}=da(),{t:c}=oa(),l=(0,k.useRef)(null),[u,{pending:d}]=ba({onError:e=>{s({message:`${c(`Plugin error:`)} ${e?.message??``}`,variant:`failure`})},scriptUIRef:l,plugin:e}),f=(0,k.useMemo)(()=>{let e=new URLSearchParams(t);return{...Object.fromEntries(e),...o}},[t,o]),{outputUIRef:p,scopedCss:m,sanitizedHtml:h,interactableScriptRef:g}=Sa(e,f);Ca(u,e,l,d);let _=(0,k.useRef)(!1);(0,k.useEffect)(()=>{!r&&!_.current&&i&&!n&&(_.current=!0,u(i,f))},[r,u,i,f,n]);let v=(0,k.useCallback)(e=>{let t=e.data;if(t?.type===`kizen:plugin_callback`){let e=t.query;a&&u(a,e)}},[u,a]);return(0,k.useEffect)(()=>(window.addEventListener(`message`,v),()=>{window.removeEventListener(`message`,v)}),[v]),{scriptUIRef:l,outputUIRef:p,scopedCss:m,sanitizedHtml:h,interactableScriptRef:g,iframeURL:r,pending:d}},Ta=(0,k.createContext)(null),Ea=({children:e})=>{let[t,n]=(0,k.useState)([]),[r,i]=(0,k.useState)(!1),a=(0,k.useCallback)((e,t)=>{n(n=>{let r=[e,...n.filter(t=>t!==e)];return t?.(r),r})},[]),o=(0,k.useMemo)(()=>[...t].reverse().reduce((e,t,n)=>({...e,[t]:n}),{}),[t]);return(0,k.useEffect)(()=>{let e=new MutationObserver(()=>{document.querySelector(`div[role="dialog"]`)?i(!0):i(!1)});return e.observe(document.body,{childList:!0}),()=>{e.disconnect()}},[]),(0,$.jsx)(Ta.Provider,{value:{touchFloatingFrame:a,floatingFrameOffset:o},children:e(r)})},Da=()=>{let e=(0,k.useContext)(Ta);if(!e)throw Error(`useFloatingFrame must be used within a FloatingFrameWrapper`);return e},Oa=[`^/$`,`^/login*`,`/settings/mine$`,`/settings/others$`,`/create-new-business$`,`^/choose-business*`,`^/inactive-business$`,`^/reset$`,`/welcome$`,`/embed/*`,`/create-new-business$`,`/businessbuilder`],ka=[`https://js.stripe.com`],Aa=(e,t,n,r)=>e<n?t<r?`top-left`:`top-right`:t<r?`bottom-left`:`bottom-right`,ja=e=>{let{currentWindow:t,pathname:n,id:r,frameHeaderSize:i,defaultPositionGap:a=0,viewportHeight:o=window.innerHeight,hiddenByModal:s,updateEmployeeConfig:c}=e,l=(0,k.useRef)(null),u=(0,k.useRef)(!1),{showToast:d}=da(),{t:f}=oa(),{installedPluginAPINamesToIds:p,clientObject:m}=Vi(),{touchFloatingFrame:h,floatingFrameOffset:g}=Da(),_=g[r]??-1,v=t.minimized_style===`none`,y=t.minimized_style===`circle`||v,b=t.default_position===`bottom-right-fixed`,x=t.default_position===`bottom-left-fixed`,S=b||x,C=t.minimized_config?.icon??`action-drag-handle`,w=t.minimized_config?.color??`blue`,T=(0,k.useMemo)(()=>{let e=n.split(`/`),t=e[1],r=e[2];if(t===`client`)return{objectId:m?.id,entityId:r};if(t===`custom-objects`)return{objectId:r,entityId:e[3]}},[m,n]),E=(0,k.useMemo)(()=>{let e=t.match,r=t.ignore;return!!(e?.length&&!e.some(e=>new RegExp(e).test(n))||Oa.concat(r??[]).filter(Boolean).some(e=>{try{return new RegExp(e).test(n)}catch{return!1}}))},[t,n]),D=t.plugin_api_name?p[t.plugin_api_name]:``,[O,A]=(0,k.useState)(()=>t.employee_config?.[r]?.minimized??!1),j=t.script,M=t.type,N=t.args,P=t.message_handler,F=t.width??0,[I,L]=(0,k.useState)(()=>{let e=window.innerHeight;return Math.min(t.height??0,e-i)}),[R,z]=(0,k.useState)(null),ee=t.default_position,B=(0,k.useCallback)(e=>{let n=t.employee_config?.[r]?.position;if(!n?.quadrant){let t=window.innerWidth-F,r=window.innerHeight-I-i;if(O&&!e&&(r=window.innerHeight-i),n)try{let e=n;return e.left>t&&(e.left=t),e.top>r&&(e.top=r),e.left<0&&(e.left=a),e.top<0&&(e.top=a),e}catch{}let o=t;return ee===`bottom-left`&&(o=a),{left:o,top:r-a}}else if(n.quadrant===`top-left`){let e=n.deltas?.left??0,t=n.deltas?.top??0;return{...n,left:e,top:t}}else if(n.quadrant===`top-right`){let e=window.innerWidth-F-(n.deltas?.right??0),t=n.deltas?.top??0;return{...n,left:e,top:t}}else if(n.quadrant===`bottom-left`){let e=n.deltas?.left??0,t=window.innerHeight-(O?0:I)-(n.deltas?.bottom??0)-i;return{...n,left:e,top:t}}else{let e=window.innerWidth-F-(n.deltas?.right??0),t=window.innerHeight-(O?0:I)-(n.deltas?.bottom??0)-i;return{...n,left:e,top:t}}},[t,r,ee,O,F,I,i,a]),te=(0,k.useCallback)(e=>{let t=B(e),n=[`bottom-right`,`bottom-left`].includes(t.quadrant??``)&&O?0:I;return t.left<0?t.left=0:t.left>window.innerWidth-F&&(t.left=window.innerWidth-F),t.top<0?t.top=0:t.top>window.innerHeight-n&&(t.top=window.innerHeight-n),t},[B,F,I,O]);(0,k.useEffect)(()=>{let e=t.height??0;if(e>o){L(o-i);let e=B(!0);e.top=0,z(e)}else L(e)},[t.height,B,o,i]);let[V,ne]=(0,k.useState)(O),[re,ie]=(0,k.useState)(O&&y),ae=I*5e-4*1e3,oe=e=>{A(e),e&&y?setTimeout(()=>{ie(e)},ae):y&&ie(e),s?setTimeout(()=>{ne(e)},ae):ne(e),(R?.quadrant===`bottom-left`||R?.quadrant===`bottom-right`)&&z(e?e=>e?{...e,top:e.top+I}:null:e=>{if(!e)return null;let t=window.innerHeight,n=e.top>=0&&e.top+I<=t;return{...e,top:n?e.top:e.top-I}}),c?.(r,O,R)({minimized:e})},[H,{pending:se,hidden:U,indicator:ce,triggerHidden:le,hideHeader:ue}]=ya({onError:e=>{d({message:`${f(`Plugin error:`)} ${e?.message??``}`,variant:`failure`})},scriptUIRef:l,plugin:t,onChangeMinimized:e=>{oe(e)}}),W=(0,k.useMemo)(()=>ue&&S,[ue,S]),de=(0,k.useMemo)(()=>{if(!R)return`top`;let{left:e,top:t}=R;return window.innerWidth-(e+F)<40?`left`:t<40?`bottom`:`top`},[R,F]),fe=(0,k.useCallback)(()=>{let e=x?`left`:`right`,n=`${t.plugin_api_name}-${t.api_name}-trigger-${e}`;return document.getElementById(n)},[x,t]),pe=(0,k.useCallback)(()=>{if(!S)return;let e=fe();if(!e)return;let t=e.getBoundingClientRect(),n=O?0:I,r=W?0:i,o=t.top-(n+r)-a,s=x?t.left:t.right-F,c=n+r,l=Math.max(0,window.innerWidth-F),u=Math.max(0,window.innerHeight-c);s=Math.min(Math.max(0,s),l),o=Math.min(Math.max(0,o),u),z({left:s,top:o,quadrant:x?`bottom-left`:`bottom-right`,deltas:{top:o,left:s,right:window.innerWidth-(s+F),bottom:window.innerHeight-(o+c)}})},[S,x,I,O,F,W,fe,i,a]);(0,k.useEffect)(()=>{S&&pe()},[S,I,O,pe]),(0,k.useEffect)(()=>{if(!S)return;pe();let e=new ResizeObserver(()=>{pe()});return e.observe(document.body),()=>{e.disconnect()}},[S,pe]),(0,k.useEffect)(()=>{!u.current&&j&&M===`script`&&!E&&(u.current=!0,H(j,{...N}))},[H,j,M,N,E]),(0,k.useEffect)(()=>{let e=e=>{let n=e;if(n?.detail?.recipient?.frame===t.api_name){let e=n.detail;if(e.recipient?.plugin!==t.plugin_api_name)return;e.recipient.script&&t.event_scripts?.[e.recipient.script]&&H(t.event_scripts[e.recipient.script]??``,{...e.args,...N,...T})}};return window.addEventListener(wn,e),()=>{window.removeEventListener(wn,e)}},[t,H,N,T]);let[me,he]=(0,k.useState)(!1),ge=(e,t)=>{he(!1),h(r);let n=window.innerWidth,i=window.innerHeight;if(t.node){let e=t.node.getBoundingClientRect(),a=e.left,o=e.top,s=o+e.height,l=a+e.width,u=o,d=i-s,f=a,p=n-l,m={left:a,right:l,top:o,quadrant:Aa(u,f,d,p),deltas:{top:u,bottom:d,left:f,right:p}};z(m),c?.(r,O,R)({position:m})}};(0,k.useEffect)(()=>{let e=()=>{S?pe():z(te(!1))};return window.addEventListener(`resize`,e),()=>{window.removeEventListener(`resize`,e)}},[S,pe,te]),Ca(H,t,l,se,N),(0,k.useEffect)(()=>{let e=e=>{e.source!==window&&P&&!ka.includes(e.origin)&&H(P,{...N,eventData:e.data})};return window.addEventListener(`message`,e),()=>{window.removeEventListener(`message`,e)}},[H,N,P]);let{outputUIRef:_e,scopedCss:G,sanitizedHtml:K,interactableScriptRef:ve}=Sa(t,{}),ye=V?U||E||s:U||E,be=`floating-window-parent--${r}`,xe=`floating-drag-handle--${r}`,Se=`floating-window-content--${r}`,Ce=t.employee_config?.[r]?.position?.quadrant?.split(`-`)[1]===`right`?`right`:`left`;x?Ce=`left`:b&&(Ce=`right`);let we=t.minimized_config?.customIcon,Te=null;return we?.startsWith(`data:image/`)&&(Te=({className:e=``})=>(0,$.jsx)(`img`,{src:we,alt:t.title||`Open Frame`,className:`object-cover select-none pointer-events-none ${e}`})),R||z(te(!1)),{circleProps:{id:r,side:Ce,circleIcon:C,CustomIcon:Te,circleColor:w,onClick:()=>{oe(!O)},hidden:!!(ye||E||v||le)},parentProps:{className:be,dragging:me,hidden:ye||re||E||v},draggableProps:{onStop:ge,onStart:()=>{he(!0)},bounds:`.${be}`,handle:`.${xe}`,defaultPosition:{x:R?.left??0,y:R?.top??0},position:{x:R?.left??0,y:R?.top??0},disabled:S},floatProps:{pending:se,width:F,dragging:me,height:I,isCircle:y&&O},contentProps:{className:Se,dragging:me,solid:!0},minimized:O,pending:se,indicator:ce,hideHeader:W,isFixed:S,isCircle:y,outputUIRef:_e,scopedCss:G,sanitizedHtml:K,interactableScriptRef:ve,tooltipPosition:de,currentPluginId:D,setMinimized:oe,dragHandleClassName:xe,height:I,script:j,dragging:me,frameOffset:_,scriptUIRef:l}},Ma=()=>{(0,k.useEffect)(()=>{let e=null,t=t=>{if(!t.detail?.location)return;let n=cn(t.detail.location);n!==e&&(e=n,document.querySelectorAll(`iframe[id^=${I}-]`).forEach(e=>{let n=null;try{n=new URL(e.src,window.location.href).origin}catch(e){on(`script-runner-logging`)&&console.warn(`Failed to parse iframe src for location change message target origin:`,e),n=null}n&&e.contentWindow?.postMessage({action:F,location:t.detail?.location},n)}))};return window.addEventListener(P,t),()=>{window.removeEventListener(P,t)}},[])},Na=new w,Pa=({children:e})=>(0,k.useContext)(u)?(0,$.jsx)($.Fragment,{children:e}):(0,$.jsx)(d,{client:Na,children:e}),Fa=e=>{let{children:t,bootstrapPlugins:n=[],userConfigs:r=[],user:i,teamMember:a,business:o,clientObject:s,onNavigate:c,modal:l,monitoringExceptionHelper:u,showToast:d,clearToasts:f,performRequest:p,appPath:m,hideFramesOnModal:h=!0,createFileId:g,performFileUpload:_,t:v}=e;return Ma(),(0,$.jsx)(Pa,{children:(0,$.jsx)(Bi,{bootstrapPlugins:n,userConfigs:r,user:i,teamMember:a,business:o,clientObject:s,appPath:m,children:({hasFinishedBootstrapping:e,waitingOnRouteScript:n})=>(0,$.jsx)(aa,{t:v,children:(0,$.jsx)(Ui,{children:r=>(0,$.jsx)(Qi,{onNavigate:c,children:(0,$.jsx)(Ki,{...l,children:i=>(0,$.jsx)(Yi,{monitoringExceptionHelper:u,children:(0,$.jsx)(Li,{children:(0,$.jsx)(Pi,{children:(0,$.jsx)(ua,{showToast:d,clearToasts:f,children:(0,$.jsx)(Ea,{children:a=>(0,$.jsx)(ta,{performRequest:p,createFileId:g,performFileUpload:_,children:t({...i,showLoadingIndicator:r,hasFinishedBootstrapping:e,waitingOnRouteScript:n,hiddenByModal:h?a:!1})})})})})})})})})})})})})},Ia=(0,k.createContext)(null),La=Ia.Provider,Ra=(e,t)=>{if(e===`custom_object`)return t?.id},za=(e,t)=>{if(e.type===`custom_object`)return e.allow_multiple?(t?.value??[]).length>0:!!t?.value?.id;if(e.type===`field`)return e.allow_multiple?(t?.value??[]).length>0:!!t?.value?.value;if(e.type===`text`)return!!(t?.value??``).trim();if(e.type===`number`){let e=Number(t?.value);return!!t?.value&&!isNaN(e)}else if(e.type===`select`)return e.allow_multiple?(t?.value??[]).length>0:!!t?.value?.value;else if(e.type===`boolean`)return!!t?.value;return!1},Ba=e=>{let t=(e.fields??[]).filter(e=>e.type===`custom_object`),n=(e.fields??[]).filter(e=>e.type===`container`).flatMap(e=>Ba(e)),r=e.actions?.filter(e=>e.hint_object_name)??[];return[...t,...n,...r.map(e=>({...xn(e),match_hint:e.hint_object_name??``}))]},Va=e=>{let t=(e.fields??[]).filter(e=>e.type===`field`),n=(e.fields??[]).filter(e=>e.type===`container`).flatMap(e=>Va(e));return[...t,...n]},Ha=({children:e,config:t,value:n,onStateChange:r,disabledKeys:i,templateAssociationsByActionApiName:a,getObjectByAPIName:o,getCustomObjectDetails:s})=>{let[c,l]=(0,k.useState)(n??{}),u=(0,k.useMemo)(()=>Sn(t),[t]),d=(0,k.useMemo)(()=>u.reduce((e,t)=>({...e,[t.key]:{type:t.type,value:t.default}}),{}),[u]),f=(0,k.useMemo)(()=>{let e={...Object.entries(a??{}).reduce((e,[t,n])=>{let r=`action__${t}`,i=n.map(e=>({id:e.custom_object.id??``,objectName:e.custom_object.object_name??`Unknown Object`}));return i.length>0&&n.length>0&&n[0]&&(e[r]={type:`custom_object`,value:i,config:xn(n[0].browser_js_action_template)}),e},{}),...c};return i?.forEach(t=>{e[t]&&(e[t]=void 0)}),e},[c,a,i]),p=(0,k.useRef)(!!n),m=(0,k.useRef)({}),[h,g]=(0,k.useState)(!n),[_,v]=(0,k.useState)({}),[y,b]=(0,k.useState)({}),[x,S]=(0,k.useState)(!1),C=(0,k.useRef)(null),[w,T]=(0,k.useState)({}),[E,D]=(0,k.useState)(!1),[O,A]=(0,k.useState)(!0),j=(0,k.useRef)({}),M=(0,k.useCallback)((e,t)=>{j.current[e]=t},[]),N=(0,k.useCallback)(e=>{typeof e==`function`?l(t=>{let n=e(t);return m.current=n,r?.(n),n}):(m.current=e,l(e),r?.(e)),T({})},[r]),P=(0,k.useCallback)((e,t)=>{if(e.startsWith(`{{`)&&e.endsWith(`}}`)){let n=e.slice(2,-2).trim();return Ra(t[n]?.type,t[n]?.value)}return e},[]),F=(0,k.useCallback)(e=>P(e,f),[f,P]),{clientObject:I}=Vi(),L=(0,k.useCallback)(async e=>e===`client_client`&&I?[{id:I.id,object_name:I.objectName}]:await o(e),[I,o]),R=(0,k.useCallback)(async()=>{let e=Ba(t);for(let t of e){if(!t.match_hint)continue;let e=await L(t.match_hint);if(e?.[0]){let n={id:e[0].id,objectName:e[0].object_name};N(e=>({...e,[t.key]:{type:`custom_object`,value:t.allow_multiple?[n]:n}}))}}},[t,N,L]),z=(0,k.useCallback)(()=>Va(t),[t]),ee=(0,k.useCallback)(async(e,t)=>{let n=z(),r={};for(let i of n){if(!i.object_id)continue;let n=t??P(i.object_id,m.current);if(e&&!i.object_id.includes(e))continue;if(!r[n]&&n)try{r[n]=await s(n)}catch{}let a=r[n];if(a){let e=a.fields.find(e=>e.name===i.match_hint);e&&N(t=>({...t,[i.key]:{type:`field`,value:{value:e.id,label:e.displayName},associatedObject:{id:n,name:a.objectName}}}))}}},[P,z,N,s]),B=(0,k.useCallback)(async e=>{let n=Ba(t).find(t=>t.key===e);if(n?.match_hint){let t=``,r=(await L(n.match_hint))?.[0];r&&(t=r.id,N(t=>({...t,[e]:{type:`custom_object`,value:{id:r.id,objectName:r.object_name}}})),t&&ee(void 0,t))}},[t,N,ee,L]),te=(0,k.useCallback)(async()=>{await R(),await ee(),g(!1)},[R,ee]),V=(0,k.useCallback)(()=>Va(t),[t]),ne=(0,k.useCallback)(e=>ee(e),[ee]),re=(0,k.useCallback)(()=>{C.current&&=(clearTimeout(C.current),null),C.current=setTimeout(()=>{S(!0)},500)},[]),ie=(0,k.useCallback)(async(e,t)=>{re(),v(e=>({...e,[t]:!0})),D(!0);let n=await _n(e,{...d,...f});return b(e=>(e[t]===!1&&typeof n==`boolean`&&n&&(f[t]||B(t)),{...e,[t]:n})),v(e=>({...e,[t]:!1})),n},[f,re,B,d]);p.current||(p.current=!0,te());let ae=(0,k.useCallback)(e=>y[e]===!1,[y]),oe=(0,k.useCallback)(e=>_[e]===!0,[_]),H=(0,k.useCallback)(e=>{if(w[e])return{message:w[e],showMessage:!0,error:!0}},[w]),se=(0,k.useMemo)(()=>{let e=(t.fields??[]).filter(e=>e.type===`container`).map(e=>e.when),n=u.map(e=>e.when);return[...e,...n].filter(Boolean)},[t,u]),U=(0,k.useMemo)(()=>u.reduce((e,t)=>(e[t.key]=t,e),{}),[u]),ce=(0,k.useCallback)((e,t,n)=>{t.add(e);let r=U[e];r?.dependencies?.length&&r.dependencies.forEach(e=>{n.has(e)||(n.add(e),ce(e,t,n))})},[U]),le=(0,k.useMemo)(()=>u.map(e=>{let t=new Set,n=e.dependencies??[],r=new Set;return n.forEach(e=>{ce(e,t,r)}),{...e,dependencies:Array.from(t)}}),[u,ce]),ue=(0,k.useCallback)(e=>{le.filter(t=>t.dependencies.length===0?!1:t.dependencies.includes(e)&&t.key!==e).forEach(e=>{j.current[e.key]?.()})},[le]),W=(0,k.useCallback)(async()=>{let e=(await Promise.all(u.map(async e=>e.when?await _n(e.when,{...d,...f})?e:null:e))).filter(Boolean),t=0;for(let n of e)n&&n.required&&!za(n,f[n.key])?(T(e=>({...e,[n.key]:`This field is required`})),t++):n?.validation_pattern?new RegExp(n.validation_pattern).test(f[n.key]?.value??n.default??``)||(T(e=>({...e,[n.key]:`Value must match the pattern ${n.validation_pattern??``}`})),t++):n&&T(e=>({...e,[n.key]:void 0}));return{isValid:t===0,includedKeys:e.map(e=>e?.key).filter(e=>!!e)}},[f,u,d]);(0,k.useEffect)(()=>{re()},[re]);let de=Object.values(_).filter(Boolean).length;return!E&&se.length===0&&D(!0),E&&O&&de===0&&A(!1),(0,$.jsx)(La,{value:{state:f,setState:N,interpolateValue:F,getNestedFields:V,reInferFieldsForObject:ne,inferencePending:h,evaluateExpression:ie,shouldHideField:ae,shouldDisableField:oe,expressionsIdle:x,getFieldErrorState:H,validateForm:W,waitingExpressionCount:de,initialExpressionsPending:O,flattenedFields:u,flattenedFieldsByKey:U,afterFieldChange:ue,registerFieldResetter:M,disabledKeys:i??[]},children:e})},Ua=()=>{let e=(0,k.useContext)(Ia);if(!e)throw Error(`useSetupAssistant must be used within a SetupAssistantController`);return e};function Wa(e,t=!1){let n=Ua(),{evaluateExpression:r,shouldHideField:i,getFieldErrorState:a,disabledKeys:o}=n;(0,k.useEffect)(()=>{e.when&&r(e.when,e.key)},[e.when,e.key,r]);let s=i(e.key),c=o.includes(e.key)||t,l=a(e.key);return{...n,shouldHide:s,isDisabled:c,errorState:l}}var Ga=({field:e,disabled:t=!1})=>{let{state:n,setState:r,afterFieldChange:i,registerFieldResetter:a,isDisabled:o,shouldHide:s,errorState:c}=Wa(e,t),l=n[e.key]?.value??e.default??!1,u=l===!0||l===`true`,d=(0,k.useCallback)(t=>{r(n=>({...n,[e.key]:{type:`boolean`,value:t}})),i(e.key)},[e.key,r,i]);return(0,k.useEffect)(()=>{a(e.key,()=>{d(void 0)})},[e.key,a,d]),s?null:(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:u,onChange:e=>{d(e.target.checked)},disabled:o,className:`h-3.5 w-3.5 cursor-pointer accent-blue-600`}),(0,$.jsxs)(`span`,{className:`text-[13px] ${o?`text-neutral-400`:`text-neutral-700`}`,children:[e.label,e.required&&(0,$.jsx)(`span`,{className:`text-red-500 ml-0.5`,children:`*`})]}),e.tooltip&&(0,$.jsx)(`span`,{className:`text-[11px] text-neutral-400`,title:e.tooltip,children:`?`})]}),c?.showMessage&&c.message&&(0,$.jsx)(`span`,{className:`text-[11px] text-red-500`,children:c.message})]})},Ka=({field:e,pluginApiName:t,disabled:n=!1})=>{let{shouldHide:r}=Wa(e,n),i=e.columns??1;return r?null:(0,$.jsxs)(`div`,{children:[e.label&&(0,$.jsx)(`h3`,{className:`text-[14px] font-semibold text-neutral-800 mb-3 mt-4`,children:e.label}),(0,$.jsx)(`div`,{className:`gap-4`,style:{display:`grid`,gridTemplateColumns:`repeat(${String(i)}, 1fr)`},children:e.fields?.map(e=>(0,$.jsx)(Za,{field:e,pluginApiName:t,disabled:n},e.key))})]})},qa=({field:e})=>e.label?(0,$.jsxs)(`label`,{className:`text-[12px] font-medium text-neutral-600`,children:[e.label,e.required&&(0,$.jsx)(`span`,{className:`text-red-500 ml-0.5`,children:`*`}),e.tooltip&&(0,$.jsx)(`span`,{className:`ml-1 text-neutral-400 cursor-help`,title:e.tooltip,children:`?`})]}):null,Ja=({anchorRef:e,open:t,children:n,className:r})=>{let[i,a]=(0,k.useState)({});return(0,k.useEffect)(()=>{if(!t||!e.current)return;let n=()=>{let t=e.current;if(!t)return;let n=t.getBoundingClientRect(),r=window.innerHeight-n.bottom;r<196&&n.top>r?a({position:`fixed`,zIndex:999999,left:n.left,width:n.width,bottom:window.innerHeight-n.top+4,maxHeight:192}):a({position:`fixed`,zIndex:999999,left:n.left,width:n.width,top:n.bottom+4,maxHeight:192})};return n(),window.addEventListener(`scroll`,n,!0),window.addEventListener(`resize`,n),()=>{window.removeEventListener(`scroll`,n,!0),window.removeEventListener(`resize`,n)}},[t,e]),t?(0,Mi.createPortal)((0,$.jsx)(`div`,{style:i,className:`overflow-auto rounded border border-black/10 bg-white font-mono shadow-lg ${r??``}`,onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},children:n}),document.body):null},Ya=({label:e,value:t,onChange:n,onSelect:a,options:o,loading:s,placeholder:c,disabled:l,keepOpenOnSelect:u})=>{let[d,f]=(0,k.useState)(!1),p=(0,k.useRef)(null);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e&&(0,$.jsx)(`label`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-500`,children:e}),(0,$.jsxs)(`div`,{ref:p,className:`relative`,children:[(0,$.jsx)(i,{icon:r,className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-[10px] text-neutral-400`}),(0,$.jsx)(`input`,{type:`text`,className:`w-full rounded border border-black/10 bg-white py-1.5 pl-7 pr-2.5 font-mono text-[12px] text-neutral-800 focus:border-neutral-400 focus:outline-none disabled:opacity-50`,value:t,placeholder:c,disabled:l,onChange:e=>{n(e.target.value)},onFocus:()=>{f(!0)},onBlur:()=>{f(!1)}})]}),(0,$.jsxs)(Ja,{anchorRef:p,open:d,children:[s&&(0,$.jsx)(`div`,{className:`px-3 py-2 text-[12px] text-neutral-400`,children:`Loading…`}),!s&&o.length===0&&t.length===0&&(0,$.jsx)(`div`,{className:`px-3 py-2 text-[12px] text-neutral-400`,children:`Start typing to search…`}),!s&&o.length===0&&t.length>0&&(0,$.jsx)(`div`,{className:`px-3 py-2 text-[12px] text-neutral-400`,children:`No results`}),!s&&o.map(e=>(0,$.jsx)(`div`,{className:`cursor-pointer px-3 py-2 text-[12px] text-neutral-800 hover:bg-neutral-100`,onClick:()=>{a(e.id,e.label),u||f(!1)},children:e.label},e.id))]})]})},Xa={container:Ka,custom_object:({field:e,disabled:t=!1})=>{let{state:n,setState:r,getNestedFields:i,reInferFieldsForObject:a,shouldDisableField:o,registerFieldResetter:s,afterFieldChange:c,isDisabled:l,shouldHide:u,errorState:d}=Wa(e,t),f=o(e.key)||l,[p,m]=(0,k.useState)(``),[h,g]=(0,k.useState)([]),[_,v]=(0,k.useState)(!1),y=(0,k.useRef)(null),b=T(),x=C(),S=(0,k.useCallback)(async e=>{v(!0);try{let t=new URLSearchParams({page_size:`20`});e&&t.set(`search`,e);let n=await(await b(`/custom-objects?${t.toString()}`)).json(),r=(Array.isArray(n)?n:n.results??[]).map(e=>({id:e.id,label:e.object_name})),i=x?.business.client_object;i?.access&&(!e||i.object_name.toLowerCase().includes(e.toLowerCase()))&&r.unshift({id:i.id,label:i.object_name}),g(r)}catch{g([])}finally{v(!1)}},[b,x]),w=e.allow_multiple?n[e.key]?.value??[]:[],E=(0,k.useCallback)((t,i)=>{let a=n[e.key]?.value??[];a.some(e=>e.id===t)||(r(n=>({...n,[e.key]:{type:`custom_object`,value:[...a,{id:t,objectName:i}]}})),c(e.key),m(``))},[n,e.key,r,c]),D=(0,k.useCallback)(t=>{let i=n[e.key]?.value??[];r(n=>({...n,[e.key]:{type:`custom_object`,value:i.filter(e=>e.id!==t)}})),c(e.key)},[n,e.key,r,c]),O=e.allow_multiple?void 0:n[e.key]?.value,A=(0,k.useRef)(!1);(0,k.useEffect)(()=>{!e.allow_multiple&&O?.objectName&&!A.current&&(m(O.objectName),A.current=!0)},[e.allow_multiple,O]);let j=(0,k.useCallback)(t=>{m(t),O&&(r(t=>Object.fromEntries(Object.entries(t).filter(([t])=>t!==e.key))),c(e.key)),y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{S(t)},300)},[O,e.key,r,c,S]),M=(0,k.useCallback)((t,n)=>{m(n),r(r=>({...r,[e.key]:{type:`custom_object`,value:{id:t,objectName:n}}}));let o=i().filter(t=>t.object_id?.includes(e.key));for(let e of o)r(t=>Object.fromEntries(Object.entries(t).filter(([t])=>t!==e.key)));a(e.key),c(e.key)},[e.key,r,i,a,c]),N=(0,k.useCallback)(t=>{e.allow_multiple?(m(t),y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{S(t)},300)):j(t)},[e.allow_multiple,j,S]),P=(0,k.useCallback)((t,n)=>{e.allow_multiple?E(t,n):M(t,n)},[e.allow_multiple,E,M]);if((0,k.useEffect)(()=>{s(e.key,()=>{r(t=>Object.fromEntries(Object.entries(t).filter(([t])=>t!==e.key))),m(``),A.current=!1})},[e.key,s,r]),u)return null;if(e.allow_multiple){let t=h.filter(e=>!w.some(t=>t.id===e.id));return(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(qa,{field:e}),w.length>0&&(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1 mb-1`,children:w.map(e=>(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-neutral-100 px-2 py-0.5 text-[11px] text-neutral-700`,children:[e.objectName,(0,$.jsx)(`button`,{type:`button`,onClick:()=>{D(e.id)},disabled:f,className:`text-neutral-400 hover:text-neutral-600`,"aria-label":`Remove ${e.objectName}`,children:`×`})]},e.id))}),(0,$.jsx)(Ya,{value:p,onChange:N,onSelect:P,options:t,loading:_,placeholder:e.placeholder??`Search for objects...`,disabled:f,keepOpenOnSelect:!0}),d?.showMessage&&d.message&&(0,$.jsx)(`span`,{className:`text-[11px] text-red-500`,children:d.message})]})}return(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(qa,{field:e}),(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(Ya,{value:p,onChange:N,onSelect:P,options:h,loading:_,placeholder:e.placeholder??`Search for an object...`,disabled:f}),O&&(0,$.jsx)(`button`,{type:`button`,onClick:()=>{r(t=>Object.fromEntries(Object.entries(t).filter(([t])=>t!==e.key))),m(``),A.current=!1,c(e.key)},disabled:f,className:`absolute right-2 top-1/2 -translate-y-1/2 text-[11px] text-neutral-400 hover:text-neutral-600`,"aria-label":`Clear selection`,children:`×`})]}),d?.showMessage&&d.message&&(0,$.jsx)(`span`,{className:`text-[11px] text-red-500`,children:d.message})]})},field:({field:e,disabled:t=!1})=>{let{interpolateValue:n,state:r,setState:i,registerFieldResetter:a,afterFieldChange:o,isDisabled:s,shouldHide:c,errorState:l}=Wa(e,t),u=n(e.object_id??``),[d,f]=(0,k.useState)([]),[p,m]=(0,k.useState)(``),[h,g]=(0,k.useState)(!1),[_,v]=(0,k.useState)(null),y=T();(0,k.useEffect)(()=>{!u||u===_||c||(async()=>{g(!0);try{m((await(await y(`/custom-objects/${u}`)).json()).object_name??``);let e=await(await y(`/custom-objects/${u}/fields`)).json();f((Array.isArray(e)?e:e.results??[]).map(e=>({label:e.display_name,value:e.id}))),v(u)}catch{f([])}finally{g(!1)}})()},[u,_,y,e.key,c]);let b=r[e.key]?.value,x=(0,k.useCallback)(t=>{i(n=>({...n,[e.key]:{type:`field`,value:t,associatedObject:{id:u,name:p}}})),o(e.key)},[e.key,i,u,p,o]);if((0,k.useEffect)(()=>{a(e.key,()=>{i(t=>Object.fromEntries(Object.entries(t).filter(([t])=>t!==e.key)))})},[e.key,a,i]),c)return null;let S=!u||s;if(e.allow_multiple){let t=Array.isArray(b)?b:[];return(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(qa,{field:e}),(0,$.jsx)(`div`,{className:`rounded border p-2 text-[13px] ${l?.error?`border-red-300`:`border-black/10`} ${S?`bg-neutral-50`:`bg-white`}`,children:h?(0,$.jsx)(`span`,{className:`text-neutral-400 text-[12px]`,children:`Loading fields...`}):u?d.length===0?(0,$.jsx)(`span`,{className:`text-neutral-400 text-[12px]`,children:`No fields available`}):(0,$.jsx)(`div`,{className:`flex flex-col gap-1 max-h-48 overflow-y-auto`,children:d.map(e=>{let n=t.some(t=>t.value===e.value);return(0,$.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:n,disabled:S,onChange:()=>{x(n?t.filter(t=>t.value!==e.value):[...t,e])},className:`h-3 w-3 accent-blue-600`}),(0,$.jsx)(`span`,{className:`text-[12px]`,children:e.label})]},e.value)})}):(0,$.jsx)(`span`,{className:`text-neutral-400 text-[12px]`,children:`Select an object first`})}),l?.showMessage&&l.message&&(0,$.jsx)(`span`,{className:`text-[11px] text-red-500`,children:l.message})]})}let C=b&&!Array.isArray(b)?b.value:``;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(qa,{field:e}),h?(0,$.jsx)(`div`,{className:`w-full rounded border border-black/10 px-2 py-1.5 text-[12px] text-neutral-400 bg-neutral-50`,children:`Loading fields...`}):(0,$.jsxs)(`select`,{value:C,onChange:e=>{let t=d.find(t=>t.value===e.target.value);t&&x(t)},disabled:S,className:`w-full rounded border px-2 py-1.5 text-[13px] font-mono focus:outline-none focus:ring-1 ${l?.error?`border-red-300 focus:ring-red-400`:`border-black/10 focus:ring-blue-400`} ${S?`bg-neutral-50 text-neutral-400`:`bg-white`}`,children:[(0,$.jsx)(`option`,{value:``,children:u?`Choose a field`:`Select an object first`}),d.map(e=>(0,$.jsx)(`option`,{value:e.value,children:e.label},e.value))]}),l?.showMessage&&l.message&&(0,$.jsx)(`span`,{className:`text-[11px] text-red-500`,children:l.message})]})},text:({field:e,disabled:t=!1})=>{let{state:n,setState:r,afterFieldChange:i,registerFieldResetter:a,isDisabled:o,shouldHide:s,errorState:c}=Wa(e,t),[l,u]=(0,k.useState)(n[e.key]?.value??e.default??``),d=(0,k.useCallback)(t=>{r(n=>({...n,[e.key]:{type:`text`,value:t}})),i(e.key)},[e.key,r,i]);return(0,k.useEffect)(()=>{a(e.key,()=>{u(``),d(``)})},[e.key,a,d]),(0,k.useEffect)(()=>{let e=setTimeout(()=>{d(l)},300);return()=>{clearTimeout(e)}},[l,d]),s?null:(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(qa,{field:e}),(0,$.jsx)(`input`,{type:`text`,value:l,onChange:e=>{u(e.target.value)},placeholder:e.placeholder??e.default??`Enter text`,disabled:o,className:`rounded border px-2 py-1.5 text-[13px] font-mono focus:outline-none focus:ring-1 ${c?.error?`border-red-300 focus:ring-red-400`:`border-black/10 focus:ring-blue-400`} ${o?`bg-neutral-50 text-neutral-400`:`bg-white`}`}),c?.showMessage&&c.message&&(0,$.jsx)(`span`,{className:`text-[11px] text-red-500`,children:c.message})]})},description:({field:e})=>{let{shouldHide:t}=Wa(e);return t?null:(0,$.jsx)(`div`,{className:`text-[13px] text-neutral-500 leading-relaxed`,children:e.content})},number:({field:e,disabled:t=!1})=>{let{state:n,setState:r,afterFieldChange:i,registerFieldResetter:a,isDisabled:o,shouldHide:s,errorState:c}=Wa(e,t),l=n[e.key]?.value??e.default??``,[u,d]=(0,k.useState)(String(l)),f=(0,k.useCallback)(t=>{r(n=>({...n,[e.key]:{type:`number`,value:t}})),i(e.key)},[e.key,r,i]);return(0,k.useEffect)(()=>{a(e.key,()=>{d(``),f(``)})},[e.key,a,f]),(0,k.useEffect)(()=>{let e=setTimeout(()=>{f(u)},300);return()=>{clearTimeout(e)}},[u,f]),s?null:(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(qa,{field:e}),(0,$.jsx)(`input`,{type:`number`,value:u,onChange:e=>{d(e.target.value)},placeholder:e.placeholder??e.default??`Enter a number`,disabled:o,className:`rounded border px-2 py-1.5 text-[13px] font-mono focus:outline-none focus:ring-1 ${c?.error?`border-red-300 focus:ring-red-400`:`border-black/10 focus:ring-blue-400`} ${o?`bg-neutral-50 text-neutral-400`:`bg-white`}`}),c?.showMessage&&c.message&&(0,$.jsx)(`span`,{className:`text-[11px] text-red-500`,children:c.message})]})},select:({field:e,pluginApiName:t,disabled:n=!1})=>{let{state:r,setState:i,inferencePending:a,initialExpressionsPending:o,expressionsIdle:s,afterFieldChange:c,registerFieldResetter:l,isDisabled:u,shouldHide:d,errorState:f}=Wa(e,n),p=!a&&!o&&s,[m,h]=(0,k.useState)([]),[g,_]=(0,k.useState)(!1),v=(0,k.useRef)(null),[y,b]=(0,k.useState)(``),[x,S]=(0,k.useState)(``),[C,w]=(0,k.useState)(!1),E=(0,k.useRef)(null),D=!!(e.getFetchUrl||e.optionMapper),O=r[e.key]?.value,A=T(),j=(0,k.useCallback)(t=>{i(n=>({...n,[e.key]:{type:`select`,value:t}})),c(e.key)},[c,e.key,i]);(0,k.useEffect)(()=>{l(e.key,()=>{i(t=>Object.fromEntries(Object.entries(t).filter(([t])=>t!==e.key))),b(``),S(``)})},[e.key,l,i]),(0,k.useEffect)(()=>{if(!e.typeahead)return;let t=setTimeout(()=>{S(y)},300);return()=>{clearTimeout(t)}},[y,e.typeahead]);let M=(0,k.useMemo)(()=>e.typeahead?{...r,search:x}:r,[r,x,e.typeahead]),N=(0,k.useMemo)(()=>JSON.stringify(M),[M]),P=(0,k.useCallback)(async n=>{_(!0);try{let r={__kizen_state:{value:{...n,pluginApiName:t}}},i;if(e.getFetchUrl){let t=await vn(e.getFetchUrl,r);if(t){let n=e.fetchMethod??`GET`,a={"Content-Type":`application/json`},o=null;if(e.getHeaders&&(a=await bn(e.getHeaders,r)),n===`POST`&&e.getBody){let t=await bn(e.getBody,r);o=JSON.stringify(t)}if(t.startsWith(`/`))i={data:await(await A(t,{method:n,headers:a,...o!=null&&{body:o}})).json()};else{let e=await fetch(t,{method:n,headers:a,...o!=null&&{body:o}});e.ok&&(i=await e.json())}}}if(e.optionMapper){let r=await yn(e.optionMapper,{__kizen_state:{value:{...n,result:i,pluginApiName:t}}});h(structuredClone(r))}else Array.isArray(i)&&h(i)}catch{h([])}finally{_(!1)}},[e,t,A]);if((0,k.useEffect)(()=>{!D||!p||d||e.typeahead||v.current!==N&&(v.current=N,P(M))},[D,p,N,M,e.typeahead,d,P]),(0,k.useEffect)(()=>{!D||!p||d||!e.typeahead||C&&v.current!==N&&(v.current=N,P(M))},[D,p,N,M,e.typeahead,C,d,P]),(0,k.useEffect)(()=>{!D||!e.autoSelect||e.typeahead||u||d||O||m.length===1&&m[0]&&(e.allow_multiple?j([m[0]]):j(m[0]))},[D,e.autoSelect,e.typeahead,e.allow_multiple,u,d,O,m,j]),d)return null;let F=D?m:e.options??[];if(e.allow_multiple){let t=Array.isArray(O)?O:[];return(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(qa,{field:e}),(0,$.jsx)(`div`,{className:`rounded border p-2 text-[13px] ${f?.error?`border-red-300`:`border-black/10`} ${u?`bg-neutral-50`:`bg-white`}`,children:g?(0,$.jsx)(`span`,{className:`text-neutral-400 text-[12px]`,children:`Loading options...`}):F.length===0?(0,$.jsx)(`span`,{className:`text-neutral-400 text-[12px]`,children:`No options available`}):(0,$.jsx)(`div`,{className:`flex flex-col gap-1 max-h-48 overflow-y-auto`,children:F.map(e=>{let n=t.some(t=>t.value===e.value);return(0,$.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:n,disabled:u,onChange:()=>{j(n?t.filter(t=>t.value!==e.value):[...t,e])},className:`h-3 w-3 accent-blue-600`}),(0,$.jsx)(`span`,{className:`text-[12px]`,children:e.label})]},e.value)})})}),f?.showMessage&&f.message&&(0,$.jsx)(`span`,{className:`text-[11px] text-red-500`,children:f.message})]})}if(e.typeahead){let t=O&&!Array.isArray(O)?O.label:``;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(qa,{field:e}),(0,$.jsxs)(`div`,{ref:E,className:`relative`,children:[(0,$.jsx)(`input`,{type:`text`,value:t&&!C?t:y,placeholder:e.placeholder??`Search...`,disabled:u,onChange:t=>{b(t.target.value),O&&(i(t=>Object.fromEntries(Object.entries(t).filter(([t])=>t!==e.key))),c(e.key))},onFocus:()=>{w(!0),t&&b(t)},onBlur:()=>{w(!1)},className:`w-full rounded border px-2 py-1.5 text-[13px] font-mono focus:outline-none focus:ring-1 ${f?.error?`border-red-300 focus:ring-red-400`:`border-black/10 focus:ring-blue-400`} ${u?`bg-neutral-50 text-neutral-400`:`bg-white`}`}),t&&!C&&(0,$.jsx)(`button`,{type:`button`,onClick:()=>{i(t=>Object.fromEntries(Object.entries(t).filter(([t])=>t!==e.key))),b(``),S(``),c(e.key)},disabled:u,className:`absolute right-2 top-1/2 -translate-y-1/2 text-[11px] text-neutral-400 hover:text-neutral-600`,"aria-label":`Clear selection`,children:`×`})]}),(0,$.jsxs)(Ja,{anchorRef:E,open:C,children:[g&&(0,$.jsx)(`div`,{className:`px-3 py-2 text-[12px] text-neutral-400`,children:`Loading...`}),!g&&F.length===0&&y.length===0&&(0,$.jsx)(`div`,{className:`px-3 py-2 text-[12px] text-neutral-400`,children:`Start typing to search...`}),!g&&F.length===0&&y.length>0&&(0,$.jsx)(`div`,{className:`px-3 py-2 text-[12px] text-neutral-400`,children:`No results`}),!g&&F.map(e=>(0,$.jsx)(`div`,{className:`cursor-pointer px-3 py-2 text-[12px] text-neutral-800 hover:bg-neutral-100`,onClick:()=>{j(e),b(e.label),w(!1)},children:e.label},e.value))]}),f?.showMessage&&f.message&&(0,$.jsx)(`span`,{className:`text-[11px] text-red-500`,children:f.message})]})}let I=O&&!Array.isArray(O)?F.findIndex(e=>JSON.stringify(e.value)===JSON.stringify(O.value)):-1;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(qa,{field:e}),g?(0,$.jsx)(`div`,{className:`w-full rounded border border-black/10 px-2 py-1.5 text-[12px] text-neutral-400 bg-neutral-50`,children:`Loading options...`}):(0,$.jsxs)(`select`,{value:I>=0?String(I):``,onChange:e=>{let t=F[Number(e.target.value)];t&&j(t)},disabled:u,className:`w-full rounded border px-2 py-1.5 text-[13px] font-mono focus:outline-none focus:ring-1 ${f?.error?`border-red-300 focus:ring-red-400`:`border-black/10 focus:ring-blue-400`} ${u?`bg-neutral-50 text-neutral-400`:`bg-white`}`,children:[(0,$.jsx)(`option`,{value:``,children:e.placeholder??`Choose an option`}),F.map((e,t)=>(0,$.jsx)(`option`,{value:String(t),children:e.label},e.label))]}),f?.showMessage&&f.message&&(0,$.jsx)(`span`,{className:`text-[11px] text-red-500`,children:f.message})]})},boolean:Ga},Za=({field:e,pluginApiName:t,disabled:n=!1})=>{let r=Xa[e.type];return(0,$.jsx)(r,{field:e,pluginApiName:t,disabled:n})},Qa=`kizen-plugin-config:`,$a=`kizen-plugin-user-config:`;function eo(e){let t=t=>`${e}${t}`;function n(e){try{let n=localStorage.getItem(t(e));return n?JSON.parse(n):null}catch{return null}}function r(e,n,r){let i={__kizen_setup_assistant_values:n,__kizen_clean_config:Cn(r,n)};localStorage.setItem(t(e),JSON.stringify(i))}function i(e,n){let r={__kizen_setup_assistant_values:{},__kizen_clean_config:n};localStorage.setItem(t(e),JSON.stringify(r))}function a(e){localStorage.removeItem(t(e))}return{load:n,save:r,saveRaw:i,clear:a}}var to=eo(Qa),no=eo($a),ro=to.load,io=to.save,ao=to.saveRaw,oo=to.clear,so=no.load,co=no.save,lo=no.clear,uo=()=>{let e=T(),t=C();return{getObjectByAPIName:(0,k.useCallback)(async n=>{try{let t=await(await e(`/api/custom-objects?filters=${encodeURIComponent(JSON.stringify({api_name:n}))}`)).json(),r=Array.isArray(t)?t:t.results;if(r&&r.length>0)return r}catch{}let r=t?.business.client_object;if(r?.access&&r.name===n)return[{id:r.id,object_name:r.object_name}]},[e,t]),getCustomObjectDetails:(0,k.useCallback)(async t=>{try{let[n,r]=await Promise.all([e(`/api/custom-objects/${t}`),e(`/api/custom-objects/${t}/fields`)]),i=await n.json(),a=await r.json(),o=Array.isArray(a)?a:a.results??[];return{id:t,objectName:i.object_name??``,fields:o.map(e=>({id:e.id,name:e.name,displayName:e.display_name}))}}catch{return{id:t,objectName:``,fields:[]}}},[e])}};export{ja as _,so as a,Ua as b,co as c,Ja as d,Fa as f,ma as g,va as h,ro as i,Za as l,wa as m,oo as n,io as o,Ha as p,lo as r,ao as s,uo as t,Ya as u,ba as v,xa as y};