@nylas/react 1.1.0-canary.22 → 1.1.0-canary.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{add-circle-icon_2.entry-404b178a.js → add-circle-icon_3.entry-37a88ff3.js} +21 -11
- package/dist/add-circle-icon_3.entry-4f8f1cbf.cjs +1 -0
- package/dist/{archive-icon_7.entry-1c2e5b68.cjs → archive-icon_7.entry-2ec9b077.cjs} +1 -1
- package/dist/{archive-icon_7.entry-d14abebc.js → archive-icon_7.entry-3dcc4a66.js} +1 -1
- package/dist/{arrow-icon.entry-61290104.cjs → arrow-icon.entry-175e8181.cjs} +1 -1
- package/dist/{arrow-icon.entry-8dd5bfb5.js → arrow-icon.entry-2cf3e94d.js} +1 -1
- package/dist/{bold-icon_3.entry-cc7319da.js → bold-icon_3.entry-9fc74a39.js} +1 -1
- package/dist/{bold-icon_3.entry-c5502b92.cjs → bold-icon_3.entry-a3e61ad8.cjs} +1 -1
- package/dist/{button-component.entry-92c46833.cjs → button-component.entry-7fdb3bca.cjs} +1 -1
- package/dist/{button-component.entry-71de5b6b.js → button-component.entry-861637f2.js} +1 -1
- package/dist/calendar-agenda-fill-icon_39.entry-3c21a3ec.cjs +7 -0
- package/dist/{calendar-agenda-fill-icon_40.entry-b33080d8.js → calendar-agenda-fill-icon_39.entry-493e91f6.js} +1274 -1306
- package/dist/{calendar-cancel-icon.entry-fcc89777.js → calendar-cancel-icon.entry-3ca731f9.js} +1 -1
- package/dist/{calendar-cancel-icon.entry-bbf56125.cjs → calendar-cancel-icon.entry-c9c7e3b3.cjs} +1 -1
- package/dist/{calendar-check-icon_2.entry-64d553de.cjs → calendar-check-icon_2.entry-5b8f8a75.cjs} +1 -1
- package/dist/{calendar-check-icon_2.entry-e7691b84.js → calendar-check-icon_2.entry-7c409a91.js} +1 -1
- package/dist/{calendar-icon.entry-6375e3ed.js → calendar-icon.entry-0589697f.js} +1 -1
- package/dist/{calendar-icon.entry-9cea89bc.cjs → calendar-icon.entry-acd00f6f.cjs} +1 -1
- package/dist/{checkbox-component_2.entry-9a89cf14.cjs → checkbox-component_2.entry-0aa252b9.cjs} +1 -1
- package/dist/{checkbox-component_2.entry-751f4638.js → checkbox-component_2.entry-538fd8ec.js} +1 -1
- package/dist/{checkmark-icon.entry-6bca8604.cjs → checkmark-icon.entry-0a184b31.cjs} +1 -1
- package/dist/{checkmark-icon.entry-136b682c.js → checkmark-icon.entry-56302db0.js} +1 -1
- package/dist/{chevron-icon_3.entry-97c91007.cjs → chevron-icon_3.entry-7076e105.cjs} +1 -1
- package/dist/{chevron-icon_3.entry-b4995425.js → chevron-icon_3.entry-80e03257.js} +1 -1
- package/dist/{clock-icon_4.entry-cd6ac47d.cjs → clock-icon_4.entry-d6901afd.cjs} +1 -1
- package/dist/{clock-icon_4.entry-d2e007e5.js → clock-icon_4.entry-db3fbda1.js} +1 -1
- package/dist/{constants-67de2eec-8286f29c.cjs → constants-12bd3c98-22fd56f2.cjs} +1 -1
- package/dist/{constants-67de2eec-31cbc722.js → constants-12bd3c98-26c75011.js} +4 -4
- package/dist/{copy-icon_3.entry-f614fc20.cjs → copy-icon_3.entry-33e89a37.cjs} +1 -1
- package/dist/{copy-icon_3.entry-e41eb1a0.js → copy-icon_3.entry-9670b9f9.js} +1 -1
- package/dist/{document-refresh-icon.entry-817322ba.js → document-refresh-icon.entry-149f2a3b.js} +1 -1
- package/dist/{document-refresh-icon.entry-12833775.cjs → document-refresh-icon.entry-a3326831.cjs} +1 -1
- package/dist/elements/index.d.ts +3 -0
- package/dist/{elements-dc5b338e-3a8522b8.cjs → elements-dc5b338e-211879a3.cjs} +1 -1
- package/dist/{elements-dc5b338e-d885666f.js → elements-dc5b338e-e07600d4.js} +1 -1
- package/dist/{focus-visible-e8093c16-78717e30.js → focus-visible-e8093c16-284cefe0.js} +1 -1
- package/dist/{focus-visible-e8093c16-17bb48f2.cjs → focus-visible-e8093c16-cb97634f.cjs} +1 -1
- package/dist/{forward-icon_6.entry-39b55b30.js → forward-icon_6.entry-554b0722.js} +2 -2
- package/dist/{forward-icon_6.entry-074fd345.cjs → forward-icon_6.entry-751fdd4e.cjs} +1 -1
- package/dist/{globe-icon.entry-dee4c2b0.cjs → globe-icon.entry-63eb510d.cjs} +1 -1
- package/dist/{globe-icon.entry-a1875d7e.js → globe-icon.entry-e3dd58bc.js} +1 -1
- package/dist/google-logo-icon_5.entry-bccce7f4.cjs +1 -0
- package/dist/google-logo-icon_5.entry-e462e091.js +748 -0
- package/dist/index-53420959-02fe58ef.js +5 -0
- package/dist/index-53420959-0b9c205e.cjs +1 -0
- package/dist/{index-6d9eeb53-b71b16c5.cjs → index-6d9eeb53-81e5b798.cjs} +1 -1
- package/dist/{index-6d9eeb53-f37ff819.js → index-6d9eeb53-cc42c6f1.js} +2 -2
- package/dist/{index-26f8bbeb.cjs → index-8a536089.cjs} +14 -14
- package/dist/{index-5da0aff3.js → index-a15916e5.js} +398 -383
- package/dist/{index.es-b16d0cf5-4ce1fb63.cjs → index.es-5355a265-e701a627.cjs} +1 -1
- package/dist/{index.es-b16d0cf5-b1cecbdd.js → index.es-5355a265-f8853ce4.js} +1 -1
- package/dist/{info-icon_2.entry-6fd10047.js → info-icon_2.entry-3b349f01.js} +1 -1
- package/dist/{info-icon_2.entry-67a3e2c3.cjs → info-icon_2.entry-9559cf3b.cjs} +1 -1
- package/dist/{input-dropdown.entry-e677224a.js → input-dropdown.entry-9bc68630.js} +1 -1
- package/dist/{input-dropdown.entry-701ab8b7.cjs → input-dropdown.entry-d454f6bc.cjs} +1 -1
- package/dist/{loading-icon.entry-3f54b204.js → loading-icon.entry-1d49e471.js} +1 -1
- package/dist/{loading-icon.entry-558c2382.cjs → loading-icon.entry-a68da48b.cjs} +1 -1
- package/dist/{mailbox-store-f11de360-79ba75b1.js → mailbox-store-31d55036-1106efe2.js} +2 -2
- package/dist/{mailbox-store-f11de360-8f269e26.cjs → mailbox-store-31d55036-c8618c0b.cjs} +1 -1
- package/dist/{multi-select-dropdown.entry-e46f5cfb.js → multi-select-dropdown.entry-36074a81.js} +1 -1
- package/dist/{multi-select-dropdown.entry-d053b2fb.cjs → multi-select-dropdown.entry-e5ed9285.cjs} +1 -1
- package/dist/{nylas-booked-event-card_10.entry-545261f6.js → nylas-booked-event-card_10.entry-38d2fd2e.js} +10 -9
- package/dist/nylas-booked-event-card_10.entry-e530a8db.cjs +1 -0
- package/dist/nylas-booking-confirmation-type.entry-2fea82f9.js +106 -0
- package/dist/nylas-booking-confirmation-type.entry-5857a863.cjs +1 -0
- package/dist/{nylas-form-card.entry-a063402d.cjs → nylas-form-card.entry-03a31218.cjs} +1 -1
- package/dist/{nylas-form-card.entry-7d69820f.js → nylas-form-card.entry-6e45c873.js} +12 -12
- package/dist/{nylas-if-state.entry-9e7df799.js → nylas-if-state.entry-092f4e1a.js} +2 -2
- package/dist/{nylas-if-state.entry-54a6948f.cjs → nylas-if-state.entry-61d7ebc5.cjs} +1 -1
- package/dist/{nylas-list-folders.entry-d08423d4.cjs → nylas-list-folders.entry-1abbb401.cjs} +1 -1
- package/dist/{nylas-list-folders.entry-013ffceb.js → nylas-list-folders.entry-ab9e1c2c.js} +2 -2
- package/dist/{nylas-list-threads.entry-d3f575a5.js → nylas-list-threads.entry-2faaa2bb.js} +2 -2
- package/dist/{nylas-list-threads.entry-be9bc422.cjs → nylas-list-threads.entry-dfc87aca.cjs} +1 -1
- package/dist/{nylas-login.entry-d82e8ee0.js → nylas-login.entry-243ae09e.js} +2 -2
- package/dist/{nylas-login.entry-e7015d8f.cjs → nylas-login.entry-d1cac0a1.cjs} +1 -1
- package/dist/{nylas-mailbox-pagination.entry-99339476.js → nylas-mailbox-pagination.entry-b8225a3e.js} +2 -2
- package/dist/{nylas-mailbox-pagination.entry-22866764.cjs → nylas-mailbox-pagination.entry-c27af71c.cjs} +1 -1
- package/dist/{nylas-mailbox-toolbar-button.entry-b8929b00.js → nylas-mailbox-toolbar-button.entry-22347d22.js} +2 -2
- package/dist/{nylas-mailbox-toolbar-button.entry-09faed21.cjs → nylas-mailbox-toolbar-button.entry-b66d597d.cjs} +1 -1
- package/dist/{nylas-mailbox.entry-6e8d4f9c.js → nylas-mailbox.entry-9e6e1b4d.js} +3 -3
- package/dist/{nylas-mailbox.entry-91ca6af1.cjs → nylas-mailbox.entry-cb80f58c.cjs} +1 -1
- package/dist/{nylas-provider.entry-cc32369c.js → nylas-provider.entry-196dd5da.js} +5 -5
- package/dist/{nylas-provider.entry-b80d5e74.cjs → nylas-provider.entry-28c12448.cjs} +1 -1
- package/dist/nylas-reminder-emails.entry-47ef5a9d.cjs +4 -0
- package/dist/nylas-reminder-emails.entry-b655d888.js +129 -0
- package/dist/nylas-reminder-time_2.entry-0f3747fb.cjs +1 -0
- package/dist/nylas-reminder-time_2.entry-9d8f7436.js +105 -0
- package/dist/{nylas-scheduler-editor.entry-c7f7bf6c.cjs → nylas-scheduler-editor.entry-504e8ed3.cjs} +2 -2
- package/dist/{nylas-scheduler-editor.entry-5e0475d8.js → nylas-scheduler-editor.entry-feb7a7db.js} +11 -10
- package/dist/nylas-scheduling.entry-8c8f8e35.cjs +1 -0
- package/dist/{nylas-scheduling.entry-c79596db.js → nylas-scheduling.entry-d35efa9a.js} +71 -67
- package/dist/{nylas-threads-refresh.entry-e200efb9.js → nylas-threads-refresh.entry-91af9af3.js} +2 -2
- package/dist/{nylas-threads-refresh.entry-ef2ad409.cjs → nylas-threads-refresh.entry-e637161b.cjs} +1 -1
- package/dist/{nylas-threads-search.entry-85a0bc7d.js → nylas-threads-search.entry-5457dcec.js} +2 -2
- package/dist/{nylas-threads-search.entry-a260ce6f.cjs → nylas-threads-search.entry-b944f95a.cjs} +1 -1
- package/dist/{nylas-time-window-picker.entry-cb33b696.cjs → nylas-time-window-picker.entry-134ef726.cjs} +1 -1
- package/dist/{nylas-time-window-picker.entry-c9b2a7ca.js → nylas-time-window-picker.entry-a6fd216b.js} +12 -12
- package/dist/{nylas-view-thread.entry-f302c441.js → nylas-view-thread.entry-6fdd6cb1.js} +2 -2
- package/dist/{nylas-view-thread.entry-219511ac.cjs → nylas-view-thread.entry-9296a505.cjs} +1 -1
- package/dist/{person-icon.entry-6b20ac42.cjs → person-icon.entry-1cdb4dc2.cjs} +1 -1
- package/dist/{person-icon.entry-8f8b928f.js → person-icon.entry-4a695727.js} +1 -1
- package/dist/{play-icon_2.entry-c8114634.cjs → play-icon_2.entry-10fd617e.cjs} +1 -1
- package/dist/{play-icon_2.entry-3aa92414.js → play-icon_2.entry-fb013b17.js} +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.js +104 -101
- package/dist/{refresh-icon.entry-0d80c9c5.js → refresh-icon.entry-46c92605.js} +1 -1
- package/dist/{refresh-icon.entry-de5001c7.cjs → refresh-icon.entry-9dbb04ba.cjs} +1 -1
- package/dist/{register-component-b2a51b20-09664950.cjs → register-component-592986c5-5edf5835.cjs} +1 -1
- package/dist/{register-component-b2a51b20-ea46761a.js → register-component-592986c5-d5d210a8.js} +1 -1
- package/dist/{scheduler-config-store-9ccfba4d-a677e77b.cjs → scheduler-config-store-9ccfba4d-3ec35859.cjs} +1 -1
- package/dist/{scheduler-config-store-9ccfba4d-92cb99d1.js → scheduler-config-store-9ccfba4d-b08031b5.js} +1 -1
- package/dist/{scheduler-store-db06b30a-cee61c58.js → scheduler-store-fd0d11a5-313e8592.js} +1 -1
- package/dist/{scheduler-store-db06b30a-08429fc9.cjs → scheduler-store-fd0d11a5-b180b3b7.cjs} +1 -1
- package/dist/{textarea-component.entry-c2d1900c.js → textarea-component.entry-0cd3b57f.js} +3 -3
- package/dist/{textarea-component.entry-670f72a7.cjs → textarea-component.entry-788eb37a.cjs} +1 -1
- package/dist/{time-period-selector.entry-a03b1ce1.js → time-period-selector.entry-112c0b64.js} +1 -1
- package/dist/{time-period-selector.entry-3ccfc000.cjs → time-period-selector.entry-1e0b720b.cjs} +1 -1
- package/dist/{translate-icon.entry-8a2878ba.js → translate-icon.entry-a4df3c16.js} +1 -1
- package/dist/{translate-icon.entry-b483f6b3.cjs → translate-icon.entry-c701b391.cjs} +1 -1
- package/dist/{warning-icon.entry-784f7818.cjs → warning-icon.entry-bda0aafa.cjs} +1 -1
- package/dist/{warning-icon.entry-68b3f25e.js → warning-icon.entry-d1703715.js} +1 -1
- package/package.json +2 -2
- package/dist/add-circle-icon_2.entry-d44a0d4b.cjs +0 -1
- package/dist/calendar-agenda-fill-icon_40.entry-242956c2.cjs +0 -10
- package/dist/close-icon.entry-d1348fa8.cjs +0 -1
- package/dist/close-icon.entry-d4d4da48.js +0 -15
- package/dist/google-logo-icon_4.entry-3c3101ea.js +0 -637
- package/dist/google-logo-icon_4.entry-44c3f539.cjs +0 -1
- package/dist/index-53420959-a444c1cf.cjs +0 -1
- package/dist/index-53420959-b26d1293.js +0 -5
- package/dist/nylas-booked-event-card_10.entry-32911b16.cjs +0 -1
- package/dist/nylas-custom-booking-flow.entry-49b82a11.cjs +0 -1
- package/dist/nylas-custom-booking-flow.entry-6639c5fb.js +0 -106
- package/dist/nylas-scheduling.entry-047cd53a.cjs +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-26f8bbeb.cjs"),bn=require("./register-component-b2a51b20-09664950.cjs");require("react");require("react-dom");const yn=".sc-forward-icon-h{display:flex}",En=yn,St=class{constructor(t){o.registerInstance(this,t),this.width="15",this.height="15"}render(){return o.h("svg",{key:"bb4e930bb772ffc0c72dba3703943c7a4f1d1dc6",fill:"auto",width:this.width,height:this.height,viewBox:"0 0 1920 1920",xmlns:"http://www.w3.org/2000/svg"},o.h("path",{key:"6e77f8f18532c1f5bd6df8be0b6c736b3a15ddcc",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"}))}};St.style=En;const Tn=':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}',An=Tn,Ct=class{constructor(t){o.registerInstance(this,t),this.close=o.createEvent(this,"close",7),this.send=o.createEvent(this,"send",7),this.closeComposer=i=>{this.close.emit(i)},this.sendComposer=i=>{var l;if(!this.editorEl){o.debug("no editor element");return}const f=this.editorEl.querySelector(".message-body");if(!f){o.debug("no message body");return}this.message&&(this.send.emit({message:this.message,replyBody:((l=f.querySelector(".message-body"))==null?void 0:l.innerHTML)||""}),this.close.emit(i),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){o.debug("[connectedCallback] no editor element");return}if(!this.toolbarEl){o.debug("[connectedCallback] no toolbar element");return}const t=this.editorEl,i=this.toolbarEl;t.addEventListener("mouseup",f=>{var B;const l=(B=this.host.shadowRoot)==null?void 0:B.getSelection();if(!l){o.debug("no selection");return}const p=l.getRangeAt(0),a=l.toString();if(!a){i.style.display="none";return}const m=t.querySelector(".message-body");if(!m){o.debug("no message body");return}const c=p.commonAncestorContainer.parentElement;if(!c)return;const E=m.getBoundingClientRect();o.debug("messageBodyRect",{messageBodyRect:E});const A=c.getBoundingClientRect();o.debug("foundRect",{foundRect:A});const le=(c.childNodes[0].textContent||"").indexOf(a),W=window.getComputedStyle(c).fontSize,j=parseInt(W.replace("px",""),10),te=A.top-E.top-i.clientHeight,be=le*(1/j)*100;i.style.top=`${te}px`,i.style.left=`${be}px`,i.style.display="block"})}watchBody(t){var a;if(!this.editorEl){o.debug("no editor element");return}this.editorEl.querySelectorAll(".message-body").forEach(m=>m.remove());const i=document.createElement("div");i.classList.add("message-body");const f=document.createElement("p");f.innerHTML=" ",i.appendChild(f);const l=document.createElement("br");i.appendChild(l);const p=document.createElement("div");if(p.classList.add("reply-text"),p.innerText=`On ${new Date(t.date*1e3).toLocaleDateString(void 0,{dateStyle:"full"})} <${(a=t.from)==null?void 0:a.map(m=>m.name||m.email).join(", ")}> wrote:`,i.appendChild(p),t.body){const m=document.createElement("html");m.innerHTML=t.body;const r=document.createElement("blockquote");r.classList.add("collapsed"),r.classList.add("gmail_quote"),r.innerHTML=m.innerHTML,i.appendChild(r),o.debug("replyContainer",{replyContainer:r})}this.editorEl.appendChild(i),this.editorEl.querySelectorAll("blockquote.collapsed").forEach(m=>{m.addEventListener("click",function(r){r.preventDefault();const c=r.target;c.classList.remove("collapsed"),c.classList.add("expanded")},{once:!0})}),this.editorEl.focus()}render(){return o.h(o.Host,{key:"46125beb4200ff389b5d4cd6ff76fe3228b3fa86"},o.h("sp-theme",{key:"2e7d9dd1e2a3817d0609b283cc8572a955230370",scale:"medium",color:"dark"},o.h("div",{key:"6a5954e74d72a031aacd29b424c68e51badce046",class:"editor",contentEditable:!0,ref:t=>this.editorEl=t},o.h("div",{key:"61152b4be1fe8505dfbc32943c2eb3406a93ca2a",class:"toolbar",ref:t=>this.toolbarEl=t,contentEditable:!1},o.h("sp-button",{key:"c896e9d32720e59cb3b7301dd9c05c73a9579fc4",quiet:!0,onClick:()=>document.execCommand("bold")},o.h("div",{key:"6c48e73ddf5c95796d68a661e0a80039827ca73c",slot:"icon"},o.h("bold-icon",{key:"955e0873449ad2affbb755e1c92310b87972925a"})),o.h("div",{key:"eb68ad20983fd72bd139ccd20383d4a8ca1f750c",slot:"label"},"Bold")),o.h("sp-button",{key:"dbb2b362cedaaf5706eda1957c853acd45b71526",quiet:!0,onClick:()=>document.execCommand("underline")},o.h("div",{key:"e699c015e2bc926e259e8666dc23be79673df140",slot:"icon"},o.h("underline-icon",{key:"bb4a86a3f9758950271394718408e83f1441a5f6"})),o.h("div",{key:"13ad8d10033b585eefa562776dcd57dd4816eb56",slot:"label"},"Underline")),o.h("sp-button",{key:"9c6b5ca3ddbca9b13cf5fdc88be9d6bb12340cab",quiet:!0,onClick:()=>document.execCommand("italic")},o.h("div",{key:"a1e776afeeb8421fb94ba203544abcafce5c43c0",slot:"icon"},o.h("italic-icon",{key:"a04ae4fcdd5c006bb5575c6c8bf33ee8f8abad78"})),o.h("div",{key:"31e02506a6def45c5444d2a70a394e65c952e3d0",slot:"label"},"Italic")))),o.h("div",{key:"57243170b74f7dfb732817acca22c53782cc0e7c",class:"buttons"},o.h("sp-button",{key:"e096fef6544f3c09cec94bd4e37519acc9a980c0",onClick:this.sendComposer,class:"send"},"Send"),o.h("sp-button",{key:"b81de8ac43034d2fdaa77ddd6462f32b775dff7d",onClick:this.closeComposer,class:"close"},"Close"))))}get host(){return o.getElement(this)}static get watchers(){return{message:["watchBody"]}}};Ct.style=An;const _n=":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)}}",wn=_n;var vn=function(t,i,f,l){var p=arguments.length,a=p<3?i:l===null?l=Object.getOwnPropertyDescriptor(i,f):l,m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,i,f,l);else for(var r=t.length-1;r>=0;r--)(m=t[r])&&(a=(p<3?m(a):p>3?m(i,f,a):m(i,f))||a);return p>3&&a&&Object.defineProperty(i,f,a),a},Fe=function(t,i){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,i)};const Be=class{constructor(t){o.registerInstance(this,t),this.summarize=o.createEvent(this,"summarize",7),this.abortController=new AbortController,this.onClick=async i=>{var f,l;i.preventDefault(),i.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||(o.debug("[nylas-summarize-message-button] Default event not prevented, summarizing message"),this.audioRef&&(await this.audioRef.play().then(()=>{var a;return(a=this.audioRef)==null?void 0:a.pause()}).catch(a=>console.error("Error playing audio:",a)),await this.audioRef.play().catch(a=>console.error("Error playing audio:",a))))):this.state==="playing"?((f=this.abortController)==null||f.abort(),(l=this.audioRef)==null||l.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(){o.debug("[nylas-summarize-message-button] Component will load")}async componentDidLoad(){o.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 i=this.audioRef;if(!("MediaSource"in window)){const r=await t;if(r==null)throw new Error("ReadableStream not yet supported in this browser.");const c=r.getReader(),E=[];await this.readChunk(c,E);const A=new Blob(E,{type:"audio/mpeg"}),M=URL.createObjectURL(A);i.src=M;return}const f=new MediaSource;let l,p=!1;i.src=URL.createObjectURL(f),f.addEventListener("sourceopen",a);async function a(){l=f.addSourceBuffer("audio/mpeg"),l.addEventListener("updateend",m);const r=await t;if(r==null)throw new Error("ReadableStream not yet supported in this browser.");const c=r.getReader(),E=()=>{c.read().then(({done:A,value:M})=>{if(A){p=!0;return}l.updating||l.appendBuffer(M),E()}).catch(A=>{console.error("Error while fetching and appending chunks:",A)})};E(),i.paused&&i.play().catch(A=>console.error("Error playing audio:",A))}function m(){if(p){f.endOfStream(),f.removeEventListener("sourceopen",a),f.removeEventListener("sourceclose",()=>{o.debug("[nylas-summarize-message-button] Source closed")}),l.removeEventListener("updateend",m);return}}}async readChunk(t,i){return t.read().then(({done:f,value:l})=>f?i:(i.push(l),this.readChunk(t,i)))}render(){return o.h(o.Host,{key:"f0daa9a48cfbea9092ac7324a2adc8f453fc35a6"},o.h("sp-theme",{key:"f03bd91f1567ebfccc2689ceaadeff139cb3245e",scale:"medium",color:"dark"},o.h("sp-button",{key:"0e8d54e1410869dc40b0afbf7e2496e4ce5a5c10",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"&&o.h("play-icon",null),this.state==="loading"&&o.h("loading-icon",null),this.state==="playing"&&o.h("stop-icon",null)),o.h("audio",{key:"7345736699b007397634f66dd15a556977fdef72",ref:t=>this.audioRef=t,autoPlay:!0,onPlaying:()=>this.state="playing",onPause:()=>this.state="stopped",onEnded:()=>{this.state="stopped",o.debug("[nylas-summarize-message-button] Audio ended")}})))}};vn([bn.RegisterComponent({name:"nylas-summarize-message-button",eventToProps:{summarize:async(t,i)=>{const{playAudio:f,updateState:l,abortController:p,message:a}=t.detail,m=o.htmlToPlainText(a.body||"");await l("loading");try{const r=await i.messages.summarizeText(m),c=i.messages.textToSpeech(r,p);await f(c)}catch(r){await l("stopped"),console.error("Error summarizing message:",r)}}},fireRegisterEvent:!0}),Fe("design:type",Function),Fe("design:paramtypes",[]),Fe("design:returntype",void 0)],Be.prototype,"render",null);Be.style=wn;function I(t){return!window.matchMedia("(prefers-color-scheme: dark)").matches||!t?t:t==="transparent"?"color":t.startsWith("#")?Sn(t):t.startsWith("rgb")?Lt(t):t.startsWith("hsl")?Cn(t):Ln(t)?Rn(t):t}function Sn(t){t.length<7&&(t="#"+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]);const i=(255-parseInt(t.slice(1,3),16)).toString(16).padStart(2,"0"),f=(255-parseInt(t.slice(3,5),16)).toString(16).padStart(2,"0"),l=(255-parseInt(t.slice(5,7),16)).toString(16).padStart(2,"0");return`#${i}${f}${l}`}function Lt(t){var a;const i=(a=t.match(/\d+/g))==null?void 0:a.map(Number);if(!i)return t;const[f,l,p]=i;return`rgb(${255-f}, ${255-l}, ${255-p})`}function Cn(t){var a;const i=(a=t.match(/\d+\.?\d*/g))==null?void 0:a.map(Number);if(!i)return t;const[f,l,p]=i;return`hsl(${f}, ${l}%, ${100-p}%)`}function Ln(t){return/^[a-z]+$/i.test(t)}function Rn(t){return Lt(kn(t))}function kn(t){return t.toLowerCase()==="red"?"rgb(255, 0, 0)":"rgb(0, 0, 0)"}function vt(t){if(t instanceof HTMLStyleElement){let i=t.textContent;if(i){i=i.replaceAll(/@media\s*\(prefers-color-scheme:\s*(dark|light)\)\s*\{([^}]+)\}/g,"");const f=i.matchAll(/border-color:\s*([^;]+)/g);if(f)for(const r of f){const[c,E]=r,A=c.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&");i=i.replaceAll(A,c.replace(E,I(E)))}const l=i.matchAll(/border:\s*([^;]+)/g);if(l)for(const r of l){const c=r[0].trim(),E=c.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),[A,M,P]=r[1].split(" ");i=i.replaceAll(E,c.replace(P,I(P)))}const p=i.matchAll(/background-color:\s*([^;]+)/g);if(p)for(const r of p){const[c,E]=r,A=c.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&");i=i.replaceAll(A,c.replace(E,I(E))),o.debug("backgroundColor",{fullMatch:c,replace:c.replace(E,I(E)),color:E,invertColor:I(E)})}const a=i.matchAll(/background:\s*([^;]+)/g);if(a)for(const r of a){const c=r[0].trim(),E=c.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),[A,M,P]=r[1].split(" ");i=i.replaceAll(E,c.replace(P,I(P)))}const m=i.matchAll(/color:\s*([^;]+)/g);if(m)for(const r of m){const[c,E]=r,A=c.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&");i=i.replaceAll(A,c.replace(E,I(E)))}t.textContent=i}}if(t instanceof HTMLElement){const i=window.getComputedStyle(t),f=i.color||t.style.color,l=i.backgroundColor||t.style.backgroundColor,p=i.borderColor||t.style.borderColor;f&&!l?t.style.color="":f&&l?(t.style.color=I(f),t.style.backgroundColor=I(l),o.debug("element",t),o.debug("computedStyle.color",f),o.debug("computedStyle.backgroundColor",l),o.debug("invertColor(color)",I(f)),o.debug("invertColor(backgroundColor)",I(l))):!f&&l&&(t.style.backgroundColor=""),p&&(o.debug("borderColor",p),t.style.borderColor=I(p)),t.hasAttribute("bgcolor")&&t.removeAttribute("bgcolor")}}function Mn(t){vt(t),t.querySelectorAll("*").forEach(f=>vt(f))}var Rt={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,i){(function(f,l){t.exports=l()})(o.commonjsGlobal,function(){const{entries:f,setPrototypeOf:l,isFrozen:p,getPrototypeOf:a,getOwnPropertyDescriptor:m}=Object;let{freeze:r,seal:c,create:E}=Object,{apply:A,construct:M}=typeof Reflect<"u"&&Reflect;r||(r=function(d){return d}),c||(c=function(d){return d}),A||(A=function(d,y,g){return d.apply(y,g)}),M||(M=function(d,y){return new d(...y)});const P=O(Array.prototype.forEach),le=O(Array.prototype.pop),W=O(Array.prototype.push),j=O(String.prototype.toLowerCase),te=O(String.prototype.toString),be=O(String.prototype.match),B=O(String.prototype.replace),xt=O(String.prototype.indexOf),Dt=O(String.prototype.trim),D=O(RegExp.prototype.test),ne=Ot(TypeError);function O(b){return function(d){for(var y=arguments.length,g=new Array(y>1?y-1:0),R=1;R<y;R++)g[R-1]=arguments[R];return A(b,d,g)}}function Ot(b){return function(){for(var d=arguments.length,y=new Array(d),g=0;g<d;g++)y[g]=arguments[g];return M(b,y)}}function h(b,d){let y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:j;l&&l(b,null);let g=d.length;for(;g--;){let R=d[g];if(typeof R=="string"){const z=y(R);z!==R&&(p(d)||(d[g]=z),R=z)}b[R]=!0}return b}function It(b){for(let d=0;d<b.length;d++)m(b,d)===void 0&&(b[d]=null);return b}function G(b){const d=E(null);for(const[y,g]of f(b))m(b,y)!==void 0&&(Array.isArray(g)?d[y]=It(g):g&&typeof g=="object"&&g.constructor===Object?d[y]=G(g):d[y]=g);return d}function ce(b,d){for(;b!==null;){const g=m(b,d);if(g){if(g.get)return O(g.get);if(typeof g.value=="function")return O(g.value)}b=a(b)}function y(g){return console.warn("fallback value for",g),null}return y}const We=r(["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"]),ye=r(["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"]),Ee=r(["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"]),Pt=r(["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"]),Te=r(["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"]),Ut=r(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ge=r(["#text"]),qe=r(["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"]),Ae=r(["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"]),$e=r(["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"]),de=r(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),zt=c(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Ft=c(/<%[\w\W]*|[\w\W]*%>/gm),Ht=c(/\${[\w\W]*}/gm),Bt=c(/^data-[\-\w.\u00B7-\uFFFF]/),Wt=c(/^aria-[\-\w]+$/),Ye=c(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Gt=c(/^(?:\w+script|data):/i),qt=c(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),je=c(/^html$/i);var Xe=Object.freeze({__proto__:null,MUSTACHE_EXPR:zt,ERB_EXPR:Ft,TMPLIT_EXPR:Ht,DATA_ATTR:Bt,ARIA_ATTR:Wt,IS_ALLOWED_URI:Ye,IS_SCRIPT_OR_DATA:Gt,ATTR_WHITESPACE:qt,DOCTYPE_NAME:je});const $t=function(){return typeof window>"u"?null:window},Yt=function(d,y){if(typeof d!="object"||typeof d.createPolicy!="function")return null;let g=null;const R="data-tt-policy-suffix";y&&y.hasAttribute(R)&&(g=y.getAttribute(R));const z="dompurify"+(g?"#"+g:"");try{return d.createPolicy(z,{createHTML(X){return X},createScriptURL(X){return X}})}catch{return console.warn("TrustedTypes policy "+z+" could not be created."),null}};function Ve(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:$t();const d=u=>Ve(u);if(d.version="3.0.8",d.removed=[],!b||!b.document||b.document.nodeType!==9)return d.isSupported=!1,d;let{document:y}=b;const g=y,R=g.currentScript,{DocumentFragment:z,HTMLTemplateElement:X,Node:_e,Element:Ze,NodeFilter:we,NamedNodeMap:Xt=b.NamedNodeMap||b.MozNamedAttrMap,HTMLFormElement:Vt,DOMParser:Zt,trustedTypes:ue}=b,fe=Ze.prototype,Kt=ce(fe,"cloneNode"),Qt=ce(fe,"nextSibling"),Jt=ce(fe,"childNodes"),ve=ce(fe,"parentNode");if(typeof X=="function"){const u=y.createElement("template");u.content&&u.content.ownerDocument&&(y=u.content.ownerDocument)}let k,oe="";const{implementation:Se,createNodeIterator:en,createDocumentFragment:tn,getElementsByTagName:nn}=y,{importNode:on}=g;let U={};d.isSupported=typeof f=="function"&&typeof ve=="function"&&Se&&Se.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Ce,ERB_EXPR:Le,TMPLIT_EXPR:Re,DATA_ATTR:rn,ARIA_ATTR:an,IS_SCRIPT_OR_DATA:sn,ATTR_WHITESPACE:Ke}=Xe;let{IS_ALLOWED_URI:Qe}=Xe,w=null;const Je=h({},[...We,...ye,...Ee,...Te,...Ge]);let v=null;const et=h({},[...qe,...Ae,...$e,...de]);let _=Object.seal(E(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}})),ie=null,ke=null,tt=!0,Me=!0,nt=!1,ot=!0,V=!1,q=!1,Ne=!1,xe=!1,Z=!1,me=!1,pe=!1,it=!0,rt=!1;const ln="user-content-";let De=!0,re=!1,K={},Q=null;const at=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 st=null;const lt=h({},["audio","video","img","source","image","track"]);let Oe=null;const ct=h({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),he="http://www.w3.org/1998/Math/MathML",ge="http://www.w3.org/2000/svg",F="http://www.w3.org/1999/xhtml";let J=F,Ie=!1,Pe=null;const cn=h({},[he,ge,F],te);let ae=null;const dn=["application/xhtml+xml","text/html"],un="text/html";let S=null,ee=null;const fn=y.createElement("form"),dt=function(e){return e instanceof RegExp||e instanceof Function},Ue=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(ee&&ee===e)){if((!e||typeof e!="object")&&(e={}),e=G(e),ae=dn.indexOf(e.PARSER_MEDIA_TYPE)===-1?un:e.PARSER_MEDIA_TYPE,S=ae==="application/xhtml+xml"?te:j,w="ALLOWED_TAGS"in e?h({},e.ALLOWED_TAGS,S):Je,v="ALLOWED_ATTR"in e?h({},e.ALLOWED_ATTR,S):et,Pe="ALLOWED_NAMESPACES"in e?h({},e.ALLOWED_NAMESPACES,te):cn,Oe="ADD_URI_SAFE_ATTR"in e?h(G(ct),e.ADD_URI_SAFE_ATTR,S):ct,st="ADD_DATA_URI_TAGS"in e?h(G(lt),e.ADD_DATA_URI_TAGS,S):lt,Q="FORBID_CONTENTS"in e?h({},e.FORBID_CONTENTS,S):at,ie="FORBID_TAGS"in e?h({},e.FORBID_TAGS,S):{},ke="FORBID_ATTR"in e?h({},e.FORBID_ATTR,S):{},K="USE_PROFILES"in e?e.USE_PROFILES:!1,tt=e.ALLOW_ARIA_ATTR!==!1,Me=e.ALLOW_DATA_ATTR!==!1,nt=e.ALLOW_UNKNOWN_PROTOCOLS||!1,ot=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,V=e.SAFE_FOR_TEMPLATES||!1,q=e.WHOLE_DOCUMENT||!1,Z=e.RETURN_DOM||!1,me=e.RETURN_DOM_FRAGMENT||!1,pe=e.RETURN_TRUSTED_TYPE||!1,xe=e.FORCE_BODY||!1,it=e.SANITIZE_DOM!==!1,rt=e.SANITIZE_NAMED_PROPS||!1,De=e.KEEP_CONTENT!==!1,re=e.IN_PLACE||!1,Qe=e.ALLOWED_URI_REGEXP||Ye,J=e.NAMESPACE||F,_=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&dt(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(_.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&dt(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(_.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(_.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),V&&(Me=!1),me&&(Z=!0),K&&(w=h({},Ge),v=[],K.html===!0&&(h(w,We),h(v,qe)),K.svg===!0&&(h(w,ye),h(v,Ae),h(v,de)),K.svgFilters===!0&&(h(w,Ee),h(v,Ae),h(v,de)),K.mathMl===!0&&(h(w,Te),h(v,$e),h(v,de))),e.ADD_TAGS&&(w===Je&&(w=G(w)),h(w,e.ADD_TAGS,S)),e.ADD_ATTR&&(v===et&&(v=G(v)),h(v,e.ADD_ATTR,S)),e.ADD_URI_SAFE_ATTR&&h(Oe,e.ADD_URI_SAFE_ATTR,S),e.FORBID_CONTENTS&&(Q===at&&(Q=G(Q)),h(Q,e.FORBID_CONTENTS,S)),De&&(w["#text"]=!0),q&&h(w,["html","head","body"]),w.table&&(h(w,["tbody"]),delete ie.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw ne('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ne('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');k=e.TRUSTED_TYPES_POLICY,oe=k.createHTML("")}else k===void 0&&(k=Yt(ue,R)),k!==null&&typeof oe=="string"&&(oe=k.createHTML(""));r&&r(e),ee=e}},ut=h({},["mi","mo","mn","ms","mtext"]),ft=h({},["foreignobject","desc","title","annotation-xml"]),mn=h({},["title","style","font","a","script"]),mt=h({},[...ye,...Ee,...Pt]),pt=h({},[...Te,...Ut]),pn=function(e){let n=ve(e);(!n||!n.tagName)&&(n={namespaceURI:J,tagName:"template"});const s=j(e.tagName),T=j(n.tagName);return Pe[e.namespaceURI]?e.namespaceURI===ge?n.namespaceURI===F?s==="svg":n.namespaceURI===he?s==="svg"&&(T==="annotation-xml"||ut[T]):!!mt[s]:e.namespaceURI===he?n.namespaceURI===F?s==="math":n.namespaceURI===ge?s==="math"&&ft[T]:!!pt[s]:e.namespaceURI===F?n.namespaceURI===ge&&!ft[T]||n.namespaceURI===he&&!ut[T]?!1:!pt[s]&&(mn[s]||!mt[s]):!!(ae==="application/xhtml+xml"&&Pe[e.namespaceURI]):!1},$=function(e){W(d.removed,{element:e});try{e.parentNode.removeChild(e)}catch{e.remove()}},ze=function(e,n){try{W(d.removed,{attribute:n.getAttributeNode(e),from:n})}catch{W(d.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e==="is"&&!v[e])if(Z||me)try{$(n)}catch{}else try{n.setAttribute(e,"")}catch{}},ht=function(e){let n=null,s=null;if(xe)e="<remove></remove>"+e;else{const L=be(e,/^[\r\n\t ]+/);s=L&&L[0]}ae==="application/xhtml+xml"&&J===F&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const T=k?k.createHTML(e):e;if(J===F)try{n=new Zt().parseFromString(T,ae)}catch{}if(!n||!n.documentElement){n=Se.createDocument(J,"template",null);try{n.documentElement.innerHTML=Ie?oe:T}catch{}}const C=n.body||n.documentElement;return e&&s&&C.insertBefore(y.createTextNode(s),C.childNodes[0]||null),J===F?nn.call(n,q?"html":"body")[0]:q?n.documentElement:C},gt=function(e){return en.call(e.ownerDocument||e,e,we.SHOW_ELEMENT|we.SHOW_COMMENT|we.SHOW_TEXT,null)},hn=function(e){return e instanceof Vt&&(typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||!(e.attributes instanceof Xt)||typeof e.removeAttribute!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function")},bt=function(e){return typeof _e=="function"&&e instanceof _e},H=function(e,n,s){U[e]&&P(U[e],T=>{T.call(d,n,s,ee)})},yt=function(e){let n=null;if(H("beforeSanitizeElements",e,null),hn(e))return $(e),!0;const s=S(e.nodeName);if(H("uponSanitizeElement",e,{tagName:s,allowedTags:w}),e.hasChildNodes()&&!bt(e.firstElementChild)&&D(/<[/\w]/g,e.innerHTML)&&D(/<[/\w]/g,e.textContent))return $(e),!0;if(!w[s]||ie[s]){if(!ie[s]&&Tt(s)&&(_.tagNameCheck instanceof RegExp&&D(_.tagNameCheck,s)||_.tagNameCheck instanceof Function&&_.tagNameCheck(s)))return!1;if(De&&!Q[s]){const T=ve(e)||e.parentNode,C=Jt(e)||e.childNodes;if(C&&T){const L=C.length;for(let N=L-1;N>=0;--N)T.insertBefore(Kt(C[N],!0),Qt(e))}}return $(e),!0}return e instanceof Ze&&!pn(e)||(s==="noscript"||s==="noembed"||s==="noframes")&&D(/<\/no(script|embed|frames)/i,e.innerHTML)?($(e),!0):(V&&e.nodeType===3&&(n=e.textContent,P([Ce,Le,Re],T=>{n=B(n,T," ")}),e.textContent!==n&&(W(d.removed,{element:e.cloneNode()}),e.textContent=n)),H("afterSanitizeElements",e,null),!1)},Et=function(e,n,s){if(it&&(n==="id"||n==="name")&&(s in y||s in fn))return!1;if(!(Me&&!ke[n]&&D(rn,n))){if(!(tt&&D(an,n))){if(!v[n]||ke[n]){if(!(Tt(e)&&(_.tagNameCheck instanceof RegExp&&D(_.tagNameCheck,e)||_.tagNameCheck instanceof Function&&_.tagNameCheck(e))&&(_.attributeNameCheck instanceof RegExp&&D(_.attributeNameCheck,n)||_.attributeNameCheck instanceof Function&&_.attributeNameCheck(n))||n==="is"&&_.allowCustomizedBuiltInElements&&(_.tagNameCheck instanceof RegExp&&D(_.tagNameCheck,s)||_.tagNameCheck instanceof Function&&_.tagNameCheck(s))))return!1}else if(!Oe[n]){if(!D(Qe,B(s,Ke,""))){if(!((n==="src"||n==="xlink:href"||n==="href")&&e!=="script"&&xt(s,"data:")===0&&st[e])){if(!(nt&&!D(sn,B(s,Ke,"")))){if(s)return!1}}}}}}return!0},Tt=function(e){return e.indexOf("-")>0},At=function(e){H("beforeSanitizeAttributes",e,null);const{attributes:n}=e;if(!n)return;const s={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:v};let T=n.length;for(;T--;){const C=n[T],{name:L,namespaceURI:N,value:Y}=C,se=S(L);let x=L==="value"?Y:Dt(Y);if(s.attrName=se,s.attrValue=x,s.keepAttr=!0,s.forceKeepAttr=void 0,H("uponSanitizeAttribute",e,s),x=s.attrValue,s.forceKeepAttr||(ze(L,e),!s.keepAttr))continue;if(!ot&&D(/\/>/i,x)){ze(L,e);continue}V&&P([Ce,Le,Re],wt=>{x=B(x,wt," ")});const _t=S(e.nodeName);if(Et(_t,se,x)){if(rt&&(se==="id"||se==="name")&&(ze(L,e),x=ln+x),k&&typeof ue=="object"&&typeof ue.getAttributeType=="function"&&!N)switch(ue.getAttributeType(_t,se)){case"TrustedHTML":{x=k.createHTML(x);break}case"TrustedScriptURL":{x=k.createScriptURL(x);break}}try{N?e.setAttributeNS(N,L,x):e.setAttribute(L,x),le(d.removed)}catch{}}}H("afterSanitizeAttributes",e,null)},gn=function u(e){let n=null;const s=gt(e);for(H("beforeSanitizeShadowDOM",e,null);n=s.nextNode();)H("uponSanitizeShadowNode",n,null),!yt(n)&&(n.content instanceof z&&u(n.content),At(n));H("afterSanitizeShadowDOM",e,null)};return d.sanitize=function(u){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=null,s=null,T=null,C=null;if(Ie=!u,Ie&&(u="<!-->"),typeof u!="string"&&!bt(u))if(typeof u.toString=="function"){if(u=u.toString(),typeof u!="string")throw ne("dirty is not a string, aborting")}else throw ne("toString is not a function");if(!d.isSupported)return u;if(Ne||Ue(e),d.removed=[],typeof u=="string"&&(re=!1),re){if(u.nodeName){const Y=S(u.nodeName);if(!w[Y]||ie[Y])throw ne("root node is forbidden and cannot be sanitized in-place")}}else if(u instanceof _e)n=ht("<!---->"),s=n.ownerDocument.importNode(u,!0),s.nodeType===1&&s.nodeName==="BODY"||s.nodeName==="HTML"?n=s:n.appendChild(s);else{if(!Z&&!V&&!q&&u.indexOf("<")===-1)return k&&pe?k.createHTML(u):u;if(n=ht(u),!n)return Z?null:pe?oe:""}n&&xe&&$(n.firstChild);const L=gt(re?u:n);for(;T=L.nextNode();)yt(T)||(T.content instanceof z&&gn(T.content),At(T));if(re)return u;if(Z){if(me)for(C=tn.call(n.ownerDocument);n.firstChild;)C.appendChild(n.firstChild);else C=n;return(v.shadowroot||v.shadowrootmode)&&(C=on.call(g,C,!0)),C}let N=q?n.outerHTML:n.innerHTML;return q&&w["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&D(je,n.ownerDocument.doctype.name)&&(N="<!DOCTYPE "+n.ownerDocument.doctype.name+`>
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-8a536089.cjs"),bn=require("./register-component-592986c5-5edf5835.cjs");require("react");require("react-dom");const yn=".sc-forward-icon-h{display:flex}",En=yn,St=class{constructor(t){o.registerInstance(this,t),this.width="15",this.height="15"}render(){return o.h("svg",{key:"bb4e930bb772ffc0c72dba3703943c7a4f1d1dc6",fill:"auto",width:this.width,height:this.height,viewBox:"0 0 1920 1920",xmlns:"http://www.w3.org/2000/svg"},o.h("path",{key:"6e77f8f18532c1f5bd6df8be0b6c736b3a15ddcc",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"}))}};St.style=En;const Tn=':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}',An=Tn,Ct=class{constructor(t){o.registerInstance(this,t),this.close=o.createEvent(this,"close",7),this.send=o.createEvent(this,"send",7),this.closeComposer=i=>{this.close.emit(i)},this.sendComposer=i=>{var l;if(!this.editorEl){o.debug("no editor element");return}const f=this.editorEl.querySelector(".message-body");if(!f){o.debug("no message body");return}this.message&&(this.send.emit({message:this.message,replyBody:((l=f.querySelector(".message-body"))==null?void 0:l.innerHTML)||""}),this.close.emit(i),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){o.debug("[connectedCallback] no editor element");return}if(!this.toolbarEl){o.debug("[connectedCallback] no toolbar element");return}const t=this.editorEl,i=this.toolbarEl;t.addEventListener("mouseup",f=>{var B;const l=(B=this.host.shadowRoot)==null?void 0:B.getSelection();if(!l){o.debug("no selection");return}const p=l.getRangeAt(0),a=l.toString();if(!a){i.style.display="none";return}const m=t.querySelector(".message-body");if(!m){o.debug("no message body");return}const c=p.commonAncestorContainer.parentElement;if(!c)return;const E=m.getBoundingClientRect();o.debug("messageBodyRect",{messageBodyRect:E});const A=c.getBoundingClientRect();o.debug("foundRect",{foundRect:A});const le=(c.childNodes[0].textContent||"").indexOf(a),W=window.getComputedStyle(c).fontSize,j=parseInt(W.replace("px",""),10),te=A.top-E.top-i.clientHeight,be=le*(1/j)*100;i.style.top=`${te}px`,i.style.left=`${be}px`,i.style.display="block"})}watchBody(t){var a;if(!this.editorEl){o.debug("no editor element");return}this.editorEl.querySelectorAll(".message-body").forEach(m=>m.remove());const i=document.createElement("div");i.classList.add("message-body");const f=document.createElement("p");f.innerHTML=" ",i.appendChild(f);const l=document.createElement("br");i.appendChild(l);const p=document.createElement("div");if(p.classList.add("reply-text"),p.innerText=`On ${new Date(t.date*1e3).toLocaleDateString(void 0,{dateStyle:"full"})} <${(a=t.from)==null?void 0:a.map(m=>m.name||m.email).join(", ")}> wrote:`,i.appendChild(p),t.body){const m=document.createElement("html");m.innerHTML=t.body;const r=document.createElement("blockquote");r.classList.add("collapsed"),r.classList.add("gmail_quote"),r.innerHTML=m.innerHTML,i.appendChild(r),o.debug("replyContainer",{replyContainer:r})}this.editorEl.appendChild(i),this.editorEl.querySelectorAll("blockquote.collapsed").forEach(m=>{m.addEventListener("click",function(r){r.preventDefault();const c=r.target;c.classList.remove("collapsed"),c.classList.add("expanded")},{once:!0})}),this.editorEl.focus()}render(){return o.h(o.Host,{key:"46125beb4200ff389b5d4cd6ff76fe3228b3fa86"},o.h("sp-theme",{key:"2e7d9dd1e2a3817d0609b283cc8572a955230370",scale:"medium",color:"dark"},o.h("div",{key:"6a5954e74d72a031aacd29b424c68e51badce046",class:"editor",contentEditable:!0,ref:t=>this.editorEl=t},o.h("div",{key:"61152b4be1fe8505dfbc32943c2eb3406a93ca2a",class:"toolbar",ref:t=>this.toolbarEl=t,contentEditable:!1},o.h("sp-button",{key:"c896e9d32720e59cb3b7301dd9c05c73a9579fc4",quiet:!0,onClick:()=>document.execCommand("bold")},o.h("div",{key:"6c48e73ddf5c95796d68a661e0a80039827ca73c",slot:"icon"},o.h("bold-icon",{key:"955e0873449ad2affbb755e1c92310b87972925a"})),o.h("div",{key:"eb68ad20983fd72bd139ccd20383d4a8ca1f750c",slot:"label"},"Bold")),o.h("sp-button",{key:"dbb2b362cedaaf5706eda1957c853acd45b71526",quiet:!0,onClick:()=>document.execCommand("underline")},o.h("div",{key:"e699c015e2bc926e259e8666dc23be79673df140",slot:"icon"},o.h("underline-icon",{key:"bb4a86a3f9758950271394718408e83f1441a5f6"})),o.h("div",{key:"13ad8d10033b585eefa562776dcd57dd4816eb56",slot:"label"},"Underline")),o.h("sp-button",{key:"9c6b5ca3ddbca9b13cf5fdc88be9d6bb12340cab",quiet:!0,onClick:()=>document.execCommand("italic")},o.h("div",{key:"a1e776afeeb8421fb94ba203544abcafce5c43c0",slot:"icon"},o.h("italic-icon",{key:"a04ae4fcdd5c006bb5575c6c8bf33ee8f8abad78"})),o.h("div",{key:"31e02506a6def45c5444d2a70a394e65c952e3d0",slot:"label"},"Italic")))),o.h("div",{key:"57243170b74f7dfb732817acca22c53782cc0e7c",class:"buttons"},o.h("sp-button",{key:"e096fef6544f3c09cec94bd4e37519acc9a980c0",onClick:this.sendComposer,class:"send"},"Send"),o.h("sp-button",{key:"b81de8ac43034d2fdaa77ddd6462f32b775dff7d",onClick:this.closeComposer,class:"close"},"Close"))))}get host(){return o.getElement(this)}static get watchers(){return{message:["watchBody"]}}};Ct.style=An;const _n=":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)}}",wn=_n;var vn=function(t,i,f,l){var p=arguments.length,a=p<3?i:l===null?l=Object.getOwnPropertyDescriptor(i,f):l,m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,i,f,l);else for(var r=t.length-1;r>=0;r--)(m=t[r])&&(a=(p<3?m(a):p>3?m(i,f,a):m(i,f))||a);return p>3&&a&&Object.defineProperty(i,f,a),a},Fe=function(t,i){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,i)};const Be=class{constructor(t){o.registerInstance(this,t),this.summarize=o.createEvent(this,"summarize",7),this.abortController=new AbortController,this.onClick=async i=>{var f,l;i.preventDefault(),i.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||(o.debug("[nylas-summarize-message-button] Default event not prevented, summarizing message"),this.audioRef&&(await this.audioRef.play().then(()=>{var a;return(a=this.audioRef)==null?void 0:a.pause()}).catch(a=>console.error("Error playing audio:",a)),await this.audioRef.play().catch(a=>console.error("Error playing audio:",a))))):this.state==="playing"?((f=this.abortController)==null||f.abort(),(l=this.audioRef)==null||l.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(){o.debug("[nylas-summarize-message-button] Component will load")}async componentDidLoad(){o.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 i=this.audioRef;if(!("MediaSource"in window)){const r=await t;if(r==null)throw new Error("ReadableStream not yet supported in this browser.");const c=r.getReader(),E=[];await this.readChunk(c,E);const A=new Blob(E,{type:"audio/mpeg"}),M=URL.createObjectURL(A);i.src=M;return}const f=new MediaSource;let l,p=!1;i.src=URL.createObjectURL(f),f.addEventListener("sourceopen",a);async function a(){l=f.addSourceBuffer("audio/mpeg"),l.addEventListener("updateend",m);const r=await t;if(r==null)throw new Error("ReadableStream not yet supported in this browser.");const c=r.getReader(),E=()=>{c.read().then(({done:A,value:M})=>{if(A){p=!0;return}l.updating||l.appendBuffer(M),E()}).catch(A=>{console.error("Error while fetching and appending chunks:",A)})};E(),i.paused&&i.play().catch(A=>console.error("Error playing audio:",A))}function m(){if(p){f.endOfStream(),f.removeEventListener("sourceopen",a),f.removeEventListener("sourceclose",()=>{o.debug("[nylas-summarize-message-button] Source closed")}),l.removeEventListener("updateend",m);return}}}async readChunk(t,i){return t.read().then(({done:f,value:l})=>f?i:(i.push(l),this.readChunk(t,i)))}render(){return o.h(o.Host,{key:"f0daa9a48cfbea9092ac7324a2adc8f453fc35a6"},o.h("sp-theme",{key:"f03bd91f1567ebfccc2689ceaadeff139cb3245e",scale:"medium",color:"dark"},o.h("sp-button",{key:"0e8d54e1410869dc40b0afbf7e2496e4ce5a5c10",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"&&o.h("play-icon",null),this.state==="loading"&&o.h("loading-icon",null),this.state==="playing"&&o.h("stop-icon",null)),o.h("audio",{key:"7345736699b007397634f66dd15a556977fdef72",ref:t=>this.audioRef=t,autoPlay:!0,onPlaying:()=>this.state="playing",onPause:()=>this.state="stopped",onEnded:()=>{this.state="stopped",o.debug("[nylas-summarize-message-button] Audio ended")}})))}};vn([bn.RegisterComponent({name:"nylas-summarize-message-button",eventToProps:{summarize:async(t,i)=>{const{playAudio:f,updateState:l,abortController:p,message:a}=t.detail,m=o.htmlToPlainText(a.body||"");await l("loading");try{const r=await i.messages.summarizeText(m),c=i.messages.textToSpeech(r,p);await f(c)}catch(r){await l("stopped"),console.error("Error summarizing message:",r)}}},fireRegisterEvent:!0}),Fe("design:type",Function),Fe("design:paramtypes",[]),Fe("design:returntype",void 0)],Be.prototype,"render",null);Be.style=wn;function I(t){return!window.matchMedia("(prefers-color-scheme: dark)").matches||!t?t:t==="transparent"?"color":t.startsWith("#")?Sn(t):t.startsWith("rgb")?Lt(t):t.startsWith("hsl")?Cn(t):Ln(t)?Rn(t):t}function Sn(t){t.length<7&&(t="#"+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]);const i=(255-parseInt(t.slice(1,3),16)).toString(16).padStart(2,"0"),f=(255-parseInt(t.slice(3,5),16)).toString(16).padStart(2,"0"),l=(255-parseInt(t.slice(5,7),16)).toString(16).padStart(2,"0");return`#${i}${f}${l}`}function Lt(t){var a;const i=(a=t.match(/\d+/g))==null?void 0:a.map(Number);if(!i)return t;const[f,l,p]=i;return`rgb(${255-f}, ${255-l}, ${255-p})`}function Cn(t){var a;const i=(a=t.match(/\d+\.?\d*/g))==null?void 0:a.map(Number);if(!i)return t;const[f,l,p]=i;return`hsl(${f}, ${l}%, ${100-p}%)`}function Ln(t){return/^[a-z]+$/i.test(t)}function Rn(t){return Lt(kn(t))}function kn(t){return t.toLowerCase()==="red"?"rgb(255, 0, 0)":"rgb(0, 0, 0)"}function vt(t){if(t instanceof HTMLStyleElement){let i=t.textContent;if(i){i=i.replaceAll(/@media\s*\(prefers-color-scheme:\s*(dark|light)\)\s*\{([^}]+)\}/g,"");const f=i.matchAll(/border-color:\s*([^;]+)/g);if(f)for(const r of f){const[c,E]=r,A=c.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&");i=i.replaceAll(A,c.replace(E,I(E)))}const l=i.matchAll(/border:\s*([^;]+)/g);if(l)for(const r of l){const c=r[0].trim(),E=c.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),[A,M,P]=r[1].split(" ");i=i.replaceAll(E,c.replace(P,I(P)))}const p=i.matchAll(/background-color:\s*([^;]+)/g);if(p)for(const r of p){const[c,E]=r,A=c.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&");i=i.replaceAll(A,c.replace(E,I(E))),o.debug("backgroundColor",{fullMatch:c,replace:c.replace(E,I(E)),color:E,invertColor:I(E)})}const a=i.matchAll(/background:\s*([^;]+)/g);if(a)for(const r of a){const c=r[0].trim(),E=c.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),[A,M,P]=r[1].split(" ");i=i.replaceAll(E,c.replace(P,I(P)))}const m=i.matchAll(/color:\s*([^;]+)/g);if(m)for(const r of m){const[c,E]=r,A=c.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&");i=i.replaceAll(A,c.replace(E,I(E)))}t.textContent=i}}if(t instanceof HTMLElement){const i=window.getComputedStyle(t),f=i.color||t.style.color,l=i.backgroundColor||t.style.backgroundColor,p=i.borderColor||t.style.borderColor;f&&!l?t.style.color="":f&&l?(t.style.color=I(f),t.style.backgroundColor=I(l),o.debug("element",t),o.debug("computedStyle.color",f),o.debug("computedStyle.backgroundColor",l),o.debug("invertColor(color)",I(f)),o.debug("invertColor(backgroundColor)",I(l))):!f&&l&&(t.style.backgroundColor=""),p&&(o.debug("borderColor",p),t.style.borderColor=I(p)),t.hasAttribute("bgcolor")&&t.removeAttribute("bgcolor")}}function Mn(t){vt(t),t.querySelectorAll("*").forEach(f=>vt(f))}var Rt={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,i){(function(f,l){t.exports=l()})(o.commonjsGlobal,function(){const{entries:f,setPrototypeOf:l,isFrozen:p,getPrototypeOf:a,getOwnPropertyDescriptor:m}=Object;let{freeze:r,seal:c,create:E}=Object,{apply:A,construct:M}=typeof Reflect<"u"&&Reflect;r||(r=function(d){return d}),c||(c=function(d){return d}),A||(A=function(d,y,g){return d.apply(y,g)}),M||(M=function(d,y){return new d(...y)});const P=O(Array.prototype.forEach),le=O(Array.prototype.pop),W=O(Array.prototype.push),j=O(String.prototype.toLowerCase),te=O(String.prototype.toString),be=O(String.prototype.match),B=O(String.prototype.replace),xt=O(String.prototype.indexOf),Dt=O(String.prototype.trim),D=O(RegExp.prototype.test),ne=Ot(TypeError);function O(b){return function(d){for(var y=arguments.length,g=new Array(y>1?y-1:0),R=1;R<y;R++)g[R-1]=arguments[R];return A(b,d,g)}}function Ot(b){return function(){for(var d=arguments.length,y=new Array(d),g=0;g<d;g++)y[g]=arguments[g];return M(b,y)}}function h(b,d){let y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:j;l&&l(b,null);let g=d.length;for(;g--;){let R=d[g];if(typeof R=="string"){const z=y(R);z!==R&&(p(d)||(d[g]=z),R=z)}b[R]=!0}return b}function It(b){for(let d=0;d<b.length;d++)m(b,d)===void 0&&(b[d]=null);return b}function G(b){const d=E(null);for(const[y,g]of f(b))m(b,y)!==void 0&&(Array.isArray(g)?d[y]=It(g):g&&typeof g=="object"&&g.constructor===Object?d[y]=G(g):d[y]=g);return d}function ce(b,d){for(;b!==null;){const g=m(b,d);if(g){if(g.get)return O(g.get);if(typeof g.value=="function")return O(g.value)}b=a(b)}function y(g){return console.warn("fallback value for",g),null}return y}const We=r(["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"]),ye=r(["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"]),Ee=r(["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"]),Pt=r(["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"]),Te=r(["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"]),Ut=r(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ge=r(["#text"]),qe=r(["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"]),Ae=r(["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"]),$e=r(["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"]),de=r(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),zt=c(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Ft=c(/<%[\w\W]*|[\w\W]*%>/gm),Ht=c(/\${[\w\W]*}/gm),Bt=c(/^data-[\-\w.\u00B7-\uFFFF]/),Wt=c(/^aria-[\-\w]+$/),Ye=c(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Gt=c(/^(?:\w+script|data):/i),qt=c(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),je=c(/^html$/i);var Xe=Object.freeze({__proto__:null,MUSTACHE_EXPR:zt,ERB_EXPR:Ft,TMPLIT_EXPR:Ht,DATA_ATTR:Bt,ARIA_ATTR:Wt,IS_ALLOWED_URI:Ye,IS_SCRIPT_OR_DATA:Gt,ATTR_WHITESPACE:qt,DOCTYPE_NAME:je});const $t=function(){return typeof window>"u"?null:window},Yt=function(d,y){if(typeof d!="object"||typeof d.createPolicy!="function")return null;let g=null;const R="data-tt-policy-suffix";y&&y.hasAttribute(R)&&(g=y.getAttribute(R));const z="dompurify"+(g?"#"+g:"");try{return d.createPolicy(z,{createHTML(X){return X},createScriptURL(X){return X}})}catch{return console.warn("TrustedTypes policy "+z+" could not be created."),null}};function Ve(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:$t();const d=u=>Ve(u);if(d.version="3.0.8",d.removed=[],!b||!b.document||b.document.nodeType!==9)return d.isSupported=!1,d;let{document:y}=b;const g=y,R=g.currentScript,{DocumentFragment:z,HTMLTemplateElement:X,Node:_e,Element:Ze,NodeFilter:we,NamedNodeMap:Xt=b.NamedNodeMap||b.MozNamedAttrMap,HTMLFormElement:Vt,DOMParser:Zt,trustedTypes:ue}=b,fe=Ze.prototype,Kt=ce(fe,"cloneNode"),Qt=ce(fe,"nextSibling"),Jt=ce(fe,"childNodes"),ve=ce(fe,"parentNode");if(typeof X=="function"){const u=y.createElement("template");u.content&&u.content.ownerDocument&&(y=u.content.ownerDocument)}let k,oe="";const{implementation:Se,createNodeIterator:en,createDocumentFragment:tn,getElementsByTagName:nn}=y,{importNode:on}=g;let U={};d.isSupported=typeof f=="function"&&typeof ve=="function"&&Se&&Se.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Ce,ERB_EXPR:Le,TMPLIT_EXPR:Re,DATA_ATTR:rn,ARIA_ATTR:an,IS_SCRIPT_OR_DATA:sn,ATTR_WHITESPACE:Ke}=Xe;let{IS_ALLOWED_URI:Qe}=Xe,w=null;const Je=h({},[...We,...ye,...Ee,...Te,...Ge]);let v=null;const et=h({},[...qe,...Ae,...$e,...de]);let _=Object.seal(E(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}})),ie=null,ke=null,tt=!0,Me=!0,nt=!1,ot=!0,V=!1,q=!1,Ne=!1,xe=!1,Z=!1,me=!1,pe=!1,it=!0,rt=!1;const ln="user-content-";let De=!0,re=!1,K={},Q=null;const at=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 st=null;const lt=h({},["audio","video","img","source","image","track"]);let Oe=null;const ct=h({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),he="http://www.w3.org/1998/Math/MathML",ge="http://www.w3.org/2000/svg",F="http://www.w3.org/1999/xhtml";let J=F,Ie=!1,Pe=null;const cn=h({},[he,ge,F],te);let ae=null;const dn=["application/xhtml+xml","text/html"],un="text/html";let S=null,ee=null;const fn=y.createElement("form"),dt=function(e){return e instanceof RegExp||e instanceof Function},Ue=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(ee&&ee===e)){if((!e||typeof e!="object")&&(e={}),e=G(e),ae=dn.indexOf(e.PARSER_MEDIA_TYPE)===-1?un:e.PARSER_MEDIA_TYPE,S=ae==="application/xhtml+xml"?te:j,w="ALLOWED_TAGS"in e?h({},e.ALLOWED_TAGS,S):Je,v="ALLOWED_ATTR"in e?h({},e.ALLOWED_ATTR,S):et,Pe="ALLOWED_NAMESPACES"in e?h({},e.ALLOWED_NAMESPACES,te):cn,Oe="ADD_URI_SAFE_ATTR"in e?h(G(ct),e.ADD_URI_SAFE_ATTR,S):ct,st="ADD_DATA_URI_TAGS"in e?h(G(lt),e.ADD_DATA_URI_TAGS,S):lt,Q="FORBID_CONTENTS"in e?h({},e.FORBID_CONTENTS,S):at,ie="FORBID_TAGS"in e?h({},e.FORBID_TAGS,S):{},ke="FORBID_ATTR"in e?h({},e.FORBID_ATTR,S):{},K="USE_PROFILES"in e?e.USE_PROFILES:!1,tt=e.ALLOW_ARIA_ATTR!==!1,Me=e.ALLOW_DATA_ATTR!==!1,nt=e.ALLOW_UNKNOWN_PROTOCOLS||!1,ot=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,V=e.SAFE_FOR_TEMPLATES||!1,q=e.WHOLE_DOCUMENT||!1,Z=e.RETURN_DOM||!1,me=e.RETURN_DOM_FRAGMENT||!1,pe=e.RETURN_TRUSTED_TYPE||!1,xe=e.FORCE_BODY||!1,it=e.SANITIZE_DOM!==!1,rt=e.SANITIZE_NAMED_PROPS||!1,De=e.KEEP_CONTENT!==!1,re=e.IN_PLACE||!1,Qe=e.ALLOWED_URI_REGEXP||Ye,J=e.NAMESPACE||F,_=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&dt(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(_.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&dt(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(_.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(_.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),V&&(Me=!1),me&&(Z=!0),K&&(w=h({},Ge),v=[],K.html===!0&&(h(w,We),h(v,qe)),K.svg===!0&&(h(w,ye),h(v,Ae),h(v,de)),K.svgFilters===!0&&(h(w,Ee),h(v,Ae),h(v,de)),K.mathMl===!0&&(h(w,Te),h(v,$e),h(v,de))),e.ADD_TAGS&&(w===Je&&(w=G(w)),h(w,e.ADD_TAGS,S)),e.ADD_ATTR&&(v===et&&(v=G(v)),h(v,e.ADD_ATTR,S)),e.ADD_URI_SAFE_ATTR&&h(Oe,e.ADD_URI_SAFE_ATTR,S),e.FORBID_CONTENTS&&(Q===at&&(Q=G(Q)),h(Q,e.FORBID_CONTENTS,S)),De&&(w["#text"]=!0),q&&h(w,["html","head","body"]),w.table&&(h(w,["tbody"]),delete ie.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw ne('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ne('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');k=e.TRUSTED_TYPES_POLICY,oe=k.createHTML("")}else k===void 0&&(k=Yt(ue,R)),k!==null&&typeof oe=="string"&&(oe=k.createHTML(""));r&&r(e),ee=e}},ut=h({},["mi","mo","mn","ms","mtext"]),ft=h({},["foreignobject","desc","title","annotation-xml"]),mn=h({},["title","style","font","a","script"]),mt=h({},[...ye,...Ee,...Pt]),pt=h({},[...Te,...Ut]),pn=function(e){let n=ve(e);(!n||!n.tagName)&&(n={namespaceURI:J,tagName:"template"});const s=j(e.tagName),T=j(n.tagName);return Pe[e.namespaceURI]?e.namespaceURI===ge?n.namespaceURI===F?s==="svg":n.namespaceURI===he?s==="svg"&&(T==="annotation-xml"||ut[T]):!!mt[s]:e.namespaceURI===he?n.namespaceURI===F?s==="math":n.namespaceURI===ge?s==="math"&&ft[T]:!!pt[s]:e.namespaceURI===F?n.namespaceURI===ge&&!ft[T]||n.namespaceURI===he&&!ut[T]?!1:!pt[s]&&(mn[s]||!mt[s]):!!(ae==="application/xhtml+xml"&&Pe[e.namespaceURI]):!1},$=function(e){W(d.removed,{element:e});try{e.parentNode.removeChild(e)}catch{e.remove()}},ze=function(e,n){try{W(d.removed,{attribute:n.getAttributeNode(e),from:n})}catch{W(d.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e==="is"&&!v[e])if(Z||me)try{$(n)}catch{}else try{n.setAttribute(e,"")}catch{}},ht=function(e){let n=null,s=null;if(xe)e="<remove></remove>"+e;else{const L=be(e,/^[\r\n\t ]+/);s=L&&L[0]}ae==="application/xhtml+xml"&&J===F&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const T=k?k.createHTML(e):e;if(J===F)try{n=new Zt().parseFromString(T,ae)}catch{}if(!n||!n.documentElement){n=Se.createDocument(J,"template",null);try{n.documentElement.innerHTML=Ie?oe:T}catch{}}const C=n.body||n.documentElement;return e&&s&&C.insertBefore(y.createTextNode(s),C.childNodes[0]||null),J===F?nn.call(n,q?"html":"body")[0]:q?n.documentElement:C},gt=function(e){return en.call(e.ownerDocument||e,e,we.SHOW_ELEMENT|we.SHOW_COMMENT|we.SHOW_TEXT,null)},hn=function(e){return e instanceof Vt&&(typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||!(e.attributes instanceof Xt)||typeof e.removeAttribute!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function")},bt=function(e){return typeof _e=="function"&&e instanceof _e},H=function(e,n,s){U[e]&&P(U[e],T=>{T.call(d,n,s,ee)})},yt=function(e){let n=null;if(H("beforeSanitizeElements",e,null),hn(e))return $(e),!0;const s=S(e.nodeName);if(H("uponSanitizeElement",e,{tagName:s,allowedTags:w}),e.hasChildNodes()&&!bt(e.firstElementChild)&&D(/<[/\w]/g,e.innerHTML)&&D(/<[/\w]/g,e.textContent))return $(e),!0;if(!w[s]||ie[s]){if(!ie[s]&&Tt(s)&&(_.tagNameCheck instanceof RegExp&&D(_.tagNameCheck,s)||_.tagNameCheck instanceof Function&&_.tagNameCheck(s)))return!1;if(De&&!Q[s]){const T=ve(e)||e.parentNode,C=Jt(e)||e.childNodes;if(C&&T){const L=C.length;for(let N=L-1;N>=0;--N)T.insertBefore(Kt(C[N],!0),Qt(e))}}return $(e),!0}return e instanceof Ze&&!pn(e)||(s==="noscript"||s==="noembed"||s==="noframes")&&D(/<\/no(script|embed|frames)/i,e.innerHTML)?($(e),!0):(V&&e.nodeType===3&&(n=e.textContent,P([Ce,Le,Re],T=>{n=B(n,T," ")}),e.textContent!==n&&(W(d.removed,{element:e.cloneNode()}),e.textContent=n)),H("afterSanitizeElements",e,null),!1)},Et=function(e,n,s){if(it&&(n==="id"||n==="name")&&(s in y||s in fn))return!1;if(!(Me&&!ke[n]&&D(rn,n))){if(!(tt&&D(an,n))){if(!v[n]||ke[n]){if(!(Tt(e)&&(_.tagNameCheck instanceof RegExp&&D(_.tagNameCheck,e)||_.tagNameCheck instanceof Function&&_.tagNameCheck(e))&&(_.attributeNameCheck instanceof RegExp&&D(_.attributeNameCheck,n)||_.attributeNameCheck instanceof Function&&_.attributeNameCheck(n))||n==="is"&&_.allowCustomizedBuiltInElements&&(_.tagNameCheck instanceof RegExp&&D(_.tagNameCheck,s)||_.tagNameCheck instanceof Function&&_.tagNameCheck(s))))return!1}else if(!Oe[n]){if(!D(Qe,B(s,Ke,""))){if(!((n==="src"||n==="xlink:href"||n==="href")&&e!=="script"&&xt(s,"data:")===0&&st[e])){if(!(nt&&!D(sn,B(s,Ke,"")))){if(s)return!1}}}}}}return!0},Tt=function(e){return e.indexOf("-")>0},At=function(e){H("beforeSanitizeAttributes",e,null);const{attributes:n}=e;if(!n)return;const s={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:v};let T=n.length;for(;T--;){const C=n[T],{name:L,namespaceURI:N,value:Y}=C,se=S(L);let x=L==="value"?Y:Dt(Y);if(s.attrName=se,s.attrValue=x,s.keepAttr=!0,s.forceKeepAttr=void 0,H("uponSanitizeAttribute",e,s),x=s.attrValue,s.forceKeepAttr||(ze(L,e),!s.keepAttr))continue;if(!ot&&D(/\/>/i,x)){ze(L,e);continue}V&&P([Ce,Le,Re],wt=>{x=B(x,wt," ")});const _t=S(e.nodeName);if(Et(_t,se,x)){if(rt&&(se==="id"||se==="name")&&(ze(L,e),x=ln+x),k&&typeof ue=="object"&&typeof ue.getAttributeType=="function"&&!N)switch(ue.getAttributeType(_t,se)){case"TrustedHTML":{x=k.createHTML(x);break}case"TrustedScriptURL":{x=k.createScriptURL(x);break}}try{N?e.setAttributeNS(N,L,x):e.setAttribute(L,x),le(d.removed)}catch{}}}H("afterSanitizeAttributes",e,null)},gn=function u(e){let n=null;const s=gt(e);for(H("beforeSanitizeShadowDOM",e,null);n=s.nextNode();)H("uponSanitizeShadowNode",n,null),!yt(n)&&(n.content instanceof z&&u(n.content),At(n));H("afterSanitizeShadowDOM",e,null)};return d.sanitize=function(u){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=null,s=null,T=null,C=null;if(Ie=!u,Ie&&(u="<!-->"),typeof u!="string"&&!bt(u))if(typeof u.toString=="function"){if(u=u.toString(),typeof u!="string")throw ne("dirty is not a string, aborting")}else throw ne("toString is not a function");if(!d.isSupported)return u;if(Ne||Ue(e),d.removed=[],typeof u=="string"&&(re=!1),re){if(u.nodeName){const Y=S(u.nodeName);if(!w[Y]||ie[Y])throw ne("root node is forbidden and cannot be sanitized in-place")}}else if(u instanceof _e)n=ht("<!---->"),s=n.ownerDocument.importNode(u,!0),s.nodeType===1&&s.nodeName==="BODY"||s.nodeName==="HTML"?n=s:n.appendChild(s);else{if(!Z&&!V&&!q&&u.indexOf("<")===-1)return k&&pe?k.createHTML(u):u;if(n=ht(u),!n)return Z?null:pe?oe:""}n&&xe&&$(n.firstChild);const L=gt(re?u:n);for(;T=L.nextNode();)yt(T)||(T.content instanceof z&&gn(T.content),At(T));if(re)return u;if(Z){if(me)for(C=tn.call(n.ownerDocument);n.firstChild;)C.appendChild(n.firstChild);else C=n;return(v.shadowroot||v.shadowrootmode)&&(C=on.call(g,C,!0)),C}let N=q?n.outerHTML:n.innerHTML;return q&&w["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&D(je,n.ownerDocument.doctype.name)&&(N="<!DOCTYPE "+n.ownerDocument.doctype.name+`>
|
|
2
2
|
`+N),V&&P([Ce,Le,Re],Y=>{N=B(N,Y," ")}),k&&pe?k.createHTML(N):N},d.setConfig=function(){let u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ue(u),Ne=!0},d.clearConfig=function(){ee=null,Ne=!1},d.isValidAttribute=function(u,e,n){ee||Ue({});const s=S(u),T=S(e);return Et(s,T,n)},d.addHook=function(u,e){typeof e=="function"&&(U[u]=U[u]||[],W(U[u],e))},d.removeHook=function(u){if(U[u])return le(U[u])},d.removeHooks=function(u){U[u]&&(U[u]=[])},d.removeAllHooks=function(){U={}},d}var jt=Ve();return jt})})(Rt);const He=Rt.exports,Nn=":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)}",xn=Nn;He.addHook("afterSanitizeAttributes",function(t){"target"in t&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener"))});const kt=class{constructor(t){o.registerInstance(this,t),this.htmlElement=document.createElement("html"),this.setBody=i=>{var p;this.state="loading",this.styles=[],this.hoistedFontURLs=new Map,this.sanitizedBody="",document.querySelectorAll(".nylas-view-email-font").forEach(a=>{a.remove()}),(this.message?o.detectIfMessageIsHTML(this.message):o.detectHTMLOrPlainText(i))||(i=`<html><body>${o.parsePlainTextToHTML(i)}</body></html>`),this.htmlElement.innerHTML=i,this.detectDarkMode&&Mn(this.htmlElement),this.htmlElement.querySelectorAll("link").forEach(a=>{if(console.debug(`[nylas-view-email] Hoisting link: ${a.getAttribute("href")}`),a.getAttribute("rel")==="stylesheet"&&a.getAttribute("href")){const m=a.getAttribute("href");if(m){const r=new URL(m,window.location.href);(r.protocol==="https:"||r.protocol==="http:")&&this.hoistedFontURLs.set(r.href,r.href)}}}),this.htmlElement.querySelectorAll("style").forEach(a=>{a.innerHTML.split(`
|
|
3
3
|
`).forEach(m=>{const r=m.match(/@import url\((.*)\)/);if(r){const c=new URL(r[1],window.location.href);(c.protocol==="https:"||c.protocol==="http:")&&this.hoistedFontURLs.set(c.href,c.href)}}),a.innerHTML=a.innerHTML.replace("body",":host"),this.styles.push(a),a.remove()}),this.htmlElement.querySelectorAll("a").forEach(a=>{a.setAttribute("target","_blank")});const l=this.htmlElement.querySelector(".gmail_quote");if(l){const a=document.createElement("button");a.classList.add("nylas-view-email-toggle-button"),a.setAttribute("aria-label","Show quoted text"),a.innerText="...",(p=l.parentElement)==null||p.insertBefore(a,l)}this.sanitizedBody=He.sanitize(this.htmlElement.innerHTML),this.hoistedFontURLs.forEach((a,m)=>{const r=document.createElement("link");r.setAttribute("rel","stylesheet"),r.setAttribute("href",a),r.classList.add("nylas-view-email-font"),document.head.appendChild(r)}),this.state="ready"},this.handleMobileSize=()=>{var f,l,p,a;const i=Math.max(document.documentElement.clientWidth||0,window.innerWidth||0);if(i<=768){const m=(f=this.viewEmailElement)==null?void 0:f.getBoundingClientRect();if(m&&this.viewEmailElement&&this.parent&&m.width>i){const r=this.parent,c=r==null?void 0:r.getBoundingClientRect();o.debug("Parent width:",c==null?void 0:c.width,"Parent height:",c==null?void 0:c.height),o.debug("Parent client width:",r.clientWidth,"Parent client height:",r.clientHeight);const E=c.width/m.width,A=c.height/m.height,M=Math.min(E,A);o.debug("Scale:",M),this.viewEmailElement.style.setProperty("transform",`scale(${M})`),this.viewEmailElement.style.setProperty("transform-origin","top left"),this.viewEmailElement.style.setProperty("height",`${m.height*M}px`)}}else(l=this.viewEmailElement)==null||l.style.removeProperty("transform"),(p=this.viewEmailElement)==null||p.style.removeProperty("transform-origin"),(a=this.viewEmailElement)==null||a.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(){o.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;o.debug("[nylas-view-email] component loaded"),this.setBody(((t=this.message)==null?void 0:t.body)??"")}async componentDidLoad(){o.debug("[nylas-view-thread] Component did load"),this.handleMobileSize()}async messageChanged(){var t;o.debug("[nylas-view-thread] Message changed",{message:this.message}),this.setBody(((t=this.message)==null?void 0:t.body)??"")}handleScroll(){this.handleMobileSize()}viewEmailElementChanged(){var i;const t=(i=this.viewEmailElement)==null?void 0:i.querySelectorAll(".nylas-view-email-toggle-button");t&&t.forEach(f=>{f.addEventListener("click",()=>{var p;const l=(p=this.viewEmailElement)==null?void 0:p.querySelector(".gmail_quote");l&&l.classList.toggle("show")})})}render(){return console.debug("[nylas-view-email] render",{hoistedFontURLs:this.hoistedFontURLs}),o.h(o.Host,{key:"3990edd6afb19e04dc7871d41183affd1e7134e6"},this.state==="loading"&&o.h("div",null,"Loading..."),this.state==="ready"&&o.h(o.Fragment,null,this.styles.map(t=>o.h("style",null,He.sanitize(t.innerHTML))),o.h("div",{class:"view-email",part:"view-email",innerHTML:this.sanitizedBody,ref:t=>this.viewEmailElement=t})))}get host(){return o.getElement(this)}static get watchers(){return{message:["messageChanged"],viewEmailElement:["viewEmailElementChanged"]}}};kt.style=xn;const Dn=".sc-reply-all-icon-h{display:flex}",On=Dn,Mt=class{constructor(t){o.registerInstance(this,t),this.width="15",this.height="15"}render(){return o.h("svg",{key:"1e2e6bf4dea51463403e12df01b1b3df43d62f95",fill:"auto",width:this.width,height:this.height,viewBox:"0 0 1920 1920",xmlns:"http://www.w3.org/2000/svg"},o.h("path",{key:"c6d85fa609061715062b127308811c1a5a07b4be",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"}))}};Mt.style=On;const In=".sc-reply-icon-h{display:flex}",Pn=In,Nt=class{constructor(t){o.registerInstance(this,t),this.width="15",this.height="15"}render(){return o.h("svg",{key:"f744471514d7365ba202e5727ec4f03a56a22c23",fill:"auto",width:this.width,height:this.height,viewBox:"0 0 1920 1920",xmlns:"http://www.w3.org/2000/svg"},o.h("path",{key:"fb4fc16adc011cd856b9328e5c0f0fd307f1c53e",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"}))}};Nt.style=Pn;exports.forward_icon=St;exports.nylas_composer=Ct;exports.nylas_summarize_message_button=Be;exports.nylas_view_email=kt;exports.reply_all_icon=Mt;exports.reply_icon=Nt;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-8a536089.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:"903f17a34ba693444f6acd6ed74d063f4f4d7e66",xmlns:"http://www.w3.org/2000/svg",width:this.width,height:this.height,viewBox:"0 0 16 16",fill:"none"},e.h("path",{key:"4bcfaccf360904eb075863bbed35e62e9d7a25aa",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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-8a536089.cjs"),Z=require("./register-component-592986c5-5edf5835.cjs"),xe=require("./constants-12bd3c98-22fd56f2.cjs");require("react");require("react-dom");const Fe=".sc-google-logo-icon-h{display:flex}",Le=Fe,Se=class{constructor(e){t.registerInstance(this,e),this.width="24",this.height="24"}render(){return t.h("svg",{key:"1d8c7ecd21b0ed36e49e1054f58d3ca7fed9a349",width:this.width,height:this.height,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t.h("g",{key:"40cbdd9176ef43ba0612b091b18a085681fc64a9","clip-path":"url(#clip0_959_12452)"},t.h("path",{key:"a2dd6514041e159035e79a3a07920dec65bf33b5",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.h("path",{key:"4a5413075eee0849afb689ae7d13b64ea08523d1",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.h("path",{key:"c944b7612fdc201c7199095911dd077a8a401d85",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.h("path",{key:"46ed9d774d7dcb2694bb44226f9b136bfd38ff74",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.h("defs",{key:"4d531967607e72490963d525edc750d3a11ba468"},t.h("clipPath",{key:"f9935de12e3add4b525d1e19878852df6fae82f9",id:"clip0_959_12452"},t.h("rect",{key:"5a609aab9388969074380dd660e5f6736e322be7",width:24,height:24,fill:"white"}))))}};Se.style=Le;const Ee=".sc-microsoft-logo-icon-h{display:flex}",Oe=Ee,Te=class{constructor(e){t.registerInstance(this,e),this.width="22",this.height="22"}render(){return t.h("svg",{key:"485f75133b08cb6657f14baf540721c4f22c1c6c",width:this.width,height:this.height,viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t.h("path",{key:"3a0292b4518ace2c62fb8d27de67df3a31386124",d:"M0.043457 0.043457H10.4782V10.4782H0.043457V0.043457Z",fill:"#F35325"}),t.h("path",{key:"cd9f1cca76e2ce12ebfb79ca575996da7f87400c",d:"M11.5217 0.043457H21.9565V10.4782H11.5217V0.043457Z",fill:"#81BC06"}),t.h("path",{key:"ad7a106422f8a774cc3e1c3b290d32e7e9e690b5",d:"M0.043457 11.5217H10.4782V21.9565H0.043457V11.5217Z",fill:"#05A6F0"}),t.h("path",{key:"f7f84eac1bedf74460b744d3d2ce57dcc1943e06",d:"M11.5217 11.5217H21.9565V21.9565H11.5217V11.5217Z",fill:"#FFBA08"}))}};Te.style=Oe;const He=':host{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;width:inherit}.nylas-booking-type{width:inherit;display:flex;flex-direction:column;margin:1rem;border-radius:var(--nylas-border-radius-2x);border:1px solid var(--nylas-base-200)}.nylas-booking-type .header{padding:1rem;border-bottom:1px solid var(--nylas-base-200)}.nylas-booking-type .header h3{margin:0;font-size:1rem;font-weight:600;line-height:20px;color:var(--nylas-base-900);text-align:left}.nylas-booking-type .nylas-booking-type__dropdown{padding:1rem;display:flex;flex-direction:column;gap:4px}.nylas-booking-type .nylas-booking-type__dropdown span.nylas-booking-type__dropdown-label{display:flex;align-items:center;gap:4px;color:var(--nylas-base-800);margin:0.25rem 0 0 0;font-size:14px;font-weight:400;line-height:20px;text-align:left}.nylas-booking-type .nylas-booking-type__dropdown span.nylas-booking-type__dropdown-label tooltip-component{display:flex}.nylas-booking-type .nylas-booking-type__dropdown select-dropdown::part(sd_dropdown){width:100%}.nylas-booking-type .nylas-booking-type__dropdown select-dropdown::part(sd_dropdown-content){width:100%;max-width:unset}.nylas-booking-type .nylas-booking-type__dropdown select-dropdown::part(sd_dropdown-button){width:100%;display:flex;justify-content:space-between;align-items:center;border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius-2x)}.nylas-booking-type .nylas-booking-type__dropdown select-dropdown::part(sd_dropdown-button-selected-label){max-width:calc(100% - 2rem);font-family:var(--nylas-font-family);font-size:16px;line-height:24px}',Pe=He;var De=function(e,n,i,o){var r=arguments.length,a=r<3?n:o===null?o=Object.getOwnPropertyDescriptor(n,i):o,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,n,i,o);else for(var s=e.length-1;s>=0;s--)(l=e[s])&&(a=(r<3?l(a):r>3?l(n,i,a):l(n,i))||a);return r>3&&a&&Object.defineProperty(n,i,a),a},$=function(e,n){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,n)};const J=class{constructor(e){t.registerInstance(this,e),this.valueChanged=t.createEvent(this,"valueChanged",7),e.$hostElement$["s-ei"]?this.internals=e.$hostElement$["s-ei"]:(this.internals=e.$hostElement$.attachInternals(),e.$hostElement$["s-ei"]=this.internals),this.name="availability-method",this.selectedConfiguration=void 0,this.participantOptions=void 0,this.selectedBookingType=""}connectedCallback(){t.debug("nylas-booking-type","connectedCallback")}disconnectedCallback(){t.debug("nylas-booking-type","disconnectedCallback")}componentWillLoad(){t.debug("nylas-booking-type","componentWillLoad"),this.host.setAttribute("name",this.name)}componentDidLoad(){var n,i,o,r;t.debug("nylas-booking-type","componentDidLoad");const e=(r=(o=(i=(n=this.selectedConfiguration)==null?void 0:n.availability)==null?void 0:i.availability_rules)==null?void 0:o.availability_method)==null?void 0:r.toString();e&&typeof this.internals.setFormValue=="function"&&this.internals.setFormValue(e,"booking-calendar"),this.selectedBookingType=e||"collective",this.valueChanged.emit({value:this.selectedBookingType,name:this.name})}componentWillUpdate(){t.debug("nylas-booking-type","componentWillUpdate")}componentDidUpdate(){t.debug("nylas-booking-type","componentDidUpdate")}componentWillRender(){t.debug("nylas-booking-type","componentWillRender")}componentDidRender(){t.debug("nylas-booking-type","componentDidRender")}elementNameChangedHandler(e){t.debug("nylas-booking-type","elementNameChangedHandler",e),this.host.setAttribute("name",e)}nylasFormDropdownChangedHandler(e){t.debug("nylas-booking-type","nylasFormDropdownChangedHandler",e.detail);const n=i=>{const{value:o}=i.detail;o&&(this.selectedBookingType=o,this.internals.setFormValue(o,this.name))};this.valueChanged.emit({value:e.detail.value,name:this.name,valueChanged:n})}render(){var o,r,a,l,s;const e=[{label:"Standard booking",value:"collective"},{label:"Round-robin maximize fairness",value:"max-fairness"},{label:"Round-robin maximize availability",value:"max-availability"}],n=(l=(a=(r=(o=this.selectedConfiguration)==null?void 0:o.availability)==null?void 0:r.availability_rules)==null?void 0:a.availability_method)==null?void 0:l.toString(),i=this.participantOptions&&((s=this.participantOptions)==null?void 0:s.length)>0&&!!this.participantOptions[0].email&&!!this.participantOptions[0].name&&!!this.participantOptions[0].calendars&&this.participantOptions[0].calendars.length>0;return n||!i?null:t.h(t.Host,null,t.h("div",{class:"nylas-booking-type",part:"nbcp"},t.h("div",{class:"header",part:"nbcp__header"},t.h("h3",null,"Booking type")),t.h("div",{class:"nylas-booking-type__dropdown"},t.h("span",{class:"nylas-booking-type__dropdown-label"},"Choose what type of booking is used for this scheduler page.",t.h("tooltip-component",null,t.h("info-icon",{slot:"tooltip-icon"}),t.h("span",{slot:"tooltip-content"},t.h("strong",null,"Standard Booking"),t.h("br",null),"- Allows for 1:1 bookings, or n:1 bookings with additional or collective participants.",t.h("br",null),t.h("br",null),t.h("strong",null,"Round-Robin Maximize Fairness"),t.h("br",null),"- Rotates through the list of participants you select, displaying the participant with the least bookings.",t.h("br",null),t.h("br",null),t.h("strong",null,"Round-Robin Maximize Availability"),t.h("br",null),"- Rotates through the list of participants you select, prioritizing participants with the least bookings, but filling up as many time-slots as possible.",t.h("br",null)))),t.h("select-dropdown",{name:"booking-calendar",options:e,withSearch:!1,exportparts:"sd_dropdown: nbcp__dropdown, sd_dropdown-button: nbcp__dropdown-button, sd_dropdown-content: nbcp__dropdown-content",defaultSelectedOption:e.find(h=>h.value==n)??e[0]}))))}static get formAssociated(){return!0}get host(){return t.getElement(this)}static get watchers(){return{name:["elementNameChangedHandler"]}}};De([Z.RegisterComponent({name:"nylas-booking-type",stateToProps:new Map([["schedulerConfig.selectedConfiguration","selectedConfiguration"],["schedulerConfig.additionalParticipants","participantOptions"]]),eventToProps:{valueChanged:async(e,n)=>{const{valueChanged:i}=e.detail;i&&i(e)}},fireRegisterEvent:!0}),$("design:type",Function),$("design:paramtypes",[]),$("design:returntype",void 0)],J.prototype,"render",null);J.style=Pe;function Be({id:e,formState:n,activeTab:i,calendars:o,currentUser:r}){var a,l;switch(i){case"eventInfo":const s=n.title,h=n.description,m=parseInt(n.duration),w=n.location,C=n.conferencing;return t.h("div",{key:e},t.h("nylas-event-info",null,t.h("div",{slot:"inputs"},t.h("nylas-event-title",{name:"title",eventTitle:s,exportparts:"net, net__title, net__dropdown-content"}),t.h("nylas-event-duration",{name:"duration",eventDurationMinutes:m,exportparts:"ned, ned__dropdown, ned__dropdown-button, ned__dropdown-content, ned__input_dropdown, ned__input_dropdown-input, ned__input_dropdown-content"}),t.h("nylas-event-location",{name:"location",eventLocation:w,eventConferencing:C,userProvider:r.provider,exportparts:"nel, nel__location, nel__dropdown, nel__dropdown-button, nel__dropdown-content"}),t.h("nylas-event-description",{name:"description",eventDescription:h,exportparts:"nedesc, nedesc__textarea"}))));case"availability":const x=n.availability.openHours,S=n.availability.timezone?n.availability.timezone:Intl.DateTimeFormat().resolvedOptions().timeZone;return t.h("div",{key:e},t.h("nylas-participant-booking-calendars",{name:"participant-booking-calendars",participants:n.participants,calendars:o}),t.h("nylas-connected-calendars",{name:"connected-calendars",participants:n.participants}),t.h("nylas-availability-picker",{name:"availability",openHours:x,defaultTimezone:S,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"}));case"bookingOptions":return t.h("div",{key:e},t.h("nylas-custom-booking-flow",null,t.h("div",{slot:"inputs"},t.h("nylas-booking-confirmation-redirect",{name:"confirmation-redirect",redirectUrl:n.redirectUrl,exportparts:"nbcr, nbcr__header, nbcr__dropdown, nbcr__dropdown-button, nbcr__dropdown-content, nbcr__input-textfield"}))),t.h("nylas-buffer-time",{name:"buffer-time",buffer:n.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"}),t.h("nylas-event-limits",null,t.h("div",{slot:"inputs"},t.h("nylas-min-booking-notice",{name:"min-booking-notice",minBookingNotice:n.minBookingNotice,exportparts:"nmbn, nmbn__number-dropdown, nmbn__number-dropdown-button, nmbn__number-dropdown-content, nmbn__period-dropdown, nmbn__period-dropdown-button, nmbn__period-dropdown-content"}),t.h("nylas-limit-future-bookings",{name:"limit-future-bookings",availableDaysInFuture:n.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"}),t.h("nylas-min-cancellation-notice",{name:"min-cancellation-notice",minCancellationNotice:n.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"}),t.h("nylas-cancellation-policy",{name:"cancellation-policy",cancellationPolicy:n.cancellationPolicy,exportparts:"ncpolicy, ncpolicy__textarea"}))),t.h("nylas-timeslot-interval",{name:"timeslot-interval",eventDurationMinutes:parseInt(n.duration),exportparts:"nti, nti__header, nti__input-label, nti__dropdown, nti__dropdown-button, nti__dropdown-content"}),t.h("nylas-customize-booking-settings",{name:"customize-booking-settings",exportparts:"ncbs, ncbs__header, ncbs__settings, ncbs__settings-div, ncbs__additional_guests, ncbs__cancellation_options, ncbs__rescheduling_options"}));case"communications":return t.h("div",{key:e},t.h("div",{class:"tab-header"},t.h("h3",null,"Event communications"),t.h("p",null,"Set up automatic communications for your events.")),t.h("nylas-confirmation-email",{name:"confirmation-email-template",confirmationEmailTemplate:n.emailTemplate,isOpen:!((l=(a=n.reminders)==null?void 0:a.overrides)!=null&&l.length),participants:n.participants,exportparts:"nce, nce__tab-heading, nce__header, nce__body, nce__confirmation-email-toggle--container, nce__summary, nce__reminder-input_dropdown, nce__reminder-input_dropdown-input, nce__reminder-input_dropdown-content"}));case"participants":return t.h("div",{key:e},t.h("nylas-additional-participants",{name:"participants",eventParticipants:n.participants,exportparts:"nap__title, nap__subtitle, nap__content, nap__input_group, nap__input_wrapper, nap__input, nap__remove-participant"}),t.h("nylas-participants-custom-availability",{name:"participant-custom-availability",participants:n.participants,exportparts:"npca, npca__header, npca__content, npca__participant-container, npca__participant-title, npca__participant-toggle--container, npca__toggle-label, npca__toggle-input, npca__toggle-slider"}));case"bookingForm":const T=Object.entries(n.additionalFields).map(([F,f])=>({key:F,...f}));return t.h("div",{key:e},t.h("nylas-booking-form-config",{name:"additional-fields",additonalFields:T}))}}const Re='.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{height:554px;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;height:auto}}.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 .tabs.sc-nylas-editor-tabs .tab.hide.sc-nylas-editor-tabs{display:none}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tab-content.sc-nylas-editor-tabs{max-width:692px;overflow-y:auto}.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,.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{width:inherit}.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}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tab-content.sc-nylas-editor-tabs .tab-header.sc-nylas-editor-tabs{display:flex;flex-direction:column;margin:1rem 1rem 0.5rem;row-gap:4px}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tab-content.sc-nylas-editor-tabs .tab-header.sc-nylas-editor-tabs h3.sc-nylas-editor-tabs{margin:0;font-size:1rem;font-weight:600;line-height:20px;color:var(--nylas-base-900);text-align:left}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tab-content.sc-nylas-editor-tabs .tab-header.sc-nylas-editor-tabs p.sc-nylas-editor-tabs{margin:0;font-size:0.875rem;font-weight:400;line-height:20px;color:var(--nylas-base-600);text-align:left}.footer.sc-nylas-editor-tabs{display:flex;justify-content:space-between;align-items:center;gap:1rem;min-height:80px;padding:0 1rem;border-top:1px solid var(--nylas-base-200)}@media screen and (max-width: 768px){.footer.sc-nylas-editor-tabs{flex-direction:column;height:auto}}@media screen and (max-width: 768px){.footer.sc-nylas-editor-tabs .preview.sc-nylas-editor-tabs{margin-top:1rem;width:100%}}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs{display:flex;justify-content:flex-end;align-items:center;justify-self:flex-end;gap:1rem}@media screen and (max-width: 768px){.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs{flex-direction:column-reverse;width:100%}}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs p.sc-nylas-editor-tabs{max-width:524px}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs p.unsaved-changes.sc-nylas-editor-tabs{color:var(--nylas-base-600)}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs p.saved-changes.sc-nylas-editor-tabs{color:var(--nylas-success)}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs p.error.sc-nylas-editor-tabs{color:var(--nylas-error)}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs p.error-full-width.sc-nylas-editor-tabs{max-width:660px}@media screen and (max-width: 768px){.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs button-component.sc-nylas-editor-tabs{width:100%}}.footer.sc-nylas-editor-tabs .buttons.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 .buttons.sc-nylas-editor-tabs button.sc-nylas-editor-tabs:hover{background:var(--nylas-base-600)}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs button.sc-nylas-editor-tabs:active{background:var(--nylas-base-800)}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs button.sc-nylas-editor-tabs:disabled{background:var(--nylas-base-300);cursor:not-allowed}.footer.sc-nylas-editor-tabs .buttons.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}',Ne=Re;var Ie=function(e,n,i,o){var r=arguments.length,a=r<3?n:o===null?o=Object.getOwnPropertyDescriptor(n,i):o,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,n,i,o);else for(var s=e.length-1;s>=0;s--)(l=e[s])&&(a=(r<3?l(a):r>3?l(n,i,a):l(n,i))||a);return r>3&&a&&Object.defineProperty(n,i,a),a},A=function(e,n){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,n)};const W=class{constructor(e){t.registerInstance(this,e),this.schedulerConfigChanged=t.createEvent(this,"schedulerConfigChanged",7),this.cancelButtonClick=t.createEvent(this,"cancelButtonClick",7),this.formSubmitted=t.createEvent(this,"formSubmitted",7),this.previewButtonClicked=t.createEvent(this,"previewButtonClicked",7),this.schedulerEditorFormUpdated=t.createEvent(this,"schedulerEditorFormUpdated",7),this.setError=n=>{this.error=n.message},this.formSubmissionHandler=async n=>{var G,K,Q,X,Y,ee,te,ne,ie,ae,oe,se,re,le,de,ce;if(n.preventDefault(),this.formSubmitted.emit(),!this.formRef.checkValidity()){this.error=this.formRef.validationMessage||"Please fix the form errors.";return}this.isLoading=!0,this.hasUnsavedChanges=!1;const o=this.updateFormState(),{title:r,description:a,duration:l,availability:s,bookingCalendar:h,location:m,bookingType:w,buffer:C,availableDaysInFuture:x,minCancellationNotice:S,minBookingNotice:T,cancellationPolicy:F,timeslotInterval:f,additionalGuestsHidden:D,hideCancellationOptions:B,hideReschedulingOptions:R,participants:g,participantOpenHours:b,additionalFields:N,participantCalendars:y,conferencing:I,participantBookingCalendars:p,reminders:z,emailTemplate:M,redirectUrl:U,availabilityMethod:E}=o,c=((K=(G=this.selectedConfiguration)==null?void 0:G.participants)==null?void 0:K.find(d=>d.is_organizer))||(g==null?void 0:g.find(d=>d.is_organizer)),v=y&&(c!=null&&c.email)?y[c==null?void 0:c.email]:[],O=((Q=c==null?void 0:c.booking)==null?void 0:Q.calendar_id)||h,H=l?parseInt(l):30,L=g&&(g==null?void 0:g.length)>0?g:[{name:(c==null?void 0:c.name)??((X=this.currentUser)==null?void 0:X.name)??"",email:(c==null?void 0:c.email)??((Y=this.currentUser)==null?void 0:Y.email)??"",is_organizer:!0,timezone:(s==null?void 0:s.timezone)??Intl.DateTimeFormat().resolvedOptions().timeZone,availability:{calendar_ids:v.length?v:["primary"],open_hours:[]},booking:{calendar_id:h&&h!==""?h:"primary"}}],P={...((ee=this.selectedConfiguration)==null?void 0:ee.id)&&{id:this.selectedConfiguration.id},version:((te=this.selectedConfiguration)==null?void 0:te.version)??"1.0.0",availability:{duration_minutes:H,interval_minutes:(f==null?void 0:f.interval)??H,round_to:f==null?void 0:f.roundTo,availability_rules:{availability_method:E||(((ae=(ie=(ne=this.selectedConfiguration)==null?void 0:ne.availability)==null?void 0:ie.availability_rules)==null?void 0:ae.availability_method)??"collective"),buffer:C||{before:0,after:0},default_open_hours:(s==null?void 0:s.openHours)??((re=(se=(oe=this.selectedConfiguration)==null?void 0:oe.availability)==null?void 0:se.availability_rules)==null?void 0:re.default_open_hours)??xe.DEFAULT_OPEN_HOURS,round_robin_group_id:((ce=(de=(le=this.selectedConfiguration)==null?void 0:le.availability)==null?void 0:de.availability_rules)==null?void 0:ce.round_robin_group_id)??""}},participants:[...L==null?void 0:L.map(d=>{var he,be,pe,ue,ye,me,fe,ge,_e,ve,we,ke,Ce;return d.is_organizer?{name:d.name??"",email:d.email,is_organizer:!0,timezone:((be=(he=b==null?void 0:b[d.email])==null?void 0:he[0])==null?void 0:be.timezone)??((ye=(ue=(pe=d.availability)==null?void 0:pe.open_hours)==null?void 0:ue[0])==null?void 0:ye.timezone)??Intl.DateTimeFormat().resolvedOptions().timeZone,availability:{calendar_ids:y!=null&&y[d.email]?y==null?void 0:y[d.email]:v!=null&&v.length?v:["primary"],open_hours:(b==null?void 0:b[d.email])??((me=d.availability)==null?void 0:me.open_hours)??[]},booking:{calendar_id:p!=null&&p[d.email]?p==null?void 0:p[d.email]:O||"primary"}}:{...d,timezone:((ge=(fe=b==null?void 0:b[d.email])==null?void 0:fe[0])==null?void 0:ge.timezone)??((we=(ve=(_e=d.availability)==null?void 0:_e.open_hours)==null?void 0:ve[0])==null?void 0:we.timezone)??Intl.DateTimeFormat().resolvedOptions().timeZone,availability:d.availability?{calendar_ids:(y==null?void 0:y[d.email])??((ke=d.availability)==null?void 0:ke.calendar_ids)??["primary"],open_hours:(b==null?void 0:b[d.email])??((Ce=d.availability)==null?void 0:Ce.open_hours)??[]}:void 0,booking:p!=null&&p[d.email]?{calendar_id:p==null?void 0:p[d.email]}:(d==null?void 0:d.booking)??void 0}})],event_booking:{title:(r==null?void 0:r.toString())??"",description:(a==null?void 0:a.toString())??"",location:(m==null?void 0:m.toString())??"",booking_type:(w==null?void 0:w.toString())??"booking",timezone:(s==null?void 0:s.timezone)??Intl.DateTimeFormat().resolvedOptions().timeZone,conferencing:I,reminders:z},scheduler:{cancellation_policy:F??"",available_days_in_future:x??30,min_cancellation_notice:S??0,min_booking_notice:T??60,hide_additional_guests:D??!1,hide_cancellation_options:B??!1,hide_rescheduling_options:R??!1,additional_fields:N,email_template:M,confirmation_redirect_url:U}},_=t.mergeDeep(P,this.selectedConfiguration),u=this.action==="create"?_:P;this.isConfigRoundRobin(u)&&(u.participants=u.participants.map(d=>({...d,is_organizer:void 0})));const k=d=>{this.isLoading=!1,this.changesSaved=!0,setTimeout(()=>{this.changesSaved=!1},5e3)};this.checkForClientSideErrors(u)||this.schedulerConfigChanged.emit({config:u,resetLoadingState:k,setError:this.setError,action:this.action})},this.isConfigRoundRobin=n=>{var i,o,r,a;return((o=(i=n.availability)==null?void 0:i.availability_rules)==null?void 0:o.availability_method)==="max-availability"||((a=(r=n.availability)==null?void 0:r.availability_rules)==null?void 0:a.availability_method)==="max-fairness"},this.checkForClientSideErrors=n=>{var a;let i=!1,o="";const r=(a=n.scheduler)==null?void 0:a.additional_fields;return r&&(o="Booking form error: ",Object.entries(r).forEach(l=>{const s=l[1];if(s.label===""){o+=`Label is required for field of type ${s.type}.`,i=!0;return}if(s.options){for(const h of s.options)if(h===""){o+=`Empty option detected inside ${s.label} of type ${s.type}.`,i=!0;break}}})),i&&(this.isLoading=!1,this.setError(new Error(o))),i},this.calendars=void 0,this.selectedConfiguration=void 0,this.currentUser=void 0,this.schedulerPreviewLink="",this.mode="app",this.hideEditorTabs=[],this.action="create",this.activeTab="eventInfo",this.isLoading=!1,this.hasUnsavedChanges=!1,this.changesSaved=!1,this.formState={},this.error=""}configChangedHandler(e){t.debug("[nylas-editor-tabs]","configChangedHandler",e,this.selectedConfiguration),this.formState={...this.getFormStateFromConfig(e)},e.id?this.action="edit":this.action="create"}userChangedHandler(e){t.debug("[nylas-editor-tabs]","userChangedHandler",e),e&&(this.formState={...this.getFormStateFromConfig(this.selectedConfiguration)})}connectedCallback(){t.debug("[nylas-editor-tabs]","connectedCallback")}componentWillLoad(){t.debug("[nylas-editor-tabs]","componentWillLoad"),this.formState=this.getFormStateFromConfig(this.selectedConfiguration)}componentDidLoad(){var n;t.debug("[nylas-editor-tabs]","componentDidLoad");const e=(n=this.host.querySelector("button.tab:not(.hide)"))==null?void 0:n.name;e&&(this.activeTab=e)}disconnectedCallback(){t.debug("[nylas-editor-tabs]","disconnectedCallback")}handleValueChanged(e){t.debug("[nylas-editor-tabs]","handleValueChanged",e);const{name:n,value:i}=e.detail;this.setFormState(i,n),this.formState={...this.formState},this.hasUnsavedChanges=!0,this.error="",this.schedulerEditorFormUpdated.emit({value:e.detail.value,name:e.detail.name})}getFormStateFromConfig(e){var i,o,r,a,l,s,h,m,w,C,x,S,T,F,f,D,B,R,g,b,N,y,I,p,z,M,U,E,c,v,O,H,L,P;let n=(i=e==null?void 0:e.participants)==null?void 0:i.find(_=>_.is_organizer);return!n&&((r=(o=e==null?void 0:e.availability)==null?void 0:o.availability_rules)==null?void 0:r.availability_method)!=="collective"&&(n=(a=e==null?void 0:e.participants)==null?void 0:a.find(_=>{var u;return _.email===((u=this.currentUser)==null?void 0:u.email)}),n&&(n.is_organizer=!0)),{title:((l=e==null?void 0:e.event_booking)==null?void 0:l.title)??"",description:((s=e==null?void 0:e.event_booking)==null?void 0:s.description)??"",duration:((m=(h=e==null?void 0:e.availability)==null?void 0:h.duration_minutes)==null?void 0:m.toString())??"30",availability:{timezone:((w=e==null?void 0:e.event_booking)==null?void 0:w.timezone)??Intl.DateTimeFormat().resolvedOptions().timeZone,openHours:((x=(C=e==null?void 0:e.availability)==null?void 0:C.availability_rules)==null?void 0:x.default_open_hours)??xe.DEFAULT_OPEN_HOURS},additionalFields:((S=e==null?void 0:e.scheduler)==null?void 0:S.additional_fields)??{},conferencing:((T=e==null?void 0:e.event_booking)==null?void 0:T.conferencing)??{},calendarIds:((F=n==null?void 0:n.availability)==null?void 0:F.calendar_ids)??[],participants:(e==null?void 0:e.participants)??[],bookingCalendar:((f=n==null?void 0:n.booking)==null?void 0:f.calendar_id)??(n==null?void 0:n.email)??"",location:((D=e==null?void 0:e.event_booking)==null?void 0:D.location)??"",bookingType:((B=e==null?void 0:e.event_booking)==null?void 0:B.booking_type)??"booking",buffer:((g=(R=e==null?void 0:e.availability)==null?void 0:R.availability_rules)==null?void 0:g.buffer)??{before:0,after:0},cancellationPolicy:((b=e==null?void 0:e.scheduler)==null?void 0:b.cancellation_policy)??"",availableDaysInFuture:((N=e==null?void 0:e.scheduler)==null?void 0:N.available_days_in_future)??30,minCancellationNotice:((y=e==null?void 0:e.scheduler)==null?void 0:y.min_cancellation_notice)??0,minBookingNotice:((I=e==null?void 0:e.scheduler)==null?void 0:I.min_booking_notice)??60,timeslotInterval:{interval:((p=e==null?void 0:e.availability)==null?void 0:p.interval_minutes)??((z=e==null?void 0:e.availability)==null?void 0:z.duration_minutes),roundTo:(M=e==null?void 0:e.availability)==null?void 0:M.round_to},additionalGuestsHidden:((U=e==null?void 0:e.scheduler)==null?void 0:U.hide_additional_guests)??!1,hideCancellationOptions:((E=e==null?void 0:e.scheduler)==null?void 0:E.hide_cancellation_options)??!1,hideReschedulingOptions:((c=e==null?void 0:e.scheduler)==null?void 0:c.hide_rescheduling_options)??!1,participantBookingCalendars:((v=e==null?void 0:e.participants)==null?void 0:v.reduce((_,u)=>{var k,j;return(k=u.booking)!=null&&k.calendar_id&&(_[u.email]=(j=u.booking)==null?void 0:j.calendar_id),_}))??{},participantCalendars:((O=e==null?void 0:e.participants)==null?void 0:O.reduce((_,u)=>{var k;return _[u.email]=(k=u.availability)==null?void 0:k.calendar_ids,_},{}))??{},reminders:(H=e==null?void 0:e.event_booking)==null?void 0:H.reminders,emailTemplate:(L=e==null?void 0:e.scheduler)==null?void 0:L.email_template,redirectUrl:(P=e==null?void 0:e.scheduler)==null?void 0:P.confirmation_redirect_url}}setFormState(e,n){switch(n){case"title":this.formState.title=e.toString();break;case"description":this.formState.description=e.toString();break;case"duration":this.formState.duration=e.toString();break;case"availability":this.formState.availability=JSON.parse(e.toString());break;case"participants":this.formState.participants=JSON.parse(e.toString());break;case"booking-calendar":this.formState.bookingCalendar=e.toString();break;case"participant-booking-calendars":this.formState.participantBookingCalendars=JSON.parse(e.toString());break;case"location":this.formState.location=e.toString();break;case"conference":this.formState.conferencing=JSON.parse(e.toString());break;case"booking-type":this.formState.bookingType=e.toString();break;case"buffer-time":this.formState.buffer=JSON.parse(e.toString());break;case"limit-future-bookings":this.formState.availableDaysInFuture=parseInt(e.toString());break;case"min-cancellation-notice":this.formState.minCancellationNotice=parseInt(e.toString());break;case"min-booking-notice":this.formState.minBookingNotice=parseInt(e.toString());break;case"cancellation-policy":this.formState.cancellationPolicy=e.toString();break;case"timeslot-interval":this.formState.timeslotInterval=JSON.parse(e.toString());break;case"customize-booking-settings":const i=JSON.parse(e.toString());this.formState.additionalGuestsHidden=i.additionalGuestsHidden,this.formState.hideCancellationOptions=i.hideCancellationOptions,this.formState.hideReschedulingOptions=i.hideReschedulingOptions;break;case"participant-custom-availability":const o=JSON.parse(e.toString());this.formState.participantOpenHours=o;break;case"additional-fields":this.formState.additionalFields=e;break;case"connected-calendars":this.formState.participantCalendars=JSON.parse(e.toString());break;case"confirmation-email-template":this.formState.emailTemplate=JSON.parse(e.toString());break;case"reminder-overrides":this.formState.reminders={overrides:JSON.parse(e.toString())};break;case"confirmation-redirect":this.formState.redirectUrl=e.toString();break;case"availability-method":this.formState.availabilityMethod=e.toString();break}this.schedulerEditorFormUpdated.emit({value:e,name:n})}updateFormState(){return new FormData(this.formRef).forEach((n,i)=>{this.setFormState(n,i)}),this.formState={...this.formState},this.formState}setActiveTab(e,n){e.preventDefault(),this.updateFormState(),this.activeTab=n}hideTab(e){var n;return((n=this.hideEditorTabs)==null?void 0:n.includes(e))||!1}render(){var e,n;return t.debug("[nylas-editor-tabs]","render",this.formState),t.h(t.Host,{key:"5f7372d88ae1d3dacfffbb620a9de2e79adda2b6"},t.h("form",{key:"8be826e8178f6667455bece8f950613c0456fc12",onSubmit:this.formSubmissionHandler,class:"scheduler-editor",ref:i=>this.formRef=i,noValidate:!0},this.mode==="app"?t.h("div",{class:"form-contents"},t.h("div",{class:"tabs"},t.h("button",{name:"eventInfo",class:{tab:!0,active:this.activeTab=="eventInfo",hide:this.hideTab("eventInfo")},part:"editortab__event-info",onClick:i=>this.setActiveTab(i,"eventInfo")},t.h("calendar-info-icon",{width:"16",height:"16"}),"Event info"),t.h("button",{name:"availability",class:{tab:!0,active:this.activeTab=="availability",hide:this.hideTab("availability")},part:"editortab__availability",onClick:i=>this.setActiveTab(i,"availability")},t.h("calendar-patterns-icon",{width:"16",height:"16"}),"Availability"),t.h("button",{name:"participants",class:{tab:!0,active:this.activeTab=="participants",hide:this.hideTab("participants")},part:"editortab__participants",onClick:i=>this.setActiveTab(i,"participants")},t.h("people-icon",{width:"16",height:"16"}),"Participants"),t.h("button",{name:"bookingOptions",class:{tab:!0,active:this.activeTab=="bookingOptions",hide:this.hideTab("bookingOptions")},part:"editortab__booking-options",onClick:i=>this.setActiveTab(i,"bookingOptions")},t.h("flow-icon",{width:"16",height:"16"}),"Booking options"),t.h("button",{name:"bookingForm",class:{tab:!0,active:this.activeTab=="bookingForm",hide:this.hideTab("bookingForm")},part:"editortab__booking-form",onClick:i=>this.setActiveTab(i,"bookingForm")},this.activeTab=="bookingForm"?t.h("calendar-agenda-fill-icon",{width:"16",height:"16"}):t.h("calendar-agenda-icon",{width:"16",height:"16"}),"Booking form"),t.h("button",{name:"communications",class:{tab:!0,active:this.activeTab=="communications"},onClick:i=>this.setActiveTab(i,"communications")},this.activeTab=="communications"?t.h("envelope-fill-icon",{width:"16",height:"16"}):t.h("envelope-icon",{width:"16",height:"16"}),"Communications")),t.h("div",{class:"tab-content"},t.h(Be,{formState:this.formState,activeTab:this.activeTab,currentUser:this.currentUser,calendars:this.calendars,id:((e=this.selectedConfiguration)==null?void 0:e.id)??"new"}))):t.h("div",{key:(n=this.selectedConfiguration)==null?void 0:n.id},t.h("slot",null)),t.h("div",{key:"6cf0a5f270552a0fb91b9ead274c93b1bfc086a3",class:"footer",part:"editor__footer"},t.h("div",{key:"73c5f3708e16589f8546692a1b7df791cc53363b",class:"preview",part:"editor__footer-preview"},this.schedulerPreviewLink!==""&&this.action==="edit"&&t.h("button-component",{type:"button",disabled:this.isLoading,clickHandler:i=>{i.preventDefault(),this.previewButtonClicked.emit(this.host).defaultPrevented||window.open(t.parsePreviewLink(this.schedulerPreviewLink,this.selectedConfiguration),"_blank")},variant:"basic"},"Preview")),t.h("div",{key:"8a4ef95bc9779438601c853d117b588a586606f5",class:"buttons",part:"editor__footer-buttons"},t.h("p",{key:"5e09184856da0e5eb851e34d673addc921c6bc85",class:{"unsaved-changes":this.hasUnsavedChanges&&!this.changesSaved,"saved-changes":this.changesSaved,error:this.error!=="","error-full-width":this.error!==""&&this.action==="create"}},this.error!==""?this.error:"",this.error==""&&this.hasUnsavedChanges&&!this.changesSaved?"Unsaved changes":this.error==""&&this.changesSaved?"Changes saved!":""),t.h("button-component",{key:"f1e201a19bef90ff09cd274d4cee79457b7dfd81",type:"button",disabled:this.isLoading,clickHandler:i=>{i.preventDefault(),this.cancelButtonClick.emit(),this.error=""},variant:"basic",part:"editor__footer-cancel"},"Back"),t.h("button-component",{key:"7f37733c28d27f9f202a917ec155d2b3b0b53b2a",type:"submit",disabled:this.isLoading,part:"editor__footer-cta"},this.isLoading?t.h("span",null,"Saving",t.h("loading-icon",null)," "):this.action=="create"?"Create":"Save changes")))))}get host(){return t.getElement(this)}static get watchers(){return{selectedConfiguration:["configChangedHandler"],currentUser:["userChangedHandler"]}}};Ie([Z.RegisterComponent({name:"nylas-editor-tabs",stateToProps:new Map([["schedulerConfig.calendars","calendars"],["schedulerConfig.selectedConfiguration","selectedConfiguration"],["schedulerConfig.currentUser","currentUser"],["schedulerConfig.hideEditorTabs","hideEditorTabs"]]),eventToProps:{schedulerConfigChanged:async(e,n)=>{const{resetLoadingState:i,setError:o,action:r,config:a}=e.detail,l=s=>{const[h,m]=s;!h&&m&&o&&o(m),i&&i(e)};if(r==="edit"){const s=await n.schedulerConfig.updateConfiguration(a);l(s)}else{const s=await n.schedulerConfig.createConfiguration(a);l(s)}},cancelButtonClick:async(e,n)=>{n.schedulerConfigStore.state.action=null},previewButtonClicked:async(e,n)=>{t.debug("[nylas-editor-tabs]","previewButtonClicked",n)},formSubmitted:async(e,n)=>{t.debug("[nylas-editor-tabs]","formSubmitted",n)},schedulerEditorFormUpdated:async(e,n)=>{t.debug("[nylas-editor-tabs]","schedulerEditorFormUpdated",e)}},localPropsToProp:new Map([["schedulerPreviewLink","schedulerPreviewLink"]]),fireRegisterEvent:!0}),A("design:type",Function),A("design:paramtypes",[]),A("design:returntype",void 0)],W.prototype,"render",null);W.style=Ne;const ze=':host{display:grid;grid-auto-flow:row;width:100%;font-family:inherit;font-optical-sizing:auto;--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}.header{display:flex;align-items:center;justify-content:space-between;margin-bottom:1rem;gap:1rem}@media screen and (max-width: 768px){.header{flex-direction:column;gap:0.5rem;align-items:unset}}.header h2{margin:0;font-size:1.25rem;color:var(--nylas-base-900);font-weight:600}.header p{margin:0;font-size:1rem;color:var(--nylas-base-700)}.header .actions{justify-self:end}@media screen and (max-width: 768px){.header .actions{width:100%}}.configurations{border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius-2x);background:var(--nylas-base-0);height:100%;display:flex;flex-direction:column;position:relative;overflow-y:auto}.configurations table{width:100%;border-spacing:0;border-collapse:collapse;font-family:inherit;height:max-content}.configurations table.no-configurations{height:100%}.configurations table tr{color:var(--nylas-base-800);border-bottom:1px solid var(--nylas-base-200);font-family:inherit}.configurations table tr.hide{display:none}.configurations table th{font-weight:600;text-transform:uppercase;font-size:14px;line-height:20px}.configurations table th.actions-header{text-align:right}.configurations table tr.no-configurations td>div{display:flex;height:100%;justify-content:center;align-items:center;flex-direction:column;padding:var(--nylas-border-radius-3x)}.configurations table tr.no-configurations td>div h3{margin:0 0 1rem 0;color:var(--nylas-base-700)}.configurations table tr.no-configurations td>div p{margin:0 0 1rem 0;color:var(--nylas-base-600)}.configurations table tr.no-configurations td>div calendar-icon{margin-bottom:1rem;color:var(--nylas-base-200)}.configurations table th,.configurations table td{text-align:left;padding:1rem;font-family:inherit}.configurations table .actions{text-align:right}.configurations table .actions{display:flex;justify-content:flex-end;gap:1rem}@media screen and (max-width: 768px){.configurations table .actions{flex-direction:column;gap:0.5rem}}.configurations table .title{width:100%;max-width:300px}@media screen and (max-width: 768px){.configurations table .title{max-width:96px}}.configurations table .title div{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.configurations table .title div.config-event-title{font-weight:600}.configurations table .title div.config-event-description{font-size:0.75rem}.configurations .pagination{padding:1rem;position:sticky;top:100%;display:flex;justify-content:flex-end;gap:0.5rem;background:white;width:calc(100% - 2rem);z-index:2}.configurations .pagination td.arrows{display:flex;justify-content:flex-end;gap:0.5rem}.configurations .pagination button{display:flex;flex-direction:row;justify-content:center;align-items:center;height:3vh;width:3vh;min-width:3em;min-height:3em;cursor:pointer;border-radius:var(--nylas-border-radius-2x);border:1px solid var(--nylas-base-300);background-color:transparent;color:var(--nylas-base-800);cursor:pointer}.configurations .pagination button:hover:not(:disabled){border:1px solid var(--nylas-primary)}.configurations .pagination button:active{border:1px solid var(--nylas-base-800)}.configurations .pagination button:disabled{border:1px solid var(--nylas-base-100);background-color:transparent;color:var(--nylas-base-300);cursor:not-allowed}.configurations .pagination button.right{transform:rotate(180deg)}.error-container{margin-top:1.5rem}.error-container .error{color:var(--nylas-error);padding:0.5rem 0;margin:1rem 0 0}button-component#copy button{width:108px}select-dropdown{width:auto}select-dropdown::part(sd_dropdown-button){display:block;height:48px;padding:0px 16px 8px}@media screen and (max-width: 768px){select-dropdown::part(sd_dropdown-button){width:92px}}select-dropdown::part(sd_dropdown-content){width:120px;right:0}select-dropdown::part(sd_dropdown-labelhtml){display:flex;gap:0.5rem;align-items:center;color:var(--nylas-base-900)}select-dropdown::part(sd_dropdown-labelhtml):hover{color:var(--nylas-primary)}',Me=ze;var Ue=function(e,n,i,o){var r=arguments.length,a=r<3?n:o===null?o=Object.getOwnPropertyDescriptor(n,i):o,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,n,i,o);else for(var s=e.length-1;s>=0;s--)(l=e[s])&&(a=(r<3?l(a):r>3?l(n,i,a):l(n,i))||a);return r>3&&a&&Object.defineProperty(n,i,a),a},V=function(e,n){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,n)};const q=class{constructor(e){t.registerInstance(this,e),this.initListConfigurations=t.createEvent(this,"initListConfigurations",7),this.createButtonClick=t.createEvent(this,"createButtonClick",7),this.editButtonClick=t.createEvent(this,"editButtonClick",7),this.deleteButtonClick=t.createEvent(this,"deleteButtonClick",7),this.configurations=[],this.schedulerPreviewLink="",this.listConfigurationsNextCursor=void 0,this.state="loading",this.error="",this.currentCursor=null,this.previousCursors=[],this.disableNextPageButton=!1}listConfigurationsNextCursorChangedHandler(e,n){if(!e||e===n){e===null&&(this.disableNextPageButton=!0);return}this.disableNextPageButton=!1,this.currentCursor=e}connectedCallback(){t.debug("[nylas-list-configurations]","connectedCallback")}componentWillLoad(){t.debug("[nylas-list-configurations]","componentWillLoad"),this.configurations&&this.configurations.length>0&&(this.state="loaded")}componentDidLoad(){t.debug("[nylas-list-configurations]","componentDidLoad"),this.initListConfigurations.emit({host:this.host})}disconnectedCallback(){t.debug("[nylas-list-configurations]","disconnectedCallback")}async handleNylasFormDropdownChanged(e){t.debug("[nylas-list-configurations]","handleNylasFormDropdownChanged",e.detail);const{value:n}=e.detail,[i,o]=n.split("-");switch(e.preventDefault(),i){case"delete":this.deleteButtonClick.emit({host:this.host,configuration:this.configurations[o]});break;case"preview":window.open(t.parsePreviewLink(this.schedulerPreviewLink,this.configurations[o]),"_blank");break;case"copy":await navigator.clipboard.writeText(t.parsePreviewLink(this.schedulerPreviewLink,this.configurations[o]));break}}async getState(){return this.state}async setState(e){this.state=e}async setError(e){this.error=e}getDurationString(e){const n=Math.floor(e/60),i=e%60;return`${n||""} ${n?`${n>1?"hours":"hour"}`:""} ${i||""} ${i?`${i>1?"mins":"min"}`:""}`}getActionLabelHTML(e){const n={display:"inline-flex",alignItems:"center",gap:"0.5rem"},i={color:"var(--nylas-error)"};switch(e){case"preview":return t.h("span",{style:n},t.h("eye-icon",{width:"16",height:"16"}),"Preview");case"copy":return t.h("span",{style:n},t.h("copy-icon",{width:"16",height:"16"}),"Copy");case"delete":return t.h("span",{style:{...n,...i}},t.h("delete-icon",{width:"15",height:"17"}),"Delete");default:return""}}previousPageClickedHandler(){if(this.previousCursors.length===0)return;this.currentCursor=this.previousCursors.pop()||null;const e=this.previousCursors[this.previousCursors.length-1]||void 0;this.initListConfigurations.emit({host:this.host,cursor:e})}nextPageClickedHandler(){this.currentCursor&&(this.previousCursors=[...this.previousCursors,this.currentCursor],this.initListConfigurations.emit({host:this.host,cursor:this.currentCursor}))}render(){return t.h(t.Host,null,t.h("div",{class:"header"},t.h("div",{class:"description"},t.h("h2",null,"All scheduling pages"),t.h("p",null,"Create, edit and manage all your scheduling pages.")),this.configurations&&this.configurations.length>0&&t.h("div",{class:"actions"},t.h("button-component",{clickHandler:()=>{this.createButtonClick.emit(this.host)}},"Create new"))),t.h("div",{class:"configurations"},t.h("table",{class:{"no-configurations":this.state!=="loading"&&(!this.configurations||this.configurations.length===0)}},t.h("tr",{class:{hide:this.state==="loading"||this.configurations&&this.configurations.length===0}},t.h("th",null,"Scheduling page title"),t.h("th",null,"Duration"),t.h("th",{class:"actions-header"},"Actions")),this.state==="loading"&&t.h("tr",{class:"no-configurations"},t.h("td",{colSpan:3},t.h("div",null,t.h("h3",null,"Loading..."),t.h("p",null,"Please wait while we fetch the scheduling pages")))),this.state!=="loading"&&(!this.configurations||this.configurations.length===0)&&t.h("tr",{class:"no-configurations"},t.h("td",{colSpan:3},t.h("div",null,t.h("calendar-icon",{width:"48",height:"48"}),t.h("h3",null,"No scheduling pages found"),t.h("p",null,"Get started with creating your first scheduling page"),t.h("button-component",{clickHandler:()=>{this.createButtonClick.emit(this.host)}},"Create new")))),this.state!=="loading"&&this.configurations.map((e,n)=>t.h("tr",{key:e.id},t.h("td",null,t.h("div",{class:"title"},t.h("div",{class:"config-event-title",title:e.event_booking.title},e.event_booking.title),t.h("div",{class:"config-event-description"},e.event_booking.description))),t.h("td",null,t.h("div",{class:"duration"},this.getDurationString(e.availability.duration_minutes))),t.h("td",null,t.h("div",{class:"actions"},t.h("button-component",{variant:"basic",key:`edit-${n}`,clickHandler:i=>{i.preventDefault(),this.editButtonClick.emit({host:this.host,configuration:e})}},t.h("edit-icon",{width:"16",height:"16"}),"Edit"),t.h("select-dropdown",{name:"actions",options:[{value:`preview-${n}`,label:"Preview",labelHTML:this.getActionLabelHTML("preview")},{value:`copy-${n}`,label:"Copy link",labelHTML:this.getActionLabelHTML("copy")},{value:`delete-${n}`,label:"Delete",labelHTML:this.getActionLabelHTML("delete")}],defaultSelectedOption:{value:"",label:""},dropdownButtonText:"...",withSearch:!1,withChevron:!1,exportparts:"sd_dropdown: actions__dropdown, sd_dropdown-button: actions__dropdown-button, sd_dropdown-content: actions__dropdown-content"})))))),t.h("div",{class:"pagination"},t.h("button",{class:"arrow left",onClick:()=>this.previousPageClickedHandler(),disabled:this.previousCursors.length<=0},t.h("chevron-icon",null)),t.h("button",{class:"arrow right",onClick:()=>this.nextPageClickedHandler(),disabled:this.disableNextPageButton},t.h("chevron-icon",null)))),this.state==="error"&&t.h("div",{class:"error-container"},t.h("p",{class:"error"},this.error)))}get host(){return t.getElement(this)}static get watchers(){return{listConfigurationsNextCursor:["listConfigurationsNextCursorChangedHandler"]}}};Ue([Z.RegisterComponent({name:"nylas-list-configurations",stateToProps:new Map([["schedulerConfig.configurations","configurations"],["schedulerConfig.listConfigurationsNextCursor","listConfigurationsNextCursor"]]),localPropsToProp:new Map([["schedulerPreviewLink","schedulerPreviewLink"]]),eventToProps:{initListConfigurations:async(e,n)=>{const{host:i,cursor:o}=e.detail;await i.setState("loading");const[r,a]=await n.schedulerConfig.getConfigurations(o);if(!r&&a&&a.message){await i.setState("error"),await i.setError(a.message);return}await i.setState("loaded")},createButtonClick:async(e,n)=>{n.schedulerConfigStore.resetSelectedConfiguration(),n.schedulerConfigStore.state.action="create"},deleteButtonClick:async(e,n)=>{const{host:i,configuration:o}=e.detail,[r,a]=await n.schedulerConfig.deleteConfiguration(o.id);!r&&a&&a.message&&(await i.setState("error"),await i.setError(a.message))},editButtonClick:async(e,n)=>{const{configuration:i}=e.detail;n.schedulerConfigStore.state.selectedConfiguration=i,n.schedulerConfigStore.state.action="edit"}},fireRegisterEvent:!0}),V("design:type",Function),V("design:paramtypes",[]),V("design:returntype",void 0)],q.prototype,"render",null);q.style=Me;exports.google_logo_icon=Se;exports.microsoft_logo_icon=Te;exports.nylas_booking_type=J;exports.nylas_editor_tabs=W;exports.nylas_list_configurations=q;
|