From e2cbed430bfef80c9377a7100ea5f7cc3610efb3 Mon Sep 17 00:00:00 2001 From: ipuppet Date: Wed, 19 Oct 2022 12:28:44 +0800 Subject: [PATCH 1/3] update --- scripts/libs/easy-jsbox.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/libs/easy-jsbox.js b/scripts/libs/easy-jsbox.js index a90fb5a..56ef4d7 100644 --- a/scripts/libs/easy-jsbox.js +++ b/scripts/libs/easy-jsbox.js @@ -1 +1 @@ -var $parcel$global="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},$parcel$modules={},$parcel$inits={},parcelRequire=$parcel$global.parcelRequire94c2;null==parcelRequire&&(parcelRequire=function(e){if(e in $parcel$modules)return $parcel$modules[e].exports;if(e in $parcel$inits){var t=$parcel$inits[e];delete $parcel$inits[e];var i={id:e,exports:{}};return $parcel$modules[e]=i,t.call(i.exports,i,i.exports),i.exports}var a=new Error("Cannot find module '"+e+"'");throw a.code="MODULE_NOT_FOUND",a},parcelRequire.register=function(e,t){$parcel$inits[e]=t},$parcel$global.parcelRequire94c2=parcelRequire),parcelRequire.register("45Ip7",(function(e,t){class i{static#e=$objc("UIApplication").$sharedApplication();static align={left:0,right:1,top:2,bottom:3};static textColor=$color("primaryText");static linkColor=$color("systemLink");static primaryViewBackgroundColor=$color("primarySurface");static scrollViewBackgroundColor=$color("insetGroupedBackground");static scrollViewList=["list","matrix"];static isLargeScreen=$device.isIpad||$device.isIpadPro;static get windowSize(){return $objc("UIWindow").$keyWindow().jsValue().size}static NavigationBarNormalHeight=$objc("UINavigationController").invoke("alloc.init").$navigationBar().jsValue().frame.height;static NavigationBarLargeTitleHeight=$objc("UITabBarController").invoke("alloc.init").$tabBar().jsValue().frame.height+i.NavigationBarNormalHeight;static get isSplitScreenMode(){return i.isLargeScreen&&$device.info.screen.width!==i.windowSize.width}static get topSafeAreaInsets(){return i.#e?.$keyWindow()?.$safeAreaInsets()?.top??0}static get bottomSafeAreaInsets(){return i.#e?.$keyWindow()?.$safeAreaInsets()?.bottom??0}static get statusBarOrientation(){return i.#e.$statusBarOrientation()}static get consoleBarHeight(){if($app.isDebugging){let e=i.#e.$statusBarFrame().height+26;return $device.isIphoneX&&(e+=30),e}return 0}static get isHorizontal(){return 3===i.statusBarOrientation||4===i.statusBarOrientation}static loading(){const e=$ui.create(i.blurBox({cornerRadius:15},[{type:"spinner",props:{loading:!0,style:0},layout:(e,t)=>{e.size.equalTo(t.prev),e.center.equalTo(t.super)}}]));return{start:()=>{$ui.controller.view.insertAtIndex(e,0),e.layout(((e,t)=>{e.center.equalTo(t.super);const a=Math.min(.6*i.windowSize.width,300);e.size.equalTo($size(a,a))})),e.moveToFront()},end:()=>{e.remove()}}}static defaultBackgroundColor(e){return i.scrollViewList.indexOf(e)>-1?i.scrollViewBackgroundColor:i.primaryViewBackgroundColor}static separatorLine(e={},t=i.align.bottom){return{type:"canvas",props:e,layout:(e,a)=>{void 0===a.prev?e.top.equalTo(a.super):t===i.align.bottom?e.top.equalTo(a.prev.bottom):e.top.equalTo(a.prev.top),e.height.equalTo(1/$device.info.screen.scale),e.left.right.inset(0)},events:{draw:(t,i)=>{i.strokeColor=e.bgcolor??$color("separatorColor"),i.setLineWidth(1),i.moveToPoint(0,0),i.addLineToPoint(t.frame.width,0),i.strokePath()}}}}static blurBox(e={},t=[],i=$layout.fill){return{type:"blur",props:Object.assign({style:$blurStyle.thinMaterial},e),views:t,layout:i}}static getContentSize(e,t="A"){return $text.sizeThatFits({text:t,width:i.windowSize.width,font:e})}static push({views:e,statusBarStyle:t=0,title:i="",navButtons:a=[{title:""}],bgcolor:r=e[0]?.props?.bgcolor??"primarySurface",disappeared:s}={}){$ui.push({props:{statusBarStyle:t,navButtons:a,title:i,bgcolor:"string"==typeof r?$color(r):r},events:{disappeared:()=>{void 0!==s&&s()}},views:[{type:"view",views:e,layout:(e,t)=>{e.top.equalTo(t.super.safeArea),e.bottom.equalTo(t.super),e.left.right.equalTo(t.super.safeArea)}}]})}}e.exports={UIKit:i}})),parcelRequire.register("7D8Kb",(function(module,exports){var $fYz8N=parcelRequire("fYz8N"),$58e2f5443faff7c0$require$Controller=$fYz8N.Controller,$8aDdQ=parcelRequire("8aDdQ"),$58e2f5443faff7c0$require$FileStorageFileNotFoundError=$8aDdQ.FileStorageFileNotFoundError,$58e2f5443faff7c0$require$FileStorage=$8aDdQ.FileStorage,$cgaQ6=parcelRequire("cgaQ6"),$58e2f5443faff7c0$require$Kernel=$cgaQ6.Kernel,$45Ip7=parcelRequire("45Ip7"),$58e2f5443faff7c0$require$UIKit=$45Ip7.UIKit,$aXWmO=parcelRequire("aXWmO"),$58e2f5443faff7c0$require$Sheet=$aXWmO.Sheet,$12xzj=parcelRequire("12xzj"),$58e2f5443faff7c0$require$NavigationView=$12xzj.NavigationView,$dcStC=parcelRequire("dcStC"),$58e2f5443faff7c0$require$NavigationBar=$dcStC.NavigationBar,$gMc1q=parcelRequire("gMc1q"),$58e2f5443faff7c0$require$ViewController=$gMc1q.ViewController;class SettingLoadConfigError extends Error{constructor(){super("Call loadConfig() first."),this.name="SettingLoadConfigError"}}class SettingReadonlyError extends Error{constructor(){super("Attempted to assign to readonly property."),this.name="SettingReadonlyError"}}class Setting extends $58e2f5443faff7c0$require$Controller{name;setting={};userData;fileStorage;imagePath;viewController=new $58e2f5443faff7c0$require$ViewController;method={readme:()=>{const e=(()=>{const e=$device.info?.language?.startsWith("zh")?"README_CN.md":"README.md";try{return __README__[e]??__README__["README.md"]}catch{return $file.read(e)?.string??$file.read("README.md")?.string}})();(new $58e2f5443faff7c0$require$Sheet).setView({type:"markdown",props:{content:e},layout:(e,t)=>{e.size.equalTo(t.super)}}).init().present()}};rowHeight=50;edgeOffset=10;iconSize=30;#t={};#i=!1;#a=!1;#r;constructor(e={}){super(),"function"==typeof e.set&&"function"==typeof e.get?(this.set=e.set,this.get=e.get,this.userData=e.userData):(this.fileStorage=e.fileStorage??new $58e2f5443faff7c0$require$FileStorage,this.dataFile=e.dataFile??"setting.json"),e.structure?this.setStructure(e.structure):this.setStructurePath(e.structurePath??"setting.json"),this.isUseJsboxNav=e.isUseJsboxNav??!1,this.imagePath=(e.name??"default")+".image",this.setName(e.name??$text.uuid),this.loadL10n()}useJsboxNav(){return this.isUseJsboxNav=!0,this}#s(){if(!this.#a)throw new SettingLoadConfigError}loadConfig(){const e=["script","info"],t=this.userData??this.fileStorage.readAsJSON("",this.dataFile,{});return this.setting=function i(a){const r={};for(let s of a)for(let a of s.items)if("child"===a.type){const e=i(a.children);Object.assign(r,e)}else-1===e.indexOf(a.type)?r[a.key]=a.key in t?t[a.key]:a.value:r[a.key]=a.value;return r}(this.structure),this.#a=!0,this}hasSectionTitle(e){return this.#s(),!!e[0].title}loadL10n(){$58e2f5443faff7c0$require$Kernel.l10n("zh-Hans",'\n "OK" = "好";\n "DONE" = "完成";\n "CANCEL" = "取消";\n "CLEAR" = "清除";\n "BACK" = "返回";\n "ERROR" = "发生错误";\n "SUCCESS" = "成功";\n "LOADING" = "加载中";\n "INVALID_VALUE" = "非法参数";\n "CONFIRM_CHANGES" = "数据已变化,确认修改?";\n \n "SETTING" = "设置";\n "GENERAL" = "一般";\n "ADVANCED" = "高级";\n "TIPS" = "小贴士";\n "COLOR" = "颜色";\n "COPY" = "复制";\n "COPIED" = "复制成功";\n \n "JSBOX_ICON" = "JSBox 内置图标";\n "SF_SYMBOLS" = "SF Symbols";\n "IMAGE_BASE64" = "图片 / base64";\n\n "PREVIEW" = "预览";\n "SELECT_IMAGE" = "选择图片";\n "CLEAR_IMAGE" = "清除图片";\n "NO_IMAGE" = "无图片";\n \n "ABOUT" = "关于";\n "VERSION" = "Version";\n "AUTHOR" = "作者";\n "AT_BOTTOM" = "已经到底啦~";\n ',!1),$58e2f5443faff7c0$require$Kernel.l10n("en",'\n "OK" = "OK";\n "DONE" = "Done";\n "CANCEL" = "Cancel";\n "CLEAR" = "Clear";\n "BACK" = "Back";\n "ERROR" = "Error";\n "SUCCESS" = "Success";\n "LOADING" = "Loading";\n "INVALID_VALUE" = "Invalid value";\n "CONFIRM_CHANGES" = "The data has changed, confirm the modification?";\n\n "SETTING" = "Setting";\n "GENERAL" = "General";\n "ADVANCED" = "Advanced";\n "TIPS" = "Tips";\n "COLOR" = "Color";\n "COPY" = "Copy";\n "COPIED" = "Copide";\n\n "JSBOX_ICON" = "JSBox in app icon";\n "SF_SYMBOLS" = "SF Symbols";\n "IMAGE_BASE64" = "Image / base64";\n\n "PREVIEW" = "Preview";\n "SELECT_IMAGE" = "Select Image";\n "CLEAR_IMAGE" = "Clear Image";\n "NO_IMAGE" = "No Image";\n\n "ABOUT" = "About";\n "VERSION" = "Version";\n "AUTHOR" = "Author";\n "AT_BOTTOM" = "It\'s the end~";\n ',!1)}setUserData(e){this.userData=e}setStructure(e){return this.structure=e,this}setStructurePath(e){return this.structure||this.setStructure($58e2f5443faff7c0$require$FileStorage.readFromRootAsJSON(e)),this}setName(e){return this.name=e,this}setFooter(e){return this.#r=e,this}set footer(e){this.#r=e}get footer(){if(void 0===this.#r){let e=$58e2f5443faff7c0$require$FileStorage.readFromRootAsJSON("config.json",{}).info??{};if(!e.version||!e.author)try{e=__INFO__}catch{}this.#r={},e.version&&e.author&&(this.#r={type:"view",props:{height:70},views:[{type:"label",props:{font:$font(14),text:`${$l10n("VERSION")} ${e.version} ♥ ${e.author}`,textColor:$color({light:"#C0C0C0",dark:"#545454"}),align:$align.center},layout:e=>{e.left.right.inset(0),e.top.inset(10)}}]})}return this.#r}setReadonly(){return this.#i=!0,this}set(e,t){if(this.#i)throw new SettingReadonlyError;return this.#s(),this.setting[e]=t,this.fileStorage.write("",this.dataFile,$data({string:JSON.stringify(this.setting)})),this.callEvent("onSet",e,t),!0}get(e,t=null){return this.#s(),Object.prototype.hasOwnProperty.call(this.setting,e)?this.setting[e]:t}getColor(e){return"string"==typeof e?$color(e):$rgba(e.red,e.green,e.blue,e.alpha)}getImageName(e,t=!1){let i=$text.MD5(e)+".jpg";return t&&(i="compress."+i),i}getImage(e,t=!1){try{const i=this.getImageName(e,t);return this.fileStorage.read(this.imagePath,i).image}catch(e){if(e instanceof $58e2f5443faff7c0$require$FileStorageFileNotFoundError)return null;throw e}}getId(e){return`setting-${this.name}-${e}`}#o(e){$(e).bgcolor=$color("systemFill")}#n(e,t=.3){0===t?$(e).bgcolor=$color("clear"):$ui.animate({duration:t,animation:()=>{$(e).bgcolor=$color("clear")}})}#l(e,t,i=!1,a=0){if(t=Object.assign(t,{touchesBegan:()=>{this.#o(e),this.#t[e]=$delay(1,(()=>this.#n(e,0)))},touchesMoved:()=>{this.#t[e]?.cancel(),this.#n(e,0)}}),i){const i=t.tapped;t.tapped=()=>{this.#o(e),setTimeout((()=>this.#n(e)),1e3*a),"function"==typeof i&&i()}}return t}createLineLabel(e,t){return t[1]||(t[1]="#00CC00"),"object"!=typeof t[1]&&(t[1]=[t[1],t[1]]),"object"!=typeof t[0]&&(t[0]=[t[0],t[0]]),{type:"view",views:[{type:"view",props:{bgcolor:$color(t[1][0],t[1][1]),cornerRadius:5,smoothCorners:!0},views:[{type:"image",props:{tintColor:$color("white"),image:$image(t[0][0],t[0][1])},layout:(e,t)=>{e.center.equalTo(t.super),e.size.equalTo(20)}}],layout:(e,t)=>{e.centerY.equalTo(t.super),e.size.equalTo(this.iconSize),e.left.inset(this.edgeOffset)}},{type:"label",props:{text:e,lines:1,textColor:this.textColor,align:$align.left},layout:(e,t)=>{e.centerY.equalTo(t.super),e.height.equalTo(t.super),e.left.equalTo(t.prev.right).offset(this.edgeOffset),e.width.greaterThanOrEqualTo(10)}}],layout:(e,t)=>{e.height.centerY.equalTo(t.super),e.left.inset(0)}}}createInfo(e,t,i){const a=Array.isArray(i),r=a?i[0]:i,s=a?i[1]:i;return{type:"view",props:{selectable:!0},views:[this.createLineLabel(t,e),{type:"label",props:{text:r,align:$align.right,textColor:$color("darkGray")},layout:(e,t)=>{e.centerY.equalTo(t.prev),e.right.inset(this.edgeOffset),e.width.equalTo(180)}},{type:"view",events:{tapped:()=>{$ui.alert({title:t,message:s,actions:[{title:$l10n("COPY"),handler:()=>{$clipboard.text=s,$ui.toast($l10n("COPIED"))}},{title:$l10n("OK")}]})}},layout:(e,t)=>{e.right.inset(0),e.size.equalTo(t.super)}}],layout:$layout.fill}}createSwitch(e,t,i){return{type:"view",props:{id:this.getId(e),selectable:!0},views:[this.createLineLabel(i,t),{type:"switch",props:{on:this.get(e),onColor:$color("#00CC00")},events:{changed:t=>{try{this.set(e,t.on)}catch(e){throw t.on=!t.on,e}}},layout:(e,t)=>{e.centerY.equalTo(t.prev),e.right.inset(this.edgeOffset)}}],layout:$layout.fill}}createString(e,t,i){return{type:"view",props:{id:this.getId(e),selectable:!0},views:[this.createLineLabel(i,t),{type:"button",props:{symbol:"square.and.pencil",bgcolor:$color("clear"),tintColor:$color("primaryText")},events:{tapped:t=>{const i=$ui.popover({sourceView:t,sourceRect:t.bounds,directions:$popoverDirection.down,size:$size(320,150),views:[{type:"text",props:{id:`${this.name}-string-${e}`,align:$align.left,text:this.get(e)},layout:e=>{e.left.right.inset(10),e.top.inset(20),e.height.equalTo(90)}},{type:"button",props:{symbol:"checkmark",bgcolor:$color("clear"),titleEdgeInsets:10,contentEdgeInsets:0},layout:e=>{e.right.inset(10),e.bottom.inset(25),e.size.equalTo(30)},events:{tapped:()=>{this.set(e,$(`${this.name}-string-${e}`).text),i.dismiss()}}}]})}},layout:(e,t)=>{e.centerY.equalTo(t.prev),e.right.inset(0),e.size.equalTo(50)}}],layout:$layout.fill}}createStepper(e,t,i,a,r){const s=this.getId(e),o=`${s}-label`;return{type:"view",props:{id:s,selectable:!0},views:[this.createLineLabel(i,t),{type:"label",props:{id:o,text:this.get(e),textColor:this.textColor,align:$align.left},layout:(e,t)=>{e.height.equalTo(t.super),e.right.inset(120)}},{type:"stepper",props:{min:a,max:r,value:this.get(e)},events:{changed:t=>{$(o).text=t.value;try{this.set(e,t.value)}catch(t){throw $(o).text=this.get(e),t}}},layout:(e,t)=>{e.centerY.equalTo(t.prev),e.right.inset(this.edgeOffset)}}],layout:$layout.fill}}createScript(key,icon,title,script){const id=this.getId(key),buttonId=`${id}-button`,actionStart=()=>{$(buttonId).alpha=0,$(`${buttonId}-spinner`).alpha=1,this.#o(id)},actionCancel=()=>{$(buttonId).alpha=1,$(`${buttonId}-spinner`).alpha=0,this.#n(id)},actionDone=(e=!0,t=$l10n("ERROR"))=>{$(`${buttonId}-spinner`).alpha=0,this.#n(id);const i=$(buttonId);if(!e)return $ui.toast(t),void(i.alpha=1);i.symbol="checkmark",$ui.animate({duration:.6,animation:()=>{i.alpha=1},completion:()=>{setTimeout((()=>{$ui.animate({duration:.4,animation:()=>{i.alpha=0},completion:()=>{i.symbol="chevron.right",$ui.animate({duration:.4,animation:()=>{i.alpha=1},completion:()=>{i.alpha=1}})}})}),600)}})};return{type:"view",props:{id:id},views:[this.createLineLabel(title,icon),{type:"view",views:[{type:"image",props:{id:buttonId,symbol:"chevron.right",tintColor:$color("secondaryText")},layout:(e,t)=>{e.centerY.equalTo(t.super),e.right.inset(0),e.size.equalTo(15)}},{type:"spinner",props:{id:`${buttonId}-spinner`,loading:!0,alpha:0},layout:(e,t)=>{e.size.equalTo(t.prev),e.left.top.equalTo(t.prev)}}],layout:(e,t)=>{e.right.inset(this.edgeOffset),e.height.equalTo(this.rowHeight),e.width.equalTo(t.super)}}],events:this.#l(id,{tapped:()=>{const animate={actionStart:actionStart,actionCancel:actionCancel,actionDone:actionDone,touchHighlightStart:()=>this.#o(id),touchHighlightEnd:()=>this.#n(id)};"function"==typeof script?script(animate):script.startsWith("this")?eval(`(()=>{return ${script}(animate)})()`):eval(script)}}),layout:$layout.fill}}createTab(key,icon,title,items,values){"string"==typeof items?items=eval(`(()=>{return ${items}()})()`):"function"==typeof items&&(items=items()),"string"==typeof values?values=eval(`(()=>{return ${values}()})()`):"function"==typeof values&&(values=values());const id=this.getId(key),isCustomizeValues=items?.length>0&&values?.length===items?.length;return{type:"view",props:{id:id,selectable:!0},views:[this.createLineLabel(title,icon),{type:"tab",props:{items:items??[],index:isCustomizeValues?values.indexOf(this.get(key)):this.get(key),dynamicWidth:!0},layout:(e,t)=>{e.right.inset(this.edgeOffset),e.centerY.equalTo(t.prev)},events:{changed:e=>{isCustomizeValues?this.set(key,values[e.index]):this.set(key,e.index)}}}],layout:$layout.fill}}createMenu(key,icon,title,items,values){const id=this.getId(key),labelId=`${id}-label`,getItems=()=>{let res;return res="string"==typeof items?eval(`(()=>{return ${items}()})()`):"function"==typeof items?items():items??[],res},getValues=()=>{let res;return res="string"==typeof values?eval(`(()=>{return ${values}()})()`):"function"==typeof values?values():values,res},tmpItems=getItems(),tmpValues=getValues(),isCustomizeValues=tmpItems?.length>0&&tmpValues?.length===tmpItems?.length;return{type:"view",props:{id:id,selectable:!0},views:[this.createLineLabel(title,icon),{type:"view",views:[{type:"label",props:{text:isCustomizeValues?tmpItems[tmpValues.indexOf(this.get(key))]:tmpItems[this.get(key)],color:$color("secondaryText"),id:labelId},layout:(e,t)=>{e.right.inset(0),e.height.equalTo(t.super)}}],layout:(e,t)=>{e.right.inset(this.edgeOffset),e.height.equalTo(this.rowHeight),e.width.equalTo(t.super)}}],events:{tapped:()=>{const e=getItems(),t=getValues();$ui.menu({items:e,handler:(e,i)=>{isCustomizeValues?this.set(key,t[i]):this.set(key,i),$(labelId).text=$l10n(e)}})}},layout:$layout.fill}}createColor(e,t,i){const a=this.getId(e),r=`${a}-color`;return{type:"view",props:{id:a,selectable:!0},views:[this.createLineLabel(i,t),{type:"view",views:[{type:"view",props:{id:r,bgcolor:this.getColor(this.get(e)),circular:!0,borderWidth:1,borderColor:$color("#e3e3e3")},layout:(e,t)=>{e.centerY.equalTo(t.super),e.right.inset(this.edgeOffset),e.size.equalTo(20)}},{type:"view",events:{tapped:async()=>{const t=await $picker.color({color:this.getColor(this.get(e))});this.set(e,t.components),$(r).bgcolor=$rgba(t.components.red,t.components.green,t.components.blue,t.components.alpha)}},layout:(e,t)=>{e.right.inset(0),e.height.width.equalTo(t.super.height)}}],layout:(e,t)=>{e.height.equalTo(this.rowHeight),e.width.equalTo(t.super)}}],layout:$layout.fill}}createDate(e,t,i,a=2){const r=this.getId(e),s=e=>{let t="";switch("number"==typeof e&&(e=new Date(e)),a){case 0:t=e.toLocaleTimeString();break;case 1:t=e.toLocaleDateString();break;case 2:t=e.toLocaleString()}return t};return{type:"view",props:{id:r,selectable:!0},views:[this.createLineLabel(i,t),{type:"view",views:[{type:"label",props:{id:`${r}-label`,color:$color("secondaryText"),text:this.get(e)?s(this.get(e)):"None"},layout:(e,t)=>{e.right.inset(0),e.height.equalTo(t.super)}}],events:{tapped:async()=>{const t=this.get(e),i=await $picker.date({props:{mode:a,date:t||Date.now()}});this.set(e,i.getTime()),$(`${r}-label`).text=s(i)}},layout:(e,t)=>{e.right.inset(this.edgeOffset),e.height.equalTo(this.rowHeight),e.width.equalTo(t.super)}}],layout:$layout.fill}}createNumber(e,t,i){return this.createInput(e,t,i,!1,$kbType.decimal,(t=>""!==t&&/^[0-9]+.?[0-9]*$/.test(t)?this.set(e,Number(t)):($ui.toast($l10n("INVALID_VALUE")),!1)))}createInput(e,t,i,a=!1,r=$kbType.default,s){void 0===s&&(s=t=>this.set(e,t));const o=this.getId(e),n=o+"-input";return{type:"view",props:{id:o,selectable:!0},views:[this.createLineLabel(i,t),{type:"input",props:{id:n,type:r,align:$align.right,bgcolor:$color("clear"),textColor:$color("secondaryText"),text:this.get(e),font:$font(16),secure:a,accessoryView:$58e2f5443faff7c0$require$UIKit.blurBox({height:44},[$58e2f5443faff7c0$require$UIKit.separatorLine({},$58e2f5443faff7c0$require$UIKit.align.top),{type:"button",props:{title:$l10n("DONE"),bgcolor:$color("clear"),titleColor:$color("primaryText")},layout:(e,t)=>{e.right.inset(this.edgeOffset),e.centerY.equalTo(t.super)},events:{tapped:()=>{$(n).blur()}}},{type:"button",props:{title:$l10n("CANCEL"),bgcolor:$color("clear"),titleColor:$color("primaryText")},layout:(e,t)=>{e.left.inset(this.edgeOffset),e.centerY.equalTo(t.super)},events:{tapped:()=>{const t=$(n),i=this.get(e,"");t.text!==i&&(t.text=i),t.blur()}}}])},layout:(t,i)=>{t.left.equalTo(i.prev.get("label").right).offset(this.edgeOffset),t.right.inset(this.edgeOffset);const a=$58e2f5443faff7c0$require$UIKit.getContentSize($font(16),this.get(e)).width;t.width.greaterThanOrEqualTo(a+30),t.height.equalTo(i.super)},events:{didBeginEditing:e=>{e.secure=!1,$app.autoKeyboardEnabled||($app.autoKeyboardEnabled=!0)},returned:e=>{e.blur()},didEndEditing:async t=>{const i=this.get(e,"");s(t.text)||(t.text=i),a&&(t.secure=a)}}}],layout:$layout.fill}}createIcon(e,t,i,a="#000000"){const r=this.getId(e),s=`${r}-image`;return{type:"view",props:{id:r,selectable:!0},views:[this.createLineLabel(i,t),{type:"view",views:[{type:"image",props:{cornerRadius:8,bgcolor:"string"==typeof a?$color(a):a,smoothCorners:!0},layout:(e,t)=>{e.right.inset(this.edgeOffset),e.centerY.equalTo(t.super),e.size.equalTo($size(30,30))}},{type:"image",props:{id:s,image:$image(this.get(e)),icon:$icon(this.get(e).slice(5,this.get(e).indexOf(".")),$color("#ffffff")),tintColor:$color("#ffffff")},layout:(e,t)=>{e.right.equalTo(t.prev).offset(-5),e.centerY.equalTo(t.super),e.size.equalTo($size(20,20))}}],events:{tapped:()=>{$ui.menu({items:[$l10n("JSBOX_ICON"),$l10n("SF_SYMBOLS"),$l10n("IMAGE_BASE64")],handler:async(t,i)=>{if(0===i){const t=await $ui.selectIcon();this.set(e,t),$(s).icon=$icon(t.slice(5,t.indexOf(".")),$color("#ffffff"))}else 1!==i&&2!==i||$input.text({text:"",placeholder:t,handler:t=>{""!==t?(this.set(e,t),1===i?$(s).symbol=t:$(s).image=$image(t)):$ui.toast($l10n("INVALID_VALUE"))}})}})}},layout:(e,t)=>{e.right.inset(0),e.height.equalTo(this.rowHeight),e.width.equalTo(t.super)}}],layout:$layout.fill}}createChild(e,t,i,a){const r=this.getId(e);return{type:"view",layout:$layout.fill,props:{id:r,selectable:!0},views:[this.createLineLabel(i,t),{type:"image",props:{symbol:"chevron.right",tintColor:$color("secondaryText")},layout:(e,t)=>{e.centerY.equalTo(t.super),e.right.inset(this.edgeOffset),e.size.equalTo(15)}}],events:{tapped:()=>{setTimeout((()=>{if(this.events?.onChildPush)this.callEvent("onChildPush",this.getListView(a,{}),i);else if(this.isUseJsboxNav)$58e2f5443faff7c0$require$UIKit.push({title:i,bgcolor:$58e2f5443faff7c0$require$UIKit.scrollViewBackgroundColor,views:[this.getListView(a,{})]});else{const e=new $58e2f5443faff7c0$require$NavigationView;e.setView(this.getListView(a,{})).navigationBarTitle(i),e.navigationBarItems.addPopButton(),e.navigationBar.setLargeTitleDisplayMode($58e2f5443faff7c0$require$NavigationBar.largeTitleDisplayModeNever),this.hasSectionTitle(a)&&e.navigationBar.setContentViewHeightOffset(-10),this.viewController.push(e)}}))}}}}createImage(e,t,i){const a=this.getId(e),r=`${a}-image`;return{type:"view",props:{id:a,selectable:!0},views:[this.createLineLabel(i,t),{type:"view",views:[{type:"image",props:{id:r,image:this.getImage(e,!0)??$image("questionmark.square.dashed")},layout:(e,t)=>{e.right.inset(this.edgeOffset),e.centerY.equalTo(t.super),e.size.equalTo($size(30,30))}}],events:{tapped:()=>{this.#o(a),$ui.menu({items:[$l10n("PREVIEW"),$l10n("SELECT_IMAGE"),$l10n("CLEAR_IMAGE")],handler:(t,i)=>{if(0===i){const t=this.getImage(e);t?$quicklook.open({image:t}):$ui.toast($l10n("NO_IMAGE"))}else 1===i?$photo.pick({format:"data"}).then((t=>{if($ui.toast($l10n("LOADING")),!t.status||!t.data)return void("canceled"!==t?.error?.description&&$ui.toast($l10n("ERROR")));const i=$58e2f5443faff7c0$require$Kernel.compressImage(t.data.image);this.fileStorage.write(this.imagePath,this.getImageName(e,!0),i.jpg(.8)),this.fileStorage.write(this.imagePath,this.getImageName(e),t.data),$(r).image=i,$ui.success($l10n("SUCCESS"))})):2===i&&(this.fileStorage.delete(this.imagePath,this.getImageName(e,!0)),this.fileStorage.delete(this.imagePath,this.getImageName(e)),$(r).image=$image("questionmark.square.dashed"),$ui.success($l10n("SUCCESS")))},finished:()=>{this.#n(a)}})}},layout:(e,t)=>{e.right.inset(0),e.height.equalTo(this.rowHeight),e.width.equalTo(t.super)}}],layout:$layout.fill}}#h(e){const t=[];for(let i of e){const e=[];for(let t of i.items){const i=this.get(t.key);let a=null;switch(t.icon||(t.icon=["square.grid.2x2.fill","#00CC00"]),"object"==typeof t.items&&(t.items=t.items.map((e=>$l10n(e)))),t.title=$l10n(t.title),t.type){case"switch":a=this.createSwitch(t.key,t.icon,t.title);break;case"stepper":a=this.createStepper(t.key,t.icon,t.title,t.min??1,t.max??12);break;case"string":a=this.createString(t.key,t.icon,t.title);break;case"info":a=this.createInfo(t.icon,t.title,i);break;case"script":a=this.createScript(t.key,t.icon,t.title,i);break;case"tab":a=this.createTab(t.key,t.icon,t.title,t.items,t.values);break;case"menu":a=this.createMenu(t.key,t.icon,t.title,t.items,t.values);break;case"color":a=this.createColor(t.key,t.icon,t.title);break;case"date":a=this.createDate(t.key,t.icon,t.title,t.mode);break;case"number":a=this.createNumber(t.key,t.icon,t.title);break;case"input":a=this.createInput(t.key,t.icon,t.title,t.secure);break;case"icon":a=this.createIcon(t.key,t.icon,t.title,t.bgcolor);break;case"child":a=this.createChild(t.key,t.icon,t.title,t.children);break;case"image":a=this.createImage(t.key,t.icon,t.title);break;default:continue}e.push(a)}t.push({title:$l10n(i.title??""),rows:e})}return t}getListView(e,t=this.footer){return{type:"list",props:{id:this.name,style:2,separatorInset:$insets(0,this.iconSize+2*this.edgeOffset,0,this.edgeOffset),bgcolor:$58e2f5443faff7c0$require$UIKit.scrollViewBackgroundColor,footer:t,data:this.#h(e??this.structure)},layout:$layout.fill,events:{rowHeight:(e,t)=>(e.object(t)?.props?.info??{}).rowHeight??this.rowHeight}}}getPage(){const e=new $58e2f5443faff7c0$require$NavigationView;return e.setView(this.getListView(this.structure)).navigationBarTitle($l10n("SETTING")),this.hasSectionTitle(this.structure)&&e.navigationBar.setContentViewHeightOffset(-10),e.getPage()}}module.exports={Setting:Setting}})),parcelRequire.register("fYz8N",(function(e,t){e.exports={Controller:class{events={};setEvents(e){return Object.keys(e).forEach((t=>this.setEvent(t,e[t]))),this}setEvent(e,t){return this.events[e]=t,this}callEvent(e,...t){"function"==typeof this.events[e]&&this.events[e](...t)}}}})),parcelRequire.register("8aDdQ",(function(e,t){class i extends Error{constructor(e){super(`Parameter [${e}] is required.`),this.name="FileStorageParameterError"}}class a extends Error{constructor(e){super(`File not found: ${e}`),this.name="FileStorageFileNotFoundError"}}class r{basePath;constructor({basePath:e="storage"}={}){this.basePath=e,this.#c(this.basePath)}#c(e){$file.isDirectory(e)||$file.mkdir(e)}#u(e="",t){return e=`${this.basePath}/${e.trim("/")}`.trim("/"),this.#c(e),e=`${e}/${t}`}write(e="",t,a){if(!t)throw new i("fileName");if(!a)throw new i("data");return $file.write({data:a,path:this.#u(e,t)})}writeSync(e="",t,i){return new Promise(((a,r)=>{try{const s=this.write(e,t,i);s?a(s):r(s)}catch(e){r(e)}}))}exists(e="",t){if(!t)throw new i("fileName");return e=this.#u(e,t),!!$file.exists(e)&&e}read(e="",t){if(!t)throw new i("fileName");if(e=this.#u(e,t),!$file.exists(e))throw new a(e);return $file.isDirectory(e)?$file.list(e):$file.read(e)}readSync(e="",t){return new Promise(((i,a)=>{try{const r=this.read(e,t);r?i(r):a()}catch(e){a(e)}}))}readAsJSON(e="",t,i=null){try{const i=this.read(e,t)?.string;return JSON.parse(i)}catch(e){return i}}static readFromRoot(e){if(!e)throw new i("path");if(!$file.exists(e))throw new a(e);return $file.isDirectory(e)?$file.list(e):$file.read(e)}static readFromRootSync(e=""){return new Promise(((t,i)=>{try{const a=r.readFromRoot(e);a?t(a):i()}catch(e){i(e)}}))}static readFromRootAsJSON(e="",t=null){try{const t=r.readFromRoot(e)?.string;return JSON.parse(t)}catch(e){return t}}delete(e="",t=""){return $file.delete(this.#u(e,t))}}e.exports={FileStorageParameterError:i,FileStorageFileNotFoundError:a,FileStorage:r}})),parcelRequire.register("cgaQ6",(function(e,t){var i=parcelRequire("czAIJ").VERSION;String.prototype.trim=function(e,t){return e?"l"===t?this.replace(new RegExp("^\\"+e+"+","g"),""):"r"===t?this.replace(new RegExp("\\"+e+"+$","g"),""):this.replace(new RegExp("^\\"+e+"+|\\"+e+"+$","g"),""):this.replace(/^\s+|\s+$/g,"")};class a{startTime=Date.now();isUseJsboxNav=!1;title=$addin.current.name;constructor(){$app.isDebugging&&this.debug()}static isTaio=$app.info.bundleID.includes("taio");static l10n(e,t,i=!0){if("string"==typeof t){const e={};t.split(";").forEach((t=>{if(""!==(t=t.trim())){const i=t.split("=");e[i[0].trim().slice(1,-1)]=i[1].trim().slice(1,-1)}})),t=e}const a=$app.strings;a[e]=i?Object.assign($app.strings[e],t):Object.assign(t,$app.strings[e]),$app.strings=a}static compressImage(e,t=921600){const i=$imagekit.info(e);if(i.height*i.width>t){const a=t/(i.height*i.width);e=$imagekit.scaleBy(e,a)}return e}static objectEqual(e,t){let i=Object.getOwnPropertyNames(e),r=Object.getOwnPropertyNames(t);if(i.length!==r.length)return!1;for(let r=0;re?i[e]:0,r=isNaN(Number(t))?t.charCodeAt():Number(t),o=a.length>e?a[e]:0,n=isNaN(Number(o))?o.charCodeAt():Number(o);if(rn){s=1;break}}return s}static deleteConfirm(e,t){$ui.alert({title:e,actions:[{title:$l10n("DELETE"),style:$alertActionType.destructive,handler:()=>{t()}},{title:$l10n("CANCEL")}]})}static bytesToSize(e){if(0===e)return"0 B";const t=Math.floor(Math.log(e)/Math.log(1024));return(e/Math.pow(1024,t)).toPrecision(3)+" "+["B","KB","MB","GB","TB","PB","EB","ZB","YB"][t]}debug(e,t){this.debugMode=!0,$app.idleTimerDisabled=!0,"function"==typeof e&&(this.debugPrint=e),"function"==typeof t&&(this.debugError=t),this.print("You are running EasyJsBox in debug mode.")}print(e){this.debugMode&&("function"==typeof this.debugPrint?this.debugPrint(e):console.log(e))}error(e){this.debugMode&&("function"==typeof this.debugError?this.debugError(e):console.error(e))}useJsboxNav(){return this.isUseJsboxNav=!0,this}setTitle(e){this.isUseJsboxNav&&($ui.title=e),this.title=e}setNavButtons(e){this.navButtons=e}openInJsbox(){$app.openURL(`jsbox://run?name=${$addin.current.name}`)}UIRender(e){try{e.props=Object.assign({title:this.title,navBarHidden:!this.isUseJsboxNav,navButtons:this.navButtons??[],statusBarStyle:0},e.props),e.events||(e.events={});const t=e.events.layoutSubviews,{UIKit:i}=parcelRequire("45Ip7");e.events.layoutSubviews=()=>{$app.notify({name:"interfaceOrientationEvent",object:{statusBarOrientation:i.statusBarOrientation,isHorizontal:i.isHorizontal}}),"function"==typeof t&&t()},$ui.render(e)}catch(e){this.print(e)}}async checkUpdate(){const e=await $http.get("https://raw.githubusercontent.com/ipuppet/EasyJsBox/dev/src/version.js");if(e.error)throw e.error;const t=srcRes.data.match(/.*VERSION.?\"([0-9\.]+)\"/)[1];if(this.print(`easy-jsbox latest version: ${t}`),a.versionCompare(t,i)>0){const e=await $http.get("https://raw.githubusercontent.com/ipuppet/EasyJsBox/dev/dist/easy-jsbox.js");if(e.error)throw e.error;return e.data}return!1}}e.exports={Kernel:a}})),parcelRequire.register("czAIJ",(function(e,t){e.exports={VERSION:"1.3.2"}})),parcelRequire.register("aXWmO",(function(e,t){var i=parcelRequire("6Xrbz").ValidationError,a=parcelRequire("liCrE").View,r=parcelRequire("45Ip7").UIKit,s=parcelRequire("12xzj").NavigationView,o=parcelRequire("dcStC").NavigationBar,n=parcelRequire("gAYmG").BarButtonItem;class l extends Error{constructor(){super("Please call setView(view) first."),this.name="SheetAddNavBarError"}}class h extends i{constructor(e,t){super(e,t),this.name="SheetViewTypeError"}}class c extends a{#p=()=>{};#g=()=>{};style=c.UIModalPresentationStyle.PageSheet;#d=!1;static UIModalPresentationStyle={Automatic:-2,FullScreen:0,PageSheet:1,FormSheet:2,CurrentContext:3,Custom:4,OverFullScreen:5,OverCurrentContext:6,Popover:7,BlurOverFullScreen:8};navigationView;init(){const{width:e,height:t}=$device.info.screen,i=$objc("UIView").invoke("initWithFrame",$rect(0,0,e,t)),a=$objc("UIViewController").invoke("alloc.init"),s=a.$view();return s.$setBackgroundColor(r.primaryViewBackgroundColor),s.$addSubview(i),a.$setModalPresentationStyle(this.style),a.$setModalInPresentation(this.#d),this.#p=()=>{s.jsValue().add(this.navigationView?.getPage().definition??this.view),$ui.vc.ocValue().invoke("presentViewController:animated:completion:",a,!0,void 0)},this.#g=()=>a.invoke("dismissViewControllerAnimated:completion:",!0,void 0),this}preventDismiss(){return this.#d=!0,this}setStyle(e){return this.style=e,this}setView(e={}){if("object"!=typeof e)throw new h("view","object");return this.view=e,this}addNavBar({title:e="",popButton:t={title:$l10n("DONE")},rightButtons:i=[]}={}){if(void 0===this.view)throw new l;this.navigationView=new s;const a=new n;a.setEvents(Object.assign({tapped:()=>{this.dismiss(),"function"==typeof t.tapped&&t.tapped()}},t.events)).setAlign(r.align.left).setSymbol(t.symbol).setTitle(t.title).setMenu(t.menu);const h=a.definition.views[0];return h.layout=(e,t)=>{e.left.equalTo(t.super.safeArea).offset(15),e.centerY.equalTo(t.super.safeArea)},this.navigationView.navigationBar.setLargeTitleDisplayMode(o.largeTitleDisplayModeNever).pageSheetMode(),this.navigationView.navigationBarItems.addPopButton("",h).setRightButtons(i),this.navigationView.setView(this.view).navigationBarTitle(e),this.view.props?.bgcolor&&this.navigationView?.getPage().setProp("bgcolor",this.view.props?.bgcolor),this}present(){this.#p()}dismiss(){this.#g()}}e.exports={Sheet:c}})),parcelRequire.register("6Xrbz",(function(e,t){class i extends Error{constructor(e,t){super(`The type of the parameter '${e}' must be '${t}'`),this.name="ValidationError"}}e.exports={ValidationError:i}})),parcelRequire.register("liCrE",(function(e,t){var i=parcelRequire("45Ip7").UIKit;class a{id=$text.uuid;type;props;views;events;layout;#$=void 0;scrollableView=null;constructor({type:e="view",props:t={},views:i=[],events:a={},layout:r=$layout.fill}={}){this.type=e,this.props=t,this.views=i,this.events=a,this.layout=r,this.props.id?this.id=this.props.id:this.props.id=this.id}static create(e){return new this(e)}static createFromViews(e){return new this({views:e})}scrollable(){if(void 0===this.#$)if(this.#$=!1,i.scrollViewList.indexOf(this.type)>-1)this.scrollableView=this,this.#$=!0;else if(this.views.length>0){const e=t=>{if(!this.#$&&t?.length>0)for(let r=0;r-1)return typeof t[r]!==a&&(t[r]=a.create(t[r])),this.scrollableView=t[r],void(this.#$=!0);e(t[r].views)}};e(this.views)}return this.#$}setProps(e){return Object.keys(e).forEach((t=>this.setProp(t,e[t]))),this}setProp(e,t){return"id"===e&&(this.id=t),this.props[e]=t,this}setViews(e){return this.views=e,this.#$=void 0,this}setEvents(e){return Object.keys(e).forEach((t=>this.setEvent(t,e[t]))),this}setEvent(e,t){return this.events[e]=t,this}eventMiddleware(e,t){const i=this.events[e];return this.events[e]=(...e)=>{"function"==typeof i&&t(i,...e)},this}assignEvent(e,t){const i=this.events[e];return this.events[e]=(...e)=>{"function"==typeof i&&i(...e),t(...e)},this}setLayout(e){return this.layout=e,this}getView(){return this}get definition(){return this.getView()}}e.exports={View:a,PageView:class extends a{constructor(e={}){super(e),this.activeStatus=!0}show(){$(this.props.id).hidden=!1,this.activeStatus=!0}hide(){$(this.props.id).hidden=!0,this.activeStatus=!1}setHorizontalSafeArea(e){return this.horizontalSafeArea=e,this}#f(e,t){e.top.bottom.equalTo(t.super),this.horizontalSafeArea?e.left.right.equalTo(t.super.safeArea):e.left.right.equalTo(t.super)}getView(){return this.layout=this.#f,this.props.clipsToBounds=!0,this.props.hidden=!this.activeStatus,super.getView()}}}})),parcelRequire.register("12xzj",(function(e,t){var i=parcelRequire("liCrE"),a=i.View,r=i.PageView,s=parcelRequire("6Xrbz").ValidationError,o=parcelRequire("cgaQ6").Kernel,n=parcelRequire("45Ip7").UIKit,l=parcelRequire("dcStC"),h=l.NavigationBar,c=l.NavigationBarController,u=parcelRequire("gAYmG").NavigationBarItems;class p extends s{constructor(e,t){super(e,t),this.name="NavigationViewTypeError"}}e.exports={NavigationView:class{page;navigationController=new c;navigationBar=new h;navigationBarItems=new u;constructor(){this.navigationBar.navigationBarItems=this.navigationBarItems,this.navigationController.navigationBar=this.navigationBar}navigationBarTitle(e){return this.navigationBar.setTitle(e),this}setView(e){if("object"!=typeof e)throw new p("view","object");return this.view=a.create(e),this}#v(){if(!(this.view instanceof a))throw new p("view","View");const e=$app.isDebugging||o.isTaio?0:n.topSafeAreaInsets;let t=this.navigationBar.contentViewHeightOffset;if(this.navigationBarItems.titleView&&(t+=this.navigationBarItems.titleView.topOffset,t+=this.navigationBarItems.titleView.height,t+=this.navigationBarItems.titleView.bottomOffset),this.view.props.stickyHeader?t+=this.navigationBar.largeTitleFontHeight:this.navigationBar.largeTitleDisplayMode===h.largeTitleDisplayModeNever?t+=this.navigationBar.navigationBarNormalHeight:t+=this.navigationBar.navigationBarLargeTitleHeight,this.view.props.header?this.view.props.header={type:"view",props:{height:t+(this.view.props.header?.props?.height??0)},views:[{type:"view",props:{clipsToBounds:!0},views:[this.view.props.header],layout:(e,i)=>{e.top.equalTo(t),e.bottom.width.equalTo(i.super)}}]}:this.view.props.header={props:{height:t}},this.view.props.footer=Object.assign({props:{}},this.view.props.footer??{}),this.view.props.footer.props.height=(this.navigationBarItems.fixedFooterView?.height??0)+(this.view.props.footer.props?.height??0),-1===n.scrollViewList.indexOf(this.view.type))this.view.layout=(i,a)=>{i.left.right.equalTo(a.super.safeArea),i.bottom.equalTo(a.super);let r=t-this.navigationBar.contentViewHeightOffset;n.isHorizontal&&!n.isLargeScreen||!this.navigationBar.topSafeArea||(r+=e),i.top.equalTo(r)};else{const t=this.navigationBarItems.isPinTitleView?this.navigationBarItems.titleView.height+this.navigationBarItems.titleView.bottomOffset+this.navigationBar.contentViewHeightOffset:0;if(this.view.props.indicatorInsets){const e=this.view.props.indicatorInsets;this.view.props.indicatorInsets=$insets(e.top+this.navigationBar.navigationBarNormalHeight+t,e.left,e.bottom+(this.navigationBarItems.fixedFooterView?.height??0),e.right)}else this.view.props.indicatorInsets=$insets(this.navigationBar.navigationBarNormalHeight+t,0,this.navigationBarItems.fixedFooterView?.height??0,0);this.view.layout=(e,t)=>{this.view.props.stickyHeader?e.top.equalTo(t.super.safeArea).offset(this.navigationBar.navigationBarNormalHeight):e.top.equalTo(t.super),e.left.right.equalTo(t.super.safeArea),e.bottom.equalTo(t.super)},this.view.assignEvent("didScroll",(t=>{let i=t.contentOffset.y;n.isHorizontal&&!n.isLargeScreen||!this.navigationBar.topSafeArea||this.view.props.stickyHeader||(i+=e),this.navigationController.didScroll(i)})).assignEvent("didEndDragging",((t,i)=>{let a=t.contentOffset.y,r=0;n.isHorizontal&&!n.isLargeScreen||!this.navigationBar.topSafeArea||this.view.props.stickyHeader||(a+=e,r=e),this.navigationController.didEndDragging(a,i,((...e)=>t.scrollToOffset(...e)),r)})).assignEvent("didEndDecelerating",((...e)=>{e[0].tracking||this.view.events?.didEndDragging(...e)}))}}#b(){if(this.navigationBar.prefersLargeTitles){this.#v();let e={};if(this.navigationBarItems.titleView){const t=this.navigationBar.largeTitleDisplayMode===h.largeTitleDisplayModeNever?1:0;e=a.create({views:[this.navigationBar.backgroundColor?{type:"view",props:{alpha:t,bgcolor:this.navigationBar.backgroundColor,id:this.navigationBar.id+"-title-view-background"},layout:$layout.fill}:n.blurBox({alpha:t,id:this.navigationBar.id+"-title-view-background"}),n.separatorLine({id:this.navigationBar.id+"-title-view-underline",alpha:t}),this.navigationBarItems.titleView.definition],layout:(e,t)=>{e.top.equalTo(t.prev.bottom),e.width.equalTo(t.super),e.height.equalTo(this.navigationBarItems.titleView.topOffset+this.navigationBarItems.titleView.height+this.navigationBarItems.titleView.bottomOffset)}})}this.page=r.createFromViews([this.view,this.navigationBar.getLargeTitleView(),e,this.navigationBar.getNavigationBarView(),this.navigationBarItems.fixedFooterView?.definition??{}])}else this.page=r.createFromViews([this.view]);this.view.props?.bgcolor?this.page.setProp("bgcolor",this.view.props.bgcolor):this.page.setProp("bgcolor",n.defaultBackgroundColor(this.view.type))}getPage(){return this.page||this.#b(),this.page}}}})),parcelRequire.register("dcStC",(function(e,t){var i=parcelRequire("liCrE").View,a=parcelRequire("fYz8N").Controller,r=parcelRequire("45Ip7").UIKit,s=parcelRequire("gAYmG").BarButtonItem;class o extends i{static largeTitleDisplayModeAutomatic=0;static largeTitleDisplayModeAlways=1;static largeTitleDisplayModeNever=2;static pageSheetNavigationBarHeight=56;navigationBarItems;title="";prefersLargeTitles=!0;largeTitleDisplayMode=o.largeTitleDisplayModeAutomatic;largeTitleFontSize=34;largeTitleFontFamily="bold";largeTitleFontHeight=$text.sizeThatFits({text:"A",width:100,font:$font(this.largeTitleFontFamily,this.largeTitleFontSize)}).height;navigationBarTitleFontSize=17;topSafeArea=!0;contentViewHeightOffset=10;navigationBarNormalHeight=r.NavigationBarNormalHeight;navigationBarLargeTitleHeight=r.NavigationBarLargeTitleHeight;pageSheetMode(){return this.navigationBarLargeTitleHeight-=this.navigationBarNormalHeight,this.navigationBarNormalHeight=o.pageSheetNavigationBarHeight,this.navigationBarLargeTitleHeight+=this.navigationBarNormalHeight,this.topSafeArea=!1,this}setTopSafeArea(){return this.topSafeArea=!0,this}removeTopSafeArea(){return this.topSafeArea=!1,this}setLargeTitleDisplayMode(e){return this.largeTitleDisplayMode=e,this}setBackgroundColor(e){return this.backgroundColor=e,this}setTitle(e){return this.title=e,this}setPrefersLargeTitles(e){return this.prefersLargeTitles=e,this}setContentViewHeightOffset(e){return this.contentViewHeightOffset=e,this}getLargeTitleView(){return this.prefersLargeTitles&&this.largeTitleDisplayMode!==o.largeTitleDisplayModeNever?{type:"label",props:{id:this.id+"-large-title",text:this.title,textColor:r.textColor,align:$align.left,font:$font(this.largeTitleFontFamily,this.largeTitleFontSize),line:1},layout:(e,t)=>{e.left.equalTo(t.super.safeArea).offset(15),e.height.equalTo(this.largeTitleFontHeight),e.top.equalTo(t.super.safeAreaTop).offset(this.navigationBarNormalHeight)}}:{props:{id:this.id+"-large-title"},layout:(e,t)=>{e.left.top.right.inset(0),e.bottom.equalTo(t.super.safeAreaTop).offset(this.navigationBarNormalHeight)}}}getNavigationBarView(){const e=(e,t)=>e.length>0?{type:"view",views:[{type:"view",views:e,layout:$layout.fill}],layout:(i,a)=>{i.top.equalTo(a.super.safeAreaTop),i.bottom.equalTo(a.super.safeAreaTop).offset(this.navigationBarNormalHeight),t===r.align.left?i.left.equalTo(a.super.safeArea):i.right.equalTo(a.super.safeArea),i.width.equalTo(e.length*s.size.width)}}:{},t=e(this.navigationBarItems.rightButtons,r.align.right),i=this.navigationBarItems.popButtonView??e(this.navigationBarItems.leftButtons,r.align.left),a=this.prefersLargeTitles,n=!this.prefersLargeTitles||this.largeTitleDisplayMode===o.largeTitleDisplayModeNever;return{type:"view",props:{id:this.id+"-navigation",bgcolor:$color("clear")},layout:(e,t)=>{e.left.top.right.inset(0),e.bottom.equalTo(t.super.safeAreaTop).offset(this.navigationBarNormalHeight)},views:[this.backgroundColor?{type:"view",props:{hidden:a,bgcolor:this.backgroundColor,id:this.id+"-background"},layout:$layout.fill}:r.blurBox({hidden:a,id:this.id+"-background"}),r.separatorLine({id:this.id+"-underline",alpha:a?0:1}),{type:"view",props:{alpha:0,bgcolor:$color("clear"),id:this.id+"-large-title-mask"},events:{ready:e=>{e.bgcolor=$(this.id+"-large-title")?.prev.bgcolor}},layout:$layout.fill},{type:"label",props:{id:this.id+"-small-title",alpha:n?1:0,text:this.title,font:$font(this.largeTitleFontFamily,this.navigationBarTitleFontSize),align:$align.center,bgcolor:$color("clear"),textColor:r.textColor},layout:(e,t)=>{e.left.right.inset(0),e.height.equalTo(20),e.centerY.equalTo(t.super.safeArea)}}].concat(t,i)}}}class n extends a{static largeTitleViewSmallMode=0;static largeTitleViewLargeMode=1;navigationBar;updateSelector(){this.selector={navigation:$(this.navigationBar.id+"-navigation"),largeTitleView:$(this.navigationBar.id+"-large-title"),smallTitleView:$(this.navigationBar.id+"-small-title"),underlineView:this.navigationBar.navigationBarItems.isPinTitleView?$(this.navigationBar.id+"-title-view-underline"):$(this.navigationBar.id+"-underline"),largeTitleMaskView:$(this.navigationBar.id+"-large-title-mask"),backgroundView:$(this.navigationBar.id+"-background"),titleViewBackgroundView:$(this.navigationBar.id+"-title-view-background")}}toNormal(e=!0){this.updateSelector(),this.selector.backgroundView.hidden=!1,$ui.animate({duration:.2,animation:()=>{this.selector.underlineView.alpha=1,this.selector.smallTitleView.alpha=1,this.selector.largeTitleView.alpha=0}}),e&&this.navigationBar.navigationBarItems&&(this.navigationBar.largeTitleDisplayMode=o.largeTitleDisplayModeNever)}toLargeTitle(e=!0){this.updateSelector(),this.selector.backgroundView.hidden=!0,$ui.animate({duration:.2,animation:()=>{this.selector.underlineView.alpha=0,this.selector.smallTitleView.alpha=0,this.selector.largeTitleView.alpha=1}}),e&&this.navigationBar.navigationBarItems&&(this.navigationBar.largeTitleDisplayMode=o.largeTitleDisplayModeAlways)}#w(e){const t=e===n.largeTitleViewSmallMode;this.selector.largeTitleView.alpha=t?0:1,$ui.animate({duration:.2,animation:()=>{this.selector.smallTitleView.alpha=t?1:0}})}#m(e){if(this.selector.largeTitleView.updateLayout(((t,i)=>{this.navigationBar.navigationBarNormalHeight-e>0?t.top.equalTo(i.super.safeAreaTop).offset(this.navigationBar.navigationBarNormalHeight-e):t.top.equalTo(i.super.safeAreaTop).offset(0)})),e>0)e>=this.navigationBar.navigationBarNormalHeight?this.#w(n.largeTitleViewSmallMode):this.#w(n.largeTitleViewLargeMode);else{this.#w(n.largeTitleViewLargeMode);let t=this.navigationBar.largeTitleFontSize-.04*e;t>40&&(t=40),this.selector.largeTitleView.font=$font(this.navigationBar.largeTitleFontFamily,t)}}#y(e){const t=this.navigationBar.largeTitleDisplayMode===o.largeTitleDisplayModeNever?5:this.navigationBar.navigationBarNormalHeight,i=void 0!==this.selector.titleViewBackgroundView;if(e>t){this.selector.backgroundView.hidden=!1;const a=()=>{i&&this.navigationBar.navigationBarItems.isPinTitleView&&(this.selector.titleViewBackgroundView.alpha=1),this.selector.largeTitleMaskView.alpha=0,this.selector.underlineView.alpha=1};(e-t)/3>=1?a():$ui.animate({duration:.2,animation:()=>{a()}})}else this.selector.largeTitleMaskView.alpha=e>0?1:0,this.selector.underlineView.alpha=0,i&&(this.selector.titleViewBackgroundView.alpha=0),this.selector.backgroundView.hidden=!0}didScroll(e){if(!this.navigationBar.prefersLargeTitles)return;const t=this.navigationBar.largeTitleDisplayMode;if(t!==o.largeTitleDisplayModeAlways)if(this.updateSelector(),t===o.largeTitleDisplayModeAutomatic){if(!this.navigationBar.navigationBarItems?.isPinTitleView&&(this.navigationBar.navigationBarItems?.titleView?.controller.didScroll(e),e>0)){(e-=this.navigationBar.navigationBarItems?.titleView?.height??0)<0&&(e=0)}this.#m(e),this.#y(e)}else t===o.largeTitleDisplayModeNever&&this.#y(e)}didEndDragging(e,t,i,a){if(!this.navigationBar.prefersLargeTitles)return;const r=this.navigationBar.largeTitleDisplayMode;if(r!==o.largeTitleDisplayModeAlways&&(this.updateSelector(),r===o.largeTitleDisplayModeAutomatic)){let r=0;this.navigationBar.navigationBarItems?.isPinTitleView||(this.navigationBar.navigationBarItems?.titleView?.controller.didEndDragging(e,t,i,a),r=this.navigationBar.navigationBarItems?.titleView?.height??0,e-=r),e>=0&&e<=this.navigationBar.largeTitleFontHeight&&i($point(0,e>=this.navigationBar.largeTitleFontHeight/2?this.navigationBar.navigationBarNormalHeight+r-a:r-a))}}}e.exports={NavigationBar:o,NavigationBarController:n}})),parcelRequire.register("gAYmG",(function(e,t){var i=parcelRequire("liCrE").View,a=parcelRequire("45Ip7").UIKit;class r extends i{static edges=15;static size=$size(38,38);static fontSize=16;static iconSize=$size(r.size.width-r.edges,r.size.height-r.edges);title;symbol;align=a.align.right;setTitle(e){return this.title=e,this}setSymbol(e){return this.symbol=e,this}setMenu(e){return this.menu=e,this}setAlign(e){return this.align=e,this}#T(){$(this.id).hidden=!0,$("spinner-"+this.id).hidden=!1}#B(){const e=$(`icon-button-${this.id}`),t=$(`icon-checkmark-${this.id}`);e.alpha=0,$(this.id).hidden=!1,$("spinner-"+this.id).hidden=!0,$ui.animate({duration:.6,animation:()=>{t.alpha=1},completion:()=>{$delay(.3,(()=>$ui.animate({duration:.6,animation:()=>{t.alpha=0},completion:()=>{$ui.animate({duration:.4,animation:()=>{e.alpha=1},completion:()=>{e.alpha=1}})}})))}})}#q(){$(this.id).hidden=!1,$("spinner-"+this.id).hidden=!0}getView(){const e=this.events.tapped;return this.events.tapped=t=>{e&&e({start:()=>this.#T(),done:()=>this.#B(),cancel:()=>this.#q()},t)},{type:"view",views:[{type:"button",props:Object.assign({id:this.id,bgcolor:$color("clear"),font:$font(r.fontSize),tintColor:a.textColor,titleColor:a.textColor,contentEdgeInsets:$insets(0,0,0,0),titleEdgeInsets:$insets(0,0,0,0),imageEdgeInsets:$insets(0,0,0,0)},this.menu?{menu:this.menu}:{},this.title?{title:this.title}:{},this.props),views:[{type:"image",props:Object.assign({id:`icon-button-${this.id}`,hidden:void 0===this.symbol,tintColor:a.textColor},void 0===this.symbol?{}:"string"==typeof this.symbol?{symbol:this.symbol}:{data:this.symbol.png}),layout:(e,t)=>{e.center.equalTo(t.super),e.size.equalTo(r.iconSize)}},{type:"image",props:{id:`icon-checkmark-${this.id}`,alpha:0,tintColor:a.textColor,symbol:"checkmark"},layout:(e,t)=>{e.center.equalTo(t.super),e.size.equalTo(r.iconSize)}}],events:this.events,layout:$layout.fill},{type:"spinner",props:{id:"spinner-"+this.id,loading:!0,hidden:!0},layout:$layout.fill}],layout:(e,t)=>{if(this.title){const t=$text.sizeThatFits({text:this.title,width:a.windowSize.width,font:$font(r.fontSize)}),i=Math.ceil(t.width)+r.edges;e.size.equalTo($size(i,r.size.height))}else e.size.equalTo(r.size);if(e.centerY.equalTo(t.super),t.prev&&"label"!==t.prev.id&&void 0!==t.prev.id)this.align===a.align.right?e.right.equalTo(t.prev.left):e.left.equalTo(t.prev.right);else{const t=r.edges/2;this.align===a.align.right?e.right.inset(t):e.left.inset(t)}}}}static creat({symbol:e,title:t,tapped:i,menu:s,events:o,align:n=a.align.right}={}){const l=new r;return l.setEvents(Object.assign({tapped:i},o)).setAlign(n).setSymbol(e).setTitle(t).setMenu(s),l}}e.exports={BarTitleView:class extends i{controller={};setController(e){return this.controller=e,this}},BarButtonItem:r,NavigationBarItems:class{rightButtons=[];leftButtons=[];hasbutton=!1;isPinTitleView=!1;setTitleView(e){return this.titleView=e,this}pinTitleView(){return this.isPinTitleView=!0,this}setFixedFooterView(e){return this.fixedFooterView=e,this}setRightButtons(e){return e.forEach((e=>this.addRightButton(e))),this.hasbutton||(this.hasbutton=!0),this}setLeftButtons(e){return e.forEach((e=>this.addLeftButton(e))),this.hasbutton||(this.hasbutton=!0),this}addRightButton({symbol:e,title:t,tapped:i,menu:s,events:o}={}){return this.rightButtons.push(r.creat({symbol:e,title:t,tapped:i,menu:s,events:o,align:a.align.right}).definition),this.hasbutton||(this.hasbutton=!0),this}addLeftButton({symbol:e,title:t,tapped:i,menu:s,events:o}={}){return this.leftButtons.push(r.creat({symbol:e,title:t,tapped:i,menu:s,events:o,align:a.align.left}).definition),this.hasbutton||(this.hasbutton=!0),this}addPopButton(e,t){return e||(e=$l10n("BACK")),this.popButtonView=t??{type:"button",props:{bgcolor:$color("clear"),symbol:"chevron.left",tintColor:a.linkColor,title:` ${e}`,titleColor:a.linkColor,font:$font("bold",16)},layout:(e,t)=>{e.left.equalTo(t.super.safeArea).offset(r.edges),e.centerY.equalTo(t.super.safeArea)},events:{tapped:()=>{$ui.pop()}}},this}removePopButton(){return this.popButtonView=void 0,this}}}})),parcelRequire.register("gMc1q",(function(e,t){var i=parcelRequire("fYz8N").Controller;e.exports={ViewController:class extends i{#S=[];#C(e){this.callEvent("onPop",e),this.#S.pop()}push(e){const t=this.#S[this.#S.length-1];e.navigationBarItems.addPopButton(t?.navigationBar.title),this.#S.push(e),$ui.push({props:{statusBarStyle:0,navBarHidden:!0},events:{dealloc:()=>{this.#C(e)}},views:[e.getPage().definition],layout:$layout.fill})}}}}));var $czAIJ=parcelRequire("czAIJ"),$bb0fea222fc5aea5$require$VERSION=$czAIJ.VERSION,$fYz8N=parcelRequire("fYz8N"),$bb0fea222fc5aea5$require$Controller=$fYz8N.Controller,$272f042430a952c6$exports={},$45Ip7=parcelRequire("45Ip7"),$272f042430a952c6$require$UIKit=$45Ip7.UIKit,$aXWmO=parcelRequire("aXWmO"),$272f042430a952c6$require$Sheet=$aXWmO.Sheet,$cgaQ6=parcelRequire("cgaQ6"),$272f042430a952c6$require$Kernel=$cgaQ6.Kernel,$12xzj=parcelRequire("12xzj"),$272f042430a952c6$require$NavigationView=$12xzj.NavigationView,$dcStC=parcelRequire("dcStC"),$272f042430a952c6$require$NavigationBar=$dcStC.NavigationBar;class $272f042430a952c6$var$FileManager{viewController;constructor(){this.listId="file-manager-list",this.edges=10,this.iconSize=25,this.loadL10n()}loadL10n(){$272f042430a952c6$require$Kernel.l10n("zh-Hans",'\n "CONFIRM_DELETE_MSG" = "确认要删除吗";\n "DELETE" = "删除";\n "CANCEL" = "取消";\n "CLOSE" = "关闭";\n "SHARE" = "分享";\n "SAVE" = "保存";\n "SAVE_SUCCESS" = "保存成功";\n '),$272f042430a952c6$require$Kernel.l10n("en",'\n "CONFIRM_DELETE_MSG" = "Are you sure you want to delete";\n "DELETE" = "Delete";\n "CANCEL" = "Cancel";\n "CLOSE" = "Close";\n "SHARE" = "Share";\n "SAVE" = "Save";\n "SAVE_SUCCESS" = "Save Success";\n ')}setViewController(e){this.viewController=e}get menu(){return{items:[{title:$l10n("SHARE"),symbol:"square.and.arrow.up",handler:async(e,t)=>{const i=e.object(t).info.info;$share.sheet([$file.absolutePath(i.path)])}}]}}delete(e){$file.delete(e.path)}edit(e){const t=$file.read(e.path);if(t.image)$quicklook.open({image:t.image});else{const i=new $272f042430a952c6$require$Sheet,a=$text.uuid;i.setView({type:"code",layout:$layout.fill,props:{id:a,lineNumbers:!0,theme:$device.isDarkMode?"atom-one-dark":"atom-one-light",text:t.string,insets:$insets(15,15,15,15)}}).addNavBar({title:e.file,popButton:{title:$l10n("CLOSE")},rightButtons:[{title:$l10n("SAVE"),tapped:()=>{$file.write({data:$data({string:$(a).text}),path:e.path}),$ui.success($l10n("SAVE_SUCCESS"))}}]}),i.init().present()}}getFiles(e=""){return $file.list(e).map((t=>{const i=e+"/"+t,a=$file.isDirectory(i);return{info:{info:{path:i,file:t,isDirectory:a}},icon:{symbol:a?"folder.fill":"doc"},name:{text:t},size:{text:a?"":"--"}}})).sort(((e,t)=>e.info.info.isDirectory!==t.info.info.isDirectory?e.info.info.isDirectory?-1:1:e.info.info.isDirectory===t.info.info.isDirectory?e.info.info.file.localeCompare(t.info.info.file):void 0))}async loadFileSize(e){return e.map(((t,i)=>{const a=t.info.info;if(!a.isDirectory)try{e[i].size.text=$272f042430a952c6$require$Kernel.bytesToSize($file.read(a.path).info.size)}catch(t){e[i].size.text=t}})),e}get listTemplate(){return{props:{bgcolor:$color("clear")},views:[{props:{id:"info"}},{type:"image",props:{id:"icon"},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.inset(this.edges),e.size.equalTo(this.iconSize)}},{type:"label",props:{id:"name",lines:1},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.equalTo(t.prev.right).offset(this.edges)}},{type:"label",props:{id:"size",color:$color("secondaryText"),lines:1},layout:(e,t)=>{e.centerY.equalTo(t.super),e.right.inset(this.edges)}}]}}#V(e,t){if(this.viewController){const i=new $272f042430a952c6$require$NavigationView;i.setView(t).navigationBarTitle(e),i.navigationBar.setLargeTitleDisplayMode($272f042430a952c6$require$NavigationBar.largeTitleDisplayModeNever),this.viewController.push(i)}else $272f042430a952c6$require$UIKit.push({title:e,views:[t]})}getListView(e=""){return{type:"list",props:{id:this.listId,menu:this.menu,info:{basePath:e},bgcolor:$272f042430a952c6$require$UIKit.primaryViewBackgroundColor,separatorInset:$insets(0,this.edges,0,0),data:[],template:this.listTemplate,actions:[{title:" "+$l10n("DELETE")+" ",color:$color("red"),handler:(e,t)=>{const i=e.object(t).info.info;$272f042430a952c6$require$Kernel.deleteConfirm($l10n("CONFIRM_DELETE_MSG")+' "'+i.file+'" ?',(()=>{this.delete(i),e.delete(t)}))}}]},layout:$layout.fill,events:{ready:()=>{const t=this.getFiles(e);$(this.listId).data=t,this.loadFileSize(t).then((e=>{$(this.listId).data=e}))},pulled:async e=>{const t=this.getFiles($(this.listId).info.basePath);$(this.listId).data=t,$(this.listId).data=await this.loadFileSize(t),$delay(.5,(()=>{e.endRefreshing()}))},didSelect:(e,t,i)=>{const a=i.info.info;a.isDirectory?this.#V(a.file,this.getListView(a.path)):this.edit(a)}}}}push(e=""){const t=e.substring(e.lastIndexOf("/"));this.#V(t,this.getListView(e))}}$272f042430a952c6$exports={FileManager:$272f042430a952c6$var$FileManager};var $bb0fea222fc5aea5$require$FileManager=$272f042430a952c6$exports.FileManager,$8aDdQ=parcelRequire("8aDdQ"),$bb0fea222fc5aea5$require$FileStorageParameterError=$8aDdQ.FileStorageParameterError,$bb0fea222fc5aea5$require$FileStorageFileNotFoundError=$8aDdQ.FileStorageFileNotFoundError,$bb0fea222fc5aea5$require$FileStorage=$8aDdQ.FileStorage,$4c192cc93140b629$exports={},$liCrE=parcelRequire("liCrE"),$4c192cc93140b629$require$View=$liCrE.View,$45Ip7=parcelRequire("45Ip7"),$4c192cc93140b629$require$UIKit=$45Ip7.UIKit;class $4c192cc93140b629$var$FixedFooterView extends $4c192cc93140b629$require$View{height=60;getView(){return this.type="view",this.setProp("bgcolor",$4c192cc93140b629$require$UIKit.primaryViewBackgroundColor),this.layout=(e,t)=>{e.left.right.bottom.equalTo(t.super),e.top.equalTo(t.super.safeAreaBottom).offset(-this.height)},this.views=[$4c192cc93140b629$require$View.create({props:this.props,views:this.views,layout:(e,t)=>{e.left.right.top.equalTo(t.super),e.height.equalTo(this.height)}})],this}}$4c192cc93140b629$exports={FixedFooterView:$4c192cc93140b629$var$FixedFooterView};var $bb0fea222fc5aea5$require$FixedFooterView=$4c192cc93140b629$exports.FixedFooterView,$cgaQ6=parcelRequire("cgaQ6"),$bb0fea222fc5aea5$require$Kernel=$cgaQ6.Kernel,$50aa538fe0dbd3b0$exports={},$liCrE=parcelRequire("liCrE"),$50aa538fe0dbd3b0$require$View=$liCrE.View;class $50aa538fe0dbd3b0$var$Matrix extends $50aa538fe0dbd3b0$require$View{titleStyle={font:$font("bold",21),height:30};#I;#E;templateIdByIndex(e){return void 0===this.props.template.views[e]?.props?.id&&(void 0===this.props.template.views[e].props&&(this.props.template.views[e].props={}),this.props.template.views[e].props.id=$text.uuid),this.props.template.views[e].props.id}get templateHiddenStatus(){if(!this.#E){this.#E={};for(let e=0;e(e.items=e.items.map((e=>(Object.keys(e).forEach((t=>{e[t].hidden=this.templateHiddenStatus[t]??!1})),Object.keys(this.templateHiddenStatus).forEach((t=>{e[t]||(e[t]={}),e[t].hidden=this.templateHiddenStatus[t]})),e.__templateProps={hidden:!1},e.__title={hidden:!0},e))),e.title&&e.items.unshift(this.#x(e.title)),e)))}rebuildTemplate(){let e={};void 0!==this.props.template.props&&(e=Object.assign(this.props.template.props,{id:"__templateProps",hidden:!1})),this.props.template.props={};const t=[{type:"view",props:e,layout:$layout.fill},{type:"label",props:{id:"__title",hidden:!0,font:this.titleStyle.font},layout:(e,t)=>{e.top.inset(-this.titleStyle.height/4*3),e.height.equalTo(this.titleStyle.height),e.width.equalTo(t.super.safeArea)}}].concat(this.props.template.views);this.props.template.views=t}insert(e,t=!0){return e.indexPath=this.indexPath(e.indexPath,t),$(this.id).insert(e)}delete(e,t=!0){return e=this.indexPath(e,t),$(this.id).delete(e)}object(e,t=!0){return e=this.indexPath(e,t),$(this.id).object(e)}cell(e,t=!0){return e=this.indexPath(e,t),$(this.id).cell(e)}indexPath(e,t){let i=t?0:1;return"number"==typeof e&&(e=$indexPath(0,e)),e=$indexPath(e.section,e.row+i)}update(e){this.props.data=this.rebuildData(e),$(this.id).data=this.props.data}getView(){return this.props.data=this.rebuildData(this.props.data),this.rebuildTemplate(),this.setEvent("itemSize",((e,t)=>{const i=e.object(t)?.__title?.info;if(i?.title)return $size(Math.max($device.info.screen.width,$device.info.screen.height),0);const a=this.props.columns??2,r=this.props.spacing??15,s=this.props.itemWidth??this.props.itemSize?.width??(e.super.frame.width-r*(a+1))/a,o=this.props.itemHeight??this.props.itemSize?.height??100;return $size(s,o)})),this}}$50aa538fe0dbd3b0$exports={Matrix:$50aa538fe0dbd3b0$var$Matrix};var $bb0fea222fc5aea5$require$Matrix=$50aa538fe0dbd3b0$exports.Matrix,$619319e3f3656d3f$exports={};class $619319e3f3656d3f$var$Request{static Method={get:"GET",post:"POST"};#N;#k=!1;#O=!1;cacheLife=2592e6;isLogRequest=!0;timeout=5;kernel;constructor(e){this.kernel=e}getCacheKey(e){return this.#N||(this.#N=$text.MD5(this.baseUrl)),this.#N+$text.MD5(e)}setCache(e,t){$cache.set(e,t)}getCache(e,t=null){return $cache.get(e)??t}removeCache(e){$cache.remove(e)}useCache(){return this.#k=!0,this}ignoreCacheExp(){this.#O=!0}async request(e,t,i={},a={},r=this.cacheLife){const s=this.baseUrl+e;let o;const n=this.#k&&t===$619319e3f3656d3f$var$Request.Method.get;if(n){o=this.getCacheKey(e);const t=this.getCache(o);if(t&&(this.#O||t.exp>Date.now()))return this.isLogRequest&&this.kernel.print("get data from cache: "+s),t.data}try{this.isLogRequest&&this.kernel.print(`sending request [${t}]: ${s}`);const e=await $http.request({header:Object.assign({"Content-Type":"application/json"},a),url:s,method:t,body:i,timeout:this.timeout});if(e?.response?.statusCode>=400){let t=e.data;throw"object"==typeof t&&(t=JSON.stringify(t)),new Error("http error: ["+e.response.statusCode+"] "+t)}return n&&this.setCache(o,{exp:Date.now()+r,data:e.data}),e.data}catch(e){throw e.code&&(e=new Error("network error: ["+e.code+"] "+e.localizedDescription)),e}}}$619319e3f3656d3f$exports={Request:$619319e3f3656d3f$var$Request};var $bb0fea222fc5aea5$require$Request=$619319e3f3656d3f$exports.Request,$7D8Kb=parcelRequire("7D8Kb"),$bb0fea222fc5aea5$require$Setting=$7D8Kb.Setting,$aXWmO=parcelRequire("aXWmO"),$bb0fea222fc5aea5$require$Sheet=$aXWmO.Sheet,$7dfcabb1e936a92c$exports={},$liCrE=parcelRequire("liCrE"),$7dfcabb1e936a92c$require$View=$liCrE.View,$7dfcabb1e936a92c$require$PageView=$liCrE.PageView,$fYz8N=parcelRequire("fYz8N"),$7dfcabb1e936a92c$require$Controller=$fYz8N.Controller,$45Ip7=parcelRequire("45Ip7"),$7dfcabb1e936a92c$require$UIKit=$45Ip7.UIKit;class $7dfcabb1e936a92c$var$TabBarCellView extends $7dfcabb1e936a92c$require$View{constructor(e={}){super(e),this.setIcon(e.icon),this.setTitle(e.title),void 0!==e.activeStatus&&(this.activeStatus=e.activeStatus)}setIcon(e){return this.icon=e instanceof Array?e:[e,e],this}setTitle(e){return this.title=e,this}active(){$(`${this.props.id}-icon`).image=$image(this.icon[1]),$(`${this.props.id}-icon`).tintColor=$color("systemLink"),$(`${this.props.id}-title`).textColor=$color("systemLink"),this.activeStatus=!0}inactive(){$(`${this.props.id}-icon`).image=$image(this.icon[0]),$(`${this.props.id}-icon`).tintColor=$color("lightGray"),$(`${this.props.id}-title`).textColor=$color("lightGray"),this.activeStatus=!1}getView(){return this.views=[{type:"image",props:{id:`${this.props.id}-icon`,image:$image(this.activeStatus?this.icon[1]:this.icon[0]),bgcolor:$color("clear"),tintColor:$color(this.activeStatus?"systemLink":"lightGray")},layout:(e,t)=>{e.centerX.equalTo(t.super);const i=$7dfcabb1e936a92c$var$TabBarController.tabBarHeight/2;e.size.equalTo(i),e.top.inset(($7dfcabb1e936a92c$var$TabBarController.tabBarHeight-i-13)/2)}},{type:"label",props:{id:`${this.props.id}-title`,text:this.title,font:$font(10),textColor:$color(this.activeStatus?"systemLink":"lightGray")},layout:(e,t)=>{e.centerX.equalTo(t.prev),e.top.equalTo(t.prev.bottom).offset(3)}}],this}}class $7dfcabb1e936a92c$var$TabBarHeaderView extends $7dfcabb1e936a92c$require$View{height=60;getView(){return this.type="view",this.setProp("bgcolor",this.props.bgcolor??$7dfcabb1e936a92c$require$UIKit.primaryViewBackgroundColor),this.layout=(e,t)=>{e.left.right.bottom.equalTo(t.super),e.top.equalTo(t.super.safeAreaBottom).offset(-this.height-$7dfcabb1e936a92c$var$TabBarController.tabBarHeight)},this.views=[$7dfcabb1e936a92c$require$View.create({props:this.props,views:this.views,layout:(e,t)=>{e.left.right.top.equalTo(t.super),e.height.equalTo(this.height)}})],this}}class $7dfcabb1e936a92c$var$TabBarController extends $7dfcabb1e936a92c$require$Controller{static tabBarHeight=50;#A={};#L={};#R;#D;#F=$text.uuid;#z=$text.uuid;bottomSafeAreaInsets=$app.isDebugging?0:$7dfcabb1e936a92c$require$UIKit.bottomSafeAreaInsets;get selected(){return this.#D}set selected(e){this.switchPageTo(e)}get contentOffset(){return $7dfcabb1e936a92c$var$TabBarController.tabBarHeight+(this.#R?.height??0)}setPages(e={}){return Object.keys(e).forEach((t=>this.setPage(t,e[t]))),this}setPage(e,t){return void 0===this.#D&&(this.#D=e),this.#A[e]=t instanceof $7dfcabb1e936a92c$require$PageView?t:$7dfcabb1e936a92c$require$PageView.create(t),this.#D!==e&&(this.#A[e].activeStatus=!1),this}switchPageTo(e){if(this.#A[e]){if(this.#D===e)return;$ui.animate({duration:.4,animation:()=>{this.#L[e].active()}}),this.#L[this.#D].inactive(),this.#A[this.#D].hide(),this.#A[e].show(),this.callEvent("onChange",this.#D,e),this.#D=e,this.initBackground()}}hideBackground(e=!0){$(this.#z).hidden=!0,$ui.animate({duration:e?.2:1e-4,animation:()=>{$(this.#F).alpha=0}})}showBackground(e=!0){$(this.#z).hidden=!1,$ui.animate({duration:e?.2:1e-4,animation:()=>{$(this.#F).alpha=1}})}initBackground(){const e=this.#A[this.selected];e.scrollable()&&$delay(0,(()=>{const t=$(e.id).get(e.scrollableView.id),i=t.contentOffset.y;t.contentSize.height+this.bottomSafeAreaInsets-t.frame.height-i<=0?this.hideBackground(!1):this.showBackground(!1)}))}setCells(e={}){return Object.keys(e).forEach((t=>this.setCell(t,e[t]))),this}setCell(e,t){return void 0===this.#D&&(this.#D=e),t instanceof $7dfcabb1e936a92c$var$TabBarCellView||(t=new $7dfcabb1e936a92c$var$TabBarCellView({props:{info:{key:e}},icon:t.icon,title:t.title,activeStatus:this.#D===e})),this.#L[e]=t,this}setHeader(e){return this.#R=e,this}#M(){const e=[];return Object.values(this.#L).forEach((t=>{t.setEvent("tapped",(e=>{const t=e.info.key;this.switchPageTo(t)})),e.push(t.getView())})),e}#P(){return Object.values(this.#A).map((e=>{if(e.scrollable()){const t=e.scrollableView;if(t.props.indicatorInsets){const e=t.props.indicatorInsets;t.props.indicatorInsets=$insets(e.top,e.left,e.bottom+this.contentOffset,e.right)}else t.props.indicatorInsets=$insets(0,0,this.contentOffset,0);t.props.footer=Object.assign({props:{}},t.props.footer??{}),t.props.footer.props.height?t.props.footer.props.height+=this.contentOffset:t.props.footer.props.height=this.contentOffset,"function"==typeof t.assignEvent&&t.assignEvent("didScroll",(e=>{const t=e.contentOffset.y;e.contentSize.height+this.bottomSafeAreaInsets-e.frame.height-t<=0?this.hideBackground():this.showBackground()}))}return e.definition}))}generateView(){const e={type:"view",layout:(e,t)=>{e.centerX.equalTo(t.super),e.width.equalTo(t.super),e.top.equalTo(t.super.safeAreaBottom).offset(-$7dfcabb1e936a92c$var$TabBarController.tabBarHeight),e.bottom.equalTo(t.super)},views:[$7dfcabb1e936a92c$require$UIKit.blurBox({id:this.#F}),{type:"stack",layout:$layout.fillSafeArea,props:{axis:$stackViewAxis.horizontal,distribution:$stackViewDistribution.fillEqually,spacing:0,stack:{views:this.#M()}}},$7dfcabb1e936a92c$require$UIKit.separatorLine({id:this.#z},$7dfcabb1e936a92c$require$UIKit.align.top)],events:{ready:()=>this.initBackground()}};return $7dfcabb1e936a92c$require$View.createFromViews(this.#P().concat(this.#R?.definition??[],e))}}$7dfcabb1e936a92c$exports={TabBarCellView:$7dfcabb1e936a92c$var$TabBarCellView,TabBarHeaderView:$7dfcabb1e936a92c$var$TabBarHeaderView,TabBarController:$7dfcabb1e936a92c$var$TabBarController};var $bb0fea222fc5aea5$require$TabBarCellView=$7dfcabb1e936a92c$exports.TabBarCellView,$bb0fea222fc5aea5$require$TabBarHeaderView=$7dfcabb1e936a92c$exports.TabBarHeaderView,$bb0fea222fc5aea5$require$TabBarController=$7dfcabb1e936a92c$exports.TabBarController,$3839e9f9bae78bdd$exports={};class $3839e9f9bae78bdd$var$Tasks{#H={};addTask(e,t=0){const i=$text.uuid;return this.#H[i]=$delay(t,(async()=>{await e(),delete this.#H[i]})),i}cancelTask(e){this.#H[e].cancel()}clearTasks(){Object.values(this.#H).forEach((e=>e.cancel()))}}$3839e9f9bae78bdd$exports={Tasks:$3839e9f9bae78bdd$var$Tasks};var $bb0fea222fc5aea5$require$Tasks=$3839e9f9bae78bdd$exports.Tasks,$45Ip7=parcelRequire("45Ip7"),$bb0fea222fc5aea5$require$UIKit=$45Ip7.UIKit,$86d2ffde19fb8791$exports={};class $86d2ffde19fb8791$var$UILoading{#U;text="";interval;fullScreen=!1;#j=()=>{};constructor(){this.#U=$text.uuid}updateText(e){$(this.#U).text=e}setLoop(e){if("function"!=typeof e)throw"loop must be a function";this.#j=e}done(){clearInterval(this.interval)}load(){$ui.render({props:{navBarHidden:this.fullScreen},views:[{type:"spinner",props:{loading:!0},layout:(e,t)=>{e.centerY.equalTo(t.super).offset(-15),e.width.equalTo(t.super)}},{type:"label",props:{id:this.#U,align:$align.center,text:""},layout:(e,t)=>{e.top.equalTo(t.prev.bottom).offset(10),e.left.right.equalTo(t.super)}}],layout:$layout.fill,events:{appeared:()=>{this.interval=setInterval((()=>{this.#j()}),100)}}})}}$86d2ffde19fb8791$exports={UILoading:$86d2ffde19fb8791$var$UILoading};var $bb0fea222fc5aea5$require$UILoading=$86d2ffde19fb8791$exports.UILoading,$6Xrbz=parcelRequire("6Xrbz"),$bb0fea222fc5aea5$require$ValidationError=$6Xrbz.ValidationError,$liCrE=parcelRequire("liCrE"),$bb0fea222fc5aea5$require$View=$liCrE.View,$bb0fea222fc5aea5$require$PageView=$liCrE.PageView,$gMc1q=parcelRequire("gMc1q"),$bb0fea222fc5aea5$require$ViewController=$gMc1q.ViewController,$12xzj=parcelRequire("12xzj"),$bb0fea222fc5aea5$require$NavigationView=$12xzj.NavigationView,$dcStC=parcelRequire("dcStC"),$bb0fea222fc5aea5$require$NavigationBar=$dcStC.NavigationBar,$bb0fea222fc5aea5$require$NavigationBarController=$dcStC.NavigationBarController,$gAYmG=parcelRequire("gAYmG"),$bb0fea222fc5aea5$require$NavigationBarItems=$gAYmG.NavigationBarItems,$bb0fea222fc5aea5$require$BarButtonItem=$gAYmG.BarButtonItem,$ee5e1f8d12d987dc$exports={},$fYz8N=parcelRequire("fYz8N"),$ee5e1f8d12d987dc$require$Controller=$fYz8N.Controller,$gAYmG=parcelRequire("gAYmG"),$ee5e1f8d12d987dc$require$BarTitleView=$gAYmG.BarTitleView;class $ee5e1f8d12d987dc$var$SearchBar extends $ee5e1f8d12d987dc$require$BarTitleView{height=35;topOffset=15;bottomOffset=10;kbType=$kbType.search;placeholder=$l10n("SEARCH");constructor(e){super(e),this.setController(new $ee5e1f8d12d987dc$var$SearchBarController),this.controller.setSearchBar(this),this.init()}init(){this.props={id:this.id,smoothCorners:!0,cornerRadius:6,bgcolor:$color("#EEF1F1","#212121")},this.views=[{type:"input",props:{id:this.id+"-input",type:this.kbType,bgcolor:$color("clear"),placeholder:this.placeholder},layout:$layout.fill,events:{changed:e=>this.controller.callEvent("onChange",e.text)}}],this.layout=(e,t)=>{e.height.equalTo(this.height),e.top.equalTo(t.super.safeArea).offset(this.topOffset),e.left.equalTo(t.super.safeArea).offset(15),e.right.equalTo(t.super.safeArea).offset(-15)}}setPlaceholder(e){return this.placeholder=e,this}setKbType(e){return this.kbType=e,this}}class $ee5e1f8d12d987dc$var$SearchBarController extends $ee5e1f8d12d987dc$require$Controller{setSearchBar(e){return this.searchBar=e,this}updateSelector(){this.selector={inputBox:$(this.searchBar.id),input:$(this.searchBar.id+"-input")}}hide(){this.updateSelector(),this.selector.inputBox.updateLayout((e=>{e.height.equalTo(0)}))}show(){this.updateSelector(),this.selector.inputBox.updateLayout((e=>{e.height.equalTo(this.searchBar.height)}))}didScroll(e){this.updateSelector();let t=this.searchBar.height-e;if(t=t>0?t>this.searchBar.height?this.searchBar.height:t:0,this.selector.inputBox.updateLayout((e=>{e.height.equalTo(t)})),e>0){const t=(this.searchBar.height/2-5-e)/10;this.selector.input.alpha=t}else this.selector.input.alpha=1}didEndDragging(e,t,i){this.updateSelector(),e>=0&&e<=this.searchBar.height&&i($point(0,e>=this.searchBar.height/2?this.searchBar.height:0))}}$ee5e1f8d12d987dc$exports={SearchBar:$ee5e1f8d12d987dc$var$SearchBar,SearchBarController:$ee5e1f8d12d987dc$var$SearchBarController};var $bb0fea222fc5aea5$require$SearchBar=$ee5e1f8d12d987dc$exports.SearchBar,$bb0fea222fc5aea5$require$SearchBarController=$ee5e1f8d12d987dc$exports.SearchBarController;module.exports={VERSION:$bb0fea222fc5aea5$require$VERSION,Controller:$bb0fea222fc5aea5$require$Controller,FileManager:$bb0fea222fc5aea5$require$FileManager,FileStorageParameterError:$bb0fea222fc5aea5$require$FileStorageParameterError,FileStorageFileNotFoundError:$bb0fea222fc5aea5$require$FileStorageFileNotFoundError,FileStorage:$bb0fea222fc5aea5$require$FileStorage,FixedFooterView:$bb0fea222fc5aea5$require$FixedFooterView,Kernel:$bb0fea222fc5aea5$require$Kernel,Matrix:$bb0fea222fc5aea5$require$Matrix,Request:$bb0fea222fc5aea5$require$Request,Setting:$bb0fea222fc5aea5$require$Setting,Sheet:$bb0fea222fc5aea5$require$Sheet,TabBarCellView:$bb0fea222fc5aea5$require$TabBarCellView,TabBarHeaderView:$bb0fea222fc5aea5$require$TabBarHeaderView,TabBarController:$bb0fea222fc5aea5$require$TabBarController,Tasks:$bb0fea222fc5aea5$require$Tasks,UIKit:$bb0fea222fc5aea5$require$UIKit,UILoading:$bb0fea222fc5aea5$require$UILoading,ValidationError:$bb0fea222fc5aea5$require$ValidationError,View:$bb0fea222fc5aea5$require$View,PageView:$bb0fea222fc5aea5$require$PageView,ViewController:$bb0fea222fc5aea5$require$ViewController,NavigationView:$bb0fea222fc5aea5$require$NavigationView,NavigationBar:$bb0fea222fc5aea5$require$NavigationBar,NavigationBarController:$bb0fea222fc5aea5$require$NavigationBarController,NavigationBarItems:$bb0fea222fc5aea5$require$NavigationBarItems,BarButtonItem:$bb0fea222fc5aea5$require$BarButtonItem,SearchBar:$bb0fea222fc5aea5$require$SearchBar,SearchBarController:$bb0fea222fc5aea5$require$SearchBarController}; \ No newline at end of file +var $parcel$global="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},$parcel$modules={},$parcel$inits={},parcelRequire=$parcel$global.parcelRequire94c2;null==parcelRequire&&(parcelRequire=function(e){if(e in $parcel$modules)return $parcel$modules[e].exports;if(e in $parcel$inits){var t=$parcel$inits[e];delete $parcel$inits[e];var i={id:e,exports:{}};return $parcel$modules[e]=i,t.call(i.exports,i,i.exports),i.exports}var a=new Error("Cannot find module '"+e+"'");throw a.code="MODULE_NOT_FOUND",a},parcelRequire.register=function(e,t){$parcel$inits[e]=t},$parcel$global.parcelRequire94c2=parcelRequire),parcelRequire.register("45Ip7",(function(e,t){class i{static#e=$objc("UIApplication").$sharedApplication();static align={left:0,right:1,top:2,bottom:3};static textColor=$color("primaryText");static linkColor=$color("systemLink");static primaryViewBackgroundColor=$color("primarySurface");static scrollViewBackgroundColor=$color("insetGroupedBackground");static scrollViewList=["list","matrix"];static isLargeScreen=$device.isIpad||$device.isIpadPro;static get windowSize(){return $objc("UIWindow").$keyWindow().jsValue().size}static NavigationBarNormalHeight=$objc("UINavigationController").invoke("alloc.init").$navigationBar().jsValue().frame.height;static NavigationBarLargeTitleHeight=$objc("UITabBarController").invoke("alloc.init").$tabBar().jsValue().frame.height+i.NavigationBarNormalHeight;static get isSplitScreenMode(){return i.isLargeScreen&&$device.info.screen.width!==i.windowSize.width}static get topSafeAreaInsets(){return i.#e?.$keyWindow()?.$safeAreaInsets()?.top??0}static get bottomSafeAreaInsets(){return i.#e?.$keyWindow()?.$safeAreaInsets()?.bottom??0}static get statusBarOrientation(){return i.#e.$statusBarOrientation()}static get consoleBarHeight(){if($app.isDebugging){let e=i.#e.$statusBarFrame().height+26;return $device.isIphoneX&&(e+=30),e}return 0}static get isHorizontal(){return 3===i.statusBarOrientation||4===i.statusBarOrientation}static loading(){const e=$ui.create(i.blurBox({cornerRadius:15},[{type:"spinner",props:{loading:!0,style:0},layout:(e,t)=>{e.size.equalTo(t.prev),e.center.equalTo(t.super)}}]));return{start:()=>{$ui.controller.view.insertAtIndex(e,0),e.layout(((e,t)=>{e.center.equalTo(t.super);const a=Math.min(.6*i.windowSize.width,300);e.size.equalTo($size(a,a))})),e.moveToFront()},end:()=>{e.remove()}}}static defaultBackgroundColor(e){return i.scrollViewList.indexOf(e)>-1?i.scrollViewBackgroundColor:i.primaryViewBackgroundColor}static separatorLine(e={},t=i.align.bottom){return{type:"canvas",props:e,layout:(e,a)=>{void 0===a.prev?e.top.equalTo(a.super):t===i.align.bottom?e.top.equalTo(a.prev.bottom):e.top.equalTo(a.prev.top),e.height.equalTo(1/$device.info.screen.scale),e.left.right.inset(0)},events:{draw:(t,i)=>{i.strokeColor=e.bgcolor??$color("separatorColor"),i.setLineWidth(1),i.moveToPoint(0,0),i.addLineToPoint(t.frame.width,0),i.strokePath()}}}}static blurBox(e={},t=[],i=$layout.fill){return{type:"blur",props:Object.assign({style:$blurStyle.thinMaterial},e),views:t,layout:i}}static getContentSize(e,t="A"){return $text.sizeThatFits({text:t,width:i.windowSize.width,font:e})}static push({views:e,statusBarStyle:t=0,title:i="",navButtons:a=[{title:""}],bgcolor:r=e[0]?.props?.bgcolor??"primarySurface",disappeared:s}={}){$ui.push({props:{statusBarStyle:t,navButtons:a,title:i,bgcolor:"string"==typeof r?$color(r):r},events:{disappeared:()=>{void 0!==s&&s()}},views:[{type:"view",views:e,layout:(e,t)=>{e.top.equalTo(t.super.safeArea),e.bottom.equalTo(t.super),e.left.right.equalTo(t.super.safeArea)}}]})}}e.exports={UIKit:i}})),parcelRequire.register("7D8Kb",(function(module,exports){var $fYz8N=parcelRequire("fYz8N"),$58e2f5443faff7c0$require$Controller=$fYz8N.Controller,$8aDdQ=parcelRequire("8aDdQ"),$58e2f5443faff7c0$require$FileStorageFileNotFoundError=$8aDdQ.FileStorageFileNotFoundError,$58e2f5443faff7c0$require$FileStorage=$8aDdQ.FileStorage,$cgaQ6=parcelRequire("cgaQ6"),$58e2f5443faff7c0$require$Kernel=$cgaQ6.Kernel,$45Ip7=parcelRequire("45Ip7"),$58e2f5443faff7c0$require$UIKit=$45Ip7.UIKit,$aXWmO=parcelRequire("aXWmO"),$58e2f5443faff7c0$require$Sheet=$aXWmO.Sheet,$12xzj=parcelRequire("12xzj"),$58e2f5443faff7c0$require$NavigationView=$12xzj.NavigationView,$dcStC=parcelRequire("dcStC"),$58e2f5443faff7c0$require$NavigationBar=$dcStC.NavigationBar,$gMc1q=parcelRequire("gMc1q"),$58e2f5443faff7c0$require$ViewController=$gMc1q.ViewController;class SettingLoadConfigError extends Error{constructor(){super("Call loadConfig() first."),this.name="SettingLoadConfigError"}}class SettingReadonlyError extends Error{constructor(){super("Attempted to assign to readonly property."),this.name="SettingReadonlyError"}}class Setting extends $58e2f5443faff7c0$require$Controller{name;setting={};userData;fileStorage;imagePath;viewController=new $58e2f5443faff7c0$require$ViewController;method={readme:()=>{const e=(()=>{const e=$device.info?.language?.startsWith("zh")?"README_CN.md":"README.md";try{return __README__[e]??__README__["README.md"]}catch{return $file.read(e)?.string??$file.read("README.md")?.string}})();(new $58e2f5443faff7c0$require$Sheet).setView({type:"markdown",props:{content:e},layout:(e,t)=>{e.size.equalTo(t.super)}}).init().present()}};rowHeight=50;edgeOffset=10;iconSize=30;#t={};#i=!1;#a=!1;#r;constructor(e={}){super(),"function"==typeof e.set&&"function"==typeof e.get?(this.set=e.set,this.get=e.get,this.userData=e.userData):(this.fileStorage=e.fileStorage??new $58e2f5443faff7c0$require$FileStorage,this.dataFile=e.dataFile??"setting.json"),e.structure?this.setStructure(e.structure):this.setStructurePath(e.structurePath??"setting.json"),this.isUseJsboxNav=e.isUseJsboxNav??!1,this.imagePath=(e.name??"default")+".image",this.setName(e.name??$text.uuid),this.loadL10n()}useJsboxNav(){return this.isUseJsboxNav=!0,this}#s(){if(!this.#a)throw new SettingLoadConfigError}loadConfig(){const e=["script","info"],t=this.userData??this.fileStorage.readAsJSON("",this.dataFile,{});return this.setting=function i(a){const r={};for(let s of a)for(let a of s.items)if("child"===a.type){const e=i(a.children);Object.assign(r,e)}else-1===e.indexOf(a.type)?r[a.key]=a.key in t?t[a.key]:a.value:r[a.key]=a.value;return r}(this.structure),this.#a=!0,this}hasSectionTitle(e){return this.#s(),!!e[0].title}loadL10n(){$58e2f5443faff7c0$require$Kernel.l10n("zh-Hans",'\n "OK" = "好";\n "DONE" = "完成";\n "CANCEL" = "取消";\n "CLEAR" = "清除";\n "BACK" = "返回";\n "ERROR" = "发生错误";\n "SUCCESS" = "成功";\n "LOADING" = "加载中";\n "INVALID_VALUE" = "非法参数";\n "CONFIRM_CHANGES" = "数据已变化,确认修改?";\n \n "SETTING" = "设置";\n "GENERAL" = "一般";\n "ADVANCED" = "高级";\n "TIPS" = "小贴士";\n "COLOR" = "颜色";\n "COPY" = "复制";\n "COPIED" = "复制成功";\n \n "JSBOX_ICON" = "JSBox 内置图标";\n "SF_SYMBOLS" = "SF Symbols";\n "IMAGE_BASE64" = "图片 / base64";\n\n "PREVIEW" = "预览";\n "SELECT_IMAGE" = "选择图片";\n "CLEAR_IMAGE" = "清除图片";\n "NO_IMAGE" = "无图片";\n \n "ABOUT" = "关于";\n "VERSION" = "Version";\n "AUTHOR" = "作者";\n "AT_BOTTOM" = "已经到底啦~";\n ',!1),$58e2f5443faff7c0$require$Kernel.l10n("en",'\n "OK" = "OK";\n "DONE" = "Done";\n "CANCEL" = "Cancel";\n "CLEAR" = "Clear";\n "BACK" = "Back";\n "ERROR" = "Error";\n "SUCCESS" = "Success";\n "LOADING" = "Loading";\n "INVALID_VALUE" = "Invalid value";\n "CONFIRM_CHANGES" = "The data has changed, confirm the modification?";\n\n "SETTING" = "Setting";\n "GENERAL" = "General";\n "ADVANCED" = "Advanced";\n "TIPS" = "Tips";\n "COLOR" = "Color";\n "COPY" = "Copy";\n "COPIED" = "Copide";\n\n "JSBOX_ICON" = "JSBox in app icon";\n "SF_SYMBOLS" = "SF Symbols";\n "IMAGE_BASE64" = "Image / base64";\n\n "PREVIEW" = "Preview";\n "SELECT_IMAGE" = "Select Image";\n "CLEAR_IMAGE" = "Clear Image";\n "NO_IMAGE" = "No Image";\n\n "ABOUT" = "About";\n "VERSION" = "Version";\n "AUTHOR" = "Author";\n "AT_BOTTOM" = "It\'s the end~";\n ',!1)}setUserData(e){this.userData=e}setStructure(e){return this.structure=e,this}setStructurePath(e){return this.structure||this.setStructure($58e2f5443faff7c0$require$FileStorage.readFromRootAsJSON(e)),this}setName(e){return this.name=e,this}setFooter(e){return this.#r=e,this}set footer(e){this.#r=e}get footer(){if(void 0===this.#r){let e=$58e2f5443faff7c0$require$FileStorage.readFromRootAsJSON("config.json",{}).info??{};if(!e.version||!e.author)try{e=__INFO__}catch{}this.#r={},e.version&&e.author&&(this.#r={type:"view",props:{height:70},views:[{type:"label",props:{font:$font(14),text:`${$l10n("VERSION")} ${e.version} ♥ ${e.author}`,textColor:$color({light:"#C0C0C0",dark:"#545454"}),align:$align.center},layout:e=>{e.left.right.inset(0),e.top.inset(10)}}]})}return this.#r}setReadonly(){return this.#i=!0,this}set(e,t){if(this.#i)throw new SettingReadonlyError;return this.#s(),this.setting[e]=t,this.fileStorage.write("",this.dataFile,$data({string:JSON.stringify(this.setting)})),this.callEvent("onSet",e,t),!0}get(e,t=null){return this.#s(),Object.prototype.hasOwnProperty.call(this.setting,e)?this.setting[e]:t}getColor(e){return"string"==typeof e?$color(e):$rgba(e.red,e.green,e.blue,e.alpha)}getImageName(e,t=!1){let i=$text.MD5(e)+".jpg";return t&&(i="compress."+i),i}getImage(e,t=!1){try{const i=this.getImageName(e,t);return this.fileStorage.read(this.imagePath,i).image}catch(e){if(e instanceof $58e2f5443faff7c0$require$FileStorageFileNotFoundError)return null;throw e}}getId(e){return`setting-${this.name}-${e}`}#o(e){$(e).bgcolor=$color("systemFill")}#n(e,t=.3){0===t?$(e).bgcolor=$color("clear"):$ui.animate({duration:t,animation:()=>{$(e).bgcolor=$color("clear")}})}#l(e,t,i=!1,a=0){if(t=Object.assign(t,{touchesBegan:()=>{this.#o(e),this.#t[e]=$delay(1,(()=>this.#n(e,0)))},touchesMoved:()=>{this.#t[e]?.cancel(),this.#n(e,0)}}),i){const i=t.tapped;t.tapped=()=>{this.#o(e),setTimeout((()=>this.#n(e)),1e3*a),"function"==typeof i&&i()}}return t}createLineLabel(e,t){return t[1]||(t[1]="#00CC00"),"object"!=typeof t[1]&&(t[1]=[t[1],t[1]]),"object"!=typeof t[0]&&(t[0]=[t[0],t[0]]),{type:"view",views:[{type:"view",props:{bgcolor:$color(t[1][0],t[1][1]),cornerRadius:5,smoothCorners:!0},views:[{type:"image",props:{tintColor:$color("white"),image:$image(t[0][0],t[0][1])},layout:(e,t)=>{e.center.equalTo(t.super),e.size.equalTo(20)}}],layout:(e,t)=>{e.centerY.equalTo(t.super),e.size.equalTo(this.iconSize),e.left.inset(this.edgeOffset)}},{type:"label",props:{text:e,lines:1,textColor:this.textColor,align:$align.left},layout:(e,t)=>{e.centerY.equalTo(t.super),e.height.equalTo(t.super),e.left.equalTo(t.prev.right).offset(this.edgeOffset),e.width.greaterThanOrEqualTo(10)}}],layout:(e,t)=>{e.height.centerY.equalTo(t.super),e.left.inset(0)}}}createInfo(e,t,i){const a=Array.isArray(i),r=a?i[0]:i,s=a?i[1]:i;return{type:"view",props:{selectable:!0},views:[this.createLineLabel(t,e),{type:"label",props:{text:r,align:$align.right,textColor:$color("darkGray")},layout:(e,t)=>{e.centerY.equalTo(t.prev),e.right.inset(this.edgeOffset),e.width.equalTo(180)}},{type:"view",events:{tapped:()=>{$ui.alert({title:t,message:s,actions:[{title:$l10n("COPY"),handler:()=>{$clipboard.text=s,$ui.toast($l10n("COPIED"))}},{title:$l10n("OK")}]})}},layout:(e,t)=>{e.right.inset(0),e.size.equalTo(t.super)}}],layout:$layout.fill}}createSwitch(e,t,i){return{type:"view",props:{id:this.getId(e),selectable:!0},views:[this.createLineLabel(i,t),{type:"switch",props:{on:this.get(e),onColor:$color("#00CC00")},events:{changed:t=>{try{this.set(e,t.on)}catch(e){throw t.on=!t.on,e}}},layout:(e,t)=>{e.centerY.equalTo(t.prev),e.right.inset(this.edgeOffset)}}],layout:$layout.fill}}createString(e,t,i){return{type:"view",props:{id:this.getId(e),selectable:!0},views:[this.createLineLabel(i,t),{type:"button",props:{symbol:"square.and.pencil",bgcolor:$color("clear"),tintColor:$color("primaryText")},events:{tapped:t=>{const i=$ui.popover({sourceView:t,sourceRect:t.bounds,directions:$popoverDirection.down,size:$size(320,150),views:[{type:"text",props:{id:`${this.name}-string-${e}`,align:$align.left,text:this.get(e)},layout:e=>{e.left.right.inset(10),e.top.inset(20),e.height.equalTo(90)}},{type:"button",props:{symbol:"checkmark",bgcolor:$color("clear"),titleEdgeInsets:10,contentEdgeInsets:0},layout:e=>{e.right.inset(10),e.bottom.inset(25),e.size.equalTo(30)},events:{tapped:()=>{this.set(e,$(`${this.name}-string-${e}`).text),i.dismiss()}}}]})}},layout:(e,t)=>{e.centerY.equalTo(t.prev),e.right.inset(0),e.size.equalTo(50)}}],layout:$layout.fill}}createStepper(e,t,i,a,r){const s=this.getId(e),o=`${s}-label`;return{type:"view",props:{id:s,selectable:!0},views:[this.createLineLabel(i,t),{type:"label",props:{id:o,text:this.get(e),textColor:this.textColor,align:$align.left},layout:(e,t)=>{e.height.equalTo(t.super),e.right.inset(120)}},{type:"stepper",props:{min:a,max:r,value:this.get(e)},events:{changed:t=>{$(o).text=t.value;try{this.set(e,t.value)}catch(t){throw $(o).text=this.get(e),t}}},layout:(e,t)=>{e.centerY.equalTo(t.prev),e.right.inset(this.edgeOffset)}}],layout:$layout.fill}}createScript(key,icon,title,script){const id=this.getId(key),buttonId=`${id}-button`,actionStart=()=>{$(buttonId).alpha=0,$(`${buttonId}-spinner`).alpha=1,this.#o(id)},actionCancel=()=>{$(buttonId).alpha=1,$(`${buttonId}-spinner`).alpha=0,this.#n(id)},actionDone=(e=!0,t=$l10n("ERROR"))=>{$(`${buttonId}-spinner`).alpha=0,this.#n(id);const i=$(buttonId);if(!e)return $ui.toast(t),void(i.alpha=1);i.symbol="checkmark",$ui.animate({duration:.6,animation:()=>{i.alpha=1},completion:()=>{setTimeout((()=>{$ui.animate({duration:.4,animation:()=>{i.alpha=0},completion:()=>{i.symbol="chevron.right",$ui.animate({duration:.4,animation:()=>{i.alpha=1},completion:()=>{i.alpha=1}})}})}),600)}})};return{type:"view",props:{id:id},views:[this.createLineLabel(title,icon),{type:"view",views:[{type:"image",props:{id:buttonId,symbol:"chevron.right",tintColor:$color("secondaryText")},layout:(e,t)=>{e.centerY.equalTo(t.super),e.right.inset(0),e.size.equalTo(15)}},{type:"spinner",props:{id:`${buttonId}-spinner`,loading:!0,alpha:0},layout:(e,t)=>{e.size.equalTo(t.prev),e.left.top.equalTo(t.prev)}}],layout:(e,t)=>{e.right.inset(this.edgeOffset),e.height.equalTo(this.rowHeight),e.width.equalTo(t.super)}}],events:this.#l(id,{tapped:()=>{const animate={actionStart:actionStart,actionCancel:actionCancel,actionDone:actionDone,touchHighlightStart:()=>this.#o(id),touchHighlightEnd:()=>this.#n(id)};"function"==typeof script?script(animate):script.startsWith("this")?eval(`(()=>{return ${script}(animate)})()`):eval(script)}}),layout:$layout.fill}}createTab(key,icon,title,items,values){"string"==typeof items?items=eval(`(()=>{return ${items}()})()`):"function"==typeof items&&(items=items()),"string"==typeof values?values=eval(`(()=>{return ${values}()})()`):"function"==typeof values&&(values=values());const id=this.getId(key),isCustomizeValues=items?.length>0&&values?.length===items?.length;return{type:"view",props:{id:id,selectable:!0},views:[this.createLineLabel(title,icon),{type:"tab",props:{items:items??[],index:isCustomizeValues?values.indexOf(this.get(key)):this.get(key),dynamicWidth:!0},layout:(e,t)=>{e.right.inset(this.edgeOffset),e.centerY.equalTo(t.prev)},events:{changed:e=>{isCustomizeValues?this.set(key,values[e.index]):this.set(key,e.index)}}}],layout:$layout.fill}}createMenu(key,icon,title,items,values){const id=this.getId(key),labelId=`${id}-label`,getItems=()=>{let res;return res="string"==typeof items?eval(`(()=>{return ${items}()})()`):"function"==typeof items?items():items??[],res},getValues=()=>{let res;return res="string"==typeof values?eval(`(()=>{return ${values}()})()`):"function"==typeof values?values():values,res},tmpItems=getItems(),tmpValues=getValues(),isCustomizeValues=tmpItems?.length>0&&tmpValues?.length===tmpItems?.length;return{type:"view",props:{id:id,selectable:!0},views:[this.createLineLabel(title,icon),{type:"view",views:[{type:"label",props:{text:isCustomizeValues?tmpItems[tmpValues.indexOf(this.get(key))]:tmpItems[this.get(key)],color:$color("secondaryText"),id:labelId},layout:(e,t)=>{e.right.inset(0),e.height.equalTo(t.super)}}],layout:(e,t)=>{e.right.inset(this.edgeOffset),e.height.equalTo(this.rowHeight),e.width.equalTo(t.super)}}],events:{tapped:()=>{const e=getItems(),t=getValues();$ui.menu({items:e,handler:(e,i)=>{isCustomizeValues?this.set(key,t[i]):this.set(key,i),$(labelId).text=$l10n(e)}})}},layout:$layout.fill}}createColor(e,t,i){const a=this.getId(e),r=`${a}-color`;return{type:"view",props:{id:a,selectable:!0},views:[this.createLineLabel(i,t),{type:"view",views:[{type:"view",props:{id:r,bgcolor:this.getColor(this.get(e)),circular:!0,borderWidth:1,borderColor:$color("#e3e3e3")},layout:(e,t)=>{e.centerY.equalTo(t.super),e.right.inset(this.edgeOffset),e.size.equalTo(20)}},{type:"view",events:{tapped:async()=>{const t=await $picker.color({color:this.getColor(this.get(e))});this.set(e,t.components),$(r).bgcolor=$rgba(t.components.red,t.components.green,t.components.blue,t.components.alpha)}},layout:(e,t)=>{e.right.inset(0),e.height.width.equalTo(t.super.height)}}],layout:(e,t)=>{e.height.equalTo(this.rowHeight),e.width.equalTo(t.super)}}],layout:$layout.fill}}createDate(e,t,i,a=2){const r=this.getId(e),s=e=>{let t="";switch("number"==typeof e&&(e=new Date(e)),a){case 0:t=e.toLocaleTimeString();break;case 1:t=e.toLocaleDateString();break;case 2:t=e.toLocaleString()}return t};return{type:"view",props:{id:r,selectable:!0},views:[this.createLineLabel(i,t),{type:"view",views:[{type:"label",props:{id:`${r}-label`,color:$color("secondaryText"),text:this.get(e)?s(this.get(e)):"None"},layout:(e,t)=>{e.right.inset(0),e.height.equalTo(t.super)}}],events:{tapped:async()=>{const t=this.get(e),i=await $picker.date({props:{mode:a,date:t||Date.now()}});this.set(e,i.getTime()),$(`${r}-label`).text=s(i)}},layout:(e,t)=>{e.right.inset(this.edgeOffset),e.height.equalTo(this.rowHeight),e.width.equalTo(t.super)}}],layout:$layout.fill}}createNumber(e,t,i){return this.createInput(e,t,i,!1,$kbType.decimal,(t=>""!==t&&/^[0-9]+.?[0-9]*$/.test(t)?this.set(e,Number(t)):($ui.toast($l10n("INVALID_VALUE")),!1)))}createInput(e,t,i,a=!1,r=$kbType.default,s){void 0===s&&(s=t=>this.set(e,t));const o=this.getId(e),n=o+"-input";return{type:"view",props:{id:o,selectable:!0},views:[this.createLineLabel(i,t),{type:"input",props:{id:n,type:r,align:$align.right,bgcolor:$color("clear"),textColor:$color("secondaryText"),text:this.get(e),font:$font(16),secure:a,accessoryView:$58e2f5443faff7c0$require$UIKit.blurBox({height:44},[$58e2f5443faff7c0$require$UIKit.separatorLine({},$58e2f5443faff7c0$require$UIKit.align.top),{type:"button",props:{title:$l10n("DONE"),bgcolor:$color("clear"),titleColor:$color("primaryText")},layout:(e,t)=>{e.right.inset(this.edgeOffset),e.centerY.equalTo(t.super)},events:{tapped:()=>{$(n).blur()}}},{type:"button",props:{title:$l10n("CANCEL"),bgcolor:$color("clear"),titleColor:$color("primaryText")},layout:(e,t)=>{e.left.inset(this.edgeOffset),e.centerY.equalTo(t.super)},events:{tapped:()=>{const t=$(n),i=this.get(e,"");t.text!==i&&(t.text=i),t.blur()}}}])},layout:(t,i)=>{t.left.equalTo(i.prev.get("label").right).offset(this.edgeOffset),t.right.inset(this.edgeOffset);const a=$58e2f5443faff7c0$require$UIKit.getContentSize($font(16),this.get(e)).width;t.width.greaterThanOrEqualTo(a+30),t.height.equalTo(i.super)},events:{didBeginEditing:e=>{e.secure=!1,$app.autoKeyboardEnabled||($app.autoKeyboardEnabled=!0)},returned:e=>{e.blur()},didEndEditing:async t=>{const i=this.get(e,"");s(t.text)||(t.text=i),a&&(t.secure=a)}}}],layout:$layout.fill}}createIcon(e,t,i,a="#000000"){const r=this.getId(e),s=`${r}-image`;return{type:"view",props:{id:r,selectable:!0},views:[this.createLineLabel(i,t),{type:"view",views:[{type:"image",props:{cornerRadius:8,bgcolor:"string"==typeof a?$color(a):a,smoothCorners:!0},layout:(e,t)=>{e.right.inset(this.edgeOffset),e.centerY.equalTo(t.super),e.size.equalTo($size(30,30))}},{type:"image",props:{id:s,image:$image(this.get(e)),icon:$icon(this.get(e).slice(5,this.get(e).indexOf(".")),$color("#ffffff")),tintColor:$color("#ffffff")},layout:(e,t)=>{e.right.equalTo(t.prev).offset(-5),e.centerY.equalTo(t.super),e.size.equalTo($size(20,20))}}],events:{tapped:()=>{$ui.menu({items:[$l10n("JSBOX_ICON"),$l10n("SF_SYMBOLS"),$l10n("IMAGE_BASE64")],handler:async(t,i)=>{if(0===i){const t=await $ui.selectIcon();this.set(e,t),$(s).icon=$icon(t.slice(5,t.indexOf(".")),$color("#ffffff"))}else 1!==i&&2!==i||$input.text({text:"",placeholder:t,handler:t=>{""!==t?(this.set(e,t),1===i?$(s).symbol=t:$(s).image=$image(t)):$ui.toast($l10n("INVALID_VALUE"))}})}})}},layout:(e,t)=>{e.right.inset(0),e.height.equalTo(this.rowHeight),e.width.equalTo(t.super)}}],layout:$layout.fill}}createChild(e,t,i,a){const r=this.getId(e);return{type:"view",layout:$layout.fill,props:{id:r,selectable:!0},views:[this.createLineLabel(i,t),{type:"image",props:{symbol:"chevron.right",tintColor:$color("secondaryText")},layout:(e,t)=>{e.centerY.equalTo(t.super),e.right.inset(this.edgeOffset),e.size.equalTo(15)}}],events:{tapped:()=>{setTimeout((()=>{if(this.events?.onChildPush)this.callEvent("onChildPush",this.getListView(a,{}),i);else if(this.isUseJsboxNav)$58e2f5443faff7c0$require$UIKit.push({title:i,bgcolor:$58e2f5443faff7c0$require$UIKit.scrollViewBackgroundColor,views:[this.getListView(a,{})]});else{const e=new $58e2f5443faff7c0$require$NavigationView;e.setView(this.getListView(a,{})).navigationBarTitle(i),e.navigationBarItems.addPopButton(),e.navigationBar.setLargeTitleDisplayMode($58e2f5443faff7c0$require$NavigationBar.largeTitleDisplayModeNever),this.hasSectionTitle(a)&&e.navigationBar.setContentViewHeightOffset(-10),this.viewController.push(e)}}))}}}}createImage(e,t,i){const a=this.getId(e),r=`${a}-image`;return{type:"view",props:{id:a,selectable:!0},views:[this.createLineLabel(i,t),{type:"view",views:[{type:"image",props:{id:r,image:this.getImage(e,!0)??$image("questionmark.square.dashed")},layout:(e,t)=>{e.right.inset(this.edgeOffset),e.centerY.equalTo(t.super),e.size.equalTo($size(30,30))}}],events:{tapped:()=>{this.#o(a),$ui.menu({items:[$l10n("PREVIEW"),$l10n("SELECT_IMAGE"),$l10n("CLEAR_IMAGE")],handler:(t,i)=>{if(0===i){const t=this.getImage(e);t?$quicklook.open({image:t}):$ui.toast($l10n("NO_IMAGE"))}else 1===i?$photo.pick({format:"data"}).then((t=>{if($ui.toast($l10n("LOADING")),!t.status||!t.data)return void("canceled"!==t?.error?.description&&$ui.toast($l10n("ERROR")));const i=$58e2f5443faff7c0$require$Kernel.compressImage(t.data.image);this.fileStorage.write(this.imagePath,this.getImageName(e,!0),i.jpg(.8)),this.fileStorage.write(this.imagePath,this.getImageName(e),t.data),$(r).image=i,$ui.success($l10n("SUCCESS"))})):2===i&&(this.fileStorage.delete(this.imagePath,this.getImageName(e,!0)),this.fileStorage.delete(this.imagePath,this.getImageName(e)),$(r).image=$image("questionmark.square.dashed"),$ui.success($l10n("SUCCESS")))},finished:()=>{this.#n(a)}})}},layout:(e,t)=>{e.right.inset(0),e.height.equalTo(this.rowHeight),e.width.equalTo(t.super)}}],layout:$layout.fill}}#h(e){const t=[];for(let i of e){const e=[];for(let t of i.items){const i=this.get(t.key);let a=null;switch(t.icon||(t.icon=["square.grid.2x2.fill","#00CC00"]),"object"==typeof t.items&&(t.items=t.items.map((e=>$l10n(e)))),t.title=$l10n(t.title),t.type){case"switch":a=this.createSwitch(t.key,t.icon,t.title);break;case"stepper":a=this.createStepper(t.key,t.icon,t.title,t.min??1,t.max??12);break;case"string":a=this.createString(t.key,t.icon,t.title);break;case"info":a=this.createInfo(t.icon,t.title,i);break;case"script":a=this.createScript(t.key,t.icon,t.title,i);break;case"tab":a=this.createTab(t.key,t.icon,t.title,t.items,t.values);break;case"menu":a=this.createMenu(t.key,t.icon,t.title,t.items,t.values);break;case"color":a=this.createColor(t.key,t.icon,t.title);break;case"date":a=this.createDate(t.key,t.icon,t.title,t.mode);break;case"number":a=this.createNumber(t.key,t.icon,t.title);break;case"input":a=this.createInput(t.key,t.icon,t.title,t.secure);break;case"icon":a=this.createIcon(t.key,t.icon,t.title,t.bgcolor);break;case"child":a=this.createChild(t.key,t.icon,t.title,t.children);break;case"image":a=this.createImage(t.key,t.icon,t.title);break;default:continue}e.push(a)}t.push({title:$l10n(i.title??""),rows:e})}return t}getListView(e,t=this.footer){return{type:"list",props:{id:this.name,style:2,separatorInset:$insets(0,this.iconSize+2*this.edgeOffset,0,this.edgeOffset),bgcolor:$58e2f5443faff7c0$require$UIKit.scrollViewBackgroundColor,footer:t,data:this.#h(e??this.structure)},layout:$layout.fill,events:{rowHeight:(e,t)=>(e.object(t)?.props?.info??{}).rowHeight??this.rowHeight}}}getPage(){const e=new $58e2f5443faff7c0$require$NavigationView;return e.setView(this.getListView(this.structure)).navigationBarTitle($l10n("SETTING")),this.hasSectionTitle(this.structure)&&e.navigationBar.setContentViewHeightOffset(-10),e.getPage()}}module.exports={Setting:Setting}})),parcelRequire.register("fYz8N",(function(e,t){e.exports={Controller:class{events={};setEvents(e){return Object.keys(e).forEach((t=>this.setEvent(t,e[t]))),this}setEvent(e,t){return this.events[e]=t,this}callEvent(e,...t){"function"==typeof this.events[e]&&this.events[e](...t)}}}})),parcelRequire.register("8aDdQ",(function(e,t){class i extends Error{constructor(e){super(`Parameter [${e}] is required.`),this.name="FileStorageParameterError"}}class a extends Error{constructor(e){super(`File not found: ${e}`),this.name="FileStorageFileNotFoundError"}}class r{basePath;constructor({basePath:e="storage"}={}){this.basePath=e,this.#c(this.basePath)}#c(e){$file.isDirectory(e)||$file.mkdir(e)}#u(e="",t){return e=`${this.basePath}/${e.trim("/")}`.trim("/"),this.#c(e),e=`${e}/${t}`}write(e="",t,a){if(!t)throw new i("fileName");if(!a)throw new i("data");return $file.write({data:a,path:this.#u(e,t)})}writeSync(e="",t,i){return new Promise(((a,r)=>{try{const s=this.write(e,t,i);s?a(s):r(s)}catch(e){r(e)}}))}exists(e="",t){if(!t)throw new i("fileName");return e=this.#u(e,t),!!$file.exists(e)&&e}read(e="",t){if(!t)throw new i("fileName");if(e=this.#u(e,t),!$file.exists(e))throw new a(e);return $file.isDirectory(e)?$file.list(e):$file.read(e)}readSync(e="",t){return new Promise(((i,a)=>{try{const r=this.read(e,t);r?i(r):a()}catch(e){a(e)}}))}readAsJSON(e="",t,i=null){try{const i=this.read(e,t)?.string;return JSON.parse(i)}catch(e){return i}}static readFromRoot(e){if(!e)throw new i("path");if(!$file.exists(e))throw new a(e);return $file.isDirectory(e)?$file.list(e):$file.read(e)}static readFromRootSync(e=""){return new Promise(((t,i)=>{try{const a=r.readFromRoot(e);a?t(a):i()}catch(e){i(e)}}))}static readFromRootAsJSON(e="",t=null){try{const t=r.readFromRoot(e)?.string;return JSON.parse(t)}catch(e){return t}}delete(e="",t=""){return $file.delete(this.#u(e,t))}}e.exports={FileStorageParameterError:i,FileStorageFileNotFoundError:a,FileStorage:r}})),parcelRequire.register("cgaQ6",(function(e,t){var i=parcelRequire("czAIJ").VERSION;String.prototype.trim=function(e,t){return e?"l"===t?this.replace(new RegExp("^\\"+e+"+","g"),""):"r"===t?this.replace(new RegExp("\\"+e+"+$","g"),""):this.replace(new RegExp("^\\"+e+"+|\\"+e+"+$","g"),""):this.replace(/^\s+|\s+$/g,"")};class a{startTime=Date.now();isUseJsboxNav=!1;title=$addin.current.name;constructor(){$app.isDebugging&&this.debug()}static isTaio=$app.info.bundleID.includes("taio");static l10n(e,t,i=!0){if("string"==typeof t){const e={};t.split(";").forEach((t=>{if(""!==(t=t.trim())){const i=t.split("=");e[i[0].trim().slice(1,-1)]=i[1].trim().slice(1,-1)}})),t=e}const a=$app.strings;a[e]=i?Object.assign($app.strings[e],t):Object.assign(t,$app.strings[e]),$app.strings=a}static compressImage(e,t=921600){const i=$imagekit.info(e);if(i.height*i.width>t){const a=t/(i.height*i.width);e=$imagekit.scaleBy(e,a)}return e}static objectEqual(e,t){let i=Object.getOwnPropertyNames(e),r=Object.getOwnPropertyNames(t);if(i.length!==r.length)return!1;for(let r=0;re?i[e]:0,r=isNaN(Number(t))?t.charCodeAt():Number(t),o=a.length>e?a[e]:0,n=isNaN(Number(o))?o.charCodeAt():Number(o);if(rn){s=1;break}}return s}static deleteConfirm(e,t){$ui.alert({title:e,actions:[{title:$l10n("DELETE"),style:$alertActionType.destructive,handler:()=>{t()}},{title:$l10n("CANCEL")}]})}static bytesToSize(e){if(0===e)return"0 B";const t=Math.floor(Math.log(e)/Math.log(1024));return(e/Math.pow(1024,t)).toPrecision(3)+" "+["B","KB","MB","GB","TB","PB","EB","ZB","YB"][t]}debug(e,t){this.debugMode=!0,$app.idleTimerDisabled=!0,"function"==typeof e&&(this.debugPrint=e),"function"==typeof t&&(this.debugError=t),this.print("You are running EasyJsBox in debug mode.")}print(e){this.debugMode&&("function"==typeof this.debugPrint?this.debugPrint(e):console.log(e))}error(e){this.debugMode&&("function"==typeof this.debugError?this.debugError(e):console.error(e))}useJsboxNav(){return this.isUseJsboxNav=!0,this}setTitle(e){this.isUseJsboxNav&&($ui.title=e),this.title=e}setNavButtons(e){this.navButtons=e}openInJsbox(){$app.openURL(`jsbox://run?name=${$addin.current.name}`)}UIRender(e){try{e.props=Object.assign({title:this.title,navBarHidden:!this.isUseJsboxNav,navButtons:this.navButtons??[],statusBarStyle:0},e.props),e.events||(e.events={});const t=e.events.layoutSubviews,{UIKit:i}=parcelRequire("45Ip7");e.events.layoutSubviews=()=>{$app.notify({name:"interfaceOrientationEvent",object:{statusBarOrientation:i.statusBarOrientation,isHorizontal:i.isHorizontal}}),"function"==typeof t&&t()},$ui.render(e)}catch(e){this.print(e)}}async checkUpdate(){const e=await $http.get("https://raw.githubusercontent.com/ipuppet/EasyJsBox/dev/src/version.js");if(e.error)throw e.error;const t=srcRes.data.match(/.*VERSION.?\"([0-9\.]+)\"/)[1];if(this.print(`easy-jsbox latest version: ${t}`),a.versionCompare(t,i)>0){const e=await $http.get("https://raw.githubusercontent.com/ipuppet/EasyJsBox/dev/dist/easy-jsbox.js");if(e.error)throw e.error;return e.data}return!1}}e.exports={Kernel:a}})),parcelRequire.register("czAIJ",(function(e,t){e.exports={VERSION:"1.3.2"}})),parcelRequire.register("aXWmO",(function(e,t){var i=parcelRequire("6Xrbz").ValidationError,a=parcelRequire("liCrE").View,r=parcelRequire("45Ip7").UIKit,s=parcelRequire("12xzj").NavigationView,o=parcelRequire("dcStC").NavigationBar,n=parcelRequire("gAYmG").BarButtonItem;class l extends Error{constructor(){super("Please call setView(view) first."),this.name="SheetAddNavBarError"}}class h extends i{constructor(e,t){super(e,t),this.name="SheetViewTypeError"}}class c extends a{#p=()=>{};#g=()=>{};style=c.UIModalPresentationStyle.PageSheet;#d=!1;static UIModalPresentationStyle={Automatic:-2,FullScreen:0,PageSheet:1,FormSheet:2,CurrentContext:3,Custom:4,OverFullScreen:5,OverCurrentContext:6,Popover:7,BlurOverFullScreen:8};navigationView;init(){const{width:e,height:t}=$device.info.screen,i=$objc("UIView").invoke("initWithFrame",$rect(0,0,e,t)),a=$objc("UIViewController").invoke("alloc.init"),s=a.$view();return s.$setBackgroundColor(r.primaryViewBackgroundColor),s.$addSubview(i),a.$setModalPresentationStyle(this.style),a.$setModalInPresentation(this.#d),this.#p=()=>{s.jsValue().add(this.navigationView?.getPage().definition??this.view),$ui.vc.ocValue().invoke("presentViewController:animated:completion:",a,!0,void 0)},this.#g=()=>a.invoke("dismissViewControllerAnimated:completion:",!0,void 0),this}preventDismiss(){return this.#d=!0,this}setStyle(e){return this.style=e,this}setView(e={}){if("object"!=typeof e)throw new h("view","object");return this.view=e,this}addNavBar({title:e="",popButton:t={title:$l10n("DONE")},rightButtons:i=[]}={}){if(void 0===this.view)throw new l;this.navigationView=new s;const a=new n;a.setEvents(Object.assign({tapped:()=>{this.dismiss(),"function"==typeof t.tapped&&t.tapped()}},t.events)).setAlign(r.align.left).setSymbol(t.symbol).setTitle(t.title).setMenu(t.menu);const h=a.definition.views[0];return h.layout=(e,t)=>{e.left.equalTo(t.super.safeArea).offset(15),e.centerY.equalTo(t.super.safeArea)},this.navigationView.navigationBar.setLargeTitleDisplayMode(o.largeTitleDisplayModeNever).pageSheetMode(),this.navigationView.navigationBarItems.addPopButton("",h).setRightButtons(i),this.navigationView.setView(this.view).navigationBarTitle(e),this.view.props?.bgcolor&&this.navigationView?.getPage().setProp("bgcolor",this.view.props?.bgcolor),this}present(){this.#p()}dismiss(){this.#g()}}e.exports={Sheet:c}})),parcelRequire.register("6Xrbz",(function(e,t){class i extends Error{constructor(e,t){super(`The type of the parameter '${e}' must be '${t}'`),this.name="ValidationError"}}e.exports={ValidationError:i}})),parcelRequire.register("liCrE",(function(e,t){var i=parcelRequire("45Ip7").UIKit;class a{id=$text.uuid;type;props;views;events;layout;#$=void 0;scrollableView=null;constructor({type:e="view",props:t={},views:i=[],events:a={},layout:r=$layout.fill}={}){this.type=e,this.props=t,this.views=i,this.events=a,this.layout=r,this.props.id?this.id=this.props.id:this.props.id=this.id}static create(e){return new this(e)}static createFromViews(e){return new this({views:e})}scrollable(){if(void 0===this.#$)if(this.#$=!1,i.scrollViewList.indexOf(this.type)>-1)this.scrollableView=this,this.#$=!0;else if(this.views.length>0){const e=t=>{if(!this.#$&&t?.length>0)for(let r=0;r-1)return typeof t[r]!==a&&(t[r]=a.create(t[r])),this.scrollableView=t[r],void(this.#$=!0);e(t[r].views)}};e(this.views)}return this.#$}setProps(e){return Object.keys(e).forEach((t=>this.setProp(t,e[t]))),this}setProp(e,t){return"id"===e&&(this.id=t),this.props[e]=t,this}setViews(e){return this.views=e,this.#$=void 0,this}setEvents(e){return Object.keys(e).forEach((t=>this.setEvent(t,e[t]))),this}setEvent(e,t){return this.events[e]=t,this}eventMiddleware(e,t){const i=this.events[e];return this.events[e]=(...e)=>{"function"==typeof i&&t(i,...e)},this}assignEvent(e,t){const i=this.events[e];return this.events[e]=(...e)=>{"function"==typeof i&&i(...e),t(...e)},this}setLayout(e){return this.layout=e,this}getView(){return this}get definition(){return this.getView()}}e.exports={View:a,PageView:class extends a{constructor(e={}){super(e),this.activeStatus=!0}show(){$(this.props.id).hidden=!1,this.activeStatus=!0}hide(){$(this.props.id).hidden=!0,this.activeStatus=!1}setHorizontalSafeArea(e){return this.horizontalSafeArea=e,this}#f(e,t){e.top.bottom.equalTo(t.super),this.horizontalSafeArea?e.left.right.equalTo(t.super.safeArea):e.left.right.equalTo(t.super)}getView(){return this.layout=this.#f,this.props.clipsToBounds=!0,this.props.hidden=!this.activeStatus,super.getView()}}}})),parcelRequire.register("12xzj",(function(e,t){var i=parcelRequire("liCrE"),a=i.View,r=i.PageView,s=parcelRequire("6Xrbz").ValidationError,o=parcelRequire("cgaQ6").Kernel,n=parcelRequire("45Ip7").UIKit,l=parcelRequire("dcStC"),h=l.NavigationBar,c=l.NavigationBarController,u=parcelRequire("gAYmG").NavigationBarItems;class p extends s{constructor(e,t){super(e,t),this.name="NavigationViewTypeError"}}e.exports={NavigationView:class{page;navigationController=new c;navigationBar=new h;navigationBarItems=new u;constructor(){this.navigationBar.navigationBarItems=this.navigationBarItems,this.navigationController.navigationBar=this.navigationBar}navigationBarTitle(e){return this.navigationBar.setTitle(e),this}setView(e){if("object"!=typeof e)throw new p("view","object");return this.view=a.create(e),this}#v(){if(!(this.view instanceof a))throw new p("view","View");const e=$app.isDebugging||o.isTaio?0:n.topSafeAreaInsets;let t=this.navigationBar.contentViewHeightOffset;if(this.navigationBarItems.titleView&&(t+=this.navigationBarItems.titleView.topOffset,t+=this.navigationBarItems.titleView.height,t+=this.navigationBarItems.titleView.bottomOffset),this.view.props.stickyHeader?t+=this.navigationBar.largeTitleFontHeight:this.navigationBar.largeTitleDisplayMode===h.largeTitleDisplayModeNever?t+=this.navigationBar.navigationBarNormalHeight:t+=this.navigationBar.navigationBarLargeTitleHeight,this.view.props.header?this.view.props.header={type:"view",props:{height:t+(this.view.props.header?.props?.height??0)},views:[{type:"view",props:{clipsToBounds:!0},views:[this.view.props.header],layout:(e,i)=>{e.top.equalTo(t),e.bottom.width.equalTo(i.super)}}]}:this.view.props.header={props:{height:t}},this.view.props.footer=Object.assign({props:{}},this.view.props.footer??{}),this.view.props.footer.props.height=(this.navigationBarItems.fixedFooterView?.height??0)+(this.view.props.footer.props?.height??0),-1===n.scrollViewList.indexOf(this.view.type))this.view.layout=(i,a)=>{i.left.right.equalTo(a.super.safeArea),i.bottom.equalTo(a.super);let r=t-this.navigationBar.contentViewHeightOffset;n.isHorizontal&&!n.isLargeScreen||!this.navigationBar.topSafeArea||(r+=e),i.top.equalTo(r)};else{const t=this.navigationBarItems.isPinTitleView?this.navigationBarItems.titleView.height+this.navigationBarItems.titleView.bottomOffset+this.navigationBar.contentViewHeightOffset:0;if(this.view.props.indicatorInsets){const e=this.view.props.indicatorInsets;this.view.props.indicatorInsets=$insets(e.top+this.navigationBar.navigationBarNormalHeight+t,e.left,e.bottom+(this.navigationBarItems.fixedFooterView?.height??0),e.right)}else this.view.props.indicatorInsets=$insets(this.navigationBar.navigationBarNormalHeight+t,0,this.navigationBarItems.fixedFooterView?.height??0,0);this.view.layout=(e,t)=>{this.view.props.stickyHeader?e.top.equalTo(t.super.safeArea).offset(this.navigationBar.navigationBarNormalHeight):e.top.equalTo(t.super),e.left.right.equalTo(t.super.safeArea),e.bottom.equalTo(t.super)},this.view.assignEvent("didScroll",(t=>{let i=t.contentOffset.y;n.isHorizontal&&!n.isLargeScreen||!this.navigationBar.topSafeArea||this.view.props.stickyHeader||(i+=e),this.navigationController.didScroll(i)})).assignEvent("didEndDragging",((t,i)=>{let a=t.contentOffset.y,r=0;n.isHorizontal&&!n.isLargeScreen||!this.navigationBar.topSafeArea||this.view.props.stickyHeader||(a+=e,r=e),this.navigationController.didEndDragging(a,i,((...e)=>t.scrollToOffset(...e)),r)})).assignEvent("didEndDecelerating",((...e)=>{e[0].tracking||this.view.events?.didEndDragging(...e)}))}}#b(){if(this.navigationBar.prefersLargeTitles){this.#v();let e={};if(this.navigationBarItems.titleView){const t=this.navigationBar.largeTitleDisplayMode===h.largeTitleDisplayModeNever?1:0;e=a.create({views:[this.navigationBar.backgroundColor?{type:"view",props:{alpha:t,bgcolor:this.navigationBar.backgroundColor,id:this.navigationBar.id+"-title-view-background"},layout:$layout.fill}:n.blurBox({alpha:t,id:this.navigationBar.id+"-title-view-background"}),n.separatorLine({id:this.navigationBar.id+"-title-view-underline",alpha:t}),this.navigationBarItems.titleView.definition],layout:(e,t)=>{e.top.equalTo(t.prev.bottom),e.width.equalTo(t.super),e.height.equalTo(this.navigationBarItems.titleView.topOffset+this.navigationBarItems.titleView.height+this.navigationBarItems.titleView.bottomOffset)}})}this.page=r.createFromViews([this.view,this.navigationBar.getLargeTitleView(),e,this.navigationBar.getNavigationBarView(),this.navigationBarItems.fixedFooterView?.definition??{}])}else this.page=r.createFromViews([this.view]);this.view.props?.bgcolor?this.page.setProp("bgcolor",this.view.props.bgcolor):this.page.setProp("bgcolor",n.defaultBackgroundColor(this.view.type))}getPage(){return this.page||this.#b(),this.page}}}})),parcelRequire.register("dcStC",(function(e,t){var i=parcelRequire("liCrE").View,a=parcelRequire("fYz8N").Controller,r=parcelRequire("45Ip7").UIKit,s=parcelRequire("gAYmG").BarButtonItem;class o extends i{static largeTitleDisplayModeAutomatic=0;static largeTitleDisplayModeAlways=1;static largeTitleDisplayModeNever=2;static pageSheetNavigationBarHeight=56;navigationBarItems;title="";prefersLargeTitles=!0;largeTitleDisplayMode=o.largeTitleDisplayModeAutomatic;largeTitleFontSize=34;largeTitleFontFamily="bold";largeTitleFontHeight=$text.sizeThatFits({text:"A",width:100,font:$font(this.largeTitleFontFamily,this.largeTitleFontSize)}).height;navigationBarTitleFontSize=17;topSafeArea=!0;contentViewHeightOffset=10;navigationBarNormalHeight=r.NavigationBarNormalHeight;navigationBarLargeTitleHeight=r.NavigationBarLargeTitleHeight;pageSheetMode(){return this.navigationBarLargeTitleHeight-=this.navigationBarNormalHeight,this.navigationBarNormalHeight=o.pageSheetNavigationBarHeight,this.navigationBarLargeTitleHeight+=this.navigationBarNormalHeight,this.topSafeArea=!1,this}setTopSafeArea(){return this.topSafeArea=!0,this}removeTopSafeArea(){return this.topSafeArea=!1,this}setLargeTitleDisplayMode(e){return this.largeTitleDisplayMode=e,this}setBackgroundColor(e){return this.backgroundColor=e,this}setTitle(e){return this.title=e,this}setPrefersLargeTitles(e){return this.prefersLargeTitles=e,this}setContentViewHeightOffset(e){return this.contentViewHeightOffset=e,this}getLargeTitleView(){return this.prefersLargeTitles&&this.largeTitleDisplayMode!==o.largeTitleDisplayModeNever?{type:"label",props:{id:this.id+"-large-title",text:this.title,textColor:r.textColor,align:$align.left,font:$font(this.largeTitleFontFamily,this.largeTitleFontSize),line:1},layout:(e,t)=>{e.left.equalTo(t.super.safeArea).offset(15),e.height.equalTo(this.largeTitleFontHeight),e.top.equalTo(t.super.safeAreaTop).offset(this.navigationBarNormalHeight)}}:{props:{id:this.id+"-large-title"},layout:(e,t)=>{e.left.top.right.inset(0),e.bottom.equalTo(t.super.safeAreaTop).offset(this.navigationBarNormalHeight)}}}getNavigationBarView(){const e=(e,t)=>e.length>0?{type:"view",views:[{type:"view",views:e,layout:$layout.fill}],layout:(i,a)=>{i.top.equalTo(a.super.safeAreaTop),i.bottom.equalTo(a.super.safeAreaTop).offset(this.navigationBarNormalHeight),t===r.align.left?i.left.equalTo(a.super.safeArea):i.right.equalTo(a.super.safeArea),i.width.equalTo(e.length*s.size.width)}}:{},t=e(this.navigationBarItems.rightButtons,r.align.right),i=this.navigationBarItems.popButtonView??e(this.navigationBarItems.leftButtons,r.align.left),a=this.prefersLargeTitles,n=!this.prefersLargeTitles||this.largeTitleDisplayMode===o.largeTitleDisplayModeNever;return{type:"view",props:{id:this.id+"-navigation",bgcolor:$color("clear")},layout:(e,t)=>{e.left.top.right.inset(0),e.bottom.equalTo(t.super.safeAreaTop).offset(this.navigationBarNormalHeight)},views:[this.backgroundColor?{type:"view",props:{hidden:a,bgcolor:this.backgroundColor,id:this.id+"-background"},layout:$layout.fill}:r.blurBox({hidden:a,id:this.id+"-background"}),r.separatorLine({id:this.id+"-underline",alpha:a?0:1}),{type:"view",props:{alpha:0,bgcolor:$color("clear"),id:this.id+"-large-title-mask"},events:{ready:e=>{e.bgcolor=$(this.id+"-large-title")?.prev.bgcolor}},layout:$layout.fill},{type:"label",props:{id:this.id+"-small-title",alpha:n?1:0,text:this.title,font:$font(this.largeTitleFontFamily,this.navigationBarTitleFontSize),align:$align.center,bgcolor:$color("clear"),textColor:r.textColor},layout:(e,t)=>{e.left.right.inset(0),e.height.equalTo(20),e.centerY.equalTo(t.super.safeArea)}}].concat(t,i)}}}class n extends a{static largeTitleViewSmallMode=0;static largeTitleViewLargeMode=1;navigationBar;updateSelector(){this.selector={navigation:$(this.navigationBar.id+"-navigation"),largeTitleView:$(this.navigationBar.id+"-large-title"),smallTitleView:$(this.navigationBar.id+"-small-title"),underlineView:this.navigationBar.navigationBarItems.isPinTitleView?$(this.navigationBar.id+"-title-view-underline"):$(this.navigationBar.id+"-underline"),largeTitleMaskView:$(this.navigationBar.id+"-large-title-mask"),backgroundView:$(this.navigationBar.id+"-background"),titleViewBackgroundView:$(this.navigationBar.id+"-title-view-background")}}toNormal(e=!0){this.updateSelector(),this.selector.backgroundView.hidden=!1,$ui.animate({duration:.2,animation:()=>{this.selector.underlineView.alpha=1,this.selector.smallTitleView.alpha=1,this.selector.largeTitleView.alpha=0}}),e&&this.navigationBar.navigationBarItems&&(this.navigationBar.largeTitleDisplayMode=o.largeTitleDisplayModeNever)}toLargeTitle(e=!0){this.updateSelector(),this.selector.backgroundView.hidden=!0,$ui.animate({duration:.2,animation:()=>{this.selector.underlineView.alpha=0,this.selector.smallTitleView.alpha=0,this.selector.largeTitleView.alpha=1}}),e&&this.navigationBar.navigationBarItems&&(this.navigationBar.largeTitleDisplayMode=o.largeTitleDisplayModeAlways)}#w(e){const t=e===n.largeTitleViewSmallMode;this.selector.largeTitleView.alpha=t?0:1,$ui.animate({duration:.2,animation:()=>{this.selector.smallTitleView.alpha=t?1:0}})}#m(e){if(this.selector.largeTitleView.updateLayout(((t,i)=>{this.navigationBar.navigationBarNormalHeight-e>0?t.top.equalTo(i.super.safeAreaTop).offset(this.navigationBar.navigationBarNormalHeight-e):t.top.equalTo(i.super.safeAreaTop).offset(0)})),e>0)e>=this.navigationBar.navigationBarNormalHeight?this.#w(n.largeTitleViewSmallMode):this.#w(n.largeTitleViewLargeMode);else{this.#w(n.largeTitleViewLargeMode);let t=this.navigationBar.largeTitleFontSize-.04*e;t>40&&(t=40),this.selector.largeTitleView.font=$font(this.navigationBar.largeTitleFontFamily,t)}}#y(e){const t=this.navigationBar.largeTitleDisplayMode===o.largeTitleDisplayModeNever?5:this.navigationBar.navigationBarNormalHeight,i=void 0!==this.selector.titleViewBackgroundView;if(e>t){this.selector.backgroundView.hidden=!1;const a=()=>{i&&this.navigationBar.navigationBarItems.isPinTitleView&&(this.selector.titleViewBackgroundView.alpha=1),this.selector.largeTitleMaskView.alpha=0,this.selector.underlineView.alpha=1};(e-t)/3>=1?a():$ui.animate({duration:.2,animation:()=>{a()}})}else this.selector.largeTitleMaskView.alpha=e>0?1:0,this.selector.underlineView.alpha=0,i&&(this.selector.titleViewBackgroundView.alpha=0),this.selector.backgroundView.hidden=!0}didScroll(e){if(!this.navigationBar.prefersLargeTitles)return;const t=this.navigationBar.largeTitleDisplayMode;if(t!==o.largeTitleDisplayModeAlways)if(this.updateSelector(),t===o.largeTitleDisplayModeAutomatic){if(!this.navigationBar.navigationBarItems?.isPinTitleView&&(this.navigationBar.navigationBarItems?.titleView?.controller.didScroll(e),e>0)){(e-=this.navigationBar.navigationBarItems?.titleView?.height??0)<0&&(e=0)}this.#m(e),this.#y(e)}else t===o.largeTitleDisplayModeNever&&this.#y(e)}didEndDragging(e,t,i,a){if(!this.navigationBar.prefersLargeTitles)return;const r=this.navigationBar.largeTitleDisplayMode;if(r!==o.largeTitleDisplayModeAlways&&(this.updateSelector(),r===o.largeTitleDisplayModeAutomatic)){let r=0;this.navigationBar.navigationBarItems?.isPinTitleView||(this.navigationBar.navigationBarItems?.titleView?.controller.didEndDragging(e,t,i,a),r=this.navigationBar.navigationBarItems?.titleView?.height??0,e-=r),e>=0&&e<=this.navigationBar.largeTitleFontHeight&&i($point(0,e>=this.navigationBar.largeTitleFontHeight/2?this.navigationBar.navigationBarNormalHeight+r-a:r-a))}}}e.exports={NavigationBar:o,NavigationBarController:n}})),parcelRequire.register("gAYmG",(function(e,t){var i=parcelRequire("liCrE").View,a=parcelRequire("45Ip7").UIKit;class r extends i{static edges=15;static size=$size(38,38);static fontSize=16;static iconSize=$size(r.size.width-r.edges,r.size.height-r.edges);title;symbol;align=a.align.right;setTitle(e){return this.title=e,this}setSymbol(e){return this.symbol=e,this}setMenu(e){return this.menu=e,this}setAlign(e){return this.align=e,this}#T(){$(this.id).hidden=!0,$("spinner-"+this.id).hidden=!1}#B(){const e=$(`icon-button-${this.id}`),t=$(`icon-checkmark-${this.id}`);e.alpha=0,$(this.id).hidden=!1,$("spinner-"+this.id).hidden=!0,$ui.animate({duration:.6,animation:()=>{t.alpha=1},completion:()=>{$delay(.3,(()=>$ui.animate({duration:.6,animation:()=>{t.alpha=0},completion:()=>{$ui.animate({duration:.4,animation:()=>{e.alpha=1},completion:()=>{e.alpha=1}})}})))}})}#q(){$(this.id).hidden=!1,$("spinner-"+this.id).hidden=!0}getView(){const e=this.events.tapped;return this.events.tapped=t=>{e&&e({start:()=>this.#T(),done:()=>this.#B(),cancel:()=>this.#q()},t)},{type:"view",views:[{type:"button",props:Object.assign({id:this.id,bgcolor:$color("clear"),font:$font(r.fontSize),tintColor:a.textColor,titleColor:a.textColor,contentEdgeInsets:$insets(0,0,0,0),titleEdgeInsets:$insets(0,0,0,0),imageEdgeInsets:$insets(0,0,0,0)},this.menu?{menu:this.menu}:{},this.title?{title:this.title}:{},this.props),views:[{type:"image",props:Object.assign({id:`icon-button-${this.id}`,hidden:void 0===this.symbol,tintColor:a.textColor},void 0===this.symbol?{}:"string"==typeof this.symbol?{symbol:this.symbol}:{data:this.symbol.png}),layout:(e,t)=>{e.center.equalTo(t.super),e.size.equalTo(r.iconSize)}},{type:"image",props:{id:`icon-checkmark-${this.id}`,alpha:0,tintColor:a.textColor,symbol:"checkmark"},layout:(e,t)=>{e.center.equalTo(t.super),e.size.equalTo(r.iconSize)}}],events:this.events,layout:$layout.fill},{type:"spinner",props:{id:"spinner-"+this.id,loading:!0,hidden:!0},layout:$layout.fill}],layout:(e,t)=>{if(this.title){const t=$text.sizeThatFits({text:this.title,width:a.windowSize.width,font:$font(r.fontSize)}),i=Math.ceil(t.width)+r.edges;e.size.equalTo($size(i,r.size.height))}else e.size.equalTo(r.size);if(e.centerY.equalTo(t.super),t.prev&&"label"!==t.prev.id&&void 0!==t.prev.id)this.align===a.align.right?e.right.equalTo(t.prev.left):e.left.equalTo(t.prev.right);else{const t=r.edges/2;this.align===a.align.right?e.right.inset(t):e.left.inset(t)}}}}static creat({symbol:e,title:t,tapped:i,menu:s,events:o,align:n=a.align.right}={}){const l=new r;return l.setEvents(Object.assign({tapped:i},o)).setAlign(n).setSymbol(e).setTitle(t).setMenu(s),l}}e.exports={BarTitleView:class extends i{controller={};setController(e){return this.controller=e,this}},BarButtonItem:r,NavigationBarItems:class{rightButtons=[];leftButtons=[];hasbutton=!1;isPinTitleView=!1;setTitleView(e){return this.titleView=e,this}pinTitleView(){return this.isPinTitleView=!0,this}setFixedFooterView(e){return this.fixedFooterView=e,this}setRightButtons(e){return e.forEach((e=>this.addRightButton(e))),this.hasbutton||(this.hasbutton=!0),this}setLeftButtons(e){return e.forEach((e=>this.addLeftButton(e))),this.hasbutton||(this.hasbutton=!0),this}addRightButton({symbol:e,title:t,tapped:i,menu:s,events:o}={}){return this.rightButtons.push(r.creat({symbol:e,title:t,tapped:i,menu:s,events:o,align:a.align.right}).definition),this.hasbutton||(this.hasbutton=!0),this}addLeftButton({symbol:e,title:t,tapped:i,menu:s,events:o}={}){return this.leftButtons.push(r.creat({symbol:e,title:t,tapped:i,menu:s,events:o,align:a.align.left}).definition),this.hasbutton||(this.hasbutton=!0),this}addPopButton(e,t){return e||(e=$l10n("BACK")),this.popButtonView=t??{type:"button",props:{bgcolor:$color("clear"),symbol:"chevron.left",tintColor:a.linkColor,title:` ${e}`,titleColor:a.linkColor,font:$font("bold",16)},layout:(e,t)=>{e.left.equalTo(t.super.safeArea).offset(r.edges),e.centerY.equalTo(t.super.safeArea)},events:{tapped:()=>{$ui.pop()}}},this}removePopButton(){return this.popButtonView=void 0,this}}}})),parcelRequire.register("gMc1q",(function(e,t){var i=parcelRequire("fYz8N").Controller;e.exports={ViewController:class extends i{#S=[];#C(e){this.callEvent("onPop",e),this.#S.pop()}push(e){const t=this.#S[this.#S.length-1];e.navigationBarItems.addPopButton(t?.navigationBar.title),this.#S.push(e),$ui.push({props:{statusBarStyle:0,navBarHidden:!0},events:{dealloc:()=>{this.#C(e)}},views:[e.getPage().definition],layout:$layout.fill})}}}}));var $czAIJ=parcelRequire("czAIJ"),$bb0fea222fc5aea5$require$VERSION=$czAIJ.VERSION,$fYz8N=parcelRequire("fYz8N"),$bb0fea222fc5aea5$require$Controller=$fYz8N.Controller,$272f042430a952c6$exports={},$45Ip7=parcelRequire("45Ip7"),$272f042430a952c6$require$UIKit=$45Ip7.UIKit,$aXWmO=parcelRequire("aXWmO"),$272f042430a952c6$require$Sheet=$aXWmO.Sheet,$cgaQ6=parcelRequire("cgaQ6"),$272f042430a952c6$require$Kernel=$cgaQ6.Kernel,$12xzj=parcelRequire("12xzj"),$272f042430a952c6$require$NavigationView=$12xzj.NavigationView,$dcStC=parcelRequire("dcStC"),$272f042430a952c6$require$NavigationBar=$dcStC.NavigationBar;class $272f042430a952c6$var$FileManager{viewController;constructor(){this.listId="file-manager-list",this.edges=10,this.iconSize=25,this.loadL10n()}loadL10n(){$272f042430a952c6$require$Kernel.l10n("zh-Hans",'\n "CONFIRM_DELETE_MSG" = "确认要删除吗";\n "DELETE" = "删除";\n "CANCEL" = "取消";\n "CLOSE" = "关闭";\n "SHARE" = "分享";\n "SAVE" = "保存";\n "SAVE_SUCCESS" = "保存成功";\n '),$272f042430a952c6$require$Kernel.l10n("en",'\n "CONFIRM_DELETE_MSG" = "Are you sure you want to delete";\n "DELETE" = "Delete";\n "CANCEL" = "Cancel";\n "CLOSE" = "Close";\n "SHARE" = "Share";\n "SAVE" = "Save";\n "SAVE_SUCCESS" = "Save Success";\n ')}setViewController(e){this.viewController=e}get menu(){return{items:[{title:$l10n("SHARE"),symbol:"square.and.arrow.up",handler:async(e,t)=>{const i=e.object(t).info.info;$share.sheet([$file.absolutePath(i.path)])}}]}}delete(e){$file.delete(e.path)}edit(e){const t=$file.read(e.path);if(t.image)$quicklook.open({image:t.image});else{const i=new $272f042430a952c6$require$Sheet,a=$text.uuid;i.setView({type:"code",layout:$layout.fill,props:{id:a,lineNumbers:!0,theme:$device.isDarkMode?"atom-one-dark":"atom-one-light",text:t.string,insets:$insets(15,15,15,15)}}).addNavBar({title:e.file,popButton:{title:$l10n("CLOSE")},rightButtons:[{title:$l10n("SAVE"),tapped:()=>{$file.write({data:$data({string:$(a).text}),path:e.path}),$ui.success($l10n("SAVE_SUCCESS"))}}]}),i.init().present()}}getFiles(e=""){return $file.list(e).map((t=>{const i=e+"/"+t,a=$file.isDirectory(i);return{info:{info:{path:i,file:t,isDirectory:a}},icon:{symbol:a?"folder.fill":"doc"},name:{text:t},size:{text:a?"":"--"}}})).sort(((e,t)=>e.info.info.isDirectory!==t.info.info.isDirectory?e.info.info.isDirectory?-1:1:e.info.info.isDirectory===t.info.info.isDirectory?e.info.info.file.localeCompare(t.info.info.file):void 0))}async loadFileSize(e){return e.map(((t,i)=>{const a=t.info.info;if(!a.isDirectory)try{e[i].size.text=$272f042430a952c6$require$Kernel.bytesToSize($file.read(a.path).info.size)}catch(t){e[i].size.text=t}})),e}get listTemplate(){return{props:{bgcolor:$color("clear")},views:[{props:{id:"info"}},{type:"image",props:{id:"icon"},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.inset(this.edges),e.size.equalTo(this.iconSize)}},{type:"label",props:{id:"name",lines:1},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.equalTo(t.prev.right).offset(this.edges)}},{type:"label",props:{id:"size",color:$color("secondaryText"),lines:1},layout:(e,t)=>{e.centerY.equalTo(t.super),e.right.inset(this.edges)}}]}}#V(e,t){if(this.viewController){const i=new $272f042430a952c6$require$NavigationView;i.setView(t).navigationBarTitle(e),i.navigationBar.setLargeTitleDisplayMode($272f042430a952c6$require$NavigationBar.largeTitleDisplayModeNever),this.viewController.push(i)}else $272f042430a952c6$require$UIKit.push({title:e,views:[t]})}getListView(e=""){return{type:"list",props:{id:this.listId,menu:this.menu,info:{basePath:e},bgcolor:$272f042430a952c6$require$UIKit.primaryViewBackgroundColor,separatorInset:$insets(0,this.edges,0,0),data:[],template:this.listTemplate,actions:[{title:" "+$l10n("DELETE")+" ",color:$color("red"),handler:(e,t)=>{const i=e.object(t).info.info;$272f042430a952c6$require$Kernel.deleteConfirm($l10n("CONFIRM_DELETE_MSG")+' "'+i.file+'" ?',(()=>{this.delete(i),e.delete(t)}))}}]},layout:$layout.fill,events:{ready:()=>{const t=this.getFiles(e);$(this.listId).data=t,this.loadFileSize(t).then((e=>{$(this.listId).data=e}))},pulled:async e=>{const t=this.getFiles($(this.listId).info.basePath);$(this.listId).data=t,$(this.listId).data=await this.loadFileSize(t),$delay(.5,(()=>{e.endRefreshing()}))},didSelect:(e,t,i)=>{const a=i.info.info;a.isDirectory?this.#V(a.file,this.getListView(a.path)):this.edit(a)}}}}push(e=""){const t=e.substring(e.lastIndexOf("/"));this.#V(t,this.getListView(e))}}$272f042430a952c6$exports={FileManager:$272f042430a952c6$var$FileManager};var $bb0fea222fc5aea5$require$FileManager=$272f042430a952c6$exports.FileManager,$8aDdQ=parcelRequire("8aDdQ"),$bb0fea222fc5aea5$require$FileStorageParameterError=$8aDdQ.FileStorageParameterError,$bb0fea222fc5aea5$require$FileStorageFileNotFoundError=$8aDdQ.FileStorageFileNotFoundError,$bb0fea222fc5aea5$require$FileStorage=$8aDdQ.FileStorage,$4c192cc93140b629$exports={},$liCrE=parcelRequire("liCrE"),$4c192cc93140b629$require$View=$liCrE.View,$45Ip7=parcelRequire("45Ip7"),$4c192cc93140b629$require$UIKit=$45Ip7.UIKit;class $4c192cc93140b629$var$FixedFooterView extends $4c192cc93140b629$require$View{height=60;getView(){return this.type="view",this.setProp("bgcolor",$4c192cc93140b629$require$UIKit.primaryViewBackgroundColor),this.layout=(e,t)=>{e.left.right.bottom.equalTo(t.super),e.top.equalTo(t.super.safeAreaBottom).offset(-this.height)},this.views=[$4c192cc93140b629$require$View.create({props:this.props,views:this.views,layout:(e,t)=>{e.left.right.top.equalTo(t.super),e.height.equalTo(this.height)}})],this}}$4c192cc93140b629$exports={FixedFooterView:$4c192cc93140b629$var$FixedFooterView};var $bb0fea222fc5aea5$require$FixedFooterView=$4c192cc93140b629$exports.FixedFooterView,$cgaQ6=parcelRequire("cgaQ6"),$bb0fea222fc5aea5$require$Kernel=$cgaQ6.Kernel,$50aa538fe0dbd3b0$exports={},$liCrE=parcelRequire("liCrE"),$50aa538fe0dbd3b0$require$View=$liCrE.View;class $50aa538fe0dbd3b0$var$Matrix extends $50aa538fe0dbd3b0$require$View{titleStyle={font:$font("bold",21),height:30};#I;#E;templateIdByIndex(e){return void 0===this.props.template.views[e]?.props?.id&&(void 0===this.props.template.views[e].props&&(this.props.template.views[e].props={}),this.props.template.views[e].props.id=$text.uuid),this.props.template.views[e].props.id}get templateHiddenStatus(){if(!this.#E){this.#E={};for(let e=0;e(e.items=e.items.map((e=>(Object.keys(e).forEach((t=>{e[t].hidden=this.templateHiddenStatus[t]??!1})),Object.keys(this.templateHiddenStatus).forEach((t=>{e[t]||(e[t]={}),e[t].hidden=this.templateHiddenStatus[t]})),e.__templateProps={hidden:!1},e.__title={hidden:!0},e))),e.title&&e.items.unshift(this.#x(e.title)),e)))}rebuildTemplate(){let e={};void 0!==this.props.template.props&&(e=Object.assign(this.props.template.props,{id:"__templateProps",hidden:!1})),this.props.template.props={};const t=[{type:"view",props:e,layout:$layout.fill},{type:"label",props:{id:"__title",hidden:!0,font:this.titleStyle.font},layout:(e,t)=>{e.top.inset(-this.titleStyle.height/4*3),e.height.equalTo(this.titleStyle.height),e.width.equalTo(t.super.safeArea)}}].concat(this.props.template.views);this.props.template.views=t}insert(e,t=!0){return e.indexPath=this.indexPath(e.indexPath,t),$(this.id).insert(e)}delete(e,t=!0){return e=this.indexPath(e,t),$(this.id).delete(e)}object(e,t=!0){return e=this.indexPath(e,t),$(this.id).object(e)}cell(e,t=!0){return e=this.indexPath(e,t),$(this.id).cell(e)}indexPath(e,t){let i=t?0:1;return"number"==typeof e&&(e=$indexPath(0,e)),e=$indexPath(e.section,e.row+i)}update(e){this.props.data=this.rebuildData(e),$(this.id).data=this.props.data}getView(){return this.props.data=this.rebuildData(this.props.data),this.rebuildTemplate(),this.setEvent("itemSize",((e,t)=>{const i=e.object(t)?.__title?.info;if(i?.title)return $size(Math.max($device.info.screen.width,$device.info.screen.height),0);const a=this.props.columns??2,r=this.props.spacing??15,s=this.props.itemWidth??this.props.itemSize?.width??(e.super.frame.width-r*(a+1))/a,o=this.props.itemHeight??this.props.itemSize?.height??100;return $size(s,o)})),this}}$50aa538fe0dbd3b0$exports={Matrix:$50aa538fe0dbd3b0$var$Matrix};var $bb0fea222fc5aea5$require$Matrix=$50aa538fe0dbd3b0$exports.Matrix,$619319e3f3656d3f$exports={};class $619319e3f3656d3f$var$Request{static Method={get:"GET",post:"POST"};#N;#k=!1;#O=!1;cacheLife=2592e6;isLogRequest=!0;timeout=5;kernel;constructor(e){this.kernel=e}getCacheKey(e){return this.#N||(this.#N=$text.MD5(this.baseUrl)),this.#N+$text.MD5(e)}setCache(e,t){$cache.set(e,t)}getCache(e,t=null){return $cache.get(e)??t}removeCache(e){$cache.remove(e)}useCache(){return this.#k=!0,this}ignoreCacheExp(){this.#O=!0}async request(e,t,i={},a={},r=this.cacheLife){const s=this.baseUrl+e;let o;const n=this.#k&&t===$619319e3f3656d3f$var$Request.Method.get;if(n){o=this.getCacheKey(e);const t=this.getCache(o);if(t&&(this.#O||t.exp>Date.now()))return this.isLogRequest&&this.kernel.print("get data from cache: "+s),t.data}try{this.isLogRequest&&this.kernel.print(`sending request [${t}]: ${s}`);const e=await $http.request({header:Object.assign({"Content-Type":"application/json"},a),url:s,method:t,body:i,timeout:this.timeout});if(e?.response?.statusCode>=400){let t=e.data;throw"object"==typeof t&&(t=JSON.stringify(t)),new Error("http error: ["+e.response.statusCode+"] "+t)}return n&&this.setCache(o,{exp:Date.now()+r,data:e.data}),e.data}catch(e){throw e.code&&(e=new Error("network error: ["+e.code+"] "+e.localizedDescription)),e}}}$619319e3f3656d3f$exports={Request:$619319e3f3656d3f$var$Request};var $bb0fea222fc5aea5$require$Request=$619319e3f3656d3f$exports.Request,$7D8Kb=parcelRequire("7D8Kb"),$bb0fea222fc5aea5$require$Setting=$7D8Kb.Setting,$aXWmO=parcelRequire("aXWmO"),$bb0fea222fc5aea5$require$Sheet=$aXWmO.Sheet,$7dfcabb1e936a92c$exports={},$liCrE=parcelRequire("liCrE"),$7dfcabb1e936a92c$require$View=$liCrE.View,$7dfcabb1e936a92c$require$PageView=$liCrE.PageView,$fYz8N=parcelRequire("fYz8N"),$7dfcabb1e936a92c$require$Controller=$fYz8N.Controller,$45Ip7=parcelRequire("45Ip7"),$7dfcabb1e936a92c$require$UIKit=$45Ip7.UIKit;class $7dfcabb1e936a92c$var$TabBarCellView extends $7dfcabb1e936a92c$require$View{constructor(e={}){super(e),this.setIcon(e.icon),this.setTitle(e.title),void 0!==e.activeStatus&&(this.activeStatus=e.activeStatus)}setIcon(e){return this.icon=e instanceof Array?e:[e,e],this}setTitle(e){return this.title=e,this}active(){$(`${this.props.id}-icon`).image=$image(this.icon[1]),$(`${this.props.id}-icon`).tintColor=$color("systemLink"),$(`${this.props.id}-title`).textColor=$color("systemLink"),this.activeStatus=!0}inactive(){$(`${this.props.id}-icon`).image=$image(this.icon[0]),$(`${this.props.id}-icon`).tintColor=$color("lightGray"),$(`${this.props.id}-title`).textColor=$color("lightGray"),this.activeStatus=!1}getView(){return this.views=[{type:"image",props:{id:`${this.props.id}-icon`,image:$image(this.activeStatus?this.icon[1]:this.icon[0]),bgcolor:$color("clear"),tintColor:$color(this.activeStatus?"systemLink":"lightGray")},layout:(e,t)=>{e.centerX.equalTo(t.super);const i=$7dfcabb1e936a92c$var$TabBarController.tabBarHeight/2;e.size.equalTo(i),e.top.inset(($7dfcabb1e936a92c$var$TabBarController.tabBarHeight-i-13)/2)}},{type:"label",props:{id:`${this.props.id}-title`,text:this.title,font:$font(10),textColor:$color(this.activeStatus?"systemLink":"lightGray")},layout:(e,t)=>{e.centerX.equalTo(t.prev),e.top.equalTo(t.prev.bottom).offset(3)}}],this}}class $7dfcabb1e936a92c$var$TabBarHeaderView extends $7dfcabb1e936a92c$require$View{height=60;getView(){return this.type="view",this.setProp("bgcolor",this.props.bgcolor??$7dfcabb1e936a92c$require$UIKit.primaryViewBackgroundColor),this.layout=(e,t)=>{e.left.right.bottom.equalTo(t.super),e.top.equalTo(t.super.safeAreaBottom).offset(-this.height-$7dfcabb1e936a92c$var$TabBarController.tabBarHeight)},this.views=[$7dfcabb1e936a92c$require$View.create({props:this.props,views:this.views,layout:(e,t)=>{e.left.right.top.equalTo(t.super),e.height.equalTo(this.height)}})],this}}class $7dfcabb1e936a92c$var$TabBarController extends $7dfcabb1e936a92c$require$Controller{static tabBarHeight=50;#A={};#L={};#R;#D;#F=$text.uuid;#z=$text.uuid;bottomSafeAreaInsets=$app.isDebugging?0:$7dfcabb1e936a92c$require$UIKit.bottomSafeAreaInsets;get selected(){return this.#D}set selected(e){this.switchPageTo(e)}get contentOffset(){return $7dfcabb1e936a92c$var$TabBarController.tabBarHeight+(this.#R?.height??0)}setPages(e={}){return Object.keys(e).forEach((t=>this.setPage(t,e[t]))),this}setPage(e,t){return void 0===this.#D&&(this.#D=e),this.#A[e]=t instanceof $7dfcabb1e936a92c$require$PageView?t:$7dfcabb1e936a92c$require$PageView.create(t),this.#D!==e&&(this.#A[e].activeStatus=!1),this}switchPageTo(e){if(this.#A[e]){if(this.#D===e)return;$ui.animate({duration:.4,animation:()=>{this.#L[e].active()}}),this.#L[this.#D].inactive(),this.#A[this.#D].hide(),this.#A[e].show(),this.callEvent("onChange",this.#D,e),this.#D=e,this.initBackground()}}hideBackground(e=!0){$(this.#z).hidden=!0,$ui.animate({duration:e?.2:1e-4,animation:()=>{$(this.#F).alpha=0}})}showBackground(e=!0){$(this.#z).hidden=!1,$ui.animate({duration:e?.2:1e-4,animation:()=>{$(this.#F).alpha=1}})}initBackground(){const e=this.#A[this.selected];e.scrollable()&&$delay(0,(()=>{const t=$(e.id).get(e.scrollableView.id),i=t.contentOffset.y;t.contentSize.height+this.bottomSafeAreaInsets-t.frame.height-i<=0?this.hideBackground(!1):this.showBackground(!1)}))}setCells(e={}){return Object.keys(e).forEach((t=>this.setCell(t,e[t]))),this}setCell(e,t){return void 0===this.#D&&(this.#D=e),t instanceof $7dfcabb1e936a92c$var$TabBarCellView||(t=new $7dfcabb1e936a92c$var$TabBarCellView({props:{info:{key:e}},icon:t.icon,title:t.title,activeStatus:this.#D===e})),this.#L[e]=t,this}setHeader(e){return this.#R=e,this}#M(){const e=[];return Object.values(this.#L).forEach((t=>{t.setEvent("tapped",(e=>{const t=e.info.key;this.switchPageTo(t)})),e.push(t.getView())})),e}#P(){return Object.values(this.#A).map((e=>{if(e.scrollable()){const t=e.scrollableView;if(t.props.indicatorInsets){const e=t.props.indicatorInsets;t.props.indicatorInsets=$insets(e.top,e.left,e.bottom+this.contentOffset,e.right)}else t.props.indicatorInsets=$insets(0,0,this.contentOffset,0);t.props.footer=Object.assign({props:{}},t.props.footer??{}),t.props.footer.props.height?t.props.footer.props.height+=this.contentOffset:t.props.footer.props.height=this.contentOffset,"function"==typeof t.assignEvent&&t.assignEvent("didScroll",(e=>{const t=e.contentOffset.y;e.contentSize.height+this.bottomSafeAreaInsets-e.frame.height-t<=0?this.hideBackground():this.showBackground()}))}return e.definition}))}generateView(){const e={type:"view",layout:(e,t)=>{e.centerX.equalTo(t.super),e.width.equalTo(t.super),e.top.equalTo(t.super.safeAreaBottom).offset(-$7dfcabb1e936a92c$var$TabBarController.tabBarHeight),e.bottom.equalTo(t.super)},views:[$7dfcabb1e936a92c$require$UIKit.blurBox({id:this.#F}),{type:"stack",layout:$layout.fillSafeArea,props:{axis:$stackViewAxis.horizontal,distribution:$stackViewDistribution.fillEqually,spacing:0,stack:{views:this.#M()}}},$7dfcabb1e936a92c$require$UIKit.separatorLine({id:this.#z},$7dfcabb1e936a92c$require$UIKit.align.top)],events:{ready:()=>this.initBackground()}};return $7dfcabb1e936a92c$require$View.createFromViews(this.#P().concat(this.#R?.definition??[],e))}}$7dfcabb1e936a92c$exports={TabBarCellView:$7dfcabb1e936a92c$var$TabBarCellView,TabBarHeaderView:$7dfcabb1e936a92c$var$TabBarHeaderView,TabBarController:$7dfcabb1e936a92c$var$TabBarController};var $bb0fea222fc5aea5$require$TabBarCellView=$7dfcabb1e936a92c$exports.TabBarCellView,$bb0fea222fc5aea5$require$TabBarHeaderView=$7dfcabb1e936a92c$exports.TabBarHeaderView,$bb0fea222fc5aea5$require$TabBarController=$7dfcabb1e936a92c$exports.TabBarController,$3839e9f9bae78bdd$exports={};class $3839e9f9bae78bdd$var$Tasks{#H={};addTask(e,t=0){const i=$text.uuid;return this.#H[i]=$delay(t,(async()=>{await e(),delete this.#H[i]})),i}cancelTask(e){this.#H[e].cancel()}clearTasks(){Object.values(this.#H).forEach((e=>e.cancel()))}}$3839e9f9bae78bdd$exports={Tasks:$3839e9f9bae78bdd$var$Tasks};var $bb0fea222fc5aea5$require$Tasks=$3839e9f9bae78bdd$exports.Tasks,$45Ip7=parcelRequire("45Ip7"),$bb0fea222fc5aea5$require$UIKit=$45Ip7.UIKit,$86d2ffde19fb8791$exports={};class $86d2ffde19fb8791$var$UILoading{#U;text="";interval;fullScreen=!1;#j=()=>{};constructor(){this.#U=$text.uuid}updateText(e){$(this.#U).text=e}setLoop(e){if("function"!=typeof e)throw"loop must be a function";this.#j=e}done(){clearInterval(this.interval)}load(){$ui.render({props:{navBarHidden:this.fullScreen},views:[{type:"spinner",props:{loading:!0},layout:(e,t)=>{e.centerY.equalTo(t.super).offset(-15),e.width.equalTo(t.super)}},{type:"label",props:{id:this.#U,align:$align.center,text:""},layout:(e,t)=>{e.top.equalTo(t.prev.bottom).offset(10),e.left.right.equalTo(t.super)}}],layout:$layout.fill,events:{appeared:()=>{this.interval=setInterval((()=>{this.#j()}),100)}}})}}$86d2ffde19fb8791$exports={UILoading:$86d2ffde19fb8791$var$UILoading};var $bb0fea222fc5aea5$require$UILoading=$86d2ffde19fb8791$exports.UILoading,$6Xrbz=parcelRequire("6Xrbz"),$bb0fea222fc5aea5$require$ValidationError=$6Xrbz.ValidationError,$liCrE=parcelRequire("liCrE"),$bb0fea222fc5aea5$require$View=$liCrE.View,$bb0fea222fc5aea5$require$PageView=$liCrE.PageView,$gMc1q=parcelRequire("gMc1q"),$bb0fea222fc5aea5$require$ViewController=$gMc1q.ViewController,$12xzj=parcelRequire("12xzj"),$bb0fea222fc5aea5$require$NavigationView=$12xzj.NavigationView,$dcStC=parcelRequire("dcStC"),$bb0fea222fc5aea5$require$NavigationBar=$dcStC.NavigationBar,$bb0fea222fc5aea5$require$NavigationBarController=$dcStC.NavigationBarController,$gAYmG=parcelRequire("gAYmG"),$bb0fea222fc5aea5$require$NavigationBarItems=$gAYmG.NavigationBarItems,$bb0fea222fc5aea5$require$BarButtonItem=$gAYmG.BarButtonItem,$ee5e1f8d12d987dc$exports={},$fYz8N=parcelRequire("fYz8N"),$ee5e1f8d12d987dc$require$Controller=$fYz8N.Controller,$gAYmG=parcelRequire("gAYmG"),$ee5e1f8d12d987dc$require$BarTitleView=$gAYmG.BarTitleView;class $ee5e1f8d12d987dc$var$SearchBar extends $ee5e1f8d12d987dc$require$BarTitleView{height=35;topOffset=15;bottomOffset=10;kbType=$kbType.search;placeholder=$l10n("SEARCH");constructor(e){super(e),this.setController(new $ee5e1f8d12d987dc$var$SearchBarController),this.controller.setSearchBar(this),this.init()}init(){this.props={id:this.id,smoothCorners:!0,cornerRadius:6,bgcolor:$color("#EEF1F1","#212121")},this.views=[{type:"input",props:{id:this.id+"-input",type:this.kbType,bgcolor:$color("clear"),placeholder:this.placeholder},layout:$layout.fill,events:{changed:e=>this.controller.callEvent("onChange",e.text)}}],this.layout=(e,t)=>{e.height.equalTo(this.height),e.top.equalTo(t.super.safeArea).offset(this.topOffset),e.left.equalTo(t.super.safeArea).offset(15),e.right.equalTo(t.super.safeArea).offset(-15)}}setEvent(e,t){return this.views[0].events[e]=t,this}setPlaceholder(e){return this.placeholder=e,this}setKbType(e){return this.kbType=e,this}}class $ee5e1f8d12d987dc$var$SearchBarController extends $ee5e1f8d12d987dc$require$Controller{setSearchBar(e){return this.searchBar=e,this}updateSelector(){this.selector={inputBox:$(this.searchBar.id),input:$(this.searchBar.id+"-input")}}hide(){this.updateSelector(),this.selector.inputBox.updateLayout((e=>{e.height.equalTo(0)}))}show(){this.updateSelector(),this.selector.inputBox.updateLayout((e=>{e.height.equalTo(this.searchBar.height)}))}didScroll(e){this.updateSelector();let t=this.searchBar.height-e;if(t=t>0?t>this.searchBar.height?this.searchBar.height:t:0,this.selector.inputBox.updateLayout((e=>{e.height.equalTo(t)})),e>0){const t=(this.searchBar.height/2-5-e)/10;this.selector.input.alpha=t}else this.selector.input.alpha=1}didEndDragging(e,t,i){this.updateSelector(),e>=0&&e<=this.searchBar.height&&i($point(0,e>=this.searchBar.height/2?this.searchBar.height:0))}}$ee5e1f8d12d987dc$exports={SearchBar:$ee5e1f8d12d987dc$var$SearchBar,SearchBarController:$ee5e1f8d12d987dc$var$SearchBarController};var $bb0fea222fc5aea5$require$SearchBar=$ee5e1f8d12d987dc$exports.SearchBar,$bb0fea222fc5aea5$require$SearchBarController=$ee5e1f8d12d987dc$exports.SearchBarController;module.exports={VERSION:$bb0fea222fc5aea5$require$VERSION,Controller:$bb0fea222fc5aea5$require$Controller,FileManager:$bb0fea222fc5aea5$require$FileManager,FileStorageParameterError:$bb0fea222fc5aea5$require$FileStorageParameterError,FileStorageFileNotFoundError:$bb0fea222fc5aea5$require$FileStorageFileNotFoundError,FileStorage:$bb0fea222fc5aea5$require$FileStorage,FixedFooterView:$bb0fea222fc5aea5$require$FixedFooterView,Kernel:$bb0fea222fc5aea5$require$Kernel,Matrix:$bb0fea222fc5aea5$require$Matrix,Request:$bb0fea222fc5aea5$require$Request,Setting:$bb0fea222fc5aea5$require$Setting,Sheet:$bb0fea222fc5aea5$require$Sheet,TabBarCellView:$bb0fea222fc5aea5$require$TabBarCellView,TabBarHeaderView:$bb0fea222fc5aea5$require$TabBarHeaderView,TabBarController:$bb0fea222fc5aea5$require$TabBarController,Tasks:$bb0fea222fc5aea5$require$Tasks,UIKit:$bb0fea222fc5aea5$require$UIKit,UILoading:$bb0fea222fc5aea5$require$UILoading,ValidationError:$bb0fea222fc5aea5$require$ValidationError,View:$bb0fea222fc5aea5$require$View,PageView:$bb0fea222fc5aea5$require$PageView,ViewController:$bb0fea222fc5aea5$require$ViewController,NavigationView:$bb0fea222fc5aea5$require$NavigationView,NavigationBar:$bb0fea222fc5aea5$require$NavigationBar,NavigationBarController:$bb0fea222fc5aea5$require$NavigationBarController,NavigationBarItems:$bb0fea222fc5aea5$require$NavigationBarItems,BarButtonItem:$bb0fea222fc5aea5$require$BarButtonItem,SearchBar:$bb0fea222fc5aea5$require$SearchBar,SearchBarController:$bb0fea222fc5aea5$require$SearchBarController}; \ No newline at end of file From 8357cbc8a92313018b4a520f6fbc8c2a278bf2f0 Mon Sep 17 00:00:00 2001 From: ipuppet Date: Thu, 3 Nov 2022 17:59:22 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E7=A9=BA=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/widget/Calendar/strings/en.strings | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/widget/Calendar/strings/en.strings b/scripts/widget/Calendar/strings/en.strings index a8066b4..dc1c479 100644 --- a/scripts/widget/Calendar/strings/en.strings +++ b/scripts/widget/Calendar/strings/en.strings @@ -13,7 +13,7 @@ "SHORT_FRIDAY" = "F"; "SHORT_SATURDAY" = "S"; -"BLANK_MONTH" = " "; +"BLANK_MONTH" = ""; "JANUARY_C" = "January"; "FEBRUARY_C" = "February"; "MARCH_C" = "March"; From 87759a097189fe105fd75a3c8c35692fb18cf279 Mon Sep 17 00:00:00 2001 From: ipuppet Date: Thu, 3 Nov 2022 18:20:03 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E5=AD=97=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/app.js | 1 + scripts/widget/Calendar/calendar.js | 48 ++++++++++++++--------------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/scripts/app.js b/scripts/app.js index 059a2cc..4d6ac62 100644 --- a/scripts/app.js +++ b/scripts/app.js @@ -389,6 +389,7 @@ class Widget { module.exports = { run: () => { + //Widget.render("Calendar");return //Widget.render("Schedule");return if ($app.env === $env.widget) { Widget.render() diff --git a/scripts/widget/Calendar/calendar.js b/scripts/widget/Calendar/calendar.js index 17f55e9..11e3dcd 100644 --- a/scripts/widget/Calendar/calendar.js +++ b/scripts/widget/Calendar/calendar.js @@ -16,7 +16,6 @@ class Calendar { height width - font = "Helvetica Neue" titleBarBottomPadding = 5 weekIndexBottomPadding = 5 @@ -80,7 +79,7 @@ class Calendar { this.titleBarHeight = Math.min(this.width * 0.11, 25) // titleBarHeight 最大值限制为 25 this.columnWidth = (this.width - this.padding.h * 2) / 7 // 每列内容宽度 this.singleContentFontSize = Math.min(this.columnWidth * 0.6, 20) // 字体最大 20 - this.singleContentHeight = this.widget.getContentSize($font(this.font, this.singleContentFontSize)).height + this.singleContentHeight = this.widget.getContentSize($font(this.singleContentFontSize)).height this.contentViewHeight = this.height - this.singleContentHeight // 周指示器高度 if (!this.isLockscreen) { this.contentViewHeight -= @@ -209,15 +208,15 @@ class Calendar { formatDate = date > days ? { - month: month + 1, - date: nextMonth++, - day: formatDay - } + month: month + 1, + date: nextMonth++, + day: formatDay + } : { - month: month, - date: date, - day: formatDay - } + month: month, + date: date, + day: formatDay + } } else { // 补齐第一周前面空缺的日期 formatDate = { @@ -337,7 +336,7 @@ class Calendar { const verticalPadding = height * 0.1 const fontHeight = (height - verticalPadding * 2) / 2 - const fontSize = this.widget.getFontSizeByHeight(fontHeight, this.font) + const fontSize = this.widget.getFontSizeByHeight(fontHeight,) const extFontWidth = Math.min( fontSize, (this.columnWidth - verticalPadding * 2) / Math.min(props.ext.text.length, 4) // 最多 4 个字 @@ -374,7 +373,7 @@ class Calendar { type: "text", props: Object.assign( { - font: $font(this.font, fontSize), + font: $font(fontSize), lineLimit: 1, frame: { width: this.columnWidth } }, @@ -385,7 +384,7 @@ class Calendar { type: "text", props: Object.assign( { - font: $font(this.font, extFontWidth), + font: $font(extFontWidth), lineLimit: 2, frame: { width: this.columnWidth } }, @@ -461,7 +460,7 @@ class Calendar { type: "text", props: Object.assign( { - font: $font(this.font, this.singleContentFontSize), + font: $font(this.singleContentFontSize), lineLimit: 1, frame: { alignment: $widget.alignment.center, @@ -540,18 +539,19 @@ class Calendar { } const views = [] - const fontSize = this.widget.getFontSizeByHeight(this.titleBarHeight, this.font) + const fontSize = this.widget.getFontSizeByHeight(this.titleBarHeight, "bold") + const font = $font("bold", fontSize) views.push({ type: "text", props: { - font: $font(this.font, fontSize), + font: font, text: leftText, lineLimit: 1, color: this.colorTone, bold: true, frame: { alignment: $widget.alignment.leading, - width: this.widget.getContentSize($font(this.font, fontSize), leftText).width + width: Math.min(this.width, this.widget.getContentSize(font, leftText).width) } } }) @@ -562,7 +562,7 @@ class Calendar { views.push({ type: "text", props: { - font: $font(this.font, fontSize), + font: font, text: rightText, lineLimit: 1, minimumScaleFactor: 0.6, @@ -627,13 +627,13 @@ class Calendar { const calendar = this.family === this.setting.family.small ? this.calendarTemplate( - dayInfo => this.singleContentDayStyleModifier(dayInfo), - props => this.singleContentDayTemplate(props) - ) + dayInfo => this.singleContentDayStyleModifier(dayInfo), + props => this.singleContentDayTemplate(props) + ) : this.calendarTemplate( - dayInfo => this.multipleContentDayStyleModifier(dayInfo), - props => this.multipleContentDayTemplate(props) - ) + dayInfo => this.multipleContentDayStyleModifier(dayInfo), + props => this.multipleContentDayTemplate(props) + ) return { type: "vstack", props: {