@nylas/react 1.0.2-prealpha1 → 1.1.0-canary.4

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 (133) hide show
  1. package/dist/add-circle-icon_22.entry-077661c3.cjs +1 -0
  2. package/dist/add-circle-icon_22.entry-f699d91e.js +1733 -0
  3. package/dist/{archive-icon_7.entry-91aaa1aa.js → archive-icon_7.entry-40b7ef3b.js} +20 -20
  4. package/dist/{archive-icon_7.entry-84d70dbf.cjs → archive-icon_7.entry-e8630de9.cjs} +1 -1
  5. package/dist/arrow-icon.entry-58246303.js +15 -0
  6. package/dist/{arrow-icon.entry-400a08fa.cjs → arrow-icon.entry-ffa53114.cjs} +1 -1
  7. package/dist/{bold-icon_3.entry-9ad35153.cjs → bold-icon_3.entry-106a4e77.cjs} +1 -1
  8. package/dist/{bold-icon_3.entry-4b2798a8.js → bold-icon_3.entry-f5f1643d.js} +4 -4
  9. package/dist/{calendar-cancel-icon.entry-fcb66929.cjs → calendar-cancel-icon.entry-6ae0fd0f.cjs} +1 -1
  10. package/dist/{calendar-cancel-icon.entry-83ba884a.js → calendar-cancel-icon.entry-75b15b19.js} +4 -4
  11. package/dist/calendar-check-icon_2.entry-57339318.js +25 -0
  12. package/dist/calendar-check-icon_2.entry-c57f83f3.cjs +1 -0
  13. package/dist/{calendar-icon.entry-8f38af4a.js → calendar-icon.entry-2069fec6.js} +2 -2
  14. package/dist/{calendar-icon.entry-7bae38d7.cjs → calendar-icon.entry-492c2630.cjs} +1 -1
  15. package/dist/chevron-icon_3.entry-83df50c3.js +117 -0
  16. package/dist/chevron-icon_3.entry-878ff6df.cjs +1 -0
  17. package/dist/close-icon.entry-480c199d.js +15 -0
  18. package/dist/close-icon.entry-8015ca05.cjs +1 -0
  19. package/dist/{nylas-booked-event-card_10.entry-7e66a648.js → constants-6ee60d6d-4cd16450.js} +1656 -2374
  20. package/dist/{nylas-booked-event-card_10.entry-ed515326.cjs → constants-6ee60d6d-6c0540db.cjs} +6 -6
  21. package/dist/document-refresh-icon.entry-06f7972b.cjs +1 -0
  22. package/dist/document-refresh-icon.entry-09870b14.js +15 -0
  23. package/dist/elements/index.d.ts +31 -2
  24. package/dist/{forward-icon_6.entry-b60fcb35.js → forward-icon_6.entry-8bb201eb.js} +127 -127
  25. package/dist/{forward-icon_6.entry-3345af84.cjs → forward-icon_6.entry-eeecf2a2.cjs} +3 -3
  26. package/dist/{globe-icon.entry-8325e73e.cjs → globe-icon.entry-a690028c.cjs} +1 -1
  27. package/dist/{globe-icon.entry-e3fd373f.js → globe-icon.entry-d515cbfa.js} +4 -4
  28. package/dist/google-logo-icon_3.entry-2164cec1.js +258 -0
  29. package/dist/google-logo-icon_3.entry-b2b85284.cjs +1 -0
  30. package/dist/index-2b8437d6.cjs +30 -0
  31. package/dist/index-db0c5017.js +1824 -0
  32. package/dist/index.d.ts +3 -1
  33. package/dist/index.es-2578c6a5-098d48d0.cjs +7 -0
  34. package/dist/{index-b30d446a-a90f84b2.js → index.es-2578c6a5-71441142.js} +833 -933
  35. package/dist/info-icon_2.entry-300ef196.js +34 -0
  36. package/dist/info-icon_2.entry-e286aaa5.cjs +1 -0
  37. package/dist/{loading-icon.entry-27410cf8.js → loading-icon.entry-6d8adaa4.js} +4 -4
  38. package/dist/{loading-icon.entry-b2096d2b.cjs → loading-icon.entry-dc40e97d.cjs} +1 -1
  39. package/dist/{mailbox-store-19f0c6c9-e3e8b4e5.js → mailbox-store-bb21512c-649a374c.js} +17 -16
  40. package/dist/mailbox-store-bb21512c-fc3c8c03.cjs +1 -0
  41. package/dist/nylas-additional-participants.entry-4afba192.js +83 -0
  42. package/dist/nylas-additional-participants.entry-db05e510.cjs +1 -0
  43. package/dist/nylas-booked-event-card_10.entry-1ebbe0c0.js +784 -0
  44. package/dist/nylas-booked-event-card_10.entry-6b6fdfae.cjs +1 -0
  45. package/dist/nylas-form-card.entry-70b20571.cjs +1 -0
  46. package/dist/nylas-form-card.entry-7bc23695.js +56 -0
  47. package/dist/nylas-if-state.entry-3829cb3d.js +96 -0
  48. package/dist/nylas-if-state.entry-ebeffe22.cjs +1 -0
  49. package/dist/nylas-list-folders.entry-191688f2.cjs +1 -0
  50. package/dist/{nylas-list-folders.entry-a5437201.js → nylas-list-folders.entry-7347e78d.js} +9 -8
  51. package/dist/{nylas-list-threads.entry-fd6cda61.js → nylas-list-threads.entry-432a8d8c.js} +5 -4
  52. package/dist/nylas-list-threads.entry-44658578.cjs +1 -0
  53. package/dist/nylas-login.entry-5311f0a7.js +75 -0
  54. package/dist/nylas-login.entry-db17a3d2.cjs +1 -0
  55. package/dist/{nylas-mailbox-pagination.entry-988214bc.js → nylas-mailbox-pagination.entry-20150fb2.js} +4 -3
  56. package/dist/nylas-mailbox-pagination.entry-9d3f5baa.cjs +1 -0
  57. package/dist/nylas-mailbox-toolbar-button.entry-6c0f7299.cjs +1 -0
  58. package/dist/{nylas-mailbox-toolbar-button.entry-c720e22a.js → nylas-mailbox-toolbar-button.entry-eec426d5.js} +11 -10
  59. package/dist/nylas-mailbox.entry-b6c758b9.js +136 -0
  60. package/dist/nylas-mailbox.entry-d41401e0.cjs +1 -0
  61. package/dist/{nylas-provider.entry-70721009.js → nylas-provider.entry-271cafd2.js} +46 -33
  62. package/dist/nylas-provider.entry-6173b721.cjs +1 -0
  63. package/dist/nylas-scheduler-editor.entry-0c75d39e.cjs +7 -0
  64. package/dist/nylas-scheduler-editor.entry-b51ad4b1.js +2192 -0
  65. package/dist/nylas-scheduling.entry-081c8825.cjs +1 -0
  66. package/dist/nylas-scheduling.entry-0a8d1da8.js +237 -0
  67. package/dist/{nylas-threads-refresh.entry-b7f9e93f.js → nylas-threads-refresh.entry-72dd854e.js} +6 -5
  68. package/dist/nylas-threads-refresh.entry-c3509e6a.cjs +1 -0
  69. package/dist/nylas-threads-search.entry-16a59ef6.cjs +1 -0
  70. package/dist/{nylas-threads-search.entry-95afea9c.js → nylas-threads-search.entry-4750a187.js} +15 -14
  71. package/dist/nylas-view-thread.entry-27df3349.cjs +1 -0
  72. package/dist/{nylas-view-thread.entry-165173b1.js → nylas-view-thread.entry-c6adce43.js} +5 -4
  73. package/dist/people-icon.entry-342be0c8.js +15 -0
  74. package/dist/people-icon.entry-35252ca9.cjs +1 -0
  75. package/dist/play-icon_2.entry-0787352c.js +25 -0
  76. package/dist/play-icon_2.entry-f83fa92a.cjs +1 -0
  77. package/dist/react.cjs +1 -1
  78. package/dist/react.js +92 -61
  79. package/dist/{refresh-icon.entry-e48a338f.js → refresh-icon.entry-8fbabfe7.js} +2 -2
  80. package/dist/{refresh-icon.entry-601cac89.cjs → refresh-icon.entry-ddbc5446.cjs} +1 -1
  81. package/dist/{register-component-152c6ad2-a06f58c2.js → register-component-dc659dc3-e43e8fae.js} +2 -2
  82. package/dist/{register-component-152c6ad2-0df7215b.cjs → register-component-dc659dc3-fb85ee68.cjs} +1 -1
  83. package/dist/scheduler-config-store-51ee4f42-66f8c2ac.js +14 -0
  84. package/dist/scheduler-config-store-51ee4f42-d7d9c25d.cjs +1 -0
  85. package/dist/scheduler-store-72116723-ce4c7a69.cjs +1 -0
  86. package/dist/{scheduler-store-7d48e682-0c0c3991.js → scheduler-store-72116723-e5f87122.js} +100 -95
  87. package/dist/time-period-selector.entry-333942a8.js +78 -0
  88. package/dist/time-period-selector.entry-78d5b3c2.cjs +1 -0
  89. package/dist/translate-icon.entry-87a62108.js +15 -0
  90. package/dist/translate-icon.entry-cb19864c.cjs +1 -0
  91. package/dist/utils-c00bdc3c-89ab163d.js +2111 -0
  92. package/dist/utils-c00bdc3c-94b9c3b6.cjs +8 -0
  93. package/dist/warning-icon.entry-50755d91.cjs +1 -0
  94. package/dist/warning-icon.entry-7a72e24a.js +15 -0
  95. package/package.json +7 -4
  96. package/dist/add-circle-icon.entry-2ccb238b.cjs +0 -1
  97. package/dist/add-circle-icon.entry-35d6aa07.js +0 -15
  98. package/dist/arrow-icon.entry-8b2e96a6.js +0 -15
  99. package/dist/calendar-check-icon_3.entry-903e2d82.js +0 -35
  100. package/dist/calendar-check-icon_3.entry-a16ce05e.cjs +0 -1
  101. package/dist/chevron-icon.entry-58366662.cjs +0 -1
  102. package/dist/chevron-icon.entry-5e11cef5.js +0 -15
  103. package/dist/close-icon_2.entry-011d9cf4.js +0 -25
  104. package/dist/close-icon_2.entry-83088b9a.cjs +0 -1
  105. package/dist/document-refresh-icon.entry-071ffd66.cjs +0 -1
  106. package/dist/document-refresh-icon.entry-9083a2e9.js +0 -15
  107. package/dist/duration-bddc4a13-05d3e3e2.cjs +0 -1
  108. package/dist/duration-bddc4a13-179ce826.js +0 -41
  109. package/dist/index-3b6f5cd5.cjs +0 -30
  110. package/dist/index-630f4e87.js +0 -1498
  111. package/dist/index-b30d446a-cbbef925.cjs +0 -7
  112. package/dist/mailbox-store-19f0c6c9-a0cbfa97.cjs +0 -1
  113. package/dist/nylas-if-state_3.entry-504be976.cjs +0 -1
  114. package/dist/nylas-if-state_3.entry-e96d01f1.js +0 -291
  115. package/dist/nylas-list-folders.entry-866361cc.cjs +0 -1
  116. package/dist/nylas-list-threads.entry-04989295.cjs +0 -1
  117. package/dist/nylas-mailbox-pagination.entry-e0bd4aef.cjs +0 -1
  118. package/dist/nylas-mailbox-toolbar-button.entry-3d772b26.cjs +0 -1
  119. package/dist/nylas-open-hours-picker.entry-6bdc7c73.js +0 -186
  120. package/dist/nylas-open-hours-picker.entry-881b6db7.cjs +0 -1
  121. package/dist/nylas-provider.entry-8d9a844b.cjs +0 -1
  122. package/dist/nylas-scheduler.entry-7321e18f.js +0 -230
  123. package/dist/nylas-scheduler.entry-e82977fb.cjs +0 -1
  124. package/dist/nylas-threads-refresh.entry-477e68e4.cjs +0 -1
  125. package/dist/nylas-threads-search.entry-c5854641.cjs +0 -1
  126. package/dist/nylas-view-thread.entry-8b72cbdb.cjs +0 -1
  127. package/dist/play-icon_2.entry-ed5877e3.js +0 -25
  128. package/dist/play-icon_2.entry-f23ed6c1.cjs +0 -1
  129. package/dist/scheduler-store-7d48e682-674705ef.cjs +0 -1
  130. package/dist/search-icon_3.entry-292138c3.js +0 -101
  131. package/dist/search-icon_3.entry-8e555357.cjs +0 -1
  132. package/dist/utils-5074a070-ce33ee6b.js +0 -119
  133. package/dist/utils-5074a070-d5ba6add.cjs +0 -2
