@social-mail/social-mail-client 1.2.80 → 1.2.82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/admin/AdminAppIndex.pack.js +10021 -9866
  2. package/dist/admin/AdminAppIndex.pack.js.map +1 -1
  3. package/dist/admin/AdminAppIndex.pack.min.js +15 -15
  4. package/dist/admin/AdminAppIndex.pack.min.js.map +1 -1
  5. package/dist/common/controls/emoji-picker/EmojiPicker.d.ts +5 -0
  6. package/dist/common/controls/emoji-picker/EmojiPicker.d.ts.map +1 -0
  7. package/dist/common/controls/emoji-picker/EmojiPicker.js +54 -0
  8. package/dist/common/controls/emoji-picker/EmojiPicker.js.map +1 -0
  9. package/dist/public/channel/ChannelView.pack.js +33 -5
  10. package/dist/public/channel/ChannelView.pack.js.map +1 -1
  11. package/dist/public/channel/ChannelView.pack.min.js +1 -1
  12. package/dist/public/channel/ChannelView.pack.min.js.map +1 -1
  13. package/dist/services/email/EmailContentDownloader.d.ts +2 -0
  14. package/dist/services/email/EmailContentDownloader.d.ts.map +1 -1
  15. package/dist/services/email/EmailContentDownloader.js +33 -2
  16. package/dist/services/email/EmailContentDownloader.js.map +1 -1
  17. package/dist/tsconfig.tsbuildinfo +1 -1
  18. package/dist/web/AppIndex.pack.js +15059 -14904
  19. package/dist/web/AppIndex.pack.js.map +1 -1
  20. package/dist/web/AppIndex.pack.min.js +15 -15
  21. package/dist/web/AppIndex.pack.min.js.map +1 -1
  22. package/dist/web/page/mails/ConversationPage.d.ts +1 -0
  23. package/dist/web/page/mails/ConversationPage.d.ts.map +1 -1
  24. package/dist/web/page/mails/ConversationPage.js +74 -4
  25. package/dist/web/page/mails/ConversationPage.js.map +1 -1
  26. package/dist/web/page/mails/service/ConversationService.d.ts.map +1 -1
  27. package/dist/web/page/mails/service/ConversationService.js +0 -3
  28. package/dist/web/page/mails/service/ConversationService.js.map +1 -1
  29. package/package.json +1 -1
  30. package/src/common/controls/emoji-picker/EmojiPicker.tsx +106 -0
  31. package/src/services/email/EmailContentDownloader.ts +59 -1
  32. package/src/web/page/mails/ConversationPage.tsx +62 -1
  33. package/src/web/page/mails/service/ConversationService.tsx +1 -4
@@ -69,7 +69,7 @@ and limitations under the License.
69
69
  }
70
70
  }
71
71
 
