@social-mail/social-mail-client 1.4.39 → 1.4.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/AdminAppIndex.pack.js +2 -2
- package/dist/admin/AdminAppIndex.pack.min.js +1 -1
- package/dist/public/channel/ChannelApp.pack.js +2 -2
- package/dist/public/channel/ChannelApp.pack.min.js +1 -1
- package/dist/public/contact-us/ContactUsApp.pack.js +1 -1
- package/dist/public/contact-us/ContactUsApp.pack.min.js +1 -1
- package/dist/public/preview/pdf/PreviewPDF.pack.js +2 -2
- package/dist/public/preview/pdf/PreviewPDF.pack.min.js +1 -1
- package/dist/public/preview/video/PreviewVideo.pack.js +2 -2
- package/dist/public/preview/video/PreviewVideo.pack.min.js +1 -1
- package/dist/public/preview/zip/DownloadZip.pack.js +2 -2
- package/dist/public/preview/zip/DownloadZip.pack.min.js +1 -1
- package/dist/public/store/StoreApp.pack.js +2 -2
- package/dist/public/store/StoreApp.pack.min.js +1 -1
- package/dist/public/store/cart/ShoppingCart.pack.js +2 -2
- package/dist/public/store/cart/ShoppingCart.pack.min.js +1 -1
- package/dist/site-editor-app/SiteEditorApp.pack.js +2 -2
- package/dist/site-editor-app/SiteEditorApp.pack.min.js +1 -1
- package/dist/web/AppIndex.pack.js +2 -2
- package/dist/web/AppIndex.pack.min.js +1 -1
- package/package.json +2 -2
|
@@ -22463,7 +22463,7 @@ System.register(["../App", "../core/AtomOnce", "../core/AtomUri", "../di/Service
|
|
|
22463
22463
|
};
|
|
22464
22464
|
});
|
|
22465
22465
|
//# sourceMappingURL=WebApp.js.map
|
|
22466
|
-
window.installStyleSheet("./DownloadZip.pack.global.less.css");
|
|
22467
|
-
window.installStyleSheet("./DownloadZip.pack.local.less.css");
|
|
22466
|
+
window.installStyleSheet( new URL("./DownloadZip.pack.global.less.css", document.currentScript.src).toString());
|
|
22467
|
+
window.installStyleSheet( new URL("./DownloadZip.pack.local.less.css", document.currentScript.src).toString());
|
|
22468
22468
|
//# sourceMappingURL=DownloadZip.pack.js.map
|
|
22469
22469
|
|
|
@@ -4,5 +4,5 @@ var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){fun
|
|
|
4
4
|
top: 0;
|
|
5
5
|
bottom: 0;
|
|
6
6
|
right: 0;
|
|
7
|
-
`.installGlobal("[data-download-all]");fileInfo=window.fileInfo;if(!fileInfo){fileInfo=window.fileInfo={};const url=new URL(location.href);url.searchParams.forEach(((v,k)=>{fileInfo[k]=v}))}DownloadZip=class DownloadZip extends AtomControl{constructor(app,e){super(app,e);this.files=[];this.map=new Map;this.slice=[];this.element.setAttribute("data-download-all","download-all");this.pushInit()}init(){var _a;return __awaiter(this,void 0,void 0,(function*(){this.renderer=XNode.create("div",null,XNode.create("div",{"data-layout":"center-all"},XNode.create("div",null,"Preparing Zip")));const{default:JSZip}=yield UMD.import("https://cdn.jsdelivr.net/npm/jszip@3.10.1/dist/jszip.min.js");this.zipFile=new JSZip;this.renderer=XNode.create("div",null,XNode.create("div",{"data-layout":"center-all"},XNode.create("div",null,"Loading folder ...")));yield this.loadingFiles();this.renderer=XNode.create("div",null,XNode.create("div",{"data-layout":"center-all"},XNode.create("div",null,"Downloading Files ...")));for(const element of this.files){if(!element.parentID){continue}const parent=this.map.get(element.parentID);if(parent){((_a=parent.children)!==null&&_a!==void 0?_a:parent.children=[]).push(element)}}const zipFolder=this.zipFile.folder(this.root.name);this.renderer=XNode.create("div",null,XNode.create("div",{"data-layout":"center-all"},XNode.create(AtomRepeater,{items:this.slice,itemRenderer:x=>XNode.create("div",{text:`Downloading ${x.name} (${toKMBString(x.fileSize)})`})})));yield this.downloadFiles(this.root,zipFolder);this.renderer=XNode.create("div",null,XNode.create("div",{"data-layout":"center-all"},XNode.create("div",null,"Generating zip file.")));const zipFile=yield this.zipFile.generateAsync({type:"blob"});const file=new File([zipFile],this.root.name+".zip",{type:"application/zip"});const url=URL.createObjectURL(file);this.renderer=XNode.create("div",null,XNode.create("div",{"data-layout":"center-all"},XNode.create("div",{"data-layout":"vertical-flex-stretch-items"},XNode.create("div",null,"Zip File is ready."),XNode.create("a",{href:url,download:file.name},"Save Zip File"))))}))}downloadFiles(folder,zipFolder){return __awaiter(this,void 0,void 0,(function*(){if(!folder.children){return}const folders=[];const files=[];for(const element of folder.children){if(element.isFolder){if(element.children){folders.push(element)}continue}files.push(element)}do{const slice=files.splice(0,5);const tasks=[];for(const file of slice){this.slice.add(file);tasks.push((()=>__awaiter(this,void 0,void 0,(function*(){const blob=yield FetchBuilder.get(file.url).asBlob();zipFolder.file(file.name,blob);this.slice.remove(file)})))())}yield Promise.all(tasks)}while(files.length);for(const element of folders){const child=zipFolder.folder(element.name);yield this.downloadFiles(element,child)}}))}loadingFiles(){var _a;return __awaiter(this,void 0,void 0,(function*(){const path=fileInfo.path+"%";let start=0;const all=[];do{const files=yield this.entityService.query(AppFile).where({path,start},(p=>x=>Sql.text.like(x.path,p.path)&&x.appFileID>p.start&&x.isDeleted===false)).orderBy((x=>x.appFileID)).toPagedList({size:100});if(!files.items.length){break}start=files.items[files.items.length-1].appFileID;for(const file of files.items){this.map.set(file.appFileID,file);all.push(file);if(!this.root&&file.appFileID===fileInfo.appFileID){this.root=file}start=file.appFileID}}while(true);for(const e of all){if(e.parentID){const p=this.map.get(e.parentID);if(!p){console.warn(`Dangling file found ${e.name} at ${e.path}`);continue}((_a=p.children)!==null&&_a!==void 0?_a:p.children=[]).push(e)}}}))}};__decorate([InjectProperty,__metadata("design:type",EntityService)],DownloadZip.prototype,"entityService",void 0);DownloadZip=__decorate([Pack,__metadata("design:paramtypes",[Object,Object])],DownloadZip);_export("default",DownloadZip)}}}));AmdLoader.instance.setup("@web-atoms/core/dist/core/AtomOnce");System.register([],(function(_export,_context){"use strict";var AtomOnce;_export("AtomOnce",void 0);return{setters:[],execute:function(){_export("AtomOnce",AtomOnce=class AtomOnce{run(f){if(this.isRunning){return}let isAsync=false;try{this.isRunning=true;const p=f();if(p&&p.then&&p.catch){isAsync=true;p.then((()=>{this.isRunning=false})).catch((()=>{this.isRunning=false}))}}finally{if(!isAsync){this.isRunning=false}}}})}}}));AmdLoader.instance.setup("@web-atoms/core/dist/core/AtomUri");System.register(["../web/core/AtomUI"],(function(_export,_context){"use strict";var AtomUI,AtomUri;_export("AtomUri",void 0);return{setters:[function(_webCoreAtomUI){AtomUI=_webCoreAtomUI.AtomUI}],execute:function(){_export("AtomUri",AtomUri=class AtomUri{get pathAndQuery(){const q=[];const h=[];for(const key in this.query){if(this.query.hasOwnProperty(key)){const element=this.query[key];if(element===undefined||element===null){continue}q.push(`${encodeURIComponent(key)}=${encodeURIComponent(element.toString())}`)}}for(const key in this.hash){if(this.hash.hasOwnProperty(key)){const element=this.hash[key];if(element===undefined||element===null){continue}h.push(`${encodeURIComponent(key)}=${encodeURIComponent(element.toString())}`)}}const query=q.length?"?"+q.join("&"):"";const hash=h.length?"#"+h.join("&"):"";let path=this.path||"/";if(path.startsWith("/")){path=path.substr(1)}return`${path}${query}${hash}`}constructor(url){let path;let query="";let hash="";let t=url.split("?");path=t[0];if(t.length===2){query=t[1]||"";t=query.split("#");query=t[0];hash=t[1]||""}else{t=path.split("#");path=t[0];hash=t[1]||""}let scheme="";let host="";let port="";let i=path.indexOf("//");if(i!==-1){scheme=path.substr(0,i);path=path.substr(i+2);i=path.indexOf("/");if(i!==-1){host=path.substr(0,i);path=path.substr(i+1);t=host.split(":");if(t.length>1){host=t[0];port=t[1]}}}this.host=host;this.protocol=scheme;this.port=port;this.path=path;this.query=AtomUI.parseUrl(query);this.hash=AtomUI.parseUrl(hash)}toString(){const port=this.port?":"+this.port:"";return`${this.protocol}//${this.host}${port}/${this.pathAndQuery}`}})}}}));AmdLoader.instance.setup("@web-atoms/core/dist/services/ReferenceService");System.register(["tslib","../di/DISingleton"],(function(_export,_context){"use strict";var __decorate,DISingleton,ObjectReference,ReferenceService;_export("ObjectReference",void 0);return{setters:[function(_tslib){__decorate=_tslib.__decorate},function(_diDISingleton){DISingleton=_diDISingleton.default}],execute:function(){_export("ObjectReference",ObjectReference=class ObjectReference{constructor(key,value){this.key=key;this.value=value}});ReferenceService=class ReferenceService{constructor(){this.cache={};this.id=1}get(key){return this.cache[key]}put(item,ttl=60){const key=`k${this.id++}`;const r=new ObjectReference(key,item);r.consume=()=>{delete this.cache[key];if(r.timeout){clearTimeout(r.timeout)}return r.value};r.timeout=setTimeout((()=>{r.timeout=0;r.consume()}),ttl*1e3);this.cache[key]=r;return r}};ReferenceService=__decorate([DISingleton()],ReferenceService);_export("default",ReferenceService)}}}));AmdLoader.instance.setup("@web-atoms/core/dist/services/NavigationService");System.register(["tslib","../core/AtomComponent","../core/AtomUri","../core/FormattedString","../core/types","./ReferenceService"],(function(_export,_context){"use strict";var __awaiter,AtomComponent,AtomUri,FormattedString,ArrayHelper,ReferenceService,ObjectReference,NavigationService,NotifyType,nameSymbol;function hasPageUrl(target){const url=target[nameSymbol];if(!url){return false}const baseClass=Object.getPrototypeOf(target);if(!baseClass){return false}return baseClass[nameSymbol]!==url}_export({NavigationService:void 0,NotifyType:void 0});return{setters:[function(_tslib){__awaiter=_tslib.__awaiter},function(_coreAtomComponent){AtomComponent=_coreAtomComponent.AtomComponent},function(_coreAtomUri){AtomUri=_coreAtomUri.AtomUri},function(_coreFormattedString){FormattedString=_coreFormattedString.default},function(_coreTypes){ArrayHelper=_coreTypes.ArrayHelper},function(_ReferenceService){ReferenceService=_ReferenceService.default;ObjectReference=_ReferenceService.ObjectReference}],execute:function(){(function(NotifyType){NotifyType["Information"]="info";NotifyType["Warning"]="warn";NotifyType["Error"]="error"})(NotifyType||_export("NotifyType",NotifyType={}));nameSymbol=UMD.nameSymbol;_export("NavigationService",NavigationService=class NavigationService{constructor(app){this.app=app;this.callbacks=[]}pushPage(pageName,viewModelParameters,options){this.app.runAsync((()=>this.openPage(pageName,viewModelParameters,options)))}openPage(pageName,viewModelParameters,options){options=options||{};if(typeof pageName!=="string"){if(hasPageUrl(pageName)){pageName=pageName[nameSymbol]}else{const rs=this.app.resolve(ReferenceService);const host=pageName instanceof AtomComponent?"reference":"class";const r=rs.put(pageName);pageName=`ref://${host}/${r.key}`}}if(this.beforeCallbacks){for(const iterator of this.beforeCallbacks){const r=iterator(pageName,viewModelParameters,options);if(r){return r}}}const url=new AtomUri(pageName);if(viewModelParameters){for(const key in viewModelParameters){if(viewModelParameters.hasOwnProperty(key)){const element=viewModelParameters[key];if(element===undefined){continue}if(element===null){url.query["json:"+key]="null";continue}if(key.startsWith("ref:")||element instanceof FormattedString){const r=element instanceof ObjectReference?element:this.app.resolve(ReferenceService).put(element);url.query[key.startsWith("ref:")?key:`ref:${key}`]=r.key;continue}if(typeof element!=="string"&&(typeof element==="object"||Array.isArray(element))){url.query["json:"+key]=JSON.stringify(element)}else{url.query[key]=element}}}}for(const iterator of this.callbacks){const r=iterator(url,options);if(r){return r}}return this.openWindow(url,options)}remove(view,force){return __awaiter(this,void 0,void 0,(function*(){if(force){this.app.broadcast(`atom-window-cancel:${view.id}`,"cancelled");return true}const vm=view.viewModel;if(vm&&vm.cancel){const a=yield vm.cancel();return a}this.app.broadcast(`atom-window-cancel:${view.id}`,"cancelled");return true}))}registerNavigationHook(callback){this.callbacks.push(callback);return{dispose:()=>{ArrayHelper.remove(this.callbacks,(a=>a===callback))}}}registerPreNavigationHook(callback){var _a;((_a=this.beforeCallbacks)!==null&&_a!==void 0?_a:this.beforeCallbacks=[]).push(callback);return{dispose:()=>{this.beforeCallbacks.remove(callback)}}}})}}}));AmdLoader.instance.setup("@web-atoms/core/dist/web/styles/StyleBuilder");System.register([],(function(_export,_context){"use strict";var StyleBuilder;function cssNumberToString(n,unit="px"){if(typeof n==="number"){if(n===0){return n+""}return n+unit}return n}_export({cssNumberToString,default:void 0});return{setters:[],execute:function(){_export("default",StyleBuilder=class StyleBuilder{static get newStyle(){return new StyleBuilder}constructor(style){this.style=style;this.style=this.style||{}}toStyle(){return this.style}size(width,height){width=cssNumberToString(width);height=cssNumberToString(height);return this.merge({width,height})}roundBorder(radius){radius=cssNumberToString(radius);return this.merge({borderRadius:radius,padding:radius})}border(borderWidth,borderColor,borderStyle="solid"){borderWidth=cssNumberToString(borderWidth);return this.merge({borderWidth,borderStyle,borderColor})}center(width,height){width=cssNumberToString(width);height=cssNumberToString(height);return this.merge({position:"absolute",left:0,right:0,top:0,bottom:0,width,height,margin:"auto"})}absolute(left,top,right,bottom){left=cssNumberToString(left);top=cssNumberToString(top);if(right!==undefined){right=cssNumberToString(right);bottom=cssNumberToString(bottom);return this.merge({position:"absolute",left,top,right,bottom})}return this.merge({position:"absolute",left,top})}merge(style){return new StyleBuilder(Object.assign(Object.assign({},this.style),style))}})}}}));AmdLoader.instance.setup("@web-atoms/core/dist/web/services/WebBusyIndicatorService");System.register(["tslib","../../App","../../di/Inject","../../di/RegisterSingleton","../../services/BusyIndicatorService","../../services/NavigationService","../controls/AtomControl","../styles/StyleBuilder"],(function(_export,_context){"use strict";var __decorate,__metadata,App,Inject,RegisterSingleton,BusyIndicatorService,NavigationService,AtomControl,cssNumberToString,WebBusyIndicatorService;return{setters:[function(_tslib){__decorate=_tslib.__decorate;__metadata=_tslib.__metadata},function(_App){App=_App.App},function(_diInject){Inject=_diInject.Inject},function(_diRegisterSingleton){RegisterSingleton=_diRegisterSingleton.RegisterSingleton},function(_servicesBusyIndicatorService){BusyIndicatorService=_servicesBusyIndicatorService.BusyIndicatorService},function(_servicesNavigationService){NavigationService=_servicesNavigationService.NavigationService},function(_controlsAtomControl){AtomControl=_controlsAtomControl.AtomControl},function(_stylesStyleBuilder){cssNumberToString=_stylesStyleBuilder.cssNumberToString}],execute:function(){_export("WebBusyIndicatorService",WebBusyIndicatorService=class WebBusyIndicatorService extends BusyIndicatorService{constructor(){super(...arguments);this.zIndex=5e4;this.indicators=0}createIndicator(){const host=document.createElement("div");const popup=new AtomControl(this.app,host);host.className="indicator-host";const span=document.createElement("i");const divStyle=host.style;divStyle.position="absolute";divStyle.overflow="hidden";divStyle.left=divStyle.right=divStyle.bottom=divStyle.top="0";divStyle.zIndex=this.zIndex+++"";const spanStyle=span.style;spanStyle.position="absolute";spanStyle.margin="auto";spanStyle.width="16px";spanStyle.height="16px";spanStyle.overflow="hidden";spanStyle.maxHeight="100%";spanStyle.maxWidth="100%";spanStyle.left=spanStyle.right=spanStyle.bottom=spanStyle.top="0";span.className="fas fa-spinner fa-spin";host.appendChild(span);const ws=this.navigationService;const e=ws.getHostForElement();if(e){e.appendChild(host)}else{document.body.appendChild(host);ws.refreshScreen();popup.bind(host,"styleLeft",[["this","scrollLeft"]],false,cssNumberToString,ws.screen);popup.bind(host,"styleTop",[["this","scrollTop"]],false,cssNumberToString,ws.screen);popup.bind(host,"styleWidth",[["this","width"]],false,cssNumberToString,ws.screen);popup.bind(host,"styleHeight",[["this","height"]],false,cssNumberToString,ws.screen)}popup.registerDisposable({dispose:()=>{host.remove()}});return popup}});__decorate([Inject,__metadata("design:type",NavigationService)],WebBusyIndicatorService.prototype,"navigationService",void 0);__decorate([Inject,__metadata("design:type",App)],WebBusyIndicatorService.prototype,"app",void 0);_export("WebBusyIndicatorService",WebBusyIndicatorService=__decorate([RegisterSingleton],WebBusyIndicatorService))}}}));AmdLoader.instance.setup("@web-atoms/core/dist/Atom");System.register(["tslib"],(function(_export,_context){"use strict";var __awaiter,Atom;_export("Atom",void 0);return{setters:[function(_tslib){__awaiter=_tslib.__awaiter}],execute:function(){_export("Atom",Atom=class Atom{static superProperty(tc,target,name){let c=tc;do{c=Object.getPrototypeOf(c);if(!c){throw new Error("No property descriptor found for "+name)}const pd=Object.getOwnPropertyDescriptor(c.prototype,name);if(!pd){continue}return pd.get.apply(target)}while(true)}static get(target,path){const segments=path.split(".");for(const iterator of segments){if(target===undefined||target===null){return target}target=target[iterator]}return target}static delay(n,ct){return new Promise(((resolve,reject)=>{const h={};h.id=setTimeout((()=>{resolve()}),n);if(ct){ct.registerForCancel((()=>{clearTimeout(h.id);reject(new Error("cancelled"))}))}}))}static encodeParameters(p){if(!p){return""}let s="";for(const key in p){if(p.hasOwnProperty(key)){const element=p[key];let v=element;if(v===undefined||v===null){continue}if(v instanceof Date){v=v.toISOString()}else if(typeof element==="object"){v=JSON.stringify(element)}if(s){s+="&"}s+=`${key}=${encodeURIComponent(v)}`}}return s}static url(url,query,hash){if(!url){return url}let p=this.encodeParameters(query);if(p){if(url.indexOf("?")===-1){url+="?"}else{url+="&"}url+=p}p=this.encodeParameters(hash);if(p){if(url.indexOf("#")===-1){url+="#"}else{url+="&"}url+=p}return url}static postAsync(app,f){return new Promise(((resolve,reject)=>{app.callLater((()=>__awaiter(this,void 0,void 0,(function*(){try{resolve(yield f())}catch(error){reject(error)}}))))}))}});Atom.designMode=false}}}));AmdLoader.instance.setup("@web-atoms/core/dist/services/JsonService");System.register(["tslib","../core/StringHelper","../di/RegisterSingleton","@web-atoms/date-time/dist/DateTime"],(function(_export,_context){"use strict";var __decorate,StringHelper,RegisterSingleton,DateTime,dateFormatISORegEx,dateFormatMSRegEx,timeZoneDiff,JsonService;return{setters:[function(_tslib){__decorate=_tslib.__decorate},function(_coreStringHelper){StringHelper=_coreStringHelper.StringHelper},function(_diRegisterSingleton){RegisterSingleton=_diRegisterSingleton.RegisterSingleton},function(_webAtomsDateTimeDistDateTime){DateTime=_webAtomsDateTimeDistDateTime.default}],execute:function(){_export("dateFormatISORegEx",dateFormatISORegEx=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/);_export("dateFormatMSRegEx",dateFormatMSRegEx=/^\/Date\((d|-|.*)\)[\/|\\]$/);timeZoneDiff=(new Date).getTimezoneOffset();_export("JsonService",JsonService=class JsonService{constructor(){this.options={indent:2,namingStrategy:"none",dateConverter:[{regex:dateFormatISORegEx,valueConverter:{fromSource(v){const d=new DateTime(v);return d},fromTarget(v){return v.toISOString()}}},{regex:dateFormatMSRegEx,valueConverter:{fromSource(v){const a=dateFormatMSRegEx.exec(v);const b=a[1].split(/[-+,.]/);return new DateTime(b[0]?+b[0]:0-+b[1])},fromTarget(v){return v.toISOString()}}}]}}transformKeys(t,v){if(!v){return v}if(typeof v!=="object"){return v}if(v instanceof Date){return v}if(typeof v==="object"&&v.length!==undefined&&typeof v.length==="number"){const a=v;if(a.map){return a.map((x=>this.transformKeys(t,x)))}const ra=[];for(let i=0;i<a.length;i++){const iterator=a[i];ra.push(this.transformKeys(t,iterator))}return ra}const r={};for(const key in v){if(v.hasOwnProperty(key)){const element=v[key];r[t(key)]=this.transformKeys(t,element)}}return r}parse(text,options){const{dateConverter,namingStrategy}=Object.assign(Object.assign({},this.options),options);const result=JSON.parse(text,((key,value)=>{if(typeof value==="string"){for(const iterator of dateConverter){const a=iterator.regex.test(value);if(a){const dv=iterator.valueConverter.fromSource(value);return dv}}}return value}));switch(namingStrategy){case"hyphen":return this.transformKeys(StringHelper.fromHyphenToCamel,result);case"underscore":return this.transformKeys(StringHelper.fromUnderscoreToCamel,result);case"pascal":return this.transformKeys(StringHelper.fromPascalToCamel,result)}return result}stringify(v,options){const{namingStrategy,dateConverter,indent}=Object.assign(Object.assign({},this.options),options);switch(namingStrategy){case"hyphen":v=this.transformKeys(StringHelper.fromCamelToHyphen,v);break;case"underscore":v=this.transformKeys(StringHelper.fromCamelToUnderscore,v);break;case"pascal":v=this.transformKeys(StringHelper.fromCamelToPascal,v);break}return JSON.stringify(v,((key,value)=>{if(key&&/^\_\$\_/.test(key)){return undefined}if(dateConverter&&value instanceof Date){return dateConverter[0].valueConverter.fromTarget(value)}return value}),indent)}});_export("JsonService",JsonService=__decorate([RegisterSingleton],JsonService))}}}));AmdLoader.instance.setup("@web-atoms/core/dist/core/AtomLoader");System.register(["tslib","../services/JsonService","../services/ReferenceService","./AtomUri","./Command","./InheritedProperty","./types"],(function(_export,_context){"use strict";var __awaiter,__rest,JsonService,ReferenceService,AtomUri,displayRouteSymbol,getOwnInheritedProperty,CancelToken,DI,AtomLoader;_export("AtomLoader",void 0);return{setters:[function(_tslib){__awaiter=_tslib.__awaiter;__rest=_tslib.__rest},function(_servicesJsonService){JsonService=_servicesJsonService.JsonService},function(_servicesReferenceService){ReferenceService=_servicesReferenceService.default},function(_AtomUri){AtomUri=_AtomUri.AtomUri},function(_Command){displayRouteSymbol=_Command.displayRouteSymbol},function(_InheritedProperty){getOwnInheritedProperty=_InheritedProperty.getOwnInheritedProperty},function(_types){CancelToken=_types.CancelToken;DI=_types.DI}],execute:function(){_export("AtomLoader",AtomLoader=class AtomLoader{static load(url,app){return __awaiter(this,void 0,void 0,(function*(){if(typeof url==="string"){const type=yield DI.resolveViewClassAsync(url);if(!type){throw new Error(`Type not found for ${url}`)}url=type}if(url instanceof AtomUri){if(url.host==="reference"){const r=app.get(ReferenceService).get(url.path);if(!r){throw new Error("reference not found")}return r.consume()}if(url.host==="class"){const r=app.get(ReferenceService).get(url.path);if(!r){throw new Error("reference not found")}return app.resolve(r.consume(),true)}url=url.path;const type=yield DI.resolveViewClassAsync(url);if(!type){throw new Error(`Type not found for ${url}`)}url=type}const obj=app.resolve(url,true);return obj}))}static loadView(url,app,hookCloseEvents,vmFactory){return __awaiter(this,void 0,void 0,(function*(){const busyIndicator=app.createBusyIndicator({title:url.toString(),description:`Loading View ${url}`});try{const view=yield AtomLoader.load(url,app);let vm=view.viewModel;if(!vm){if(!vmFactory){return{view}}vm=vmFactory();view.viewModel=vm}if("parameters"in view){vm=view.parameters}if(vm){const jsonService=app.get(JsonService);for(const key in url.query){if(url.query.hasOwnProperty(key)){const element=url.query[key];if(typeof element==="object"){vm[key]=jsonService.parse(jsonService.stringify(element));continue}if(/^json\:/.test(key)){const k=key.split(":")[1];vm[k]=jsonService.parse(element.toString());continue}if(/^ref\:/.test(key)){const rs=app.get(ReferenceService);const v=rs.get(element);vm[key.split(":",2)[1]]=v.consume();continue}try{vm[key]=element}catch(e){console.error(e)}}}}if(hookCloseEvents&&vm){const disposables=view.disposables;const id=(AtomLoader.id++).toString();view.id=id;const returnPromise=new Promise(((resolve,reject)=>{disposables.add(app.subscribe(`atom-window-close:${id}`,((m,r)=>{resolve(r);view.dispose()})));disposables.add(app.subscribe(`atom-window-cancel:${id}`,(()=>{reject("cancelled");view.dispose()})))}));vm.windowName=id;view.returnPromise=returnPromise;return{view,disposables,returnPromise,id}}return{view}}finally{busyIndicator.dispose()}}))}static loadClass(url_1){return __awaiter(this,arguments,void 0,(function*(url,_a={},app){var _b,_c,_d,_e;var _f;var{title}=_a,_g=displayRouteSymbol,route=_a[_g],parameters=__rest(_a,["title",typeof _g==="symbol"?_g:_g+""]);const busyIndicator=app.createBusyIndicator({title:url===null||url===void 0?void 0:url.toString(),description:`Loading View ${url}`});try{const view=yield AtomLoader.load(url,app);const vm=getOwnInheritedProperty(view,"viewModel");let params;if("parameters"in view){params=view.parameters}if(!vm){params=(_b=(_f=view).parameters)!==null&&_b!==void 0?_b:_f.parameters={}}else{console.warn("ViewModel is deprecated")}if(title){view.title=title}if(params){params[displayRouteSymbol]=route}if((vm||params)&¶meters){for(const key in parameters){if(parameters.hasOwnProperty(key)){const element=parameters[key];try{if(vm){vm[key]=element}if(params){params[key]=element}}catch(e){console.error(e)}}}}(_e=(_d=(_c=view).init)===null||_d===void 0?void 0:_d.call(_c))===null||_e===void 0?void 0:_e.catch((error=>{if(!CancelToken.isCancelled(error)){console.error(error)}}));return view}finally{busyIndicator.dispose()}}))}static loadControl(url,app){return __awaiter(this,void 0,void 0,(function*(){var _a,_b,_c,_d;var _e;const busyIndicator=app.createBusyIndicator({title:url===null||url===void 0?void 0:url.toString(),description:`Loading View ${url}`});try{const view=yield AtomLoader.load(url,app);const vm=getOwnInheritedProperty(view,"viewModel");let params;if("parameters"in view){params=view.parameters}if(!vm){params=(_a=(_e=view).parameters)!==null&&_a!==void 0?_a:_e.parameters={}}if(vm||params){const jsonService=app.get(JsonService);for(const key in url.query){if(url.query.hasOwnProperty(key)){const element=url.query[key];if(/^json\:/.test(key)){const k=key.split(":")[1];const v=jsonService.parse(element.toString());if(vm){vm[k]=v}if(params){params[k]=v}continue}if(/^ref\:/.test(key)){const rs=app.get(ReferenceService);const v=rs.get(element).consume();const keyName=key.split(":",2)[1];if(vm){vm[keyName]=v}if(params){params[keyName]=v}continue}try{if(vm){vm[key]=element}if(params){params[key]=element}}catch(e){console.error(e)}}}}(_d=(_c=(_b=view).init)===null||_c===void 0?void 0:_c.call(_b))===null||_d===void 0?void 0:_d.catch((error=>{if(!CancelToken.isCancelled(error)){console.error(error)}}));return view}finally{busyIndicator.dispose()}}))}});AtomLoader.id=1}}}));AmdLoader.instance.setup("@web-atoms/core/dist/core/FormattedError");System.register([],(function(_export,_context){"use strict";var FormattedError;_export("default",void 0);return{setters:[],execute:function(){_export("default",FormattedError=class FormattedError{constructor(msg){const e=new Error(msg.toString());e.formattedMessage=msg;e.__proto__=FormattedError.prototype;return e}})}}}));AmdLoader.instance.setup("@web-atoms/core/dist/view-model/baseTypes");System.register([],(function(_export,_context){"use strict";function registerInit(target,fx){const t=target;const inits=t._$_inits=t._$_inits||[];inits.push(fx)}_export("registerInit",registerInit);return{setters:[],execute:function(){}}}));AmdLoader.instance.setup("@web-atoms/core/dist/view-model/AtomViewModel");System.register(["tslib","../App","../Atom","../core/AtomBinder","../core/AtomDisposableList","../core/AtomWatcher","../core/BindableProperty","../di/Inject","./baseTypes"],(function(_export,_context){"use strict";var __awaiter,__decorate,__metadata,__param,App,Atom,AtomBinder,AtomDisposableList,AtomWatcher,BindableProperty,Inject,registerInit,AtomViewModel;function runDecoratorInits(){const v=this.constructor.prototype;if(!v){return}const ris=v._$_inits;if(ris){for(const ri of ris){ri.call(this,this)}}}function privateInit(){return __awaiter(this,void 0,void 0,(function*(){try{yield Atom.postAsync(this.app,(()=>__awaiter(this,void 0,void 0,(function*(){runDecoratorInits.apply(this)}))));yield Atom.postAsync(this.app,(()=>__awaiter(this,void 0,void 0,(function*(){yield this.init();this.onReady()}))));if(this.postInit){for(const i of this.postInit){i()}this.postInit=null}}finally{const pi=this.pendingInits;this.pendingInits=null;for(const iterator of pi){iterator()}}}))}function waitForReady(vm){return __awaiter(this,void 0,void 0,(function*(){while(vm.pendingInits){yield Atom.delay(100)}}))}function Receive(...channel){return(target,key)=>{registerInit(target,(vm=>{const fx=vm[key];const a=(ch,d)=>{const p=fx.call(vm,ch,d);if(p&&p.then&&p.catch){p.catch((e=>{console.warn(e)}))}};const ivm=vm;for(const c of channel){ivm.registerDisposable(ivm.app.subscribe(c,a))}}))}}function BindableReceive(...channel){return(target,key)=>{const bp=BindableProperty(target,key);registerInit(target,(vm=>{const fx=(cx,m)=>{vm[key]=m};const ivm=vm;for(const c of channel){ivm.registerDisposable(ivm.app.subscribe(c,fx))}}));return bp}}function BindableBroadcast(...channel){return(target,key)=>{const bp=BindableProperty(target,key);registerInit(target,(vm=>{const fx=t=>{const v=vm[key];for(const c of channel){vm.app.broadcast(c,v)}};const d=new AtomWatcher(vm,[key.split(".")],fx);d.init();vm.registerDisposable(d)}));return bp}}function Watch(target,key,descriptor){registerInit(target,(vm=>{const ivm=vm;if(descriptor&&descriptor.get){ivm.setupWatch(descriptor.get,(()=>{vm.refresh(key.toString())}));return}ivm.setupWatch(vm[key])}))}function CachedWatch(target,key,descriptor){const getMethod=descriptor.get;descriptor.get=()=>null;registerInit(target,(vm=>{const ivm=vm;const fieldName=`_${key}`;Object.defineProperty(ivm,key,{enumerable:true,configurable:true,get(){const c=ivm[fieldName]||(ivm[fieldName]={value:getMethod.apply(ivm)});return c.value}});ivm.setupWatch(getMethod,(()=>{ivm[fieldName]=null;AtomBinder.refreshValue(ivm,key)}))}))}function Validate(target,key,descriptor){const getMethod=descriptor.get;descriptor.get=()=>null;registerInit(target,(vm=>{const initialized={i:false};const ivm=vm;Object.defineProperty(ivm,key,{enumerable:true,configurable:true,get(){if(vm.mShouldValidate&&initialized.i){return getMethod.apply(this)}return null}});ivm.setupWatch(getMethod,(()=>{initialized.i=true;vm.refresh(key.toString())}),true,key.toString());return}))}_export({waitForReady,Receive,BindableReceive,BindableBroadcast,Watch,CachedWatch,Validate});return{setters:[function(_tslib){__awaiter=_tslib.__awaiter;__decorate=_tslib.__decorate;__metadata=_tslib.__metadata;__param=_tslib.__param},function(_App){App=_App.App},function(_Atom){Atom=_Atom.Atom},function(_coreAtomBinder){AtomBinder=_coreAtomBinder.AtomBinder},function(_coreAtomDisposableList){AtomDisposableList=_coreAtomDisposableList.AtomDisposableList},function(_coreAtomWatcher){AtomWatcher=_coreAtomWatcher.AtomWatcher},function(_coreBindableProperty){BindableProperty=_coreBindableProperty.BindableProperty},function(_diInject){Inject=_diInject.Inject},function(_baseTypes){registerInit=_baseTypes.registerInit}],execute:function(){_export("AtomViewModel",AtomViewModel=class AtomViewModel{get isReady(){return this.pendingInits===null}get errors(){const e=[];if(!this.mShouldValidate){return e}for(const v of this.validations){if(!v.initialized){return e}const error=this[v.name];if(error){e.push({name:v.name,error})}}return e}get parent(){return this.mParent}set parent(v){if(this.mParent&&this.mParent.mChildren){this.mParent.mChildren.remove(this)}this.mParent=v;if(v){const c=v.mChildren||(v.mChildren=[]);c.add(this);this.registerDisposable({dispose:()=>{c.remove(this)}})}}get isValid(){let valid=true;const validateWasFalse=this.mShouldValidate===false;this.mShouldValidate=true;for(const v of this.validations){if(!v.initialized){v.watcher.init(true);v.initialized=true}if(this[v.name]){if(validateWasFalse){AtomBinder.refreshValue(this,v.name)}valid=false}}if(this.mChildren){for(const child of this.mChildren){if(!child.isValid){valid=false}}}AtomBinder.refreshValue(this,"errors");return valid}constructor(app){this.app=app;this.disposables=null;this.validations=[];this.pendingInits=[];this.mShouldValidate=false;this.app.runAsync((()=>privateInit.apply(this)))}resetValidations(resetChildren=true){this.mShouldValidate=false;for(const v of this.validations){this.refresh(v.name)}if(resetChildren&&this.mChildren){for(const iterator of this.mChildren){iterator.resetValidations(resetChildren)}}}runAfterInit(f){if(this.pendingInits){this.pendingInits.push(f);return}f()}refresh(name){AtomBinder.refreshValue(this,name)}init(){return __awaiter(this,void 0,void 0,(function*(){}))}dispose(){if(this.disposables){this.disposables.dispose()}}registerDisposable(d){this.disposables=this.disposables||new AtomDisposableList;return this.disposables.add(d)}onReady(){}setupWatch(ft,proxy,forValidation,name){const d=new AtomWatcher(this,ft,proxy,this);if(forValidation){this.validations=this.validations||[];this.validations.push({name,watcher:d,initialized:false})}else{d.init()}return this.registerDisposable(d)}onPropertyChanged(name){}});_export("AtomViewModel",AtomViewModel=__decorate([__param(0,Inject),__metadata("design:paramtypes",[App])],AtomViewModel))}}}));AmdLoader.instance.setup("@web-atoms/core/dist/view-model/AtomWindowViewModel");System.register(["tslib","../services/NavigationService","./AtomViewModel"],(function(_export,_context){"use strict";var __awaiter,NavigationService,AtomViewModel,AtomWindowViewModel;_export("AtomWindowViewModel",void 0);return{setters:[function(_tslib){__awaiter=_tslib.__awaiter},function(_servicesNavigationService){NavigationService=_servicesNavigationService.NavigationService},function(_AtomViewModel){AtomViewModel=_AtomViewModel.AtomViewModel}],execute:function(){_export("AtomWindowViewModel",AtomWindowViewModel=class AtomWindowViewModel extends AtomViewModel{close(result){this.app.broadcast(`atom-window-close:${this.windowName}`,result)}cancel(){return __awaiter(this,void 0,void 0,(function*(){if(this.closeWarning){const navigationService=this.app.resolve(NavigationService);if(!(yield navigationService.confirm(this.closeWarning,"Are you sure?"))){return false}}this.app.broadcast(`atom-window-cancel:${this.windowName}`,"cancelled");return true}))}})}}}));AmdLoader.instance.setup("@web-atoms/core/dist/web/styles/AtomWindowStyle");System.register(["@web-atoms/core/src/web/images/close-button-hover.svg","../styles/AtomStyle"],(function(_export,_context){"use strict";var closeButtonHover,AtomStyle,AtomWindowStyle;_export("AtomWindowStyle",void 0);return{setters:[function(_webAtomsCoreSrcWebImagesCloseButtonHoverSvg){closeButtonHover=_webAtomsCoreSrcWebImagesCloseButtonHoverSvg.default},function(_stylesAtomStyle){AtomStyle=_stylesAtomStyle.AtomStyle}],execute:function(){_export("AtomWindowStyle",AtomWindowStyle=class AtomWindowStyle extends AtomStyle{get root(){return Object.assign(Object.assign({},this.frameHost),{subclasses:{" .close-button":this.closeButton," .command-bar-presenter":this.commandBarPresenter," .command-bar":this.commandBar," .content-presenter":this.contentPresenter," .content":this.content," .frame":this.frame," .title":this.title," .title-host":this.titleHost," .title-presenter":this.titlePresenter}})}get frameHost(){return{position:"absolute",left:0,right:0,top:0,bottom:0,backgroundColor:"#50505080"}}get frame(){return{position:"absolute",minHeight:"100px",minWidth:"300px",margin:"auto",border:"solid 1px #808080",borderRadius:"5px",backgroundColor:"white"}}get titlePresenter(){return{position:"relative",left:0,right:0,top:0,height:"37px"}}get titleHost(){return{position:"absolute",left:0,right:0,padding:"7px",minHeight:"32px",backgroundColor:"#404040",color:"white",top:0,borderTopRightRadius:"4px",borderTopLeftRadius:"4px"}}get title(){return{margin:"auto"}}get closeButton(){return{position:"absolute",right:"6px",top:"7px",width:"0",height:"0",padding:"9px",border:"none",backgroundColor:"transparent",backgroundImage:closeButtonHover}}get content(){return{}}get contentPresenter(){return{position:"relative",padding:"10px",background:"white"}}get commandBarPresenter(){return{left:0,right:0,bottom:0,padding:"5px",backgroundColor:"#d4d4d4",textAlign:"right",borderBottomRightRadius:"4px",borderBottomLeftRadius:"4px"}}get commandBar(){return{subclasses:{" button":{borderRadius:"3px",marginLeft:"5px",marginRight:"5px",padding:"4px 16px",backgroundColor:"whitesmoke",border:"1px solid gray"}}}}})}}}));AmdLoader.instance.setup("@web-atoms/core/dist/web/styles/AtomAlertWindowStyle");System.register(["../../core/Colors","./AtomWindowStyle"],(function(_export,_context){"use strict";var Colors,AtomWindowStyle,AtomAlertWindowStyle;_export("default",void 0);return{setters:[function(_coreColors){Colors=_coreColors.default},function(_AtomWindowStyle){AtomWindowStyle=_AtomWindowStyle.AtomWindowStyle}],execute:function(){_export("default",AtomAlertWindowStyle=class AtomAlertWindowStyle extends AtomWindowStyle{get titleHost(){return Object.assign(Object.assign({},this.getBaseProperty(AtomAlertWindowStyle,"titleHost")),{color:Colors.black,backgroundColor:Colors.white})}get contentPresenter(){return Object.assign(Object.assign({},this.getBaseProperty(AtomAlertWindowStyle,"contentPresenter")),{padding:"0px 10px 30px 10px",textAlign:"center",color:Colors.rgba(51,51,51)})}get commandBar(){return Object.assign(Object.assign({},this.getBaseProperty(AtomAlertWindowStyle,"commandBar")),{textAlign:"center",subclasses:{" button":this.buttonStyle," .yes-button":{backgroundColor:Colors.rgba(0,128,0)}," .no-button":{backgroundColor:Colors.rgba(255,0,0)}}})}get buttonStyle(){return{border:"none",color:Colors.white,width:"50%",height:"40px"}}})}}}));AmdLoader.instance.setup("@web-atoms/core/dist/web/controls/AtomTemplate");System.register(["./AtomControl"],(function(_export,_context){"use strict";var AtomControl,AtomTemplate;_export("AtomTemplate",void 0);return{setters:[function(_AtomControl){AtomControl=_AtomControl.AtomControl}],execute:function(){_export("AtomTemplate",AtomTemplate=class AtomTemplate extends AtomControl{})}}}));AmdLoader.instance.setup("@web-atoms/core/dist/web/controls/AtomWindow");System.register(["../../App","../../core/Bind","../../core/XNode","../styles/AtomWindowStyle","./AtomControl","./AtomTemplate"],(function(_export,_context){"use strict";var App,Bind,XNode,AtomWindowStyle,AtomControl,AtomTemplate,AtomWindowFrameTemplate,AtomWindowTitleTemplate,AtomWindow;function getTemplateParent(e){const tp=e._templateParent;if(tp){return tp}const p=e._logicalParent||e.parentElement;if(p){return getTemplateParent(p)}}_export({getTemplateParent,AtomWindowFrameTemplate:void 0,AtomWindow:void 0});return{setters:[function(_App){App=_App.App},function(_coreBind){Bind=_coreBind.default},function(_coreXNode){XNode=_coreXNode.default},function(_stylesAtomWindowStyle){AtomWindowStyle=_stylesAtomWindowStyle.AtomWindowStyle},function(_AtomControl){AtomControl=_AtomControl.AtomControl},function(_AtomTemplate){AtomTemplate=_AtomTemplate.AtomTemplate}],execute:function(){_export("AtomWindowFrameTemplate",AtomWindowFrameTemplate=class AtomWindowFrameTemplate extends AtomTemplate{get templateParent(){return getTemplateParent(this.element)}preCreate(){this.titlePresenter=null;this.commandPresenter=null;this.contentPresenter=null;super.preCreate()}create(){this.render(XNode.create("div",{class:"frame",styleWidth:Bind.oneWay((()=>this.templateParent.width||undefined)),styleHeight:Bind.oneWay((()=>this.templateParent.height||undefined)),styleLeft:Bind.oneWay((()=>this.templateParent.x>=0?`${this.templateParent.x}px`:undefined)),styleTop:Bind.oneWay((()=>this.templateParent.y>=0?`${this.templateParent.y}px`:undefined)),styleMarginTop:Bind.oneWay((()=>this.templateParent.x>=0?"0":undefined)),styleMarginLeft:Bind.oneWay((()=>this.templateParent.x>=0?"0":undefined)),styleMarginRight:Bind.oneWay((()=>this.templateParent.x>=0?"0":undefined)),styleMarginBottom:Bind.oneWay((()=>this.templateParent.x>=0?"0":undefined))},XNode.create("div",{class:"title-presenter",presenter:Bind.presenter("titlePresenter")}),XNode.create("div",{class:"content-presenter",presenter:Bind.presenter("contentPresenter")}),XNode.create("div",{class:"command-bar-presenter",presenter:Bind.presenter("commandPresenter")})))}});AtomWindowTitleTemplate=class AtomWindowTitleTemplate extends AtomControl{get templateParent(){return getTemplateParent(this.element)}create(){this.render(XNode.create("div",{class:"title-host"},XNode.create("span",{class:"title",text:Bind.oneWay((()=>this.templateParent.title))}),XNode.create("button",{class:"close-button",eventClick:Bind.event((()=>this.templateParent.close()))})))}};_export("AtomWindow",AtomWindow=class AtomWindow extends AtomControl{constructor(){super(...arguments);this.title="";this.width="";this.height="";this.x=-1;this.y=-1;this.titleTemplate=AtomWindowTitleTemplate;this.frameTemplate=AtomWindowFrameTemplate;this.isReady=false}get templateParent(){return getTemplateParent(this.element)}onPropertyChanged(name){switch(name){case"windowTemplate":case"commandTemplate":case"frameTemplate":this.invalidate();break}}close(){const vm=this.viewModel;if(vm.cancel){this.app.runAsync((()=>vm.cancel()));return}const message=`atom-window-cancel:${this.id}`;const device=this.app.resolve(App);device.broadcast(message,"cancelled")}onUpdateUI(){if(!(this.windowTemplate&&this.frameTemplate)){return}if(this.isReady){return}this.bind(this.element,"title",[["viewModel","title"]]);const frame=new this.frameTemplate(this.app);const fe=frame.element;const titleContent=new this.titleTemplate(this.app);titleContent.element._templateParent=this;frame.titlePresenter.appendChild(titleContent.element);this.setupDragging(frame.titlePresenter);this.element.classList.add("frame-host");fe._logicalParent=this.element;fe._templateParent=this;if(!frame.contentPresenter){throw new Error("ContentPresenter must be set inside frameTemplate before creating window")}const content=new this.windowTemplate(this.app);content.element._templateParent=this;this.setElementClass(content.element,{content:1});frame.contentPresenter.appendChild(content.element);if(this.commandTemplate){if(!frame.commandPresenter){throw new Error("CommandPresenter must be set inside frameTemplate"+"before creating window if command template is present")}const command=new this.commandTemplate(this.app);command.element._templateParent=this;this.setElementClass(command.element,{"command-bar":1});frame.commandPresenter.appendChild(command.element)}this.append(frame);setTimeout((()=>{this.centerFrame(frame.element)}),100);this.isReady=true}preCreate(){this.defaultControlStyle=AtomWindowStyle;this.title=null;this.width="";this.height="";this.x=-1;this.y=-1;this.windowTemplate=null;this.commandTemplate=null;this.titleTemplate=AtomWindowTitleTemplate;this.frameTemplate=AtomWindowFrameTemplate;super.preCreate();this.render(XNode.create("div",{styleClass:Bind.oneTime((()=>this.controlStyle.name))}))}centerFrame(e){if(!this.element){return}const parent=this.element.parentElement;if(parent===window||parent===document.body){return}if(parent.offsetWidth<=0||parent.offsetHeight<=0){setTimeout((()=>{this.centerFrame(e)}),100);return}if(e.offsetWidth<=0||e.offsetHeight<=0){setTimeout((()=>{this.centerFrame(e)}),100);return}const x=(parent.offsetWidth-e.offsetWidth)/2;const y=(parent.offsetHeight-e.offsetHeight)/2;this.x=x;this.y=y;e.style.opacity="1";this.element.style.removeProperty("opacity")}setupDragging(tp){this.bindEvent(tp,"mousedown",(startEvent=>{startEvent.preventDefault();const disposables=[];const offset={x:tp.parentElement.offsetLeft,y:tp.parentElement.offsetTop};const rect={x:startEvent.clientX,y:startEvent.clientY};const cursor=tp.style.cursor;tp.style.cursor="move";disposables.push(this.bindEvent(document.body,"mousemove",(moveEvent=>{const{clientX,clientY}=moveEvent;const dx=clientX-rect.x;const dy=clientY-rect.y;offset.x+=dx;offset.y+=dy;this.x=offset.x;this.y=offset.y;rect.x=clientX;rect.y=clientY})));disposables.push(this.bindEvent(document.body,"mouseup",(endEvent=>{tp.style.cursor=cursor;for(const iterator of disposables){iterator.dispose()}})))}))}});AtomWindow.windowTemplate=XNode.prepare("windowTemplate",true,true);AtomWindow.commandTemplate=XNode.prepare("commandTemplate",true,true);AtomWindow.titleTemplate=XNode.prepare("titleTemplate",true,true);AtomWindow.frameTemplate=XNode.prepare("frameTemplate",true,true)}}}));AmdLoader.instance.setup("@web-atoms/core/dist/web/controls/AtomAlertWindow");System.register(["tslib","../../core/Bind","../../core/BindableProperty","../../core/XNode","../../view-model/AtomWindowViewModel","../styles/AtomAlertWindowStyle","./AtomWindow"],(function(_export,_context){"use strict";var __decorate,__metadata,Bind,BindableProperty,XNode,AtomWindowViewModel,AtomAlertWindowStyle,AtomWindow,AtomAlertWindow,AtomAlertViewModel;_export("default",void 0);return{setters:[function(_tslib){__decorate=_tslib.__decorate;__metadata=_tslib.__metadata},function(_coreBind){Bind=_coreBind.default},function(_coreBindableProperty){BindableProperty=_coreBindableProperty.BindableProperty},function(_coreXNode){XNode=_coreXNode.default},function(_viewModelAtomWindowViewModel){AtomWindowViewModel=_viewModelAtomWindowViewModel.AtomWindowViewModel},function(_stylesAtomAlertWindowStyle){AtomAlertWindowStyle=_stylesAtomAlertWindowStyle.default},function(_AtomWindow){AtomWindow=_AtomWindow.AtomWindow}],execute:function(){_export("default",AtomAlertWindow=class AtomAlertWindow extends AtomWindow{create(){this.defaultControlStyle=AtomAlertWindowStyle;this.viewModel=this.resolve(AtomAlertViewModel);this.render(XNode.create(AtomWindow,{title:Bind.oneWay((()=>this.viewModel.title))},XNode.create(AtomWindow.windowTemplate,null,XNode.create("div",{formattedText:Bind.oneWay((()=>this.viewModel.message))})),XNode.create(AtomWindow.commandTemplate,null,XNode.create("div",null,XNode.create("button",{class:"yes-button",styleDisplay:Bind.oneWay((()=>this.viewModel.okTitle?"":"none")),text:Bind.oneWay((()=>this.viewModel.okTitle)),eventClick:()=>this.viewModel.onOkClicked()}),XNode.create("button",{class:"no-button",styleMarginBottom:Bind.oneWay((()=>this.viewModel.cancelTitle?"0":"10px")),styleDisplay:Bind.oneWay((()=>this.viewModel.cancelTitle?"":"none")),text:Bind.oneWay((()=>this.viewModel.cancelTitle)),eventClick:()=>this.viewModel.onCancelClicked()})))))}});AtomAlertViewModel=class AtomAlertViewModel extends AtomWindowViewModel{onOkClicked(){this.close(true)}onCancelClicked(){this.cancel()}};__decorate([BindableProperty,__metadata("design:type",String)],AtomAlertViewModel.prototype,"title",void 0);__decorate([BindableProperty,__metadata("design:type",String)],AtomAlertViewModel.prototype,"message",void 0);__decorate([BindableProperty,__metadata("design:type",String)],AtomAlertViewModel.prototype,"okTitle",void 0);__decorate([BindableProperty,__metadata("design:type",String)],AtomAlertViewModel.prototype,"cancelTitle",void 0)}}}));AmdLoader.instance.setup("@web-atoms/core/dist/web/styles/AtomNotificationStyle");System.register(["../../core/Colors","./AtomStyle"],(function(_export,_context){"use strict";var Colors,AtomStyle,AtomNotificationStyle;_export("default",void 0);return{setters:[function(_coreColors){Colors=_coreColors.default},function(_AtomStyle){AtomStyle=_AtomStyle.AtomStyle}],execute:function(){_export("default",AtomNotificationStyle=class AtomNotificationStyle extends AtomStyle{get root(){return{padding:"5px",borderRadius:"5px",border:"solid 1px lightgray",fontFamily:"Verdana, Geneva, sans-serif",fontSize:"16px",subclasses:{".error":{borderColor:Colors.red,color:Colors.red},".warning":{backgroundColor:Colors.lightYellow}}}}})}}}));AmdLoader.instance.setup("@web-atoms/core/dist/web/controls/AtomNotification");System.register(["tslib","../../core/Bind","../../core/BindableProperty","../../core/XNode","../styles/AtomNotificationStyle","./AtomControl"],(function(_export,_context){"use strict";var __decorate,__metadata,Bind,BindableProperty,XNode,AtomNotificationStyle,AtomControl,AtomNotification;_export("default",void 0);return{setters:[function(_tslib){__decorate=_tslib.__decorate;__metadata=_tslib.__metadata},function(_coreBind){Bind=_coreBind.default},function(_coreBindableProperty){BindableProperty=_coreBindableProperty.BindableProperty},function(_coreXNode){XNode=_coreXNode.default},function(_stylesAtomNotificationStyle){AtomNotificationStyle=_stylesAtomNotificationStyle.default},function(_AtomControl){AtomControl=_AtomControl.AtomControl}],execute:function(){_export("default",AtomNotification=class AtomNotification extends AtomControl{constructor(){super(...arguments);this.timeout=5e3;this.timeoutKey=null}onPropertyChanged(name){switch(name){case"timeout":this.setupTimeout();break}}create(){this.defaultControlStyle=AtomNotificationStyle;this.render(XNode.create("div",{formattedText:Bind.oneWay((()=>this.viewModel.message)),timeout:Bind.oneWay((()=>this.viewModel.timeout||5e3)),styleClass:Bind.oneWay((()=>({[this.controlStyle.name]:1,error:this.viewModel.type&&/error/i.test(this.viewModel.type),warning:this.viewModel.type&&/warn/i.test(this.viewModel.type)})))}))}setupTimeout(){if(this.timeoutKey){clearTimeout(this.timeoutKey)}this.timeoutKey=setTimeout((()=>{if(this.element){this.app.broadcast(`atom-window-close:${this.id}`,"")}}),this.timeout)}});__decorate([BindableProperty,__metadata("design:type",Number)],AtomNotification.prototype,"timeout",void 0)}}}));AmdLoader.instance.setup("@web-atoms/core/dist/web/styles/AtomPopupStyle");System.register(["../styles/AtomStyle"],(function(_export,_context){"use strict";var AtomStyle,AtomPopupStyle;_export("AtomPopupStyle",void 0);return{setters:[function(_stylesAtomStyle){AtomStyle=_stylesAtomStyle.AtomStyle}],execute:function(){_export("AtomPopupStyle",AtomPopupStyle=class AtomPopupStyle extends AtomStyle{get root(){return{backgroundColor:"white",border:"solid 1px lightgray",padding:"5px",borderRadius:"5px"}}})}}}));AmdLoader.instance.setup("@web-atoms/core/dist/web/services/NotificationPopup");System.register(["../../core/XNode","./PopupService","./NotifcationPopup.global.less"],(function(_export,_context){"use strict";var XNode,PopupWindow,css;function NotificationPopup({message,type}){return class Notification extends PopupWindow{create(){if(message instanceof XNode){this.render(XNode.create("div",{styleClass:{[css]:1,error:/error/i.test(type),warning:/warn/i.test(type)}},message));return}this.render(XNode.create("div",{styleClass:{[css]:1,error:/error/i.test(type),warning:/warn/i.test(type)},formattedText:message}))}}}_export("default",NotificationPopup);return{setters:[function(_coreXNode){XNode=_coreXNode.default},function(_PopupService){PopupWindow=_PopupService.PopupWindow},function(_NotifcationPopupGlobalLess){}],execute:function(){css="web-atoms-notification-popup"}}}));AmdLoader.instance.setup("@web-atoms/core/dist/web/services/WindowService");System.register(["tslib","../../App","../../Atom","../../core/AtomLoader","../../core/AtomUri","../../core/FormattedError","../../core/FormattedString","../../core/types","../../di/Inject","../../di/RegisterSingleton","../../di/ServiceCollection","../../services/JsonService","../../services/NavigationService","../../view-model/AtomWindowViewModel","../../web/core/AtomUI","../controls/AtomAlertWindow","../controls/AtomNotification","../controls/AtomWindow","../styles/AtomPopupStyle","../styles/AtomStyleSheet","../styles/StyleBuilder","./NotificationPopup","./PopupService"],(function(_export,_context){"use strict";var __awaiter,__decorate,__metadata,__param,App,Atom,AtomLoader,AtomUri,FormattedError,FormattedString,CancelToken,Inject,RegisterSingleton,Scope,ServiceCollection,JsonService,NavigationService,AtomWindowViewModel,AtomUI,AtomAlertWindow,AtomNotification,AtomWindow,AtomPopupStyle,AtomStyleSheet,cssNumberToString,NotificationPopup,PopupService,WindowService;return{setters:[function(_tslib){__awaiter=_tslib.__awaiter;__decorate=_tslib.__decorate;__metadata=_tslib.__metadata;__param=_tslib.__param},function(_App){App=_App.App},function(_Atom){Atom=_Atom.Atom},function(_coreAtomLoader){AtomLoader=_coreAtomLoader.AtomLoader},function(_coreAtomUri){AtomUri=_coreAtomUri.AtomUri},function(_coreFormattedError){FormattedError=_coreFormattedError.default},function(_coreFormattedString){FormattedString=_coreFormattedString.default},function(_coreTypes){CancelToken=_coreTypes.CancelToken},function(_diInject){Inject=_diInject.Inject},function(_diRegisterSingleton){RegisterSingleton=_diRegisterSingleton.RegisterSingleton},function(_diServiceCollection){Scope=_diServiceCollection.Scope;ServiceCollection=_diServiceCollection.ServiceCollection},function(_servicesJsonService){JsonService=_servicesJsonService.JsonService},function(_servicesNavigationService){NavigationService=_servicesNavigationService.NavigationService},function(_viewModelAtomWindowViewModel){AtomWindowViewModel=_viewModelAtomWindowViewModel.AtomWindowViewModel},function(_webCoreAtomUI){AtomUI=_webCoreAtomUI.AtomUI},function(_controlsAtomAlertWindow){AtomAlertWindow=_controlsAtomAlertWindow.default},function(_controlsAtomNotification){AtomNotification=_controlsAtomNotification.default},function(_controlsAtomWindow){AtomWindow=_controlsAtomWindow.AtomWindow},function(_stylesAtomPopupStyle){AtomPopupStyle=_stylesAtomPopupStyle.AtomPopupStyle},function(_stylesAtomStyleSheet){AtomStyleSheet=_stylesAtomStyleSheet.AtomStyleSheet},function(_stylesStyleBuilder){cssNumberToString=_stylesStyleBuilder.cssNumberToString},function(_NotificationPopup){NotificationPopup=_NotificationPopup.default},function(_PopupService){PopupService=_PopupService.default}],execute:function(){_export("WindowService",WindowService=class WindowService extends NavigationService{get title(){return window.document.title}set title(v){window.document.title=v}get location(){return new AtomUri(location.href)}set location(v){location.href=v.toString()}constructor(app,jsonService){super(app);this.jsonService=jsonService;this.popups=[];this.hostForElementFunc=[];this.lastPopupID=0;this.screen=app.screen;let st="desktop";if(/mobile|android|ios/i.test(window.navigator.userAgent)){st="mobile";if(/tablet/i.test(window.navigator.userAgent)){st="tablet"}}this.screen.screenType=st;if(window){const update=e=>{this.refreshScreen()};if(st!=="mobile"){window.addEventListener("resize",update);window.addEventListener("scroll",update);document.body.addEventListener("scroll",update);document.body.addEventListener("resize",update)}setTimeout((()=>{update(null)}),1e3)}}registerHostForWindow(f){this.hostForElementFunc.push(f);return{dispose:()=>{this.hostForElementFunc.remove(f)}}}navigate(url){location.href=url}back(){window.history.back()}register(id,type){ServiceCollection.instance.register(type,null,Scope.Transient,id)}confirm(message,title){return PopupService.confirm({message,title})}alert(message,title){if(!(message instanceof FormattedString||typeof message==="string")){if(message instanceof FormattedError){message=message.formattedMessage}else{message=message.message?message.message:message.toString()}}return PopupService.alert({message,title})}refresh(){location.reload()}getHostForElement(){const ce=PopupService.lastTarget;if(!ce){return null}for(const iterator of this.hostForElementFunc){const e=iterator(ce);if(e){return e}}return null}refreshScreen(){const height=this.screen.height=window.innerHeight||document.body.clientHeight;const width=this.screen.width=window.innerWidth||document.body.clientWidth;this.screen.scrollLeft=window.scrollX||document.body.scrollLeft||0;this.screen.scrollTop=window.scrollY||document.body.scrollTop||0;this.screen.orientation=width>height?"landscape":"portrait"}notify(message,title,type,delay){return __awaiter(this,void 0,void 0,(function*(){try{const notification=NotificationPopup({message,type});const cancelToken=new CancelToken(delay!==null&&delay!==void 0?delay:5e3);yield notification.showWindow(notification,{title,cancelToken})}catch(ex){console.error(ex)}}))}openWindow(url,options){return __awaiter(this,void 0,void 0,(function*(){yield Atom.delay(1);const lastTarget=PopupService.lastTarget;const{view:popup,returnPromise,disposables}=yield AtomLoader.loadView(url,this.app,true,(()=>this.app.resolve(AtomWindowViewModel,true)));if(options&&options.onInit){options.onInit(popup)}const cancelToken=options.cancelToken;if(cancelToken){if(cancelToken.cancelled){this.app.callLater((()=>{this.remove(popup,true)}))}cancelToken.registerForCancel((()=>{this.remove(popup,true)}))}const e=popup.element;let isPopup=true;if(popup instanceof AtomWindow){isPopup=false;e.style.opacity="0"}popup.registerDisposable({dispose:()=>{PopupService.lastTarget=lastTarget}});if(isPopup){const root=popup.element;const last=PopupService.lastTarget;const closePopup=et=>{let target=et.target;while(target){if(target===root||target===last){return}target=target.parentElement}this.remove(popup,true)};document.body.addEventListener("click",closePopup);popup.registerDisposable({dispose:()=>{document.body.removeEventListener("click",closePopup)}})}e._logicalParent=lastTarget;e.sourceUrl=url;const pvm=popup.viewModel;if(pvm){let ce=PopupService.lastTarget;if(ce){while(!ce.atomControl){ce=ce.parentElement;if(!ce){break}}if(ce&&ce.atomControl&&ce.atomControl.viewModel){pvm.parent=ce.atomControl.viewModel}}}const theme=this.app.get(AtomStyleSheet).getNamedStyle(AtomPopupStyle);e.style.zIndex=1e4+this.lastPopupID+"";const isNotification=popup instanceof AtomNotification;if(isPopup){const sr=AtomUI.screenOffset(PopupService.lastTarget);const x=sr.x;const y=sr.y;const h=sr.height;e.style.position="absolute";e.style.left=x+"px";e.style.top=y+h+"px";e.classList.add(theme.name);this.popups.push(popup);disposables.add((()=>{this.popups.remove(popup)}));document.body.appendChild(e);if(isNotification){e.style.opacity="0";this.centerElement(popup)}}else{const eHost=(options===null||options===void 0?void 0:options.modal)?null:this.getHostForElement();if(eHost){eHost.appendChild(e)}else{const host=document.createElement("div");document.body.appendChild(host);host.style.position="absolute";host.appendChild(e);disposables.add({dispose(){host.remove()}});this.refreshScreen();popup.bind(host,"styleLeft",[["this","scrollLeft"]],false,cssNumberToString,this.screen);popup.bind(host,"styleTop",[["this","scrollTop"]],false,cssNumberToString,this.screen);popup.bind(host,"styleWidth",[["this","width"]],false,cssNumberToString,this.screen);popup.bind(host,"styleHeight",[["this","height"]],false,cssNumberToString,this.screen)}}popup.bindEvent(document.body,"keyup",(keyboardEvent=>{if(keyboardEvent.key==="Escape"){this.app.runAsync((()=>this.remove(popup)))}}));disposables.add({dispose:()=>{e.innerHTML="";e.remove()}});return yield returnPromise}))}centerElement(c){const e=c.element;const parent=e.parentElement;if(parent===window||parent===document.body){setTimeout((()=>{const ew=(document.body.offsetWidth-e.offsetWidth)/2;const eh=window.scrollY+(window.innerHeight-e.offsetHeight)/2;e.style.left=`${ew}px`;e.style.top=`${eh}px`;e.style.removeProperty("opacity")}),200);return}if(parent.offsetWidth<=0||parent.offsetHeight<=0){setTimeout((()=>{this.centerElement(c)}),100);return}if(e.offsetWidth<=0||e.offsetHeight<=0){setTimeout((()=>{this.centerElement(c)}),100);return}const x=(parent.offsetWidth-e.offsetWidth)/2;const y=(parent.offsetHeight-e.offsetHeight)/2;e.style.left=`${x}px`;e.style.top=`${y}px`;e.style.removeProperty("opacity")}});WindowService.alertWindow=AtomAlertWindow;_export("WindowService",WindowService=__decorate([RegisterSingleton,__param(0,Inject),__param(1,Inject),__metadata("design:paramtypes",[App,JsonService])],WindowService))}}}));AmdLoader.instance.setup("@web-atoms/core/dist/web/styles/AtomTheme");System.register(["tslib","../../App","../../core/Colors","../../di/Inject","../../di/RegisterSingleton","../../services/NavigationService","../styles/AtomStyleSheet"],(function(_export,_context){"use strict";var __decorate,__metadata,__param,App,Colors,Inject,RegisterSingleton,NavigationService,AtomStyleSheet,AtomTheme;return{setters:[function(_tslib){__decorate=_tslib.__decorate;__metadata=_tslib.__metadata;__param=_tslib.__param},function(_App){App=_App.App},function(_coreColors){Colors=_coreColors.default},function(_diInject){Inject=_diInject.Inject},function(_diRegisterSingleton){RegisterSingleton=_diRegisterSingleton.RegisterSingleton},function(_servicesNavigationService){NavigationService=_servicesNavigationService.NavigationService},function(_stylesAtomStyleSheet){AtomStyleSheet=_stylesAtomStyleSheet.AtomStyleSheet}],execute:function(){_export("AtomTheme",AtomTheme=class AtomTheme extends AtomStyleSheet{constructor(app,navigationService){super(app,"atom-theme");this.navigationService=navigationService;this.bgColor=Colors.white;this.color=Colors.gray;this.hoverColor=Colors.lightGray;this.activeColor=Colors.lightBlue;this.selectedBgColor=Colors.blue;this.selectedColor=Colors.white;this.padding=5;setTimeout((()=>{window.addEventListener("resize",(()=>{setTimeout((()=>{this.pushUpdate()}),10)}));document.body.addEventListener("resize",(()=>{setTimeout((()=>{this.pushUpdate()}),10)}))}),1e3)}});_export("AtomTheme",AtomTheme=__decorate([RegisterSingleton,__param(0,Inject),__param(1,Inject),__metadata("design:paramtypes",[App,NavigationService])],AtomTheme))}}}));AmdLoader.instance.setup("@web-atoms/core/dist/web/WebApp");System.register(["../App","../core/AtomOnce","../core/AtomUri","../di/ServiceCollection","../services/BusyIndicatorService","../services/NavigationService","./services/WebBusyIndicatorService","./services/WindowService","./styles/AtomStyleSheet","./styles/AtomTheme"],(function(_export,_context){"use strict";var App,AtomOnce,AtomUri,ServiceCollection,BusyIndicatorService,NavigationService,WebBusyIndicatorService,WindowService,AtomStyleSheet,AtomTheme,WebApp;_export("default",void 0);return{setters:[function(_App){App=_App.App},function(_coreAtomOnce){AtomOnce=_coreAtomOnce.AtomOnce},function(_coreAtomUri){AtomUri=_coreAtomUri.AtomUri},function(_diServiceCollection){ServiceCollection=_diServiceCollection.ServiceCollection},function(_servicesBusyIndicatorService){BusyIndicatorService=_servicesBusyIndicatorService.BusyIndicatorService},function(_servicesNavigationService){NavigationService=_servicesNavigationService.NavigationService},function(_servicesWebBusyIndicatorService){WebBusyIndicatorService=_servicesWebBusyIndicatorService.WebBusyIndicatorService},function(_servicesWindowService){WindowService=_servicesWindowService.WindowService},function(_stylesAtomStyleSheet){AtomStyleSheet=_stylesAtomStyleSheet.AtomStyleSheet},function(_stylesAtomTheme){AtomTheme=_stylesAtomTheme.AtomTheme}],execute:function(){_export("default",WebApp=class WebApp extends App{get parentElement(){return document.body}get root(){return this.mRoot}set root(v){const old=this.mRoot;if(old){old.dispose()}this.mRoot=v;if(!v){return}const pe=this.parentElement;const de=Array.from(pe.children);for(const iterator of de){iterator.remove()}pe.appendChild(v.element)}get theme(){return this.get(AtomStyleSheet)}set theme(v){this.put(AtomTheme,v);this.put(AtomStyleSheet,v)}get contextId(){var _a;(_a=this.mContextId)!==null&&_a!==void 0?_a:this.mContextId=parseInt((this.url.hash.contextId||"0").toString(),10);if(!this.mContextId){for(let index=0;index<100;index++){const cid=`contextId${index}`;const cidData=sessionStorage.getItem(`contextId${index}`);if(!cidData){this.mContextId=index;sessionStorage.setItem(cid,cid);this.url.hash.contextId=index;this.syncUrl();break}}}return`contextId_${this.mContextId}`}constructor(){super();this.hashUpdater=new AtomOnce;this.url=new AtomUri(location.href);this.put(NavigationService,this.resolve(WindowService));this.put(WebApp,this);this.put(BusyIndicatorService,this.resolve(WebBusyIndicatorService));ServiceCollection.instance.registerSingleton(AtomStyleSheet,(sp=>sp.resolve(AtomTheme)));window.addEventListener("hashchange",(()=>{this.hashUpdater.run((()=>{this.url=new AtomUri(location.href)}))}));this.initPromise=new Promise(((resolve,reject)=>{this.onReady(resolve)}))}updateDefaultStyle(textContent){if(this.styleElement){if(this.styleElement.textContent===textContent){return}}const ss=document.createElement("style");ss.textContent=textContent;if(this.styleElement){this.styleElement.remove()}document.head.appendChild(ss);this.styleElement=ss}syncUrl(){this.hashUpdater.run((()=>{const currentUrl=new AtomUri(location.href);const sourceHash=this.url.hash;const keyValues=[];let modified=false;for(const key in sourceHash){if(/^\_\$\_/.test(key)){continue}if(sourceHash.hasOwnProperty(key)){const element=sourceHash[key];const cv=currentUrl.hash[key];if(element!==undefined){keyValues.push({key,value:element})}if(cv===element){continue}modified=true}}if(!modified){return}const hash=keyValues.map((s=>`${s.key}=${encodeURIComponent(s.value)}`)).join("&");location.hash=hash}))}invokeReady(){if(document.readyState==="complete"){super.invokeReady();return}document.addEventListener("readystatechange",(e=>{super.invokeReady()}))}});(function(){if(typeof window.CustomEvent==="function"){return false}function CustomEvent(event,params){params=params||{bubbles:false,cancelable:false,detail:null};const evt=document.createEvent("CustomEvent");evt.initCustomEvent(event,params.bubbles,params.cancelable,params.detail);return evt}window.CustomEvent=CustomEvent})()}}}));window.installStyleSheet("./DownloadZip.pack.global.less.css");window.installStyleSheet("./DownloadZip.pack.local.less.css");
|
|
7
|
+
`.installGlobal("[data-download-all]");fileInfo=window.fileInfo;if(!fileInfo){fileInfo=window.fileInfo={};const url=new URL(location.href);url.searchParams.forEach(((v,k)=>{fileInfo[k]=v}))}DownloadZip=class DownloadZip extends AtomControl{constructor(app,e){super(app,e);this.files=[];this.map=new Map;this.slice=[];this.element.setAttribute("data-download-all","download-all");this.pushInit()}init(){var _a;return __awaiter(this,void 0,void 0,(function*(){this.renderer=XNode.create("div",null,XNode.create("div",{"data-layout":"center-all"},XNode.create("div",null,"Preparing Zip")));const{default:JSZip}=yield UMD.import("https://cdn.jsdelivr.net/npm/jszip@3.10.1/dist/jszip.min.js");this.zipFile=new JSZip;this.renderer=XNode.create("div",null,XNode.create("div",{"data-layout":"center-all"},XNode.create("div",null,"Loading folder ...")));yield this.loadingFiles();this.renderer=XNode.create("div",null,XNode.create("div",{"data-layout":"center-all"},XNode.create("div",null,"Downloading Files ...")));for(const element of this.files){if(!element.parentID){continue}const parent=this.map.get(element.parentID);if(parent){((_a=parent.children)!==null&&_a!==void 0?_a:parent.children=[]).push(element)}}const zipFolder=this.zipFile.folder(this.root.name);this.renderer=XNode.create("div",null,XNode.create("div",{"data-layout":"center-all"},XNode.create(AtomRepeater,{items:this.slice,itemRenderer:x=>XNode.create("div",{text:`Downloading ${x.name} (${toKMBString(x.fileSize)})`})})));yield this.downloadFiles(this.root,zipFolder);this.renderer=XNode.create("div",null,XNode.create("div",{"data-layout":"center-all"},XNode.create("div",null,"Generating zip file.")));const zipFile=yield this.zipFile.generateAsync({type:"blob"});const file=new File([zipFile],this.root.name+".zip",{type:"application/zip"});const url=URL.createObjectURL(file);this.renderer=XNode.create("div",null,XNode.create("div",{"data-layout":"center-all"},XNode.create("div",{"data-layout":"vertical-flex-stretch-items"},XNode.create("div",null,"Zip File is ready."),XNode.create("a",{href:url,download:file.name},"Save Zip File"))))}))}downloadFiles(folder,zipFolder){return __awaiter(this,void 0,void 0,(function*(){if(!folder.children){return}const folders=[];const files=[];for(const element of folder.children){if(element.isFolder){if(element.children){folders.push(element)}continue}files.push(element)}do{const slice=files.splice(0,5);const tasks=[];for(const file of slice){this.slice.add(file);tasks.push((()=>__awaiter(this,void 0,void 0,(function*(){const blob=yield FetchBuilder.get(file.url).asBlob();zipFolder.file(file.name,blob);this.slice.remove(file)})))())}yield Promise.all(tasks)}while(files.length);for(const element of folders){const child=zipFolder.folder(element.name);yield this.downloadFiles(element,child)}}))}loadingFiles(){var _a;return __awaiter(this,void 0,void 0,(function*(){const path=fileInfo.path+"%";let start=0;const all=[];do{const files=yield this.entityService.query(AppFile).where({path,start},(p=>x=>Sql.text.like(x.path,p.path)&&x.appFileID>p.start&&x.isDeleted===false)).orderBy((x=>x.appFileID)).toPagedList({size:100});if(!files.items.length){break}start=files.items[files.items.length-1].appFileID;for(const file of files.items){this.map.set(file.appFileID,file);all.push(file);if(!this.root&&file.appFileID===fileInfo.appFileID){this.root=file}start=file.appFileID}}while(true);for(const e of all){if(e.parentID){const p=this.map.get(e.parentID);if(!p){console.warn(`Dangling file found ${e.name} at ${e.path}`);continue}((_a=p.children)!==null&&_a!==void 0?_a:p.children=[]).push(e)}}}))}};__decorate([InjectProperty,__metadata("design:type",EntityService)],DownloadZip.prototype,"entityService",void 0);DownloadZip=__decorate([Pack,__metadata("design:paramtypes",[Object,Object])],DownloadZip);_export("default",DownloadZip)}}}));AmdLoader.instance.setup("@web-atoms/core/dist/core/AtomOnce");System.register([],(function(_export,_context){"use strict";var AtomOnce;_export("AtomOnce",void 0);return{setters:[],execute:function(){_export("AtomOnce",AtomOnce=class AtomOnce{run(f){if(this.isRunning){return}let isAsync=false;try{this.isRunning=true;const p=f();if(p&&p.then&&p.catch){isAsync=true;p.then((()=>{this.isRunning=false})).catch((()=>{this.isRunning=false}))}}finally{if(!isAsync){this.isRunning=false}}}})}}}));AmdLoader.instance.setup("@web-atoms/core/dist/core/AtomUri");System.register(["../web/core/AtomUI"],(function(_export,_context){"use strict";var AtomUI,AtomUri;_export("AtomUri",void 0);return{setters:[function(_webCoreAtomUI){AtomUI=_webCoreAtomUI.AtomUI}],execute:function(){_export("AtomUri",AtomUri=class AtomUri{get pathAndQuery(){const q=[];const h=[];for(const key in this.query){if(this.query.hasOwnProperty(key)){const element=this.query[key];if(element===undefined||element===null){continue}q.push(`${encodeURIComponent(key)}=${encodeURIComponent(element.toString())}`)}}for(const key in this.hash){if(this.hash.hasOwnProperty(key)){const element=this.hash[key];if(element===undefined||element===null){continue}h.push(`${encodeURIComponent(key)}=${encodeURIComponent(element.toString())}`)}}const query=q.length?"?"+q.join("&"):"";const hash=h.length?"#"+h.join("&"):"";let path=this.path||"/";if(path.startsWith("/")){path=path.substr(1)}return`${path}${query}${hash}`}constructor(url){let path;let query="";let hash="";let t=url.split("?");path=t[0];if(t.length===2){query=t[1]||"";t=query.split("#");query=t[0];hash=t[1]||""}else{t=path.split("#");path=t[0];hash=t[1]||""}let scheme="";let host="";let port="";let i=path.indexOf("//");if(i!==-1){scheme=path.substr(0,i);path=path.substr(i+2);i=path.indexOf("/");if(i!==-1){host=path.substr(0,i);path=path.substr(i+1);t=host.split(":");if(t.length>1){host=t[0];port=t[1]}}}this.host=host;this.protocol=scheme;this.port=port;this.path=path;this.query=AtomUI.parseUrl(query);this.hash=AtomUI.parseUrl(hash)}toString(){const port=this.port?":"+this.port:"";return`${this.protocol}//${this.host}${port}/${this.pathAndQuery}`}})}}}));AmdLoader.instance.setup("@web-atoms/core/dist/services/ReferenceService");System.register(["tslib","../di/DISingleton"],(function(_export,_context){"use strict";var __decorate,DISingleton,ObjectReference,ReferenceService;_export("ObjectReference",void 0);return{setters:[function(_tslib){__decorate=_tslib.__decorate},function(_diDISingleton){DISingleton=_diDISingleton.default}],execute:function(){_export("ObjectReference",ObjectReference=class ObjectReference{constructor(key,value){this.key=key;this.value=value}});ReferenceService=class ReferenceService{constructor(){this.cache={};this.id=1}get(key){return this.cache[key]}put(item,ttl=60){const key=`k${this.id++}`;const r=new ObjectReference(key,item);r.consume=()=>{delete this.cache[key];if(r.timeout){clearTimeout(r.timeout)}return r.value};r.timeout=setTimeout((()=>{r.timeout=0;r.consume()}),ttl*1e3);this.cache[key]=r;return r}};ReferenceService=__decorate([DISingleton()],ReferenceService);_export("default",ReferenceService)}}}));AmdLoader.instance.setup("@web-atoms/core/dist/services/NavigationService");System.register(["tslib","../core/AtomComponent","../core/AtomUri","../core/FormattedString","../core/types","./ReferenceService"],(function(_export,_context){"use strict";var __awaiter,AtomComponent,AtomUri,FormattedString,ArrayHelper,ReferenceService,ObjectReference,NavigationService,NotifyType,nameSymbol;function hasPageUrl(target){const url=target[nameSymbol];if(!url){return false}const baseClass=Object.getPrototypeOf(target);if(!baseClass){return false}return baseClass[nameSymbol]!==url}_export({NavigationService:void 0,NotifyType:void 0});return{setters:[function(_tslib){__awaiter=_tslib.__awaiter},function(_coreAtomComponent){AtomComponent=_coreAtomComponent.AtomComponent},function(_coreAtomUri){AtomUri=_coreAtomUri.AtomUri},function(_coreFormattedString){FormattedString=_coreFormattedString.default},function(_coreTypes){ArrayHelper=_coreTypes.ArrayHelper},function(_ReferenceService){ReferenceService=_ReferenceService.default;ObjectReference=_ReferenceService.ObjectReference}],execute:function(){(function(NotifyType){NotifyType["Information"]="info";NotifyType["Warning"]="warn";NotifyType["Error"]="error"})(NotifyType||_export("NotifyType",NotifyType={}));nameSymbol=UMD.nameSymbol;_export("NavigationService",NavigationService=class NavigationService{constructor(app){this.app=app;this.callbacks=[]}pushPage(pageName,viewModelParameters,options){this.app.runAsync((()=>this.openPage(pageName,viewModelParameters,options)))}openPage(pageName,viewModelParameters,options){options=options||{};if(typeof pageName!=="string"){if(hasPageUrl(pageName)){pageName=pageName[nameSymbol]}else{const rs=this.app.resolve(ReferenceService);const host=pageName instanceof AtomComponent?"reference":"class";const r=rs.put(pageName);pageName=`ref://${host}/${r.key}`}}if(this.beforeCallbacks){for(const iterator of this.beforeCallbacks){const r=iterator(pageName,viewModelParameters,options);if(r){return r}}}const url=new AtomUri(pageName);if(viewModelParameters){for(const key in viewModelParameters){if(viewModelParameters.hasOwnProperty(key)){const element=viewModelParameters[key];if(element===undefined){continue}if(element===null){url.query["json:"+key]="null";continue}if(key.startsWith("ref:")||element instanceof FormattedString){const r=element instanceof ObjectReference?element:this.app.resolve(ReferenceService).put(element);url.query[key.startsWith("ref:")?key:`ref:${key}`]=r.key;continue}if(typeof element!=="string"&&(typeof element==="object"||Array.isArray(element))){url.query["json:"+key]=JSON.stringify(element)}else{url.query[key]=element}}}}for(const iterator of this.callbacks){const r=iterator(url,options);if(r){return r}}return this.openWindow(url,options)}remove(view,force){return __awaiter(this,void 0,void 0,(function*(){if(force){this.app.broadcast(`atom-window-cancel:${view.id}`,"cancelled");return true}const vm=view.viewModel;if(vm&&vm.cancel){const a=yield vm.cancel();return a}this.app.broadcast(`atom-window-cancel:${view.id}`,"cancelled");return true}))}registerNavigationHook(callback){this.callbacks.push(callback);return{dispose:()=>{ArrayHelper.remove(this.callbacks,(a=>a===callback))}}}registerPreNavigationHook(callback){var _a;((_a=this.beforeCallbacks)!==null&&_a!==void 0?_a:this.beforeCallbacks=[]).push(callback);return{dispose:()=>{this.beforeCallbacks.remove(callback)}}}})}}}));AmdLoader.instance.setup("@web-atoms/core/dist/web/styles/StyleBuilder");System.register([],(function(_export,_context){"use strict";var StyleBuilder;function cssNumberToString(n,unit="px"){if(typeof n==="number"){if(n===0){return n+""}return n+unit}return n}_export({cssNumberToString,default:void 0});return{setters:[],execute:function(){_export("default",StyleBuilder=class StyleBuilder{static get newStyle(){return new StyleBuilder}constructor(style){this.style=style;this.style=this.style||{}}toStyle(){return this.style}size(width,height){width=cssNumberToString(width);height=cssNumberToString(height);return this.merge({width,height})}roundBorder(radius){radius=cssNumberToString(radius);return this.merge({borderRadius:radius,padding:radius})}border(borderWidth,borderColor,borderStyle="solid"){borderWidth=cssNumberToString(borderWidth);return this.merge({borderWidth,borderStyle,borderColor})}center(width,height){width=cssNumberToString(width);height=cssNumberToString(height);return this.merge({position:"absolute",left:0,right:0,top:0,bottom:0,width,height,margin:"auto"})}absolute(left,top,right,bottom){left=cssNumberToString(left);top=cssNumberToString(top);if(right!==undefined){right=cssNumberToString(right);bottom=cssNumberToString(bottom);return this.merge({position:"absolute",left,top,right,bottom})}return this.merge({position:"absolute",left,top})}merge(style){return new StyleBuilder(Object.assign(Object.assign({},this.style),style))}})}}}));AmdLoader.instance.setup("@web-atoms/core/dist/web/services/WebBusyIndicatorService");System.register(["tslib","../../App","../../di/Inject","../../di/RegisterSingleton","../../services/BusyIndicatorService","../../services/NavigationService","../controls/AtomControl","../styles/StyleBuilder"],(function(_export,_context){"use strict";var __decorate,__metadata,App,Inject,RegisterSingleton,BusyIndicatorService,NavigationService,AtomControl,cssNumberToString,WebBusyIndicatorService;return{setters:[function(_tslib){__decorate=_tslib.__decorate;__metadata=_tslib.__metadata},function(_App){App=_App.App},function(_diInject){Inject=_diInject.Inject},function(_diRegisterSingleton){RegisterSingleton=_diRegisterSingleton.RegisterSingleton},function(_servicesBusyIndicatorService){BusyIndicatorService=_servicesBusyIndicatorService.BusyIndicatorService},function(_servicesNavigationService){NavigationService=_servicesNavigationService.NavigationService},function(_controlsAtomControl){AtomControl=_controlsAtomControl.AtomControl},function(_stylesStyleBuilder){cssNumberToString=_stylesStyleBuilder.cssNumberToString}],execute:function(){_export("WebBusyIndicatorService",WebBusyIndicatorService=class WebBusyIndicatorService extends BusyIndicatorService{constructor(){super(...arguments);this.zIndex=5e4;this.indicators=0}createIndicator(){const host=document.createElement("div");const popup=new AtomControl(this.app,host);host.className="indicator-host";const span=document.createElement("i");const divStyle=host.style;divStyle.position="absolute";divStyle.overflow="hidden";divStyle.left=divStyle.right=divStyle.bottom=divStyle.top="0";divStyle.zIndex=this.zIndex+++"";const spanStyle=span.style;spanStyle.position="absolute";spanStyle.margin="auto";spanStyle.width="16px";spanStyle.height="16px";spanStyle.overflow="hidden";spanStyle.maxHeight="100%";spanStyle.maxWidth="100%";spanStyle.left=spanStyle.right=spanStyle.bottom=spanStyle.top="0";span.className="fas fa-spinner fa-spin";host.appendChild(span);const ws=this.navigationService;const e=ws.getHostForElement();if(e){e.appendChild(host)}else{document.body.appendChild(host);ws.refreshScreen();popup.bind(host,"styleLeft",[["this","scrollLeft"]],false,cssNumberToString,ws.screen);popup.bind(host,"styleTop",[["this","scrollTop"]],false,cssNumberToString,ws.screen);popup.bind(host,"styleWidth",[["this","width"]],false,cssNumberToString,ws.screen);popup.bind(host,"styleHeight",[["this","height"]],false,cssNumberToString,ws.screen)}popup.registerDisposable({dispose:()=>{host.remove()}});return popup}});__decorate([Inject,__metadata("design:type",NavigationService)],WebBusyIndicatorService.prototype,"navigationService",void 0);__decorate([Inject,__metadata("design:type",App)],WebBusyIndicatorService.prototype,"app",void 0);_export("WebBusyIndicatorService",WebBusyIndicatorService=__decorate([RegisterSingleton],WebBusyIndicatorService))}}}));AmdLoader.instance.setup("@web-atoms/core/dist/Atom");System.register(["tslib"],(function(_export,_context){"use strict";var __awaiter,Atom;_export("Atom",void 0);return{setters:[function(_tslib){__awaiter=_tslib.__awaiter}],execute:function(){_export("Atom",Atom=class Atom{static superProperty(tc,target,name){let c=tc;do{c=Object.getPrototypeOf(c);if(!c){throw new Error("No property descriptor found for "+name)}const pd=Object.getOwnPropertyDescriptor(c.prototype,name);if(!pd){continue}return pd.get.apply(target)}while(true)}static get(target,path){const segments=path.split(".");for(const iterator of segments){if(target===undefined||target===null){return target}target=target[iterator]}return target}static delay(n,ct){return new Promise(((resolve,reject)=>{const h={};h.id=setTimeout((()=>{resolve()}),n);if(ct){ct.registerForCancel((()=>{clearTimeout(h.id);reject(new Error("cancelled"))}))}}))}static encodeParameters(p){if(!p){return""}let s="";for(const key in p){if(p.hasOwnProperty(key)){const element=p[key];let v=element;if(v===undefined||v===null){continue}if(v instanceof Date){v=v.toISOString()}else if(typeof element==="object"){v=JSON.stringify(element)}if(s){s+="&"}s+=`${key}=${encodeURIComponent(v)}`}}return s}static url(url,query,hash){if(!url){return url}let p=this.encodeParameters(query);if(p){if(url.indexOf("?")===-1){url+="?"}else{url+="&"}url+=p}p=this.encodeParameters(hash);if(p){if(url.indexOf("#")===-1){url+="#"}else{url+="&"}url+=p}return url}static postAsync(app,f){return new Promise(((resolve,reject)=>{app.callLater((()=>__awaiter(this,void 0,void 0,(function*(){try{resolve(yield f())}catch(error){reject(error)}}))))}))}});Atom.designMode=false}}}));AmdLoader.instance.setup("@web-atoms/core/dist/services/JsonService");System.register(["tslib","../core/StringHelper","../di/RegisterSingleton","@web-atoms/date-time/dist/DateTime"],(function(_export,_context){"use strict";var __decorate,StringHelper,RegisterSingleton,DateTime,dateFormatISORegEx,dateFormatMSRegEx,timeZoneDiff,JsonService;return{setters:[function(_tslib){__decorate=_tslib.__decorate},function(_coreStringHelper){StringHelper=_coreStringHelper.StringHelper},function(_diRegisterSingleton){RegisterSingleton=_diRegisterSingleton.RegisterSingleton},function(_webAtomsDateTimeDistDateTime){DateTime=_webAtomsDateTimeDistDateTime.default}],execute:function(){_export("dateFormatISORegEx",dateFormatISORegEx=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/);_export("dateFormatMSRegEx",dateFormatMSRegEx=/^\/Date\((d|-|.*)\)[\/|\\]$/);timeZoneDiff=(new Date).getTimezoneOffset();_export("JsonService",JsonService=class JsonService{constructor(){this.options={indent:2,namingStrategy:"none",dateConverter:[{regex:dateFormatISORegEx,valueConverter:{fromSource(v){const d=new DateTime(v);return d},fromTarget(v){return v.toISOString()}}},{regex:dateFormatMSRegEx,valueConverter:{fromSource(v){const a=dateFormatMSRegEx.exec(v);const b=a[1].split(/[-+,.]/);return new DateTime(b[0]?+b[0]:0-+b[1])},fromTarget(v){return v.toISOString()}}}]}}transformKeys(t,v){if(!v){return v}if(typeof v!=="object"){return v}if(v instanceof Date){return v}if(typeof v==="object"&&v.length!==undefined&&typeof v.length==="number"){const a=v;if(a.map){return a.map((x=>this.transformKeys(t,x)))}const ra=[];for(let i=0;i<a.length;i++){const iterator=a[i];ra.push(this.transformKeys(t,iterator))}return ra}const r={};for(const key in v){if(v.hasOwnProperty(key)){const element=v[key];r[t(key)]=this.transformKeys(t,element)}}return r}parse(text,options){const{dateConverter,namingStrategy}=Object.assign(Object.assign({},this.options),options);const result=JSON.parse(text,((key,value)=>{if(typeof value==="string"){for(const iterator of dateConverter){const a=iterator.regex.test(value);if(a){const dv=iterator.valueConverter.fromSource(value);return dv}}}return value}));switch(namingStrategy){case"hyphen":return this.transformKeys(StringHelper.fromHyphenToCamel,result);case"underscore":return this.transformKeys(StringHelper.fromUnderscoreToCamel,result);case"pascal":return this.transformKeys(StringHelper.fromPascalToCamel,result)}return result}stringify(v,options){const{namingStrategy,dateConverter,indent}=Object.assign(Object.assign({},this.options),options);switch(namingStrategy){case"hyphen":v=this.transformKeys(StringHelper.fromCamelToHyphen,v);break;case"underscore":v=this.transformKeys(StringHelper.fromCamelToUnderscore,v);break;case"pascal":v=this.transformKeys(StringHelper.fromCamelToPascal,v);break}return JSON.stringify(v,((key,value)=>{if(key&&/^\_\$\_/.test(key)){return undefined}if(dateConverter&&value instanceof Date){return dateConverter[0].valueConverter.fromTarget(value)}return value}),indent)}});_export("JsonService",JsonService=__decorate([RegisterSingleton],JsonService))}}}));AmdLoader.instance.setup("@web-atoms/core/dist/core/AtomLoader");System.register(["tslib","../services/JsonService","../services/ReferenceService","./AtomUri","./Command","./InheritedProperty","./types"],(function(_export,_context){"use strict";var __awaiter,__rest,JsonService,ReferenceService,AtomUri,displayRouteSymbol,getOwnInheritedProperty,CancelToken,DI,AtomLoader;_export("AtomLoader",void 0);return{setters:[function(_tslib){__awaiter=_tslib.__awaiter;__rest=_tslib.__rest},function(_servicesJsonService){JsonService=_servicesJsonService.JsonService},function(_servicesReferenceService){ReferenceService=_servicesReferenceService.default},function(_AtomUri){AtomUri=_AtomUri.AtomUri},function(_Command){displayRouteSymbol=_Command.displayRouteSymbol},function(_InheritedProperty){getOwnInheritedProperty=_InheritedProperty.getOwnInheritedProperty},function(_types){CancelToken=_types.CancelToken;DI=_types.DI}],execute:function(){_export("AtomLoader",AtomLoader=class AtomLoader{static load(url,app){return __awaiter(this,void 0,void 0,(function*(){if(typeof url==="string"){const type=yield DI.resolveViewClassAsync(url);if(!type){throw new Error(`Type not found for ${url}`)}url=type}if(url instanceof AtomUri){if(url.host==="reference"){const r=app.get(ReferenceService).get(url.path);if(!r){throw new Error("reference not found")}return r.consume()}if(url.host==="class"){const r=app.get(ReferenceService).get(url.path);if(!r){throw new Error("reference not found")}return app.resolve(r.consume(),true)}url=url.path;const type=yield DI.resolveViewClassAsync(url);if(!type){throw new Error(`Type not found for ${url}`)}url=type}const obj=app.resolve(url,true);return obj}))}static loadView(url,app,hookCloseEvents,vmFactory){return __awaiter(this,void 0,void 0,(function*(){const busyIndicator=app.createBusyIndicator({title:url.toString(),description:`Loading View ${url}`});try{const view=yield AtomLoader.load(url,app);let vm=view.viewModel;if(!vm){if(!vmFactory){return{view}}vm=vmFactory();view.viewModel=vm}if("parameters"in view){vm=view.parameters}if(vm){const jsonService=app.get(JsonService);for(const key in url.query){if(url.query.hasOwnProperty(key)){const element=url.query[key];if(typeof element==="object"){vm[key]=jsonService.parse(jsonService.stringify(element));continue}if(/^json\:/.test(key)){const k=key.split(":")[1];vm[k]=jsonService.parse(element.toString());continue}if(/^ref\:/.test(key)){const rs=app.get(ReferenceService);const v=rs.get(element);vm[key.split(":",2)[1]]=v.consume();continue}try{vm[key]=element}catch(e){console.error(e)}}}}if(hookCloseEvents&&vm){const disposables=view.disposables;const id=(AtomLoader.id++).toString();view.id=id;const returnPromise=new Promise(((resolve,reject)=>{disposables.add(app.subscribe(`atom-window-close:${id}`,((m,r)=>{resolve(r);view.dispose()})));disposables.add(app.subscribe(`atom-window-cancel:${id}`,(()=>{reject("cancelled");view.dispose()})))}));vm.windowName=id;view.returnPromise=returnPromise;return{view,disposables,returnPromise,id}}return{view}}finally{busyIndicator.dispose()}}))}static loadClass(url_1){return __awaiter(this,arguments,void 0,(function*(url,_a={},app){var _b,_c,_d,_e;var _f;var{title}=_a,_g=displayRouteSymbol,route=_a[_g],parameters=__rest(_a,["title",typeof _g==="symbol"?_g:_g+""]);const busyIndicator=app.createBusyIndicator({title:url===null||url===void 0?void 0:url.toString(),description:`Loading View ${url}`});try{const view=yield AtomLoader.load(url,app);const vm=getOwnInheritedProperty(view,"viewModel");let params;if("parameters"in view){params=view.parameters}if(!vm){params=(_b=(_f=view).parameters)!==null&&_b!==void 0?_b:_f.parameters={}}else{console.warn("ViewModel is deprecated")}if(title){view.title=title}if(params){params[displayRouteSymbol]=route}if((vm||params)&¶meters){for(const key in parameters){if(parameters.hasOwnProperty(key)){const element=parameters[key];try{if(vm){vm[key]=element}if(params){params[key]=element}}catch(e){console.error(e)}}}}(_e=(_d=(_c=view).init)===null||_d===void 0?void 0:_d.call(_c))===null||_e===void 0?void 0:_e.catch((error=>{if(!CancelToken.isCancelled(error)){console.error(error)}}));return view}finally{busyIndicator.dispose()}}))}static loadControl(url,app){return __awaiter(this,void 0,void 0,(function*(){var _a,_b,_c,_d;var _e;const busyIndicator=app.createBusyIndicator({title:url===null||url===void 0?void 0:url.toString(),description:`Loading View ${url}`});try{const view=yield AtomLoader.load(url,app);const vm=getOwnInheritedProperty(view,"viewModel");let params;if("parameters"in view){params=view.parameters}if(!vm){params=(_a=(_e=view).parameters)!==null&&_a!==void 0?_a:_e.parameters={}}if(vm||params){const jsonService=app.get(JsonService);for(const key in url.query){if(url.query.hasOwnProperty(key)){const element=url.query[key];if(/^json\:/.test(key)){const k=key.split(":")[1];const v=jsonService.parse(element.toString());if(vm){vm[k]=v}if(params){params[k]=v}continue}if(/^ref\:/.test(key)){const rs=app.get(ReferenceService);const v=rs.get(element).consume();const keyName=key.split(":",2)[1];if(vm){vm[keyName]=v}if(params){params[keyName]=v}continue}try{if(vm){vm[key]=element}if(params){params[key]=element}}catch(e){console.error(e)}}}}(_d=(_c=(_b=view).init)===null||_c===void 0?void 0:_c.call(_b))===null||_d===void 0?void 0:_d.catch((error=>{if(!CancelToken.isCancelled(error)){console.error(error)}}));return view}finally{busyIndicator.dispose()}}))}});AtomLoader.id=1}}}));AmdLoader.instance.setup("@web-atoms/core/dist/core/FormattedError");System.register([],(function(_export,_context){"use strict";var FormattedError;_export("default",void 0);return{setters:[],execute:function(){_export("default",FormattedError=class FormattedError{constructor(msg){const e=new Error(msg.toString());e.formattedMessage=msg;e.__proto__=FormattedError.prototype;return e}})}}}));AmdLoader.instance.setup("@web-atoms/core/dist/view-model/baseTypes");System.register([],(function(_export,_context){"use strict";function registerInit(target,fx){const t=target;const inits=t._$_inits=t._$_inits||[];inits.push(fx)}_export("registerInit",registerInit);return{setters:[],execute:function(){}}}));AmdLoader.instance.setup("@web-atoms/core/dist/view-model/AtomViewModel");System.register(["tslib","../App","../Atom","../core/AtomBinder","../core/AtomDisposableList","../core/AtomWatcher","../core/BindableProperty","../di/Inject","./baseTypes"],(function(_export,_context){"use strict";var __awaiter,__decorate,__metadata,__param,App,Atom,AtomBinder,AtomDisposableList,AtomWatcher,BindableProperty,Inject,registerInit,AtomViewModel;function runDecoratorInits(){const v=this.constructor.prototype;if(!v){return}const ris=v._$_inits;if(ris){for(const ri of ris){ri.call(this,this)}}}function privateInit(){return __awaiter(this,void 0,void 0,(function*(){try{yield Atom.postAsync(this.app,(()=>__awaiter(this,void 0,void 0,(function*(){runDecoratorInits.apply(this)}))));yield Atom.postAsync(this.app,(()=>__awaiter(this,void 0,void 0,(function*(){yield this.init();this.onReady()}))));if(this.postInit){for(const i of this.postInit){i()}this.postInit=null}}finally{const pi=this.pendingInits;this.pendingInits=null;for(const iterator of pi){iterator()}}}))}function waitForReady(vm){return __awaiter(this,void 0,void 0,(function*(){while(vm.pendingInits){yield Atom.delay(100)}}))}function Receive(...channel){return(target,key)=>{registerInit(target,(vm=>{const fx=vm[key];const a=(ch,d)=>{const p=fx.call(vm,ch,d);if(p&&p.then&&p.catch){p.catch((e=>{console.warn(e)}))}};const ivm=vm;for(const c of channel){ivm.registerDisposable(ivm.app.subscribe(c,a))}}))}}function BindableReceive(...channel){return(target,key)=>{const bp=BindableProperty(target,key);registerInit(target,(vm=>{const fx=(cx,m)=>{vm[key]=m};const ivm=vm;for(const c of channel){ivm.registerDisposable(ivm.app.subscribe(c,fx))}}));return bp}}function BindableBroadcast(...channel){return(target,key)=>{const bp=BindableProperty(target,key);registerInit(target,(vm=>{const fx=t=>{const v=vm[key];for(const c of channel){vm.app.broadcast(c,v)}};const d=new AtomWatcher(vm,[key.split(".")],fx);d.init();vm.registerDisposable(d)}));return bp}}function Watch(target,key,descriptor){registerInit(target,(vm=>{const ivm=vm;if(descriptor&&descriptor.get){ivm.setupWatch(descriptor.get,(()=>{vm.refresh(key.toString())}));return}ivm.setupWatch(vm[key])}))}function CachedWatch(target,key,descriptor){const getMethod=descriptor.get;descriptor.get=()=>null;registerInit(target,(vm=>{const ivm=vm;const fieldName=`_${key}`;Object.defineProperty(ivm,key,{enumerable:true,configurable:true,get(){const c=ivm[fieldName]||(ivm[fieldName]={value:getMethod.apply(ivm)});return c.value}});ivm.setupWatch(getMethod,(()=>{ivm[fieldName]=null;AtomBinder.refreshValue(ivm,key)}))}))}function Validate(target,key,descriptor){const getMethod=descriptor.get;descriptor.get=()=>null;registerInit(target,(vm=>{const initialized={i:false};const ivm=vm;Object.defineProperty(ivm,key,{enumerable:true,configurable:true,get(){if(vm.mShouldValidate&&initialized.i){return getMethod.apply(this)}return null}});ivm.setupWatch(getMethod,(()=>{initialized.i=true;vm.refresh(key.toString())}),true,key.toString());return}))}_export({waitForReady,Receive,BindableReceive,BindableBroadcast,Watch,CachedWatch,Validate});return{setters:[function(_tslib){__awaiter=_tslib.__awaiter;__decorate=_tslib.__decorate;__metadata=_tslib.__metadata;__param=_tslib.__param},function(_App){App=_App.App},function(_Atom){Atom=_Atom.Atom},function(_coreAtomBinder){AtomBinder=_coreAtomBinder.AtomBinder},function(_coreAtomDisposableList){AtomDisposableList=_coreAtomDisposableList.AtomDisposableList},function(_coreAtomWatcher){AtomWatcher=_coreAtomWatcher.AtomWatcher},function(_coreBindableProperty){BindableProperty=_coreBindableProperty.BindableProperty},function(_diInject){Inject=_diInject.Inject},function(_baseTypes){registerInit=_baseTypes.registerInit}],execute:function(){_export("AtomViewModel",AtomViewModel=class AtomViewModel{get isReady(){return this.pendingInits===null}get errors(){const e=[];if(!this.mShouldValidate){return e}for(const v of this.validations){if(!v.initialized){return e}const error=this[v.name];if(error){e.push({name:v.name,error})}}return e}get parent(){return this.mParent}set parent(v){if(this.mParent&&this.mParent.mChildren){this.mParent.mChildren.remove(this)}this.mParent=v;if(v){const c=v.mChildren||(v.mChildren=[]);c.add(this);this.registerDisposable({dispose:()=>{c.remove(this)}})}}get isValid(){let valid=true;const validateWasFalse=this.mShouldValidate===false;this.mShouldValidate=true;for(const v of this.validations){if(!v.initialized){v.watcher.init(true);v.initialized=true}if(this[v.name]){if(validateWasFalse){AtomBinder.refreshValue(this,v.name)}valid=false}}if(this.mChildren){for(const child of this.mChildren){if(!child.isValid){valid=false}}}AtomBinder.refreshValue(this,"errors");return valid}constructor(app){this.app=app;this.disposables=null;this.validations=[];this.pendingInits=[];this.mShouldValidate=false;this.app.runAsync((()=>privateInit.apply(this)))}resetValidations(resetChildren=true){this.mShouldValidate=false;for(const v of this.validations){this.refresh(v.name)}if(resetChildren&&this.mChildren){for(const iterator of this.mChildren){iterator.resetValidations(resetChildren)}}}runAfterInit(f){if(this.pendingInits){this.pendingInits.push(f);return}f()}refresh(name){AtomBinder.refreshValue(this,name)}init(){return __awaiter(this,void 0,void 0,(function*(){}))}dispose(){if(this.disposables){this.disposables.dispose()}}registerDisposable(d){this.disposables=this.disposables||new AtomDisposableList;return this.disposables.add(d)}onReady(){}setupWatch(ft,proxy,forValidation,name){const d=new AtomWatcher(this,ft,proxy,this);if(forValidation){this.validations=this.validations||[];this.validations.push({name,watcher:d,initialized:false})}else{d.init()}return this.registerDisposable(d)}onPropertyChanged(name){}});_export("AtomViewModel",AtomViewModel=__decorate([__param(0,Inject),__metadata("design:paramtypes",[App])],AtomViewModel))}}}));AmdLoader.instance.setup("@web-atoms/core/dist/view-model/AtomWindowViewModel");System.register(["tslib","../services/NavigationService","./AtomViewModel"],(function(_export,_context){"use strict";var __awaiter,NavigationService,AtomViewModel,AtomWindowViewModel;_export("AtomWindowViewModel",void 0);return{setters:[function(_tslib){__awaiter=_tslib.__awaiter},function(_servicesNavigationService){NavigationService=_servicesNavigationService.NavigationService},function(_AtomViewModel){AtomViewModel=_AtomViewModel.AtomViewModel}],execute:function(){_export("AtomWindowViewModel",AtomWindowViewModel=class AtomWindowViewModel extends AtomViewModel{close(result){this.app.broadcast(`atom-window-close:${this.windowName}`,result)}cancel(){return __awaiter(this,void 0,void 0,(function*(){if(this.closeWarning){const navigationService=this.app.resolve(NavigationService);if(!(yield navigationService.confirm(this.closeWarning,"Are you sure?"))){return false}}this.app.broadcast(`atom-window-cancel:${this.windowName}`,"cancelled");return true}))}})}}}));AmdLoader.instance.setup("@web-atoms/core/dist/web/styles/AtomWindowStyle");System.register(["@web-atoms/core/src/web/images/close-button-hover.svg","../styles/AtomStyle"],(function(_export,_context){"use strict";var closeButtonHover,AtomStyle,AtomWindowStyle;_export("AtomWindowStyle",void 0);return{setters:[function(_webAtomsCoreSrcWebImagesCloseButtonHoverSvg){closeButtonHover=_webAtomsCoreSrcWebImagesCloseButtonHoverSvg.default},function(_stylesAtomStyle){AtomStyle=_stylesAtomStyle.AtomStyle}],execute:function(){_export("AtomWindowStyle",AtomWindowStyle=class AtomWindowStyle extends AtomStyle{get root(){return Object.assign(Object.assign({},this.frameHost),{subclasses:{" .close-button":this.closeButton," .command-bar-presenter":this.commandBarPresenter," .command-bar":this.commandBar," .content-presenter":this.contentPresenter," .content":this.content," .frame":this.frame," .title":this.title," .title-host":this.titleHost," .title-presenter":this.titlePresenter}})}get frameHost(){return{position:"absolute",left:0,right:0,top:0,bottom:0,backgroundColor:"#50505080"}}get frame(){return{position:"absolute",minHeight:"100px",minWidth:"300px",margin:"auto",border:"solid 1px #808080",borderRadius:"5px",backgroundColor:"white"}}get titlePresenter(){return{position:"relative",left:0,right:0,top:0,height:"37px"}}get titleHost(){return{position:"absolute",left:0,right:0,padding:"7px",minHeight:"32px",backgroundColor:"#404040",color:"white",top:0,borderTopRightRadius:"4px",borderTopLeftRadius:"4px"}}get title(){return{margin:"auto"}}get closeButton(){return{position:"absolute",right:"6px",top:"7px",width:"0",height:"0",padding:"9px",border:"none",backgroundColor:"transparent",backgroundImage:closeButtonHover}}get content(){return{}}get contentPresenter(){return{position:"relative",padding:"10px",background:"white"}}get commandBarPresenter(){return{left:0,right:0,bottom:0,padding:"5px",backgroundColor:"#d4d4d4",textAlign:"right",borderBottomRightRadius:"4px",borderBottomLeftRadius:"4px"}}get commandBar(){return{subclasses:{" button":{borderRadius:"3px",marginLeft:"5px",marginRight:"5px",padding:"4px 16px",backgroundColor:"whitesmoke",border:"1px solid gray"}}}}})}}}));AmdLoader.instance.setup("@web-atoms/core/dist/web/styles/AtomAlertWindowStyle");System.register(["../../core/Colors","./AtomWindowStyle"],(function(_export,_context){"use strict";var Colors,AtomWindowStyle,AtomAlertWindowStyle;_export("default",void 0);return{setters:[function(_coreColors){Colors=_coreColors.default},function(_AtomWindowStyle){AtomWindowStyle=_AtomWindowStyle.AtomWindowStyle}],execute:function(){_export("default",AtomAlertWindowStyle=class AtomAlertWindowStyle extends AtomWindowStyle{get titleHost(){return Object.assign(Object.assign({},this.getBaseProperty(AtomAlertWindowStyle,"titleHost")),{color:Colors.black,backgroundColor:Colors.white})}get contentPresenter(){return Object.assign(Object.assign({},this.getBaseProperty(AtomAlertWindowStyle,"contentPresenter")),{padding:"0px 10px 30px 10px",textAlign:"center",color:Colors.rgba(51,51,51)})}get commandBar(){return Object.assign(Object.assign({},this.getBaseProperty(AtomAlertWindowStyle,"commandBar")),{textAlign:"center",subclasses:{" button":this.buttonStyle," .yes-button":{backgroundColor:Colors.rgba(0,128,0)}," .no-button":{backgroundColor:Colors.rgba(255,0,0)}}})}get buttonStyle(){return{border:"none",color:Colors.white,width:"50%",height:"40px"}}})}}}));AmdLoader.instance.setup("@web-atoms/core/dist/web/controls/AtomTemplate");System.register(["./AtomControl"],(function(_export,_context){"use strict";var AtomControl,AtomTemplate;_export("AtomTemplate",void 0);return{setters:[function(_AtomControl){AtomControl=_AtomControl.AtomControl}],execute:function(){_export("AtomTemplate",AtomTemplate=class AtomTemplate extends AtomControl{})}}}));AmdLoader.instance.setup("@web-atoms/core/dist/web/controls/AtomWindow");System.register(["../../App","../../core/Bind","../../core/XNode","../styles/AtomWindowStyle","./AtomControl","./AtomTemplate"],(function(_export,_context){"use strict";var App,Bind,XNode,AtomWindowStyle,AtomControl,AtomTemplate,AtomWindowFrameTemplate,AtomWindowTitleTemplate,AtomWindow;function getTemplateParent(e){const tp=e._templateParent;if(tp){return tp}const p=e._logicalParent||e.parentElement;if(p){return getTemplateParent(p)}}_export({getTemplateParent,AtomWindowFrameTemplate:void 0,AtomWindow:void 0});return{setters:[function(_App){App=_App.App},function(_coreBind){Bind=_coreBind.default},function(_coreXNode){XNode=_coreXNode.default},function(_stylesAtomWindowStyle){AtomWindowStyle=_stylesAtomWindowStyle.AtomWindowStyle},function(_AtomControl){AtomControl=_AtomControl.AtomControl},function(_AtomTemplate){AtomTemplate=_AtomTemplate.AtomTemplate}],execute:function(){_export("AtomWindowFrameTemplate",AtomWindowFrameTemplate=class AtomWindowFrameTemplate extends AtomTemplate{get templateParent(){return getTemplateParent(this.element)}preCreate(){this.titlePresenter=null;this.commandPresenter=null;this.contentPresenter=null;super.preCreate()}create(){this.render(XNode.create("div",{class:"frame",styleWidth:Bind.oneWay((()=>this.templateParent.width||undefined)),styleHeight:Bind.oneWay((()=>this.templateParent.height||undefined)),styleLeft:Bind.oneWay((()=>this.templateParent.x>=0?`${this.templateParent.x}px`:undefined)),styleTop:Bind.oneWay((()=>this.templateParent.y>=0?`${this.templateParent.y}px`:undefined)),styleMarginTop:Bind.oneWay((()=>this.templateParent.x>=0?"0":undefined)),styleMarginLeft:Bind.oneWay((()=>this.templateParent.x>=0?"0":undefined)),styleMarginRight:Bind.oneWay((()=>this.templateParent.x>=0?"0":undefined)),styleMarginBottom:Bind.oneWay((()=>this.templateParent.x>=0?"0":undefined))},XNode.create("div",{class:"title-presenter",presenter:Bind.presenter("titlePresenter")}),XNode.create("div",{class:"content-presenter",presenter:Bind.presenter("contentPresenter")}),XNode.create("div",{class:"command-bar-presenter",presenter:Bind.presenter("commandPresenter")})))}});AtomWindowTitleTemplate=class AtomWindowTitleTemplate extends AtomControl{get templateParent(){return getTemplateParent(this.element)}create(){this.render(XNode.create("div",{class:"title-host"},XNode.create("span",{class:"title",text:Bind.oneWay((()=>this.templateParent.title))}),XNode.create("button",{class:"close-button",eventClick:Bind.event((()=>this.templateParent.close()))})))}};_export("AtomWindow",AtomWindow=class AtomWindow extends AtomControl{constructor(){super(...arguments);this.title="";this.width="";this.height="";this.x=-1;this.y=-1;this.titleTemplate=AtomWindowTitleTemplate;this.frameTemplate=AtomWindowFrameTemplate;this.isReady=false}get templateParent(){return getTemplateParent(this.element)}onPropertyChanged(name){switch(name){case"windowTemplate":case"commandTemplate":case"frameTemplate":this.invalidate();break}}close(){const vm=this.viewModel;if(vm.cancel){this.app.runAsync((()=>vm.cancel()));return}const message=`atom-window-cancel:${this.id}`;const device=this.app.resolve(App);device.broadcast(message,"cancelled")}onUpdateUI(){if(!(this.windowTemplate&&this.frameTemplate)){return}if(this.isReady){return}this.bind(this.element,"title",[["viewModel","title"]]);const frame=new this.frameTemplate(this.app);const fe=frame.element;const titleContent=new this.titleTemplate(this.app);titleContent.element._templateParent=this;frame.titlePresenter.appendChild(titleContent.element);this.setupDragging(frame.titlePresenter);this.element.classList.add("frame-host");fe._logicalParent=this.element;fe._templateParent=this;if(!frame.contentPresenter){throw new Error("ContentPresenter must be set inside frameTemplate before creating window")}const content=new this.windowTemplate(this.app);content.element._templateParent=this;this.setElementClass(content.element,{content:1});frame.contentPresenter.appendChild(content.element);if(this.commandTemplate){if(!frame.commandPresenter){throw new Error("CommandPresenter must be set inside frameTemplate"+"before creating window if command template is present")}const command=new this.commandTemplate(this.app);command.element._templateParent=this;this.setElementClass(command.element,{"command-bar":1});frame.commandPresenter.appendChild(command.element)}this.append(frame);setTimeout((()=>{this.centerFrame(frame.element)}),100);this.isReady=true}preCreate(){this.defaultControlStyle=AtomWindowStyle;this.title=null;this.width="";this.height="";this.x=-1;this.y=-1;this.windowTemplate=null;this.commandTemplate=null;this.titleTemplate=AtomWindowTitleTemplate;this.frameTemplate=AtomWindowFrameTemplate;super.preCreate();this.render(XNode.create("div",{styleClass:Bind.oneTime((()=>this.controlStyle.name))}))}centerFrame(e){if(!this.element){return}const parent=this.element.parentElement;if(parent===window||parent===document.body){return}if(parent.offsetWidth<=0||parent.offsetHeight<=0){setTimeout((()=>{this.centerFrame(e)}),100);return}if(e.offsetWidth<=0||e.offsetHeight<=0){setTimeout((()=>{this.centerFrame(e)}),100);return}const x=(parent.offsetWidth-e.offsetWidth)/2;const y=(parent.offsetHeight-e.offsetHeight)/2;this.x=x;this.y=y;e.style.opacity="1";this.element.style.removeProperty("opacity")}setupDragging(tp){this.bindEvent(tp,"mousedown",(startEvent=>{startEvent.preventDefault();const disposables=[];const offset={x:tp.parentElement.offsetLeft,y:tp.parentElement.offsetTop};const rect={x:startEvent.clientX,y:startEvent.clientY};const cursor=tp.style.cursor;tp.style.cursor="move";disposables.push(this.bindEvent(document.body,"mousemove",(moveEvent=>{const{clientX,clientY}=moveEvent;const dx=clientX-rect.x;const dy=clientY-rect.y;offset.x+=dx;offset.y+=dy;this.x=offset.x;this.y=offset.y;rect.x=clientX;rect.y=clientY})));disposables.push(this.bindEvent(document.body,"mouseup",(endEvent=>{tp.style.cursor=cursor;for(const iterator of disposables){iterator.dispose()}})))}))}});AtomWindow.windowTemplate=XNode.prepare("windowTemplate",true,true);AtomWindow.commandTemplate=XNode.prepare("commandTemplate",true,true);AtomWindow.titleTemplate=XNode.prepare("titleTemplate",true,true);AtomWindow.frameTemplate=XNode.prepare("frameTemplate",true,true)}}}));AmdLoader.instance.setup("@web-atoms/core/dist/web/controls/AtomAlertWindow");System.register(["tslib","../../core/Bind","../../core/BindableProperty","../../core/XNode","../../view-model/AtomWindowViewModel","../styles/AtomAlertWindowStyle","./AtomWindow"],(function(_export,_context){"use strict";var __decorate,__metadata,Bind,BindableProperty,XNode,AtomWindowViewModel,AtomAlertWindowStyle,AtomWindow,AtomAlertWindow,AtomAlertViewModel;_export("default",void 0);return{setters:[function(_tslib){__decorate=_tslib.__decorate;__metadata=_tslib.__metadata},function(_coreBind){Bind=_coreBind.default},function(_coreBindableProperty){BindableProperty=_coreBindableProperty.BindableProperty},function(_coreXNode){XNode=_coreXNode.default},function(_viewModelAtomWindowViewModel){AtomWindowViewModel=_viewModelAtomWindowViewModel.AtomWindowViewModel},function(_stylesAtomAlertWindowStyle){AtomAlertWindowStyle=_stylesAtomAlertWindowStyle.default},function(_AtomWindow){AtomWindow=_AtomWindow.AtomWindow}],execute:function(){_export("default",AtomAlertWindow=class AtomAlertWindow extends AtomWindow{create(){this.defaultControlStyle=AtomAlertWindowStyle;this.viewModel=this.resolve(AtomAlertViewModel);this.render(XNode.create(AtomWindow,{title:Bind.oneWay((()=>this.viewModel.title))},XNode.create(AtomWindow.windowTemplate,null,XNode.create("div",{formattedText:Bind.oneWay((()=>this.viewModel.message))})),XNode.create(AtomWindow.commandTemplate,null,XNode.create("div",null,XNode.create("button",{class:"yes-button",styleDisplay:Bind.oneWay((()=>this.viewModel.okTitle?"":"none")),text:Bind.oneWay((()=>this.viewModel.okTitle)),eventClick:()=>this.viewModel.onOkClicked()}),XNode.create("button",{class:"no-button",styleMarginBottom:Bind.oneWay((()=>this.viewModel.cancelTitle?"0":"10px")),styleDisplay:Bind.oneWay((()=>this.viewModel.cancelTitle?"":"none")),text:Bind.oneWay((()=>this.viewModel.cancelTitle)),eventClick:()=>this.viewModel.onCancelClicked()})))))}});AtomAlertViewModel=class AtomAlertViewModel extends AtomWindowViewModel{onOkClicked(){this.close(true)}onCancelClicked(){this.cancel()}};__decorate([BindableProperty,__metadata("design:type",String)],AtomAlertViewModel.prototype,"title",void 0);__decorate([BindableProperty,__metadata("design:type",String)],AtomAlertViewModel.prototype,"message",void 0);__decorate([BindableProperty,__metadata("design:type",String)],AtomAlertViewModel.prototype,"okTitle",void 0);__decorate([BindableProperty,__metadata("design:type",String)],AtomAlertViewModel.prototype,"cancelTitle",void 0)}}}));AmdLoader.instance.setup("@web-atoms/core/dist/web/styles/AtomNotificationStyle");System.register(["../../core/Colors","./AtomStyle"],(function(_export,_context){"use strict";var Colors,AtomStyle,AtomNotificationStyle;_export("default",void 0);return{setters:[function(_coreColors){Colors=_coreColors.default},function(_AtomStyle){AtomStyle=_AtomStyle.AtomStyle}],execute:function(){_export("default",AtomNotificationStyle=class AtomNotificationStyle extends AtomStyle{get root(){return{padding:"5px",borderRadius:"5px",border:"solid 1px lightgray",fontFamily:"Verdana, Geneva, sans-serif",fontSize:"16px",subclasses:{".error":{borderColor:Colors.red,color:Colors.red},".warning":{backgroundColor:Colors.lightYellow}}}}})}}}));AmdLoader.instance.setup("@web-atoms/core/dist/web/controls/AtomNotification");System.register(["tslib","../../core/Bind","../../core/BindableProperty","../../core/XNode","../styles/AtomNotificationStyle","./AtomControl"],(function(_export,_context){"use strict";var __decorate,__metadata,Bind,BindableProperty,XNode,AtomNotificationStyle,AtomControl,AtomNotification;_export("default",void 0);return{setters:[function(_tslib){__decorate=_tslib.__decorate;__metadata=_tslib.__metadata},function(_coreBind){Bind=_coreBind.default},function(_coreBindableProperty){BindableProperty=_coreBindableProperty.BindableProperty},function(_coreXNode){XNode=_coreXNode.default},function(_stylesAtomNotificationStyle){AtomNotificationStyle=_stylesAtomNotificationStyle.default},function(_AtomControl){AtomControl=_AtomControl.AtomControl}],execute:function(){_export("default",AtomNotification=class AtomNotification extends AtomControl{constructor(){super(...arguments);this.timeout=5e3;this.timeoutKey=null}onPropertyChanged(name){switch(name){case"timeout":this.setupTimeout();break}}create(){this.defaultControlStyle=AtomNotificationStyle;this.render(XNode.create("div",{formattedText:Bind.oneWay((()=>this.viewModel.message)),timeout:Bind.oneWay((()=>this.viewModel.timeout||5e3)),styleClass:Bind.oneWay((()=>({[this.controlStyle.name]:1,error:this.viewModel.type&&/error/i.test(this.viewModel.type),warning:this.viewModel.type&&/warn/i.test(this.viewModel.type)})))}))}setupTimeout(){if(this.timeoutKey){clearTimeout(this.timeoutKey)}this.timeoutKey=setTimeout((()=>{if(this.element){this.app.broadcast(`atom-window-close:${this.id}`,"")}}),this.timeout)}});__decorate([BindableProperty,__metadata("design:type",Number)],AtomNotification.prototype,"timeout",void 0)}}}));AmdLoader.instance.setup("@web-atoms/core/dist/web/styles/AtomPopupStyle");System.register(["../styles/AtomStyle"],(function(_export,_context){"use strict";var AtomStyle,AtomPopupStyle;_export("AtomPopupStyle",void 0);return{setters:[function(_stylesAtomStyle){AtomStyle=_stylesAtomStyle.AtomStyle}],execute:function(){_export("AtomPopupStyle",AtomPopupStyle=class AtomPopupStyle extends AtomStyle{get root(){return{backgroundColor:"white",border:"solid 1px lightgray",padding:"5px",borderRadius:"5px"}}})}}}));AmdLoader.instance.setup("@web-atoms/core/dist/web/services/NotificationPopup");System.register(["../../core/XNode","./PopupService","./NotifcationPopup.global.less"],(function(_export,_context){"use strict";var XNode,PopupWindow,css;function NotificationPopup({message,type}){return class Notification extends PopupWindow{create(){if(message instanceof XNode){this.render(XNode.create("div",{styleClass:{[css]:1,error:/error/i.test(type),warning:/warn/i.test(type)}},message));return}this.render(XNode.create("div",{styleClass:{[css]:1,error:/error/i.test(type),warning:/warn/i.test(type)},formattedText:message}))}}}_export("default",NotificationPopup);return{setters:[function(_coreXNode){XNode=_coreXNode.default},function(_PopupService){PopupWindow=_PopupService.PopupWindow},function(_NotifcationPopupGlobalLess){}],execute:function(){css="web-atoms-notification-popup"}}}));AmdLoader.instance.setup("@web-atoms/core/dist/web/services/WindowService");System.register(["tslib","../../App","../../Atom","../../core/AtomLoader","../../core/AtomUri","../../core/FormattedError","../../core/FormattedString","../../core/types","../../di/Inject","../../di/RegisterSingleton","../../di/ServiceCollection","../../services/JsonService","../../services/NavigationService","../../view-model/AtomWindowViewModel","../../web/core/AtomUI","../controls/AtomAlertWindow","../controls/AtomNotification","../controls/AtomWindow","../styles/AtomPopupStyle","../styles/AtomStyleSheet","../styles/StyleBuilder","./NotificationPopup","./PopupService"],(function(_export,_context){"use strict";var __awaiter,__decorate,__metadata,__param,App,Atom,AtomLoader,AtomUri,FormattedError,FormattedString,CancelToken,Inject,RegisterSingleton,Scope,ServiceCollection,JsonService,NavigationService,AtomWindowViewModel,AtomUI,AtomAlertWindow,AtomNotification,AtomWindow,AtomPopupStyle,AtomStyleSheet,cssNumberToString,NotificationPopup,PopupService,WindowService;return{setters:[function(_tslib){__awaiter=_tslib.__awaiter;__decorate=_tslib.__decorate;__metadata=_tslib.__metadata;__param=_tslib.__param},function(_App){App=_App.App},function(_Atom){Atom=_Atom.Atom},function(_coreAtomLoader){AtomLoader=_coreAtomLoader.AtomLoader},function(_coreAtomUri){AtomUri=_coreAtomUri.AtomUri},function(_coreFormattedError){FormattedError=_coreFormattedError.default},function(_coreFormattedString){FormattedString=_coreFormattedString.default},function(_coreTypes){CancelToken=_coreTypes.CancelToken},function(_diInject){Inject=_diInject.Inject},function(_diRegisterSingleton){RegisterSingleton=_diRegisterSingleton.RegisterSingleton},function(_diServiceCollection){Scope=_diServiceCollection.Scope;ServiceCollection=_diServiceCollection.ServiceCollection},function(_servicesJsonService){JsonService=_servicesJsonService.JsonService},function(_servicesNavigationService){NavigationService=_servicesNavigationService.NavigationService},function(_viewModelAtomWindowViewModel){AtomWindowViewModel=_viewModelAtomWindowViewModel.AtomWindowViewModel},function(_webCoreAtomUI){AtomUI=_webCoreAtomUI.AtomUI},function(_controlsAtomAlertWindow){AtomAlertWindow=_controlsAtomAlertWindow.default},function(_controlsAtomNotification){AtomNotification=_controlsAtomNotification.default},function(_controlsAtomWindow){AtomWindow=_controlsAtomWindow.AtomWindow},function(_stylesAtomPopupStyle){AtomPopupStyle=_stylesAtomPopupStyle.AtomPopupStyle},function(_stylesAtomStyleSheet){AtomStyleSheet=_stylesAtomStyleSheet.AtomStyleSheet},function(_stylesStyleBuilder){cssNumberToString=_stylesStyleBuilder.cssNumberToString},function(_NotificationPopup){NotificationPopup=_NotificationPopup.default},function(_PopupService){PopupService=_PopupService.default}],execute:function(){_export("WindowService",WindowService=class WindowService extends NavigationService{get title(){return window.document.title}set title(v){window.document.title=v}get location(){return new AtomUri(location.href)}set location(v){location.href=v.toString()}constructor(app,jsonService){super(app);this.jsonService=jsonService;this.popups=[];this.hostForElementFunc=[];this.lastPopupID=0;this.screen=app.screen;let st="desktop";if(/mobile|android|ios/i.test(window.navigator.userAgent)){st="mobile";if(/tablet/i.test(window.navigator.userAgent)){st="tablet"}}this.screen.screenType=st;if(window){const update=e=>{this.refreshScreen()};if(st!=="mobile"){window.addEventListener("resize",update);window.addEventListener("scroll",update);document.body.addEventListener("scroll",update);document.body.addEventListener("resize",update)}setTimeout((()=>{update(null)}),1e3)}}registerHostForWindow(f){this.hostForElementFunc.push(f);return{dispose:()=>{this.hostForElementFunc.remove(f)}}}navigate(url){location.href=url}back(){window.history.back()}register(id,type){ServiceCollection.instance.register(type,null,Scope.Transient,id)}confirm(message,title){return PopupService.confirm({message,title})}alert(message,title){if(!(message instanceof FormattedString||typeof message==="string")){if(message instanceof FormattedError){message=message.formattedMessage}else{message=message.message?message.message:message.toString()}}return PopupService.alert({message,title})}refresh(){location.reload()}getHostForElement(){const ce=PopupService.lastTarget;if(!ce){return null}for(const iterator of this.hostForElementFunc){const e=iterator(ce);if(e){return e}}return null}refreshScreen(){const height=this.screen.height=window.innerHeight||document.body.clientHeight;const width=this.screen.width=window.innerWidth||document.body.clientWidth;this.screen.scrollLeft=window.scrollX||document.body.scrollLeft||0;this.screen.scrollTop=window.scrollY||document.body.scrollTop||0;this.screen.orientation=width>height?"landscape":"portrait"}notify(message,title,type,delay){return __awaiter(this,void 0,void 0,(function*(){try{const notification=NotificationPopup({message,type});const cancelToken=new CancelToken(delay!==null&&delay!==void 0?delay:5e3);yield notification.showWindow(notification,{title,cancelToken})}catch(ex){console.error(ex)}}))}openWindow(url,options){return __awaiter(this,void 0,void 0,(function*(){yield Atom.delay(1);const lastTarget=PopupService.lastTarget;const{view:popup,returnPromise,disposables}=yield AtomLoader.loadView(url,this.app,true,(()=>this.app.resolve(AtomWindowViewModel,true)));if(options&&options.onInit){options.onInit(popup)}const cancelToken=options.cancelToken;if(cancelToken){if(cancelToken.cancelled){this.app.callLater((()=>{this.remove(popup,true)}))}cancelToken.registerForCancel((()=>{this.remove(popup,true)}))}const e=popup.element;let isPopup=true;if(popup instanceof AtomWindow){isPopup=false;e.style.opacity="0"}popup.registerDisposable({dispose:()=>{PopupService.lastTarget=lastTarget}});if(isPopup){const root=popup.element;const last=PopupService.lastTarget;const closePopup=et=>{let target=et.target;while(target){if(target===root||target===last){return}target=target.parentElement}this.remove(popup,true)};document.body.addEventListener("click",closePopup);popup.registerDisposable({dispose:()=>{document.body.removeEventListener("click",closePopup)}})}e._logicalParent=lastTarget;e.sourceUrl=url;const pvm=popup.viewModel;if(pvm){let ce=PopupService.lastTarget;if(ce){while(!ce.atomControl){ce=ce.parentElement;if(!ce){break}}if(ce&&ce.atomControl&&ce.atomControl.viewModel){pvm.parent=ce.atomControl.viewModel}}}const theme=this.app.get(AtomStyleSheet).getNamedStyle(AtomPopupStyle);e.style.zIndex=1e4+this.lastPopupID+"";const isNotification=popup instanceof AtomNotification;if(isPopup){const sr=AtomUI.screenOffset(PopupService.lastTarget);const x=sr.x;const y=sr.y;const h=sr.height;e.style.position="absolute";e.style.left=x+"px";e.style.top=y+h+"px";e.classList.add(theme.name);this.popups.push(popup);disposables.add((()=>{this.popups.remove(popup)}));document.body.appendChild(e);if(isNotification){e.style.opacity="0";this.centerElement(popup)}}else{const eHost=(options===null||options===void 0?void 0:options.modal)?null:this.getHostForElement();if(eHost){eHost.appendChild(e)}else{const host=document.createElement("div");document.body.appendChild(host);host.style.position="absolute";host.appendChild(e);disposables.add({dispose(){host.remove()}});this.refreshScreen();popup.bind(host,"styleLeft",[["this","scrollLeft"]],false,cssNumberToString,this.screen);popup.bind(host,"styleTop",[["this","scrollTop"]],false,cssNumberToString,this.screen);popup.bind(host,"styleWidth",[["this","width"]],false,cssNumberToString,this.screen);popup.bind(host,"styleHeight",[["this","height"]],false,cssNumberToString,this.screen)}}popup.bindEvent(document.body,"keyup",(keyboardEvent=>{if(keyboardEvent.key==="Escape"){this.app.runAsync((()=>this.remove(popup)))}}));disposables.add({dispose:()=>{e.innerHTML="";e.remove()}});return yield returnPromise}))}centerElement(c){const e=c.element;const parent=e.parentElement;if(parent===window||parent===document.body){setTimeout((()=>{const ew=(document.body.offsetWidth-e.offsetWidth)/2;const eh=window.scrollY+(window.innerHeight-e.offsetHeight)/2;e.style.left=`${ew}px`;e.style.top=`${eh}px`;e.style.removeProperty("opacity")}),200);return}if(parent.offsetWidth<=0||parent.offsetHeight<=0){setTimeout((()=>{this.centerElement(c)}),100);return}if(e.offsetWidth<=0||e.offsetHeight<=0){setTimeout((()=>{this.centerElement(c)}),100);return}const x=(parent.offsetWidth-e.offsetWidth)/2;const y=(parent.offsetHeight-e.offsetHeight)/2;e.style.left=`${x}px`;e.style.top=`${y}px`;e.style.removeProperty("opacity")}});WindowService.alertWindow=AtomAlertWindow;_export("WindowService",WindowService=__decorate([RegisterSingleton,__param(0,Inject),__param(1,Inject),__metadata("design:paramtypes",[App,JsonService])],WindowService))}}}));AmdLoader.instance.setup("@web-atoms/core/dist/web/styles/AtomTheme");System.register(["tslib","../../App","../../core/Colors","../../di/Inject","../../di/RegisterSingleton","../../services/NavigationService","../styles/AtomStyleSheet"],(function(_export,_context){"use strict";var __decorate,__metadata,__param,App,Colors,Inject,RegisterSingleton,NavigationService,AtomStyleSheet,AtomTheme;return{setters:[function(_tslib){__decorate=_tslib.__decorate;__metadata=_tslib.__metadata;__param=_tslib.__param},function(_App){App=_App.App},function(_coreColors){Colors=_coreColors.default},function(_diInject){Inject=_diInject.Inject},function(_diRegisterSingleton){RegisterSingleton=_diRegisterSingleton.RegisterSingleton},function(_servicesNavigationService){NavigationService=_servicesNavigationService.NavigationService},function(_stylesAtomStyleSheet){AtomStyleSheet=_stylesAtomStyleSheet.AtomStyleSheet}],execute:function(){_export("AtomTheme",AtomTheme=class AtomTheme extends AtomStyleSheet{constructor(app,navigationService){super(app,"atom-theme");this.navigationService=navigationService;this.bgColor=Colors.white;this.color=Colors.gray;this.hoverColor=Colors.lightGray;this.activeColor=Colors.lightBlue;this.selectedBgColor=Colors.blue;this.selectedColor=Colors.white;this.padding=5;setTimeout((()=>{window.addEventListener("resize",(()=>{setTimeout((()=>{this.pushUpdate()}),10)}));document.body.addEventListener("resize",(()=>{setTimeout((()=>{this.pushUpdate()}),10)}))}),1e3)}});_export("AtomTheme",AtomTheme=__decorate([RegisterSingleton,__param(0,Inject),__param(1,Inject),__metadata("design:paramtypes",[App,NavigationService])],AtomTheme))}}}));AmdLoader.instance.setup("@web-atoms/core/dist/web/WebApp");System.register(["../App","../core/AtomOnce","../core/AtomUri","../di/ServiceCollection","../services/BusyIndicatorService","../services/NavigationService","./services/WebBusyIndicatorService","./services/WindowService","./styles/AtomStyleSheet","./styles/AtomTheme"],(function(_export,_context){"use strict";var App,AtomOnce,AtomUri,ServiceCollection,BusyIndicatorService,NavigationService,WebBusyIndicatorService,WindowService,AtomStyleSheet,AtomTheme,WebApp;_export("default",void 0);return{setters:[function(_App){App=_App.App},function(_coreAtomOnce){AtomOnce=_coreAtomOnce.AtomOnce},function(_coreAtomUri){AtomUri=_coreAtomUri.AtomUri},function(_diServiceCollection){ServiceCollection=_diServiceCollection.ServiceCollection},function(_servicesBusyIndicatorService){BusyIndicatorService=_servicesBusyIndicatorService.BusyIndicatorService},function(_servicesNavigationService){NavigationService=_servicesNavigationService.NavigationService},function(_servicesWebBusyIndicatorService){WebBusyIndicatorService=_servicesWebBusyIndicatorService.WebBusyIndicatorService},function(_servicesWindowService){WindowService=_servicesWindowService.WindowService},function(_stylesAtomStyleSheet){AtomStyleSheet=_stylesAtomStyleSheet.AtomStyleSheet},function(_stylesAtomTheme){AtomTheme=_stylesAtomTheme.AtomTheme}],execute:function(){_export("default",WebApp=class WebApp extends App{get parentElement(){return document.body}get root(){return this.mRoot}set root(v){const old=this.mRoot;if(old){old.dispose()}this.mRoot=v;if(!v){return}const pe=this.parentElement;const de=Array.from(pe.children);for(const iterator of de){iterator.remove()}pe.appendChild(v.element)}get theme(){return this.get(AtomStyleSheet)}set theme(v){this.put(AtomTheme,v);this.put(AtomStyleSheet,v)}get contextId(){var _a;(_a=this.mContextId)!==null&&_a!==void 0?_a:this.mContextId=parseInt((this.url.hash.contextId||"0").toString(),10);if(!this.mContextId){for(let index=0;index<100;index++){const cid=`contextId${index}`;const cidData=sessionStorage.getItem(`contextId${index}`);if(!cidData){this.mContextId=index;sessionStorage.setItem(cid,cid);this.url.hash.contextId=index;this.syncUrl();break}}}return`contextId_${this.mContextId}`}constructor(){super();this.hashUpdater=new AtomOnce;this.url=new AtomUri(location.href);this.put(NavigationService,this.resolve(WindowService));this.put(WebApp,this);this.put(BusyIndicatorService,this.resolve(WebBusyIndicatorService));ServiceCollection.instance.registerSingleton(AtomStyleSheet,(sp=>sp.resolve(AtomTheme)));window.addEventListener("hashchange",(()=>{this.hashUpdater.run((()=>{this.url=new AtomUri(location.href)}))}));this.initPromise=new Promise(((resolve,reject)=>{this.onReady(resolve)}))}updateDefaultStyle(textContent){if(this.styleElement){if(this.styleElement.textContent===textContent){return}}const ss=document.createElement("style");ss.textContent=textContent;if(this.styleElement){this.styleElement.remove()}document.head.appendChild(ss);this.styleElement=ss}syncUrl(){this.hashUpdater.run((()=>{const currentUrl=new AtomUri(location.href);const sourceHash=this.url.hash;const keyValues=[];let modified=false;for(const key in sourceHash){if(/^\_\$\_/.test(key)){continue}if(sourceHash.hasOwnProperty(key)){const element=sourceHash[key];const cv=currentUrl.hash[key];if(element!==undefined){keyValues.push({key,value:element})}if(cv===element){continue}modified=true}}if(!modified){return}const hash=keyValues.map((s=>`${s.key}=${encodeURIComponent(s.value)}`)).join("&");location.hash=hash}))}invokeReady(){if(document.readyState==="complete"){super.invokeReady();return}document.addEventListener("readystatechange",(e=>{super.invokeReady()}))}});(function(){if(typeof window.CustomEvent==="function"){return false}function CustomEvent(event,params){params=params||{bubbles:false,cancelable:false,detail:null};const evt=document.createEvent("CustomEvent");evt.initCustomEvent(event,params.bubbles,params.cancelable,params.detail);return evt}window.CustomEvent=CustomEvent})()}}}));window.installStyleSheet(new URL("./DownloadZip.pack.global.less.css",document.currentScript.src).toString());window.installStyleSheet(new URL("./DownloadZip.pack.local.less.css",document.currentScript.src).toString());
|
|
8
8
|
//# sourceMappingURL=DownloadZip.pack.min.js.map
|
|
@@ -26572,7 +26572,7 @@ System.register(["tslib", "@web-atoms/web-controls/dist/desktop-app/MobileDeskto
|
|
|
26572
26572
|
};
|
|
26573
26573
|
});
|
|
26574
26574
|
//# sourceMappingURL=StoreApp.js.map
|
|
26575
|
-
window.installStyleSheet("./StoreApp.pack.global.less.css");
|
|
26576
|
-
window.installStyleSheet("./StoreApp.pack.local.less.css");
|
|
26575
|
+
window.installStyleSheet( new URL("./StoreApp.pack.global.less.css", document.currentScript.src).toString());
|
|
26576
|
+
window.installStyleSheet( new URL("./StoreApp.pack.local.less.css", document.currentScript.src).toString());
|
|
26577
26577
|
//# sourceMappingURL=StoreApp.pack.js.map
|
|
26578
26578
|
|