@@ -1,3 +1,3 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./index-3b6f5cd5.cjs"),y=require("./utils-5074a070-d5ba6add.cjs"),yn=require("./register-component-152c6ad2-0df7215b.cjs"),En=require("./_commonjsHelpers-57e89916-4a3ae7d8.cjs");require("react");require("react-dom");const Tn=".sc-forward-icon-h{display:flex}",An=Tn,Ct=class{constructor(t){m.registerInstance(this,t),this.width="15",this.height="15"}render(){return m.h("svg",{key:"f6f2a0745a4ea7849081d7ac5d0244ee69d087b7",fill:"auto",width:this.width,height:this.height,viewBox:"0 0 1920 1920",xmlns:"http://www.w3.org/2000/svg"},m.h("path",{key:"484a8d3299af5b6a48929d894214027e3c273fe4",d:"m1246.246 64-90.496 90.496 477.952 477.952h-590.848C467.878 632.448.038 1100.416.038 1675.392v109.056h128v-109.056c0-504.576 410.368-914.944 914.816-914.944h590.848l-477.952 478.08 90.496 90.496 632.448-632.576L1246.246 64Z","fill-rule":"evenodd"}))}};Ct.style=An;const _n=':host{display:grid;color:var(--nylas-color-primary-900)}.editor{position:relative;display:block;max-height:300px;overflow:auto;padding:1rem;border:1px solid var(--nylas-color-primary-300)}.editor blockquote{visibility:hidden;overflow:hidden;position:relative;transition:height 0.3s ease;margin:0}.editor blockquote::before{content:"...";visibility:visible;opacity:1;position:absolute;top:0;left:0;background-color:var(--nylas-color-primary-300);width:20px;text-align:center;color:var(--nylas-color-primary-800);vertical-align:middle;display:flex;justify-content:center;align-items:center;align-self:center;cursor:pointer}.editor .collapsed{height:20px}.editor .expanded{visibility:visible;opacity:1;height:auto;margin:0px 0px 0px 0.8ex;border-left:1px solid var(--nylas-color-primary-300);padding-left:1rem}.editor .expanded::before{display:none;}.buttons{display:flex;margin-top:1rem;justify-content:space-between}.buttons sp-button{border-radius:var(--nylas-border-radius);background-color:var(--nylas-color-primary-400);color:var(--nylas-color-primary-900);fill:var(--nylas-color-primary-900)}.buttons sp-button:hover{background-color:var(--nylas-color-primary-500)}.buttons sp-button:disabled{background-color:var(--nylas-color-primary-200);color:var(--nylas-color-primary-600);cursor:not-allowed}.buttons sp-button chevron-icon{display:inline-block}.buttons .close{justify-self:end}.toolbar{position:absolute;display:none;background-color:var(--nylas-color-primary-200);border-radius:var(--nylas-border-radius);z-index:1}.toolbar sp-button{border:0}',wn=_n,Lt=class{constructor(t){m.registerInstance(this,t),this.close=m.createEvent(this,"close",7),this.send=m.createEvent(this,"send",7),this.closeComposer=o=>{this.close.emit(o)},this.sendComposer=o=>{var s;if(!this.editorEl){y.debug("no editor element");return}const u=this.editorEl.querySelector(".message-body");if(!u){y.debug("no message body");return}this.message&&(this.send.emit({message:this.message,replyBody:((s=u.querySelector(".message-body"))==null?void 0:s.innerHTML)||""}),this.close.emit(o),this.editorEl.innerHTML="")},this.message=void 0,this.viewEmailElement=void 0}connectedCallback(){}disconnectedCallback(){this.editorEl&&(this.editorEl.innerHTML="")}componentWillLoad(){}async componentDidLoad(){if(this.message&&this.watchBody(this.message),!this.editorEl){y.debug("[connectedCallback] no editor element");return}if(!this.toolbarEl){y.debug("[connectedCallback] no toolbar element");return}const t=this.editorEl,o=this.toolbarEl;t.addEventListener("mouseup",u=>{var W;const s=(W=this.host.shadowRoot)==null?void 0:W.getSelection();if(!s){y.debug("no selection");return}const p=s.getRangeAt(0),r=s.toString();if(!r){o.style.display="none";return}const f=t.querySelector(".message-body");if(!f){y.debug("no message body");return}const l=p.commonAncestorContainer.parentElement;if(!l)return;const T=f.getBoundingClientRect();y.debug("messageBodyRect",{messageBodyRect:T});const _=l.getBoundingClientRect();y.debug("foundRect",{foundRect:_});const ce=(l.childNodes[0].textContent||"").indexOf(r),q=window.getComputedStyle(l).fontSize,X=parseInt(q.replace("px",""),10),ne=_.top-T.top-o.clientHeight,ye=ce*(1/X)*100;o.style.top=`${ne}px`,o.style.left=`${ye}px`,o.style.display="block"})}watchBody(t){var r;if(!this.editorEl){y.debug("no editor element");return}this.editorEl.querySelectorAll(".message-body").forEach(f=>f.remove());const o=document.createElement("div");o.classList.add("message-body");const u=document.createElement("p");u.innerHTML="&nbsp;",o.appendChild(u);const s=document.createElement("br");o.appendChild(s);const p=document.createElement("div");if(p.classList.add("reply-text"),p.innerText=`On ${new Date(t.date*1e3).toLocaleDateString(void 0,{dateStyle:"full"})} <${(r=t.from)==null?void 0:r.map(f=>f.name||f.email).join(", ")}> wrote:`,o.appendChild(p),t.body){const f=document.createElement("html");f.innerHTML=t.body;const i=document.createElement("blockquote");i.classList.add("collapsed"),i.classList.add("gmail_quote"),i.innerHTML=f.innerHTML,o.appendChild(i),y.debug("replyContainer",{replyContainer:i})}this.editorEl.appendChild(o),this.editorEl.querySelectorAll("blockquote.collapsed").forEach(f=>{f.addEventListener("click",function(i){i.preventDefault();const l=i.target;l.classList.remove("collapsed"),l.classList.add("expanded")},{once:!0})}),this.editorEl.focus()}render(){return m.h(m.Host,{key:"b25497b478659d675aadb91a6b7e147ff6e5e9b8"},m.h("sp-theme",{key:"dd88253135657e6cda8daf8e71635c16d736a317",scale:"medium",color:"dark"},m.h("div",{key:"f23ecbde8bda95328796f60bc5612cedd30cd488",class:"editor",contentEditable:!0,ref:t=>this.editorEl=t},m.h("div",{key:"871c357e3c095fe2237d228bbaaeb1f5247734b3",class:"toolbar",ref:t=>this.toolbarEl=t,contentEditable:!1},m.h("sp-button",{key:"626560dcbd264b9572be5f7d69268186c8b1a0f6",quiet:!0,onClick:()=>document.execCommand("bold")},m.h("div",{key:"d83785d23518d539064405eb657d9291f76436be",slot:"icon"},m.h("bold-icon",{key:"ce45db34d019a60e3955a3a32335447ae1e27b14"})),m.h("div",{key:"9f05672f538617fbaca46e8287f7e2ebc0909816",slot:"label"},"Bold")),m.h("sp-button",{key:"2906871fa67987ab87a7619b7bb0b9ee09b3dca8",quiet:!0,onClick:()=>document.execCommand("underline")},m.h("div",{key:"b75c2a77ed80693f66b6bddcc9c7af13c474bd7d",slot:"icon"},m.h("underline-icon",{key:"733d5dd3fa2906c9ad4e6a212c3282315290f0bb"})),m.h("div",{key:"f59da34a2ef65a4339a5e5770acd41e1e4c0d4b1",slot:"label"},"Underline")),m.h("sp-button",{key:"5654719682fe352f5a060e1a947d52686dcbb91c",quiet:!0,onClick:()=>document.execCommand("italic")},m.h("div",{key:"650498d94ec07f8fd43d305637f189336aaac2a1",slot:"icon"},m.h("italic-icon",{key:"8f03281a56c6b35f17b7a7f5f10285f3be87d757"})),m.h("div",{key:"03ba08b7ffb8023b44bbd7a107f8767e7430a692",slot:"label"},"Italic")))),m.h("div",{key:"19cd7d52d3f24a440a6b4ae6beb75a680403d94d",class:"buttons"},m.h("sp-button",{key:"dfe307499781aa00e03de3316043a4d47bf349a5",onClick:this.sendComposer,class:"send"},"Send"),m.h("sp-button",{key:"c8d6a72d27723f1c2ac789d0a03d22b14ebfdec6",onClick:this.closeComposer,class:"close"},"Close"))))}get host(){return m.getElement(this)}static get watchers(){return{message:["watchBody"]}}};Lt.style=wn;const vn=":host{display:block}sp-button{padding:0;border:0;border-radius:var(--nylas-border-radius);min-block-size:50%;min-inline-size:2rem;background-color:var(--nylas-color-primary-300);fill:var(--nylas-color-primary-800)}sp-button:hover{background-color:var(--nylas-color-primary-400)}.summarize-button.stopped{animation:none}.summarize-button.playing{animation:pulse 2s infinite}.summarize-button.loading{display:flex;align-content:center;height:1.5rem;width:2rem;vertical-align:middle;animation:pulse 2s infinite;flex-wrap:wrap}.summarize-button.loading loading-icon{--dot-color:var(--nylas-color-primary-600)}@keyframes pulse{0%{transform:scale(1);box-shadow:0 0 0 0 var(--nylas-color-primary-300)}70%{transform:scale(1.05);box-shadow:0 0 0 10px rgba(255, 69, 0, 0)}100%{transform:scale(1);box-shadow:0 0 0 0 rgba(255, 69, 0, 0)}}@keyframes wave{0%{transform:translateX(0)}50%{transform:translateX(100%)}100%{transform:translateX(0)}}",Sn=vn;var Cn=function(t,o,u,s){var p=arguments.length,r=p<3?o:s===null?s=Object.getOwnPropertyDescriptor(o,u):s,f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,o,u,s);else for(var i=t.length-1;i>=0;i--)(f=t[i])&&(r=(p<3?f(r):p>3?f(o,u,r):f(o,u))||r);return p>3&&r&&Object.defineProperty(o,u,r),r},Fe=function(t,o){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,o)};const We=class{constructor(t){m.registerInstance(this,t),this.summarize=m.createEvent(this,"summarize",7),this.abortController=new AbortController,this.onClick=async o=>{var u,s;o.preventDefault(),o.stopPropagation(),this.state==="stopped"?this.message&&(this.abortController=new AbortController,this.summarize.emit({abortController:this.abortController,playAudio:this.playAudio,message:this.message,updateState:this.updateState}).defaultPrevented||(y.debug("[nylas-summarize-message-button] Default event not prevented, summarizing message"),this.audioRef&&(await this.audioRef.play().then(()=>{var r;return(r=this.audioRef)==null?void 0:r.pause()}).catch(r=>console.error("Error playing audio:",r)),await this.audioRef.play().catch(r=>console.error("Error playing audio:",r))))):this.state==="playing"?((u=this.abortController)==null||u.abort(),(s=this.audioRef)==null||s.pause()):this.state="stopped"},this.message=void 0,this.state="stopped",this.playAudio=this.playAudio.bind(this),this.updateState=this.updateState.bind(this)}connectedCallback(){}disconnectedCallback(){}async componentWillLoad(){y.debug("[nylas-summarize-message-button] Component will load")}async componentDidLoad(){y.debug("[nylas-summarize-message-button] Component did load")}async updateState(t){this.state=t}async playAudio(t){if(!this.audioRef){this.state="stopped";return}if(!t){this.state="stopped";return}const o=this.audioRef;if(!("MediaSource"in window)){const i=await t;if(i==null)throw new Error("ReadableStream not yet supported in this browser.");const l=i.getReader(),T=[];await this.readChunk(l,T);const _=new Blob(T,{type:"audio/mpeg"}),N=URL.createObjectURL(_);o.src=N;return}const u=new MediaSource;let s,p=!1;o.src=URL.createObjectURL(u),u.addEventListener("sourceopen",r);async function r(){s=u.addSourceBuffer("audio/mpeg"),s.addEventListener("updateend",f);const i=await t;if(i==null)throw new Error("ReadableStream not yet supported in this browser.");const l=i.getReader(),T=()=>{l.read().then(({done:_,value:N})=>{if(_){p=!0;return}s.updating||s.appendBuffer(N),T()}).catch(_=>{console.error("Error while fetching and appending chunks:",_)})};T(),o.paused&&o.play().catch(_=>console.error("Error playing audio:",_))}function f(){if(p){u.endOfStream(),u.removeEventListener("sourceopen",r),u.removeEventListener("sourceclose",()=>{y.debug("[nylas-summarize-message-button] Source closed")}),s.removeEventListener("updateend",f);return}}}async readChunk(t,o){return t.read().then(({done:u,value:s})=>u?o:(o.push(s),this.readChunk(t,o)))}render(){return m.h(m.Host,{key:"052c49f7b564274561da89404b06b490b993b1f0"},m.h("sp-theme",{key:"55b4965642873d51c445b4db4eac17119d6e0568",scale:"medium",color:"dark"},m.h("sp-button",{key:"c7bf00d3570f9129cdb3005d0e0877c95cb75466",label:"Summarize email","icon-only":!0,onClickCapture:this.onClick,class:{"summarize-button":!0,stopped:this.state==="stopped",loading:this.state==="loading",playing:this.state==="playing"}},this.state==="stopped"&&m.h("play-icon",null),this.state==="loading"&&m.h("loading-icon",null),this.state==="playing"&&m.h("stop-icon",null)),m.h("audio",{key:"489a2f36807bf74313ca4ce0cdfe84682a614a34",ref:t=>this.audioRef=t,autoPlay:!0,onPlaying:()=>this.state="playing",onPause:()=>this.state="stopped",onEnded:()=>{this.state="stopped",y.debug("[nylas-summarize-message-button] Audio ended")}})))}};Cn([yn.RegisterComponent({name:"nylas-summarize-message-button",eventToProps:{summarize:async(t,o)=>{const{playAudio:u,updateState:s,abortController:p,message:r}=t.detail,f=y.htmlToPlainText(r.body||"");await s("loading");try{const i=await o.messages.summarizeText(f),l=o.messages.textToSpeech(i,p);await u(l)}catch(i){await s("stopped"),console.error("Error summarizing message:",i)}}},fireRegisterEvent:!0}),Fe("design:type",Function),Fe("design:paramtypes",[]),Fe("design:returntype",void 0)],We.prototype,"render",null);We.style=Sn;function P(t){return!window.matchMedia("(prefers-color-scheme: dark)").matches||!t?t:t==="transparent"?"color":t.startsWith("#")?Ln(t):t.startsWith("rgb")?Rt(t):t.startsWith("hsl")?Rn(t):kn(t)?Mn(t):t}function Ln(t){t.length<7&&(t="#"+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]);const o=(255-parseInt(t.slice(1,3),16)).toString(16).padStart(2,"0"),u=(255-parseInt(t.slice(3,5),16)).toString(16).padStart(2,"0"),s=(255-parseInt(t.slice(5,7),16)).toString(16).padStart(2,"0");return`#${o}${u}${s}`}function Rt(t){var r;const o=(r=t.match(/\d+/g))==null?void 0:r.map(Number);if(!o)return t;const[u,s,p]=o;return`rgb(${255-u}, ${255-s}, ${255-p})`}function Rn(t){var r;const o=(r=t.match(/\d+\.?\d*/g))==null?void 0:r.map(Number);if(!o)return t;const[u,s,p]=o;return`hsl(${u}, ${s}%, ${100-p}%)`}function kn(t){return/^[a-z]+$/i.test(t)}function Mn(t){return Rt(Nn(t))}function Nn(t){return t.toLowerCase()==="red"?"rgb(255, 0, 0)":"rgb(0, 0, 0)"}function St(t){if(t instanceof HTMLStyleElement){let o=t.textContent;if(o){o=o.replaceAll(/@media\s*\(prefers-color-scheme:\s*(dark|light)\)\s*\{([^}]+)\}/g,"");const u=o.matchAll(/border-color:\s*([^;]+)/g);if(u)for(const i of u){const[l,T]=i,_=l.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&");o=o.replaceAll(_,l.replace(T,P(T)))}const s=o.matchAll(/border:\s*([^;]+)/g);if(s)for(const i of s){const l=i[0].trim(),T=l.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),[_,N,U]=i[1].split(" ");o=o.replaceAll(T,l.replace(U,P(U)))}const p=o.matchAll(/background-color:\s*([^;]+)/g);if(p)for(const i of p){const[l,T]=i,_=l.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&");o=o.replaceAll(_,l.replace(T,P(T))),y.debug("backgroundColor",{fullMatch:l,replace:l.replace(T,P(T)),color:T,invertColor:P(T)})}const r=o.matchAll(/background:\s*([^;]+)/g);if(r)for(const i of r){const l=i[0].trim(),T=l.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),[_,N,U]=i[1].split(" ");o=o.replaceAll(T,l.replace(U,P(U)))}const f=o.matchAll(/color:\s*([^;]+)/g);if(f)for(const i of f){const[l,T]=i,_=l.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&");o=o.replaceAll(_,l.replace(T,P(T)))}t.textContent=o}}if(t instanceof HTMLElement){const o=window.getComputedStyle(t),u=o.color||t.style.color,s=o.backgroundColor||t.style.backgroundColor,p=o.borderColor||t.style.borderColor;u&&!s?t.style.color="":u&&s?(t.style.color=P(u),t.style.backgroundColor=P(s),y.debug("element",t),y.debug("computedStyle.color",u),y.debug("computedStyle.backgroundColor",s),y.debug("invertColor(color)",P(u)),y.debug("invertColor(backgroundColor)",P(s))):!u&&s&&(t.style.backgroundColor=""),p&&(y.debug("borderColor",p),t.style.borderColor=P(p)),t.hasAttribute("bgcolor")&&t.removeAttribute("bgcolor")}}function xn(t){St(t),t.querySelectorAll("*").forEach(u=>St(u))}var kt={exports:{}};/*! @license DOMPurify 3.0.8 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.8/LICENSE */(function(t,o){(function(u,s){t.exports=s()})(En.commonjsGlobal,function(){const{entries:u,setPrototypeOf:s,isFrozen:p,getPrototypeOf:r,getOwnPropertyDescriptor:f}=Object;let{freeze:i,seal:l,create:T}=Object,{apply:_,construct:N}=typeof Reflect<"u"&&Reflect;i||(i=function(c){return c}),l||(l=function(c){return c}),_||(_=function(c,E,g){return c.apply(E,g)}),N||(N=function(c,E){return new c(...E)});const U=I(Array.prototype.forEach),ce=I(Array.prototype.pop),q=I(Array.prototype.push),X=I(String.prototype.toLowerCase),ne=I(String.prototype.toString),ye=I(String.prototype.match),W=I(String.prototype.replace),Dt=I(String.prototype.indexOf),Ot=I(String.prototype.trim),O=I(RegExp.prototype.test),oe=It(TypeError);function I(b){return function(c){for(var E=arguments.length,g=new Array(E>1?E-1:0),k=1;k<E;k++)g[k-1]=arguments[k];return _(b,c,g)}}function It(b){return function(){for(var c=arguments.length,E=new Array(c),g=0;g<c;g++)E[g]=arguments[g];return N(b,E)}}function h(b,c){let E=arguments.length>2&&arguments[2]!==void 0?arguments[2]:X;s&&s(b,null);let g=c.length;for(;g--;){let k=c[g];if(typeof k=="string"){const H=E(k);H!==k&&(p(c)||(c[g]=H),k=H)}b[k]=!0}return b}function Pt(b){for(let c=0;c<b.length;c++)f(b,c)===void 0&&(b[c]=null);return b}function G(b){const c=T(null);for(const[E,g]of u(b))f(b,E)!==void 0&&(Array.isArray(g)?c[E]=Pt(g):g&&typeof g=="object"&&g.constructor===Object?c[E]=G(g):c[E]=g);return c}function de(b,c){for(;b!==null;){const g=f(b,c);if(g){if(g.get)return I(g.get);if(typeof g.value=="function")return I(g.value)}b=r(b)}function E(g){return console.warn("fallback value for",g),null}return E}const qe=i(["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","section","select","shadow","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"]),Ee=i(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Te=i(["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"]),Ut=i(["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"]),Ae=i(["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"]),zt=i(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ge=i(["#text"]),$e=i(["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","face","for","headers","height","hidden","high","href","hreflang","id","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","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),_e=i(["accent-height","accumulate","additive","alignment-baseline","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","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","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","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","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","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"]),Ye=i(["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"]),ue=i(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ht=l(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Ft=l(/<%[\w\W]*|[\w\W]*%>/gm),Bt=l(/\${[\w\W]*}/gm),Wt=l(/^data-[\-\w.\u00B7-\uFFFF]/),qt=l(/^aria-[\-\w]+$/),je=l(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Gt=l(/^(?:\w+script|data):/i),$t=l(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Xe=l(/^html$/i);var Ve=Object.freeze({__proto__:null,MUSTACHE_EXPR:Ht,ERB_EXPR:Ft,TMPLIT_EXPR:Bt,DATA_ATTR:Wt,ARIA_ATTR:qt,IS_ALLOWED_URI:je,IS_SCRIPT_OR_DATA:Gt,ATTR_WHITESPACE:$t,DOCTYPE_NAME:Xe});const Yt=function(){return typeof window>"u"?null:window},jt=function(c,E){if(typeof c!="object"||typeof c.createPolicy!="function")return null;let g=null;const k="data-tt-policy-suffix";E&&E.hasAttribute(k)&&(g=E.getAttribute(k));const H="dompurify"+(g?"#"+g:"");try{return c.createPolicy(H,{createHTML(V){return V},createScriptURL(V){return V}})}catch{return console.warn("TrustedTypes policy "+H+" could not be created."),null}};function Ze(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Yt();const c=d=>Ze(d);if(c.version="3.0.8",c.removed=[],!b||!b.document||b.document.nodeType!==9)return c.isSupported=!1,c;let{document:E}=b;const g=E,k=g.currentScript,{DocumentFragment:H,HTMLTemplateElement:V,Node:we,Element:Ke,NodeFilter:ve,NamedNodeMap:Vt=b.NamedNodeMap||b.MozNamedAttrMap,HTMLFormElement:Zt,DOMParser:Kt,trustedTypes:me}=b,fe=Ke.prototype,Qt=de(fe,"cloneNode"),Jt=de(fe,"nextSibling"),en=de(fe,"childNodes"),Se=de(fe,"parentNode");if(typeof V=="function"){const d=E.createElement("template");d.content&&d.content.ownerDocument&&(E=d.content.ownerDocument)}let M,ie="";const{implementation:Ce,createNodeIterator:tn,createDocumentFragment:nn,getElementsByTagName:on}=E,{importNode:rn}=g;let z={};c.isSupported=typeof u=="function"&&typeof Se=="function"&&Ce&&Ce.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Le,ERB_EXPR:Re,TMPLIT_EXPR:ke,DATA_ATTR:an,ARIA_ATTR:sn,IS_SCRIPT_OR_DATA:ln,ATTR_WHITESPACE:Qe}=Ve;let{IS_ALLOWED_URI:Je}=Ve,v=null;const et=h({},[...qe,...Ee,...Te,...Ae,...Ge]);let S=null;const tt=h({},[...$e,..._e,...Ye,...ue]);let w=Object.seal(T(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}})),re=null,Me=null,nt=!0,Ne=!0,ot=!1,it=!0,Z=!1,$=!1,xe=!1,De=!1,K=!1,pe=!1,he=!1,rt=!0,at=!1;const cn="user-content-";let Oe=!0,ae=!1,Q={},J=null;const st=h({},["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"]);let lt=null;const ct=h({},["audio","video","img","source","image","track"]);let Ie=null;const dt=h({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ge="http://www.w3.org/1998/Math/MathML",be="http://www.w3.org/2000/svg",F="http://www.w3.org/1999/xhtml";let ee=F,Pe=!1,Ue=null;const dn=h({},[ge,be,F],ne);let se=null;const un=["application/xhtml+xml","text/html"],mn="text/html";let C=null,te=null;const fn=E.createElement("form"),ut=function(e){return e instanceof RegExp||e instanceof Function},ze=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(te&&te===e)){if((!e||typeof e!="object")&&(e={}),e=G(e),se=un.indexOf(e.PARSER_MEDIA_TYPE)===-1?mn:e.PARSER_MEDIA_TYPE,C=se==="application/xhtml+xml"?ne:X,v="ALLOWED_TAGS"in e?h({},e.ALLOWED_TAGS,C):et,S="ALLOWED_ATTR"in e?h({},e.ALLOWED_ATTR,C):tt,Ue="ALLOWED_NAMESPACES"in e?h({},e.ALLOWED_NAMESPACES,ne):dn,Ie="ADD_URI_SAFE_ATTR"in e?h(G(dt),e.ADD_URI_SAFE_ATTR,C):dt,lt="ADD_DATA_URI_TAGS"in e?h(G(ct),e.ADD_DATA_URI_TAGS,C):ct,J="FORBID_CONTENTS"in e?h({},e.FORBID_CONTENTS,C):st,re="FORBID_TAGS"in e?h({},e.FORBID_TAGS,C):{},Me="FORBID_ATTR"in e?h({},e.FORBID_ATTR,C):{},Q="USE_PROFILES"in e?e.USE_PROFILES:!1,nt=e.ALLOW_ARIA_ATTR!==!1,Ne=e.ALLOW_DATA_ATTR!==!1,ot=e.ALLOW_UNKNOWN_PROTOCOLS||!1,it=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Z=e.SAFE_FOR_TEMPLATES||!1,$=e.WHOLE_DOCUMENT||!1,K=e.RETURN_DOM||!1,pe=e.RETURN_DOM_FRAGMENT||!1,he=e.RETURN_TRUSTED_TYPE||!1,De=e.FORCE_BODY||!1,rt=e.SANITIZE_DOM!==!1,at=e.SANITIZE_NAMED_PROPS||!1,Oe=e.KEEP_CONTENT!==!1,ae=e.IN_PLACE||!1,Je=e.ALLOWED_URI_REGEXP||je,ee=e.NAMESPACE||F,w=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&ut(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(w.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&ut(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(w.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(w.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Z&&(Ne=!1),pe&&(K=!0),Q&&(v=h({},Ge),S=[],Q.html===!0&&(h(v,qe),h(S,$e)),Q.svg===!0&&(h(v,Ee),h(S,_e),h(S,ue)),Q.svgFilters===!0&&(h(v,Te),h(S,_e),h(S,ue)),Q.mathMl===!0&&(h(v,Ae),h(S,Ye),h(S,ue))),e.ADD_TAGS&&(v===et&&(v=G(v)),h(v,e.ADD_TAGS,C)),e.ADD_ATTR&&(S===tt&&(S=G(S)),h(S,e.ADD_ATTR,C)),e.ADD_URI_SAFE_ATTR&&h(Ie,e.ADD_URI_SAFE_ATTR,C),e.FORBID_CONTENTS&&(J===st&&(J=G(J)),h(J,e.FORBID_CONTENTS,C)),Oe&&(v["#text"]=!0),$&&h(v,["html","head","body"]),v.table&&(h(v,["tbody"]),delete re.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw oe('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw oe('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');M=e.TRUSTED_TYPES_POLICY,ie=M.createHTML("")}else M===void 0&&(M=jt(me,k)),M!==null&&typeof ie=="string"&&(ie=M.createHTML(""));i&&i(e),te=e}},mt=h({},["mi","mo","mn","ms","mtext"]),ft=h({},["foreignobject","desc","title","annotation-xml"]),pn=h({},["title","style","font","a","script"]),pt=h({},[...Ee,...Te,...Ut]),ht=h({},[...Ae,...zt]),hn=function(e){let n=Se(e);(!n||!n.tagName)&&(n={namespaceURI:ee,tagName:"template"});const a=X(e.tagName),A=X(n.tagName);return Ue[e.namespaceURI]?e.namespaceURI===be?n.namespaceURI===F?a==="svg":n.namespaceURI===ge?a==="svg"&&(A==="annotation-xml"||mt[A]):!!pt[a]:e.namespaceURI===ge?n.namespaceURI===F?a==="math":n.namespaceURI===be?a==="math"&&ft[A]:!!ht[a]:e.namespaceURI===F?n.namespaceURI===be&&!ft[A]||n.namespaceURI===ge&&!mt[A]?!1:!ht[a]&&(pn[a]||!pt[a]):!!(se==="application/xhtml+xml"&&Ue[e.namespaceURI]):!1},Y=function(e){q(c.removed,{element:e});try{e.parentNode.removeChild(e)}catch{e.remove()}},He=function(e,n){try{q(c.removed,{attribute:n.getAttributeNode(e),from:n})}catch{q(c.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e==="is"&&!S[e])if(K||pe)try{Y(n)}catch{}else try{n.setAttribute(e,"")}catch{}},gt=function(e){let n=null,a=null;if(De)e="<remove></remove>"+e;else{const R=ye(e,/^[\r\n\t ]+/);a=R&&R[0]}se==="application/xhtml+xml"&&ee===F&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const A=M?M.createHTML(e):e;if(ee===F)try{n=new Kt().parseFromString(A,se)}catch{}if(!n||!n.documentElement){n=Ce.createDocument(ee,"template",null);try{n.documentElement.innerHTML=Pe?ie:A}catch{}}const L=n.body||n.documentElement;return e&&a&&L.insertBefore(E.createTextNode(a),L.childNodes[0]||null),ee===F?on.call(n,$?"html":"body")[0]:$?n.documentElement:L},bt=function(e){return tn.call(e.ownerDocument||e,e,ve.SHOW_ELEMENT|ve.SHOW_COMMENT|ve.SHOW_TEXT,null)},gn=function(e){return e instanceof Zt&&(typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||!(e.attributes instanceof Vt)||typeof e.removeAttribute!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function")},yt=function(e){return typeof we=="function"&&e instanceof we},B=function(e,n,a){z[e]&&U(z[e],A=>{A.call(c,n,a,te)})},Et=function(e){let n=null;if(B("beforeSanitizeElements",e,null),gn(e))return Y(e),!0;const a=C(e.nodeName);if(B("uponSanitizeElement",e,{tagName:a,allowedTags:v}),e.hasChildNodes()&&!yt(e.firstElementChild)&&O(/<[/\w]/g,e.innerHTML)&&O(/<[/\w]/g,e.textContent))return Y(e),!0;if(!v[a]||re[a]){if(!re[a]&&At(a)&&(w.tagNameCheck instanceof RegExp&&O(w.tagNameCheck,a)||w.tagNameCheck instanceof Function&&w.tagNameCheck(a)))return!1;if(Oe&&!J[a]){const A=Se(e)||e.parentNode,L=en(e)||e.childNodes;if(L&&A){const R=L.length;for(let x=R-1;x>=0;--x)A.insertBefore(Qt(L[x],!0),Jt(e))}}return Y(e),!0}return e instanceof Ke&&!hn(e)||(a==="noscript"||a==="noembed"||a==="noframes")&&O(/<\/no(script|embed|frames)/i,e.innerHTML)?(Y(e),!0):(Z&&e.nodeType===3&&(n=e.textContent,U([Le,Re,ke],A=>{n=W(n,A," ")}),e.textContent!==n&&(q(c.removed,{element:e.cloneNode()}),e.textContent=n)),B("afterSanitizeElements",e,null),!1)},Tt=function(e,n,a){if(rt&&(n==="id"||n==="name")&&(a in E||a in fn))return!1;if(!(Ne&&!Me[n]&&O(an,n))){if(!(nt&&O(sn,n))){if(!S[n]||Me[n]){if(!(At(e)&&(w.tagNameCheck instanceof RegExp&&O(w.tagNameCheck,e)||w.tagNameCheck instanceof Function&&w.tagNameCheck(e))&&(w.attributeNameCheck instanceof RegExp&&O(w.attributeNameCheck,n)||w.attributeNameCheck instanceof Function&&w.attributeNameCheck(n))||n==="is"&&w.allowCustomizedBuiltInElements&&(w.tagNameCheck instanceof RegExp&&O(w.tagNameCheck,a)||w.tagNameCheck instanceof Function&&w.tagNameCheck(a))))return!1}else if(!Ie[n]){if(!O(Je,W(a,Qe,""))){if(!((n==="src"||n==="xlink:href"||n==="href")&&e!=="script"&&Dt(a,"data:")===0&&lt[e])){if(!(ot&&!O(ln,W(a,Qe,"")))){if(a)return!1}}}}}}return!0},At=function(e){return e.indexOf("-")>0},_t=function(e){B("beforeSanitizeAttributes",e,null);const{attributes:n}=e;if(!n)return;const a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:S};let A=n.length;for(;A--;){const L=n[A],{name:R,namespaceURI:x,value:j}=L,le=C(R);let D=R==="value"?j:Ot(j);if(a.attrName=le,a.attrValue=D,a.keepAttr=!0,a.forceKeepAttr=void 0,B("uponSanitizeAttribute",e,a),D=a.attrValue,a.forceKeepAttr||(He(R,e),!a.keepAttr))continue;if(!it&&O(/\/>/i,D)){He(R,e);continue}Z&&U([Le,Re,ke],vt=>{D=W(D,vt," ")});const wt=C(e.nodeName);if(Tt(wt,le,D)){if(at&&(le==="id"||le==="name")&&(He(R,e),D=cn+D),M&&typeof me=="object"&&typeof me.getAttributeType=="function"&&!x)switch(me.getAttributeType(wt,le)){case"TrustedHTML":{D=M.createHTML(D);break}case"TrustedScriptURL":{D=M.createScriptURL(D);break}}try{x?e.setAttributeNS(x,R,D):e.setAttribute(R,D),ce(c.removed)}catch{}}}B("afterSanitizeAttributes",e,null)},bn=function d(e){let n=null;const a=bt(e);for(B("beforeSanitizeShadowDOM",e,null);n=a.nextNode();)B("uponSanitizeShadowNode",n,null),!Et(n)&&(n.content instanceof H&&d(n.content),_t(n));B("afterSanitizeShadowDOM",e,null)};return c.sanitize=function(d){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=null,a=null,A=null,L=null;if(Pe=!d,Pe&&(d="<!-->"),typeof d!="string"&&!yt(d))if(typeof d.toString=="function"){if(d=d.toString(),typeof d!="string")throw oe("dirty is not a string, aborting")}else throw oe("toString is not a function");if(!c.isSupported)return d;if(xe||ze(e),c.removed=[],typeof d=="string"&&(ae=!1),ae){if(d.nodeName){const j=C(d.nodeName);if(!v[j]||re[j])throw oe("root node is forbidden and cannot be sanitized in-place")}}else if(d instanceof we)n=gt("<!---->"),a=n.ownerDocument.importNode(d,!0),a.nodeType===1&&a.nodeName==="BODY"||a.nodeName==="HTML"?n=a:n.appendChild(a);else{if(!K&&!Z&&!$&&d.indexOf("<")===-1)return M&&he?M.createHTML(d):d;if(n=gt(d),!n)return K?null:he?ie:""}n&&De&&Y(n.firstChild);const R=bt(ae?d:n);for(;A=R.nextNode();)Et(A)||(A.content instanceof H&&bn(A.content),_t(A));if(ae)return d;if(K){if(pe)for(L=nn.call(n.ownerDocument);n.firstChild;)L.appendChild(n.firstChild);else L=n;return(S.shadowroot||S.shadowrootmode)&&(L=rn.call(g,L,!0)),L}let x=$?n.outerHTML:n.innerHTML;return $&&v["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&O(Xe,n.ownerDocument.doctype.name)&&(x="<!DOCTYPE "+n.ownerDocument.doctype.name+`>
2
- `+x),Z&&U([Le,Re,ke],j=>{x=W(x,j," ")}),M&&he?M.createHTML(x):x},c.setConfig=function(){let d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ze(d),xe=!0},c.clearConfig=function(){te=null,xe=!1},c.isValidAttribute=function(d,e,n){te||ze({});const a=C(d),A=C(e);return Tt(a,A,n)},c.addHook=function(d,e){typeof e=="function"&&(z[d]=z[d]||[],q(z[d],e))},c.removeHook=function(d){if(z[d])return ce(z[d])},c.removeHooks=function(d){z[d]&&(z[d]=[])},c.removeAllHooks=function(){z={}},c}var Xt=Ze();return Xt})})(kt);const Be=kt.exports,Dn=":host{display:inline-grid;overflow:hidden;width:100%}.view-email{width:100%}.view-email div.gmail_quote{display:none;color:var(--nylas-color-primary-400)}.view-email div.gmail_quote.show{display:block}.view-email blockquote{border-color:var(--nylas-color-primary-500) !important}.view-email .nylas-view-email-toggle-button{display:flex;justify-content:center;align-items:center;cursor:pointer;background-color:var(--nylas-color-primary-200);color:var(--nylas-color-primary-600);border:0;border-radius:2px;font-size:14px;font-weight:500;line-height:1.5;transition:all 0.2s ease-in-out}.view-email .nylas-view-email-toggle-button:hover{background-color:var(--nylas-color-primary-200);color:var(--nylas-color-primary-600)}",On=Dn;Be.addHook("afterSanitizeAttributes",function(t){"target"in t&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener"))});const Mt=class{constructor(t){m.registerInstance(this,t),this.htmlElement=document.createElement("html"),this.setBody=o=>{var p;this.state="loading",this.styles=[],this.hoistedFontURLs=new Map,this.sanitizedBody="",document.querySelectorAll(".nylas-view-email-font").forEach(r=>{r.remove()}),(this.message?y.detectIfMessageIsHTML(this.message):y.detectHTMLOrPlainText(o))||(o=`<html><body>${y.parsePlainTextToHTML(o)}</body></html>`),this.htmlElement.innerHTML=o,this.detectDarkMode&&xn(this.htmlElement),this.htmlElement.querySelectorAll("link").forEach(r=>{if(console.debug(`[nylas-view-email] Hoisting link: ${r.getAttribute("href")}`),r.getAttribute("rel")==="stylesheet"&&r.getAttribute("href")){const f=r.getAttribute("href");if(f){const i=new URL(f,window.location.href);(i.protocol==="https:"||i.protocol==="http:")&&this.hoistedFontURLs.set(i.href,i.href)}}}),this.htmlElement.querySelectorAll("style").forEach(r=>{r.innerHTML.split(`
3
- `).forEach(f=>{const i=f.match(/@import url\((.*)\)/);if(i){const l=new URL(i[1],window.location.href);(l.protocol==="https:"||l.protocol==="http:")&&this.hoistedFontURLs.set(l.href,l.href)}}),r.innerHTML=r.innerHTML.replace("body",":host"),this.styles.push(r),r.remove()}),this.htmlElement.querySelectorAll("a").forEach(r=>{r.setAttribute("target","_blank")});const s=this.htmlElement.querySelector(".gmail_quote");if(s){const r=document.createElement("button");r.classList.add("nylas-view-email-toggle-button"),r.setAttribute("aria-label","Show quoted text"),r.innerText="...",(p=s.parentElement)==null||p.insertBefore(r,s)}this.sanitizedBody=Be.sanitize(this.htmlElement.innerHTML),this.hoistedFontURLs.forEach((r,f)=>{const i=document.createElement("link");i.setAttribute("rel","stylesheet"),i.setAttribute("href",r),i.classList.add("nylas-view-email-font"),document.head.appendChild(i)}),this.state="ready"},this.handleMobileSize=()=>{var u,s,p,r;const o=Math.max(document.documentElement.clientWidth||0,window.innerWidth||0);if(o<=768){const f=(u=this.viewEmailElement)==null?void 0:u.getBoundingClientRect();if(f&&this.viewEmailElement&&this.parent&&f.width>o){const i=this.parent,l=i==null?void 0:i.getBoundingClientRect();y.debug("Parent width:",l==null?void 0:l.width,"Parent height:",l==null?void 0:l.height),y.debug("Parent client width:",i.clientWidth,"Parent client height:",i.clientHeight);const T=l.width/f.width,_=l.height/f.height,N=Math.min(T,_);y.debug("Scale:",N),this.viewEmailElement.style.setProperty("transform",`scale(${N})`),this.viewEmailElement.style.setProperty("transform-origin","top left"),this.viewEmailElement.style.setProperty("height",`${f.height*N}px`)}}else(s=this.viewEmailElement)==null||s.style.removeProperty("transform"),(p=this.viewEmailElement)==null||p.style.removeProperty("transform-origin"),(r=this.viewEmailElement)==null||r.style.removeProperty("height")},this.message=void 0,this.parent=void 0,this.attachments=[],this.detectDarkMode=!0,this.state="loading",this.sanitizedBody="",this.styles=[],this.viewEmailElement=void 0,this.hoistedFontURLs=new Map}connectedCallback(){}disconnectedCallback(){y.debug("[nylas-view-email] Component disconnected"),this.state="loading",this.styles=[],this.hoistedFontURLs=new Map,this.sanitizedBody="",document.querySelectorAll(".nylas-view-email-font").forEach(t=>{t.remove()})}async componentWillLoad(){var t;y.debug("[nylas-view-email] component loaded"),this.setBody(((t=this.message)==null?void 0:t.body)??"")}async componentDidLoad(){y.debug("[nylas-view-thread] Component did load"),this.handleMobileSize()}async messageChanged(){var t;y.debug("[nylas-view-thread] Message changed",{message:this.message}),this.setBody(((t=this.message)==null?void 0:t.body)??"")}handleScroll(){this.handleMobileSize()}viewEmailElementChanged(){var o;const t=(o=this.viewEmailElement)==null?void 0:o.querySelectorAll(".nylas-view-email-toggle-button");t&&t.forEach(u=>{u.addEventListener("click",()=>{var p;const s=(p=this.viewEmailElement)==null?void 0:p.querySelector(".gmail_quote");s&&s.classList.toggle("show")})})}render(){return console.debug("[nylas-view-email] render",{hoistedFontURLs:this.hoistedFontURLs}),m.h(m.Host,{key:"4fe5de7068b18d3566e049d2b068e2a568e8d849"},this.state==="loading"&&m.h("div",null,"Loading..."),this.state==="ready"&&m.h(m.Fragment,null,this.styles.map(t=>m.h("style",null,Be.sanitize(t.innerHTML))),m.h("div",{class:"view-email",part:"view-email",innerHTML:this.sanitizedBody,ref:t=>this.viewEmailElement=t})))}get host(){return m.getElement(this)}static get watchers(){return{message:["messageChanged"],viewEmailElement:["viewEmailElementChanged"]}}};Mt.style=On;const In=".sc-reply-all-icon-h{display:flex}",Pn=In,Nt=class{constructor(t){m.registerInstance(this,t),this.width="15",this.height="15"}render(){return m.h("svg",{key:"b8ecda42e9fee4ee178dba36bf798a6a0404424d",fill:"auto",width:this.width,height:this.height,viewBox:"0 0 1920 1920",xmlns:"http://www.w3.org/2000/svg"},m.h("path",{key:"94ea534065e92c1e70cbe5d29b3f2afc2c1597a5",d:"m1030.975 188 81.249 81.249-429.228 429.228h300.747c516.223 0 936.257 420.034 936.257 936.257v98.028h-114.92v-98.028c0-452.901-368.436-821.337-821.337-821.337H682.996l429.228 429.229-81.25 81.248-567.936-567.937L1030.975 188Zm-463.038.011 81.249 81.25-486.688 486.688 486.688 486.688-81.249 81.249L0 755.949 567.937 188.01Z","fill-rule":"evenodd"}))}};Nt.style=Pn;const Un=".sc-reply-icon-h{display:flex}",zn=Un,xt=class{constructor(t){m.registerInstance(this,t),this.width="15",this.height="15"}render(){return m.h("svg",{key:"7bd2f7db7c28d9eacd86fea8287078d3a5572a64",fill:"auto",width:this.width,height:this.height,viewBox:"0 0 1920 1920",xmlns:"http://www.w3.org/2000/svg"},m.h("path",{key:"c9ed6c5cb89c0f3c7a9417ae4875b2c9dd6b60ce",d:"M835.942 632.563H244.966l478.08-478.08-90.496-90.496L-.026 696.563 632.55 1329.14l90.496-90.496-478.08-478.08h590.976c504.448 0 914.816 410.368 914.816 914.816v109.184h128V1675.38c0-574.976-467.84-1042.816-1042.816-1042.816","fill-rule":"evenodd"}))}};xt.style=zn;exports.forward_icon=Ct;exports.nylas_composer=Lt;exports.nylas_summarize_message_button=We;exports.nylas_view_email=Mt;exports.reply_all_icon=Nt;exports.reply_icon=xt;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./index-2b8437d6.cjs"),y=require("./utils-c00bdc3c-94b9c3b6.cjs"),yn=require("./register-component-dc659dc3-fb85ee68.cjs"),En=require("./_commonjsHelpers-57e89916-4a3ae7d8.cjs");require("react");require("react-dom");const Tn=".sc-forward-icon-h{display:flex}",An=Tn,Ct=class{constructor(t){f.registerInstance(this,t),this.width="15",this.height="15"}render(){return f.h("svg",{key:"a858bd82169ace274a3c8cc1e214cd976e47e113",fill:"auto",width:this.width,height:this.height,viewBox:"0 0 1920 1920",xmlns:"http://www.w3.org/2000/svg"},f.h("path",{key:"963f33f0803edfb6e8dfdbd287cee4917da7df01",d:"m1246.246 64-90.496 90.496 477.952 477.952h-590.848C467.878 632.448.038 1100.416.038 1675.392v109.056h128v-109.056c0-504.576 410.368-914.944 914.816-914.944h590.848l-477.952 478.08 90.496 90.496 632.448-632.576L1246.246 64Z","fill-rule":"evenodd"}))}};Ct.style=An;const _n=':host{display:grid;color:var(--nylas-color-primary-900)}.editor{position:relative;display:block;max-height:300px;overflow:auto;padding:1rem;border:1px solid var(--nylas-color-primary-300)}.editor blockquote{visibility:hidden;overflow:hidden;position:relative;transition:height 0.3s ease;margin:0}.editor blockquote::before{content:"...";visibility:visible;opacity:1;position:absolute;top:0;left:0;background-color:var(--nylas-color-primary-300);width:20px;text-align:center;color:var(--nylas-color-primary-800);vertical-align:middle;display:flex;justify-content:center;align-items:center;align-self:center;cursor:pointer}.editor .collapsed{height:20px}.editor .expanded{visibility:visible;opacity:1;height:auto;margin:0px 0px 0px 0.8ex;border-left:1px solid var(--nylas-color-primary-300);padding-left:1rem}.editor .expanded::before{display:none;}.buttons{display:flex;margin-top:1rem;justify-content:space-between}.buttons sp-button{border-radius:var(--nylas-border-radius);background-color:var(--nylas-color-primary-400);color:var(--nylas-color-primary-900);fill:var(--nylas-color-primary-900)}.buttons sp-button:hover{background-color:var(--nylas-color-primary-500)}.buttons sp-button:disabled{background-color:var(--nylas-color-primary-200);color:var(--nylas-color-primary-600);cursor:not-allowed}.buttons sp-button chevron-icon{display:inline-block}.buttons .close{justify-self:end}.toolbar{position:absolute;display:none;background-color:var(--nylas-color-primary-200);border-radius:var(--nylas-border-radius);z-index:1}.toolbar sp-button{border:0}',wn=_n,Lt=class{constructor(t){f.registerInstance(this,t),this.close=f.createEvent(this,"close",7),this.send=f.createEvent(this,"send",7),this.closeComposer=o=>{this.close.emit(o)},this.sendComposer=o=>{var s;if(!this.editorEl){y.debug("no editor element");return}const u=this.editorEl.querySelector(".message-body");if(!u){y.debug("no message body");return}this.message&&(this.send.emit({message:this.message,replyBody:((s=u.querySelector(".message-body"))==null?void 0:s.innerHTML)||""}),this.close.emit(o),this.editorEl.innerHTML="")},this.message=void 0,this.viewEmailElement=void 0}connectedCallback(){}disconnectedCallback(){this.editorEl&&(this.editorEl.innerHTML="")}componentWillLoad(){}async componentDidLoad(){if(this.message&&this.watchBody(this.message),!this.editorEl){y.debug("[connectedCallback] no editor element");return}if(!this.toolbarEl){y.debug("[connectedCallback] no toolbar element");return}const t=this.editorEl,o=this.toolbarEl;t.addEventListener("mouseup",u=>{var W;const s=(W=this.host.shadowRoot)==null?void 0:W.getSelection();if(!s){y.debug("no selection");return}const p=s.getRangeAt(0),r=s.toString();if(!r){o.style.display="none";return}const m=t.querySelector(".message-body");if(!m){y.debug("no message body");return}const l=p.commonAncestorContainer.parentElement;if(!l)return;const T=m.getBoundingClientRect();y.debug("messageBodyRect",{messageBodyRect:T});const _=l.getBoundingClientRect();y.debug("foundRect",{foundRect:_});const ce=(l.childNodes[0].textContent||"").indexOf(r),q=window.getComputedStyle(l).fontSize,X=parseInt(q.replace("px",""),10),ne=_.top-T.top-o.clientHeight,ye=ce*(1/X)*100;o.style.top=`${ne}px`,o.style.left=`${ye}px`,o.style.display="block"})}watchBody(t){var r;if(!this.editorEl){y.debug("no editor element");return}this.editorEl.querySelectorAll(".message-body").forEach(m=>m.remove());const o=document.createElement("div");o.classList.add("message-body");const u=document.createElement("p");u.innerHTML="&nbsp;",o.appendChild(u);const s=document.createElement("br");o.appendChild(s);const p=document.createElement("div");if(p.classList.add("reply-text"),p.innerText=`On ${new Date(t.date*1e3).toLocaleDateString(void 0,{dateStyle:"full"})} <${(r=t.from)==null?void 0:r.map(m=>m.name||m.email).join(", ")}> wrote:`,o.appendChild(p),t.body){const m=document.createElement("html");m.innerHTML=t.body;const i=document.createElement("blockquote");i.classList.add("collapsed"),i.classList.add("gmail_quote"),i.innerHTML=m.innerHTML,o.appendChild(i),y.debug("replyContainer",{replyContainer:i})}this.editorEl.appendChild(o),this.editorEl.querySelectorAll("blockquote.collapsed").forEach(m=>{m.addEventListener("click",function(i){i.preventDefault();const l=i.target;l.classList.remove("collapsed"),l.classList.add("expanded")},{once:!0})}),this.editorEl.focus()}render(){return f.h(f.Host,{key:"89cdb2c6c606698704a06507ddbe301a37134ca4"},f.h("sp-theme",{key:"4946560c2ab8518e5172e506caf36fa98fbc3912",scale:"medium",color:"dark"},f.h("div",{key:"b21a8843aaebb1fd4169ce2b849fb801bce46df4",class:"editor",contentEditable:!0,ref:t=>this.editorEl=t},f.h("div",{key:"830a97d7947b65c0312630184d539d4f8c7a48eb",class:"toolbar",ref:t=>this.toolbarEl=t,contentEditable:!1},f.h("sp-button",{key:"2fb11d997b13e4ec6e700155e3001d30f52bb217",quiet:!0,onClick:()=>document.execCommand("bold")},f.h("div",{key:"5c4fd64a8a3ccb94f36675047c05a662a1846426",slot:"icon"},f.h("bold-icon",{key:"033043849fddd392bc078dbb2fd843f6701c0501"})),f.h("div",{key:"585b08407297a97e3214d716505331f0889ea68f",slot:"label"},"Bold")),f.h("sp-button",{key:"b01e3c9c40fbe11122ca7be4b5120ba19262e1d5",quiet:!0,onClick:()=>document.execCommand("underline")},f.h("div",{key:"e407e888cb414fc4e5b15e9d21349038c7871f83",slot:"icon"},f.h("underline-icon",{key:"838cf6c3b7b42708b5ed6e5c53072cda29043f40"})),f.h("div",{key:"c662e1cefa352cb8910050a77e5b0a2e18de6bed",slot:"label"},"Underline")),f.h("sp-button",{key:"7e39fdbbdaeafabf1de93f42758f3b499c70206b",quiet:!0,onClick:()=>document.execCommand("italic")},f.h("div",{key:"8d7c7be8cf3959726b7541ed64e4e41995461258",slot:"icon"},f.h("italic-icon",{key:"ae07a6648728e3f9720dfdc3e3f91e8e4cbf86d9"})),f.h("div",{key:"fc3fc026d47610df27752ec8a310db99e280014c",slot:"label"},"Italic")))),f.h("div",{key:"9d4abb27a5d5a6b2c884da58191ca8f014e9ab43",class:"buttons"},f.h("sp-button",{key:"43f2b6d9a4a6d5513eb6fd52fb8f68f416077b37",onClick:this.sendComposer,class:"send"},"Send"),f.h("sp-button",{key:"fbae8e0490814b13347e3cc09bfd922ff5fceb43",onClick:this.closeComposer,class:"close"},"Close"))))}get host(){return f.getElement(this)}static get watchers(){return{message:["watchBody"]}}};Lt.style=wn;const vn=":host{display:block}sp-button{padding:0;border:0;border-radius:var(--nylas-border-radius);min-block-size:50%;min-inline-size:2rem;background-color:var(--nylas-color-primary-300);fill:var(--nylas-color-primary-800)}sp-button:hover{background-color:var(--nylas-color-primary-400)}.summarize-button.stopped{animation:none}.summarize-button.playing{animation:pulse 2s infinite}.summarize-button.loading{display:flex;align-content:center;height:1.5rem;width:2rem;vertical-align:middle;animation:pulse 2s infinite;flex-wrap:wrap}.summarize-button.loading loading-icon{--dot-color:var(--nylas-color-primary-600)}@keyframes pulse{0%{transform:scale(1);box-shadow:0 0 0 0 var(--nylas-color-primary-300)}70%{transform:scale(1.05);box-shadow:0 0 0 10px rgba(255, 69, 0, 0)}100%{transform:scale(1);box-shadow:0 0 0 0 rgba(255, 69, 0, 0)}}@keyframes wave{0%{transform:translateX(0)}50%{transform:translateX(100%)}100%{transform:translateX(0)}}",Sn=vn;var Cn=function(t,o,u,s){var p=arguments.length,r=p<3?o:s===null?s=Object.getOwnPropertyDescriptor(o,u):s,m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,o,u,s);else for(var i=t.length-1;i>=0;i--)(m=t[i])&&(r=(p<3?m(r):p>3?m(o,u,r):m(o,u))||r);return p>3&&r&&Object.defineProperty(o,u,r),r},Fe=function(t,o){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,o)};const We=class{constructor(t){f.registerInstance(this,t),this.summarize=f.createEvent(this,"summarize",7),this.abortController=new AbortController,this.onClick=async o=>{var u,s;o.preventDefault(),o.stopPropagation(),this.state==="stopped"?this.message&&(this.abortController=new AbortController,this.summarize.emit({abortController:this.abortController,playAudio:this.playAudio,message:this.message,updateState:this.updateState}).defaultPrevented||(y.debug("[nylas-summarize-message-button] Default event not prevented, summarizing message"),this.audioRef&&(await this.audioRef.play().then(()=>{var r;return(r=this.audioRef)==null?void 0:r.pause()}).catch(r=>console.error("Error playing audio:",r)),await this.audioRef.play().catch(r=>console.error("Error playing audio:",r))))):this.state==="playing"?((u=this.abortController)==null||u.abort(),(s=this.audioRef)==null||s.pause()):this.state="stopped"},this.message=void 0,this.state="stopped",this.playAudio=this.playAudio.bind(this),this.updateState=this.updateState.bind(this)}connectedCallback(){}disconnectedCallback(){}async componentWillLoad(){y.debug("[nylas-summarize-message-button] Component will load")}async componentDidLoad(){y.debug("[nylas-summarize-message-button] Component did load")}async updateState(t){this.state=t}async playAudio(t){if(!this.audioRef){this.state="stopped";return}if(!t){this.state="stopped";return}const o=this.audioRef;if(!("MediaSource"in window)){const i=await t;if(i==null)throw new Error("ReadableStream not yet supported in this browser.");const l=i.getReader(),T=[];await this.readChunk(l,T);const _=new Blob(T,{type:"audio/mpeg"}),N=URL.createObjectURL(_);o.src=N;return}const u=new MediaSource;let s,p=!1;o.src=URL.createObjectURL(u),u.addEventListener("sourceopen",r);async function r(){s=u.addSourceBuffer("audio/mpeg"),s.addEventListener("updateend",m);const i=await t;if(i==null)throw new Error("ReadableStream not yet supported in this browser.");const l=i.getReader(),T=()=>{l.read().then(({done:_,value:N})=>{if(_){p=!0;return}s.updating||s.appendBuffer(N),T()}).catch(_=>{console.error("Error while fetching and appending chunks:",_)})};T(),o.paused&&o.play().catch(_=>console.error("Error playing audio:",_))}function m(){if(p){u.endOfStream(),u.removeEventListener("sourceopen",r),u.removeEventListener("sourceclose",()=>{y.debug("[nylas-summarize-message-button] Source closed")}),s.removeEventListener("updateend",m);return}}}async readChunk(t,o){return t.read().then(({done:u,value:s})=>u?o:(o.push(s),this.readChunk(t,o)))}render(){return f.h(f.Host,{key:"b14f3bab7ebd190d54a66a3e00704f9e4b147a8f"},f.h("sp-theme",{key:"3a5b0782c84bbc7dba7b15306d608b885b5a6edc",scale:"medium",color:"dark"},f.h("sp-button",{key:"d63121e6f80bd09f1e7ca35e1176aa3a070517b3",label:"Summarize email","icon-only":!0,onClickCapture:this.onClick,class:{"summarize-button":!0,stopped:this.state==="stopped",loading:this.state==="loading",playing:this.state==="playing"}},this.state==="stopped"&&f.h("play-icon",null),this.state==="loading"&&f.h("loading-icon",null),this.state==="playing"&&f.h("stop-icon",null)),f.h("audio",{key:"954be0517a3b7328149830b2058d073ae9da591d",ref:t=>this.audioRef=t,autoPlay:!0,onPlaying:()=>this.state="playing",onPause:()=>this.state="stopped",onEnded:()=>{this.state="stopped",y.debug("[nylas-summarize-message-button] Audio ended")}})))}};Cn([yn.RegisterComponent({name:"nylas-summarize-message-button",eventToProps:{summarize:async(t,o)=>{const{playAudio:u,updateState:s,abortController:p,message:r}=t.detail,m=y.htmlToPlainText(r.body||"");await s("loading");try{const i=await o.messages.summarizeText(m),l=o.messages.textToSpeech(i,p);await u(l)}catch(i){await s("stopped"),console.error("Error summarizing message:",i)}}},fireRegisterEvent:!0}),Fe("design:type",Function),Fe("design:paramtypes",[]),Fe("design:returntype",void 0)],We.prototype,"render",null);We.style=Sn;function P(t){return!window.matchMedia("(prefers-color-scheme: dark)").matches||!t?t:t==="transparent"?"color":t.startsWith("#")?Ln(t):t.startsWith("rgb")?Rt(t):t.startsWith("hsl")?Rn(t):kn(t)?Mn(t):t}function Ln(t){t.length<7&&(t="#"+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]);const o=(255-parseInt(t.slice(1,3),16)).toString(16).padStart(2,"0"),u=(255-parseInt(t.slice(3,5),16)).toString(16).padStart(2,"0"),s=(255-parseInt(t.slice(5,7),16)).toString(16).padStart(2,"0");return`#${o}${u}${s}`}function Rt(t){var r;const o=(r=t.match(/\d+/g))==null?void 0:r.map(Number);if(!o)return t;const[u,s,p]=o;return`rgb(${255-u}, ${255-s}, ${255-p})`}function Rn(t){var r;const o=(r=t.match(/\d+\.?\d*/g))==null?void 0:r.map(Number);if(!o)return t;const[u,s,p]=o;return`hsl(${u}, ${s}%, ${100-p}%)`}function kn(t){return/^[a-z]+$/i.test(t)}function Mn(t){return Rt(Nn(t))}function Nn(t){return t.toLowerCase()==="red"?"rgb(255, 0, 0)":"rgb(0, 0, 0)"}function St(t){if(t instanceof HTMLStyleElement){let o=t.textContent;if(o){o=o.replaceAll(/@media\s*\(prefers-color-scheme:\s*(dark|light)\)\s*\{([^}]+)\}/g,"");const u=o.matchAll(/border-color:\s*([^;]+)/g);if(u)for(const i of u){const[l,T]=i,_=l.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&");o=o.replaceAll(_,l.replace(T,P(T)))}const s=o.matchAll(/border:\s*([^;]+)/g);if(s)for(const i of s){const l=i[0].trim(),T=l.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),[_,N,U]=i[1].split(" ");o=o.replaceAll(T,l.replace(U,P(U)))}const p=o.matchAll(/background-color:\s*([^;]+)/g);if(p)for(const i of p){const[l,T]=i,_=l.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&");o=o.replaceAll(_,l.replace(T,P(T))),y.debug("backgroundColor",{fullMatch:l,replace:l.replace(T,P(T)),color:T,invertColor:P(T)})}const r=o.matchAll(/background:\s*([^;]+)/g);if(r)for(const i of r){const l=i[0].trim(),T=l.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),[_,N,U]=i[1].split(" ");o=o.replaceAll(T,l.replace(U,P(U)))}const m=o.matchAll(/color:\s*([^;]+)/g);if(m)for(const i of m){const[l,T]=i,_=l.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&");o=o.replaceAll(_,l.replace(T,P(T)))}t.textContent=o}}if(t instanceof HTMLElement){const o=window.getComputedStyle(t),u=o.color||t.style.color,s=o.backgroundColor||t.style.backgroundColor,p=o.borderColor||t.style.borderColor;u&&!s?t.style.color="":u&&s?(t.style.color=P(u),t.style.backgroundColor=P(s),y.debug("element",t),y.debug("computedStyle.color",u),y.debug("computedStyle.backgroundColor",s),y.debug("invertColor(color)",P(u)),y.debug("invertColor(backgroundColor)",P(s))):!u&&s&&(t.style.backgroundColor=""),p&&(y.debug("borderColor",p),t.style.borderColor=P(p)),t.hasAttribute("bgcolor")&&t.removeAttribute("bgcolor")}}function xn(t){St(t),t.querySelectorAll("*").forEach(u=>St(u))}var kt={exports:{}};/*! @license DOMPurify 3.0.8 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.8/LICENSE */(function(t,o){(function(u,s){t.exports=s()})(En.commonjsGlobal,function(){const{entries:u,setPrototypeOf:s,isFrozen:p,getPrototypeOf:r,getOwnPropertyDescriptor:m}=Object;let{freeze:i,seal:l,create:T}=Object,{apply:_,construct:N}=typeof Reflect<"u"&&Reflect;i||(i=function(c){return c}),l||(l=function(c){return c}),_||(_=function(c,E,g){return c.apply(E,g)}),N||(N=function(c,E){return new c(...E)});const U=I(Array.prototype.forEach),ce=I(Array.prototype.pop),q=I(Array.prototype.push),X=I(String.prototype.toLowerCase),ne=I(String.prototype.toString),ye=I(String.prototype.match),W=I(String.prototype.replace),Dt=I(String.prototype.indexOf),Ot=I(String.prototype.trim),O=I(RegExp.prototype.test),oe=It(TypeError);function I(b){return function(c){for(var E=arguments.length,g=new Array(E>1?E-1:0),k=1;k<E;k++)g[k-1]=arguments[k];return _(b,c,g)}}function It(b){return function(){for(var c=arguments.length,E=new Array(c),g=0;g<c;g++)E[g]=arguments[g];return N(b,E)}}function h(b,c){let E=arguments.length>2&&arguments[2]!==void 0?arguments[2]:X;s&&s(b,null);let g=c.length;for(;g--;){let k=c[g];if(typeof k=="string"){const H=E(k);H!==k&&(p(c)||(c[g]=H),k=H)}b[k]=!0}return b}function Pt(b){for(let c=0;c<b.length;c++)m(b,c)===void 0&&(b[c]=null);return b}function G(b){const c=T(null);for(const[E,g]of u(b))m(b,E)!==void 0&&(Array.isArray(g)?c[E]=Pt(g):g&&typeof g=="object"&&g.constructor===Object?c[E]=G(g):c[E]=g);return c}function de(b,c){for(;b!==null;){const g=m(b,c);if(g){if(g.get)return I(g.get);if(typeof g.value=="function")return I(g.value)}b=r(b)}function E(g){return console.warn("fallback value for",g),null}return E}const qe=i(["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","section","select","shadow","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"]),Ee=i(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Te=i(["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"]),Ut=i(["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"]),Ae=i(["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"]),zt=i(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ge=i(["#text"]),$e=i(["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","face","for","headers","height","hidden","high","href","hreflang","id","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","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),_e=i(["accent-height","accumulate","additive","alignment-baseline","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","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","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","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","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","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"]),Ye=i(["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"]),ue=i(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ht=l(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Ft=l(/<%[\w\W]*|[\w\W]*%>/gm),Bt=l(/\${[\w\W]*}/gm),Wt=l(/^data-[\-\w.\u00B7-\uFFFF]/),qt=l(/^aria-[\-\w]+$/),je=l(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Gt=l(/^(?:\w+script|data):/i),$t=l(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Xe=l(/^html$/i);var Ve=Object.freeze({__proto__:null,MUSTACHE_EXPR:Ht,ERB_EXPR:Ft,TMPLIT_EXPR:Bt,DATA_ATTR:Wt,ARIA_ATTR:qt,IS_ALLOWED_URI:je,IS_SCRIPT_OR_DATA:Gt,ATTR_WHITESPACE:$t,DOCTYPE_NAME:Xe});const Yt=function(){return typeof window>"u"?null:window},jt=function(c,E){if(typeof c!="object"||typeof c.createPolicy!="function")return null;let g=null;const k="data-tt-policy-suffix";E&&E.hasAttribute(k)&&(g=E.getAttribute(k));const H="dompurify"+(g?"#"+g:"");try{return c.createPolicy(H,{createHTML(V){return V},createScriptURL(V){return V}})}catch{return console.warn("TrustedTypes policy "+H+" could not be created."),null}};function Ze(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Yt();const c=d=>Ze(d);if(c.version="3.0.8",c.removed=[],!b||!b.document||b.document.nodeType!==9)return c.isSupported=!1,c;let{document:E}=b;const g=E,k=g.currentScript,{DocumentFragment:H,HTMLTemplateElement:V,Node:we,Element:Ke,NodeFilter:ve,NamedNodeMap:Vt=b.NamedNodeMap||b.MozNamedAttrMap,HTMLFormElement:Zt,DOMParser:Kt,trustedTypes:fe}=b,me=Ke.prototype,Qt=de(me,"cloneNode"),Jt=de(me,"nextSibling"),en=de(me,"childNodes"),Se=de(me,"parentNode");if(typeof V=="function"){const d=E.createElement("template");d.content&&d.content.ownerDocument&&(E=d.content.ownerDocument)}let M,ie="";const{implementation:Ce,createNodeIterator:tn,createDocumentFragment:nn,getElementsByTagName:on}=E,{importNode:rn}=g;let z={};c.isSupported=typeof u=="function"&&typeof Se=="function"&&Ce&&Ce.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Le,ERB_EXPR:Re,TMPLIT_EXPR:ke,DATA_ATTR:an,ARIA_ATTR:sn,IS_SCRIPT_OR_DATA:ln,ATTR_WHITESPACE:Qe}=Ve;let{IS_ALLOWED_URI:Je}=Ve,v=null;const et=h({},[...qe,...Ee,...Te,...Ae,...Ge]);let S=null;const tt=h({},[...$e,..._e,...Ye,...ue]);let w=Object.seal(T(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}})),re=null,Me=null,nt=!0,Ne=!0,ot=!1,it=!0,Z=!1,$=!1,xe=!1,De=!1,K=!1,pe=!1,he=!1,rt=!0,at=!1;const cn="user-content-";let Oe=!0,ae=!1,Q={},J=null;const st=h({},["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"]);let lt=null;const ct=h({},["audio","video","img","source","image","track"]);let Ie=null;const dt=h({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ge="http://www.w3.org/1998/Math/MathML",be="http://www.w3.org/2000/svg",F="http://www.w3.org/1999/xhtml";let ee=F,Pe=!1,Ue=null;const dn=h({},[ge,be,F],ne);let se=null;const un=["application/xhtml+xml","text/html"],fn="text/html";let C=null,te=null;const mn=E.createElement("form"),ut=function(e){return e instanceof RegExp||e instanceof Function},ze=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(te&&te===e)){if((!e||typeof e!="object")&&(e={}),e=G(e),se=un.indexOf(e.PARSER_MEDIA_TYPE)===-1?fn:e.PARSER_MEDIA_TYPE,C=se==="application/xhtml+xml"?ne:X,v="ALLOWED_TAGS"in e?h({},e.ALLOWED_TAGS,C):et,S="ALLOWED_ATTR"in e?h({},e.ALLOWED_ATTR,C):tt,Ue="ALLOWED_NAMESPACES"in e?h({},e.ALLOWED_NAMESPACES,ne):dn,Ie="ADD_URI_SAFE_ATTR"in e?h(G(dt),e.ADD_URI_SAFE_ATTR,C):dt,lt="ADD_DATA_URI_TAGS"in e?h(G(ct),e.ADD_DATA_URI_TAGS,C):ct,J="FORBID_CONTENTS"in e?h({},e.FORBID_CONTENTS,C):st,re="FORBID_TAGS"in e?h({},e.FORBID_TAGS,C):{},Me="FORBID_ATTR"in e?h({},e.FORBID_ATTR,C):{},Q="USE_PROFILES"in e?e.USE_PROFILES:!1,nt=e.ALLOW_ARIA_ATTR!==!1,Ne=e.ALLOW_DATA_ATTR!==!1,ot=e.ALLOW_UNKNOWN_PROTOCOLS||!1,it=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Z=e.SAFE_FOR_TEMPLATES||!1,$=e.WHOLE_DOCUMENT||!1,K=e.RETURN_DOM||!1,pe=e.RETURN_DOM_FRAGMENT||!1,he=e.RETURN_TRUSTED_TYPE||!1,De=e.FORCE_BODY||!1,rt=e.SANITIZE_DOM!==!1,at=e.SANITIZE_NAMED_PROPS||!1,Oe=e.KEEP_CONTENT!==!1,ae=e.IN_PLACE||!1,Je=e.ALLOWED_URI_REGEXP||je,ee=e.NAMESPACE||F,w=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&ut(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(w.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&ut(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(w.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(w.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Z&&(Ne=!1),pe&&(K=!0),Q&&(v=h({},Ge),S=[],Q.html===!0&&(h(v,qe),h(S,$e)),Q.svg===!0&&(h(v,Ee),h(S,_e),h(S,ue)),Q.svgFilters===!0&&(h(v,Te),h(S,_e),h(S,ue)),Q.mathMl===!0&&(h(v,Ae),h(S,Ye),h(S,ue))),e.ADD_TAGS&&(v===et&&(v=G(v)),h(v,e.ADD_TAGS,C)),e.ADD_ATTR&&(S===tt&&(S=G(S)),h(S,e.ADD_ATTR,C)),e.ADD_URI_SAFE_ATTR&&h(Ie,e.ADD_URI_SAFE_ATTR,C),e.FORBID_CONTENTS&&(J===st&&(J=G(J)),h(J,e.FORBID_CONTENTS,C)),Oe&&(v["#text"]=!0),$&&h(v,["html","head","body"]),v.table&&(h(v,["tbody"]),delete re.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw oe('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw oe('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');M=e.TRUSTED_TYPES_POLICY,ie=M.createHTML("")}else M===void 0&&(M=jt(fe,k)),M!==null&&typeof ie=="string"&&(ie=M.createHTML(""));i&&i(e),te=e}},ft=h({},["mi","mo","mn","ms","mtext"]),mt=h({},["foreignobject","desc","title","annotation-xml"]),pn=h({},["title","style","font","a","script"]),pt=h({},[...Ee,...Te,...Ut]),ht=h({},[...Ae,...zt]),hn=function(e){let n=Se(e);(!n||!n.tagName)&&(n={namespaceURI:ee,tagName:"template"});const a=X(e.tagName),A=X(n.tagName);return Ue[e.namespaceURI]?e.namespaceURI===be?n.namespaceURI===F?a==="svg":n.namespaceURI===ge?a==="svg"&&(A==="annotation-xml"||ft[A]):!!pt[a]:e.namespaceURI===ge?n.namespaceURI===F?a==="math":n.namespaceURI===be?a==="math"&&mt[A]:!!ht[a]:e.namespaceURI===F?n.namespaceURI===be&&!mt[A]||n.namespaceURI===ge&&!ft[A]?!1:!ht[a]&&(pn[a]||!pt[a]):!!(se==="application/xhtml+xml"&&Ue[e.namespaceURI]):!1},Y=function(e){q(c.removed,{element:e});try{e.parentNode.removeChild(e)}catch{e.remove()}},He=function(e,n){try{q(c.removed,{attribute:n.getAttributeNode(e),from:n})}catch{q(c.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e==="is"&&!S[e])if(K||pe)try{Y(n)}catch{}else try{n.setAttribute(e,"")}catch{}},gt=function(e){let n=null,a=null;if(De)e="<remove></remove>"+e;else{const R=ye(e,/^[\r\n\t ]+/);a=R&&R[0]}se==="application/xhtml+xml"&&ee===F&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const A=M?M.createHTML(e):e;if(ee===F)try{n=new Kt().parseFromString(A,se)}catch{}if(!n||!n.documentElement){n=Ce.createDocument(ee,"template",null);try{n.documentElement.innerHTML=Pe?ie:A}catch{}}const L=n.body||n.documentElement;return e&&a&&L.insertBefore(E.createTextNode(a),L.childNodes[0]||null),ee===F?on.call(n,$?"html":"body")[0]:$?n.documentElement:L},bt=function(e){return tn.call(e.ownerDocument||e,e,ve.SHOW_ELEMENT|ve.SHOW_COMMENT|ve.SHOW_TEXT,null)},gn=function(e){return e instanceof Zt&&(typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||!(e.attributes instanceof Vt)||typeof e.removeAttribute!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function")},yt=function(e){return typeof we=="function"&&e instanceof we},B=function(e,n,a){z[e]&&U(z[e],A=>{A.call(c,n,a,te)})},Et=function(e){let n=null;if(B("beforeSanitizeElements",e,null),gn(e))return Y(e),!0;const a=C(e.nodeName);if(B("uponSanitizeElement",e,{tagName:a,allowedTags:v}),e.hasChildNodes()&&!yt(e.firstElementChild)&&O(/<[/\w]/g,e.innerHTML)&&O(/<[/\w]/g,e.textContent))return Y(e),!0;if(!v[a]||re[a]){if(!re[a]&&At(a)&&(w.tagNameCheck instanceof RegExp&&O(w.tagNameCheck,a)||w.tagNameCheck instanceof Function&&w.tagNameCheck(a)))return!1;if(Oe&&!J[a]){const A=Se(e)||e.parentNode,L=en(e)||e.childNodes;if(L&&A){const R=L.length;for(let x=R-1;x>=0;--x)A.insertBefore(Qt(L[x],!0),Jt(e))}}return Y(e),!0}return e instanceof Ke&&!hn(e)||(a==="noscript"||a==="noembed"||a==="noframes")&&O(/<\/no(script|embed|frames)/i,e.innerHTML)?(Y(e),!0):(Z&&e.nodeType===3&&(n=e.textContent,U([Le,Re,ke],A=>{n=W(n,A," ")}),e.textContent!==n&&(q(c.removed,{element:e.cloneNode()}),e.textContent=n)),B("afterSanitizeElements",e,null),!1)},Tt=function(e,n,a){if(rt&&(n==="id"||n==="name")&&(a in E||a in mn))return!1;if(!(Ne&&!Me[n]&&O(an,n))){if(!(nt&&O(sn,n))){if(!S[n]||Me[n]){if(!(At(e)&&(w.tagNameCheck instanceof RegExp&&O(w.tagNameCheck,e)||w.tagNameCheck instanceof Function&&w.tagNameCheck(e))&&(w.attributeNameCheck instanceof RegExp&&O(w.attributeNameCheck,n)||w.attributeNameCheck instanceof Function&&w.attributeNameCheck(n))||n==="is"&&w.allowCustomizedBuiltInElements&&(w.tagNameCheck instanceof RegExp&&O(w.tagNameCheck,a)||w.tagNameCheck instanceof Function&&w.tagNameCheck(a))))return!1}else if(!Ie[n]){if(!O(Je,W(a,Qe,""))){if(!((n==="src"||n==="xlink:href"||n==="href")&&e!=="script"&&Dt(a,"data:")===0&&lt[e])){if(!(ot&&!O(ln,W(a,Qe,"")))){if(a)return!1}}}}}}return!0},At=function(e){return e.indexOf("-")>0},_t=function(e){B("beforeSanitizeAttributes",e,null);const{attributes:n}=e;if(!n)return;const a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:S};let A=n.length;for(;A--;){const L=n[A],{name:R,namespaceURI:x,value:j}=L,le=C(R);let D=R==="value"?j:Ot(j);if(a.attrName=le,a.attrValue=D,a.keepAttr=!0,a.forceKeepAttr=void 0,B("uponSanitizeAttribute",e,a),D=a.attrValue,a.forceKeepAttr||(He(R,e),!a.keepAttr))continue;if(!it&&O(/\/>/i,D)){He(R,e);continue}Z&&U([Le,Re,ke],vt=>{D=W(D,vt," ")});const wt=C(e.nodeName);if(Tt(wt,le,D)){if(at&&(le==="id"||le==="name")&&(He(R,e),D=cn+D),M&&typeof fe=="object"&&typeof fe.getAttributeType=="function"&&!x)switch(fe.getAttributeType(wt,le)){case"TrustedHTML":{D=M.createHTML(D);break}case"TrustedScriptURL":{D=M.createScriptURL(D);break}}try{x?e.setAttributeNS(x,R,D):e.setAttribute(R,D),ce(c.removed)}catch{}}}B("afterSanitizeAttributes",e,null)},bn=function d(e){let n=null;const a=bt(e);for(B("beforeSanitizeShadowDOM",e,null);n=a.nextNode();)B("uponSanitizeShadowNode",n,null),!Et(n)&&(n.content instanceof H&&d(n.content),_t(n));B("afterSanitizeShadowDOM",e,null)};return c.sanitize=function(d){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=null,a=null,A=null,L=null;if(Pe=!d,Pe&&(d="<!-->"),typeof d!="string"&&!yt(d))if(typeof d.toString=="function"){if(d=d.toString(),typeof d!="string")throw oe("dirty is not a string, aborting")}else throw oe("toString is not a function");if(!c.isSupported)return d;if(xe||ze(e),c.removed=[],typeof d=="string"&&(ae=!1),ae){if(d.nodeName){const j=C(d.nodeName);if(!v[j]||re[j])throw oe("root node is forbidden and cannot be sanitized in-place")}}else if(d instanceof we)n=gt("<!---->"),a=n.ownerDocument.importNode(d,!0),a.nodeType===1&&a.nodeName==="BODY"||a.nodeName==="HTML"?n=a:n.appendChild(a);else{if(!K&&!Z&&!$&&d.indexOf("<")===-1)return M&&he?M.createHTML(d):d;if(n=gt(d),!n)return K?null:he?ie:""}n&&De&&Y(n.firstChild);const R=bt(ae?d:n);for(;A=R.nextNode();)Et(A)||(A.content instanceof H&&bn(A.content),_t(A));if(ae)return d;if(K){if(pe)for(L=nn.call(n.ownerDocument);n.firstChild;)L.appendChild(n.firstChild);else L=n;return(S.shadowroot||S.shadowrootmode)&&(L=rn.call(g,L,!0)),L}let x=$?n.outerHTML:n.innerHTML;return $&&v["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&O(Xe,n.ownerDocument.doctype.name)&&(x="<!DOCTYPE "+n.ownerDocument.doctype.name+`>
2
+ `+x),Z&&U([Le,Re,ke],j=>{x=W(x,j," ")}),M&&he?M.createHTML(x):x},c.setConfig=function(){let d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ze(d),xe=!0},c.clearConfig=function(){te=null,xe=!1},c.isValidAttribute=function(d,e,n){te||ze({});const a=C(d),A=C(e);return Tt(a,A,n)},c.addHook=function(d,e){typeof e=="function"&&(z[d]=z[d]||[],q(z[d],e))},c.removeHook=function(d){if(z[d])return ce(z[d])},c.removeHooks=function(d){z[d]&&(z[d]=[])},c.removeAllHooks=function(){z={}},c}var Xt=Ze();return Xt})})(kt);const Be=kt.exports,Dn=":host{display:inline-grid;overflow:hidden;width:100%}.view-email{width:100%}.view-email div.gmail_quote{display:none;color:var(--nylas-color-primary-400)}.view-email div.gmail_quote.show{display:block}.view-email blockquote{border-color:var(--nylas-color-primary-500) !important}.view-email .nylas-view-email-toggle-button{display:flex;justify-content:center;align-items:center;cursor:pointer;background-color:var(--nylas-color-primary-200);color:var(--nylas-color-primary-600);border:0;border-radius:2px;font-size:14px;font-weight:500;line-height:1.5;transition:all 0.2s ease-in-out}.view-email .nylas-view-email-toggle-button:hover{background-color:var(--nylas-color-primary-200);color:var(--nylas-color-primary-600)}",On=Dn;Be.addHook("afterSanitizeAttributes",function(t){"target"in t&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener"))});const Mt=class{constructor(t){f.registerInstance(this,t),this.htmlElement=document.createElement("html"),this.setBody=o=>{var p;this.state="loading",this.styles=[],this.hoistedFontURLs=new Map,this.sanitizedBody="",document.querySelectorAll(".nylas-view-email-font").forEach(r=>{r.remove()}),(this.message?y.detectIfMessageIsHTML(this.message):y.detectHTMLOrPlainText(o))||(o=`<html><body>${y.parsePlainTextToHTML(o)}</body></html>`),this.htmlElement.innerHTML=o,this.detectDarkMode&&xn(this.htmlElement),this.htmlElement.querySelectorAll("link").forEach(r=>{if(console.debug(`[nylas-view-email] Hoisting link: ${r.getAttribute("href")}`),r.getAttribute("rel")==="stylesheet"&&r.getAttribute("href")){const m=r.getAttribute("href");if(m){const i=new URL(m,window.location.href);(i.protocol==="https:"||i.protocol==="http:")&&this.hoistedFontURLs.set(i.href,i.href)}}}),this.htmlElement.querySelectorAll("style").forEach(r=>{r.innerHTML.split(`
3
+ `).forEach(m=>{const i=m.match(/@import url\((.*)\)/);if(i){const l=new URL(i[1],window.location.href);(l.protocol==="https:"||l.protocol==="http:")&&this.hoistedFontURLs.set(l.href,l.href)}}),r.innerHTML=r.innerHTML.replace("body",":host"),this.styles.push(r),r.remove()}),this.htmlElement.querySelectorAll("a").forEach(r=>{r.setAttribute("target","_blank")});const s=this.htmlElement.querySelector(".gmail_quote");if(s){const r=document.createElement("button");r.classList.add("nylas-view-email-toggle-button"),r.setAttribute("aria-label","Show quoted text"),r.innerText="...",(p=s.parentElement)==null||p.insertBefore(r,s)}this.sanitizedBody=Be.sanitize(this.htmlElement.innerHTML),this.hoistedFontURLs.forEach((r,m)=>{const i=document.createElement("link");i.setAttribute("rel","stylesheet"),i.setAttribute("href",r),i.classList.add("nylas-view-email-font"),document.head.appendChild(i)}),this.state="ready"},this.handleMobileSize=()=>{var u,s,p,r;const o=Math.max(document.documentElement.clientWidth||0,window.innerWidth||0);if(o<=768){const m=(u=this.viewEmailElement)==null?void 0:u.getBoundingClientRect();if(m&&this.viewEmailElement&&this.parent&&m.width>o){const i=this.parent,l=i==null?void 0:i.getBoundingClientRect();y.debug("Parent width:",l==null?void 0:l.width,"Parent height:",l==null?void 0:l.height),y.debug("Parent client width:",i.clientWidth,"Parent client height:",i.clientHeight);const T=l.width/m.width,_=l.height/m.height,N=Math.min(T,_);y.debug("Scale:",N),this.viewEmailElement.style.setProperty("transform",`scale(${N})`),this.viewEmailElement.style.setProperty("transform-origin","top left"),this.viewEmailElement.style.setProperty("height",`${m.height*N}px`)}}else(s=this.viewEmailElement)==null||s.style.removeProperty("transform"),(p=this.viewEmailElement)==null||p.style.removeProperty("transform-origin"),(r=this.viewEmailElement)==null||r.style.removeProperty("height")},this.message=void 0,this.parent=void 0,this.attachments=[],this.detectDarkMode=!0,this.state="loading",this.sanitizedBody="",this.styles=[],this.viewEmailElement=void 0,this.hoistedFontURLs=new Map}connectedCallback(){}disconnectedCallback(){y.debug("[nylas-view-email] Component disconnected"),this.state="loading",this.styles=[],this.hoistedFontURLs=new Map,this.sanitizedBody="",document.querySelectorAll(".nylas-view-email-font").forEach(t=>{t.remove()})}async componentWillLoad(){var t;y.debug("[nylas-view-email] component loaded"),this.setBody(((t=this.message)==null?void 0:t.body)??"")}async componentDidLoad(){y.debug("[nylas-view-thread] Component did load"),this.handleMobileSize()}async messageChanged(){var t;y.debug("[nylas-view-thread] Message changed",{message:this.message}),this.setBody(((t=this.message)==null?void 0:t.body)??"")}handleScroll(){this.handleMobileSize()}viewEmailElementChanged(){var o;const t=(o=this.viewEmailElement)==null?void 0:o.querySelectorAll(".nylas-view-email-toggle-button");t&&t.forEach(u=>{u.addEventListener("click",()=>{var p;const s=(p=this.viewEmailElement)==null?void 0:p.querySelector(".gmail_quote");s&&s.classList.toggle("show")})})}render(){return console.debug("[nylas-view-email] render",{hoistedFontURLs:this.hoistedFontURLs}),f.h(f.Host,{key:"5209aa3727b4c8013cec3ee0a33afdb38e9925d9"},this.state==="loading"&&f.h("div",null,"Loading..."),this.state==="ready"&&f.h(f.Fragment,null,this.styles.map(t=>f.h("style",null,Be.sanitize(t.innerHTML))),f.h("div",{class:"view-email",part:"view-email",innerHTML:this.sanitizedBody,ref:t=>this.viewEmailElement=t})))}get host(){return f.getElement(this)}static get watchers(){return{message:["messageChanged"],viewEmailElement:["viewEmailElementChanged"]}}};Mt.style=On;const In=".sc-reply-all-icon-h{display:flex}",Pn=In,Nt=class{constructor(t){f.registerInstance(this,t),this.width="15",this.height="15"}render(){return f.h("svg",{key:"cf3a910b7232018b6579cfe31a868e3ba54f30b0",fill:"auto",width:this.width,height:this.height,viewBox:"0 0 1920 1920",xmlns:"http://www.w3.org/2000/svg"},f.h("path",{key:"1db5bb9aa170d0a00c5939cdd7bfe7b878124c2c",d:"m1030.975 188 81.249 81.249-429.228 429.228h300.747c516.223 0 936.257 420.034 936.257 936.257v98.028h-114.92v-98.028c0-452.901-368.436-821.337-821.337-821.337H682.996l429.228 429.229-81.25 81.248-567.936-567.937L1030.975 188Zm-463.038.011 81.249 81.25-486.688 486.688 486.688 486.688-81.249 81.249L0 755.949 567.937 188.01Z","fill-rule":"evenodd"}))}};Nt.style=Pn;const Un=".sc-reply-icon-h{display:flex}",zn=Un,xt=class{constructor(t){f.registerInstance(this,t),this.width="15",this.height="15"}render(){return f.h("svg",{key:"a353055eb9122f1dae36fbf49a557c431fd8580a",fill:"auto",width:this.width,height:this.height,viewBox:"0 0 1920 1920",xmlns:"http://www.w3.org/2000/svg"},f.h("path",{key:"97ac62efd50d229e10b45fc2a47f3c8c5a9b6e5d",d:"M835.942 632.563H244.966l478.08-478.08-90.496-90.496L-.026 696.563 632.55 1329.14l90.496-90.496-478.08-478.08h590.976c504.448 0 914.816 410.368 914.816 914.816v109.184h128V1675.38c0-574.976-467.84-1042.816-1042.816-1042.816","fill-rule":"evenodd"}))}};xt.style=zn;exports.forward_icon=Ct;exports.nylas_composer=Lt;exports.nylas_summarize_message_button=We;exports.nylas_view_email=Mt;exports.reply_all_icon=Nt;exports.reply_icon=xt;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-3b6f5cd5.cjs");require("react");require("react-dom");const i=".sc-globe-icon-h{display:flex}",c=i,C=class{constructor(t){e.registerInstance(this,t),this.width="16",this.height="16"}render(){return e.h("svg",{key:"40c238dae79b6c837926f797a13f07c9378eeeac",xmlns:"http://www.w3.org/2000/svg",width:this.width,height:this.height,viewBox:"0 0 16 16",fill:"none"},e.h("path",{key:"b332e53dace690161725dee143c3682bc9039fa4",d:"M8 14C11.3137 14 14 11.3137 14 8C14 4.68629 11.3137 2 8 2C4.68629 2 2 4.68629 2 8C2 11.3137 4.68629 14 8 14ZM8 3C8.37372 3 8.87543 3.35608 9.31258 4.31781C9.4073 4.52619 9.49448 4.75446 9.57265 5H6.42735C6.50552 4.75446 6.5927 4.52619 6.68742 4.31781C7.12457 3.35608 7.62628 3 8 3ZM5.77705 3.90401C5.62614 4.23601 5.49428 4.6038 5.38411 5H3.99963C4.52341 4.30269 5.22525 3.74677 6.03766 3.39978C5.94287 3.56117 5.85596 3.7304 5.77705 3.90401ZM5.16299 6C5.05694 6.6275 5 7.30146 5 8C5 8.69854 5.05694 9.3725 5.16299 10H3.41604C3.14845 9.38754 3 8.7111 3 8C3 7.2889 3.14845 6.61246 3.41604 6H5.16299ZM5.38411 11C5.49428 11.3962 5.62614 11.764 5.77705 12.096C5.85596 12.2696 5.94287 12.4388 6.03766 12.6002C5.22525 12.2532 4.52341 11.6973 3.99963 11H5.38411ZM6.42735 11H9.57265C9.49448 11.2455 9.4073 11.4738 9.31258 11.6822C8.87543 12.6439 8.37372 13 8 13C7.62628 13 7.12457 12.6439 6.68742 11.6822C6.5927 11.4738 6.50552 11.2455 6.42735 11ZM9.82134 10H6.17866C6.06438 9.3892 6 8.71396 6 8C6 7.28604 6.06438 6.6108 6.17866 6H9.82134C9.93562 6.6108 10 7.28604 10 8C10 8.71396 9.93562 9.3892 9.82134 10ZM10.6159 11H12.0004C11.4766 11.6973 10.7747 12.2532 9.96234 12.6002C10.0571 12.4388 10.144 12.2696 10.2229 12.096C10.3739 11.764 10.5057 11.3962 10.6159 11ZM12.584 10H10.837C10.9431 9.3725 11 8.69854 11 8C11 7.30146 10.9431 6.6275 10.837 6H12.584C12.8516 6.61246 13 7.2889 13 8C13 8.7111 12.8516 9.38754 12.584 10ZM9.96234 3.39978C10.7747 3.74677 11.4766 4.30269 12.0004 5H10.6159C10.5057 4.6038 10.3739 4.23601 10.2229 3.90401C10.144 3.7304 10.0571 3.56117 9.96234 3.39978Z",fill:"currentColor"}))}};C.style=c;exports.globe_icon=C;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-2b8437d6.cjs");require("react");require("react-dom");const i=".sc-globe-icon-h{display:flex}",o=i,C=class{constructor(t){e.registerInstance(this,t),this.width="16",this.height="16"}render(){return e.h("svg",{key:"cda54141a59e6ec136d44bbd369596ef24779ce1",xmlns:"http://www.w3.org/2000/svg",width:this.width,height:this.height,viewBox:"0 0 16 16",fill:"none"},e.h("path",{key:"b70c95480990f3728bf67830554b3abfabffdc8a",d:"M8 14C11.3137 14 14 11.3137 14 8C14 4.68629 11.3137 2 8 2C4.68629 2 2 4.68629 2 8C2 11.3137 4.68629 14 8 14ZM8 3C8.37372 3 8.87543 3.35608 9.31258 4.31781C9.4073 4.52619 9.49448 4.75446 9.57265 5H6.42735C6.50552 4.75446 6.5927 4.52619 6.68742 4.31781C7.12457 3.35608 7.62628 3 8 3ZM5.77705 3.90401C5.62614 4.23601 5.49428 4.6038 5.38411 5H3.99963C4.52341 4.30269 5.22525 3.74677 6.03766 3.39978C5.94287 3.56117 5.85596 3.7304 5.77705 3.90401ZM5.16299 6C5.05694 6.6275 5 7.30146 5 8C5 8.69854 5.05694 9.3725 5.16299 10H3.41604C3.14845 9.38754 3 8.7111 3 8C3 7.2889 3.14845 6.61246 3.41604 6H5.16299ZM5.38411 11C5.49428 11.3962 5.62614 11.764 5.77705 12.096C5.85596 12.2696 5.94287 12.4388 6.03766 12.6002C5.22525 12.2532 4.52341 11.6973 3.99963 11H5.38411ZM6.42735 11H9.57265C9.49448 11.2455 9.4073 11.4738 9.31258 11.6822C8.87543 12.6439 8.37372 13 8 13C7.62628 13 7.12457 12.6439 6.68742 11.6822C6.5927 11.4738 6.50552 11.2455 6.42735 11ZM9.82134 10H6.17866C6.06438 9.3892 6 8.71396 6 8C6 7.28604 6.06438 6.6108 6.17866 6H9.82134C9.93562 6.6108 10 7.28604 10 8C10 8.71396 9.93562 9.3892 9.82134 10ZM10.6159 11H12.0004C11.4766 11.6973 10.7747 12.2532 9.96234 12.6002C10.0571 12.4388 10.144 12.2696 10.2229 12.096C10.3739 11.764 10.5057 11.3962 10.6159 11ZM12.584 10H10.837C10.9431 9.3725 11 8.69854 11 8C11 7.30146 10.9431 6.6275 10.837 6H12.584C12.8516 6.61246 13 7.2889 13 8C13 8.7111 12.8516 9.38754 12.584 10ZM9.96234 3.39978C10.7747 3.74677 11.4766 4.30269 12.0004 5H10.6159C10.5057 4.6038 10.3739 4.23601 10.2229 3.90401C10.144 3.7304 10.0571 3.56117 9.96234 3.39978Z",fill:"currentColor"}))}};C.style=o;exports.globe_icon=C;
@@ -1,12 +1,12 @@
1
- import { r as t, h as C } from "./index-630f4e87.js";
1
+ import { r as e, h as C } from "./index-db0c5017.js";
2
2
  import "react";
3
3
  import "react-dom";
4
4
  const o = ".sc-globe-icon-h{display:flex}", s = o, i = class {
5
- constructor(e) {
6
- t(this, e), this.width = "16", this.height = "16";
5
+ constructor(t) {
6
+ e(this, t), this.width = "16", this.height = "16";
7
7
  }
8
8
  render() {
9
- return C("svg", { key: "40c238dae79b6c837926f797a13f07c9378eeeac", xmlns: "http://www.w3.org/2000/svg", width: this.width, height: this.height, viewBox: "0 0 16 16", fill: "none" }, C("path", { key: "b332e53dace690161725dee143c3682bc9039fa4", d: "M8 14C11.3137 14 14 11.3137 14 8C14 4.68629 11.3137 2 8 2C4.68629 2 2 4.68629 2 8C2 11.3137 4.68629 14 8 14ZM8 3C8.37372 3 8.87543 3.35608 9.31258 4.31781C9.4073 4.52619 9.49448 4.75446 9.57265 5H6.42735C6.50552 4.75446 6.5927 4.52619 6.68742 4.31781C7.12457 3.35608 7.62628 3 8 3ZM5.77705 3.90401C5.62614 4.23601 5.49428 4.6038 5.38411 5H3.99963C4.52341 4.30269 5.22525 3.74677 6.03766 3.39978C5.94287 3.56117 5.85596 3.7304 5.77705 3.90401ZM5.16299 6C5.05694 6.6275 5 7.30146 5 8C5 8.69854 5.05694 9.3725 5.16299 10H3.41604C3.14845 9.38754 3 8.7111 3 8C3 7.2889 3.14845 6.61246 3.41604 6H5.16299ZM5.38411 11C5.49428 11.3962 5.62614 11.764 5.77705 12.096C5.85596 12.2696 5.94287 12.4388 6.03766 12.6002C5.22525 12.2532 4.52341 11.6973 3.99963 11H5.38411ZM6.42735 11H9.57265C9.49448 11.2455 9.4073 11.4738 9.31258 11.6822C8.87543 12.6439 8.37372 13 8 13C7.62628 13 7.12457 12.6439 6.68742 11.6822C6.5927 11.4738 6.50552 11.2455 6.42735 11ZM9.82134 10H6.17866C6.06438 9.3892 6 8.71396 6 8C6 7.28604 6.06438 6.6108 6.17866 6H9.82134C9.93562 6.6108 10 7.28604 10 8C10 8.71396 9.93562 9.3892 9.82134 10ZM10.6159 11H12.0004C11.4766 11.6973 10.7747 12.2532 9.96234 12.6002C10.0571 12.4388 10.144 12.2696 10.2229 12.096C10.3739 11.764 10.5057 11.3962 10.6159 11ZM12.584 10H10.837C10.9431 9.3725 11 8.69854 11 8C11 7.30146 10.9431 6.6275 10.837 6H12.584C12.8516 6.61246 13 7.2889 13 8C13 8.7111 12.8516 9.38754 12.584 10ZM9.96234 3.39978C10.7747 3.74677 11.4766 4.30269 12.0004 5H10.6159C10.5057 4.6038 10.3739 4.23601 10.2229 3.90401C10.144 3.7304 10.0571 3.56117 9.96234 3.39978Z", fill: "currentColor" }));
9
+ return C("svg", { key: "cda54141a59e6ec136d44bbd369596ef24779ce1", xmlns: "http://www.w3.org/2000/svg", width: this.width, height: this.height, viewBox: "0 0 16 16", fill: "none" }, C("path", { key: "b70c95480990f3728bf67830554b3abfabffdc8a", d: "M8 14C11.3137 14 14 11.3137 14 8C14 4.68629 11.3137 2 8 2C4.68629 2 2 4.68629 2 8C2 11.3137 4.68629 14 8 14ZM8 3C8.37372 3 8.87543 3.35608 9.31258 4.31781C9.4073 4.52619 9.49448 4.75446 9.57265 5H6.42735C6.50552 4.75446 6.5927 4.52619 6.68742 4.31781C7.12457 3.35608 7.62628 3 8 3ZM5.77705 3.90401C5.62614 4.23601 5.49428 4.6038 5.38411 5H3.99963C4.52341 4.30269 5.22525 3.74677 6.03766 3.39978C5.94287 3.56117 5.85596 3.7304 5.77705 3.90401ZM5.16299 6C5.05694 6.6275 5 7.30146 5 8C5 8.69854 5.05694 9.3725 5.16299 10H3.41604C3.14845 9.38754 3 8.7111 3 8C3 7.2889 3.14845 6.61246 3.41604 6H5.16299ZM5.38411 11C5.49428 11.3962 5.62614 11.764 5.77705 12.096C5.85596 12.2696 5.94287 12.4388 6.03766 12.6002C5.22525 12.2532 4.52341 11.6973 3.99963 11H5.38411ZM6.42735 11H9.57265C9.49448 11.2455 9.4073 11.4738 9.31258 11.6822C8.87543 12.6439 8.37372 13 8 13C7.62628 13 7.12457 12.6439 6.68742 11.6822C6.5927 11.4738 6.50552 11.2455 6.42735 11ZM9.82134 10H6.17866C6.06438 9.3892 6 8.71396 6 8C6 7.28604 6.06438 6.6108 6.17866 6H9.82134C9.93562 6.6108 10 7.28604 10 8C10 8.71396 9.93562 9.3892 9.82134 10ZM10.6159 11H12.0004C11.4766 11.6973 10.7747 12.2532 9.96234 12.6002C10.0571 12.4388 10.144 12.2696 10.2229 12.096C10.3739 11.764 10.5057 11.3962 10.6159 11ZM12.584 10H10.837C10.9431 9.3725 11 8.69854 11 8C11 7.30146 10.9431 6.6275 10.837 6H12.584C12.8516 6.61246 13 7.2889 13 8C13 8.7111 12.8516 9.38754 12.584 10ZM9.96234 3.39978C10.7747 3.74677 11.4766 4.30269 12.0004 5H10.6159C10.5057 4.6038 10.3739 4.23601 10.2229 3.90401C10.144 3.7304 10.0571 3.56117 9.96234 3.39978Z", fill: "currentColor" }));
10
10
  }
11
11
  };
12
12
  i.style = s;
@@ -0,0 +1,258 @@
1
+ import { r as S, h as t, c as N, H as A } from "./index-db0c5017.js";
2
+ import { R as Z } from "./register-component-dc659dc3-e43e8fae.js";
3
+ import { d as y } from "./utils-c00bdc3c-89ab163d.js";
4
+ import "react";
5
+ import "react-dom";
6
+ import "./_commonjsHelpers-57e89916-af061c86.js";
7
+ const B = ".sc-google-logo-icon-h{display:flex}", j = B, J = class {
8
+ constructor(a) {
9
+ S(this, a), this.width = "24", this.height = "24";
10
+ }
11
+ render() {
12
+ return t("svg", { key: "054a6d1317c29eb0eed05c1f7d69611837b294f5", width: this.width, height: this.height, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, t("g", { key: "7a46687e247930c1200d1cdd0ef6c1463cec96ee", "clip-path": "url(#clip0_959_12452)" }, t("path", { key: "d64a97cc07c2e8094e71a79f03b96a2c495c9a28", d: "M23.745 12.27C23.745 11.48 23.675 10.73 23.555 10H12.255V14.51H18.725C18.435 15.99 17.585 17.24 16.325 18.09V21.09H20.185C22.445 19 23.745 15.92 23.745 12.27Z", fill: "#4285F4" }), t("path", { key: "00f94b17c43c5199a00537873106f5f4eeaaa9a7", d: "M12.255 24C15.495 24 18.205 22.92 20.185 21.09L16.325 18.09C15.245 18.81 13.875 19.25 12.255 19.25C9.12504 19.25 6.47505 17.14 5.52505 14.29H1.54504V17.38C3.51504 21.3 7.56504 24 12.255 24Z", fill: "#34A853" }), t("path", { key: "9391a8453b0adb7908ab1d06888a0cfcf0a32999", d: "M5.52501 14.2901C5.27501 13.5701 5.145 12.8001 5.145 12.0001C5.145 11.2001 5.28501 10.4301 5.52501 9.71012V6.62012H1.545C0.725004 8.24012 0.255005 10.0601 0.255005 12.0001C0.255005 13.9401 0.725004 15.7601 1.545 17.3801L5.52501 14.2901Z", fill: "#FBBC05" }), t("path", { key: "57cc6b8f6edb5b0361468c8bb49d450d1f92727f", d: "M12.255 4.75C14.025 4.75 15.605 5.36 16.855 6.55L20.275 3.13C18.205 1.19 15.495 0 12.255 0C7.56504 0 3.51504 2.7 1.54504 6.62L5.52505 9.71C6.47505 6.86 9.12504 4.75 12.255 4.75Z", fill: "#EA4335" })), t("defs", { key: "ddb9c74f9a608e22e21f39feca20be85612e3e0d" }, t("clipPath", { key: "4828256582d76ee2c0732552630581e5d756c7e5", id: "clip0_959_12452" }, t("rect", { key: "5331dc073a4dbe01fabb56ee0fae553a0100edd9", width: 24, height: 24, fill: "white" }))));
13
+ }
14
+ };
15
+ J.style = j;
16
+ const G = ".sc-microsoft-logo-icon-h{display:flex}", W = G, z = class {
17
+ constructor(a) {
18
+ S(this, a), this.width = "22", this.height = "22";
19
+ }
20
+ render() {
21
+ return t("svg", { key: "9c6a5f616c9e25067b87916d304b0cd32b00f083", width: this.width, height: this.height, viewBox: "0 0 22 22", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, t("path", { key: "bbe87ce62235b96d327cc0dd4dabc78f5273c034", d: "M0.043457 0.043457H10.4782V10.4782H0.043457V0.043457Z", fill: "#F35325" }), t("path", { key: "de6dd97b42e8103d81cad275c722b36e5b5233b5", d: "M11.5217 0.043457H21.9565V10.4782H11.5217V0.043457Z", fill: "#81BC06" }), t("path", { key: "b13b204df603dd53a9f4aba4af8a502a224ff580", d: "M0.043457 11.5217H10.4782V21.9565H0.043457V11.5217Z", fill: "#05A6F0" }), t("path", { key: "372e3c35aae7f712309a0d97c54f5e92741f6eb7", d: "M11.5217 11.5217H21.9565V21.9565H11.5217V11.5217Z", fill: "#FFBA08" }));
22
+ }
23
+ };
24
+ z.style = W;
25
+ function $({ id: a, formState: e, activeTab: n, calendars: i }) {
26
+ var s, o;
27
+ switch (n) {
28
+ case "eventInfo":
29
+ const d = e.title, c = e.description, b = parseInt(e.duration), f = e.location;
30
+ return t(
31
+ "div",
32
+ { key: a },
33
+ t(
34
+ "nylas-event-info",
35
+ null,
36
+ t(
37
+ "div",
38
+ { slot: "inputs" },
39
+ t("nylas-event-title", { name: "title", eventTitle: d, exportparts: "net, net__title, net__dropdown-content" }),
40
+ t("nylas-event-duration", { name: "duration", eventDurationMinutes: b, exportparts: "ned, ned__input, ned__dropdown, ned__dropdown-button, ned__dropdown-content" }),
41
+ t("nylas-location-component", { name: "location", eventLocation: f, exportparts: "nel, nel__location, nel__dropdown, nel__dropdown-button, nel__dropdown-content" }),
42
+ t("nylas-event-description", { name: "description", eventDescription: c, exportparts: "nedesc, nedesc__textarea" })
43
+ )
44
+ )
45
+ );
46
+ case "availability":
47
+ const l = e.availability, u = ((s = l == null ? void 0 : l[0]) == null ? void 0 : s.timezone) ?? Intl.DateTimeFormat().resolvedOptions().timeZone, p = (o = e.participants) == null ? void 0 : o.find((h) => h.is_organizer), r = (p == null ? void 0 : p.email) ?? "primary", m = e.calendarIds.length > 0 ? e.calendarIds : [r], _ = e.bookingCalendar == "primary" ? r : e.bookingCalendar;
48
+ return t(
49
+ "div",
50
+ { key: a },
51
+ t("nylas-booking-calendar-picker", { name: "booking-calendar", calendars: i ?? [], defaultBookingCalendar: _, exportparts: "nbcp, nbcp__header, nbcp__input-label, nbcp__dropdown, nbcp__dropdown-button, nbcp__dropdown-content" }),
52
+ t("nylas-calendar-picker", { name: "calendars", calendars: i ?? [], defaultSelectedCalendars: m, organizerEmail: r, exportparts: "ncp ncp__header, ncp__dropdown, ncp__dropdown-button, ncp__dropdown-content" }),
53
+ t("nylas-availability-picker", { name: "availability", openHours: l, defaultTimezone: u, exportparts: "nap__header, nap__select-timezone, nap__select-timezone-button, nap__select-timezone-dropdown-content, nap__availability, nap__day, nap__time-ranges, nap__time-range, nap__add-time-range, nap__time-picker-container, nap__time-picker-input, nap__time-picker-times" })
54
+ );
55
+ case "bookingOptions":
56
+ return t(
57
+ "div",
58
+ { key: a },
59
+ a == "new" && t("p", null, "Config"),
60
+ t("nylas-buffer-time", { name: "buffer-time", buffer: e.buffer, exportparts: "nbt, nbt__header, nbt__body, nbt__dropdown-before, nbt__dropdown-button-before, nbt__dropdown-content-before, nbt__dropdown-after, nbt__dropdown-button-after, nbt__dropdown-content-after, nbt__preview" }),
61
+ t("nylas-custom-booking-flow", { name: "booking-type", bookingType: e.bookingType, exportparts: "ncbf, ncbf__header, ncbf__dropdown, ncbf__dropdown-button, ncbf__dropdown-content" }),
62
+ t(
63
+ "nylas-event-limits",
64
+ null,
65
+ t(
66
+ "div",
67
+ { slot: "inputs" },
68
+ t("nylas-limit-future-bookings", { name: "limit-future-bookings", availableDaysInFuture: e.availableDaysInFuture, exportparts: "nlfb, nlfb__number-dropdown, nlfb__number-dropdown-button, nlfb__number-dropdown-content, nlfb__period-dropdown, nlfb__period-dropdown-button, nlfb__period-dropdown-content" }),
69
+ t("nylas-min-cancellation-notice", { name: "min-cancellation-notice", minCancellationNotice: e.minCancellationNotice, exportparts: "nmcn, nmcn__number-dropdown, nmcn__number-dropdown-button, nmcn__number-dropdown-content, nmcn__period-dropdown, nmcn__period-dropdown-button, nmcn__period-dropdown-content" })
70
+ )
71
+ )
72
+ );
73
+ }
74
+ }
75
+ const q = '.sc-nylas-editor-tabs-h{display:block;--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif}.scheduler-editor.sc-nylas-editor-tabs{display:flex;flex-direction:column}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs{display:grid;grid-template-columns:minmax(224px, 25%) 1fr}@media screen and (max-width: 768px){.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs{display:table-column-group}}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tabs.sc-nylas-editor-tabs{display:flex;flex-direction:column;border-right:1px solid var(--nylas-base-200);background-color:var(--nylas-base-25)}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tabs.sc-nylas-editor-tabs .tab.sc-nylas-editor-tabs{display:flex;align-items:center;gap:0.5rem;padding:0.5rem 1rem;color:var(--nylas-base-900);background:var(--nylas-base-0);border:none;height:56px;font-family:var(--nylas-font-family);font-size:16px;font-weight:500;line-height:24px;cursor:pointer}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tabs.sc-nylas-editor-tabs .tab.sc-nylas-editor-tabs:not(:first-of-type){margin-top:0.25rem}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tabs.sc-nylas-editor-tabs .tab.active.sc-nylas-editor-tabs{font-weight:600;background:var(--nylas-base-0);color:var(--nylas-primary);border-left:4px solid var(--nylas-primary);box-shadow:0px 1px 2px 0px rgba(0, 0, 0, 0.0588235294);box-shadow:0px 1px 3px 0px rgba(0, 0, 0, 0.1019607843)}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tab-content.sc-nylas-editor-tabs{max-width:692px}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tab-content.sc-nylas-editor-tabs nylas-event-info.sc-nylas-editor-tabs div[slot=inputs].sc-nylas-editor-tabs,.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tab-content.sc-nylas-editor-tabs nylas-event-limits.sc-nylas-editor-tabs div[slot=inputs].sc-nylas-editor-tabs{display:flex;flex-direction:column;gap:1rem}.footer.sc-nylas-editor-tabs{display:flex;justify-content:flex-end;align-items:center;gap:1rem;height:80px;padding:0 1rem;border-top:1px solid var(--nylas-base-200)}.footer.sc-nylas-editor-tabs .unsaved-changes.sc-nylas-editor-tabs{color:var(--nylas-base-600)}.footer.sc-nylas-editor-tabs .saved-changes.sc-nylas-editor-tabs{color:var(--nylas-success)}.footer.sc-nylas-editor-tabs button.sc-nylas-editor-tabs{background:var(--nylas-primary);color:var(--nylas-base-0);height:48px;border:none;border-radius:var(--nylas-border-radius-2x);font-size:1rem;line-height:24px;padding:0 1rem;cursor:pointer;width:148px}.footer.sc-nylas-editor-tabs button.sc-nylas-editor-tabs:hover{background:var(--nylas-base-600)}.footer.sc-nylas-editor-tabs button.sc-nylas-editor-tabs:active{background:var(--nylas-base-800)}.footer.sc-nylas-editor-tabs button.sc-nylas-editor-tabs:disabled{background:var(--nylas-base-300);cursor:not-allowed}.footer.sc-nylas-editor-tabs button.sc-nylas-editor-tabs span.sc-nylas-editor-tabs{display:flex;align-items:center;justify-content:center;gap:0.5rem}', K = q;
76
+ var Q = function(a, e, n, i) {
77
+ var s = arguments.length, o = s < 3 ? e : i === null ? i = Object.getOwnPropertyDescriptor(e, n) : i, d;
78
+ if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
79
+ o = Reflect.decorate(a, e, n, i);
80
+ else
81
+ for (var c = a.length - 1; c >= 0; c--)
82
+ (d = a[c]) && (o = (s < 3 ? d(o) : s > 3 ? d(e, n, o) : d(e, n)) || o);
83
+ return s > 3 && o && Object.defineProperty(e, n, o), o;
84
+ }, x = function(a, e) {
85
+ if (typeof Reflect == "object" && typeof Reflect.metadata == "function")
86
+ return Reflect.metadata(a, e);
87
+ };
88
+ const E = class {
89
+ constructor(a) {
90
+ S(this, a), this.schedulerConfigChanged = N(this, "schedulerConfigChanged", 7), this.formSubmissionHandler = async (e) => {
91
+ var h, g, v, k, w, C, T, I, F, H, L, D, V, M, O, U;
92
+ e.preventDefault(), this.isLoading = !0, this.hasUnsavedChanges = !1, this.updateFormState();
93
+ const { title: n, description: i, duration: s, availability: o, calendarIds: d, bookingCalendar: c, location: b, bookingType: f, buffer: l, availableDaysInFuture: u, minCancellationNotice: p } = this.formState, r = (g = (h = this.config) == null ? void 0 : h.participants) == null ? void 0 : g.find((R) => R.is_organizer), m = {
94
+ ...((v = this.config) == null ? void 0 : v.id) && { id: this.config.id },
95
+ version: ((k = this.config) == null ? void 0 : k.version) ?? "1.0.0",
96
+ availability: {
97
+ duration_minutes: s ? parseInt(s) : 0,
98
+ availability_rules: {
99
+ availability_method: ((T = (C = (w = this.config) == null ? void 0 : w.availability) == null ? void 0 : C.availability_rules) == null ? void 0 : T.availability_method) ?? "collective",
100
+ buffer: l || { before: 0, after: 0 },
101
+ default_open_hours: ((H = (F = (I = this.config) == null ? void 0 : I.availability) == null ? void 0 : F.availability_rules) == null ? void 0 : H.default_open_hours) ?? [],
102
+ round_robin_group_id: ((V = (D = (L = this.config) == null ? void 0 : L.availability) == null ? void 0 : D.availability_rules) == null ? void 0 : V.round_robin_group_id) ?? ""
103
+ }
104
+ },
105
+ participants: [
106
+ {
107
+ name: (r == null ? void 0 : r.name) ?? (r == null ? void 0 : r.email) ?? ((M = this.currentUser) == null ? void 0 : M.name) ?? ((O = this.currentUser) == null ? void 0 : O.email) ?? "",
108
+ email: (r == null ? void 0 : r.email) ?? ((U = this.currentUser) == null ? void 0 : U.email) ?? "",
109
+ is_organizer: !0,
110
+ availability: {
111
+ calendar_ids: d != null && d.length ? d : ["primary"],
112
+ open_hours: o ?? []
113
+ },
114
+ booking: {
115
+ calendar_id: c && c !== "" ? c : "primary"
116
+ }
117
+ }
118
+ ],
119
+ event_booking: {
120
+ title: (n == null ? void 0 : n.toString()) ?? "",
121
+ description: (i == null ? void 0 : i.toString()) ?? "",
122
+ location: (b == null ? void 0 : b.toString()) ?? "",
123
+ booking_type: (f == null ? void 0 : f.toString()) ?? "booking"
124
+ },
125
+ scheduler: {
126
+ available_days_in_future: u ?? 30,
127
+ min_cancellation_notice: p ?? 0
128
+ }
129
+ }, _ = (R) => {
130
+ this.isLoading = !1, this.changesSaved = !0, setTimeout(() => {
131
+ this.changesSaved = !1;
132
+ }, 5e3);
133
+ };
134
+ this.schedulerConfigChanged.emit({ config: m, resetLoadingState: _, action: this.action });
135
+ }, this.calendars = void 0, this.config = void 0, this.currentUser = void 0, this.action = "create", this.activeTab = "eventInfo", this.isLoading = !1, this.hasUnsavedChanges = !1, this.changesSaved = !1, this.formState = {};
136
+ }
137
+ configChangedHandler(a) {
138
+ y("[nylas-editor-tabs]", "configChangedHandler", a, this.config), this.formState = {
139
+ ...this.getFormStateFromConfig(a)
140
+ }, a.id ? this.action = "update" : this.action = "create";
141
+ }
142
+ connectedCallback() {
143
+ y("[nylas-editor-tabs]", "connectedCallback");
144
+ }
145
+ componentWillLoad() {
146
+ y("[nylas-editor-tabs]", "componentWillLoad"), this.formState = this.getFormStateFromConfig(this.config);
147
+ }
148
+ componentDidLoad() {
149
+ y("[nylas-editor-tabs]", "componentDidLoad");
150
+ }
151
+ disconnectedCallback() {
152
+ y("[nylas-editor-tabs]", "disconnectedCallback");
153
+ }
154
+ handleValueChanged(a) {
155
+ y("[nylas-editor-tabs]", "handleValueChanged", a), this.formState = { ...this.formState, [a.detail.name]: a.detail.value }, this.hasUnsavedChanges = !0;
156
+ }
157
+ getFormStateFromConfig(a) {
158
+ var n, i, s, o, d, c, b, f, l, u, p, r, m, _, h, g, v, k, w;
159
+ const e = (n = a == null ? void 0 : a.participants) == null ? void 0 : n.find((C) => C.is_organizer);
160
+ return {
161
+ title: ((i = a == null ? void 0 : a.event_booking) == null ? void 0 : i.title) ?? "",
162
+ description: ((s = a == null ? void 0 : a.event_booking) == null ? void 0 : s.description) ?? "",
163
+ duration: ((d = (o = a == null ? void 0 : a.availability) == null ? void 0 : o.duration_minutes) == null ? void 0 : d.toString()) ?? "10",
164
+ availability: ((c = e == null ? void 0 : e.availability) == null ? void 0 : c.open_hours) ?? void 0,
165
+ calendarIds: ((b = e == null ? void 0 : e.availability) == null ? void 0 : b.calendar_ids) ?? [],
166
+ participants: (a == null ? void 0 : a.participants) ?? [],
167
+ bookingCalendar: ((f = e == null ? void 0 : e.booking) == null ? void 0 : f.calendar_id) ?? (e == null ? void 0 : e.email) ?? "",
168
+ location: ((u = (l = this.config) == null ? void 0 : l.event_booking) == null ? void 0 : u.location) ?? "",
169
+ bookingType: ((r = (p = this.config) == null ? void 0 : p.event_booking) == null ? void 0 : r.booking_type) ?? "booking",
170
+ buffer: ((h = (_ = (m = this.config) == null ? void 0 : m.availability) == null ? void 0 : _.availability_rules) == null ? void 0 : h.buffer) ?? { before: 0, after: 0 },
171
+ availableDaysInFuture: ((v = (g = this.config) == null ? void 0 : g.scheduler) == null ? void 0 : v.available_days_in_future) ?? 30,
172
+ minCancellationNotice: ((w = (k = this.config) == null ? void 0 : k.scheduler) == null ? void 0 : w.min_cancellation_notice) ?? 0
173
+ };
174
+ }
175
+ updateFormState() {
176
+ new FormData(this.formRef).forEach((e, n) => {
177
+ switch (n) {
178
+ case "title":
179
+ this.formState.title = e.toString();
180
+ break;
181
+ case "description":
182
+ this.formState.description = e.toString();
183
+ break;
184
+ case "duration":
185
+ this.formState.duration = e.toString();
186
+ break;
187
+ case "availability":
188
+ this.formState.availability = JSON.parse(e.toString());
189
+ break;
190
+ case "participants":
191
+ this.formState.participants = JSON.parse(e.toString());
192
+ break;
193
+ case "calendars":
194
+ this.formState.calendarIds = e.toString().split(",");
195
+ break;
196
+ case "booking-calendar":
197
+ this.formState.bookingCalendar = e.toString();
198
+ break;
199
+ case "location":
200
+ this.formState.location = e.toString();
201
+ break;
202
+ case "booking-type":
203
+ this.formState.bookingType = e.toString();
204
+ break;
205
+ case "buffer-time":
206
+ this.formState.buffer = JSON.parse(e.toString());
207
+ break;
208
+ case "limit-future-bookings":
209
+ this.formState.availableDaysInFuture = parseInt(e.toString());
210
+ break;
211
+ case "min-cancellation-notice":
212
+ this.formState.minCancellationNotice = parseInt(e.toString());
213
+ break;
214
+ }
215
+ }), this.formState = { ...this.formState };
216
+ }
217
+ setActiveTab(a, e) {
218
+ a.preventDefault(), this.updateFormState(), this.activeTab = e;
219
+ }
220
+ render() {
221
+ var a;
222
+ return y("[nylas-editor-tabs]", "render", this.formState), t(A, { key: "920332a1206e84229cd4875b598b388d196edc77" }, t("form", { key: "cc33124020c4ec87dff2eb395d8a4151dd2a63a8", onSubmit: this.formSubmissionHandler, class: "scheduler-editor", ref: (e) => this.formRef = e }, t("div", { key: "e9a0e2d35d59ab3c95e0b17db057aa97de1c48d3", class: "form-contents" }, t("div", { key: "c2b30e822e4b5a0d938b9d7fb5849e90503d5fee", class: "tabs" }, t("button", { key: "1958ff2af28cf21a3c8b6a1029dfd0fdfd58bbf7", class: { tab: !0, active: this.activeTab == "eventInfo" }, onClick: (e) => this.setActiveTab(e, "eventInfo") }, t("calendar-info-icon", { key: "c62f9b3cad22d4c67791c78dcac202d47617eda0", width: "16", height: "16" }), "Event Info"), t("button", { key: "7858b3fe59f02eefba9cebc561e5e89b220a6018", class: { tab: !0, active: this.activeTab == "availability" }, onClick: (e) => this.setActiveTab(e, "availability") }, t("calendar-patterns-icon", { key: "b8d6ed526a37bd31ce150c4202e41a9599c553af", width: "16", height: "16" }), "Availability"), t("button", { key: "224c119608059affb6245f72b6337fe66aafe9fb", class: { tab: !0, active: this.activeTab == "bookingOptions" }, onClick: (e) => this.setActiveTab(e, "bookingOptions") }, t("flow-icon", { key: "149824372964f592dd1d754a7db6eef9367ffafc", width: "16", height: "16" }), "Booking Options")), t("div", { key: "0feb5d9500b8028542438e9d091b66bc87bc9673", class: "tab-content" }, t($, { key: "86de2a2ab92dd6c1081c7a4db4f3ceb62ee579fe", formState: this.formState, activeTab: this.activeTab, calendars: this.calendars, id: ((a = this.config) == null ? void 0 : a.id) ?? "new" }))), t("div", { key: "8a63b2e9761aea3dea1e967784db8e2de5b65eda", class: "footer" }, t("p", { key: "da0e2f2f19bc7a8b2910706f57ea437b291fc2b1", class: {
223
+ "unsaved-changes": this.hasUnsavedChanges && !this.changesSaved,
224
+ "saved-changes": this.changesSaved
225
+ } }, this.hasUnsavedChanges && !this.changesSaved ? "Unsaved changes" : this.changesSaved ? "Changes saved!" : ""), t("button-component", { key: "6d41a5158d8ff68528056fcc65c1b668e3fcd6e6", type: "submit", disabled: this.isLoading }, this.isLoading ? t("span", null, "Saving", t("loading-icon", null), " ") : this.action == "create" ? "Create" : "Save changes"))));
226
+ }
227
+ static get watchers() {
228
+ return {
229
+ config: ["configChangedHandler"]
230
+ };
231
+ }
232
+ };
233
+ Q([
234
+ Z({
235
+ name: "nylas-editor-tabs",
236
+ stateToProps: /* @__PURE__ */ new Map([
237
+ ["schedulerConfig.calendars", "calendars"],
238
+ ["schedulerConfig.config", "config"],
239
+ ["schedulerConfig.currentUser", "currentUser"]
240
+ ]),
241
+ eventToProps: {
242
+ schedulerConfigChanged: async (a, e) => {
243
+ const { resetLoadingState: n, action: i, config: s } = a.detail;
244
+ n && n(a), i === "update" ? await e.schedulerConfig.updateConfiguration(s) : await e.schedulerConfig.createConfiguration(s);
245
+ }
246
+ },
247
+ fireRegisterEvent: !0
248
+ }),
249
+ x("design:type", Function),
250
+ x("design:paramtypes", []),
251
+ x("design:returntype", void 0)
252
+ ], E.prototype, "render", null);
253
+ E.style = K;
254
+ export {
255
+ J as google_logo_icon,
256
+ z as microsoft_logo_icon,
257
+ E as nylas_editor_tabs
258
+ };