72
- `.installLocal();stack=0;_export("default",BusyProgress=class BusyProgress{static create(){if(!container){container=document.createElement("div");container.className=css;const progressBar=document.createElement("div");progressBar.className="progress-bar";container.appendChild(progressBar);const progressBarValue=document.createElement("div");progressBarValue.className="progress-bar-value";progressBar.appendChild(progressBarValue);document.body.appendChild(container)}stack++;if(stack===1){container.setAttribute("data-show","true")}return{dispose(){stack--;if(stack<=0){container.removeAttribute("data-show")}}}}})}}}));AmdLoader.instance.setup("@social-mail/social-mail-client/dist/services/BusyProgress");System.register(["tslib","@web-atoms/core/dist/di/DISingleton","@web-atoms/entity/dist/services/BaseEntityService","@web-atoms/core/dist/di/Inject","@web-atoms/core/dist/App","./BusyProgress"],(function(_export,_context){"use strict";var __decorate,__metadata,DISingleton,BaseEntityService,Inject,App,BusyProgress,EntityService;return{setters:[function(_tslib){__decorate=_tslib.__decorate;__metadata=_tslib.__metadata},function(_webAtomsCoreDistDiDISingleton){DISingleton=_webAtomsCoreDistDiDISingleton.default},function(_webAtomsEntityDistServicesBaseEntityService){BaseEntityService=_webAtomsEntityDistServicesBaseEntityService.default},function(_webAtomsCoreDistDiInject){Inject=_webAtomsCoreDistDiInject.Inject},function(_webAtomsCoreDistApp){App=_webAtomsCoreDistApp.App},function(_BusyProgress){BusyProgress=_BusyProgress.default}],execute:function(){EntityService=class EntityService extends BaseEntityService{constructor(){super(...arguments);this.queryProcessor="JavaScript"}createBusyIndicator(options){if(options.hideActivityIndicator){return}return BusyProgress.create()}};__decorate([Inject,__metadata("design:type",App)],EntityService.prototype,"app",void 0);EntityService=__decorate([DISingleton()],EntityService);_export("default",EntityService)}}}));AmdLoader.instance.setup("@social-mail/social-mail-client/dist/services/EntityService");System.register(["@web-atoms/date-time/dist/DateTime","@web-atoms/entity/dist/services/BaseEntityService"],(function(_export,_context){"use strict";var DateTime,Model,DefaultFactory,AppRole,AppFileContentDispositionArray,AppFile,AppFileVersion,AppFileAccessTypeArray,AppFileAccess,AppFileTag,FileContent,Configuration,Contact,ContactEmail,ContactPhone,ContactItem,ContactDomain,CachedItem,Domain,HostedDomain,DomainUser,DomainRelayTypeArray,DomainRelay,DomainKey,EmailStatusArray,Email,EmailEngagement,AppLog,EmailRecipientTypeArray,EmailRecipient,EmailTag,EmailAddress,EmailTemplate,Mailbox,MailboxEmail,MailboxContactStatusArray,MailboxContact,MailboxContactEmail,MailboxContactTag,MailboxSyncTargetDirectionArray,MailboxSyncTargetProtocolArray,MailboxSyncTargetLastSyncStatusArray,MailboxSyncTarget,ChannelConfig,SubscriberActivity,SearchWordStatusArray,SearchWord,SearchWordIndex,UserStatusArray,User,UserPin,UserPushSubscription,UserRole,UserMailbox,UserAuthFactorMethodArray,UserAuthFactor,WebSiteFolder,WebSiteFolderHost,WebSiteFolderVersion,LoginSession,TextDocument,Tag;return{setters:[function(_webAtomsDateTimeDistDateTime){DateTime=_webAtomsDateTimeDistDateTime.default},function(_webAtomsEntityDistServicesBaseEntityService){Model=_webAtomsEntityDistServicesBaseEntityService.Model;DefaultFactory=_webAtomsEntityDistServicesBaseEntityService.DefaultFactory}],execute:function(){_export("AppRole",AppRole=new Model("AppRole",["roleName"],{}));_export("AppFileContentDispositionArray",AppFileContentDispositionArray=[{label:"attachment",value:"attachment"},{label:"inline",value:"inline"}]);_export("AppFile",AppFile=new Model("AppFile",["appFileID"],{isFolder:false,name:"",fileSize:0,contentType:"",isDeleted:false,isShared:false,dateCreated:new DefaultFactory((()=>new DateTime))}));_export("AppFileVersion",AppFileVersion=new Model("AppFileVersion",["versionID"],{name:"",dateCreated:new DefaultFactory((()=>new DateTime))}));_export("AppFileAccessTypeArray",AppFileAccessTypeArray=[{label:"create",value:"create"},{label:"read",value:"read"},{label:"write",value:"write"},{label:"delegate",value:"delegate"}]);_export("AppFileAccess",AppFileAccess=new Model("AppFileAccess",["accessID","type"],{dateCreated:new DefaultFactory((()=>new DateTime)),dateUpdated:new DefaultFactory((()=>new DateTime))}));_export("AppFileTag",AppFileTag=new Model("AppFileTag",["appFileID","tagID"],{}));_export("FileContent",FileContent=new Model("FileContent",["fileContentID"],{contentHash:"",contentType:"",contentSize:0}));_export("Configuration",Configuration=new Model("Configuration",["name"],{configValue:""}));_export("Contact",Contact=new Model("Contact",["contactID"],{name:"",type:"",dateCreated:new DefaultFactory((()=>new DateTime)),dateUpdated:new DefaultFactory((()=>new DateTime))}));_export("ContactEmail",ContactEmail=new Model("ContactEmail",["emailAddressID","contactID"],{type:"",blocked:false}));_export("ContactPhone",ContactPhone=new Model("ContactPhone",["contactID","phoneNumberE64"],{type:""}));_export("ContactItem",ContactItem=new Model("ContactItem",["itemID"],{type:"",title:"",valuesJson:""}));_export("ContactDomain",ContactDomain=new Model("ContactDomain",["domainID","contactID"],{blocked:false}));_export("CachedItem",CachedItem=new Model("CachedItem",["itemID","keyHash"],{key:"",expiry:new DefaultFactory((()=>new DateTime)),ready:false,slide:false}));_export("Domain",Domain=new Model("Domain",["domainID"],{name:""}));_export("HostedDomain",HostedDomain=new Model("HostedDomain",["domainID"],{enableReceive:false,enableSend:false,useRelay:false,external:false}));_export("DomainUser",DomainUser=new Model("DomainUser",["domainID","userID"],{isAdmin:false,allowCreateMailbox:false}));_export("DomainRelayTypeArray",DomainRelayTypeArray=[{label:"smtp",value:"smtp"},{label:"ses",value:"ses"},{label:"https",value:"https"}]);_export("DomainRelay",DomainRelay=new Model("DomainRelay",["domainRelayID"],{type:"smtp",host:"",username:"",password:"",priority:0}));_export("DomainKey",DomainKey=new Model("DomainKey",["domainKeyID"],{name:"",keyType:"",publicKey:""}));_export("EmailStatusArray",EmailStatusArray=[{label:"queued",value:"queued"},{label:"received",value:"received"},{label:"draft",value:"draft"},{label:"published",value:"published"},{label:"pending-approval",value:"pending-approval"},{label:"scheduled",value:"scheduled"},{label:"sent",value:"sent"},{label:"sent-failed",value:"sent-failed"},{label:"deleted",value:"deleted"}]);_export("Email",Email=new Model("Email",["emailID"],{senderName:"",received:false,dateReceived:new DefaultFactory((()=>new DateTime)),dateCreated:new DefaultFactory((()=>new DateTime)),status:"queued",forwardCount:0,replyCount:0,viewCount:0,originalFileSize:0}));_export("EmailEngagement",EmailEngagement=new Model("EmailEngagement",["emailID"],{engagement:"",count:0}));_export("AppLog",AppLog=new Model("AppLog",["logID"],{dateCreated:new DefaultFactory((()=>new DateTime)),json:false}));_export("EmailRecipientTypeArray",EmailRecipientTypeArray=[{label:"from",value:"from"},{label:"to",value:"to"},{label:"cc",value:"cc"},{label:"bcc",value:"bcc"},{label:"viewer",value:"viewer"},{label:"editor",value:"editor"}]);_export("EmailRecipient",EmailRecipient=new Model("EmailRecipient",["emailID","emailAddressID"],{type:"from"}));_export("EmailTag",EmailTag=new Model("EmailTag",["emailID","tagID"],{}));_export("EmailAddress",EmailAddress=new Model("EmailAddress",["emailAddressID"],{emailAddress:"",name:"",blocked:false}));_export("EmailTemplate",EmailTemplate=new Model("EmailTemplate",["templateID"],{}));_export("Mailbox",Mailbox=new Model("Mailbox",["mailboxID"],{storage:0,maxStorage:0,indexAttachments:false,indexImageAttachments:false,dateCreated:new DefaultFactory((()=>new DateTime)),dateUpdated:new DefaultFactory((()=>new DateTime)),isChannel:false,isPrivateChannel:false,requireApproval:false,subscriberCount:0}));_export("MailboxEmail",MailboxEmail=new Model("MailboxEmail",["mailboxID","emailID"],{}));_export("MailboxContactStatusArray",MailboxContactStatusArray=[{label:"invited",value:"invited"},{label:"added",value:"added"},{label:"active",value:"active"},{label:"unsubscribed",value:"unsubscribed"},{label:"blocked",value:"blocked"}]);_export("MailboxContact",MailboxContact=new Model("MailboxContact",["mailboxID","emailAddressID"],{dateCreated:new DefaultFactory((()=>new DateTime)),dateUpdated:new DefaultFactory((()=>new DateTime)),unread:0,total:0,isOwner:false,canContribute:false,priority:0,blocked:false,mute:false,status:"invited"}));_export("MailboxContactEmail",MailboxContactEmail=new Model("MailboxContactEmail",["mailboxID","emailAddressID","emailID"],{dateReceived:new DefaultFactory((()=>new DateTime))}));_export("MailboxContactTag",MailboxContactTag=new Model("MailboxContactTag",["mailboxID","emailAddressID","tagID"],{count:0,dateUpdated:new DefaultFactory((()=>new DateTime))}));_export("MailboxSyncTargetDirectionArray",MailboxSyncTargetDirectionArray=[{label:"in",value:"in"},{label:"out",value:"out"}]);_export("MailboxSyncTargetProtocolArray",MailboxSyncTargetProtocolArray=[{label:"imap",value:"imap"}]);_export("MailboxSyncTargetLastSyncStatusArray",MailboxSyncTargetLastSyncStatusArray=[{label:"none",value:"none"},{label:"success",value:"success"},{label:"failed",value:"failed"}]);_export("MailboxSyncTarget",MailboxSyncTarget=new Model("MailboxSyncTarget",["syncTargetID"],{direction:"in",protocol:"imap",username:"",host:"",port:0,isSecure:false,syncAllFolders:false,syncJunkMails:false,intervalSeconds:0,active:false}));_export("ChannelConfig",ChannelConfig=new Model("ChannelConfig",["mailboxID"],{sendInviteOnEngagement:false,memberOnlyEngagement:false,notSafeForWork:false}));_export("SubscriberActivity",SubscriberActivity=new Model("SubscriberActivity",["activityID"],{activity:"",dateCreated:new DefaultFactory((()=>new DateTime))}));_export("SearchWordStatusArray",SearchWordStatusArray=[{label:"begin",value:"begin"},{label:"ready",value:"ready"},{label:"deleted",value:"deleted"}]);_export("SearchWord",SearchWord=new Model("SearchWord",["wordID"],{word:"",dateCreated:new DefaultFactory((()=>new DateTime)),dateUpdated:new DefaultFactory((()=>new DateTime)),status:"begin"}));_export("SearchWordIndex",SearchWordIndex=new Model("SearchWordIndex",["wordID","fileContentID"],{rank:0}));_export("UserStatusArray",UserStatusArray=[{label:"active",value:"active"},{label:"blocked",value:"blocked"},{label:"locked",value:"locked"},{label:"change-password",value:"change-password"},{label:"external",value:"external"}]);_export("User",User=new Model("User",["userID"],{userName:"",displayName:"",status:"active",isExternal:false,multiFactor:false,dateUpdated:new DefaultFactory((()=>new DateTime))}));_export("UserPin",UserPin=new Model("UserPin",["pinID"],{}));_export("UserPushSubscription",UserPushSubscription=new Model("UserPushSubscription",["subscriptionID"],{notify:false}));_export("UserRole",UserRole=new Model("UserRole",["userID","roleName"],{}));_export("UserMailbox",UserMailbox=new Model("UserMailbox",["userID","mailboxID"],{}));_export("UserAuthFactorMethodArray",UserAuthFactorMethodArray=[{label:"totp",value:"totp"},{label:"hotp",value:"hotp"},{label:"fido2",value:"fido2"},{label:"one-time",value:"one-time"}]);_export("UserAuthFactor",UserAuthFactor=new Model("UserAuthFactor",["authFactorID"],{method:"totp",verified:false,dateUpdated:new DefaultFactory((()=>new DateTime))}));_export("WebSiteFolder",WebSiteFolder=new Model("WebSiteFolder",["folderID"],{isStatic:false,isModified:false}));_export("WebSiteFolderHost",WebSiteFolderHost=new Model("WebSiteFolderHost",["host"],{}));_export("WebSiteFolderVersion",WebSiteFolderVersion=new Model("WebSiteFolderVersion",["folderID","snapshotFolderID"],{dateCreated:new DefaultFactory((()=>new DateTime)),name:""}));_export("LoginSession",LoginSession=new Model("LoginSession",["sessionID"],{invalid:false,dateUpdated:new DefaultFactory((()=>new DateTime))}));_export("TextDocument",TextDocument=new Model("TextDocument",["textDocumentID"],{searchable:""}));_export("Tag",Tag=new Model("Tag",["tagID"],{name:"",isSystemTag:false}))}}}));AmdLoader.instance.setup("@social-mail/social-mail-client/dist/model/model");System.register([],(function(_export,_context){"use strict";var Sql;return{setters:[],execute:function(){_export("Sql",Sql=void 0)}}}));AmdLoader.instance.setup("@social-mail/social-mail-client/dist/common/Sql");System.register(["tslib","./http/JsonError"],(function(_export,_context){"use strict";var __awaiter,JsonError,FetchBuilder;function buildUrl(strings,...p){let r="";for(let index=0;index<strings.length;index++){const element=strings[index];r+=element;if(index<p.length){r+=encodeURIComponent(p[index])}}return r}_export({buildUrl,default:void 0});return{setters:[function(_tslib){__awaiter=_tslib.__awaiter},function(_httpJsonError){JsonError=_httpJsonError.default}],execute:function(){_export("default",FetchBuilder=class FetchBuilder{static get(url){return this.method(url,"GET")}static put(url){return this.method(url,"PUT")}static post(url){return this.method(url,"POST")}static delete(url){return this.method(url,"DELETE")}static method(url,method){return new FetchBuilder({url,method})}constructor(request){this.request=request}cancelToken(cancelToken){const ac=new AbortController;cancelToken.registerForCancel((()=>ac.abort()));return this.signal(ac.signal)}signal(signal){return this.append({signal})}form(name,value,fileName){var _a;if(value===void 0){return this}const body=(_a=this.request.body)!==null&&_a!==void 0?_a:new FormData;if(fileName){if(typeof value==="string"){throw new Error("value must be a blob with content type set correctly.")}body.append(name,value,fileName)}else{body.append(name,value)}return this.append({body})}jsonBody(body,encode=true){var _a;if(encode){body=JSON.stringify(body)}const headers=(_a=this.request.headers)!==null&&_a!==void 0?_a:{};headers["content-type"]="application/json";return this.append({body,headers})}header(name,value){var _a;const headers=(_a=this.request.headers)!==null&&_a!==void 0?_a:{};headers[name]=value;return this.append({headers})}path(name,value,encode=true){let url=this.request.url;if(encode){value=encodeURIComponent(value)}url=url.replace(name,value);return this.append({url})}query(name,value,encode=true){if(value===void 0){return this}let url=this.request.url;if(encode){value=encodeURIComponent(value)}name=encodeURIComponent(name);if(url.indexOf("?")===-1){url+=`?${name}=${value}`}else{url+=`&${name}=${value}`}return this.append({url})}responseAsText(ensureSuccess=true){return __awaiter(this,void 0,void 0,(function*(){const r=yield this.response();if(ensureSuccess){yield this.ensureSuccess(r)}return yield r.text()}))}responseAsBlob(ensureSuccess=true){return __awaiter(this,void 0,void 0,(function*(){const r=yield this.response();if(ensureSuccess){yield this.ensureSuccess(r)}return yield r.blob()}))}responseAsJson(ensureSuccess=true){return __awaiter(this,void 0,void 0,(function*(){const r=yield this.response();if(ensureSuccess){yield this.ensureSuccess(r)}return yield r.json()}))}response(){return fetch(this.request.url,this.request)}ensureSuccess(r){return __awaiter(this,void 0,void 0,(function*(){if(r.status<=300){return}const type=r.headers.get("content-type");if(/\/json/i.test(type)){const json=yield r.json();throw new JsonError(`Failed for ${this.request.url}`,json)}const text=yield r.text();throw new Error(`Failed for ${this.request.url}\n${text}`)}))}append(r){return new FetchBuilder(Object.assign(Object.assign({},this.request),r))}})}}}));AmdLoader.instance.setup("@web-atoms/core/dist/services/FetchBuilder");System.register(["tslib","@web-atoms/core/dist/di/DISingleton","@web-atoms/entity/dist/models/TaskManager","@web-atoms/core/dist/services/FetchBuilder"],(function(_export,_context){"use strict";var __awaiter,__decorate,DISingleton,TaskManager,FetchBuilder,EmailContentDownloader;return{setters:[function(_tslib){__awaiter=_tslib.__awaiter;__decorate=_tslib.__decorate},function(_webAtomsCoreDistDiDISingleton){DISingleton=_webAtomsCoreDistDiDISingleton.default},function(_webAtomsEntityDistModelsTaskManager){TaskManager=_webAtomsEntityDistModelsTaskManager.default},function(_webAtomsCoreDistServicesFetchBuilder){FetchBuilder=_webAtomsCoreDistServicesFetchBuilder.default}],execute:function(){EmailContentDownloader=class EmailContentDownloader extends TaskManager{download(email){return __awaiter(this,void 0,void 0,(function*(){if(email.htmlBody){return email.htmlBody}const cache=yield window.caches.open("email-content-cache");const cacheKey=new URL(email.htmlBodyUrl,location.href);const content=yield cache.match(cacheKey);if(content){return email.htmlBody=yield content.text()}return yield this.run((()=>__awaiter(this,void 0,void 0,(function*(){for(let i=0;i<3;i++){try{const text=yield FetchBuilder.get(email.htmlBodyUrl).responseAsText();yield cache.put(cacheKey,new Response(text,{headers:{"cache-control":"public, max-age=86000"}}));return email.htmlBody=text}catch(error){console.error(error)}}}))))}))}};EmailContentDownloader=__decorate([DISingleton({})],EmailContentDownloader);_export("default",EmailContentDownloader)}}}));AmdLoader.instance.setup("@social-mail/social-mail-client/dist/services/email/EmailContentDownloader");System.register(["tslib","@web-atoms/core/dist/di/DISingleton","@web-atoms/core/dist/di/Inject","../../services/EntityService","../../model/model","../../common/Sql","../../services/email/EmailContentDownloader"],(function(_export,_context){"use strict";var __awaiter,__decorate,__metadata,DISingleton,Inject,EntityService,Email,Mailbox,Sql,EmailContentDownloader,BlogService;return{setters:[function(_tslib){__awaiter=_tslib.__awaiter;__decorate=_tslib.__decorate;__metadata=_tslib.__metadata},function(_webAtomsCoreDistDiDISingleton){DISingleton=_webAtomsCoreDistDiDISingleton.default},function(_webAtomsCoreDistDiInject){Inject=_webAtomsCoreDistDiInject.Inject},function(_servicesEntityService){EntityService=_servicesEntityService.default},function(_modelModel){Email=_modelModel.Email;Mailbox=_modelModel.Mailbox},function(_commonSql){Sql=_commonSql.Sql},function(_servicesEmailEmailContentDownloader){EmailContentDownloader=_servicesEmailEmailContentDownloader.default}],execute:function(){BlogService=class BlogService{getEmail({emailID,channelID}){return __awaiter(this,void 0,void 0,(function*(){const q=this.entityService.query(Email,"channelEmails",channelID).where({emailID},(p=>x=>x.emailID===p.emailID)).include((x=>[x.children]));return q.firstOrDefault()}))}getEmails({channelID=0,search="",start=0,size=10,cancelToken}){return __awaiter(this,void 0,void 0,(function*(){let q=this.entityService.query(Email,"channelEmails",channelID);if(search){q=q.where({search},(p=>x=>Sql.text.includes(x.textBody,p.search)))}const emails=yield q.include((x=>[x.attachments])).orderByDescending((x=>x.dateSent)).toPagedList({start,size,cancelToken});const tasks=[];for(const iterator of emails.items){if(!iterator.htmlBody){tasks.push(this.downloader.download(iterator))}}yield Promise.all(tasks);return emails}))}getChannel(channelID,emailAddress){return __awaiter(this,void 0,void 0,(function*(){let q=this.entityService.query(Mailbox,"channels",emailAddress).where((x=>x.datePublished!==null));if(channelID){q=q.where({channelID},(p=>x=>x.mailboxID===p.channelID))}const c=yield q.include((x=>x.emailAddress)).orderByDescending((x=>x.datePublished)).firstOrDefault();return c}))}};__decorate([Inject,__metadata("design:type",EntityService)],BlogService.prototype,"entityService",void 0);__decorate([Inject,__metadata("design:type",EmailContentDownloader)],BlogService.prototype,"downloader",void 0);BlogService=__decorate([DISingleton()],BlogService);_export("default",BlogService)}}}));AmdLoader.instance.setup("@social-mail/social-mail-client/dist/public/channel/BlogService");System.register(["@web-atoms/date-time/dist/DateTime"],(function(_export,_context){"use strict";var DateTime,DIVISIONS,DateFormats;return{setters:[function(_webAtomsDateTimeDistDateTime){DateTime=_webAtomsDateTimeDistDateTime.default}],execute:function(){DIVISIONS=[{amount:60,name:"seconds"},{amount:60,name:"minutes"},{amount:24,name:"hours"},{amount:7,name:"days"},{amount:4.34524,name:"weeks"},{amount:12,name:"months"},{amount:Number.POSITIVE_INFINITY,name:"years"}];_export("DateFormats",DateFormats={diff(d){if(!d){return""}if(!(d instanceof DateTime)){d=typeof d==="string"?new DateTime(d):DateTime.from(d)}const today=DateTime.now;let diff=today.diff(d);if(diff.totalMilliseconds<0){diff=d.diff(today)}if(diff.totalHours<=24){if(diff.totalSeconds<=180){return"now"}if(diff.totalMinutes<60){return Math.round(diff.totalMinutes)+"m"}return Math.round(diff.totalHours)+"h"}if(diff.totalDays<=30){return Math.round(diff.totalDays)+"d"}if(diff.totalDays<=365){return Math.round(diff.totalDays/30)+"mo"}return Math.round(diff.totalDays/365)+"yr"},withWeekDayAndTime(d,def=""){var _a;if(!d){return def}d=DateTime.from(d);return(_a=d===null||d===void 0?void 0:d.toLocaleString(navigator.language,{year:"numeric",month:"short",day:"numeric",weekday:"short",hour12:true,minute:"numeric",hour:"numeric"}))!==null&&_a!==void 0?_a:def},relative:{short(d){if(!d){return""}d=DateTime.from(d);const now=DateTime.now;if(now<d){return"in "+DateFormats.diff(d)}return DateFormats.diff(d)+" ago"}}})}}}));AmdLoader.instance.setup("@social-mail/social-mail-client/dist/common/date/DateFormats");System.register([],(function(_export,_context){"use strict";function newCSSStyleDeclaration(){const e=document.createElement("div");return e.style}function mergeStyle(...styles){var _a,_b;const s=newCSSStyleDeclaration();for(const iterator of styles){if(!iterator){continue}if(iterator instanceof CSSStyleDeclaration){for(let index=0;index<iterator.length;index++){const name=iterator[index];let value=(_a=iterator[name])===null||_a===void 0?void 0:_a.toString();if(value===void 0||value===null||value===""){continue}s[name]=value}continue}for(const key in iterator){if(Object.prototype.hasOwnProperty.call(iterator,key)){const element=(_b=iterator[key])===null||_b===void 0?void 0:_b.toString();if(!element){continue}s[key]=element}}}return s}_export({newCSSStyleDeclaration,default:mergeStyle});return{setters:[],execute:function(){}}}));AmdLoader.instance.setup("@web-atoms/email-dom/dist/style/mergeStyle");System.register(["../style/mergeStyle"],(function(_export,_context){"use strict";var newCSSStyleDeclaration,StyleHelper,toStyle;_export("default",void 0);return{setters:[function(_styleMergeStyle){newCSSStyleDeclaration=_styleMergeStyle.newCSSStyleDeclaration}],execute:function(){toStyle=style=>{var _a;if(typeof style==="string"){const css=style;const cs=newCSSStyleDeclaration();cs.cssText=css;return cs}const s=newCSSStyleDeclaration();if(style instanceof CSSStyleDeclaration){return style}for(const key in style){if(Object.prototype.hasOwnProperty.call(style,key)){const element=(_a=style[key])===null||_a===void 0?void 0:_a.toString();if(element===void 0||element===null||element===""){continue}s[key]=element}}return s};_export("default",StyleHelper=class StyleHelper{static styleToString(style,props){var _a;if(!style){return}const cs=toStyle(style);if(props){const ps=toStyle(props);for(let index=0;index<ps.length;index++){const key=ps[index];let value=(_a=ps[key])===null||_a===void 0?void 0:_a.toString();if(value===void 0||value===null||value===""){continue}cs[key]=value}}const allKeys=[];for(let index=0;index<cs.length;index++){const key=cs[index];allKeys.push(key)}for(const key of allKeys){if(!cs[key]){cs.removeProperty(key)}}return cs.cssText}})}}}));AmdLoader.instance.setup("@web-atoms/email-dom/dist/dom/StyleHelper");System.register(["@web-atoms/core/dist/core/XNode","./dom/StyleHelper"],(function(_export,_context){"use strict";var XNode,StyleHelper;function DomToString(node){const div=document.createElement("div");render(div,XNode.create("div",null,node));return div.innerHTML}function render(div,node){var _a;while(typeof node.name==="function"){node=node.name(node.attributes,...node.children)}const a=node.attributes;if(a){for(const key in a){if(Object.prototype.hasOwnProperty.call(a,key)){let element=a[key];if(element===null||element===void 0){continue}if(typeof element==="object"&&key==="style"){element=StyleHelper.styleToString(element)}else{element=element.toString()}if(!element){continue}if(key==="text"){div.textContent=element;continue}if(key.startsWith("style")&&key.length>5){div.style[key.substring(5)]=element;continue}if(key.startsWith("data")&&key.length>4){if(key.indexOf("-")!==-1){div.setAttribute(key,element);continue}div.dataset[key.substring(4)]=element;continue}div.setAttribute(key,element)}}}if(!((_a=node.children)===null||_a===void 0?void 0:_a.length)){return}for(let iterator of node.children){if(iterator===false||iterator===void 0||iterator===null){continue}if(typeof iterator!=="object"){div.appendChild(document.createTextNode(iterator.toString()));continue}while(typeof iterator.name==="function"){iterator=iterator.name(iterator.attributes,...iterator.children)}const child=document.createElement(iterator.name);div.appendChild(child);render(child,iterator)}}_export("default",DomToString);return{setters:[function(_webAtomsCoreDistCoreXNode){XNode=_webAtomsCoreDistCoreXNode.default},function(_domStyleHelper){StyleHelper=_domStyleHelper.default}],execute:function(){}}}));AmdLoader.instance.setup("@web-atoms/email-dom/dist/DomToString");System.register(["@web-atoms/core/dist/core/EventScope"],(function(_export,_context){"use strict";var EventScope,CommonEvents;return{setters:[function(_webAtomsCoreDistCoreEventScope){EventScope=_webAtomsCoreDistCoreEventScope.default}],execute:function(){_export("CommonEvents",CommonEvents={onThreadMarkedAsRead:EventScope.create(),onThreadMarkedAsBlocked:EventScope.create(),onDraftDeleted:EventScope.create(),onFileDeleted:EventScope.create(),onEmailScheduled:EventScope.create(),onEmailUnscheduled:EventScope.create()})}}}));AmdLoader.instance.setup("@social-mail/social-mail-client/dist/common/events/CommonEvents");System.register(["tslib","@web-atoms/core/dist/di/DISingleton","@web-atoms/core/dist/di/Inject","../../../../services/EntityService","../../../../model/model","../../../../common/Sql","@web-atoms/email-dom/dist/DomToString","@web-atoms/core/dist/core/XNode","@web-atoms/core/dist/web/controls/AtomControl","@web-atoms/core/dist/web/core/AtomUI","@web-atoms/date-time/dist/DateTime","../../../../common/events/CommonEvents","../../../../services/BusyProgress","../../../../services/email/EmailContentDownloader"],(function(_export,_context){"use strict";var __awaiter,__decorate,__metadata,DISingleton,Inject,EntityService,Email,EmailRecipient,MailboxContactEmail,MailboxEmail,Sql,DomToString,XNode,AtomControl,descendentElementIterator,DateTime,CommonEvents,BusyProgress,EmailContentDownloader,renderMail,downloadEmailContent,ConversationService;return{setters:[function(_tslib){__awaiter=_tslib.__awaiter;__decorate=_tslib.__decorate;__metadata=_tslib.__metadata},function(_webAtomsCoreDistDiDISingleton){DISingleton=_webAtomsCoreDistDiDISingleton.default},function(_webAtomsCoreDistDiInject){Inject=_webAtomsCoreDistDiInject.Inject},function(_servicesEntityService){EntityService=_servicesEntityService.default},function(_modelModel){Email=_modelModel.Email;EmailRecipient=_modelModel.EmailRecipient;MailboxContactEmail=_modelModel.MailboxContactEmail;MailboxEmail=_modelModel.MailboxEmail},function(_commonSql){Sql=_commonSql.Sql},function(_webAtomsEmailDomDistDomToString){DomToString=_webAtomsEmailDomDistDomToString.default},function(_webAtomsCoreDistCoreXNode){XNode=_webAtomsCoreDistCoreXNode.default},function(_webAtomsCoreDistWebControlsAtomControl){AtomControl=_webAtomsCoreDistWebControlsAtomControl.AtomControl},function(_webAtomsCoreDistWebCoreAtomUI){descendentElementIterator=_webAtomsCoreDistWebCoreAtomUI.descendentElementIterator},function(_webAtomsDateTimeDistDateTime){DateTime=_webAtomsDateTimeDistDateTime.default},function(_commonEventsCommonEvents){CommonEvents=_commonEventsCommonEvents.CommonEvents},function(_servicesBusyProgress){BusyProgress=_servicesBusyProgress.default},function(_servicesEmailEmailContentDownloader){EmailContentDownloader=_servicesEmailEmailContentDownloader.default}],execute:function(){_export("renderMail",renderMail=AtomControl.registerProperty("data-html","html",((c,e,value)=>{if(!value){e.innerHTML="";return}const thread=value;const mail=thread.email;const html=mail.htmlBody;const msg=document.createElement("div");if(!html){for(const iterator of html.split("\n")){const p=document.createElement("p");p.appendChild(document.createTextNode(iterator));msg.appendChild(p)}e.appendChild(msg);return}msg.innerHTML=html;for(const iterator of descendentElementIterator(msg)){if(iterator.tagName==="IMG"){const src=iterator.getAttribute("src");if(src){if(src.startsWith("cid:")){const cid=src.substring(4);const a=mail.attachments.find((x=>x.contentID===cid));if(a){iterator.setAttribute("src",`/api/files/${a.appFileID}/${a.fileContentID}/${a.name}`)}}if(/^http\:\/\//i.test(src)){iterator.setAttribute("src",src.substring(5))}}continue}if(iterator.tagName==="A"){iterator.target="_blank"}}const shadow=e.attachShadow({mode:"open"});shadow.appendChild(msg);if(!thread.timeRead&&thread.mailboxID){const timeRead=DateTime.now;thread.timeRead=timeRead;const control=AtomControl.from(e);const entityService=control.app.resolve(EntityService);entityService.save(MailboxContactEmail.patch(thread,{timeRead})).then((()=>{CommonEvents.onThreadMarkedAsRead.dispatchEvent(thread)}),console.error)}return})));downloadEmailContent=(es,email)=>__awaiter(void 0,void 0,void 0,(function*(){var _a,_b;if(email.replyCount){const children=yield es.query(Email).where({emailID:email.emailID},(p=>x=>x.emailID===p.emailID&&x.engagement!==null)).orderByDescending((x=>x.emailID)).toPagedList({start:0,size:4,cacheVersion:"a",cacheSeconds:900});email.children=(_a=children===null||children===void 0?void 0:children.items)!==null&&_a!==void 0?_a:[]}else{(_b=email.children)!==null&&_b!==void 0?_b:email.children=[]}if(!email.originalFileID){return}for(let i=0;i<10;i++){try{const rs=yield fetch(email.htmlBodyUrl);const text=yield rs.text();email.htmlBody=text;return}catch(error){console.error(error)}}}));ConversationService=class ConversationService{getDraft({mailboxID,emailAddressID,email}){return __awaiter(this,void 0,void 0,(function*(){const draft="draft";return yield this.entityService.query(MailboxContactEmail).where({mailboxID,emailAddressID,draft},(p=>x=>x.mailboxID===p.mailboxID&&x.emailAddressID===p.emailAddressID&&x.email.status===p.draft)).orderByDescending((x=>x.emailID)).include((x=>[x.email.recipients,x.email.attachments])).firstOrDefault()}))}draft({mailboxID,emailAddressID,email},create=false){var _a,_b,_c;return __awaiter(this,void 0,void 0,(function*(){if(email===null||email===void 0?void 0:email.emailID){if(!email.textBody){email.textBody=email.mdBody}email.subject||(email.subject="");const cloner=this.entityService.cloner(email).include((x=>x.attachments)).include((x=>x.recipients));yield this.entityService.save(cloner.copy);return email}if(create&&email){const recipients=(_a=email.recipients)!==null&&_a!==void 0?_a:email.recipients=[];const mailboxes=(_b=email.mailboxes)!==null&&_b!==void 0?_b:email.mailboxes=[];const threads=(_c=email.threadEmails)!==null&&_c!==void 0?_c:email.threadEmails=[];email.senderID=mailboxID;email.status="draft";if(!mailboxes.some((m=>m.mailboxID===mailboxID))){mailboxes.push(MailboxEmail.create({mailboxID}))}if(!recipients.some((r=>r.emailAddressID===emailAddressID))){recipients.push(EmailRecipient.create({emailAddressID}))}if(!threads.some((r=>r.mailboxID===mailboxID))){threads.push(MailboxContactEmail.create({mailboxID,emailAddressID}))}yield this.entityService.save(email)}return email}))}list({search="",mailboxID,emailAddressID,start=0,size=100,version=0,cancelToken}){var _a,_b,_c;return __awaiter(this,void 0,void 0,(function*(){let q=this.entityService.query(MailboxContactEmail).where({mailboxID,emailAddressID},(p=>x=>x.mailboxID===p.mailboxID&&x.emailAddressID===p.emailAddressID&&x.engagement===null));if(search){if(!/\%/.test(search)){search=`%${search}%`}q=q.where({search},(p=>x=>Sql.text.iLike(x.email.subject,p.search)||Sql.text.iLike(x.email.textBody,p.search)||Sql.text.iLike(x.email.originalFile.fileContent.textDocument.searchable,p.search)))}const emails=yield q.include((x=>[x.email.recipients.forEach((r=>r.emailAddress)),x.email.attachments,x.email.senderUser,x.email.senderEmail])).orderByDescending((x=>x.dateReceived)).toPagedList({start,size,cancelToken});const tasks=[];const d=BusyProgress.create();try{for(const{email}of emails.items){(_a=email.htmlBody)!==null&&_a!==void 0?_a:email.htmlBody="";(_b=email.textBody)!==null&&_b!==void 0?_b:email.textBody="";tasks.push(this.downloadEmailContent(email))}yield Promise.all(tasks)}finally{(_c=d===null||d===void 0?void 0:d.dispose)===null||_c===void 0?void 0:_c.call(d)}return emails}))}stopEmail(mce){return __awaiter(this,void 0,void 0,(function*(){const{email}=mce;email.status="draft";yield this.entityService.save(email,(c=>c));CommonEvents.onEmailUnscheduled.dispatchEvent(mce)}))}downloadEmailContent(email){var _a,_b;return __awaiter(this,void 0,void 0,(function*(){if(email.replyCount){const children=yield this.entityService.query(Email).where({emailID:email.emailID},(p=>x=>x.emailID===p.emailID&&x.engagement!==null)).orderByDescending((x=>x.emailID)).toPagedList({start:0,size:4,cacheVersion:"a",cacheSeconds:900});email.children=(_a=children===null||children===void 0?void 0:children.items)!==null&&_a!==void 0?_a:[]}else{(_b=email.children)!==null&&_b!==void 0?_b:email.children=[]}if(!email.originalFileID){return}yield this.emailContentDownloader.download(email)}))}renderText(html){const div=document.createElement("div");div.innerHTML=html;return div.textContent}renderHtml(html){const div=document.createElement("div");div.innerHTML=html;return div.innerHTML}toHtml(textBody){return DomToString(XNode.create("div",null,...textBody.split("\n").map((p=>XNode.create("p",{text:p})))))}block(thread){return __awaiter(this,void 0,void 0,(function*(){thread.blocked=!thread.blocked;const cloner=this.entityService.cloner(thread).copy;yield this.entityService.save(cloner);CommonEvents.onThreadMarkedAsBlocked.dispatchEvent(thread)}))}delete(email){return __awaiter(this,void 0,void 0,(function*(){const{emailID,status}=email;yield this.entityService.delete(Email.create({emailID,status}));CommonEvents.onDraftDeleted.dispatchEvent(email)}))}};__decorate([Inject,__metadata("design:type",EntityService)],ConversationService.prototype,"entityService",void 0);__decorate([Inject,__metadata("design:type",EmailContentDownloader)],ConversationService.prototype,"emailContentDownloader",void 0);ConversationService=__decorate([DISingleton()],ConversationService);_export("default",ConversationService)}}}));AmdLoader.instance.setup("@social-mail/social-mail-client/dist/web/page/mails/service/ConversationService");System.register(["tslib","@web-atoms/core/dist/core/InjectProperty","@web-atoms/core/dist/web/controls/AtomControl","./BlogService","@web-atoms/core/dist/core/XNode","../../common/date/DateFormats","../../web/page/mails/service/ConversationService"],(function(_export,_context){"use strict";var __awaiter,__decorate,__metadata,InjectProperty,AtomControl,BlogService,XNode,DateFormats,renderMail,ChannelMessage,_a,url,channelID,emailID;_export("default",void 0);return{setters:[function(_tslib){__awaiter=_tslib.__awaiter;__decorate=_tslib.__decorate;__metadata=_tslib.__metadata},function(_webAtomsCoreDistCoreInjectProperty){InjectProperty=_webAtomsCoreDistCoreInjectProperty.default},function(_webAtomsCoreDistWebControlsAtomControl){AtomControl=_webAtomsCoreDistWebControlsAtomControl.AtomControl},function(_BlogService){BlogService=_BlogService.default},function(_webAtomsCoreDistCoreXNode){XNode=_webAtomsCoreDistCoreXNode.default},function(_commonDateDateFormats){DateFormats=_commonDateDateFormats.DateFormats},function(_webPageMailsServiceConversationService){renderMail=_webPageMailsServiceConversationService.renderMail}],execute:function(){url=window.pageUrl;({1:channelID=1,2:emailID=82}=(_a=/^\/channels\/([^\/]+)\/([^\/]+)\//.exec(url.pathname))!==null&&_a!==void 0?_a:{});channelID=parseInt(channelID,36);emailID=parseInt(emailID,36);_export("default",ChannelMessage=class ChannelMessage extends AtomControl{init(){return __awaiter(this,void 0,void 0,(function*(){const{items:[email]}=yield this.blogService.getEmails({channelID,start:0,size:1,cancelToken:null});this.renderer=XNode.create("section",{"data-element":"blog-item"},XNode.create("h4",{"data-element":"title"},XNode.create("label",{text:email.subject})),XNode.create("h6",{"data-element":"date",text:DateFormats.relative.short(email.dateSent)}),XNode.create("h6",{text:email.senderName}),XNode.create("section",{"data-element":"content"},XNode.create("section",Object.assign({},renderMail({email})))))}))}});__decorate([InjectProperty,__metadata("design:type",BlogService)],ChannelMessage.prototype,"blogService",void 0)}}}));AmdLoader.instance.setup("@social-mail/social-mail-client/dist/public/channel/ChannelMessage");System.register([],(function(_export,_context){"use strict";var ColorItem,Colors;function toFixedString(t){return("0"+t.toString(16)).slice(-2)}_export({ColorItem:void 0,default:void 0});return{setters:[],execute:function(){_export("ColorItem",ColorItem=class ColorItem{constructor(colorCodeOrRed,namedColorOrGreen,blue,alpha){if(typeof colorCodeOrRed==="string"){this.colorCode=colorCodeOrRed;if(typeof namedColorOrGreen==="string"){this.namedColor=namedColorOrGreen}const r=ColorItem.parseRgb(this.colorCode);this.red=r.red;this.green=r.green;this.blue=r.blue;this.alpha=r.alpha}else{this.red=colorCodeOrRed;if(typeof namedColorOrGreen==="number"){this.green=namedColorOrGreen}this.blue=blue;this.alpha=alpha;this.colorCode=ColorItem.rgb(this.red,this.green,this.blue,this.alpha)}}toString(){return this.colorCode}withAlphaPercent(a){return new ColorItem(this.red,this.green,this.blue,a)}static parseRgb(rgba){if(/^\#/.test(rgba)){rgba=rgba.substr(1);if(rgba.length===3){rgba=rgba.split("").map((x=>x+x)).join("")}const red=Number.parseInt(rgba[0]+rgba[1],16);const green=Number.parseInt(rgba[2]+rgba[3],16);const blue=Number.parseInt(rgba[4]+rgba[5],16);if(rgba.length>6){const alpha=Number.parseInt(rgba[6]+rgba[7],16);return{red,green,blue,alpha}}return{red,green,blue}}if(/^rgba/i.test(rgba)){rgba=rgba.substr(5);rgba=rgba.substr(0,rgba.length-1);const a=rgba.split(",").map(((x,i)=>i===3?Number.parseFloat(x):Number.parseInt(x,10)));return{red:a[0],green:a[1],blue:a[2],alpha:a[3]}}if(/^rgb/i.test(rgba)){rgba=rgba.substr(4);rgba=rgba.substr(0,rgba.length-1);const a=rgba.split(",").map((x=>Number.parseInt(x,10)));return{red:a[0],green:a[1],blue:a[2]}}throw new Error("Unknown color format "+rgba)}static rgb(r,g,b,a){if(a!==undefined){return`rgba(${r},${g},${b},${a})`}return"#"+toFixedString(r)+toFixedString(g)+toFixedString(b)}});_export("default",Colors=class Colors{static rgba(red,green,blue,alpha){return new ColorItem(red,green,blue,alpha)}static parse(color){if(!color){return null}color=color.toLowerCase();for(const key in Colors){if(Colors.hasOwnProperty(key)){const element=Colors[key];if(element instanceof ColorItem){const ci=element;if(ci.namedColor===color){return ci}}}}if(/^(\#|rgb\(|rgba\()/i.test(color)){return new ColorItem(color)}throw new Error("Invalid color format "+color)}});Colors.black=new ColorItem("#000000","black");Colors.silver=new ColorItem("#c0c0c0","silver");Colors.gray=new ColorItem("#808080","gray");Colors.white=new ColorItem("#ffffff","white");Colors.maroon=new ColorItem("#800000","maroon");Colors.red=new ColorItem("#ff0000","red");Colors.purple=new ColorItem("#800080","purple");Colors.fuchsia=new ColorItem("#ff00ff","fuchsia");Colors.green=new ColorItem("#008000","green");Colors.lime=new ColorItem("#00ff00","lime");Colors.olive=new ColorItem("#808000","olive");Colors.yellow=new ColorItem("#ffff00","yellow");Colors.navy=new ColorItem("#000080","navy");Colors.blue=new ColorItem("#0000ff","blue");Colors.teal=new ColorItem("#008080","teal");Colors.aqua=new ColorItem("#00ffff","aqua");Colors.orange=new ColorItem("#ffa500","orange");Colors.aliceBlue=new ColorItem("#f0f8ff","aliceblue");Colors.antiqueWhite=new ColorItem("#faebd7","antiquewhite");Colors.aquaMarine=new ColorItem("#7fffd4","aquamarine");Colors.azure=new ColorItem("#f0ffff","azure");Colors.beige=new ColorItem("#f5f5dc","beige");Colors.bisque=new ColorItem("#ffe4c4","bisque");Colors.blanchedAlmond=new ColorItem("#ffebcd","blanchedalmond");Colors.blueViolet=new ColorItem("#8a2be2","blueviolet");Colors.brown=new ColorItem("#a52a2a","brown");Colors.burlyWood=new ColorItem("#deb887","burlywood");Colors.cadetBlue=new ColorItem("#5f9ea0","cadetblue");Colors.chartReuse=new ColorItem("#7fff00","chartreuse");Colors.chocolate=new ColorItem("#d2691e","chocolate");Colors.coral=new ColorItem("#ff7f50","coral");Colors.cornFlowerBlue=new ColorItem("#6495ed","cornflowerblue");Colors.cornSilk=new ColorItem("#fff8dc","cornsilk");Colors.crimson=new ColorItem("#dc143c","crimson");Colors.cyan=new ColorItem("#00ffff","cyan");Colors.darkBlue=new ColorItem("#00008b","darkblue");Colors.darkCyan=new ColorItem("#008b8b","darkcyan");Colors.darkGoldenRod=new ColorItem("#b8860b","darkgoldenrod");Colors.darkGray=new ColorItem("#a9a9a9","darkgray");Colors.darkGreen=new ColorItem("#006400","darkgreen");Colors.darkGrey=new ColorItem("#a9a9a9","darkgrey");Colors.darkKhaki=new ColorItem("#bdb76b","darkkhaki");Colors.darkMagenta=new ColorItem("#8b008b","darkmagenta");Colors.darkOliveGreen=new ColorItem("#556b2f","darkolivegreen");Colors.darkOrange=new ColorItem("#ff8c00","darkorange");Colors.darkOrchid=new ColorItem("#9932cc","darkorchid");Colors.darkRed=new ColorItem("#8b0000","darkred");Colors.darkSalmon=new ColorItem("#e9967a","darksalmon");Colors.darkSeaGreen=new ColorItem("#8fbc8f","darkseagreen");Colors.darkSlateBlue=new ColorItem("#483d8b","darkslateblue");Colors.darkSlateGray=new ColorItem("#2f4f4f","darkslategray");Colors.darkSlateGrey=new ColorItem("#2f4f4f","darkslategrey");Colors.darkTurquoise=new ColorItem("#00ced1","darkturquoise");Colors.darkViolet=new ColorItem("#9400d3","darkviolet");Colors.deepPink=new ColorItem("#ff1493","deeppink");Colors.deepSkyBlue=new ColorItem("#00bfff","deepskyblue");Colors.dimGray=new ColorItem("#696969","dimgray");Colors.dimGrey=new ColorItem("#696969","dimgrey");Colors.dodgerBlue=new ColorItem("#1e90ff","dodgerblue");Colors.fireBrick=new ColorItem("#b22222","firebrick");Colors.floralWhite=new ColorItem("#fffaf0","floralwhite");Colors.forestGreen=new ColorItem("#228b22","forestgreen");Colors.gainsboro=new ColorItem("#dcdcdc","gainsboro");Colors.ghostWhite=new ColorItem("#f8f8ff","ghostwhite");Colors.gold=new ColorItem("#ffd700","gold");Colors.goldenRod=new ColorItem("#daa520","goldenrod");Colors.greenYellow=new ColorItem("#adff2f","greenyellow");Colors.grey=new ColorItem("#808080","grey");Colors.honeyDew=new ColorItem("#f0fff0","honeydew");Colors.hotPink=new ColorItem("#ff69b4","hotpink");Colors.indianRed=new ColorItem("#cd5c5c","indianred");Colors.indigo=new ColorItem("#4b0082","indigo");Colors.ivory=new ColorItem("#fffff0","ivory");Colors.khaki=new ColorItem("#f0e68c","khaki");Colors.lavender=new ColorItem("#e6e6fa","lavender");Colors.lavenderBlush=new ColorItem("#fff0f5","lavenderblush");Colors.lawnGreen=new ColorItem("#7cfc00","lawngreen");Colors.lemonChiffon=new ColorItem("#fffacd","lemonchiffon");Colors.lightBlue=new ColorItem("#add8e6","lightblue");Colors.lightCoral=new ColorItem("#f08080","lightcoral");Colors.lightCyan=new ColorItem("#e0ffff","lightcyan");Colors.lightGoldenRodYellow=new ColorItem("#fafad2","lightgoldenrodyellow");Colors.lightGray=new ColorItem("#d3d3d3","lightgray");Colors.lightGreen=new ColorItem("#90ee90","lightgreen");Colors.lightGrey=new ColorItem("#d3d3d3","lightgrey");Colors.lightPink=new ColorItem("#ffb6c1","lightpink");Colors.lightSalmon=new ColorItem("#ffa07a","lightsalmon");Colors.lightSeaGreen=new ColorItem("#20b2aa","lightseagreen");Colors.lightSkyBlue=new ColorItem("#87cefa","lightskyblue");Colors.lightSlateGray=new ColorItem("#778899","lightslategray");Colors.lightSlateGrey=new ColorItem("#778899","lightslategrey");Colors.lightSteelBlue=new ColorItem("#b0c4de","lightsteelblue");Colors.lightYellow=new ColorItem("#ffffe0","lightyellow");Colors.limeGreen=new ColorItem("#32cd32","limegreen");Colors.linen=new ColorItem("#faf0e6","linen");Colors.magenta=new ColorItem("#ff00ff","magenta");Colors.mediumAquaMarine=new ColorItem("#66cdaa","mediumaquamarine");Colors.mediumBlue=new ColorItem("#0000cd","mediumblue");Colors.mediumOrchid=new ColorItem("#ba55d3","mediumorchid");Colors.mediumPurple=new ColorItem("#9370db","mediumpurple");Colors.mediumSeaGreen=new ColorItem("#3cb371","mediumseagreen");Colors.mediumSlateBlue=new ColorItem("#7b68ee","mediumslateblue");Colors.mediumSpringGreen=new ColorItem("#00fa9a","mediumspringgreen");Colors.mediumTurquoise=new ColorItem("#48d1cc","mediumturquoise");Colors.mediumVioletred=new ColorItem("#c71585","mediumvioletred");Colors.midNightBlue=new ColorItem("#191970","midnightblue");Colors.mintCream=new ColorItem("#f5fffa","mintcream");Colors.mistyRose=new ColorItem("#ffe4e1","mistyrose");Colors.moccasin=new ColorItem("#ffe4b5","moccasin");Colors.navajoWhite=new ColorItem("#ffdead","navajowhite");Colors.oldLace=new ColorItem("#fdf5e6","oldlace");Colors.oliveDrab=new ColorItem("#6b8e23","olivedrab");Colors.orangeRed=new ColorItem("#ff4500","orangered");Colors.orchid=new ColorItem("#da70d6","orchid");Colors.paleGoldenRod=new ColorItem("#eee8aa","palegoldenrod");Colors.paleGreen=new ColorItem("#98fb98","palegreen");Colors.paleTurquoise=new ColorItem("#afeeee","paleturquoise");Colors.paleVioletRed=new ColorItem("#db7093","palevioletred");Colors.papayaWhip=new ColorItem("#ffefd5","papayawhip");Colors.peachPuff=new ColorItem("#ffdab9","peachpuff");Colors.peru=new ColorItem("#cd853f","peru");Colors.pink=new ColorItem("#ffc0cb","pink");Colors.plum=new ColorItem("#dda0dd","plum");Colors.powderBlue=new ColorItem("#b0e0e6","powderblue");Colors.rosyBrown=new ColorItem("#bc8f8f","rosybrown");Colors.royalBlue=new ColorItem("#4169e1","royalblue");Colors.saddleBrown=new ColorItem("#8b4513","saddlebrown");Colors.salmon=new ColorItem("#fa8072","salmon");Colors.sandyBrown=new ColorItem("#f4a460","sandybrown");Colors.seaGreen=new ColorItem("#2e8b57","seagreen");Colors.seaShell=new ColorItem("#fff5ee","seashell");Colors.sienna=new ColorItem("#a0522d","sienna");Colors.skyBlue=new ColorItem("#87ceeb","skyblue");Colors.slateBlue=new ColorItem("#6a5acd","slateblue");Colors.slateGray=new ColorItem("#708090","slategray");Colors.slateGrey=new ColorItem("#708090","slategrey");Colors.snow=new ColorItem("#fffafa","snow");Colors.springGreen=new ColorItem("#00ff7f","springgreen");Colors.steelBlue=new ColorItem("#4682b4","steelblue");Colors.tan=new ColorItem("#d2b48c","tan");Colors.thistle=new ColorItem("#d8bfd8","thistle");Colors.tomato=new ColorItem("#ff6347","tomato");Colors.turquoise=new ColorItem("#40e0d0","turquoise");Colors.violet=new ColorItem("#ee82ee","violet");Colors.wheat=new ColorItem("#f5deb3","wheat");Colors.whiteSmoke=new ColorItem("#f5f5f5","whitesmoke");Colors.yellowGreen=new ColorItem("#9acd32","yellowgreen");Colors.rebeccaPurple=new ColorItem("#663399","rebeccapurple");Colors.transparent=new ColorItem("#00000000","transparent")}}}));AmdLoader.instance.setup("@web-atoms/core/dist/core/Colors");System.register(["./AtomBinder","./AtomWatcher"],(function(_export,_context){"use strict";var AtomBinder,AtomWatcher;function WatchProperty(target,key,descriptor){const{get}=descriptor;const isSetup=Symbol.for(`isSetup${key}`);return{get:function(){const watcher=new AtomWatcher(this,get,(()=>{AtomBinder.refreshValue(this,key)}),this);watcher.init(false);this.registerDisposable(watcher);this[isSetup]=watcher;Object.defineProperty(this,key,descriptor);return get.apply(this)},configurable:true}}_export("default",WatchProperty);return{setters:[function(_AtomBinder){AtomBinder=_AtomBinder.AtomBinder},function(_AtomWatcher){AtomWatcher=_AtomWatcher.AtomWatcher}],execute:function(){}}}));AmdLoader.instance.setup("@web-atoms/core/dist/core/WatchProperty");System.register([],(function(_export,_context){"use strict";function sleep(timeInMS,ct,throwOnCancel=true){let token=0;return new Promise(((resolve,reject)=>{ct===null||ct===void 0?void 0:ct.registerForCancel((reason=>{if(token){clearTimeout(token);if(throwOnCancel){reject(reason)}else{resolve()}}}));if(ct===null||ct===void 0?void 0:ct.cancelled){if(throwOnCancel){reject("cancelled")}else{resolve()}return}token=setTimeout(resolve,timeInMS)}))}_export("default",sleep);return{setters:[],execute:function(){}}}));AmdLoader.instance.setup("@web-atoms/core/dist/core/sleep");System.register(["tslib","../../core/Bind","../../core/BindableProperty","../../core/XNode","../../core/sleep","../../core/types","../../style/styled","../controls/AtomControl","../core/AtomUI"],(function(_export,_context){"use strict";var __awaiter,__decorate,__metadata,Bind,BindableProperty,XNode,sleep,CancelToken,styled,AtomControl,ChildEnumerator,PopupWindow,ConfirmPopup,popupService,loadPopupService,focus;_export({default:void 0,ConfirmPopup:void 0});return{setters:[function(_tslib){__awaiter=_tslib.__awaiter;__decorate=_tslib.__decorate;__metadata=_tslib.__metadata},function(_coreBind){Bind=_coreBind.default},function(_coreBindableProperty){BindableProperty=_coreBindableProperty.BindableProperty},function(_coreXNode){XNode=_coreXNode.default},function(_coreSleep){sleep=_coreSleep.default},function(_coreTypes){CancelToken=_coreTypes.CancelToken},function(_styleStyled){styled=_styleStyled.default},function(_controlsAtomControl){AtomControl=_controlsAtomControl.AtomControl},function(_coreAtomUI){ChildEnumerator=_coreAtomUI.ChildEnumerator}],execute:function(){loadPopupService=()=>__awaiter(void 0,void 0,void 0,(function*(){if(popupService){return popupService}return popupService=(yield _context.import("./PopupService")).default}));focus=popup=>{var _a,_b,_c;const element=popup.element;if(!element){return}const host=(_a=element.querySelector(`[data-window-element="title"]`))!==null&&_a!==void 0?_a:element.querySelector(`[data-window-element="action-bar"]`);if(host){popup.setupDragging(host)}const anyAutofocus=element.querySelector(`*[autofocus]`);if(!anyAutofocus){const cb=element.querySelector(".popup-close-button");if(cb){cb.focus()}return}(_c=(_b=anyAutofocus).focus)===null||_c===void 0?void 0:_c.call(_b)};styled.css`
72
+ `.installLocal();stack=0;_export("default",BusyProgress=class BusyProgress{static create(){if(!container){container=document.createElement("div");container.className=css;const progressBar=document.createElement("div");progressBar.className="progress-bar";container.appendChild(progressBar);const progressBarValue=document.createElement("div");progressBarValue.className="progress-bar-value";progressBar.appendChild(progressBarValue);document.body.appendChild(container)}stack++;if(stack===1){container.setAttribute("data-show","true")}return{dispose(){stack--;if(stack<=0){container.removeAttribute("data-show")}}}}})}}}));AmdLoader.instance.setup("@social-mail/social-mail-client/dist/services/BusyProgress");System.register(["tslib","@web-atoms/core/dist/di/DISingleton","@web-atoms/entity/dist/services/BaseEntityService","@web-atoms/core/dist/di/Inject","@web-atoms/core/dist/App","./BusyProgress"],(function(_export,_context){"use strict";var __decorate,__metadata,DISingleton,BaseEntityService,Inject,App,BusyProgress,EntityService;return{setters:[function(_tslib){__decorate=_tslib.__decorate;__metadata=_tslib.__metadata},function(_webAtomsCoreDistDiDISingleton){DISingleton=_webAtomsCoreDistDiDISingleton.default},function(_webAtomsEntityDistServicesBaseEntityService){BaseEntityService=_webAtomsEntityDistServicesBaseEntityService.default},function(_webAtomsCoreDistDiInject){Inject=_webAtomsCoreDistDiInject.Inject},function(_webAtomsCoreDistApp){App=_webAtomsCoreDistApp.App},function(_BusyProgress){BusyProgress=_BusyProgress.default}],execute:function(){EntityService=class EntityService extends BaseEntityService{constructor(){super(...arguments);this.queryProcessor="JavaScript"}createBusyIndicator(options){if(options.hideActivityIndicator){return}return BusyProgress.create()}};__decorate([Inject,__metadata("design:type",App)],EntityService.prototype,"app",void 0);EntityService=__decorate([DISingleton()],EntityService);_export("default",EntityService)}}}));AmdLoader.instance.setup("@social-mail/social-mail-client/dist/services/EntityService");System.register(["@web-atoms/date-time/dist/DateTime","@web-atoms/entity/dist/services/BaseEntityService"],(function(_export,_context){"use strict";var DateTime,Model,DefaultFactory,AppRole,AppFileContentDispositionArray,AppFile,AppFileVersion,AppFileAccessTypeArray,AppFileAccess,AppFileTag,FileContent,Configuration,Contact,ContactEmail,ContactPhone,ContactItem,ContactDomain,CachedItem,Domain,HostedDomain,DomainUser,DomainRelayTypeArray,DomainRelay,DomainKey,EmailStatusArray,Email,EmailEngagement,AppLog,EmailRecipientTypeArray,EmailRecipient,EmailTag,EmailAddress,EmailTemplate,Mailbox,MailboxEmail,MailboxContactStatusArray,MailboxContact,MailboxContactEmail,MailboxContactTag,MailboxSyncTargetDirectionArray,MailboxSyncTargetProtocolArray,MailboxSyncTargetLastSyncStatusArray,MailboxSyncTarget,ChannelConfig,SubscriberActivity,SearchWordStatusArray,SearchWord,SearchWordIndex,UserStatusArray,User,UserPin,UserPushSubscription,UserRole,UserMailbox,UserAuthFactorMethodArray,UserAuthFactor,WebSiteFolder,WebSiteFolderHost,WebSiteFolderVersion,LoginSession,TextDocument,Tag;return{setters:[function(_webAtomsDateTimeDistDateTime){DateTime=_webAtomsDateTimeDistDateTime.default},function(_webAtomsEntityDistServicesBaseEntityService){Model=_webAtomsEntityDistServicesBaseEntityService.Model;DefaultFactory=_webAtomsEntityDistServicesBaseEntityService.DefaultFactory}],execute:function(){_export("AppRole",AppRole=new Model("AppRole",["roleName"],{}));_export("AppFileContentDispositionArray",AppFileContentDispositionArray=[{label:"attachment",value:"attachment"},{label:"inline",value:"inline"}]);_export("AppFile",AppFile=new Model("AppFile",["appFileID"],{isFolder:false,name:"",fileSize:0,contentType:"",isDeleted:false,isShared:false,dateCreated:new DefaultFactory((()=>new DateTime))}));_export("AppFileVersion",AppFileVersion=new Model("AppFileVersion",["versionID"],{name:"",dateCreated:new DefaultFactory((()=>new DateTime))}));_export("AppFileAccessTypeArray",AppFileAccessTypeArray=[{label:"create",value:"create"},{label:"read",value:"read"},{label:"write",value:"write"},{label:"delegate",value:"delegate"}]);_export("AppFileAccess",AppFileAccess=new Model("AppFileAccess",["accessID","type"],{dateCreated:new DefaultFactory((()=>new DateTime)),dateUpdated:new DefaultFactory((()=>new DateTime))}));_export("AppFileTag",AppFileTag=new Model("AppFileTag",["appFileID","tagID"],{}));_export("FileContent",FileContent=new Model("FileContent",["fileContentID"],{contentHash:"",contentType:"",contentSize:0}));_export("Configuration",Configuration=new Model("Configuration",["name"],{configValue:""}));_export("Contact",Contact=new Model("Contact",["contactID"],{name:"",type:"",dateCreated:new DefaultFactory((()=>new DateTime)),dateUpdated:new DefaultFactory((()=>new DateTime))}));_export("ContactEmail",ContactEmail=new Model("ContactEmail",["emailAddressID","contactID"],{type:"",blocked:false}));_export("ContactPhone",ContactPhone=new Model("ContactPhone",["contactID","phoneNumberE64"],{type:""}));_export("ContactItem",ContactItem=new Model("ContactItem",["itemID"],{type:"",title:"",valuesJson:""}));_export("ContactDomain",ContactDomain=new Model("ContactDomain",["domainID","contactID"],{blocked:false}));_export("CachedItem",CachedItem=new Model("CachedItem",["itemID","keyHash"],{key:"",expiry:new DefaultFactory((()=>new DateTime)),ready:false,slide:false}));_export("Domain",Domain=new Model("Domain",["domainID"],{name:""}));_export("HostedDomain",HostedDomain=new Model("HostedDomain",["domainID"],{enableReceive:false,enableSend:false,useRelay:false,external:false}));_export("DomainUser",DomainUser=new Model("DomainUser",["domainID","userID"],{isAdmin:false,allowCreateMailbox:false}));_export("DomainRelayTypeArray",DomainRelayTypeArray=[{label:"smtp",value:"smtp"},{label:"ses",value:"ses"},{label:"https",value:"https"}]);_export("DomainRelay",DomainRelay=new Model("DomainRelay",["domainRelayID"],{type:"smtp",host:"",username:"",password:"",priority:0}));_export("DomainKey",DomainKey=new Model("DomainKey",["domainKeyID"],{name:"",keyType:"",publicKey:""}));_export("EmailStatusArray",EmailStatusArray=[{label:"queued",value:"queued"},{label:"received",value:"received"},{label:"draft",value:"draft"},{label:"published",value:"published"},{label:"pending-approval",value:"pending-approval"},{label:"scheduled",value:"scheduled"},{label:"sent",value:"sent"},{label:"sent-failed",value:"sent-failed"},{label:"deleted",value:"deleted"}]);_export("Email",Email=new Model("Email",["emailID"],{senderName:"",received:false,dateReceived:new DefaultFactory((()=>new DateTime)),dateCreated:new DefaultFactory((()=>new DateTime)),status:"queued",forwardCount:0,replyCount:0,viewCount:0,originalFileSize:0}));_export("EmailEngagement",EmailEngagement=new Model("EmailEngagement",["emailID"],{engagement:"",count:0}));_export("AppLog",AppLog=new Model("AppLog",["logID"],{dateCreated:new DefaultFactory((()=>new DateTime)),json:false}));_export("EmailRecipientTypeArray",EmailRecipientTypeArray=[{label:"from",value:"from"},{label:"to",value:"to"},{label:"cc",value:"cc"},{label:"bcc",value:"bcc"},{label:"viewer",value:"viewer"},{label:"editor",value:"editor"}]);_export("EmailRecipient",EmailRecipient=new Model("EmailRecipient",["emailID","emailAddressID"],{type:"from"}));_export("EmailTag",EmailTag=new Model("EmailTag",["emailID","tagID"],{}));_export("EmailAddress",EmailAddress=new Model("EmailAddress",["emailAddressID"],{emailAddress:"",name:"",blocked:false}));_export("EmailTemplate",EmailTemplate=new Model("EmailTemplate",["templateID"],{}));_export("Mailbox",Mailbox=new Model("Mailbox",["mailboxID"],{storage:0,maxStorage:0,indexAttachments:false,indexImageAttachments:false,dateCreated:new DefaultFactory((()=>new DateTime)),dateUpdated:new DefaultFactory((()=>new DateTime)),isChannel:false,isPrivateChannel:false,requireApproval:false,subscriberCount:0}));_export("MailboxEmail",MailboxEmail=new Model("MailboxEmail",["mailboxID","emailID"],{}));_export("MailboxContactStatusArray",MailboxContactStatusArray=[{label:"invited",value:"invited"},{label:"added",value:"added"},{label:"active",value:"active"},{label:"unsubscribed",value:"unsubscribed"},{label:"blocked",value:"blocked"}]);_export("MailboxContact",MailboxContact=new Model("MailboxContact",["mailboxID","emailAddressID"],{dateCreated:new DefaultFactory((()=>new DateTime)),dateUpdated:new DefaultFactory((()=>new DateTime)),unread:0,total:0,isOwner:false,canContribute:false,priority:0,blocked:false,mute:false,status:"invited"}));_export("MailboxContactEmail",MailboxContactEmail=new Model("MailboxContactEmail",["mailboxID","emailAddressID","emailID"],{dateReceived:new DefaultFactory((()=>new DateTime))}));_export("MailboxContactTag",MailboxContactTag=new Model("MailboxContactTag",["mailboxID","emailAddressID","tagID"],{count:0,dateUpdated:new DefaultFactory((()=>new DateTime))}));_export("MailboxSyncTargetDirectionArray",MailboxSyncTargetDirectionArray=[{label:"in",value:"in"},{label:"out",value:"out"}]);_export("MailboxSyncTargetProtocolArray",MailboxSyncTargetProtocolArray=[{label:"imap",value:"imap"}]);_export("MailboxSyncTargetLastSyncStatusArray",MailboxSyncTargetLastSyncStatusArray=[{label:"none",value:"none"},{label:"success",value:"success"},{label:"failed",value:"failed"}]);_export("MailboxSyncTarget",MailboxSyncTarget=new Model("MailboxSyncTarget",["syncTargetID"],{direction:"in",protocol:"imap",username:"",host:"",port:0,isSecure:false,syncAllFolders:false,syncJunkMails:false,intervalSeconds:0,active:false}));_export("ChannelConfig",ChannelConfig=new Model("ChannelConfig",["mailboxID"],{sendInviteOnEngagement:false,memberOnlyEngagement:false,notSafeForWork:false}));_export("SubscriberActivity",SubscriberActivity=new Model("SubscriberActivity",["activityID"],{activity:"",dateCreated:new DefaultFactory((()=>new DateTime))}));_export("SearchWordStatusArray",SearchWordStatusArray=[{label:"begin",value:"begin"},{label:"ready",value:"ready"},{label:"deleted",value:"deleted"}]);_export("SearchWord",SearchWord=new Model("SearchWord",["wordID"],{word:"",dateCreated:new DefaultFactory((()=>new DateTime)),dateUpdated:new DefaultFactory((()=>new DateTime)),status:"begin"}));_export("SearchWordIndex",SearchWordIndex=new Model("SearchWordIndex",["wordID","fileContentID"],{rank:0}));_export("UserStatusArray",UserStatusArray=[{label:"active",value:"active"},{label:"blocked",value:"blocked"},{label:"locked",value:"locked"},{label:"change-password",value:"change-password"},{label:"external",value:"external"}]);_export("User",User=new Model("User",["userID"],{userName:"",displayName:"",status:"active",isExternal:false,multiFactor:false,dateUpdated:new DefaultFactory((()=>new DateTime))}));_export("UserPin",UserPin=new Model("UserPin",["pinID"],{}));_export("UserPushSubscription",UserPushSubscription=new Model("UserPushSubscription",["subscriptionID"],{notify:false}));_export("UserRole",UserRole=new Model("UserRole",["userID","roleName"],{}));_export("UserMailbox",UserMailbox=new Model("UserMailbox",["userID","mailboxID"],{}));_export("UserAuthFactorMethodArray",UserAuthFactorMethodArray=[{label:"totp",value:"totp"},{label:"hotp",value:"hotp"},{label:"fido2",value:"fido2"},{label:"one-time",value:"one-time"}]);_export("UserAuthFactor",UserAuthFactor=new Model("UserAuthFactor",["authFactorID"],{method:"totp",verified:false,dateUpdated:new DefaultFactory((()=>new DateTime))}));_export("WebSiteFolder",WebSiteFolder=new Model("WebSiteFolder",["folderID"],{isStatic:false,isModified:false}));_export("WebSiteFolderHost",WebSiteFolderHost=new Model("WebSiteFolderHost",["host"],{}));_export("WebSiteFolderVersion",WebSiteFolderVersion=new Model("WebSiteFolderVersion",["folderID","snapshotFolderID"],{dateCreated:new DefaultFactory((()=>new DateTime)),name:""}));_export("LoginSession",LoginSession=new Model("LoginSession",["sessionID"],{invalid:false,dateUpdated:new DefaultFactory((()=>new DateTime))}));_export("TextDocument",TextDocument=new Model("TextDocument",["textDocumentID"],{searchable:""}));_export("Tag",Tag=new Model("Tag",["tagID"],{name:"",isSystemTag:false}))}}}));AmdLoader.instance.setup("@social-mail/social-mail-client/dist/model/model");System.register([],(function(_export,_context){"use strict";var Sql;return{setters:[],execute:function(){_export("Sql",Sql=void 0)}}}));AmdLoader.instance.setup("@social-mail/social-mail-client/dist/common/Sql");System.register(["tslib","./http/JsonError"],(function(_export,_context){"use strict";var __awaiter,JsonError,FetchBuilder;function buildUrl(strings,...p){let r="";for(let index=0;index<strings.length;index++){const element=strings[index];r+=element;if(index<p.length){r+=encodeURIComponent(p[index])}}return r}_export({buildUrl,default:void 0});return{setters:[function(_tslib){__awaiter=_tslib.__awaiter},function(_httpJsonError){JsonError=_httpJsonError.default}],execute:function(){_export("default",FetchBuilder=class FetchBuilder{static get(url){return this.method(url,"GET")}static put(url){return this.method(url,"PUT")}static post(url){return this.method(url,"POST")}static delete(url){return this.method(url,"DELETE")}static method(url,method){return new FetchBuilder({url,method})}constructor(request){this.request=request}cancelToken(cancelToken){const ac=new AbortController;cancelToken.registerForCancel((()=>ac.abort()));return this.signal(ac.signal)}signal(signal){return this.append({signal})}form(name,value,fileName){var _a;if(value===void 0){return this}const body=(_a=this.request.body)!==null&&_a!==void 0?_a:new FormData;if(fileName){if(typeof value==="string"){throw new Error("value must be a blob with content type set correctly.")}body.append(name,value,fileName)}else{body.append(name,value)}return this.append({body})}jsonBody(body,encode=true){var _a;if(encode){body=JSON.stringify(body)}const headers=(_a=this.request.headers)!==null&&_a!==void 0?_a:{};headers["content-type"]="application/json";return this.append({body,headers})}header(name,value){var _a;const headers=(_a=this.request.headers)!==null&&_a!==void 0?_a:{};headers[name]=value;return this.append({headers})}path(name,value,encode=true){let url=this.request.url;if(encode){value=encodeURIComponent(value)}url=url.replace(name,value);return this.append({url})}query(name,value,encode=true){if(value===void 0){return this}let url=this.request.url;if(encode){value=encodeURIComponent(value)}name=encodeURIComponent(name);if(url.indexOf("?")===-1){url+=`?${name}=${value}`}else{url+=`&${name}=${value}`}return this.append({url})}responseAsText(ensureSuccess=true){return __awaiter(this,void 0,void 0,(function*(){const r=yield this.response();if(ensureSuccess){yield this.ensureSuccess(r)}return yield r.text()}))}responseAsBlob(ensureSuccess=true){return __awaiter(this,void 0,void 0,(function*(){const r=yield this.response();if(ensureSuccess){yield this.ensureSuccess(r)}return yield r.blob()}))}responseAsJson(ensureSuccess=true){return __awaiter(this,void 0,void 0,(function*(){const r=yield this.response();if(ensureSuccess){yield this.ensureSuccess(r)}return yield r.json()}))}response(){return fetch(this.request.url,this.request)}ensureSuccess(r){return __awaiter(this,void 0,void 0,(function*(){if(r.status<=300){return}const type=r.headers.get("content-type");if(/\/json/i.test(type)){const json=yield r.json();throw new JsonError(`Failed for ${this.request.url}`,json)}const text=yield r.text();throw new Error(`Failed for ${this.request.url}\n${text}`)}))}append(r){return new FetchBuilder(Object.assign(Object.assign({},this.request),r))}})}}}));AmdLoader.instance.setup("@web-atoms/core/dist/services/FetchBuilder");System.register(["tslib","@web-atoms/core/dist/di/DISingleton","@web-atoms/entity/dist/models/TaskManager","../../model/model","@web-atoms/core/dist/services/FetchBuilder","@web-atoms/core/dist/di/Inject","../EntityService","@web-atoms/date-time/dist/DateTime"],(function(_export,_context){"use strict";var __awaiter,__decorate,__metadata,DISingleton,TaskManager,EmailEngagement,FetchBuilder,Inject,EntityService,DateTime,EmailContentDownloader;return{setters:[function(_tslib){__awaiter=_tslib.__awaiter;__decorate=_tslib.__decorate;__metadata=_tslib.__metadata},function(_webAtomsCoreDistDiDISingleton){DISingleton=_webAtomsCoreDistDiDISingleton.default},function(_webAtomsEntityDistModelsTaskManager){TaskManager=_webAtomsEntityDistModelsTaskManager.default},function(_modelModel){EmailEngagement=_modelModel.EmailEngagement},function(_webAtomsCoreDistServicesFetchBuilder){FetchBuilder=_webAtomsCoreDistServicesFetchBuilder.default},function(_webAtomsCoreDistDiInject){Inject=_webAtomsCoreDistDiInject.Inject},function(_EntityService){EntityService=_EntityService.default},function(_webAtomsDateTimeDistDateTime){DateTime=_webAtomsDateTimeDistDateTime.default}],execute:function(){EmailContentDownloader=class EmailContentDownloader extends TaskManager{download(email){return __awaiter(this,void 0,void 0,(function*(){yield this.downloadEngagements(email);if(email.htmlBody){return email.htmlBody}if(!email.originalFileID){return}const cache=yield window.caches.open("email-content-cache");const cacheKey=new URL(email.htmlBodyUrl,location.href);const content=yield cache.match(cacheKey);if(content){return email.htmlBody=yield content.text()}return yield this.run((()=>__awaiter(this,void 0,void 0,(function*(){for(let i=0;i<3;i++){try{const text=yield FetchBuilder.get(email.htmlBodyUrl).responseAsText();yield cache.put(cacheKey,new Response(text,{headers:{"cache-control":"public, max-age=86000"}}));return email.htmlBody=text}catch(error){console.error(error)}}}))))}))}downloadEngagements(email){return __awaiter(this,void 0,void 0,(function*(){const{emailID}=email;let now=DateTime.now;const minute=Math.floor(now.minute/5);now=now.addMinutes(-minute);const cacheVersion=now.msSinceEpoch.toString(36);email.engagements=yield this.entityService.query(EmailEngagement).where({emailID},(p=>x=>x.emailID===p.emailID)).toArray({cacheVersion,cacheSeconds:300})}))}};__decorate([Inject,__metadata("design:type",EntityService)],EmailContentDownloader.prototype,"entityService",void 0);EmailContentDownloader=__decorate([DISingleton({})],EmailContentDownloader);_export("default",EmailContentDownloader)}}}));AmdLoader.instance.setup("@social-mail/social-mail-client/dist/services/email/EmailContentDownloader");System.register(["tslib","@web-atoms/core/dist/di/DISingleton","@web-atoms/core/dist/di/Inject","../../services/EntityService","../../model/model","../../common/Sql","../../services/email/EmailContentDownloader"],(function(_export,_context){"use strict";var __awaiter,__decorate,__metadata,DISingleton,Inject,EntityService,Email,Mailbox,Sql,EmailContentDownloader,BlogService;return{setters:[function(_tslib){__awaiter=_tslib.__awaiter;__decorate=_tslib.__decorate;__metadata=_tslib.__metadata},function(_webAtomsCoreDistDiDISingleton){DISingleton=_webAtomsCoreDistDiDISingleton.default},function(_webAtomsCoreDistDiInject){Inject=_webAtomsCoreDistDiInject.Inject},function(_servicesEntityService){EntityService=_servicesEntityService.default},function(_modelModel){Email=_modelModel.Email;Mailbox=_modelModel.Mailbox},function(_commonSql){Sql=_commonSql.Sql},function(_servicesEmailEmailContentDownloader){EmailContentDownloader=_servicesEmailEmailContentDownloader.default}],execute:function(){BlogService=class BlogService{getEmail({emailID,channelID}){return __awaiter(this,void 0,void 0,(function*(){const q=this.entityService.query(Email,"channelEmails",channelID).where({emailID},(p=>x=>x.emailID===p.emailID)).include((x=>[x.children]));return q.firstOrDefault()}))}getEmails({channelID=0,search="",start=0,size=10,cancelToken}){return __awaiter(this,void 0,void 0,(function*(){let q=this.entityService.query(Email,"channelEmails",channelID);if(search){q=q.where({search},(p=>x=>Sql.text.includes(x.textBody,p.search)))}const emails=yield q.include((x=>[x.attachments])).orderByDescending((x=>x.dateSent)).toPagedList({start,size,cancelToken});const tasks=[];for(const iterator of emails.items){if(!iterator.htmlBody){tasks.push(this.downloader.download(iterator))}}yield Promise.all(tasks);return emails}))}getChannel(channelID,emailAddress){return __awaiter(this,void 0,void 0,(function*(){let q=this.entityService.query(Mailbox,"channels",emailAddress).where((x=>x.datePublished!==null));if(channelID){q=q.where({channelID},(p=>x=>x.mailboxID===p.channelID))}const c=yield q.include((x=>x.emailAddress)).orderByDescending((x=>x.datePublished)).firstOrDefault();return c}))}};__decorate([Inject,__metadata("design:type",EntityService)],BlogService.prototype,"entityService",void 0);__decorate([Inject,__metadata("design:type",EmailContentDownloader)],BlogService.prototype,"downloader",void 0);BlogService=__decorate([DISingleton()],BlogService);_export("default",BlogService)}}}));AmdLoader.instance.setup("@social-mail/social-mail-client/dist/public/channel/BlogService");System.register(["@web-atoms/date-time/dist/DateTime"],(function(_export,_context){"use strict";var DateTime,DIVISIONS,DateFormats;return{setters:[function(_webAtomsDateTimeDistDateTime){DateTime=_webAtomsDateTimeDistDateTime.default}],execute:function(){DIVISIONS=[{amount:60,name:"seconds"},{amount:60,name:"minutes"},{amount:24,name:"hours"},{amount:7,name:"days"},{amount:4.34524,name:"weeks"},{amount:12,name:"months"},{amount:Number.POSITIVE_INFINITY,name:"years"}];_export("DateFormats",DateFormats={diff(d){if(!d){return""}if(!(d instanceof DateTime)){d=typeof d==="string"?new DateTime(d):DateTime.from(d)}const today=DateTime.now;let diff=today.diff(d);if(diff.totalMilliseconds<0){diff=d.diff(today)}if(diff.totalHours<=24){if(diff.totalSeconds<=180){return"now"}if(diff.totalMinutes<60){return Math.round(diff.totalMinutes)+"m"}return Math.round(diff.totalHours)+"h"}if(diff.totalDays<=30){return Math.round(diff.totalDays)+"d"}if(diff.totalDays<=365){return Math.round(diff.totalDays/30)+"mo"}return Math.round(diff.totalDays/365)+"yr"},withWeekDayAndTime(d,def=""){var _a;if(!d){return def}d=DateTime.from(d);return(_a=d===null||d===void 0?void 0:d.toLocaleString(navigator.language,{year:"numeric",month:"short",day:"numeric",weekday:"short",hour12:true,minute:"numeric",hour:"numeric"}))!==null&&_a!==void 0?_a:def},relative:{short(d){if(!d){return""}d=DateTime.from(d);const now=DateTime.now;if(now<d){return"in "+DateFormats.diff(d)}return DateFormats.diff(d)+" ago"}}})}}}));AmdLoader.instance.setup("@social-mail/social-mail-client/dist/common/date/DateFormats");System.register([],(function(_export,_context){"use strict";function newCSSStyleDeclaration(){const e=document.createElement("div");return e.style}function mergeStyle(...styles){var _a,_b;const s=newCSSStyleDeclaration();for(const iterator of styles){if(!iterator){continue}if(iterator instanceof CSSStyleDeclaration){for(let index=0;index<iterator.length;index++){const name=iterator[index];let value=(_a=iterator[name])===null||_a===void 0?void 0:_a.toString();if(value===void 0||value===null||value===""){continue}s[name]=value}continue}for(const key in iterator){if(Object.prototype.hasOwnProperty.call(iterator,key)){const element=(_b=iterator[key])===null||_b===void 0?void 0:_b.toString();if(!element){continue}s[key]=element}}}return s}_export({newCSSStyleDeclaration,default:mergeStyle});return{setters:[],execute:function(){}}}));AmdLoader.instance.setup("@web-atoms/email-dom/dist/style/mergeStyle");System.register(["../style/mergeStyle"],(function(_export,_context){"use strict";var newCSSStyleDeclaration,StyleHelper,toStyle;_export("default",void 0);return{setters:[function(_styleMergeStyle){newCSSStyleDeclaration=_styleMergeStyle.newCSSStyleDeclaration}],execute:function(){toStyle=style=>{var _a;if(typeof style==="string"){const css=style;const cs=newCSSStyleDeclaration();cs.cssText=css;return cs}const s=newCSSStyleDeclaration();if(style instanceof CSSStyleDeclaration){return style}for(const key in style){if(Object.prototype.hasOwnProperty.call(style,key)){const element=(_a=style[key])===null||_a===void 0?void 0:_a.toString();if(element===void 0||element===null||element===""){continue}s[key]=element}}return s};_export("default",StyleHelper=class StyleHelper{static styleToString(style,props){var _a;if(!style){return}const cs=toStyle(style);if(props){const ps=toStyle(props);for(let index=0;index<ps.length;index++){const key=ps[index];let value=(_a=ps[key])===null||_a===void 0?void 0:_a.toString();if(value===void 0||value===null||value===""){continue}cs[key]=value}}const allKeys=[];for(let index=0;index<cs.length;index++){const key=cs[index];allKeys.push(key)}for(const key of allKeys){if(!cs[key]){cs.removeProperty(key)}}return cs.cssText}})}}}));AmdLoader.instance.setup("@web-atoms/email-dom/dist/dom/StyleHelper");System.register(["@web-atoms/core/dist/core/XNode","./dom/StyleHelper"],(function(_export,_context){"use strict";var XNode,StyleHelper;function DomToString(node){const div=document.createElement("div");render(div,XNode.create("div",null,node));return div.innerHTML}function render(div,node){var _a;while(typeof node.name==="function"){node=node.name(node.attributes,...node.children)}const a=node.attributes;if(a){for(const key in a){if(Object.prototype.hasOwnProperty.call(a,key)){let element=a[key];if(element===null||element===void 0){continue}if(typeof element==="object"&&key==="style"){element=StyleHelper.styleToString(element)}else{element=element.toString()}if(!element){continue}if(key==="text"){div.textContent=element;continue}if(key.startsWith("style")&&key.length>5){div.style[key.substring(5)]=element;continue}if(key.startsWith("data")&&key.length>4){if(key.indexOf("-")!==-1){div.setAttribute(key,element);continue}div.dataset[key.substring(4)]=element;continue}div.setAttribute(key,element)}}}if(!((_a=node.children)===null||_a===void 0?void 0:_a.length)){return}for(let iterator of node.children){if(iterator===false||iterator===void 0||iterator===null){continue}if(typeof iterator!=="object"){div.appendChild(document.createTextNode(iterator.toString()));continue}while(typeof iterator.name==="function"){iterator=iterator.name(iterator.attributes,...iterator.children)}const child=document.createElement(iterator.name);div.appendChild(child);render(child,iterator)}}_export("default",DomToString);return{setters:[function(_webAtomsCoreDistCoreXNode){XNode=_webAtomsCoreDistCoreXNode.default},function(_domStyleHelper){StyleHelper=_domStyleHelper.default}],execute:function(){}}}));AmdLoader.instance.setup("@web-atoms/email-dom/dist/DomToString");System.register(["@web-atoms/core/dist/core/EventScope"],(function(_export,_context){"use strict";var EventScope,CommonEvents;return{setters:[function(_webAtomsCoreDistCoreEventScope){EventScope=_webAtomsCoreDistCoreEventScope.default}],execute:function(){_export("CommonEvents",CommonEvents={onThreadMarkedAsRead:EventScope.create(),onThreadMarkedAsBlocked:EventScope.create(),onDraftDeleted:EventScope.create(),onFileDeleted:EventScope.create(),onEmailScheduled:EventScope.create(),onEmailUnscheduled:EventScope.create()})}}}));AmdLoader.instance.setup("@social-mail/social-mail-client/dist/common/events/CommonEvents");System.register(["tslib","@web-atoms/core/dist/di/DISingleton","@web-atoms/core/dist/di/Inject","../../../../services/EntityService","../../../../model/model","../../../../common/Sql","@web-atoms/email-dom/dist/DomToString","@web-atoms/core/dist/core/XNode","@web-atoms/core/dist/web/controls/AtomControl","@web-atoms/core/dist/web/core/AtomUI","@web-atoms/date-time/dist/DateTime","../../../../common/events/CommonEvents","../../../../services/BusyProgress","../../../../services/email/EmailContentDownloader"],(function(_export,_context){"use strict";var __awaiter,__decorate,__metadata,DISingleton,Inject,EntityService,Email,EmailRecipient,MailboxContactEmail,MailboxEmail,Sql,DomToString,XNode,AtomControl,descendentElementIterator,DateTime,CommonEvents,BusyProgress,EmailContentDownloader,renderMail,downloadEmailContent,ConversationService;return{setters:[function(_tslib){__awaiter=_tslib.__awaiter;__decorate=_tslib.__decorate;__metadata=_tslib.__metadata},function(_webAtomsCoreDistDiDISingleton){DISingleton=_webAtomsCoreDistDiDISingleton.default},function(_webAtomsCoreDistDiInject){Inject=_webAtomsCoreDistDiInject.Inject},function(_servicesEntityService){EntityService=_servicesEntityService.default},function(_modelModel){Email=_modelModel.Email;EmailRecipient=_modelModel.EmailRecipient;MailboxContactEmail=_modelModel.MailboxContactEmail;MailboxEmail=_modelModel.MailboxEmail},function(_commonSql){Sql=_commonSql.Sql},function(_webAtomsEmailDomDistDomToString){DomToString=_webAtomsEmailDomDistDomToString.default},function(_webAtomsCoreDistCoreXNode){XNode=_webAtomsCoreDistCoreXNode.default},function(_webAtomsCoreDistWebControlsAtomControl){AtomControl=_webAtomsCoreDistWebControlsAtomControl.AtomControl},function(_webAtomsCoreDistWebCoreAtomUI){descendentElementIterator=_webAtomsCoreDistWebCoreAtomUI.descendentElementIterator},function(_webAtomsDateTimeDistDateTime){DateTime=_webAtomsDateTimeDistDateTime.default},function(_commonEventsCommonEvents){CommonEvents=_commonEventsCommonEvents.CommonEvents},function(_servicesBusyProgress){BusyProgress=_servicesBusyProgress.default},function(_servicesEmailEmailContentDownloader){EmailContentDownloader=_servicesEmailEmailContentDownloader.default}],execute:function(){_export("renderMail",renderMail=AtomControl.registerProperty("data-html","html",((c,e,value)=>{if(!value){e.innerHTML="";return}const thread=value;const mail=thread.email;const html=mail.htmlBody;const msg=document.createElement("div");if(!html){for(const iterator of html.split("\n")){const p=document.createElement("p");p.appendChild(document.createTextNode(iterator));msg.appendChild(p)}e.appendChild(msg);return}msg.innerHTML=html;for(const iterator of descendentElementIterator(msg)){if(iterator.tagName==="IMG"){const src=iterator.getAttribute("src");if(src){if(src.startsWith("cid:")){const cid=src.substring(4);const a=mail.attachments.find((x=>x.contentID===cid));if(a){iterator.setAttribute("src",`/api/files/${a.appFileID}/${a.fileContentID}/${a.name}`)}}if(/^http\:\/\//i.test(src)){iterator.setAttribute("src",src.substring(5))}}continue}if(iterator.tagName==="A"){iterator.target="_blank"}}const shadow=e.attachShadow({mode:"open"});shadow.appendChild(msg);if(!thread.timeRead&&thread.mailboxID){const timeRead=DateTime.now;thread.timeRead=timeRead;const control=AtomControl.from(e);const entityService=control.app.resolve(EntityService);entityService.save(MailboxContactEmail.patch(thread,{timeRead})).then((()=>{CommonEvents.onThreadMarkedAsRead.dispatchEvent(thread)}),console.error)}return})));downloadEmailContent=(es,email)=>__awaiter(void 0,void 0,void 0,(function*(){var _a,_b;if(email.replyCount){const children=yield es.query(Email).where({emailID:email.emailID},(p=>x=>x.emailID===p.emailID&&x.engagement!==null)).orderByDescending((x=>x.emailID)).toPagedList({start:0,size:4,cacheVersion:"a",cacheSeconds:900});email.children=(_a=children===null||children===void 0?void 0:children.items)!==null&&_a!==void 0?_a:[]}else{(_b=email.children)!==null&&_b!==void 0?_b:email.children=[]}if(!email.originalFileID){return}for(let i=0;i<10;i++){try{const rs=yield fetch(email.htmlBodyUrl);const text=yield rs.text();email.htmlBody=text;return}catch(error){console.error(error)}}}));ConversationService=class ConversationService{getDraft({mailboxID,emailAddressID,email}){return __awaiter(this,void 0,void 0,(function*(){const draft="draft";return yield this.entityService.query(MailboxContactEmail).where({mailboxID,emailAddressID,draft},(p=>x=>x.mailboxID===p.mailboxID&&x.emailAddressID===p.emailAddressID&&x.email.status===p.draft)).orderByDescending((x=>x.emailID)).include((x=>[x.email.recipients,x.email.attachments])).firstOrDefault()}))}draft({mailboxID,emailAddressID,email},create=false){var _a,_b,_c;return __awaiter(this,void 0,void 0,(function*(){if(email===null||email===void 0?void 0:email.emailID){if(!email.textBody){email.textBody=email.mdBody}email.subject||(email.subject="");const cloner=this.entityService.cloner(email).include((x=>x.attachments)).include((x=>x.recipients));yield this.entityService.save(cloner.copy);return email}if(create&&email){const recipients=(_a=email.recipients)!==null&&_a!==void 0?_a:email.recipients=[];const mailboxes=(_b=email.mailboxes)!==null&&_b!==void 0?_b:email.mailboxes=[];const threads=(_c=email.threadEmails)!==null&&_c!==void 0?_c:email.threadEmails=[];email.senderID=mailboxID;email.status="draft";if(!mailboxes.some((m=>m.mailboxID===mailboxID))){mailboxes.push(MailboxEmail.create({mailboxID}))}if(!recipients.some((r=>r.emailAddressID===emailAddressID))){recipients.push(EmailRecipient.create({emailAddressID}))}if(!threads.some((r=>r.mailboxID===mailboxID))){threads.push(MailboxContactEmail.create({mailboxID,emailAddressID}))}yield this.entityService.save(email)}return email}))}list({search="",mailboxID,emailAddressID,start=0,size=100,version=0,cancelToken}){var _a,_b,_c;return __awaiter(this,void 0,void 0,(function*(){let q=this.entityService.query(MailboxContactEmail).where({mailboxID,emailAddressID},(p=>x=>x.mailboxID===p.mailboxID&&x.emailAddressID===p.emailAddressID&&x.engagement===null));if(search){if(!/\%/.test(search)){search=`%${search}%`}q=q.where({search},(p=>x=>Sql.text.iLike(x.email.subject,p.search)||Sql.text.iLike(x.email.textBody,p.search)||Sql.text.iLike(x.email.originalFile.fileContent.textDocument.searchable,p.search)))}const emails=yield q.include((x=>[x.email.recipients.forEach((r=>r.emailAddress)),x.email.attachments,x.email.senderUser,x.email.senderEmail])).orderByDescending((x=>x.dateReceived)).toPagedList({start,size,cancelToken});const tasks=[];const d=BusyProgress.create();try{for(const{email}of emails.items){(_a=email.htmlBody)!==null&&_a!==void 0?_a:email.htmlBody="";(_b=email.textBody)!==null&&_b!==void 0?_b:email.textBody="";tasks.push(this.downloadEmailContent(email))}yield Promise.all(tasks)}finally{(_c=d===null||d===void 0?void 0:d.dispose)===null||_c===void 0?void 0:_c.call(d)}return emails}))}stopEmail(mce){return __awaiter(this,void 0,void 0,(function*(){const{email}=mce;email.status="draft";yield this.entityService.save(email,(c=>c));CommonEvents.onEmailUnscheduled.dispatchEvent(mce)}))}downloadEmailContent(email){var _a,_b;return __awaiter(this,void 0,void 0,(function*(){if(email.replyCount){const children=yield this.entityService.query(Email).where({emailID:email.emailID},(p=>x=>x.emailID===p.emailID&&x.engagement!==null)).orderByDescending((x=>x.emailID)).toPagedList({start:0,size:4,cacheVersion:"a",cacheSeconds:900});email.children=(_a=children===null||children===void 0?void 0:children.items)!==null&&_a!==void 0?_a:[]}else{(_b=email.children)!==null&&_b!==void 0?_b:email.children=[]}yield this.emailContentDownloader.download(email)}))}renderText(html){const div=document.createElement("div");div.innerHTML=html;return div.textContent}renderHtml(html){const div=document.createElement("div");div.innerHTML=html;return div.innerHTML}toHtml(textBody){return DomToString(XNode.create("div",null,...textBody.split("\n").map((p=>XNode.create("p",{text:p})))))}block(thread){return __awaiter(this,void 0,void 0,(function*(){thread.blocked=!thread.blocked;const cloner=this.entityService.cloner(thread).copy;yield this.entityService.save(cloner);CommonEvents.onThreadMarkedAsBlocked.dispatchEvent(thread)}))}delete(email){return __awaiter(this,void 0,void 0,(function*(){const{emailID,status}=email;yield this.entityService.delete(Email.create({emailID,status}));CommonEvents.onDraftDeleted.dispatchEvent(email)}))}};__decorate([Inject,__metadata("design:type",EntityService)],ConversationService.prototype,"entityService",void 0);__decorate([Inject,__metadata("design:type",EmailContentDownloader)],ConversationService.prototype,"emailContentDownloader",void 0);ConversationService=__decorate([DISingleton()],ConversationService);_export("default",ConversationService)}}}));AmdLoader.instance.setup("@social-mail/social-mail-client/dist/web/page/mails/service/ConversationService");System.register(["tslib","@web-atoms/core/dist/core/InjectProperty","@web-atoms/core/dist/web/controls/AtomControl","./BlogService","@web-atoms/core/dist/core/XNode","../../common/date/DateFormats","../../web/page/mails/service/ConversationService"],(function(_export,_context){"use strict";var __awaiter,__decorate,__metadata,InjectProperty,AtomControl,BlogService,XNode,DateFormats,renderMail,ChannelMessage,_a,url,channelID,emailID;_export("default",void 0);return{setters:[function(_tslib){__awaiter=_tslib.__awaiter;__decorate=_tslib.__decorate;__metadata=_tslib.__metadata},function(_webAtomsCoreDistCoreInjectProperty){InjectProperty=_webAtomsCoreDistCoreInjectProperty.default},function(_webAtomsCoreDistWebControlsAtomControl){AtomControl=_webAtomsCoreDistWebControlsAtomControl.AtomControl},function(_BlogService){BlogService=_BlogService.default},function(_webAtomsCoreDistCoreXNode){XNode=_webAtomsCoreDistCoreXNode.default},function(_commonDateDateFormats){DateFormats=_commonDateDateFormats.DateFormats},function(_webPageMailsServiceConversationService){renderMail=_webPageMailsServiceConversationService.renderMail}],execute:function(){url=window.pageUrl;({1:channelID=1,2:emailID=82}=(_a=/^\/channels\/([^\/]+)\/([^\/]+)\//.exec(url.pathname))!==null&&_a!==void 0?_a:{});channelID=parseInt(channelID,36);emailID=parseInt(emailID,36);_export("default",ChannelMessage=class ChannelMessage extends AtomControl{init(){return __awaiter(this,void 0,void 0,(function*(){const{items:[email]}=yield this.blogService.getEmails({channelID,start:0,size:1,cancelToken:null});this.renderer=XNode.create("section",{"data-element":"blog-item"},XNode.create("h4",{"data-element":"title"},XNode.create("label",{text:email.subject})),XNode.create("h6",{"data-element":"date",text:DateFormats.relative.short(email.dateSent)}),XNode.create("h6",{text:email.senderName}),XNode.create("section",{"data-element":"content"},XNode.create("section",Object.assign({},renderMail({email})))))}))}});__decorate([InjectProperty,__metadata("design:type",BlogService)],ChannelMessage.prototype,"blogService",void 0)}}}));AmdLoader.instance.setup("@social-mail/social-mail-client/dist/public/channel/ChannelMessage");System.register([],(function(_export,_context){"use strict";var ColorItem,Colors;function toFixedString(t){return("0"+t.toString(16)).slice(-2)}_export({ColorItem:void 0,default:void 0});return{setters:[],execute:function(){_export("ColorItem",ColorItem=class ColorItem{constructor(colorCodeOrRed,namedColorOrGreen,blue,alpha){if(typeof colorCodeOrRed==="string"){this.colorCode=colorCodeOrRed;if(typeof namedColorOrGreen==="string"){this.namedColor=namedColorOrGreen}const r=ColorItem.parseRgb(this.colorCode);this.red=r.red;this.green=r.green;this.blue=r.blue;this.alpha=r.alpha}else{this.red=colorCodeOrRed;if(typeof namedColorOrGreen==="number"){this.green=namedColorOrGreen}this.blue=blue;this.alpha=alpha;this.colorCode=ColorItem.rgb(this.red,this.green,this.blue,this.alpha)}}toString(){return this.colorCode}withAlphaPercent(a){return new ColorItem(this.red,this.green,this.blue,a)}static parseRgb(rgba){if(/^\#/.test(rgba)){rgba=rgba.substr(1);if(rgba.length===3){rgba=rgba.split("").map((x=>x+x)).join("")}const red=Number.parseInt(rgba[0]+rgba[1],16);const green=Number.parseInt(rgba[2]+rgba[3],16);const blue=Number.parseInt(rgba[4]+rgba[5],16);if(rgba.length>6){const alpha=Number.parseInt(rgba[6]+rgba[7],16);return{red,green,blue,alpha}}return{red,green,blue}}if(/^rgba/i.test(rgba)){rgba=rgba.substr(5);rgba=rgba.substr(0,rgba.length-1);const a=rgba.split(",").map(((x,i)=>i===3?Number.parseFloat(x):Number.parseInt(x,10)));return{red:a[0],green:a[1],blue:a[2],alpha:a[3]}}if(/^rgb/i.test(rgba)){rgba=rgba.substr(4);rgba=rgba.substr(0,rgba.length-1);const a=rgba.split(",").map((x=>Number.parseInt(x,10)));return{red:a[0],green:a[1],blue:a[2]}}throw new Error("Unknown color format "+rgba)}static rgb(r,g,b,a){if(a!==undefined){return`rgba(${r},${g},${b},${a})`}return"#"+toFixedString(r)+toFixedString(g)+toFixedString(b)}});_export("default",Colors=class Colors{static rgba(red,green,blue,alpha){return new ColorItem(red,green,blue,alpha)}static parse(color){if(!color){return null}color=color.toLowerCase();for(const key in Colors){if(Colors.hasOwnProperty(key)){const element=Colors[key];if(element instanceof ColorItem){const ci=element;if(ci.namedColor===color){return ci}}}}if(/^(\#|rgb\(|rgba\()/i.test(color)){return new ColorItem(color)}throw new Error("Invalid color format "+color)}});Colors.black=new ColorItem("#000000","black");Colors.silver=new ColorItem("#c0c0c0","silver");Colors.gray=new ColorItem("#808080","gray");Colors.white=new ColorItem("#ffffff","white");Colors.maroon=new ColorItem("#800000","maroon");Colors.red=new ColorItem("#ff0000","red");Colors.purple=new ColorItem("#800080","purple");Colors.fuchsia=new ColorItem("#ff00ff","fuchsia");Colors.green=new ColorItem("#008000","green");Colors.lime=new ColorItem("#00ff00","lime");Colors.olive=new ColorItem("#808000","olive");Colors.yellow=new ColorItem("#ffff00","yellow");Colors.navy=new ColorItem("#000080","navy");Colors.blue=new ColorItem("#0000ff","blue");Colors.teal=new ColorItem("#008080","teal");Colors.aqua=new ColorItem("#00ffff","aqua");Colors.orange=new ColorItem("#ffa500","orange");Colors.aliceBlue=new ColorItem("#f0f8ff","aliceblue");Colors.antiqueWhite=new ColorItem("#faebd7","antiquewhite");Colors.aquaMarine=new ColorItem("#7fffd4","aquamarine");Colors.azure=new ColorItem("#f0ffff","azure");Colors.beige=new ColorItem("#f5f5dc","beige");Colors.bisque=new ColorItem("#ffe4c4","bisque");Colors.blanchedAlmond=new ColorItem("#ffebcd","blanchedalmond");Colors.blueViolet=new ColorItem("#8a2be2","blueviolet");Colors.brown=new ColorItem("#a52a2a","brown");Colors.burlyWood=new ColorItem("#deb887","burlywood");Colors.cadetBlue=new ColorItem("#5f9ea0","cadetblue");Colors.chartReuse=new ColorItem("#7fff00","chartreuse");Colors.chocolate=new ColorItem("#d2691e","chocolate");Colors.coral=new ColorItem("#ff7f50","coral");Colors.cornFlowerBlue=new ColorItem("#6495ed","cornflowerblue");Colors.cornSilk=new ColorItem("#fff8dc","cornsilk");Colors.crimson=new ColorItem("#dc143c","crimson");Colors.cyan=new ColorItem("#00ffff","cyan");Colors.darkBlue=new ColorItem("#00008b","darkblue");Colors.darkCyan=new ColorItem("#008b8b","darkcyan");Colors.darkGoldenRod=new ColorItem("#b8860b","darkgoldenrod");Colors.darkGray=new ColorItem("#a9a9a9","darkgray");Colors.darkGreen=new ColorItem("#006400","darkgreen");Colors.darkGrey=new ColorItem("#a9a9a9","darkgrey");Colors.darkKhaki=new ColorItem("#bdb76b","darkkhaki");Colors.darkMagenta=new ColorItem("#8b008b","darkmagenta");Colors.darkOliveGreen=new ColorItem("#556b2f","darkolivegreen");Colors.darkOrange=new ColorItem("#ff8c00","darkorange");Colors.darkOrchid=new ColorItem("#9932cc","darkorchid");Colors.darkRed=new ColorItem("#8b0000","darkred");Colors.darkSalmon=new ColorItem("#e9967a","darksalmon");Colors.darkSeaGreen=new ColorItem("#8fbc8f","darkseagreen");Colors.darkSlateBlue=new ColorItem("#483d8b","darkslateblue");Colors.darkSlateGray=new ColorItem("#2f4f4f","darkslategray");Colors.darkSlateGrey=new ColorItem("#2f4f4f","darkslategrey");Colors.darkTurquoise=new ColorItem("#00ced1","darkturquoise");Colors.darkViolet=new ColorItem("#9400d3","darkviolet");Colors.deepPink=new ColorItem("#ff1493","deeppink");Colors.deepSkyBlue=new ColorItem("#00bfff","deepskyblue");Colors.dimGray=new ColorItem("#696969","dimgray");Colors.dimGrey=new ColorItem("#696969","dimgrey");Colors.dodgerBlue=new ColorItem("#1e90ff","dodgerblue");Colors.fireBrick=new ColorItem("#b22222","firebrick");Colors.floralWhite=new ColorItem("#fffaf0","floralwhite");Colors.forestGreen=new ColorItem("#228b22","forestgreen");Colors.gainsboro=new ColorItem("#dcdcdc","gainsboro");Colors.ghostWhite=new ColorItem("#f8f8ff","ghostwhite");Colors.gold=new ColorItem("#ffd700","gold");Colors.goldenRod=new ColorItem("#daa520","goldenrod");Colors.greenYellow=new ColorItem("#adff2f","greenyellow");Colors.grey=new ColorItem("#808080","grey");Colors.honeyDew=new ColorItem("#f0fff0","honeydew");Colors.hotPink=new ColorItem("#ff69b4","hotpink");Colors.indianRed=new ColorItem("#cd5c5c","indianred");Colors.indigo=new ColorItem("#4b0082","indigo");Colors.ivory=new ColorItem("#fffff0","ivory");Colors.khaki=new ColorItem("#f0e68c","khaki");Colors.lavender=new ColorItem("#e6e6fa","lavender");Colors.lavenderBlush=new ColorItem("#fff0f5","lavenderblush");Colors.lawnGreen=new ColorItem("#7cfc00","lawngreen");Colors.lemonChiffon=new ColorItem("#fffacd","lemonchiffon");Colors.lightBlue=new ColorItem("#add8e6","lightblue");Colors.lightCoral=new ColorItem("#f08080","lightcoral");Colors.lightCyan=new ColorItem("#e0ffff","lightcyan");Colors.lightGoldenRodYellow=new ColorItem("#fafad2","lightgoldenrodyellow");Colors.lightGray=new ColorItem("#d3d3d3","lightgray");Colors.lightGreen=new ColorItem("#90ee90","lightgreen");Colors.lightGrey=new ColorItem("#d3d3d3","lightgrey");Colors.lightPink=new ColorItem("#ffb6c1","lightpink");Colors.lightSalmon=new ColorItem("#ffa07a","lightsalmon");Colors.lightSeaGreen=new ColorItem("#20b2aa","lightseagreen");Colors.lightSkyBlue=new ColorItem("#87cefa","lightskyblue");Colors.lightSlateGray=new ColorItem("#778899","lightslategray");Colors.lightSlateGrey=new ColorItem("#778899","lightslategrey");Colors.lightSteelBlue=new ColorItem("#b0c4de","lightsteelblue");Colors.lightYellow=new ColorItem("#ffffe0","lightyellow");Colors.limeGreen=new ColorItem("#32cd32","limegreen");Colors.linen=new ColorItem("#faf0e6","linen");Colors.magenta=new ColorItem("#ff00ff","magenta");Colors.mediumAquaMarine=new ColorItem("#66cdaa","mediumaquamarine");Colors.mediumBlue=new ColorItem("#0000cd","mediumblue");Colors.mediumOrchid=new ColorItem("#ba55d3","mediumorchid");Colors.mediumPurple=new ColorItem("#9370db","mediumpurple");Colors.mediumSeaGreen=new ColorItem("#3cb371","mediumseagreen");Colors.mediumSlateBlue=new ColorItem("#7b68ee","mediumslateblue");Colors.mediumSpringGreen=new ColorItem("#00fa9a","mediumspringgreen");Colors.mediumTurquoise=new ColorItem("#48d1cc","mediumturquoise");Colors.mediumVioletred=new ColorItem("#c71585","mediumvioletred");Colors.midNightBlue=new ColorItem("#191970","midnightblue");Colors.mintCream=new ColorItem("#f5fffa","mintcream");Colors.mistyRose=new ColorItem("#ffe4e1","mistyrose");Colors.moccasin=new ColorItem("#ffe4b5","moccasin");Colors.navajoWhite=new ColorItem("#ffdead","navajowhite");Colors.oldLace=new ColorItem("#fdf5e6","oldlace");Colors.oliveDrab=new ColorItem("#6b8e23","olivedrab");Colors.orangeRed=new ColorItem("#ff4500","orangered");Colors.orchid=new ColorItem("#da70d6","orchid");Colors.paleGoldenRod=new ColorItem("#eee8aa","palegoldenrod");Colors.paleGreen=new ColorItem("#98fb98","palegreen");Colors.paleTurquoise=new ColorItem("#afeeee","paleturquoise");Colors.paleVioletRed=new ColorItem("#db7093","palevioletred");Colors.papayaWhip=new ColorItem("#ffefd5","papayawhip");Colors.peachPuff=new ColorItem("#ffdab9","peachpuff");Colors.peru=new ColorItem("#cd853f","peru");Colors.pink=new ColorItem("#ffc0cb","pink");Colors.plum=new ColorItem("#dda0dd","plum");Colors.powderBlue=new ColorItem("#b0e0e6","powderblue");Colors.rosyBrown=new ColorItem("#bc8f8f","rosybrown");Colors.royalBlue=new ColorItem("#4169e1","royalblue");Colors.saddleBrown=new ColorItem("#8b4513","saddlebrown");Colors.salmon=new ColorItem("#fa8072","salmon");Colors.sandyBrown=new ColorItem("#f4a460","sandybrown");Colors.seaGreen=new ColorItem("#2e8b57","seagreen");Colors.seaShell=new ColorItem("#fff5ee","seashell");Colors.sienna=new ColorItem("#a0522d","sienna");Colors.skyBlue=new ColorItem("#87ceeb","skyblue");Colors.slateBlue=new ColorItem("#6a5acd","slateblue");Colors.slateGray=new ColorItem("#708090","slategray");Colors.slateGrey=new ColorItem("#708090","slategrey");Colors.snow=new ColorItem("#fffafa","snow");Colors.springGreen=new ColorItem("#00ff7f","springgreen");Colors.steelBlue=new ColorItem("#4682b4","steelblue");Colors.tan=new ColorItem("#d2b48c","tan");Colors.thistle=new ColorItem("#d8bfd8","thistle");Colors.tomato=new ColorItem("#ff6347","tomato");Colors.turquoise=new ColorItem("#40e0d0","turquoise");Colors.violet=new ColorItem("#ee82ee","violet");Colors.wheat=new ColorItem("#f5deb3","wheat");Colors.whiteSmoke=new ColorItem("#f5f5f5","whitesmoke");Colors.yellowGreen=new ColorItem("#9acd32","yellowgreen");Colors.rebeccaPurple=new ColorItem("#663399","rebeccapurple");Colors.transparent=new ColorItem("#00000000","transparent")}}}));AmdLoader.instance.setup("@web-atoms/core/dist/core/Colors");System.register(["./AtomBinder","./AtomWatcher"],(function(_export,_context){"use strict";var AtomBinder,AtomWatcher;function WatchProperty(target,key,descriptor){const{get}=descriptor;const isSetup=Symbol.for(`isSetup${key}`);return{get:function(){const watcher=new AtomWatcher(this,get,(()=>{AtomBinder.refreshValue(this,key)}),this);watcher.init(false);this.registerDisposable(watcher);this[isSetup]=watcher;Object.defineProperty(this,key,descriptor);return get.apply(this)},configurable:true}}_export("default",WatchProperty);return{setters:[function(_AtomBinder){AtomBinder=_AtomBinder.AtomBinder},function(_AtomWatcher){AtomWatcher=_AtomWatcher.AtomWatcher}],execute:function(){}}}));AmdLoader.instance.setup("@web-atoms/core/dist/core/WatchProperty");System.register([],(function(_export,_context){"use strict";function sleep(timeInMS,ct,throwOnCancel=true){let token=0;return new Promise(((resolve,reject)=>{ct===null||ct===void 0?void 0:ct.registerForCancel((reason=>{if(token){clearTimeout(token);if(throwOnCancel){reject(reason)}else{resolve()}}}));if(ct===null||ct===void 0?void 0:ct.cancelled){if(throwOnCancel){reject("cancelled")}else{resolve()}return}token=setTimeout(resolve,timeInMS)}))}_export("default",sleep);return{setters:[],execute:function(){}}}));AmdLoader.instance.setup("@web-atoms/core/dist/core/sleep");System.register(["tslib","../../core/Bind","../../core/BindableProperty","../../core/XNode","../../core/sleep","../../core/types","../../style/styled","../controls/AtomControl","../core/AtomUI"],(function(_export,_context){"use strict";var __awaiter,__decorate,__metadata,Bind,BindableProperty,XNode,sleep,CancelToken,styled,AtomControl,ChildEnumerator,PopupWindow,ConfirmPopup,popupService,loadPopupService,focus;_export({default:void 0,ConfirmPopup:void 0});return{setters:[function(_tslib){__awaiter=_tslib.__awaiter;__decorate=_tslib.__decorate;__metadata=_tslib.__metadata},function(_coreBind){Bind=_coreBind.default},function(_coreBindableProperty){BindableProperty=_coreBindableProperty.BindableProperty},function(_coreXNode){XNode=_coreXNode.default},function(_coreSleep){sleep=_coreSleep.default},function(_coreTypes){CancelToken=_coreTypes.CancelToken},function(_styleStyled){styled=_styleStyled.default},function(_controlsAtomControl){AtomControl=_controlsAtomControl.AtomControl},function(_coreAtomUI){ChildEnumerator=_coreAtomUI.ChildEnumerator}],execute:function(){loadPopupService=()=>__awaiter(void 0,void 0,void 0,(function*(){if(popupService){return popupService}return popupService=(yield _context.import("./PopupService")).default}));focus=popup=>{var _a,_b,_c;const element=popup.element;if(!element){return}const host=(_a=element.querySelector(`[data-window-element="title"]`))!==null&&_a!==void 0?_a:element.querySelector(`[data-window-element="action-bar"]`);if(host){popup.setupDragging(host)}const anyAutofocus=element.querySelector(`*[autofocus]`);if(!anyAutofocus){const cb=element.querySelector(".popup-close-button");if(cb){cb.focus()}return}(_c=(_b=anyAutofocus).focus)===null||_c===void 0?void 0:_c.call(_b)};styled.css`
73
73
  position: absolute;
74
74
  border: solid 1px lightgray;
75
75
  border-radius: 5px;