cardbuddy 0.22.0 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/README.md +11 -11
  2. package/dist/cli.js +2 -2
  3. package/dist/config.js +3 -3
  4. package/dist/init.js +13 -13
  5. package/dist/mcp.js +1 -1
  6. package/dist/preview-editor/assets/{index-CPpLZZyi.js → index-BumNBo-n.js} +81 -80
  7. package/dist/preview-editor/assets/{index-CU8zVA2P.css → index-MWKPP9nd.css} +1 -1
  8. package/dist/preview-editor/index.html +2 -2
  9. package/dist/skills-upgrade.js +1 -1
  10. package/dist/standalone.js +2 -2
  11. package/dist/vendored/card-editor/runtime/adapter.js +10 -11
  12. package/dist/vendored/mcp/client.mjs +50 -13
  13. package/dist/vendored/mcp/tools.mjs +13 -7
  14. package/dist/vendored/server/core/ai-chat.js +540 -183
  15. package/dist/vendored/server/core/assetProxy.js +1 -1
  16. package/dist/vendored/server/core/browser.js +1 -1
  17. package/dist/vendored/server/core/cardCompile.js +202 -0
  18. package/dist/vendored/server/core/cardDigest.js +324 -0
  19. package/dist/vendored/server/core/cardExport.js +5 -5
  20. package/dist/vendored/server/core/cardFiles.js +1 -1
  21. package/dist/vendored/server/core/cardHistoryRemote.js +1 -1
  22. package/dist/vendored/server/core/cardImportMeta.js +1 -1
  23. package/dist/vendored/server/core/cardListCache.js +92 -10
  24. package/dist/vendored/server/core/cardPublish.js +11 -6
  25. package/dist/vendored/server/core/cardPublishVersions.js +8 -8
  26. package/dist/vendored/server/core/cardSave.js +14 -10
  27. package/dist/vendored/server/core/cardSidecar.js +3 -3
  28. package/dist/vendored/server/core/cardSync.js +35 -23
  29. package/dist/vendored/server/core/cardVersion.js +1 -1
  30. package/dist/vendored/server/core/flameCompile/client.js +466 -0
  31. package/dist/vendored/server/core/flameCompile/clientElements.js +372 -0
  32. package/dist/vendored/server/core/flameCompile/common.js +253 -0
  33. package/dist/vendored/server/core/flameCompile/h5.js +326 -0
  34. package/dist/vendored/server/core/flameCompile/index.js +126 -0
  35. package/dist/vendored/server/core/flameCompile/model.js +162 -0
  36. package/dist/vendored/server/core/index.js +12 -6
  37. package/dist/vendored/server/core/logger.js +1 -1
  38. package/dist/vendored/server/core/remoteCard.js +5 -5
  39. package/dist/vendored/server/core/skillPaths.js +1 -1
  40. package/dist/vendored/server/core/sliceUpload.js +4 -4
  41. package/dist/vendored/skills/README.md +13 -13
  42. package/dist/vendored/skills/card-doctor/SKILL.md +2 -2
  43. package/dist/vendored/skills/dsl-card-ai/SKILL.md +4 -4
  44. package/dist/vendored/skills/dsl-card-generator/SKILL.md +2 -2
  45. package/dist/vendored/skills/dsl-card-generator/references/amount_formatting.md +1 -1
  46. package/dist/vendored/skills/dsl-card-generator/references/build_protocol.md +54 -0
  47. package/dist/vendored/skills/dsl-card-generator/references/component_rules.md +2 -2
  48. package/dist/vendored/skills/dsl-card-generator/references/converge_protocol.md +36 -0
  49. package/dist/vendored/skills/dsl-card-generator/references/event_patterns.md +1 -1
  50. package/dist/vendored/skills/dsl-card-generator/references/generation_pitfalls.md +1 -1
  51. package/dist/vendored/skills/dsl-card-generator/references/image_to_card.md +1 -1
  52. package/dist/vendored/skills/dsl-card-generator/references/quickref.md +1 -1
  53. package/dist/vendored/skills/dsl-card-generator/references/recipes.md +4 -4
  54. package/dist/vendored/skills/dsl-card-generator/references/rules.md +1 -1
  55. package/dist/vendored/skills/dsl-card-generator/references/slices_convention.md +6 -6
  56. package/dist/vendored/skills/dsl-card-generator/scripts/inventory_schemas.py +1 -1
  57. package/dist/vendored/skills/dsl-card-generator/scripts/lib/scaffold.mjs +1 -1
  58. package/dist/vendored/skills/dsl-card-generator/scripts/lib/slice_dedupe.mjs +2 -2
  59. package/dist/vendored/skills/dsl-card-generator/vendor/preview/assets/standalone-CeVX_y-M.js +137 -0
  60. package/dist/vendored/skills/dsl-card-generator/vendor/preview/assets/standalone-DiEiY59H.css +1 -0
  61. package/dist/vendored/skills/dsl-card-generator/vendor/preview/standalone.html +2 -2
  62. package/dist/vendored/skills/{finmall-card-sync → platform-card-sync}/SKILL.md +26 -26
  63. package/dist/vendored/skills/{finmall-card-sync → platform-card-sync}/scripts/api_batch_sync.mjs +184 -162
  64. package/dist/vendored/skills/{finmall-card-sync → platform-card-sync}/scripts/slice_upload.mjs +48 -29
  65. package/dist/vendored/skills/{finmall-session-navigator → platform-session-navigator}/SKILL.md +13 -13
  66. package/dist/vendored/skills/{finmall-session-navigator → platform-session-navigator}/scripts/package-lock.json +2 -2
  67. package/dist/vendored/skills/{finmall-session-navigator → platform-session-navigator}/scripts/package.json +2 -2
  68. package/dist/vendored/skills/{finmall-session-navigator/scripts/finmall_login.mjs → platform-session-navigator/scripts/platform_login.mjs} +41 -31
  69. package/dist/vendored/skills/{finmall-session-navigator → platform-session-navigator}/scripts/session-manager.mjs +17 -17
  70. package/dist/vendored/skills/shared/README.md +21 -21
  71. package/dist/vendored/skills/shared/auth-model.md +8 -10
  72. package/dist/vendored/skills/shared/{finmall-config.mjs → platform-config.mjs} +10 -10
  73. package/dist/vendored/tools/{finmall-env.mjs → platform-env.mjs} +13 -13
  74. package/package.json +1 -1
  75. package/dist/vendored/skills/dsl-card-generator/vendor/preview/assets/standalone-BCLshIzC.css +0 -1
  76. package/dist/vendored/skills/dsl-card-generator/vendor/preview/assets/standalone-pP5kTKiI.js +0 -88
@@ -18,7 +18,7 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
18
18
  <symbol id="icon-image-upload" viewBox="0 0 24 24"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><path d="M12 19v-7"></path><path d="M9 15l3-3 3 3"></path></symbol>
19
19
  <symbol id="icon-download" viewBox="0 0 24 24"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><path d="M7 10l5 5 5-5"></path><path d="M12 15V3"></path></symbol>
20
20
  <symbol id="icon-grid" viewBox="0 0 24 24"><rect x="3" y="3" width="7" height="7" rx="1"></rect><rect x="14" y="3" width="7" height="7" rx="1"></rect><rect x="3" y="14" width="7" height="7" rx="1"></rect><path d="M14 14h3v3M21 14v7h-7v-3"></path></symbol>
21
- <!-- 移动设备(device-mobile):顶栏「远端 → 预览当前卡」语义图标,真机预览(FinMall App 扫码) -->
21
+ <!-- 移动设备(device-mobile):顶栏「远端 → 预览当前卡」语义图标,真机预览(远端 App 扫码) -->
22
22
  <symbol id="icon-device-mobile" viewBox="0 0 24 24"><rect x="5" y="2" width="14" height="20" rx="2" ry="2"></rect><line x1="12" y1="18" x2="12.01" y2="18"></line></symbol>
23
23
  <symbol id="icon-sync-box" viewBox="0 0 24 24"><rect x="3" y="5" width="14" height="14" rx="2" ry="2"></rect><path d="M21 7v10a2 2 0 0 1-2 2H7"></path></symbol>
24
24
  <symbol id="icon-locate" viewBox="0 0 24 24"><circle cx="12" cy="12" r="7"></circle><line x1="12" y1="1" x2="12" y2="5"></line><line x1="12" y1="19" x2="12" y2="23"></line><line x1="1" y1="12" x2="5" y2="12"></line><line x1="19" y1="12" x2="23" y2="12"></line></symbol>
@@ -177,7 +177,7 @@ Expected function or array of functions, received type ${typeof e}.`),m)}var ol=
177
177
  `),W(`div`,$m,[W(`button`,{class:j([`st__help`,{"st__help--open":i.helpOpen}]),type:`button`,title:`使用说明`,"aria-expanded":i.helpOpen,onClick:t[34]||=J(e=>i.helpOpen=!i.helpOpen,[`stop`])},[...t[41]||=[W(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-help`})],-1)]],10,eh),G(hc,{name:`pop`},{default:I(()=>[i.helpOpen?(V(),H(`div`,{key:0,class:`st__help-pop`,onClick:t[36]||=J(()=>{},[`stop`])},[W(`div`,th,[t[42]||=W(`span`,{class:`st__help-pop-title`},`快捷键`,-1),W(`button`,{class:`st__help-pop-close`,type:`button`,title:`关闭`,onClick:t[35]||=e=>i.helpOpen=!1},`✕`)]),q(` 快捷键清单:左列按键示意(kbd 芯片),右列一句话说明;与 App onKeydown 保持一致 `),W(`ul`,nh,[(V(!0),H(B,null,z(i.shortcuts,e=>(V(),H(`li`,{key:e.desc,class:`st__keys-row`},[W(`span`,rh,[(V(!0),H(B,null,z(e.keys,(t,n)=>(V(),H(B,{key:t},[W(`kbd`,ih,M(t),1),n<e.keys.length-1?(V(),H(`span`,ah,`+`)):q(`v-if`,!0)],64))),128))]),W(`span`,oh,M(e.desc),1)]))),128))])])):q(`v-if`,!0)]),_:1})])])}var ch=Z(Bm,[[`render`,sh],[`__file`,`/Users/ynet/dsl-card/card-editor/components/StructureTree.vue`]]),lh=e=>e===void 0?e:JSON.parse(JSON.stringify(e)),uh={className:`Root`,name:`根节点`,styleState:{},styleVisible:{rect:!0,flex:!0,background:!0,padding:!0,margin:!0,borderRadius:!0,border:!0,shadow:!0,transform:!0,other:!0},styleMeta:{},properties:[],slots:[],events:[{eventName:`初始化完成`,eventKey:`onReady`}]};function dh(e){return e===`Root`?uh:ju[e]||null}function fh(e={},t={},n={}){let r=[];return Mu.forEach(i=>{let a=e[i.itemKey];if(!a)return;let o=new X(i),s=o.itemChildren&&o.itemChildren.properties||[];if(a&&typeof a==`object`)for(let e=0;e<s.length;e++)a[s[e].itemKey]||s.splice(e--,1);if(!s.length)return;let c=t[i.itemKey]||{};s.forEach(e=>{let t=c[e.itemKey];t&&(t.itemName&&(e.itemName=t.itemName),t.itemOption&&(e.itemOption=Object.assign({},e.itemOption,t.itemOption)))}),n[i.itemKey]&&wu.setPropertyValue(s,n[i.itemKey]),o.itemValueFrom=`0`,r.push(o)}),r}var ph=class{constructor(e={}){this.schemaNode=e,this.className=e.className||`Root`,this.isRoot=this.className===`Root`;let t=dh(this.className);this.metaMissing=!t,this.meta=t||{properties:[],events:[],styleVisible:{},styleState:{},styleMeta:{}},this.name=this.meta.name||this.className,this.events=this.meta.events||[],this.properties=(this.meta.properties||[]).map(e=>new X(e)),X.restoreProperty(e.properties||[],this.properties),X.updatePropertyVisible(this.properties),this.extraProperties=this._orphans(e.properties,this.properties),this.hasDirectives=!this.isRoot,this.directives=this.hasDirectives?Pu.map(e=>new X(e)):[],this.hasDirectives?(X.restoreProperty(e.directives||[],this.directives),X.updatePropertyVisible(this.directives),this.extraDirectives=this._orphans(e.directives,this.directives)):this.extraDirectives=[],this.style=new Fu({state:this.meta.styleState,visible:this.meta.styleVisible,meta:this.meta.styleMeta}),this.style.onRestore(e.style||{}),this.styleForm=fh(this.meta.styleVisible||{},this.meta.styleMeta||{},this.meta.styleState||{}),X.restoreProperty(this.style.onExport().properties,this.styleForm),X.updatePropertyVisible(this.styleForm)}refreshVisible(){X.updatePropertyVisible(this.properties),this.hasDirectives&&X.updatePropertyVisible(this.directives),X.updatePropertyVisible(this.styleForm)}applyStyleChange(e,t=[]){let n=null;for(let e=t.length-1;e>=0;e--)n={itemId:t[e].itemId,child:n};X.updatePropertyVisible(this.styleForm),this.style.applyChange(e,n)}exportProperties(){return this.properties.reduce((e,t)=>{let n=t.onExport();return n&&e.push(n),e},[]).concat(this.extraProperties.map(e=>lh(e)))}exportDirectives(){return this.directives.reduce((e,t)=>{let n=t.onExport();return n&&e.push(n),e},[]).concat(this.extraDirectives.map(e=>lh(e)))}_orphans(e,t){let n=new Set;return(t||[]).forEach(e=>{e.itemId&&n.add(e.itemId),e.itemKey&&n.add(e.itemKey)}),(e||[]).filter(e=>e&&e.itemId&&!n.has(e.itemId)&&!(e.itemKey&&n.has(e.itemKey))).map(e=>lh(e))}exportStyle(){return this.style.onExport()}applyToSchema(){let e=this.schemaNode;e.properties=this.exportProperties(),e.style=this.exportStyle(),this.hasDirectives&&(e.directives=this.exportDirectives())}toSchemaFragment(){let e={properties:this.exportProperties(),style:this.exportStyle()};return this.hasDirectives&&(e.directives=this.exportDirectives()),lh(e)}},mh={name:`NodeInspector`,props:{comp:{type:Object,required:!0},compNames:{type:Object,default:()=>({})},rt:{type:Object,required:!0}},emits:[`apply`,`commit`,`close`],data(){return{model:null,secOpen:{basic:!0,props:!0,style:!0,directive:!0},_t:null,_snapshot:null,_dirty:!1,_written:!1}},computed:{schemaNode(){return this.comp&&this.comp._schemaNode||null},compName(){let e=this.schemaNode&&this.schemaNode.className;return e?this.compNames&&this.compNames[e]||e:`节点`},styleWatches(){let e={},t=n=>{(n||[]).forEach(n=>{n.itemKey!=null&&(e[n.itemKey]=n.itemValue),n.itemChildren&&n.itemChildren.properties&&t(n.itemChildren.properties)})};return this.model&&t(this.model.styleForm),e}},watch:{comp:{immediate:!0,handler(){this.buildModel()}}},methods:{buildModel(){let e=this.schemaNode;this.model=e?cn(new ph(e)):null,this._snapshot=e?this.snapshotNode(e):null,this._dirty=!1,this._written=!1},snapshotNode(e){let t=t=>Object.prototype.hasOwnProperty.call(e,t),n=e=>e===void 0?void 0:JSON.parse(JSON.stringify(e));return{hasProperties:t(`properties`),properties:n(e.properties),hasStyle:t(`style`),style:n(e.style),hasDirectives:t(`directives`),directives:n(e.directives),hasComponentId:t(`componentId`),componentId:n(e.componentId),hasName:t(`name`),name:n(e.name)}},restoreSnapshot(){let e=this.schemaNode;if(!e||!this._snapshot)return;let t=this._snapshot,n=(t,n,r)=>{t?e[n]=JSON.parse(JSON.stringify(r)):delete e[n]};n(t.hasProperties,`properties`,t.properties),n(t.hasStyle,`style`,t.style),n(t.hasDirectives,`directives`,t.directives),n(t.hasComponentId,`componentId`,t.componentId),n(t.hasName,`name`,t.name)},toggleSec(e){this.secOpen[e]=!this.secOpen[e],this.secOpen=Object.assign({},this.secOpen)},hasField(e){return this.schemaNode&&Object.prototype.hasOwnProperty.call(this.schemaNode,e)},onMetaInput(e,t){this.schemaNode&&(this.schemaNode[e]=t,this._dirty=!0,this.scheduleApply())},onPropChange(){this.model.refreshVisible(),this._dirty=!0,this.scheduleApply()},onStyleChange(e){e&&e.length&&(this.model.applyStyleChange(e[0],e.slice(1)),this.model.refreshVisible(),this._dirty=!0,this.scheduleApply())},onStyleSync(e){if(e){for(let t in e){let n=String(t).split(`.`);if(n.length<3||n[0]!==`style`)continue;let r=n[1],i=n[2],a=this.model.styleForm.find(e=>e.itemKey===r);if(!a)continue;let o=a.itemChildren.properties.find(e=>e.itemKey===i);o&&(o.itemValue=e[t],this.model.applyStyleChange(a,[o]))}this.model.refreshVisible(),this.scheduleApply()}},scheduleApply(){this._t&&clearTimeout(this._t),this._t=setTimeout(()=>{this.applyAll(),this.$emit(`apply`)},250)},applyAll(){this.model&&this.model.applyToSchema()},onApplyWrite(){this._t&&=(clearTimeout(this._t),null),this.applyAll(),this._written=!0,this.$emit(`apply`),this.$emit(`commit`),this.$emit(`close`)},discardAndClose(){this._t&&=(clearTimeout(this._t),null),this._dirty&&!this._written&&(this.restoreSnapshot(),this.$emit(`apply`)),this.$emit(`close`)},onClose(){this.discardAndClose()},onCancel(){this.discardAndClose()}}},hh={class:`ni-overlay`},gh={class:`ni-panel modal-card`},_h={class:`ni-head`},vh={class:`ni-title`},yh={class:`ni-cls`},bh={key:0,class:`ni-body`},xh={key:1,class:`ni-body`},Sh={class:`ni-scroll`},Ch={class:`ni-sec`},wh={class:`ni-sec-body`},Th={class:`ni-field-row`},Eh={class:`ni-static`},Dh={key:0,class:`ni-field-row`},Oh=[`value`],kh={key:1,class:`ni-field-row`},Ah=[`value`],jh={class:`ni-sec`},Mh={class:`ni-sec-body`},Nh={class:`ni-sec`},Ph={class:`ni-sec-body`},Fh={key:0,class:`ni-sec`},Ih={class:`ni-sec-body`},Lh={key:0,class:`ni-empty`},Rh={class:`ni-foot`},zh={class:`ni-foot-btns`};function Bh(e,t,n,r,i,a){let o=R(`prop-tree`);return V(),H(`div`,hh,[W(`div`,gh,[W(`div`,_h,[W(`span`,vh,[K(` 节点属性 · `+M(a.compName)+` `,1),W(`em`,yh,M(a.schemaNode&&a.schemaNode.className),1)]),W(`button`,{class:`ni-close`,type:`button`,onClick:t[0]||=(...e)=>a.onClose&&a.onClose(...e)})]),i.model?(V(),H(`div`,xh,[q(` ============ 属性 ============ `),W(`div`,Sh,[q(` 基本信息 `),W(`section`,Ch,[W(`div`,{class:`ni-sec-head`,onClick:t[1]||=e=>a.toggleSec(`basic`)},[W(`span`,{class:j([`ni-caret`,{"is-open":i.secOpen.basic}])},`▸`,2),t[10]||=K(`基本信息 `,-1)]),L(W(`div`,wh,[W(`div`,Th,[t[11]||=W(`label`,{class:`ni-field-label`},`组件类型`,-1),W(`span`,Eh,M(a.compName),1)]),a.hasField(`componentId`)?(V(),H(`div`,Dh,[t[12]||=W(`label`,{class:`ni-field-label`},`实例 ID`,-1),W(`input`,{class:`ni-input`,value:a.schemaNode.componentId,onInput:t[2]||=e=>a.onMetaInput(`componentId`,e.target.value)},null,40,Oh)])):q(`v-if`,!0),a.hasField(`name`)?(V(),H(`div`,kh,[t[13]||=W(`label`,{class:`ni-field-label`},`节点名`,-1),W(`input`,{class:`ni-input`,value:a.schemaNode.name,onInput:t[3]||=e=>a.onMetaInput(`name`,e.target.value)},null,40,Ah)])):q(`v-if`,!0)],512),[[Nc,i.secOpen.basic]])]),q(` 组件属性 `),L(W(`section`,jh,[W(`div`,{class:`ni-sec-head`,onClick:t[4]||=e=>a.toggleSec(`props`)},[W(`span`,{class:j([`ni-caret`,{"is-open":i.secOpen.props}])},`▸`,2),t[14]||=K(` 组件属性 `,-1)]),L(W(`div`,Mh,[G(o,{properties:i.model.properties,mode:`property`,plain:!0,onLeafChange:a.onPropChange,onLeafSync:a.onStyleSync},null,8,[`properties`,`onLeafChange`,`onLeafSync`])],512),[[Nc,i.secOpen.props]])],512),[[Nc,i.model.properties.length]]),q(` 样式 `),W(`section`,Nh,[W(`div`,{class:`ni-sec-head`,onClick:t[5]||=e=>a.toggleSec(`style`)},[W(`span`,{class:j([`ni-caret`,{"is-open":i.secOpen.style}])},`▸`,2),t[15]||=K(` 样式 `,-1)]),L(W(`div`,Ph,[G(o,{properties:i.model.styleForm,mode:`style`,watches:a.styleWatches,plain:!0,onLeafChange:a.onStyleChange,onLeafSync:a.onStyleSync},null,8,[`properties`,`watches`,`onLeafChange`,`onLeafSync`])],512),[[Nc,i.secOpen.style]])]),q(` 指令 `),i.model.hasDirectives?(V(),H(`section`,Fh,[W(`div`,{class:`ni-sec-head`,onClick:t[6]||=e=>a.toggleSec(`directive`)},[W(`span`,{class:j([`ni-caret`,{"is-open":i.secOpen.directive}])},`▸`,2),t[16]||=K(` 指令 `,-1)]),L(W(`div`,Ih,[i.model.directives.length?(V(),U(o,{key:1,properties:i.model.directives,mode:`directive`,"b-exchange":!1,plain:!0,onLeafChange:a.onPropChange,onLeafSync:a.onStyleSync},null,8,[`properties`,`onLeafChange`,`onLeafSync`])):(V(),H(`p`,Lh,`无指令`))],512),[[Nc,i.secOpen.directive]])])):q(`v-if`,!0)])])):(V(),H(`div`,bh,[...t[9]||=[W(`p`,{class:`ni-empty`},`无法定位该节点的原始 schema(_schemaNode 缺失)`,-1)]])),W(`div`,Rh,[t[17]||=W(`span`,{class:`ni-tip`},`编辑即时预览(不记历史);「取消」丢弃改动并还原,「应用」写入历史并关闭,落盘由顶栏「保存到本地」负责`,-1),W(`div`,zh,[W(`button`,{class:`ni-btn ni-btn--ghost`,type:`button`,onClick:t[7]||=(...e)=>a.onCancel&&a.onCancel(...e)},`取消`),W(`button`,{class:`ni-btn`,type:`button`,onClick:t[8]||=(...e)=>a.onApplyWrite&&a.onApplyWrite(...e)},`应用`)])])])])}var Vh=Z(mh,[[`render`,Bh],[`__file`,`/Users/ynet/dsl-card/card-editor/components/NodeInspector.vue`]]),Hh={_source:`docs/动态卡片方案详细说明.md(JSAPI 章节)+ src/cards/*/schema.json 实测形态`,_note:`事件动作元数据。properties 采用与 component-meta / style-meta 完全一致的 Property meta 形态,可直接喂给 Property / PropTree / PropControl,无需任何专用渲染分支。itemRequired 的项在导出时总是写回 schema(对齐线上:customAction 永远带 function 项);非必填项只有在 schema 原本就有、或用户改过值时才写回,避免把默认值污染进 DSL 产品数据。`,lifecycleEvents:[{eventKey:`onReady`,eventName:`初始化完成`,eventDesc:`卡片渲染就绪时执行一次`}],actions:[{actionType:`customAction`,actionName:`自定义动作`,actionDesc:`执行一段 JavaScript。this 为卡片上下文:state / data / setData / setRootData / postMessage / addEventListener`,properties:[{itemId:`001`,itemKey:`function`,itemName:`脚本`,itemType:`Code`,itemTypeRange:`const`,itemRequired:!0,itemDefaultValue:{},itemOption:{language:`javascript`,codeKey:`code`},itemDesc:`事件回调函数体,形参为 event`}]},{actionType:`startRouter`,actionName:`路由跳转`,actionDesc:`ynet.callJSAPI('startRouter', { targetUrl, urlType, isLoginNeeded, extra })`,properties:[{itemId:`001`,itemKey:`targetUrl`,itemName:`跳转地址`,itemType:`Input`,itemTypeRange:`const,var`,itemRequired:!0,itemDefaultValue:``,itemDesc:`目标页面地址`},{itemId:`002`,itemKey:`urlType`,itemName:`地址类型`,itemType:`Select`,itemTypeRange:`const`,itemRequired:!0,itemDefaultValue:`3`,itemOption:{iParamList:[{key:`2`,value:`离线包`},{key:`3`,value:`在线页面`},{key:`4`,value:`原生页面`}]}},{itemId:`003`,itemKey:`isLoginNeeded`,itemName:`是否需要登录`,itemType:`Select`,itemTypeRange:`const`,itemRequired:!0,itemDefaultValue:`1`,itemOption:{iParamList:[{key:`1`,value:`需要登录`},{key:`0`,value:`不需要登录`}]}},{itemId:`004`,itemKey:`extra`,itemName:`备用参数`,itemType:`Textarea`,itemTypeRange:`const,var`,itemDefaultValue:``,itemDesc:`JSON 文本,透传给原生`}]},{actionType:`sendAiChatMessage`,actionName:`发送智能体消息`,actionDesc:`ynet.callJSAPI('sendAiChatMessage', { message })`,properties:[{itemId:`001`,itemKey:`message`,itemName:`消息内容`,itemType:`Input`,itemTypeRange:`const,var`,itemRequired:!0,itemDefaultValue:``,itemDesc:`发送给智能体的文本`}]},{actionType:`closeAlertCard`,actionName:`关闭弹窗卡片`,actionDesc:`ynet.callJSAPI('closeAlertCard', { cardCode, index, data });三项均可不填,默认关闭最上层弹窗`,properties:[{itemId:`001`,itemKey:`cardCode`,itemName:`卡片编码`,itemType:`Input`,itemTypeRange:`const,var`,itemDefaultValue:``,itemDesc:`按 cardCode 从堆栈自上而下关闭一个;不填则关最上层`},{itemId:`002`,itemKey:`index`,itemName:`关闭层数`,itemType:`InputNumber`,itemTypeRange:`const`,itemDefaultValue:``,itemOption:{max:0,min:-10,step:1},itemDesc:`-1 关一层,-2 关两层,以此类推;优先级高于卡片编码`},{itemId:`003`,itemKey:`data`,itemName:`回传数据`,itemType:`Textarea`,itemTypeRange:`const,var`,itemDefaultValue:``,itemDesc:`JSON 文本,作为 alertCard 的回调参数`}]}]},Uh=0,Wh=e=>`${e}_${(++Uh).toString(36)}`,Gh=e=>e===void 0?e:JSON.parse(JSON.stringify(e)),Kh=Hh.lifecycleEvents||[],qh=Hh.actions||[],Jh=qh.reduce((e,t)=>(e[t.actionType]=t,e),{});function Yh(e,t){let n=new Set;return(t||[]).forEach(e=>{e.itemId&&n.add(e.itemId),e.itemKey&&n.add(e.itemKey)}),(e||[]).filter(e=>e&&e.itemId&&!n.has(e.itemId)&&!(e.itemKey&&n.has(e.itemKey))).map(e=>Gh(e))}function Xh(e,t){let n={};return Object.keys(e||{}).forEach(r=>{t.indexOf(r)<0&&(n[r]=Gh(e[r]))}),n}var Zh=class{constructor(e={}){let t=e.event||{},n=e.action||{};this.uid=Wh(`ea`),this.eventKey=t.eventKey||``,this.eventName=t.eventName||``,this.actionType=n.actionType||``,this._extraEvent=Xh(t,[`eventKey`,`eventName`]),this._extraAction=Xh(n,[`actionType`,`properties`]),this.properties=[],this.extraProperties=[],this.buildProps(n.properties||[])}buildProps(e=[]){let t=(Jh[this.actionType]||{}).properties||[];this.properties=t.map(e=>{let t=new X(e);return t.itemRequired=!!e.itemRequired,t}),X.restoreProperty(e,this.properties),X.updatePropertyVisible(this.properties),this.extraProperties=Yh(e,this.properties),this.formKey=Wh(`form`)}isPristine(e){let t=e.itemValue;if(t===``||t==null)return!0;try{return JSON.stringify(t)===JSON.stringify(e.itemDefaultValue)}catch{return t===e.itemDefaultValue}}get summary(){if(this.actionType===`customAction`){let e=this.properties.find(e=>e.itemKey===`function`),t=e&&e.itemValue&&typeof e.itemValue==`object`&&e.itemValue.code||``;if(!t)return`空脚本`;let n=String(t).split(`
178
178
  `).find(e=>e.trim())||``;return n.trim().slice(0,46)+(n.trim().length>46?`…`:``)}let e=this.properties.filter(e=>!this.isPristine(e));return e.length?e.map(e=>`${e.itemName}=${String(e.itemValue).slice(0,20)}`).join(`,`):`未配置参数`}exportProps(){let e=[];return this.properties.forEach(t=>{if(!(t.itemRequired||t.itemUpdated||!this.isPristine(t)))return;let n=t.onExport();n&&e.push(n)}),e.concat(this.extraProperties.map(e=>Gh(e)))}},Qh=class{constructor(e={}){this.schemaNode=e,this.className=e.className||`Root`;let t=dh(this.className)||{};this.metaEvents=(t.events||[]).map(e=>Gh(e)),this.hadKey=Object.prototype.hasOwnProperty.call(e,`eventactions`),this.rows=(e.eventactions||[]).map(e=>new Zh(e))}get count(){return this.rows.length}get eventOptions(){let e=new Set,t=[];return(this.className===`Root`?this.metaEvents.concat(Kh):this.metaEvents).forEach(n=>{n&&n.eventKey&&!e.has(n.eventKey)&&(e.add(n.eventKey),t.push(n))}),t}eventOptionsFor(e){let t=this.eventOptions;return e.eventKey&&!t.some(t=>t.eventKey===e.eventKey)?t.concat([{eventKey:e.eventKey,eventName:e.eventName||e.eventKey,_unknown:!0}]):t}actionOptionsFor(e){let t=this.eventOptions.find(t=>t.eventKey===e.eventKey),n=t&&t.includes,r=n&&n.length?qh.filter(e=>n.indexOf(e.actionType)>=0):qh;return e.actionType&&!r.some(t=>t.actionType===e.actionType)?r.concat([{actionType:e.actionType,actionName:e.actionType,_unknown:!0}]):r}eventNameOf(e){let t=this.eventOptions.find(t=>t.eventKey===e);return t?t.eventName:``}get eventactionMap(){let e={};return this.rows.forEach(t=>{t.eventKey&&(e[t.eventKey]=t)}),e}rowForEvent(e){return this.eventactionMap[e]||null}toggleEvent(e){let t=e&&e.eventKey;if(!t)return;let n=this.rowForEvent(t);if(n)this.removeRow(n);else{let n=this.actionOptionsForEvent(t,``),r=n.length?n[0].actionType:`customAction`,i=new Zh({event:{eventKey:t,eventName:e.eventName||this.eventNameOf(t)},action:{actionType:r,properties:[]}});this.rows.push(i)}}actionOptionsForEvent(e,t){let n=this.eventOptions.find(t=>t.eventKey===e),r=n&&n.includes,i=r&&r.length?qh.filter(e=>r.indexOf(e.actionType)>=0):qh;return t&&!i.some(e=>e.actionType===t)?i.concat([{actionType:t,actionName:t,_unknown:!0}]):i}setEventKey(e,t){e.eventKey=t||``,e.eventName=this.eventNameOf(e.eventKey)||e.eventName;let n=this.actionOptionsFor(e);e.actionType&&!n.some(t=>t.actionType===e.actionType)&&n.length&&this.setActionType(e,n[0].actionType)}setActionType(e,t){if(t===e.actionType)return;let n={};e.properties.forEach(e=>{e.itemKey&&(n[e.itemKey]={itemValue:Gh(e.itemValue),itemValueFrom:e.itemValueFrom})}),e.actionType=t||``,e.buildProps([]),e.properties.forEach(e=>{let t=n[e.itemKey];t&&t.itemValue!==``&&t.itemValue!=null&&(e.itemValue=t.itemValue,e.itemValueFrom=t.itemValueFrom,e.itemUpdated=!0)}),X.updatePropertyVisible(e.properties)}addRow(){let e=this.eventOptions[0],t=new Zh({event:e?{eventKey:e.eventKey,eventName:e.eventName}:{},action:{actionType:`customAction`,properties:[]}});return this.rows.push(t),t}removeRow(e){let t=this.rows.indexOf(e);t>=0&&this.rows.splice(t,1)}moveRow(e,t){if(e<0||e>=this.rows.length)return;let n=Math.max(0,Math.min(this.rows.length-1,t));if(n===e)return;let[r]=this.rows.splice(e,1);this.rows.splice(n,0,r)}refreshVisible(){this.rows.forEach(e=>X.updatePropertyVisible(e.properties))}export(){return this.rows.map(e=>{let t=e.eventKey?Object.assign({},e._extraEvent,{eventName:this.eventNameOf(e.eventKey)||e.eventName||void 0,eventKey:e.eventKey}):Object.assign({},e._extraEvent);return t.eventName===void 0&&delete t.eventName,{event:t,action:Object.assign({},e._extraAction,{actionType:e.actionType,properties:e.exportProps()})}})}applyToSchema(){(this.hadKey||this.rows.length)&&(this.schemaNode.eventactions=this.export(),this.hadKey=!0)}},$h={name:`EventEditor`,props:{comp:{type:Object,required:!0},compNames:{type:Object,default:()=>({})},rt:{type:Object,required:!0}},emits:[`apply`,`commit`,`close`],data(){return{eventModel:null,activeKey:``,helpOpen:!1,_t:null,_snapshot:null,_dirty:!1,_written:!1}},computed:{schemaNode(){return this.comp&&this.comp._schemaNode||null},compName(){let e=this.schemaNode&&this.schemaNode.className;return e?this.compNames&&this.compNames[e]||e:`节点`},activeRow(){return!this.eventModel||!this.activeKey?null:this.eventModel.rowForEvent(this.activeKey)||null},helpText(){return(this.activeRow?this.actionDesc(this.activeRow.actionType):``)||`先在上方开启事件,再选择动作类型并填写参数;编辑即时预览,「应用」写入历史。`}},watch:{comp:{immediate:!0,handler(){this.buildModel()}}},methods:{buildModel(){let e=this.schemaNode;this.eventModel=e?cn(new Qh(e)):null,this.activeKey=``,this.helpOpen=!1,this._snapshot=e?this.snapshotEventActions(e):null,this._dirty=!1,this._written=!1,this.autoSelect()},snapshotEventActions(e){let t=Object.prototype.hasOwnProperty.call(e,`eventactions`);return{hadKey:t,eventactions:t?JSON.parse(JSON.stringify(e.eventactions||[])):[]}},restoreSnapshot(){let e=this.schemaNode;e&&this._snapshot&&(this._snapshot.hadKey?e.eventactions=JSON.parse(JSON.stringify(this._snapshot.eventactions||[])):delete e.eventactions)},autoSelect(){if(!this.eventModel){this.activeKey=``;return}let e=this.eventModel.eventOptions.find(e=>this.eventModel.rowForEvent(e.eventKey));this.activeKey=e?e.eventKey:``},isOn(e){return!!(this.eventModel&&this.eventModel.rowForEvent(e.eventKey))},onSelectEvent(e){this.activeKey=e.eventKey},onToggleEvent(e){let t=this.isOn(e);this.eventModel.toggleEvent(e),this._dirty=!0,t?this.activeKey===e.eventKey&&(this.activeKey=``):this.activeKey=e.eventKey,this.scheduleApply()},actionOptions(e){return(this.eventModel.actionOptionsForEvent(e.eventKey,e.actionType)||[]).map(e=>({key:e.actionType,value:e.actionName+(e._unknown?` · meta 未定义`:``)}))},actionDesc(e){return Jh[e]&&Jh[e].actionDesc||``},onActionType(e,t){this.eventModel.setActionType(e,t),this._dirty=!0,this.scheduleApply()},onEventLeaf(){this.eventModel.refreshVisible(),this._dirty=!0,this.scheduleApply()},scheduleApply(){this._t&&clearTimeout(this._t),this._t=setTimeout(()=>{this.applyAll(),this.$emit(`apply`)},250)},applyAll(){this.eventModel&&this.eventModel.applyToSchema()},onApplyWrite(){this._t&&=(clearTimeout(this._t),null),this.applyAll(),this._written=!0,this.$emit(`apply`),this.$emit(`commit`),this.$emit(`close`)},onCancel(){this.onClose()},onClose(){this._t&&=(clearTimeout(this._t),null),this._dirty&&!this._written&&(this.restoreSnapshot(),this.$emit(`apply`)),this.$emit(`close`)}}},eg={class:`ee-overlay`},tg={class:`ee-panel`},ng={class:`ee-head`},rg={class:`ee-title`},ig={class:`ee-cls`},ag={class:`ee-body`},og={class:`ee-side`},sg={key:0,class:`ee-empty`},cg={key:1,class:`ee-evt-list`},lg=[`onClick`],ug=[`title`],dg=[`aria-checked`,`onClick`],fg=[`title`],pg={class:`ee-help__text`},mg={class:`ee-detail`},hg={class:`ee-detail-head`},gg={class:`ee-field-row`},_g={class:`ee-detail-body`},vg={key:1,class:`ee-empty`},yg={key:2,class:`ee-evt-orphan`},bg={key:1,class:`ee-empty ee-detail-empty`},xg={class:`ee-foot`},Sg={class:`ee-foot-btns`};function Cg(e,t,n,r,i,a){let o=R(`Dropdown`),s=R(`prop-tree`);return V(),H(`div`,eg,[W(`div`,tg,[W(`div`,ng,[W(`span`,rg,[K(` 事件配置 · `+M(a.compName)+` `,1),W(`em`,ig,M(a.schemaNode&&a.schemaNode.className),1)]),W(`button`,{class:`ee-close`,type:`button`,onClick:t[0]||=(...e)=>a.onClose&&a.onClose(...e)})]),W(`div`,ag,[W(`aside`,og,[!i.eventModel||!i.eventModel.eventOptions.length?(V(),H(`p`,sg,`该节点无可用事件`)):(V(),H(`div`,cg,[(V(!0),H(B,null,z(i.eventModel.eventOptions,e=>(V(),H(`div`,{key:e.eventKey,class:j([`ee-evt`,{"is-on":a.isOn(e),"is-sel":i.activeKey===e.eventKey}]),onClick:t=>a.onSelectEvent(e)},[W(`span`,{class:`ee-evt-name`,title:e.eventDesc||e.eventName||e.eventKey},M(e.eventName||e.eventKey),9,ug),W(`button`,{class:j([`ee-switch`,{"is-on":a.isOn(e)}]),type:`button`,role:`switch`,"aria-checked":a.isOn(e),onClick:J(t=>a.onToggleEvent(e),[`stop`])},[...t[7]||=[W(`span`,{class:`ee-switch__dot`},null,-1)]],10,dg)],10,lg))),128))])),q(` 帮助图标:与事件项左右靠边、垂直居中;点击弹出当前动作的使用说明 `),W(`button`,{class:`ee-help`,type:`button`,title:i.helpOpen?`关闭使用说明`:`使用说明`,onClick:t[1]||=J(e=>i.helpOpen=!i.helpOpen,[`stop`])},[...t[8]||=[W(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-help`})],-1)]],8,fg),i.helpOpen?(V(),H(`div`,{key:2,class:`ee-help__mask`,onClick:t[2]||=e=>i.helpOpen=!1})):q(`v-if`,!0),G(hc,{name:`pop`},{default:I(()=>[i.helpOpen?(V(),H(`div`,{key:0,class:`ee-help__pop`,onClick:t[3]||=J(()=>{},[`stop`])},[W(`p`,pg,M(a.helpText),1)])):q(`v-if`,!0)]),_:1})]),W(`section`,mg,[a.activeRow?(V(),H(B,{key:0},[W(`div`,hg,[W(`div`,gg,[t[9]||=W(`label`,{class:`ee-field-label`},`动作类型`,-1),G(o,{value:a.activeRow.actionType,options:a.actionOptions(a.activeRow),size:`sm`,block:``,onChange:t[4]||=e=>a.onActionType(a.activeRow,e)},null,8,[`value`,`options`])])]),W(`div`,_g,[a.activeRow.properties.length?(V(),U(s,{key:a.activeRow.formKey,properties:a.activeRow.properties,mode:`event`,plain:!0,onLeafChange:a.onEventLeaf},null,8,[`properties`,`onLeafChange`])):(V(),H(`p`,vg,`该动作无可配置参数`)),a.activeRow.extraProperties.length?(V(),H(`p`,yg,` 另有 `+M(a.activeRow.extraProperties.length)+` 项 meta 未定义的参数,已原样保留 `,1)):q(`v-if`,!0)])],64)):(V(),H(`p`,bg,`请在左侧开启并选择一个事件`))])]),W(`div`,xg,[t[10]||=W(`span`,{class:`ee-tip`},`编辑即时预览(不记历史);「应用」写入历史并关闭,落盘由顶栏「保存到本地」负责`,-1),W(`div`,Sg,[W(`button`,{class:`ee-btn ee-btn--ghost`,type:`button`,onClick:t[5]||=(...e)=>a.onCancel&&a.onCancel(...e)},`取消`),W(`button`,{class:`ee-btn`,type:`button`,onClick:t[6]||=(...e)=>a.onApplyWrite&&a.onApplyWrite(...e)},`应用`)])])])])}var wg=Z($h,[[`render`,Cg],[`__file`,`/Users/ynet/dsl-card/card-editor/components/EventEditor.vue`]]),Tg={0:{text:`未发布`,cls:`debug__tag--warn`},1:{text:`发布中`,cls:`debug__tag--ok`},2:{text:`已完成`,cls:`debug__tag--done`},3:{text:`已停止`,cls:`debug__tag--err`}},Eg={name:`PublishVersionsDialog`,props:{visible:{type:Boolean,default:!1},cardCode:{type:String,default:``}},emits:[`close`],components:{ConfirmDialog:Ap},data(){return{list:[],page:1,totalNums:0,totalPages:1,maxVersion:``,loading:!1,loadingMore:!1,error:``,loginNeeded:!1,stopTarget:null,publishTarget:null,busyId:``}},computed:{hasMore(){return this.page<this.totalPages},stopMessage(){let e=this.stopTarget;if(!e)return``;let t=e.platformStr||`全部平台`;return[`将立即结束版本 ${e.version} 在「${t}」上的发布任务。`,``,`已发布的内容不会回滚,但后续灰度推送会就此停止;该操作不可撤销,如仍需发布需重新发起一次发布任务。`].join(`
179
179
  `)},publishMessage(){let e=this.publishTarget;if(!e)return``;let t=e.platformStr||`全部平台`,n=[`将为版本 ${e.version} 创建一条「正式发布」任务,推送到「${t}」。`,``,`这是正式发布(不做灰度分批),发布后该版本即面向全部用户;如需撤回,可在本表对该版本执行「停止发布」。`];return String(e.publishStatus)===`1`&&n.push(``,`注意:该版本当前状态为「发布中」(已上线)。本次会为其创建一条新的发布任务,远端不会覆盖或作废旧任务。`),n.join(`
180
- `)}},watch:{visible:{immediate:!0,handler(e){e&&this.fetchPage(1)}}},methods:{statusText(e){let t=Tg[String(e)];return t?t.text:e?`未知(${e})`:`未知`},statusClass(e){let t=Tg[String(e)];return t?t.cls:`debug__tag--warn`},async fetchPage(e){if(!this.cardCode)return;let t=e>1;if(t){if(this.loadingMore||this.loading)return;this.loadingMore=!0}else{if(this.loading)return;this.loading=!0}this.error=``,this.loginNeeded=!1;try{let n=await Y(`/__card-publish-versions/${encodeURIComponent(this.cardCode)}?pageNo=${e}&pageSize=20`),r=await n.json().catch(()=>({}));if(r&&r.needCredentials){this.loginNeeded=!0;return}if(!n.ok||!r||!r.ok)throw Error(r&&(r.message||r.error)||`HTTP `+n.status);this.list=t?this.list.concat(r.list||[]):r.list||[],this.totalNums=r.totalNums||0,this.totalPages=r.totalPages||1,t||(this.maxVersion=r.maxVersion||r.list&&r.list[0]&&r.list[0].version||``),this.page=e}catch(e){this.error=e&&e.message||`查询失败`}finally{this.loading=!1,this.loadingMore=!1}},onScroll(e){let t=e.target;t&&!this.loading&&!this.loadingMore&&this.hasMore&&t.scrollTop+t.clientHeight>=t.scrollHeight-24&&this.fetchPage(this.page+1)},canStop(e){return!!(e&&e.task&&e.task.taskId&&e.task.taskStatus!==`0`)},canPublish(e){return!!e&&!!e.versionId&&!this.canStop(e)},stopTitle(e){return this.canStop(e)?`停止版本 ${e.version} 的发布`:`版本 ${e.version} 没有进行中的发布任务`},publishTitle(e){return this.canPublish(e)?e&&String(e.publishStatus)===`1`?`重新发布版本 ${e.version}(将创建新的发布任务)`:`发布版本 ${e.version}(正式发布)`:e&&e.task?`版本 ${e.version} 正在发布中,如需重新发布请先停止`:`版本 ${e.version} 暂不可发布`},busyStop(e){return!!this.busyId&&!!(e&&e.task&&e.task.taskId===this.busyId)},busyPublish(e){return!!this.busyId&&!!(e&&e.versionId===this.busyId)},askStop(e){!this.busyId&&this.canStop(e)&&(this.stopTarget=e)},askPublish(e){!this.busyId&&this.canPublish(e)&&(this.publishTarget=e)},async confirmStop(){let e=this.stopTarget;this.stopTarget=null,e&&e.task&&await this.runTaskAction({id:e.task.taskId,url:`/__card-publish-versions/${encodeURIComponent(this.cardCode)}/stop`,body:{taskId:e.task.taskId,versionId:e.versionId,version:e.version},okText:t=>`已停止版本 ${t.version||e.version} 的发布`,failText:`停止发布失败`})},async confirmPublish(){let e=this.publishTarget;this.publishTarget=null,e&&await this.runTaskAction({id:e.versionId,url:`/__card-publish-versions/${encodeURIComponent(this.cardCode)}/publish`,body:{versionId:e.versionId,version:e.version},okText:t=>`已创建版本 ${t.version||e.version} 的正式发布任务`,failText:`创建发布失败`})},async runTaskAction({id:e,url:t,body:n,okText:r,failText:i}){this.busyId=e;try{let e=await Y(t,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)}),i=await e.json().catch(()=>({}));if(i&&i.needCredentials){this.loginNeeded=!0,Q(`FinMall 登录凭据缺失,请重新登录`,`err`);return}if(!e.ok||!i||!i.ok)throw Error(i&&(i.message||i.error)||`HTTP `+e.status);Q(r(i)),await this.fetchPage(1)}catch(e){Q(e&&e.message||i,`err`)}finally{this.busyId=``}}}},Dg={class:`pv-card modal-card`,role:`dialog`,"aria-modal":`true`,"aria-label":`发布版本记录`},Og={class:`pv-head`},kg={class:`pv-head__title`},Ag={key:0,class:`pv-head__count`},jg={key:0,class:`empty-state`},Mg={key:1,class:`empty-state`},Ng={class:`empty-state__hint`},Pg={key:2,class:`pv-loading`},Fg={key:3,class:`empty-state`},Ig={class:`pv-table`},Lg={class:`pv-table__td pv-table__td--version`},Rg={class:`pv-version`},zg={key:0,class:`pv-badge`,title:`线上当前最高版本`},Bg={class:`pv-table__td`},Vg={class:`pv-table__td`},Hg={class:`pv-table__td pv-table__td--time`},Ug={class:`pv-table__td pv-table__td--op`},Wg=[`title`,`aria-label`,`disabled`,`onClick`],Gg=[`href`],Kg=[`title`,`aria-label`,`disabled`,`onClick`],qg=[`href`],Jg={key:0,class:`pv-more`},Yg={key:1,class:`pv-more pv-more--idle`};function Xg(e,t,n,r,i,a){let o=R(`ConfirmDialog`);return V(),U(hc,{name:`modal`},{default:I(()=>[n.visible?(V(),H(`div`,{key:0,class:`pv-mask`,onClick:t[5]||=J(t=>e.$emit(`close`),[`self`])},[W(`div`,Dg,[W(`header`,Og,[W(`div`,kg,[t[6]||=W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-list`})],-1),t[7]||=W(`span`,null,`发布版本记录`,-1),i.totalNums?(V(),H(`span`,Ag,`共 `+M(i.totalNums)+` 条`,1)):q(`v-if`,!0)]),W(`button`,{class:`pv-head__close`,type:`button`,title:`关闭`,"aria-label":`关闭`,onClick:t[0]||=t=>e.$emit(`close`)},[...t[8]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-x`})],-1)]])]),q(` 凭据缺失引导(双保险:弹框仅对有来源卡的按钮可点,凭据过期/被清时给出明确指引) `),i.loginNeeded?(V(),H(`div`,jg,[...t[9]||=[W(`span`,{class:`empty-state__badge`,"aria-hidden":`true`},[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[W(`use`,{href:`#icon-cloud`})])],-1),W(`p`,{class:`debug__empty`},`远端登录凭据缺失`,-1),W(`p`,{class:`empty-state__hint`},`请先通过顶栏「远端」完成 FinMall 登录,再查看发布版本记录`,-1)]])):i.error?(V(),H(`div`,Mg,[t[11]||=W(`span`,{class:`empty-state__badge`,"aria-hidden":`true`},[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[W(`use`,{href:`#icon-cloud-alert`})])],-1),t[12]||=W(`p`,{class:`debug__empty`},`发布版本记录加载失败`,-1),W(`p`,Ng,[K(M(i.error)+`(`,1),W(`a`,{class:`debug__link`,onClick:t[1]||=e=>a.fetchPage(1)},`重试`),t[10]||=K(`)`,-1)])])):i.loading&&!i.list.length?(V(),H(`div`,Pg,`正在查询远端发布记录…`)):i.list.length?(V(),H(B,{key:4},[q(` 滚动区:滚到底部自动加载下一页(阈值 24px,避免必须精准贴底) `),W(`div`,{ref:`scroll`,class:`pv-scroll`,onScroll:t[2]||=(...e)=>a.onScroll&&a.onScroll(...e)},[W(`table`,Ig,[t[14]||=W(`thead`,null,[W(`tr`,null,[W(`th`,{class:`pv-table__th pv-table__th--version`},`版本号`),W(`th`,{class:`pv-table__th`},`平台`),W(`th`,{class:`pv-table__th pv-table__th--status`},`状态`),W(`th`,{class:`pv-table__th`},`发布时间`),W(`th`,{class:`pv-table__th pv-table__th--op`},`操作`)])],-1),W(`tbody`,null,[(V(!0),H(B,null,z(i.list,e=>(V(),H(`tr`,{key:e.versionId||e.version,class:`pv-table__row`},[W(`td`,Lg,[W(`code`,Rg,M(e.version),1),e.version===i.maxVersion?(V(),H(`span`,zg,`最新`)):q(`v-if`,!0)]),W(`td`,Bg,M(e.platformStr||`—`),1),W(`td`,Vg,[W(`span`,{class:j([`debug__tag`,a.statusClass(e.publishStatus)])},M(a.statusText(e.publishStatus)),3)]),W(`td`,Hg,M(e.publishTime||`—`),1),q(` 操作列固定「停止 + 发布」两个图标位,判定轴只有一条:该版本有没有进行中的发布任务。
180
+ `)}},watch:{visible:{immediate:!0,handler(e){e&&this.fetchPage(1)}}},methods:{statusText(e){let t=Tg[String(e)];return t?t.text:e?`未知(${e})`:`未知`},statusClass(e){let t=Tg[String(e)];return t?t.cls:`debug__tag--warn`},async fetchPage(e){if(!this.cardCode)return;let t=e>1;if(t){if(this.loadingMore||this.loading)return;this.loadingMore=!0}else{if(this.loading)return;this.loading=!0}this.error=``,this.loginNeeded=!1;try{let n=await Y(`/__card-publish-versions/${encodeURIComponent(this.cardCode)}?pageNo=${e}&pageSize=20`),r=await n.json().catch(()=>({}));if(r&&r.needCredentials){this.loginNeeded=!0;return}if(!n.ok||!r||!r.ok)throw Error(r&&(r.message||r.error)||`HTTP `+n.status);this.list=t?this.list.concat(r.list||[]):r.list||[],this.totalNums=r.totalNums||0,this.totalPages=r.totalPages||1,t||(this.maxVersion=r.maxVersion||r.list&&r.list[0]&&r.list[0].version||``),this.page=e}catch(e){this.error=e&&e.message||`查询失败`}finally{this.loading=!1,this.loadingMore=!1}},onScroll(e){let t=e.target;t&&!this.loading&&!this.loadingMore&&this.hasMore&&t.scrollTop+t.clientHeight>=t.scrollHeight-24&&this.fetchPage(this.page+1)},canStop(e){return!!(e&&e.task&&e.task.taskId&&e.task.taskStatus!==`0`)},canPublish(e){return!!e&&!!e.versionId&&!this.canStop(e)},stopTitle(e){return this.canStop(e)?`停止版本 ${e.version} 的发布`:`版本 ${e.version} 没有进行中的发布任务`},publishTitle(e){return this.canPublish(e)?e&&String(e.publishStatus)===`1`?`重新发布版本 ${e.version}(将创建新的发布任务)`:`发布版本 ${e.version}(正式发布)`:e&&e.task?`版本 ${e.version} 正在发布中,如需重新发布请先停止`:`版本 ${e.version} 暂不可发布`},busyStop(e){return!!this.busyId&&!!(e&&e.task&&e.task.taskId===this.busyId)},busyPublish(e){return!!this.busyId&&!!(e&&e.versionId===this.busyId)},askStop(e){!this.busyId&&this.canStop(e)&&(this.stopTarget=e)},askPublish(e){!this.busyId&&this.canPublish(e)&&(this.publishTarget=e)},async confirmStop(){let e=this.stopTarget;this.stopTarget=null,e&&e.task&&await this.runTaskAction({id:e.task.taskId,url:`/__card-publish-versions/${encodeURIComponent(this.cardCode)}/stop`,body:{taskId:e.task.taskId,versionId:e.versionId,version:e.version},okText:t=>`已停止版本 ${t.version||e.version} 的发布`,failText:`停止发布失败`})},async confirmPublish(){let e=this.publishTarget;this.publishTarget=null,e&&await this.runTaskAction({id:e.versionId,url:`/__card-publish-versions/${encodeURIComponent(this.cardCode)}/publish`,body:{versionId:e.versionId,version:e.version},okText:t=>`已创建版本 ${t.version||e.version} 的正式发布任务`,failText:`创建发布失败`})},async runTaskAction({id:e,url:t,body:n,okText:r,failText:i}){this.busyId=e;try{let e=await Y(t,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)}),i=await e.json().catch(()=>({}));if(i&&i.needCredentials){this.loginNeeded=!0,Q(`远端登录凭据缺失,请重新登录`,`err`);return}if(!e.ok||!i||!i.ok)throw Error(i&&(i.message||i.error)||`HTTP `+e.status);Q(r(i)),await this.fetchPage(1)}catch(e){Q(e&&e.message||i,`err`)}finally{this.busyId=``}}}},Dg={class:`pv-card modal-card`,role:`dialog`,"aria-modal":`true`,"aria-label":`发布版本记录`},Og={class:`pv-head`},kg={class:`pv-head__title`},Ag={key:0,class:`pv-head__count`},jg={key:0,class:`empty-state`},Mg={key:1,class:`empty-state`},Ng={class:`empty-state__hint`},Pg={key:2,class:`pv-loading`},Fg={key:3,class:`empty-state`},Ig={class:`pv-table`},Lg={class:`pv-table__td pv-table__td--version`},Rg={class:`pv-version`},zg={key:0,class:`pv-badge`,title:`线上当前最高版本`},Bg={class:`pv-table__td`},Vg={class:`pv-table__td`},Hg={class:`pv-table__td pv-table__td--time`},Ug={class:`pv-table__td pv-table__td--op`},Wg=[`title`,`aria-label`,`disabled`,`onClick`],Gg=[`href`],Kg=[`title`,`aria-label`,`disabled`,`onClick`],qg=[`href`],Jg={key:0,class:`pv-more`},Yg={key:1,class:`pv-more pv-more--idle`};function Xg(e,t,n,r,i,a){let o=R(`ConfirmDialog`);return V(),U(hc,{name:`modal`},{default:I(()=>[n.visible?(V(),H(`div`,{key:0,class:`pv-mask`,onClick:t[5]||=J(t=>e.$emit(`close`),[`self`])},[W(`div`,Dg,[W(`header`,Og,[W(`div`,kg,[t[6]||=W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-list`})],-1),t[7]||=W(`span`,null,`发布版本记录`,-1),i.totalNums?(V(),H(`span`,Ag,`共 `+M(i.totalNums)+` 条`,1)):q(`v-if`,!0)]),W(`button`,{class:`pv-head__close`,type:`button`,title:`关闭`,"aria-label":`关闭`,onClick:t[0]||=t=>e.$emit(`close`)},[...t[8]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-x`})],-1)]])]),q(` 凭据缺失引导(双保险:弹框仅对有来源卡的按钮可点,凭据过期/被清时给出明确指引) `),i.loginNeeded?(V(),H(`div`,jg,[...t[9]||=[W(`span`,{class:`empty-state__badge`,"aria-hidden":`true`},[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[W(`use`,{href:`#icon-cloud`})])],-1),W(`p`,{class:`debug__empty`},`远端登录凭据缺失`,-1),W(`p`,{class:`empty-state__hint`},`请先通过顶栏「远端」完成远端登录,再查看发布版本记录`,-1)]])):i.error?(V(),H(`div`,Mg,[t[11]||=W(`span`,{class:`empty-state__badge`,"aria-hidden":`true`},[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[W(`use`,{href:`#icon-cloud-alert`})])],-1),t[12]||=W(`p`,{class:`debug__empty`},`发布版本记录加载失败`,-1),W(`p`,Ng,[K(M(i.error)+`(`,1),W(`a`,{class:`debug__link`,onClick:t[1]||=e=>a.fetchPage(1)},`重试`),t[10]||=K(`)`,-1)])])):i.loading&&!i.list.length?(V(),H(`div`,Pg,`正在查询远端发布记录…`)):i.list.length?(V(),H(B,{key:4},[q(` 滚动区:滚到底部自动加载下一页(阈值 24px,避免必须精准贴底) `),W(`div`,{ref:`scroll`,class:`pv-scroll`,onScroll:t[2]||=(...e)=>a.onScroll&&a.onScroll(...e)},[W(`table`,Ig,[t[14]||=W(`thead`,null,[W(`tr`,null,[W(`th`,{class:`pv-table__th pv-table__th--version`},`版本号`),W(`th`,{class:`pv-table__th`},`平台`),W(`th`,{class:`pv-table__th pv-table__th--status`},`状态`),W(`th`,{class:`pv-table__th`},`发布时间`),W(`th`,{class:`pv-table__th pv-table__th--op`},`操作`)])],-1),W(`tbody`,null,[(V(!0),H(B,null,z(i.list,e=>(V(),H(`tr`,{key:e.versionId||e.version,class:`pv-table__row`},[W(`td`,Lg,[W(`code`,Rg,M(e.version),1),e.version===i.maxVersion?(V(),H(`span`,zg,`最新`)):q(`v-if`,!0)]),W(`td`,Bg,M(e.platformStr||`—`),1),W(`td`,Vg,[W(`span`,{class:j([`debug__tag`,a.statusClass(e.publishStatus)])},M(a.statusText(e.publishStatus)),3)]),W(`td`,Hg,M(e.publishTime||`—`),1),q(` 操作列固定「停止 + 发布」两个图标位,判定轴只有一条:该版本有没有进行中的发布任务。
181
181
  有 → 停止可点、发布禁用;没有 → 发布可点、停止禁用。两者互斥,故不会双灰。
182
182
  禁用态保留(比藏起来更容易读懂当前状态),两个槽位定宽,行间不跳列宽。 `),W(`td`,Ug,[W(`button`,{class:j([`pv-op pv-op--stop`,{"is-busy":a.busyStop(e)}]),type:`button`,title:a.stopTitle(e),"aria-label":a.stopTitle(e),disabled:!a.canStop(e)||!!i.busyId,onClick:t=>a.askStop(e)},[(V(),H(`svg`,{class:j([`app__icon`,{"app__icon--spin":a.busyStop(e)}]),viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:a.busyStop(e)?`#icon-loading`:`#icon-no-entry`},null,8,Gg)],2))],10,Wg),W(`button`,{class:j([`pv-op pv-op--publish`,{"is-busy":a.busyPublish(e)}]),type:`button`,title:a.publishTitle(e),"aria-label":a.publishTitle(e),disabled:!a.canPublish(e)||!!i.busyId,onClick:t=>a.askPublish(e)},[(V(),H(`svg`,{class:j([`app__icon`,{"app__icon--spin":a.busyPublish(e)}]),viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:a.busyPublish(e)?`#icon-loading`:`#icon-rocket`},null,8,qg)],2))],10,Kg)])]))),128))])]),q(` 懒加载脚注:还有下一页时给「加载中」反馈,避免静默翻页 `),i.loadingMore?(V(),H(`p`,Jg,`加载中…`)):a.hasMore?(V(),H(`p`,Yg,`滚动到底部加载更多`)):q(`v-if`,!0)],544)],2112)):(V(),H(`div`,Fg,[...t[13]||=[W(`span`,{class:`empty-state__badge`,"aria-hidden":`true`},[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[W(`use`,{href:`#icon-history`})])],-1),W(`p`,{class:`debug__empty`},`暂无发布版本记录`,-1),W(`p`,{class:`empty-state__hint`},`该卡在远端还没有发布记录;每次「发布」后会生成新的一条`,-1)]]))]),q(`
183
183
  停止发布确认:放在 .pv-card 之后、.pv-mask 之内。
@@ -196,8 +196,8 @@ Expected function or array of functions, received type ${typeof e}.`),m)}var ol=
196
196
  `),r.hasAttribute(`data-start`)||r.setAttribute(`data-start`,String(o+1))}f.textContent=e,n.highlightElement(f)},function(e){r.setAttribute(a,c),f.textContent=e})}}),n.plugins.fileHighlight={highlight:function(e){for(var t=(e||document).querySelectorAll(l),r=0,i;i=t[r++];)n.highlightElement(i)}};var f=!1;n.fileHighlight=function(){f||=(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),!0),n.plugins.fileHighlight.highlight.apply(this,arguments)}})()}))());Prism.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:`keyword`}},Prism.languages.webmanifest=Prism.languages.json;function mv(e,t={}){if(!e||typeof e!=`object`)return{};let n=t.includeMocks?hv(e):null,r={};for(let t of e.dictionary?.inputParams||[]){let e=_v(t),i=t.defaultValue,a=i&&typeof i==`object`&&!Array.isArray(i)&&Object.keys(i).length===0,o=e!==void 0&&(i===void 0||i===``||a)?e:i;n&&gv(n,t.key)&&(o=n[t.key]),r[t.key]=vv(o)}return r}function hv(e){let t=e&&e.dictionary&&e.dictionary.mocks;return t&&typeof t==`object`&&!Array.isArray(t)?t:null}function gv(e,t){if(!e||!Object.prototype.hasOwnProperty.call(e,t))return!1;let n=e[t];return n==null||n===``?!1:Array.isArray(n)?n.length>0:typeof n!=`object`||Object.keys(n).length>0}function _v(e){if(!e.desc||typeof e.desc!=`string`)return;let t=e.desc.trim();if(t.startsWith(`{`))try{let n=JSON.parse(t);return Object.prototype.hasOwnProperty.call(n,e.key)?n[e.key]:void 0}catch{return}}function vv(e){return e==null?e:JSON.parse(JSON.stringify(e))}var yv=/\x1b\[[0-9;:?]*[ -/]*[@-~]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)|\x1b[@-Z\\-_]/g;function bv(e){return String(e??``).replace(yv,``)}var xv=[[0,0,0],[170,0,0],[0,170,0],[170,85,0],[0,0,170],[170,0,170],[0,170,170],[170,170,170]],Sv=[[85,85,85],[255,85,85],[85,255,85],[255,255,85],[85,85,255],[255,85,255],[85,255,255],[255,255,255]];function Cv(e){let t=Math.round(Number(e));return Number.isFinite(t)?t<0?0:t>255?255:t:0}function wv(e){let t=Cv(e);if(t<8)return xv[t];if(t<16)return Sv[t-8];if(t<232){let e=t-16,n=e=>e?e*40+55:0;return[n(Math.floor(e/36)),n(Math.floor(e%36/6)),n(e%6)]}let n=8+(t-232)*10;return[n,n,n]}function Tv(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function Ev(e){return`rgb(${e[0]},${e[1]},${e[2]})`}function Dv(){return{fg:null,bg:null,bold:!1,dim:!1,italic:!1,underline:!1}}function Ov(e){return!e.fg&&!e.bg&&!e.bold&&!e.dim&&!e.italic&&!e.underline}function kv(e){let t=[],n=e.fg;return n&&n.basic!=null&&(n={rgb:e.bold?Sv[n.basic]:xv[n.basic]}),n&&t.push(`color:${Ev(n.rgb)}`),e.bg&&t.push(`background-color:${Ev(e.bg.rgb)}`),e.bold&&t.push(`font-weight:600`),e.dim&&t.push(`opacity:.72`),e.italic&&t.push(`font-style:italic`),e.underline&&t.push(`text-decoration:underline`),t.join(`;`)}function Av(e,t){let n=String(t||``),r=(n===``?`0`:n).split(/[;:]/).map(e=>e===``?0:Number(e));for(let t=0;t<r.length;t++){let n=r[t];if(Number.isFinite(n)){if(n===0)Object.assign(e,Dv());else if(n===1)e.bold=!0;else if(n===2)e.dim=!0;else if(n===3)e.italic=!0;else if(n===4)e.underline=!0;else if(n===22)e.bold=!1,e.dim=!1;else if(n===23)e.italic=!1;else if(n===24)e.underline=!1;else if(n===39)e.fg=null;else if(n===49)e.bg=null;else if(n>=30&&n<=37)e.fg={basic:n-30};else if(n>=90&&n<=97)e.fg={rgb:Sv[n-90]};else if(n>=40&&n<=47)e.bg={basic:n-40};else if(n>=100&&n<=107)e.bg={rgb:Sv[n-100]};else if(n===38||n===48){let i=r[t+1],a=null,o=0;i===5?(a=wv(r[t+2]),o=2):i===2&&(a=[Cv(r[t+2]),Cv(r[t+3]),Cv(r[t+4])],o=4),a&&(n===38?e.fg={rgb:a}:e.bg={rgb:a},t+=o)}}}}function jv(e){let t=String(e??``);if(!t)return``;if(t.indexOf(`\x1B`)<0)return Tv(t);let n=Dv(),r=``,i=0,a;for(yv.lastIndex=0;(a=yv.exec(t))!==null;){a.index>i&&(r+=Mv(t.slice(i,a.index),n)),i=a.index+a[0].length;let e=a[0];e[1]===`[`&&/[m]$/.test(e)&&Av(n,e.slice(2,-1))}return i<t.length&&(r+=Mv(t.slice(i),n)),r}function Mv(e,t){if(!e)return``;let n=Tv(e);if(Ov(t))return n;let r=kv(t);return r?`<span style="${r}">${n}</span>`:n}var Nv=800;function Pv(e){let t=String(e??``).replace(/^\uFEFF/,``),n=``,r=0,i=t.length,a=()=>{let e=n.length-1;for(;e>=0&&/\s/.test(n[e]);)--e;return e},o=()=>{let e=a();e>=0&&n[e]!==`,`&&n[e]!==`[`&&n[e]!==`{`&&(n+=`,`)},s=e=>{let n=e;for(;n<i&&/\s/.test(t[n]);)n+=1;return n};for(;r<i;){let e=t[r];if(e===`"`){let e=r+1;for(;e<i;)if(t[e]===`\\`)e+=2;else{if(t[e]===`"`){e+=1;break}e+=1}n+=t.slice(r,e),r=e}else if(e===`'`){let e=r+1,a=``;for(;e<i;){let n=t[e];if(n===`\\`&&e+1<i){let r=t[e+1];if(r===`'`){a+=`'`,e+=2;continue}if(r===`"`){a+=`\\"`,e+=2;continue}a+=n+r,e+=2}else{if(n===`'`){e+=1;break}n===`"`?(a+=`\\"`,e+=1):(a+=n,e+=1)}}n+=`"`+a+`"`,r=e}else if(e===`/`&&t[r+1]===`/`)for(;r<i&&t[r]!==`
197
197
  `;)r+=1;else if(e===`/`&&t[r+1]===`*`){let e=t.indexOf(`*/`,r+2);r=e===-1?i:e+2}else if(e===`;`||e===`,`)o(),r+=1;else if(/[A-Za-z_$]/.test(e)){let e=r;for(;e<i&&/[A-Za-z0-9_$]/.test(t[e]);)e+=1;let a=t.slice(r,e);t[s(e)]===`:`?n+=`"`+a+`"`:n+=a===`undefined`||a===`NaN`||a===`Infinity`?`null`:a,r=e}else if(e===`-`&&t.startsWith(`Infinity`,r+1))n+=`null`,r+=9;else if(/[0-9]/.test(e)||e===`-`&&/[0-9]/.test(t[r+1]||``)){let e=r;for(;e<i&&/[0-9eE+\-.]/.test(t[e]);)e+=1;let a=t.slice(r,e);t[s(e)]===`:`?n+=`"`+a+`"`:n+=a,r=e}else{if(e===`}`||e===`]`){let e=a();for(;e>=0&&n[e]===`,`;)n=n.slice(0,e)+n.slice(e+1),e=a()}n+=e,r+=1}}try{return{value:JSON.parse(n.trim()||`{}`)}}catch(e){return{error:e.message}}}function Fv(e){let t=/^\d{2}:\d{2}:\d{2}\.\d{3}\s+(INFO|OK\s|WARN|ERR)\b/.exec(e);if(t){let e=t[1].trim();return e===`ERR`?`error`:e===`WARN`?`warn`:e===`OK`?`ok`:`info`}return`info`}function Iv(e){let t=String(e&&e.text!=null?e.text:``),n=bv(t);return{seq:Number(e&&e.seq)||0,t:Number(e&&e.t)||0,level:Fv(n),plain:n,html:jv(t)}}function Lv(e,t){if(e===t)return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Lv(e[r],t[r]))return!1;return!0}function Rv(e){return e===void 0?void 0:JSON.parse(JSON.stringify(e))}var zv=`cardbuddy:history-cache:v1`,Bv=30,Vv=90;function Hv(){try{let e=JSON.parse(localStorage.getItem(zv)||`{}`);return e&&typeof e==`object`?e:{}}catch{return{}}}function Uv(e){try{localStorage.setItem(zv,JSON.stringify(e))}catch{}}var Wv={name:`DebugPanel`,components:{JsonTree:om,StateDiffPanel:Im,StructureTree:ch,NodeInspector:Vh,EventEditor:wg,PublishVersionsDialog:Zg,LogValue:k_,Dropdown:B_,ConfirmDialog:Ap,NumberStepper:J_,SetSegment:uv},props:{rt:{type:Object,required:!0},preview:{type:Object,default:null},schema:{type:Object,default:null},cardId:{type:String,default:``},reloadToken:{type:Number,default:0},cardCount:{type:Number,default:0},selectedNodeId:{type:String,default:``},moveCollapseToken:{type:Number,default:0},activeTab:{type:String,default:`vars`},metaRefreshToken:{type:Number,default:0},historyRefreshToken:{type:Number,default:0},devSvcClass:{type:String,default:`app__btn--warn`},devSvcTitle:{type:String,default:``},devSvcLabel:{type:String,default:``},devSvcConn:{type:String,default:``},chromeOff:{type:Boolean,default:!1},remoteLoggedIn:{type:Boolean,default:!1},hasCardSource:{type:Boolean,default:!1},historyRestoring:{type:Boolean,default:!1}},data(){return{copied:!1,copyTimer:null,copiedVar:null,varCopyTimer:null,errorPanel:``,eventTab:`log`,svcLogs:[],svcLogSeq:0,svcLogFloor:0,svcLogLive:!1,svcLogFollow:!0,svcLogDropped:0,svcLogLoading:!1,svcLogErr:``,svcCopied:!1,statePanelOpen:!1,panelH:this.loadPanelH(),panelDragging:!1,inspectingComp:null,inspectKey:0,editingEventComp:null,eventEditorKey:0,rawText:``,rawError:``,varsMode:`list`,varDlg:null,varDlgError:``,delVarTarget:null,schemaViewerOpen:!1,copiedSchemaText:!1,copiedCode:!1,schemaViewData:null,varTypeOptions:[{key:`string`,value:`字符串`},{key:`number`,value:`数字`},{key:`boolean`,value:`布尔`},{key:`array`,value:`数组`},{key:`object`,value:`对象`}],varBoolOptions:[{key:`true`,value:`true`},{key:`false`,value:`false`}],importMeta:null,remoteVersionLoading:!1,remoteVersionError:``,publishRecordsOpen:!1,historyLoading:!1,historyLoadingMore:!1,historyError:``,historyLoginNeeded:!1,historyList:[],historyTotal:0,historyTotalPages:1,historyPage:1,historyLoadedFor:``,historyPreview:``}},computed:{tabs(){let e=[{key:`vars`,label:`变量`},{key:`structure`,label:`组件结构`},{key:`meta`,label:`导入信息`}];return this.remoteLoggedIn&&this.hasCardSource&&e.push({key:`history`,label:`编辑记录`}),e},historyLatestId(){return this.historyList.length?this.historyList[0].id:``},historyGroups(){let e=[];for(let t of this.historyList){let n=this.historyDateGroup(t.createTime),r=e[e.length-1];(!r||r.key!==n.key)&&(r={key:n.key,label:n.label,items:[]},e.push(r)),r.items.push(t)}return e},historyNeedLogin(){return!!this.historyLoginNeeded},mocks(){return hv(this.schema)||{}},inputParams(){let e=this.schema&&this.schema.dictionary;return e&&Array.isArray(e.inputParams)?e.inputParams:[]},delVarRefs(){let e=this.delVarTarget==null?null:this.inputParams[this.delVarTarget];return this.scanVarRefs(e&&e.key)},delVarSeverity(){let e=this.delVarRefs;return e.binding+e.event+e.other>0?`danger`:`warn`},delVarConfirmText(){return this.delVarSeverity===`danger`?`仍要删除`:`删除`},delVarMessage(){let e=this.delVarTarget==null?null:this.inputParams[this.delVarTarget];if(!e)return``;let t=e.name&&e.name!==e.key?`(`+e.name+`)`:``,n=this.delVarRefs,r=n.binding+n.event+n.other;if(r>0){let i=[];return n.binding&&i.push(`绑定表达式 ${n.binding} 处`),n.event&&i.push(`事件脚本 ${n.event} 处`),n.other&&i.push(`其它文本 ${n.other} 处`),`变量「${e.key}」${t}仍被${i.join(`、`)}引用(共 ${r} 处)。删除后这些引用将取不到值,画布可能出现空白或执行报错,请先迁移再删除。`}return`变量「${e.key}」${t}当前未被任何绑定表达式或事件脚本引用。删除后变量定义与 mock 值一并移除,不可恢复。`},svcEmptyText(){return this.devSvcConn===`unconfigured`?`未配置本地开发服务`:this.devSvcConn===`open`?`暂无服务日志`:`本地服务未连接`},svcEmptyHint(){return this.svcLogErr?`取历史失败:`+this.svcLogErr+`(本地服务需升级到支持 /__logs 的 cardbuddy 版本)`:this.devSvcConn===`unconfigured`?`在顶栏「连接」中配置本地开发服务地址后,这里会实时镜像该服务终端的彩色输出`:this.devSvcConn===`open`?`cardbuddy 终端的输出(含配色)会实时镜像到这里;试试同步、保存、校验或截图`:`连接恢复后自动继续;服务端保留最近 800 行历史,重连不丢`},scopeText(){this.rt.revision;try{return JSON.stringify(this.rt.rootScope,null,2)}catch{return`(无法序列化)`}},bindingErrors(){return this.rt.errorRev,this.rt.errors.slice()},eventErrors(){return this.rt.errorRev,this.rt.eventErrors.slice()},logs(){return this.rt.logRev,this.rt.eventLogs.slice()},eventCount(){return this.eventErrors.length+this.logs.length},eventStatusClass(){return this.eventErrors.length?`is-error`:this.logs.length?`is-log`:`is-ok`},eventStatusTitle(){return this.eventErrors.length?`查看事件(含错误)`:this.logs.length?`查看事件(含日志)`:`无事件记录`},panelErrors(){return this.errorPanel===`event`?this.eventErrors:this.bindingErrors},compNames(){let e={};for(let t in ju)e[t]=ju[t].name||t;return e.Root=`根`,e},canPaste(){return!!ed.node},schemaText(){if(!this.schema)return``;try{let e={...this.schema};return this.rt&&this.rt.rootScope&&(e.data=this.rt.rootScope),JSON.stringify(e,(e,t)=>e===`_schemaNode`?void 0:t,2)}catch{return`(无法序列化)`}},schemaTextLines(){return this.schemaText?this.schemaText.split(`
198
198
  `).length:0},schemaTextBytes(){let e=new Blob([this.schemaText]).size;return e>=1024?(e/1024).toFixed(1)+` KB`:e+` B`},stateDirty(){return this.rt.revision,!Lv(this.rt.state,this.rt.rootScope)}},watch:{errorPanel(e){e===`svclog`?this.startSvcLog():this.stopSvcLog()},cardId:{immediate:!0,handler(){this.rawError=``,this.destroyJar(),this.varsMode=`list`,this.varDlg=null,this.varDlgError=``,this.delVarTarget=null,this.inspectingComp=null,this.editingEventComp=null,this.importMeta=null,this.remoteVersionLoading=!1,this.remoteVersionError=``,this.resetCardHistory(),this.schemaViewerOpen=!1,this.maybeFetchMeta()}},reloadToken(){this.maybeFetchMeta()},metaRefreshToken(e,t){e!==t&&this.activeTab===`meta`&&this.fetchImportMeta()},historyRefreshToken(e,t){e===t||this.historyLoading||this.historyLoadingMore||(this._dropHistoryCache(this.historyLoadedFor||this.cardId),this.historyLoadedFor=``,this.activeTab===`history`&&this.fetchCardHistoryPage(1))},activeTab(e){e===`meta`&&this.fetchImportMeta(),e===`history`&&this.maybeFetchCardHistory(),e!==`vars`&&(this.varsMode=`list`,this.rawError=``,this.destroyJar(),this.varDlg=null)},varDlg(e){e?(this.varDlgError=``,this.isComplexType(e.form.type)&&this.$nextTick(()=>this.initDlgJar())):this.destroyDlgJar()},"varDlg.form.type"(e,t){this.varDlg&&e!==t&&(this.varDlg.form.defaultValue=this.normalizeDefaultText(e,this.varDlg.form.defaultValue),this.isComplexType(e)?this.$nextTick(()=>this.initDlgJar()):this.destroyDlgJar())},varsMode(e){e===`mock`?(this.seedRawFromMocks(),this.$nextTick(()=>this.initJar())):(this.rawError=``,this.destroyJar())},schema(){this.inspectingComp=null,this.editingEventComp=null,this.varsMode===`mock`&&this.seedRawFromMocks()}},mounted(){let e=this.panelH;this.$refs.statePanel&&(this.$refs.statePanel.style.height=e+`px`),this.$refs.errPanel&&(this.$refs.errPanel.style.height=e+`px`)},beforeUnmount(){this.destroyJar(),this.destroyDlgJar(),this.cancelResize(),this.stopSvcLog()},methods:{toggleStatePanel(){this.statePanelOpen=!this.statePanelOpen,this.statePanelOpen&&(this.errorPanel=``)},toggleErrorPanel(e){this.errorPanel=this.errorPanel===e?``:e,this.errorPanel&&(this.statePanelOpen=!1,e===`event`&&(this.eventTab=this.eventErrors.length?`err`:`log`))},startResize(e){if(e.target.closest(`button`))return;this.panelDragging=!0;let t=e.clientY,n=this.panelH,r=Math.max(120,Math.round(window.innerHeight*.6)),i=e=>{this.panelH=e,this.$refs.statePanel&&(this.$refs.statePanel.style.height=e+`px`),this.$refs.errPanel&&(this.$refs.errPanel.style.height=e+`px`)},a=e=>{let a=t-e.clientY;i(Math.min(r,Math.max(120,n+a)))},o=()=>{document.body.style.cursor=``,document.body.style.userSelect=``,document.removeEventListener(`mousemove`,a),document.removeEventListener(`mouseup`,o),this._resizeMove=this._resizeUp=null,this.panelDragging=!1,this.savePanelH()};this._resizeMove=a,this._resizeUp=o,document.body.style.cursor=`row-resize`,document.body.style.userSelect=`none`,document.addEventListener(`mousemove`,a),document.addEventListener(`mouseup`,o)},cancelResize(){this._resizeMove&&document.removeEventListener(`mousemove`,this._resizeMove),this._resizeUp&&document.removeEventListener(`mouseup`,this._resizeUp),this._resizeMove=this._resizeUp=null,this.panelDragging=!1,document.body.style.cursor=``,document.body.style.userSelect=``},loadPanelH(){try{let e=localStorage.getItem(`cardbuddy:debug-panel-height`);if(e!=null){let t=parseInt(e,10);if(!Number.isNaN(t)){let e=Math.max(120,Math.round(window.innerHeight*.6));return Math.min(e,Math.max(120,t))}}}catch{}return 240},savePanelH(){try{localStorage.setItem(`cardbuddy:debug-panel-height`,String(Math.round(this.panelH)))}catch{}},initJar(){let e=this.$refs.rawEditor;if(!e)return;this.destroyJar();let t=e=>{e.innerHTML=pv.default.highlight(e.textContent,pv.default.languages.json,`json`)};this._jar=fv(e,t,{tab:` `,indentOn:/[({[]$/,addClosing:!0,history:!0}),this._jar.updateCode(this.rawText||``),this._jar.onUpdate(e=>{this.rawText=e,this.rawError&&=``}),window.__rawEditor=this._jar,this.$nextTick(()=>e.focus())},destroyJar(){this._jar&&this._jar.destroy&&this._jar.destroy(),this._jar=null,typeof window<`u`&&window.__rawEditor&&(window.__rawEditor=null)},initDlgJar(){let e=this.$refs.dlgCode;if(!e)return;this.destroyDlgJar();let t=e=>{e.innerHTML=pv.default.highlight(e.textContent,pv.default.languages.json,`json`)};this._dlgJar=fv(e,t,{tab:` `,indentOn:/[({[]$/,addClosing:!0,history:!0}),this._dlgJar.updateCode(this.varDlg?this.varDlg.form.defaultValue:``),this._dlgJar.onUpdate(e=>{this.varDlg&&(this.varDlg.form.defaultValue=e),this.varDlgError&&=``}),window.__dlgEditor=this._dlgJar},destroyDlgJar(){this._dlgJar&&this._dlgJar.destroy&&this._dlgJar.destroy(),this._dlgJar=null,typeof window<`u`&&window.__dlgEditor&&(window.__dlgEditor=null)},complexSeed(e,t){let n=e===`array`?`[]`:`{}`,r=String(t??``).trim();if(!r)return n;try{let t=JSON.parse(r);return(e===`array`?Array.isArray(t):t&&typeof t==`object`)?JSON.stringify(t,null,2):n}catch{return n}},normalizeDefaultText(e,t){if(this.isComplexType(e))return this.complexSeed(e,t);let n=String(t??``).trim();return e===`number`?n!==``&&Number.isFinite(Number(n))?String(Number(n)):``:e===`boolean`?/^(true|1)$/i.test(n)?`true`:`false`:String(t??``)},saveRaw(){let e=Pv(this.rawText);if(e.error){this.rawError=`JSON 格式错误:`+e.error;return}if(e.value===null||typeof e.value!=`object`||Array.isArray(e.value)){this.rawError=`变量 mock 必须是 JSON 对象({ ... })`;return}let t=this.schema;if(!t){this.rawError=`当前未载入卡片`;return}(!t.dictionary||typeof t.dictionary!=`object`)&&(t.dictionary={dictionaryList:[],inputParams:[]}),t.dictionary.mocks=e.value,this.rt.setRootScope(mv(t,{includeMocks:!0}));let n=JSON.stringify(e.value,null,2);this.rawText=n,this._jar&&this._jar.updateCode(n),this.$nextTick(()=>this.onCommit()),this.rawError=``},async copyScope(){await yp(this.rawText||``)&&(this.copied=!0,this.copyTimer&&clearTimeout(this.copyTimer),this.copyTimer=setTimeout(()=>{this.copied=!1},1500))},onEditEvent(e){this.editingEventComp=e,this.eventEditorKey++},onApply(){this.$emit(`schema-changed`)},onCommit(){this.$emit(`schema-commit`)},hasMock(e){return gv(this.mocks,e.key)},async copyVarName(e,t){let n=e&&e.key?String(e.key):``;n&&await yp(n)&&(this.copiedVar=t,this.varCopyTimer&&clearTimeout(this.varCopyTimer),this.varCopyTimer=setTimeout(()=>{this.copiedVar===t&&(this.copiedVar=null)},1500))},async copyCardCode(){let e=this.importMeta&&this.importMeta.cardCode!=null?String(this.importMeta.cardCode):``;e&&await yp(e)&&(this.copiedCode=!0,this._codeCopyTimer&&clearTimeout(this._codeCopyTimer),this._codeCopyTimer=setTimeout(()=>{this.copiedCode=!1},1500))},isComplexType(e){return e===`array`||e===`object`},scalarPlaceholder(e){return e===`number`?`数字,如 0 / 99.5`:`字符串原样保存`},onVarTypeChange(e){this.varDlg&&(this.varDlg.form.type=e)},openVarDlg(e){let t=e==null?null:this.inputParams[e],n=t&&t.type||`string`,r=t?t.defaultValue:void 0,i=``;r!=null&&(i=typeof r==`object`?JSON.stringify(r,null,2):String(r)),i=this.normalizeDefaultText(n,i),this.varDlgError=``,this.varDlg={index:e,form:{key:t&&t.key||``,name:t&&t.name||``,type:n,defaultValue:i,desc:t&&t.desc||``}}},parseDefault(e,t){let n=String(t??``).trim();if(this.isComplexType(e)){if(!n)return{value:e===`array`?[]:{}};let t=Pv(n);if(t.error)return{error:`默认值不是合法 JSON:`+t.error};let r=t.value;return e===`array`&&!Array.isArray(r)?{error:`默认值需为 JSON 数组`}:e===`object`&&(typeof r!=`object`||!r||Array.isArray(r))?{error:`默认值需为 JSON 对象`}:{value:r}}if(e===`number`){if(!n)return{value:0};let e=Number(n);return Number.isFinite(e)?{value:e}:{error:`默认值不是合法数字`}}return e===`boolean`?n?n===`true`||n===`1`?{value:!0}:n===`false`||n===`0`?{value:!1}:{error:`布尔默认值仅接受 true / false`}:{value:!1}:{value:String(t??``)}},confirmVarDlg(){let e=this.varDlg;if(!e)return;let t=e.form,n=String(t.key||``).trim(),r=String(t.name||``).trim();if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(n)){this.varDlgError=`变量名需为字母 / 下划线开头的英文标识(绑定以 $key 引用)`;return}if(this.inputParams.some((t,r)=>t.key===n&&r!==e.index)){this.varDlgError=`已存在同名变量 `+n;return}if(!r){this.varDlgError=`中文名不能为空`;return}let i=this.parseDefault(t.type,t.defaultValue);if(i.error){this.varDlgError=i.error;return}if(this.isComplexType(t.type)){let e=JSON.stringify(i.value,null,2);t.defaultValue=e,this._dlgJar&&this._dlgJar.updateCode(e)}let a=this.schema;if(!a){this.varDlgError=`当前未载入卡片`;return}(!a.dictionary||typeof a.dictionary!=`object`)&&(a.dictionary={dictionaryList:[],inputParams:[]}),Array.isArray(a.dictionary.inputParams)||(a.dictionary.inputParams=[]);let o=a.dictionary.inputParams,s=this.rt.rootScope,c=hv(a)||{},l=Rv(i.value);if(e.index==null)o.push({key:n,name:r,type:t.type,defaultValue:Rv(l),desc:String(t.desc||``),rule:{type:``,options:{}},children:[]}),gv(c,n)||(s[n]=l);else{let i=o[e.index];if(!i)return;let a=i.key;i.key=n,i.name=r,i.type=t.type,i.desc=String(t.desc||``),i.defaultValue=Rv(l),a!==n&&(Object.prototype.hasOwnProperty.call(c,a)&&(c[n]=c[a],delete c[a]),s&&Object.prototype.hasOwnProperty.call(s,a)&&delete s[a]),gv(c,n)||(s[n]=l)}this.varDlg=null,this.onCommit()},askDeleteVar(e){this.delVarTarget=e},scanVarRefs(e){let t={binding:0,event:0,other:0},n=this.schema;if(!e||!n||typeof n!=`object`)return t;let r=String(e).replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),i=RegExp(`\\$`+r+`(?![A-Za-z0-9_$])`),a=RegExp(`state\\s*(?:\\.\\s*`+r+`(?![A-Za-z0-9_$])|\\[\\s*['"]`+r+`['"]\\s*\\])`),o=e=>i.test(e)||a.test(e),s=e=>{if(e!=null){if(Array.isArray(e))for(let t of e)s(t);else if(typeof e==`object`){for(let[n,r]of Object.entries(e))if(n!==`dictionary`&&n!==`compiled`){if(typeof r==`string`){if(!o(r))continue;n===`itemValue`?t.binding+=1:n===`code`?t.event+=1:t.other+=1}else s(r)}}}};return s(n),t},confirmDeleteVar(){let e=this.delVarTarget==null?null:this.inputParams[this.delVarTarget];if(this.delVarTarget=null,!e||!this.schema||!this.schema.dictionary)return;let t=this.schema.dictionary.inputParams||[],n=t.indexOf(e);n>=0&&t.splice(n,1);let r=hv(this.schema)||{};Object.prototype.hasOwnProperty.call(r,e.key)&&delete r[e.key];let i=this.rt.rootScope;i&&Object.prototype.hasOwnProperty.call(i,e.key)&&delete i[e.key],this.onCommit()},leaveMock(){this.varsMode=`list`},seedRawFromMocks(){this.rawError=``;try{this.rawText=JSON.stringify(this.mocks,null,2)}catch(e){this.rawText=``,this.rawError=`无法序列化当前数据:`+(e&&e.message);return}this._jar&&this._jar.updateCode(this.rawText)},onInspect(e){this.inspectingComp=e,this.inspectKey++},openSchemaViewer(){try{let e={...this.schema||{}};this.schema&&this.rt&&this.rt.rootScope&&(e.data=this.rt.rootScope),this.schemaViewData=this.schema?JSON.parse(JSON.stringify(e,(e,t)=>e===`_schemaNode`?void 0:t)):null}catch{this.schemaViewData=null}this.schemaViewerOpen=!0,this.$nextTick(()=>{let e=this.$refs.schemaViewerEl;e&&e.focus&&e.focus()})},onSchemaViewerKey(e){e.key===`Escape`?(e.preventDefault(),this.schemaViewerOpen=!1):(e.key===`c`||e.key===`C`)&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&(e.preventDefault(),this.copySchemaText())},async copySchemaText(){this.schema&&this.schemaText&&await yp(this.schemaText)&&(this.copiedSchemaText=!0,clearTimeout(this._schemaCopyTimer),this._schemaCopyTimer=setTimeout(()=>{this.copiedSchemaText=!1},1500))},onSelectNode(e){this.$emit(`select-node`,e)},_saveHistoryToCache(){if(!this.historyLoadedFor||!this.historyList.length)return;this._historyCache||={};let e={at:Date.now(),list:this.historyList.slice(0,Vv),total:this.historyTotal,totalPages:this.historyTotalPages,page:this.historyPage};this._historyCache[this.historyLoadedFor]=e;let t=Hv();t[this.historyLoadedFor]=e;let n=Object.keys(t);if(n.length>Bv){n.sort((e,n)=>(t[e].at||0)-(t[n].at||0));for(let e of n.slice(0,n.length-Bv))delete t[e]}Uv(t)},_loadHistoryCache(e){if(!e)return null;if(this._historyCache&&this._historyCache[e])return this._historyCache[e];let t=Hv()[e];return!t||!t.list||!t.list.length?null:(this._historyCache||={},this._historyCache[e]=t,t)},_dropHistoryCache(e){if(!e)return;this._historyCache&&delete this._historyCache[e];let t=Hv();t[e]&&(delete t[e],Uv(t))},resetCardHistory(){this._saveHistoryToCache(),this.historyLoading=!1,this.historyLoadingMore=!1,this.historyError=``,this.historyLoginNeeded=!1,this.historyList=[],this.historyTotal=0,this.historyTotalPages=1,this.historyPage=1,this.historyLoadedFor=``,this.historyPreview=``},maybeFetchCardHistory(){if(!this.cardId||this.historyLoading||this.historyLoadingMore||this.historyLoadedFor===this.cardId)return;let e=this._loadHistoryCache(this.cardId);e?(this.historyList=e.list.slice(),this.historyTotal=e.total,this.historyTotalPages=e.totalPages,this.historyPage=e.page,this.historyLoadedFor=this.cardId,this.historyError=``,this.historyLoginNeeded=!1,this.historyPreview=``):this.fetchCardHistoryPage(1)},async fetchCardHistoryPage(e){let t=e>1,n=this.cardId;if(t){if(this.historyLoadingMore)return;this.historyLoadingMore=!0}else this.historyLoading=!0;this.historyError=``,this.historyLoginNeeded=!1;try{let r=await Y(`/__card-history/${encodeURIComponent(this.cardId)}?pageNo=${e}&pageSize=30`),i=await r.json().catch(()=>({}));if(this.cardId!==n)return;if(i&&i.needCredentials){this.historyList.length||(this.historyLoginNeeded=!0);return}if(!r.ok||!i||!i.ok)throw Error(i&&(i.message||i.error)||`HTTP `+r.status);this.historyList=t?this.historyList.concat(i.list||[]):i.list||[],this.historyTotal=i.totalNums||0,this.historyTotalPages=i.totalPages||1,this.historyPage=e,this.historyLoadedFor=this.cardId,this._saveHistoryToCache()}catch(e){(t||!this.historyList.length)&&(this.historyError=e&&e.message||`查询失败`)}finally{this.historyLoading=!1,this.historyLoadingMore=!1}},reloadCardHistory(){this.historyLoading||this.historyLoadingMore||(this.historyLoadedFor=``,this.fetchCardHistoryPage(1))},loadMoreCardHistory(){this.historyPage>=this.historyTotalPages||this.fetchCardHistoryPage(this.historyPage+1)},openHistoryPreview(e){e&&(this.historyPreview=e)},onThumbError(e){let t=e.target;t&&t.parentNode&&t.parentNode.classList.add(`hist__thumb--broken`),t&&(t.style.display=`none`)},historyDateGroup(e){let t=this.parseHistoryTime(e);if(!t)return{key:`unknown`,label:`时间未知`};let n=new Date,r=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime(),i=Math.round((r(n)-r(t))/864e5);return i<=0?{key:`today`,label:`今天`}:i===1?{key:`yesterday`,label:`昨天`}:{key:`${t.getFullYear()}-${t.getMonth()+1}-${t.getDate()}`,label:`${t.getMonth()+1} 月 ${t.getDate()} 日`}},formatRelTime(e){let t=this.parseHistoryTime(e);if(!t)return``;let n=Date.now()-t.getTime();return n<0?``:n<6e4?`刚刚`:n<36e5?`${Math.floor(n/6e4)} 分钟前`:n<864e5?`${Math.floor(n/36e5)} 小时前`:n<2592e6?`${Math.floor(n/864e5)} 天前`:e.slice(0,10)},parseHistoryTime(e){if(!e||typeof e!=`string`)return null;let t=new Date(e.replace(` `,`T`));return isNaN(t.getTime())?null:t},histTagClass(e){return e?e.indexOf(`新增`)===0?`hist__tag--ok`:e.indexOf(`移除`)===0?`hist__tag--danger`:e===`初始版本`?`hist__tag--accent`:e===`结构未变`?`hist__tag--muted`:`hist__tag--warn`:``},onAddNode(e){this.$emit(`add-node`,e)},onMoveNode(e){this.$emit(`move-node`,e)},onHoverNode(e){this.$emit(`hover-node`,e)},clearEventLogs(){this.rt.clearEventLogs()},async startSvcLog(){this.svcLogFollow=!0,await this.pullSvcLogHistory(0),!this._svcUnsub&&(this._svcUnsub=nu(e=>this.appendSvcLogs(e&&e.lines),e=>{this.svcLogLive=e===`open`,e===`open`&&this.svcLogSeq&&this.pullSvcLogHistory(this.svcLogSeq)}))},stopSvcLog(){this._svcUnsub&&=(this._svcUnsub(),null),this.svcLogLive=!1},async pullSvcLogHistory(e){if(this.svcLogLoading)return;this.svcLogLoading=!0;let t=Math.max(Number(e)||0,this.svcLogFloor);try{let e=await ru({limit:Nv,since:t});if(this.svcLogErr=``,e&&e.enabled===!1)this.svcLogErr=`服务端已关闭日志流(CARDBUDDY_STREAM_LOGS=0)`;else{this.svcLogDropped=e&&e.dropped||0,e&&e.seq&&(this.svcLogSeq=Math.max(this.svcLogSeq,e.seq));let n=(e&&e.lines||[]).map(Iv);t?this.appendSvcLogs(n):this.svcLogs=n,this.scrollSvcToBottom(!0)}}catch(e){this.svcLogErr=e&&e.message||String(e)}finally{this.svcLogLoading=!1}},appendSvcLogs(e){let t=Array.isArray(e)?e:[];if(!t.length)return;let n=[];for(let e of t){let t=e&&e.html!=null?e:Iv(e),r=Number(t.seq)||0;r&&r<=this.svcLogSeq||(r&&(this.svcLogSeq=r),n.push(t))}if(!n.length)return;let r=this.svcLogs.concat(n);this.svcLogs=r.length>Nv?r.slice(r.length-Nv):r,this.svcLogFollow&&this.scrollSvcToBottom()},clearSvcLogs(){this.svcLogFloor=this.svcLogSeq,this.svcLogs=[],this.svcLogDropped=0},async copySvcLogs(){await yp(this.svcLogs.map(e=>e.plain).join(`
199
- `))&&(this.svcCopied=!0,this._svcCopiedTimer&&clearTimeout(this._svcCopiedTimer),this._svcCopiedTimer=setTimeout(()=>{this.svcCopied=!1},1200))},toggleSvcFollow(){this.svcLogFollow=!this.svcLogFollow,this.svcLogFollow&&this.scrollSvcToBottom(!0)},scrollSvcToBottom(e){(e||this.svcLogFollow)&&this.$nextTick(()=>{let e=this.$refs.errBody;e&&(e.scrollTop=e.scrollHeight)})},onErrBodyScroll(){if(this.errorPanel!==`svclog`)return;let e=this.$refs.errBody;e&&(this.svcLogFollow=e.scrollHeight-e.scrollTop-e.clientHeight<24)},fmtTime(e){if(!e)return`--:--:--`;let t=new Date(e),n=e=>String(e).padStart(2,`0`);return n(t.getHours())+`:`+n(t.getMinutes())+`:`+n(t.getSeconds())},maybeFetchMeta(){this.activeTab===`meta`&&this.fetchImportMeta()},async fetchImportMeta(){let e=this.cardId;if(!e)this.importMeta=null;else try{let t=await Y(`/__import-meta/${encodeURIComponent(e)}`);if(t.ok){let e=await t.json();this.importMeta=e.meta||null}else this.importMeta=null}catch{this.importMeta=null}},async refreshRemoteVersion(){if(this.importMeta&&this.importMeta.cardId){this.remoteVersionLoading=!0,this.remoteVersionError=``;try{let e=await Y(`/__card-version/${encodeURIComponent(this.cardId)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`});if(!e.ok){let t=await e.json().catch(()=>({}));if(t.needCredentials){this.remoteVersionError=`需先登录 FinMall 后查询`;return}throw Error(t.message||`HTTP `+e.status)}let t=await e.json();if(!t.ok)throw Error(t.message||`查询失败`);await this.fetchImportMeta()}catch(e){this.remoteVersionError=e&&e.message?e.message:`查询失败`}finally{this.remoteVersionLoading=!1}}},formatTime(e){if(!e)return`-`;try{return new Date(e).toLocaleString(`zh-CN`,{hour12:!1})}catch{return e}}}},Gv={class:`debug`},Kv={class:`debug__tabs`},qv=[`onClick`],Jv={class:`debug__body`},Yv={key:0,class:`vars`},Xv={key:0,class:`empty-state`},Zv={key:1,class:`vars__list`},Qv=[`onDblclick`],$v={class:`vars__key`},ey={key:0,class:`vars__mock`,title:`已配置 mock(dictionary.mocks,设计期覆盖默认值)`},ty=[`title`],ny=[`disabled`,`title`,`onClick`],ry={key:0,class:`debug__copy-ok`},iy={key:1,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},ay=[`onClick`],oy=[`onClick`],sy={class:`vars__fabs`},cy={class:`debug__scope-wrap debug__scope-wrap--raw`},ly={class:`vars__mockhead`},uy={class:`debug__scope-raw`},dy={key:0,class:`raw-err-bar`,role:`alert`},fy={class:`raw-err-bar__msg`},py={ref:`rawEditor`,class:`debug__raw-editor`,spellcheck:`false`},my={class:`debug__scope-foot`},hy={key:0,class:`debug__copied`},gy={key:1,class:`structab`},_y={class:`structab__fabs`},vy=[`title`],yy={key:0,class:`debug__copy-ok`},by={key:1,class:`debug__copy-icn`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},xy={key:2,class:`debug__meta`},Sy={key:0,class:`empty-state`},Cy={key:1,class:`debug__meta-list`},wy={class:`debug__meta-row`},Ty={class:`debug__meta-muted`},Ey={class:`debug__meta-row`},Dy={class:`debug__meta-row`},Oy={class:`debug__meta-row`},ky=[`title`],Ay={key:0,class:`debug__copy-ok`},jy={key:1,class:`debug__meta-copy-icn`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},My={key:0,class:`debug__meta-row`},Ny={class:`debug__meta-row`},Py={class:`debug__meta-row`},Fy={class:`debug__meta-row`},Iy={class:`debug__meta-row`},Ly={key:0,class:`debug__tag debug__tag--warn`,title:`本地已编辑,偏离导入镜像`},Ry={key:1,class:`debug__tag debug__tag--ok`},zy={key:1,class:`debug__meta-row`},By={key:0,class:`debug__tag debug__tag--ok`},Vy={key:1,class:`debug__tag debug__tag--err`},Hy={class:`debug__meta-muted`},Uy={key:2,class:`debug__meta-err`},Wy={class:`debug__meta-row`},Gy={key:0,class:`debug__meta-muted`},Ky={class:`debug__version`},qy={key:0,class:`debug__meta-muted`},Jy={key:2,class:`debug__meta-err`},Yy={key:3,class:`debug__meta-muted`},Xy={class:`hist`},Zy={class:`hist__bar`},Qy={key:0,class:`hist__count`},$y=[`disabled`],eb={key:0,class:`empty-state`},tb={key:1,class:`hist__loading`},nb={key:2,class:`empty-state`},rb={class:`empty-state__hint`},ib={key:3,class:`empty-state`},ab={key:4,class:`hist__timeline`},ob={class:`hist__group-label`},sb={class:`hist__card`},cb={class:`hist__card-head`},lb={class:`hist__time`},ub={class:`hist__rel`},db={class:`hist__id`,title:`远端版本记录 ID`},fb={key:0,class:`hist__badge`},pb=[`disabled`,`onClick`],mb={class:`hist__card-body`},hb=[`onClick`],gb=[`src`],_b={key:1,class:`hist__thumb hist__thumb--none`},vb={class:`hist__info`},yb={class:`hist__tags`},bb={class:`hist__meta`},xb={key:0},Sb={key:1},Cb=[`disabled`],wb=[`src`],Tb={class:`statepanel`,ref:`statePanel`},Eb={class:`statepanel__head`},Db={class:`statepanel__tree`},Ob={class:`statusbar`},kb=[`title`],Ab=[`title`],jb={class:`statusbar__icon`},Mb=[`title`],Nb={class:`statusbar__icon`},Pb=[`title`],Fb={class:`statusbar__item statusbar__item--right`},Ib={class:`statusbar__item statusbar__item--right`},Lb={class:`errpanel`,ref:`errPanel`},Rb={class:`errpanel__head`},zb={class:`errpanel__title`},Bb={key:0,class:`svclog__meta`},Vb={key:0},Hb={key:1,class:`errpanel__tabs`},Ub={class:`errpanel__tab-count`},Wb={class:`errpanel__actions`},Gb=[`disabled`],Kb=[`disabled`,`title`],qb=[`title`],Jb=[`disabled`],Yb={key:0,class:`empty-state`},Xb={class:`debug__empty`},Zb={class:`empty-state__hint`},Qb={key:1,class:`svclog`},$b=[`innerHTML`],ex={key:0,class:`empty-state`},tx={key:1,class:`debug__list debug__list--log`},nx={class:`log__time`},rx={class:`log__content`},ix={key:1,class:`log__empty`},ax={key:0,class:`empty-state`},ox={key:1,class:`debug__list`},sx={class:`err__time`},cx={class:`debug__kind`},lx={class:`err__msg`},ux={key:0,class:`empty-state`},dx={key:1,class:`debug__list`},fx={class:`err__time`},px={class:`debug__kind`},mx={class:`err__msg`},hx={class:`schemaview__title`},gx={class:`schemaview__card`},_x={class:`schemaview__meta`},vx={class:`schemaview__acts`},yx=[`title`],bx={key:0,class:`debug__copy-ok`},xx={key:1,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},Sx={key:0,class:`schemaview__tree`},Cx={key:1,class:`empty-state`},wx=[`aria-label`],Tx={class:`ni-head`},Ex={class:`ni-title`},Dx={class:`ni-cls`},Ox={class:`ni-body`},kx={class:`ni-scroll`},Ax={class:`ni-field-row`},jx={class:`ni-field-row`},Mx={class:`ni-field-row`},Nx={key:0,class:`vars-type-pick`},Px={class:`vars-type-pick__name`},Fx={class:`vars-type-pick`},Ix={class:`vars-type-pick__name`},Lx={class:`ni-field-row ni-field-row--top`},Rx={key:0,ref:`dlgCode`,class:`vars-dlg__code`,spellcheck:`false`},zx=[`placeholder`],Bx={class:`ni-field-row ni-field-row--top`},Vx={key:0,class:`vars-dlg__err`},Hx={class:`ni-foot`},Ux={class:`ni-foot-btns`};function Wx(e,t,n,r,i,a){let o=R(`StructureTree`),s=R(`NodeInspector`),c=R(`EventEditor`),l=R(`PublishVersionsDialog`),u=R(`StateDiffPanel`),d=R(`LogValue`),f=R(`JsonTree`),p=R(`Dropdown`),m=R(`NumberStepper`),h=R(`SetSegment`),g=R(`ConfirmDialog`);return V(),H(`aside`,Gv,[W(`div`,Kv,[(V(!0),H(B,null,z(a.tabs,t=>(V(),H(`button`,{key:t.key,class:j([`debug__tab`,{"debug__tab--active":n.activeTab===t.key}]),onClick:n=>e.$emit(`update:activeTab`,t.key)},M(t.label),11,qv))),128))]),W(`div`,Jv,[n.activeTab===`vars`?(V(),H(B,{key:0},[q(` 变量列表视图:管理 schema.dictionary.inputParams(变量属性的增 / 删 / 改) `),i.varsMode===`list`?(V(),H(`div`,Yv,[q(` 空态占位:与导入信息 / API 调用面板同款语言 `),a.inputParams.length?(V(),H(`ul`,Zv,[(V(!0),H(B,null,z(a.inputParams,(e,n)=>(V(),H(`li`,{key:e.key||n,class:`vars__row`,onDblclick:e=>a.openVarDlg(n)},[W(`span`,$v,M(e.key),1),W(`span`,{class:j([`vars__type`,`vars__type--`+(e.type||`string`)])},M(e.type||`string`),3),a.hasMock(e)?(V(),H(`span`,ey,`m`)):q(`v-if`,!0),W(`span`,{class:`vars__name`,title:[e.name,e.desc].filter(Boolean).join(` · `)},M(e.name||e.desc||``),9,ty),q(` 操作区双击不冒泡到行:连点复制/删除/编辑钮时不误开编辑弹窗 `),W(`span`,{class:`vars__ops`,onDblclick:t[0]||=J(()=>{},[`stop`])},[q(` 复制变量名:复制当前变量 key(绑定以 $key 引用),无变量名时禁用 `),W(`button`,{class:`vars__op`,type:`button`,disabled:!e.key,title:i.copiedVar===n?`已复制 ✓`:e.key?`复制变量名`:`暂无变量名`,onClick:t=>a.copyVarName(e,n)},[i.copiedVar===n?(V(),H(`span`,ry,`✓`)):(V(),H(`svg`,iy,[...t[63]||=[W(`use`,{href:`#icon-copy-sm`},null,-1)]]))],8,ny),W(`button`,{class:`vars__op`,type:`button`,title:`编辑变量`,onClick:e=>a.openVarDlg(n)},[...t[64]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-gear`})],-1)]],8,ay),W(`button`,{class:`vars__op vars__op--del`,type:`button`,title:`删除变量`,onClick:e=>a.askDeleteVar(n)},[...t[65]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-trash`})],-1)]],8,oy)],32)],40,Qv))),128))])):(V(),H(`div`,Xv,[...t[62]||=[_s(`<span class="empty-state__badge" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-settings"></use></svg></span><p class="debug__empty">暂无变量</p><p class="empty-state__hint">变量与 schema.dictionary.inputParams 一一对应:绑定表达式以 $key 引用,mock 值供设计期预览</p>`,3)]])),q(` 右下角悬浮操作组:与 mock 视图悬浮条同语言,不占固定行高 `),W(`div`,sy,[W(`button`,{class:`debug__copy`,type:`button`,title:`新增变量(写入 dictionary.inputParams)`,onClick:t[1]||=e=>a.openVarDlg(null)},`+ 添加变量`),a.inputParams.length?(V(),H(`button`,{key:0,class:`debug__copy`,type:`button`,title:`以 Raw JSON 编辑全部变量的设计期 mock 数据`,onClick:t[2]||=e=>i.varsMode=`mock`},`配置变量 mock`)):q(`v-if`,!0)])])):(V(),H(B,{key:1},[q(` mock 二级视图:仅 Raw JSON(CodeJar + Prism 高亮);右下角操作按钮只在此出现 `),W(`div`,cy,[W(`div`,ly,[W(`button`,{class:`vars__back`,type:`button`,title:`返回变量列表`,onClick:t[3]||=(...e)=>a.leaveMock&&a.leaveMock(...e)},[...t[66]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-chevron-left`})],-1),K(` 变量 `,-1)]]),t[67]||=W(`span`,{class:`vars__mocktitle`},`变量 mock · 设计期覆盖(dictionary.mocks · Raw JSON)`,-1),t[68]||=W(`span`,{class:`vars__mockhint`},`仅设计期生效 · 未列出的键回退默认值`,-1)]),W(`div`,uy,[q(` 报错提示条:与顶部提示条同语言(语义色软底 + 图标 + 关闭),钉在编辑器顶部不挤占编辑区 `),i.rawError?(V(),H(`div`,dy,[t[69]||=W(`svg`,{class:`raw-err-bar__icn`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-alert-triangle`})],-1),W(`span`,fy,M(i.rawError),1),W(`button`,{class:`raw-err-bar__close`,type:`button`,title:`关闭`,onClick:t[4]||=e=>i.rawError=``},`✕`)])):q(`v-if`,!0),W(`div`,py,null,512)]),W(`div`,my,[q(` 右下角悬浮组内的返回:与头部 chip 同一 leaveMock 语义,手不离编辑区即可退出二级视图 `),W(`button`,{class:`debug__copy`,type:`button`,title:`返回变量列表`,onClick:t[5]||=(...e)=>a.leaveMock&&a.leaveMock(...e)},[...t[70]||=[W(`svg`,{class:`debug__copy-icn`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-chevron-left`})],-1),K(`返回 `,-1)]]),t[74]||=W(`span`,{class:`debug__sep`},null,-1),i.copied?(V(),H(`span`,hy,`已复制 ✓`)):q(`v-if`,!0),W(`button`,{class:`debug__copy`,type:`button`,onClick:t[6]||=(...e)=>a.copyScope&&a.copyScope(...e)},[...t[71]||=[W(`svg`,{class:`debug__copy-icn`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-copy-sm`})],-1),K(`复制 `,-1)]]),t[75]||=W(`span`,{class:`debug__sep`},null,-1),W(`button`,{class:`debug__copy debug__copy--primary`,type:`button`,onClick:t[7]||=(...e)=>a.saveRaw&&a.saveRaw(...e)},[...t[72]||=[W(`svg`,{class:`debug__copy-icn`,viewBox:`0 0 16 16`,"aria-hidden":`true`},[W(`use`,{href:`#icon-check`})],-1),K(`应用 `,-1)]]),W(`button`,{class:`debug__copy debug__copy--warn`,type:`button`,onClick:t[8]||=t=>e.$emit(`reset-import`),title:`丢弃内存编辑,从磁盘重新载入(导入优先于编辑)`},[...t[73]||=[W(`svg`,{class:`debug__copy-icn`,viewBox:`0 0 16 16`,"aria-hidden":`true`},[W(`use`,{href:`#icon-reset`})],-1),K(`重置 `,-1)]])])])],2112))],64)):n.activeTab===`structure`?(V(),H(`div`,gy,[G(o,{preview:n.preview,schema:n.schema,"card-code":n.cardId,"selected-node-id":n.selectedNodeId,"move-collapse-token":n.moveCollapseToken,"can-paste":a.canPaste,onEditEvent:a.onEditEvent,onInspect:a.onInspect,onSelectNode:a.onSelectNode,onAddNode:a.onAddNode,onMoveNode:a.onMoveNode,onHoverNode:a.onHoverNode,onCopySelected:t[9]||=t=>e.$emit(`copy-selected`),onPaste:t[10]||=t=>e.$emit(`paste`),onDuplicate:t[11]||=t=>e.$emit(`duplicate`),onDeleteSelected:t[12]||=t=>e.$emit(`delete-selected`),onRenameCard:t[13]||=t=>e.$emit(`rename-card`)},null,8,[`preview`,`schema`,`card-code`,`selected-node-id`,`move-collapse-token`,`can-paste`,`onEditEvent`,`onInspect`,`onSelectNode`,`onAddNode`,`onMoveNode`,`onHoverNode`]),q(` 右下角悬浮融合按钮组:查看 schema(全屏只读面板)+ 复制整份 schema `),W(`div`,_y,[W(`button`,{class:`debug__copy`,type:`button`,title:`全屏查看当前卡片的原始 schema(只读)`,onClick:t[14]||=(...e)=>a.openSchemaViewer&&a.openSchemaViewer(...e)},`查看 schema`),W(`button`,{class:`debug__copy`,type:`button`,title:i.copiedSchemaText?`已复制 ✓`:`复制整份 schema(含变量 mock 合并后的数据)`,onClick:t[15]||=(...e)=>a.copySchemaText&&a.copySchemaText(...e)},[i.copiedSchemaText?(V(),H(`span`,yy,`✓`)):(V(),H(`svg`,by,[...t[76]||=[W(`use`,{href:`#icon-copy-sm`},null,-1)]])),t[77]||=K(`复制 `,-1)],8,vy)])])):n.activeTab===`meta`?(V(),H(`div`,xy,[q(` 引导提示置顶:sticky 吸附在面板顶部(DOM 首位),滚动时不随列表滚走 `),t[98]||=W(`p`,{class:`debug__meta-hint`},`导入优先于编辑:在「变量」tab →「配置变量 mock」里点「重置」,可丢弃内存编辑、从磁盘重新载入最新导入。`,-1),q(` 空状态占位:与 API 调用面板同款(虚线徽章 + 线性图标 + 文案 + 弱提示) `),i.importMeta?(V(),H(`dl`,Cy,[W(`div`,wy,[t[80]||=W(`dt`,null,`导入接口`,-1),W(`dd`,null,[W(`code`,null,M(i.importMeta.interface),1),t[79]||=K(),W(`span`,Ty,`(`+M(i.importMeta.source)+`)`,1)])]),W(`div`,Ey,[t[81]||=W(`dt`,null,`远端基址`,-1),W(`dd`,null,[W(`code`,null,M(i.importMeta.baseUrl),1)])]),W(`div`,Dy,[t[82]||=W(`dt`,null,`cardId`,-1),W(`dd`,null,[W(`code`,null,M(i.importMeta.cardId),1)])]),W(`div`,Oy,[t[84]||=W(`dt`,null,`cardCode`,-1),W(`dd`,null,[W(`code`,null,M(i.importMeta.cardCode),1),W(`button`,{class:`debug__meta-copy`,type:`button`,title:i.copiedCode?`已复制 ✓`:`复制 cardCode`,onClick:t[16]||=(...e)=>a.copyCardCode&&a.copyCardCode(...e)},[i.copiedCode?(V(),H(`span`,Ay,`✓`)):(V(),H(`svg`,jy,[...t[83]||=[W(`use`,{href:`#icon-copy-sm`},null,-1)]]))],8,ky)])]),i.importMeta.cardName?(V(),H(`div`,My,[t[85]||=W(`dt`,null,`卡片标题`,-1),W(`dd`,null,M(i.importMeta.cardName),1)])):q(`v-if`,!0),W(`div`,Ny,[t[87]||=W(`dt`,null,`应用 / 空间`,-1),W(`dd`,null,[W(`code`,null,M(i.importMeta.appId),1),t[86]||=K(` / `,-1),W(`code`,null,M(i.importMeta.workspaceId),1)])]),W(`div`,Py,[t[88]||=W(`dt`,null,`同步时间`,-1),W(`dd`,null,M(a.formatTime(i.importMeta.syncedAt)),1)]),W(`div`,Fy,[t[89]||=W(`dt`,null,`落库位置`,-1),W(`dd`,null,[W(`code`,null,`src/cards/`+M(i.importMeta.cardCode)+`/`,1)])]),W(`div`,Iy,[t[90]||=W(`dt`,null,`本地状态`,-1),W(`dd`,null,[i.importMeta.dirty?(V(),H(`span`,Ly,`已编辑(偏离导入镜像)`)):(V(),H(`span`,Ry,`与导入镜像一致`))])]),i.importMeta.lastExport?(V(),H(`div`,zy,[t[91]||=W(`dt`,null,`最近导出`,-1),W(`dd`,null,[i.importMeta.lastExport.ok?(V(),H(`span`,By,`读回校验通过 ✓`)):(V(),H(`span`,Vy,`读回校验未通过 ✗`)),W(`span`,Hy,`(`+M(a.formatTime(i.importMeta.lastExport.at))+`)`,1),i.importMeta.lastExport.readBackError?(V(),H(`span`,Uy,` · `+M(i.importMeta.lastExport.readBackError),1)):q(`v-if`,!0)])])):q(`v-if`,!0),W(`div`,Wy,[t[97]||=W(`dt`,null,`线上最新版本`,-1),W(`dd`,null,[i.remoteVersionLoading?(V(),H(`span`,Gy,`查询中…`)):i.importMeta.remoteVersion==null?i.remoteVersionError?(V(),H(`span`,Jy,[K(M(i.remoteVersionError)+`(`,1),W(`a`,{class:`debug__link`,onClick:t[18]||=(...e)=>a.refreshRemoteVersion&&a.refreshRemoteVersion(...e)},`重试`),t[93]||=K(`)`,-1)])):(V(),H(`span`,Yy,[t[94]||=K(`未记录(`,-1),W(`a`,{class:`debug__link`,onClick:t[19]||=(...e)=>a.refreshRemoteVersion&&a.refreshRemoteVersion(...e)},`查询`),t[95]||=K(`)`,-1)])):(V(),H(B,{key:1},[W(`code`,Ky,M(i.importMeta.remoteVersion),1),i.importMeta.remoteVersionAt?(V(),H(`span`,qy,`(`+M(a.formatTime(i.importMeta.remoteVersionAt))+` 查询)`,1)):q(`v-if`,!0),W(`button`,{class:`debug__meta-refresh`,type:`button`,title:`刷新线上最新版本`,onClick:t[17]||=(...e)=>a.refreshRemoteVersion&&a.refreshRemoteVersion(...e)},[...t[92]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-refresh`})],-1)]])],64)),q(` 发布版本记录:与刷新按钮同款内联小按钮(图标换列表),点击弹 IDC10004 分页表格 `),W(`button`,{class:`debug__meta-history`,type:`button`,title:`查看发布版本记录`,onClick:t[20]||=e=>i.publishRecordsOpen=!0},[...t[96]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-list`})],-1)]])])])])):(V(),H(`div`,Sy,[...t[78]||=[_s(`<span class="empty-state__badge" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-cloud"></use></svg></span><p class="debug__empty">暂无导入信息</p><p class="empty-state__hint">该卡尚未经「同步远程」导入,无导入来源元数据;本地新建卡 / 未同步卡均如此</p>`,3)]]))])):n.activeTab===`history`?(V(),H(B,{key:3},[q(` 编辑记录:远端版本时间线(git log 式,新→旧)。仅远端已登录时出现该 tab,
200
- 数据经 GET /__card-history/:cardCode(服务端走 IDC10013)懒加载,换卡清空。 `),W(`div`,Xy,[W(`div`,Zy,[t[100]||=W(`span`,{class:`hist__title`},`远端版本时间线`,-1),i.historyList.length?(V(),H(`span`,Qy,`共 `+M(i.historyTotal)+` 个版本`,1)):q(`v-if`,!0),W(`button`,{class:j([`hist__refresh`,{"is-busy":i.historyLoading}]),type:`button`,disabled:i.historyLoading,title:`刷新历史记录`,onClick:t[21]||=(...e)=>a.reloadCardHistory&&a.reloadCardHistory(...e)},[...t[99]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-refresh`})],-1)]],10,$y)]),q(` 凭据缺失引导(双保险:tab 仅在登录态出现,凭据过期/被清时给出明确指引) `),a.historyNeedLogin?(V(),H(`div`,eb,[...t[101]||=[_s(`<span class="empty-state__badge" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-cloud"></use></svg></span><p class="debug__empty">远端登录凭据缺失</p><p class="empty-state__hint">请先通过顶栏「远端」完成 FinMall 登录,再查看远端历史版本</p>`,3)]])):i.historyLoading&&!i.historyList.length?(V(),H(`div`,tb,`正在查询远端历史…`)):i.historyError?(V(),H(`div`,nb,[t[103]||=W(`span`,{class:`empty-state__badge`,"aria-hidden":`true`},[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[W(`use`,{href:`#icon-history`})])],-1),t[104]||=W(`p`,{class:`debug__empty`},`历史记录加载失败`,-1),W(`p`,rb,[K(M(i.historyError)+`(`,1),W(`a`,{class:`debug__link`,onClick:t[22]||=(...e)=>a.reloadCardHistory&&a.reloadCardHistory(...e)},`重试`),t[102]||=K(`)`,-1)])])):i.historyList.length?(V(),H(`div`,ab,[(V(!0),H(B,null,z(a.historyGroups,r=>(V(),H(`div`,{key:r.key,class:`hist__group`},[W(`div`,ob,M(r.label),1),(V(!0),H(B,null,z(r.items,r=>(V(),H(`div`,{key:r.id,class:`hist__item`},[t[107]||=W(`div`,{class:`hist__rail`,"aria-hidden":`true`},[W(`span`,{class:`hist__dot`})],-1),W(`div`,sb,[W(`div`,cb,[W(`span`,lb,M(r.createTime),1),W(`span`,ub,M(a.formatRelTime(r.createTime)),1),W(`code`,db,`#`+M(r.id),1),r.id===a.historyLatestId?(V(),H(`span`,fb,`最新`)):q(`v-if`,!0),q(` 加载此版本:仅把该版本写本地 schema.json 并重载编辑器,不自动推送/保存到远端 `),W(`button`,{class:j([`hist__restore`,{"is-busy":n.historyRestoring}]),type:`button`,disabled:n.historyRestoring,title:`把该版本加载到编辑器(仅加载,不会自动保存到远端)`,onClick:t=>e.$emit(`restore-history`,r)},[...t[106]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-undo`})],-1),K(`加载此版本 `,-1)]],10,pb)]),W(`div`,mb,[r.screenshotPath?(V(),H(`div`,{key:0,class:`hist__thumb`,title:`点击查看大图`,onClick:e=>a.openHistoryPreview(r.screenshotPath)},[W(`img`,{src:r.screenshotPath,alt:`版本预览`,loading:`lazy`,onError:t[23]||=(...e)=>a.onThumbError&&a.onThumbError(...e)},null,40,gb)],8,hb)):(V(),H(`div`,_b,`无预览`)),W(`div`,vb,[W(`div`,yb,[(V(!0),H(B,null,z(r.tags,(e,t)=>(V(),H(`span`,{key:t,class:j([`hist__tag`,a.histTagClass(e)])},M(e),3))),128))]),W(`div`,bb,[K(M(r.summary.componentCount)+` 个组件`,1),r.summary.width?(V(),H(`span`,xb,` · 画布宽 `+M(r.summary.width),1)):q(`v-if`,!0),r.summary.name?(V(),H(`span`,Sb,` · `+M(r.summary.name),1)):q(`v-if`,!0)])])])])]))),128))]))),128)),i.historyList.length<i.historyTotal?(V(),H(`button`,{key:0,class:`hist__more`,type:`button`,disabled:i.historyLoadingMore,onClick:t[24]||=(...e)=>a.loadMoreCardHistory&&a.loadMoreCardHistory(...e)},M(i.historyLoadingMore?`加载中…`:`加载更多(剩余 ${i.historyTotal-i.historyList.length} 条)`),9,Cb)):q(`v-if`,!0)])):(V(),H(`div`,ib,[...t[105]||=[_s(`<span class="empty-state__badge" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-history"></use></svg></span><p class="debug__empty">暂无历史版本</p><p class="empty-state__hint">该卡在远端还没有已保存的版本记录;每次「保存到远端」后会生成新的一条</p>`,3)]]))]),q(` 版本预览大图:点击缩略图弹出,点遮罩或 ✕ 关闭 `),i.historyPreview?(V(),H(`div`,{key:0,class:`hist__preview-mask`,onClick:t[26]||=J(e=>i.historyPreview=``,[`self`])},[W(`img`,{class:`hist__preview-img`,src:i.historyPreview,alt:`版本预览大图`},null,8,wb),W(`button`,{class:`hist__preview-x`,type:`button`,title:`关闭预览`,onClick:t[25]||=e=>i.historyPreview=``},[...t[108]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-x`})],-1)]])])):q(`v-if`,!0)],64)):q(`v-if`,!0)]),q(`
199
+ `))&&(this.svcCopied=!0,this._svcCopiedTimer&&clearTimeout(this._svcCopiedTimer),this._svcCopiedTimer=setTimeout(()=>{this.svcCopied=!1},1200))},toggleSvcFollow(){this.svcLogFollow=!this.svcLogFollow,this.svcLogFollow&&this.scrollSvcToBottom(!0)},scrollSvcToBottom(e){(e||this.svcLogFollow)&&this.$nextTick(()=>{let e=this.$refs.errBody;e&&(e.scrollTop=e.scrollHeight)})},onErrBodyScroll(){if(this.errorPanel!==`svclog`)return;let e=this.$refs.errBody;e&&(this.svcLogFollow=e.scrollHeight-e.scrollTop-e.clientHeight<24)},fmtTime(e){if(!e)return`--:--:--`;let t=new Date(e),n=e=>String(e).padStart(2,`0`);return n(t.getHours())+`:`+n(t.getMinutes())+`:`+n(t.getSeconds())},maybeFetchMeta(){this.activeTab===`meta`&&this.fetchImportMeta()},async fetchImportMeta(){let e=this.cardId;if(!e)this.importMeta=null;else try{let t=await Y(`/__import-meta/${encodeURIComponent(e)}`);if(t.ok){let e=await t.json();this.importMeta=e.meta||null}else this.importMeta=null}catch{this.importMeta=null}},async refreshRemoteVersion(){if(this.importMeta&&this.importMeta.cardId){this.remoteVersionLoading=!0,this.remoteVersionError=``;try{let e=await Y(`/__card-version/${encodeURIComponent(this.cardId)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`});if(!e.ok){let t=await e.json().catch(()=>({}));if(t.needCredentials){this.remoteVersionError=`需先登录远端后查询`;return}throw Error(t.message||`HTTP `+e.status)}let t=await e.json();if(!t.ok)throw Error(t.message||`查询失败`);await this.fetchImportMeta()}catch(e){this.remoteVersionError=e&&e.message?e.message:`查询失败`}finally{this.remoteVersionLoading=!1}}},formatTime(e){if(!e)return`-`;try{return new Date(e).toLocaleString(`zh-CN`,{hour12:!1})}catch{return e}}}},Gv={class:`debug`},Kv={class:`debug__tabs`},qv=[`onClick`],Jv={class:`debug__body`},Yv={key:0,class:`vars`},Xv={key:0,class:`empty-state`},Zv={key:1,class:`vars__list`},Qv=[`onDblclick`],$v={class:`vars__key`},ey={key:0,class:`vars__mock`,title:`已配置 mock(dictionary.mocks,设计期覆盖默认值)`},ty=[`title`],ny=[`disabled`,`title`,`onClick`],ry={key:0,class:`debug__copy-ok`},iy={key:1,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},ay=[`onClick`],oy=[`onClick`],sy={class:`vars__fabs`},cy={class:`debug__scope-wrap debug__scope-wrap--raw`},ly={class:`vars__mockhead`},uy={class:`debug__scope-raw`},dy={key:0,class:`raw-err-bar`,role:`alert`},fy={class:`raw-err-bar__msg`},py={ref:`rawEditor`,class:`debug__raw-editor`,spellcheck:`false`},my={class:`debug__scope-foot`},hy={key:0,class:`debug__copied`},gy={key:1,class:`structab`},_y={class:`structab__fabs`},vy=[`title`],yy={key:0,class:`debug__copy-ok`},by={key:1,class:`debug__copy-icn`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},xy={key:2,class:`debug__meta`},Sy={key:0,class:`empty-state`},Cy={key:1,class:`debug__meta-list`},wy={class:`debug__meta-row`},Ty={class:`debug__meta-muted`},Ey={class:`debug__meta-row`},Dy={class:`debug__meta-row`},Oy={class:`debug__meta-row`},ky=[`title`],Ay={key:0,class:`debug__copy-ok`},jy={key:1,class:`debug__meta-copy-icn`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},My={key:0,class:`debug__meta-row`},Ny={class:`debug__meta-row`},Py={class:`debug__meta-row`},Fy={class:`debug__meta-row`},Iy={class:`debug__meta-row`},Ly={key:0,class:`debug__tag debug__tag--warn`,title:`本地已编辑,偏离导入镜像`},Ry={key:1,class:`debug__tag debug__tag--ok`},zy={key:1,class:`debug__meta-row`},By={key:0,class:`debug__tag debug__tag--ok`},Vy={key:1,class:`debug__tag debug__tag--err`},Hy={class:`debug__meta-muted`},Uy={key:2,class:`debug__meta-err`},Wy={class:`debug__meta-row`},Gy={key:0,class:`debug__meta-muted`},Ky={class:`debug__version`},qy={key:0,class:`debug__meta-muted`},Jy={key:2,class:`debug__meta-err`},Yy={key:3,class:`debug__meta-muted`},Xy={class:`hist`},Zy={class:`hist__bar`},Qy={key:0,class:`hist__count`},$y=[`disabled`],eb={key:0,class:`empty-state`},tb={key:1,class:`hist__loading`},nb={key:2,class:`empty-state`},rb={class:`empty-state__hint`},ib={key:3,class:`empty-state`},ab={key:4,class:`hist__timeline`},ob={class:`hist__group-label`},sb={class:`hist__card`},cb={class:`hist__card-head`},lb={class:`hist__time`},ub={class:`hist__rel`},db={class:`hist__id`,title:`远端版本记录 ID`},fb={key:0,class:`hist__badge`},pb=[`disabled`,`onClick`],mb={class:`hist__card-body`},hb=[`onClick`],gb=[`src`],_b={key:1,class:`hist__thumb hist__thumb--none`},vb={class:`hist__info`},yb={class:`hist__tags`},bb={class:`hist__meta`},xb={key:0},Sb={key:1},Cb=[`disabled`],wb=[`src`],Tb={class:`statepanel`,ref:`statePanel`},Eb={class:`statepanel__head`},Db={class:`statepanel__tree`},Ob={class:`statusbar`},kb=[`title`],Ab=[`title`],jb={class:`statusbar__icon`},Mb=[`title`],Nb={class:`statusbar__icon`},Pb=[`title`],Fb={class:`statusbar__item statusbar__item--right`},Ib={class:`statusbar__item statusbar__item--right`},Lb={class:`errpanel`,ref:`errPanel`},Rb={class:`errpanel__head`},zb={class:`errpanel__title`},Bb={key:0,class:`svclog__meta`},Vb={key:0},Hb={key:1,class:`errpanel__tabs`},Ub={class:`errpanel__tab-count`},Wb={class:`errpanel__actions`},Gb=[`disabled`],Kb=[`disabled`,`title`],qb=[`title`],Jb=[`disabled`],Yb={key:0,class:`empty-state`},Xb={class:`debug__empty`},Zb={class:`empty-state__hint`},Qb={key:1,class:`svclog`},$b=[`innerHTML`],ex={key:0,class:`empty-state`},tx={key:1,class:`debug__list debug__list--log`},nx={class:`log__time`},rx={class:`log__content`},ix={key:1,class:`log__empty`},ax={key:0,class:`empty-state`},ox={key:1,class:`debug__list`},sx={class:`err__time`},cx={class:`debug__kind`},lx={class:`err__msg`},ux={key:0,class:`empty-state`},dx={key:1,class:`debug__list`},fx={class:`err__time`},px={class:`debug__kind`},mx={class:`err__msg`},hx={class:`schemaview__title`},gx={class:`schemaview__card`},_x={class:`schemaview__meta`},vx={class:`schemaview__acts`},yx=[`title`],bx={key:0,class:`debug__copy-ok`},xx={key:1,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},Sx={key:0,class:`schemaview__tree`},Cx={key:1,class:`empty-state`},wx=[`aria-label`],Tx={class:`ni-head`},Ex={class:`ni-title`},Dx={class:`ni-cls`},Ox={class:`ni-body`},kx={class:`ni-scroll`},Ax={class:`ni-field-row`},jx={class:`ni-field-row`},Mx={class:`ni-field-row`},Nx={key:0,class:`vars-type-pick`},Px={class:`vars-type-pick__name`},Fx={class:`vars-type-pick`},Ix={class:`vars-type-pick__name`},Lx={class:`ni-field-row ni-field-row--top`},Rx={key:0,ref:`dlgCode`,class:`vars-dlg__code`,spellcheck:`false`},zx=[`placeholder`],Bx={class:`ni-field-row ni-field-row--top`},Vx={key:0,class:`vars-dlg__err`},Hx={class:`ni-foot`},Ux={class:`ni-foot-btns`};function Wx(e,t,n,r,i,a){let o=R(`StructureTree`),s=R(`NodeInspector`),c=R(`EventEditor`),l=R(`PublishVersionsDialog`),u=R(`StateDiffPanel`),d=R(`LogValue`),f=R(`JsonTree`),p=R(`Dropdown`),m=R(`NumberStepper`),h=R(`SetSegment`),g=R(`ConfirmDialog`);return V(),H(`aside`,Gv,[W(`div`,Kv,[(V(!0),H(B,null,z(a.tabs,t=>(V(),H(`button`,{key:t.key,class:j([`debug__tab`,{"debug__tab--active":n.activeTab===t.key}]),onClick:n=>e.$emit(`update:activeTab`,t.key)},M(t.label),11,qv))),128))]),W(`div`,Jv,[n.activeTab===`vars`?(V(),H(B,{key:0},[q(` 变量列表视图:管理 schema.dictionary.inputParams(变量属性的增 / 删 / 改) `),i.varsMode===`list`?(V(),H(`div`,Yv,[q(` 空态占位:与导入信息 / API 调用面板同款语言 `),a.inputParams.length?(V(),H(`ul`,Zv,[(V(!0),H(B,null,z(a.inputParams,(e,n)=>(V(),H(`li`,{key:e.key||n,class:`vars__row`,onDblclick:e=>a.openVarDlg(n)},[W(`span`,$v,M(e.key),1),W(`span`,{class:j([`vars__type`,`vars__type--`+(e.type||`string`)])},M(e.type||`string`),3),a.hasMock(e)?(V(),H(`span`,ey,`m`)):q(`v-if`,!0),W(`span`,{class:`vars__name`,title:[e.name,e.desc].filter(Boolean).join(` · `)},M(e.name||e.desc||``),9,ty),q(` 操作区双击不冒泡到行:连点复制/删除/编辑钮时不误开编辑弹窗 `),W(`span`,{class:`vars__ops`,onDblclick:t[0]||=J(()=>{},[`stop`])},[q(` 复制变量名:复制当前变量 key(绑定以 $key 引用),无变量名时禁用 `),W(`button`,{class:`vars__op`,type:`button`,disabled:!e.key,title:i.copiedVar===n?`已复制 ✓`:e.key?`复制变量名`:`暂无变量名`,onClick:t=>a.copyVarName(e,n)},[i.copiedVar===n?(V(),H(`span`,ry,`✓`)):(V(),H(`svg`,iy,[...t[63]||=[W(`use`,{href:`#icon-copy-sm`},null,-1)]]))],8,ny),W(`button`,{class:`vars__op`,type:`button`,title:`编辑变量`,onClick:e=>a.openVarDlg(n)},[...t[64]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-gear`})],-1)]],8,ay),W(`button`,{class:`vars__op vars__op--del`,type:`button`,title:`删除变量`,onClick:e=>a.askDeleteVar(n)},[...t[65]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-trash`})],-1)]],8,oy)],32)],40,Qv))),128))])):(V(),H(`div`,Xv,[...t[62]||=[_s(`<span class="empty-state__badge" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-settings"></use></svg></span><p class="debug__empty">暂无变量</p><p class="empty-state__hint">变量与 schema.dictionary.inputParams 一一对应:绑定表达式以 $key 引用,mock 值供设计期预览</p>`,3)]])),q(` 右下角悬浮操作组:与 mock 视图悬浮条同语言,不占固定行高 `),W(`div`,sy,[W(`button`,{class:`debug__copy`,type:`button`,title:`新增变量(写入 dictionary.inputParams)`,onClick:t[1]||=e=>a.openVarDlg(null)},`+ 添加变量`),a.inputParams.length?(V(),H(`button`,{key:0,class:`debug__copy`,type:`button`,title:`以 Raw JSON 编辑全部变量的设计期 mock 数据`,onClick:t[2]||=e=>i.varsMode=`mock`},`配置变量 mock`)):q(`v-if`,!0)])])):(V(),H(B,{key:1},[q(` mock 二级视图:仅 Raw JSON(CodeJar + Prism 高亮);右下角操作按钮只在此出现 `),W(`div`,cy,[W(`div`,ly,[W(`button`,{class:`vars__back`,type:`button`,title:`返回变量列表`,onClick:t[3]||=(...e)=>a.leaveMock&&a.leaveMock(...e)},[...t[66]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-chevron-left`})],-1),K(` 变量 `,-1)]]),t[67]||=W(`span`,{class:`vars__mocktitle`},`变量 mock · 设计期覆盖(dictionary.mocks · Raw JSON)`,-1),t[68]||=W(`span`,{class:`vars__mockhint`},`仅设计期生效 · 未列出的键回退默认值`,-1)]),W(`div`,uy,[q(` 报错提示条:与顶部提示条同语言(语义色软底 + 图标 + 关闭),钉在编辑器顶部不挤占编辑区 `),i.rawError?(V(),H(`div`,dy,[t[69]||=W(`svg`,{class:`raw-err-bar__icn`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-alert-triangle`})],-1),W(`span`,fy,M(i.rawError),1),W(`button`,{class:`raw-err-bar__close`,type:`button`,title:`关闭`,onClick:t[4]||=e=>i.rawError=``},`✕`)])):q(`v-if`,!0),W(`div`,py,null,512)]),W(`div`,my,[q(` 右下角悬浮组内的返回:与头部 chip 同一 leaveMock 语义,手不离编辑区即可退出二级视图 `),W(`button`,{class:`debug__copy`,type:`button`,title:`返回变量列表`,onClick:t[5]||=(...e)=>a.leaveMock&&a.leaveMock(...e)},[...t[70]||=[W(`svg`,{class:`debug__copy-icn`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-chevron-left`})],-1),K(`返回 `,-1)]]),t[74]||=W(`span`,{class:`debug__sep`},null,-1),i.copied?(V(),H(`span`,hy,`已复制 ✓`)):q(`v-if`,!0),W(`button`,{class:`debug__copy`,type:`button`,onClick:t[6]||=(...e)=>a.copyScope&&a.copyScope(...e)},[...t[71]||=[W(`svg`,{class:`debug__copy-icn`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-copy-sm`})],-1),K(`复制 `,-1)]]),t[75]||=W(`span`,{class:`debug__sep`},null,-1),W(`button`,{class:`debug__copy debug__copy--primary`,type:`button`,onClick:t[7]||=(...e)=>a.saveRaw&&a.saveRaw(...e)},[...t[72]||=[W(`svg`,{class:`debug__copy-icn`,viewBox:`0 0 16 16`,"aria-hidden":`true`},[W(`use`,{href:`#icon-check`})],-1),K(`应用 `,-1)]]),W(`button`,{class:`debug__copy debug__copy--warn`,type:`button`,onClick:t[8]||=t=>e.$emit(`reset-import`),title:`丢弃内存编辑,从磁盘重新载入(导入优先于编辑)`},[...t[73]||=[W(`svg`,{class:`debug__copy-icn`,viewBox:`0 0 16 16`,"aria-hidden":`true`},[W(`use`,{href:`#icon-reset`})],-1),K(`重置 `,-1)]])])])],2112))],64)):n.activeTab===`structure`?(V(),H(`div`,gy,[G(o,{preview:n.preview,schema:n.schema,"card-code":n.cardId,"selected-node-id":n.selectedNodeId,"move-collapse-token":n.moveCollapseToken,"can-paste":a.canPaste,onEditEvent:a.onEditEvent,onInspect:a.onInspect,onSelectNode:a.onSelectNode,onAddNode:a.onAddNode,onMoveNode:a.onMoveNode,onHoverNode:a.onHoverNode,onCopySelected:t[9]||=t=>e.$emit(`copy-selected`),onPaste:t[10]||=t=>e.$emit(`paste`),onDuplicate:t[11]||=t=>e.$emit(`duplicate`),onDeleteSelected:t[12]||=t=>e.$emit(`delete-selected`),onRenameCard:t[13]||=t=>e.$emit(`rename-card`)},null,8,[`preview`,`schema`,`card-code`,`selected-node-id`,`move-collapse-token`,`can-paste`,`onEditEvent`,`onInspect`,`onSelectNode`,`onAddNode`,`onMoveNode`,`onHoverNode`]),q(` 右下角悬浮融合按钮组:查看 schema(全屏只读面板)+ 复制整份 schema `),W(`div`,_y,[W(`button`,{class:`debug__copy`,type:`button`,title:`全屏查看当前卡片的原始 schema(只读)`,onClick:t[14]||=(...e)=>a.openSchemaViewer&&a.openSchemaViewer(...e)},`查看 schema`),W(`button`,{class:`debug__copy`,type:`button`,title:i.copiedSchemaText?`已复制 ✓`:`复制整份 schema(含变量 mock 合并后的数据)`,onClick:t[15]||=(...e)=>a.copySchemaText&&a.copySchemaText(...e)},[i.copiedSchemaText?(V(),H(`span`,yy,`✓`)):(V(),H(`svg`,by,[...t[76]||=[W(`use`,{href:`#icon-copy-sm`},null,-1)]])),t[77]||=K(`复制 `,-1)],8,vy)])])):n.activeTab===`meta`?(V(),H(`div`,xy,[q(` 引导提示置顶:sticky 吸附在面板顶部(DOM 首位),滚动时不随列表滚走 `),t[98]||=W(`p`,{class:`debug__meta-hint`},`导入优先于编辑:在「变量」tab →「配置变量 mock」里点「重置」,可丢弃内存编辑、从磁盘重新载入最新导入。`,-1),q(` 空状态占位:与 API 调用面板同款(虚线徽章 + 线性图标 + 文案 + 弱提示) `),i.importMeta?(V(),H(`dl`,Cy,[W(`div`,wy,[t[80]||=W(`dt`,null,`导入接口`,-1),W(`dd`,null,[W(`code`,null,M(i.importMeta.interface),1),t[79]||=K(),W(`span`,Ty,`(`+M(i.importMeta.source)+`)`,1)])]),W(`div`,Ey,[t[81]||=W(`dt`,null,`远端基址`,-1),W(`dd`,null,[W(`code`,null,M(i.importMeta.baseUrl),1)])]),W(`div`,Dy,[t[82]||=W(`dt`,null,`cardId`,-1),W(`dd`,null,[W(`code`,null,M(i.importMeta.cardId),1)])]),W(`div`,Oy,[t[84]||=W(`dt`,null,`cardCode`,-1),W(`dd`,null,[W(`code`,null,M(i.importMeta.cardCode),1),W(`button`,{class:`debug__meta-copy`,type:`button`,title:i.copiedCode?`已复制 ✓`:`复制 cardCode`,onClick:t[16]||=(...e)=>a.copyCardCode&&a.copyCardCode(...e)},[i.copiedCode?(V(),H(`span`,Ay,`✓`)):(V(),H(`svg`,jy,[...t[83]||=[W(`use`,{href:`#icon-copy-sm`},null,-1)]]))],8,ky)])]),i.importMeta.cardName?(V(),H(`div`,My,[t[85]||=W(`dt`,null,`卡片标题`,-1),W(`dd`,null,M(i.importMeta.cardName),1)])):q(`v-if`,!0),W(`div`,Ny,[t[87]||=W(`dt`,null,`应用 / 空间`,-1),W(`dd`,null,[W(`code`,null,M(i.importMeta.appId),1),t[86]||=K(` / `,-1),W(`code`,null,M(i.importMeta.workspaceId),1)])]),W(`div`,Py,[t[88]||=W(`dt`,null,`同步时间`,-1),W(`dd`,null,M(a.formatTime(i.importMeta.syncedAt)),1)]),W(`div`,Fy,[t[89]||=W(`dt`,null,`落库位置`,-1),W(`dd`,null,[W(`code`,null,`src/cards/`+M(i.importMeta.cardCode)+`/`,1)])]),W(`div`,Iy,[t[90]||=W(`dt`,null,`本地状态`,-1),W(`dd`,null,[i.importMeta.dirty?(V(),H(`span`,Ly,`已编辑(偏离导入镜像)`)):(V(),H(`span`,Ry,`与导入镜像一致`))])]),i.importMeta.lastExport?(V(),H(`div`,zy,[t[91]||=W(`dt`,null,`最近导出`,-1),W(`dd`,null,[i.importMeta.lastExport.ok?(V(),H(`span`,By,`读回校验通过 ✓`)):(V(),H(`span`,Vy,`读回校验未通过 ✗`)),W(`span`,Hy,`(`+M(a.formatTime(i.importMeta.lastExport.at))+`)`,1),i.importMeta.lastExport.readBackError?(V(),H(`span`,Uy,` · `+M(i.importMeta.lastExport.readBackError),1)):q(`v-if`,!0)])])):q(`v-if`,!0),W(`div`,Wy,[t[97]||=W(`dt`,null,`线上最新版本`,-1),W(`dd`,null,[i.remoteVersionLoading?(V(),H(`span`,Gy,`查询中…`)):i.importMeta.remoteVersion==null?i.remoteVersionError?(V(),H(`span`,Jy,[K(M(i.remoteVersionError)+`(`,1),W(`a`,{class:`debug__link`,onClick:t[18]||=(...e)=>a.refreshRemoteVersion&&a.refreshRemoteVersion(...e)},`重试`),t[93]||=K(`)`,-1)])):(V(),H(`span`,Yy,[t[94]||=K(`未记录(`,-1),W(`a`,{class:`debug__link`,onClick:t[19]||=(...e)=>a.refreshRemoteVersion&&a.refreshRemoteVersion(...e)},`查询`),t[95]||=K(`)`,-1)])):(V(),H(B,{key:1},[W(`code`,Ky,M(i.importMeta.remoteVersion),1),i.importMeta.remoteVersionAt?(V(),H(`span`,qy,`(`+M(a.formatTime(i.importMeta.remoteVersionAt))+` 查询)`,1)):q(`v-if`,!0),W(`button`,{class:`debug__meta-refresh`,type:`button`,title:`刷新线上最新版本`,onClick:t[17]||=(...e)=>a.refreshRemoteVersion&&a.refreshRemoteVersion(...e)},[...t[92]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-refresh`})],-1)]])],64)),q(` 发布版本记录:与刷新按钮同款内联小按钮(图标换列表),点击弹 IDC10004 分页表格 `),W(`button`,{class:`debug__meta-history`,type:`button`,title:`查看发布版本记录`,onClick:t[20]||=e=>i.publishRecordsOpen=!0},[...t[96]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-list`})],-1)]])])])])):(V(),H(`div`,Sy,[...t[78]||=[_s(`<span class="empty-state__badge" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-cloud"></use></svg></span><p class="debug__empty">暂无导入信息</p><p class="empty-state__hint">该卡尚未经「同步远程」导入,无导入来源元数据;本地新建卡 / 未同步卡均如此</p>`,3)]]))])):n.activeTab===`history`?(V(),H(B,{key:3},[q(` 编辑记录:远端版本时间线(git log 式,新→旧)。仅远端已登录时出现该 tab,
200
+ 数据经 GET /__card-history/:cardCode(服务端走 IDC10013)懒加载,换卡清空。 `),W(`div`,Xy,[W(`div`,Zy,[t[100]||=W(`span`,{class:`hist__title`},`远端版本时间线`,-1),i.historyList.length?(V(),H(`span`,Qy,`共 `+M(i.historyTotal)+` 个版本`,1)):q(`v-if`,!0),W(`button`,{class:j([`hist__refresh`,{"is-busy":i.historyLoading}]),type:`button`,disabled:i.historyLoading,title:`刷新历史记录`,onClick:t[21]||=(...e)=>a.reloadCardHistory&&a.reloadCardHistory(...e)},[...t[99]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-refresh`})],-1)]],10,$y)]),q(` 凭据缺失引导(双保险:tab 仅在登录态出现,凭据过期/被清时给出明确指引) `),a.historyNeedLogin?(V(),H(`div`,eb,[...t[101]||=[_s(`<span class="empty-state__badge" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-cloud"></use></svg></span><p class="debug__empty">远端登录凭据缺失</p><p class="empty-state__hint">请先通过顶栏「远端」完成远端登录,再查看远端历史版本</p>`,3)]])):i.historyLoading&&!i.historyList.length?(V(),H(`div`,tb,`正在查询远端历史…`)):i.historyError?(V(),H(`div`,nb,[t[103]||=W(`span`,{class:`empty-state__badge`,"aria-hidden":`true`},[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[W(`use`,{href:`#icon-history`})])],-1),t[104]||=W(`p`,{class:`debug__empty`},`历史记录加载失败`,-1),W(`p`,rb,[K(M(i.historyError)+`(`,1),W(`a`,{class:`debug__link`,onClick:t[22]||=(...e)=>a.reloadCardHistory&&a.reloadCardHistory(...e)},`重试`),t[102]||=K(`)`,-1)])])):i.historyList.length?(V(),H(`div`,ab,[(V(!0),H(B,null,z(a.historyGroups,r=>(V(),H(`div`,{key:r.key,class:`hist__group`},[W(`div`,ob,M(r.label),1),(V(!0),H(B,null,z(r.items,r=>(V(),H(`div`,{key:r.id,class:`hist__item`},[t[107]||=W(`div`,{class:`hist__rail`,"aria-hidden":`true`},[W(`span`,{class:`hist__dot`})],-1),W(`div`,sb,[W(`div`,cb,[W(`span`,lb,M(r.createTime),1),W(`span`,ub,M(a.formatRelTime(r.createTime)),1),W(`code`,db,`#`+M(r.id),1),r.id===a.historyLatestId?(V(),H(`span`,fb,`最新`)):q(`v-if`,!0),q(` 加载此版本:仅把该版本写本地 schema.json 并重载编辑器,不自动推送/保存到远端 `),W(`button`,{class:j([`hist__restore`,{"is-busy":n.historyRestoring}]),type:`button`,disabled:n.historyRestoring,title:`把该版本加载到编辑器(仅加载,不会自动保存到远端)`,onClick:t=>e.$emit(`restore-history`,r)},[...t[106]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-undo`})],-1),K(`加载此版本 `,-1)]],10,pb)]),W(`div`,mb,[r.screenshotPath?(V(),H(`div`,{key:0,class:`hist__thumb`,title:`点击查看大图`,onClick:e=>a.openHistoryPreview(r.screenshotPath)},[W(`img`,{src:r.screenshotPath,alt:`版本预览`,loading:`lazy`,onError:t[23]||=(...e)=>a.onThumbError&&a.onThumbError(...e)},null,40,gb)],8,hb)):(V(),H(`div`,_b,`无预览`)),W(`div`,vb,[W(`div`,yb,[(V(!0),H(B,null,z(r.tags,(e,t)=>(V(),H(`span`,{key:t,class:j([`hist__tag`,a.histTagClass(e)])},M(e),3))),128))]),W(`div`,bb,[K(M(r.summary.componentCount)+` 个组件`,1),r.summary.width?(V(),H(`span`,xb,` · 画布宽 `+M(r.summary.width),1)):q(`v-if`,!0),r.summary.name?(V(),H(`span`,Sb,` · `+M(r.summary.name),1)):q(`v-if`,!0)])])])])]))),128))]))),128)),i.historyList.length<i.historyTotal?(V(),H(`button`,{key:0,class:`hist__more`,type:`button`,disabled:i.historyLoadingMore,onClick:t[24]||=(...e)=>a.loadMoreCardHistory&&a.loadMoreCardHistory(...e)},M(i.historyLoadingMore?`加载中…`:`加载更多(剩余 ${i.historyTotal-i.historyList.length} 条)`),9,Cb)):q(`v-if`,!0)])):(V(),H(`div`,ib,[...t[105]||=[_s(`<span class="empty-state__badge" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-history"></use></svg></span><p class="debug__empty">暂无历史版本</p><p class="empty-state__hint">该卡在远端还没有已保存的版本记录;每次「保存到远端」后会生成新的一条</p>`,3)]]))]),q(` 版本预览大图:点击缩略图弹出,点遮罩或 ✕ 关闭 `),i.historyPreview?(V(),H(`div`,{key:0,class:`hist__preview-mask`,onClick:t[26]||=J(e=>i.historyPreview=``,[`self`])},[W(`img`,{class:`hist__preview-img`,src:i.historyPreview,alt:`版本预览大图`},null,8,wb),W(`button`,{class:`hist__preview-x`,type:`button`,title:`关闭预览`,onClick:t[25]||=e=>i.historyPreview=``},[...t[108]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-x`})],-1)]])])):q(`v-if`,!0)],64)):q(`v-if`,!0)]),q(`
201
201
  节点属性面板:组件结构 tab 双击节点弹出(可编辑写回)。
202
202
  事件编辑已并入本面板的「事件」页签(meta 驱动),不再有独立弹层。
203
203
  `),G(hc,{name:`modal`},{default:I(()=>[i.inspectingComp?(V(),U(s,{key:i.inspectKey,comp:i.inspectingComp,"comp-names":a.compNames,rt:n.rt,onApply:a.onApply,onCommit:a.onCommit,onClose:t[27]||=e=>i.inspectingComp=null},null,8,[`comp`,`comp-names`,`rt`,`onApply`,`onCommit`])):q(`v-if`,!0)]),_:1}),q(`
@@ -240,44 +240,45 @@ Expected function or array of functions, received type ${typeof e}.`),m)}var ol=
240
240
  字符串走多行文本域、数字走带 −/+ 的 NumberStepper、布尔走 SetSegment 分段单选。 `),G(hc,{name:`modal`},{default:I(()=>[i.varDlg?(V(),H(`div`,{key:0,class:`ni-overlay`,onClick:t[60]||=J(e=>i.varDlg=null,[`self`])},[W(`div`,{class:`ni-panel modal-card vars-dlg`,role:`alertdialog`,"aria-modal":`true`,"aria-label":i.varDlg.index==null?`添加变量`:`编辑变量`},[W(`div`,Tx,[W(`span`,Ex,[K(M(i.varDlg.index==null?`添加变量`:`编辑变量`),1),W(`em`,Dx,M(i.varDlg.form.key||`未命名`),1)]),W(`button`,{class:`ni-close`,type:`button`,title:`关闭`,onClick:t[51]||=e=>i.varDlg=null})]),W(`div`,Ox,[W(`div`,kx,[W(`div`,Ax,[t[129]||=W(`label`,{class:`ni-field-label`},[W(`i`,null,`*`),K(`变量名`)],-1),L(W(`input`,{class:`ni-input`,type:`text`,"onUpdate:modelValue":t[52]||=e=>i.varDlg.form.key=e,placeholder:`英文标识,绑定以 $key 引用`},null,512),[[gl,i.varDlg.form.key]])]),W(`div`,jx,[t[130]||=W(`label`,{class:`ni-field-label`},[W(`i`,null,`*`),K(`中文名`)],-1),L(W(`input`,{class:`ni-input`,type:`text`,"onUpdate:modelValue":t[53]||=e=>i.varDlg.form.name=e,placeholder:`中文名`},null,512),[[gl,i.varDlg.form.name]])]),W(`div`,Mx,[t[131]||=W(`label`,{class:`ni-field-label`},[W(`i`,null,`*`),K(`类型`)],-1),q(` 类型下拉:触发器与选项都走「中文名 + 彩色类型标签」,标签直接复用变量列表的
241
241
  .vars__type / .vars__type--<type>(同一套 --type-* 语义色),两处视觉完全一致 `),G(p,{class:`vars-dlg__ctrl`,block:``,size:`sm`,value:i.varDlg.form.type,options:i.varTypeOptions,onChange:a.onVarTypeChange},{current:I(({opt:e,text:t})=>[e?(V(),H(`span`,Nx,[W(`span`,Px,M(e.value),1),W(`span`,{class:j([`vars__type`,`vars__type--`+e.key])},M(e.key),3)])):(V(),H(B,{key:1},[K(M(t),1)],64))]),option:I(({opt:e})=>[W(`span`,Fx,[W(`span`,Ix,M(e.value),1),W(`span`,{class:j([`vars__type`,`vars__type--`+e.key])},M(e.key),3)])]),_:1},8,[`value`,`options`,`onChange`])]),q(` 默认值按类型分四种控件:数组 / 对象 = CodeJar 代码编辑区、字符串 = 多行文本域、
242
242
  数字 = 带 −/+ 的 NumberStepper、布尔 = 复用 SetSegment 的 true / false 分段单选。四者统一以文本承载
243
- (varDlg.form.defaultValue),确定时仍由 parseDefault 按类型解析。 `),W(`div`,Lx,[t[132]||=W(`label`,{class:`ni-field-label`},`默认值`,-1),a.isComplexType(i.varDlg.form.type)?(V(),H(`div`,Rx,null,512)):i.varDlg.form.type===`string`?L((V(),H(`textarea`,{key:1,class:`ni-input vars-dlg__str`,"onUpdate:modelValue":t[54]||=e=>i.varDlg.form.defaultValue=e,placeholder:a.scalarPlaceholder(`string`)},null,8,zx)),[[gl,i.varDlg.form.defaultValue]]):i.varDlg.form.type===`number`?(V(),U(m,{key:2,class:`vars-dlg__ctrl`,value:i.varDlg.form.defaultValue,placeholder:a.scalarPlaceholder(`number`),onInput:t[55]||=e=>i.varDlg.form.defaultValue=e},null,8,[`value`,`placeholder`])):(V(),U(h,{key:3,class:`vars-dlg__ctrl`,value:i.varDlg.form.defaultValue,options:{iParamList:i.varBoolOptions},onInput:t[56]||=e=>i.varDlg.form.defaultValue=e},null,8,[`value`,`options`]))]),W(`div`,Bx,[t[133]||=W(`label`,{class:`ni-field-label`},`描述`,-1),L(W(`textarea`,{class:`ni-input vars-dlg__desc`,"onUpdate:modelValue":t[57]||=e=>i.varDlg.form.desc=e,placeholder:`可选`},null,512),[[gl,i.varDlg.form.desc]])]),i.varDlgError?(V(),H(`p`,Vx,M(i.varDlgError),1)):q(`v-if`,!0)])]),W(`div`,Hx,[t[134]||=W(`span`,{class:`ni-tip`},`默认值入 defaultValue;设计期覆盖见「配置变量 mock」`,-1),W(`div`,Ux,[W(`button`,{class:`ni-btn ni-btn--ghost`,type:`button`,onClick:t[58]||=e=>i.varDlg=null},`取消`),W(`button`,{class:`ni-btn`,type:`button`,onClick:t[59]||=(...e)=>a.confirmVarDlg&&a.confirmVarDlg(...e)},`确定`)])])],8,wx)])):q(`v-if`,!0)]),_:1}),G(g,{visible:i.delVarTarget!=null,title:`删除变量`,message:a.delVarMessage,severity:a.delVarSeverity,"confirm-text":a.delVarConfirmText,onConfirm:a.confirmDeleteVar,onCancel:t[61]||=e=>i.delVarTarget=null},null,8,[`visible`,`message`,`severity`,`confirm-text`,`onConfirm`])])}var Gx=Z(Wv,[[`render`,Wx],[`__file`,`/Users/ynet/dsl-card/card-editor/components/DebugPanel.vue`]]),Kx={name:`ApiCallPanel`,components:{ApiPayloadTree:T_},props:{rt:{type:Object,required:!0}},emits:[`close`],data(){return{filter:``,follow:!0,copiedIndex:null,apiCopyTimer:null}},computed:{apiCalls(){return this.rt.apiRev,this.rt.apiCalls.slice()},filteredCalls(){let e=this.filter.trim().toLowerCase();return e?this.apiCalls.filter(t=>String(t.api).toLowerCase().includes(e)):this.apiCalls}},watch:{"apiCalls.length"(){this.follow&&this.scrollToBottom()}},methods:{clearApiLog(){this.rt.clearApiCalls()},removeCall(e){this.rt.removeApiCall(e)},toggleFollow(){this.follow=!this.follow,this.follow&&this.scrollToBottom()},async copyApiPayload(e){let t=``;try{t=JSON.stringify(e.payload,null,2)}catch{t=String(e.payload)}await yp(t)&&(this.copiedIndex=e.id,this.apiCopyTimer&&clearTimeout(this.apiCopyTimer),this.apiCopyTimer=setTimeout(()=>{this.copiedIndex===e.id&&(this.copiedIndex=null)},1500))},scrollToBottom(){this.$nextTick(()=>{let e=this.$refs.body;e&&(e.scrollTop=e.scrollHeight)})},fmtTime(e){if(!e)return`--:--:--`;let t=new Date(e),n=e=>String(e).padStart(2,`0`);return n(t.getHours())+`:`+n(t.getMinutes())+`:`+n(t.getSeconds())}},beforeUnmount(){this.apiCopyTimer&&clearTimeout(this.apiCopyTimer)}},qx={class:`apipanel`},Jx={class:`apipanel__head`},Yx={class:`apipanel__title`},Xx={key:0,class:`debug__count`},Zx=[`disabled`],Qx={class:`apipanel__body`,ref:`body`},$x={class:`apipanel__tools`},eS={class:`apipanel__filter-wrap`},tS=[`title`],nS={key:0,class:`empty-state`},rS={key:1,class:`debug__list`},iS={class:`debug__api-row`},aS={class:`debug__kind`},oS={class:`apipanel__right`},sS={class:`apipanel__meta`},cS=[`title`,`onClick`],lS={key:0,width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},uS={key:1,class:`debug__copy-ok`},dS=[`onClick`];function fS(e,t,n,r,i,a){let o=R(`ApiPayloadTree`);return V(),H(`aside`,qx,[W(`div`,Jx,[W(`span`,Yx,[t[4]||=K(` API调用 `,-1),a.apiCalls.length?(V(),H(`span`,Xx,M(a.apiCalls.length),1)):q(`v-if`,!0)]),t[7]||=W(`span`,{class:`apipanel__spacer`},null,-1),W(`button`,{class:`apipanel__btn`,type:`button`,disabled:!a.apiCalls.length,title:`清空日志`,onClick:t[0]||=(...e)=>a.clearApiLog&&a.clearApiLog(...e)},[...t[5]||=[W(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[W(`use`,{href:`#icon-trash`})],-1)]],8,Zx),W(`button`,{class:`apipanel__btn`,type:`button`,title:`收起接口调用面板`,onClick:t[1]||=t=>e.$emit(`close`)},[...t[6]||=[W(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[W(`use`,{href:`#icon-x`})],-1)]])]),W(`div`,Qx,[q(` 工具条:方法名过滤(调试大量同类调用时快速收敛)+ 跟随最新开关 `),W(`div`,$x,[W(`div`,eS,[t[8]||=W(`svg`,{class:`apipanel__search-ic`,width:`15`,height:`15`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.4`,"stroke-linecap":`round`},[W(`use`,{href:`#icon-search`})],-1),L(W(`input`,{class:`apipanel__filter`,type:`text`,"onUpdate:modelValue":t[2]||=e=>i.filter=e,placeholder:`过滤方法名…`,spellcheck:`false`},null,512),[[gl,i.filter]])]),W(`button`,{class:j([`apipanel__follow`,{"is-on":i.follow}]),type:`button`,title:i.follow?`跟随最新(点击暂停)`:`已暂停跟随(点击回到最新)`,onClick:t[3]||=(...e)=>a.toggleFollow&&a.toggleFollow(...e)},[...t[9]||=[W(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[W(`use`,{href:`#icon-arrow-down`})],-1)]],10,tS)]),q(` 空状态占位:虚线圆形徽章 + 插头图标(与全局 24 网格线性图标同语言)+ 文案 + 弱提示 `),a.apiCalls.length?(V(),H(`ul`,rS,[(V(!0),H(B,null,z(a.filteredCalls,e=>(V(),H(`li`,{key:e.id,class:`debug__item debug__item--api`},[W(`div`,iS,[W(`span`,aS,M(e.api),1),W(`span`,oS,[W(`span`,sS,`#`+M(e.id)+` · `+M(a.fmtTime(e.t)),1),W(`button`,{class:`apipanel__op`,type:`button`,title:i.copiedIndex===e.id?`已复制 ✓`:`复制返回数据`,onClick:t=>a.copyApiPayload(e)},[i.copiedIndex===e.id?(V(),H(`span`,uS,`✓`)):(V(),H(`svg`,lS,[...t[11]||=[W(`use`,{href:`#icon-copy-sm`},null,-1)]]))],8,cS),W(`button`,{class:`apipanel__op apipanel__op--del`,type:`button`,title:`删除这条调用`,onClick:t=>a.removeCall(e)},[...t[12]||=[W(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[W(`use`,{href:`#icon-trash`})],-1)]],8,dS)])]),q(` 返回数据:结构化折叠树(Chrome 控制台风格) `),G(o,{value:e.payload},null,8,[`value`])]))),128))])):(V(),H(`div`,nS,[...t[10]||=[_s(`<span class="empty-state__badge" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-cup"></use></svg></span><p class="debug__empty">暂无API调用</p><p class="empty-state__hint">卡片事件触发 ynet.callJSAPI / postMessage 后,调用流水会实时显示在这里</p>`,3)]]))],512)])}var pS=Z(Kx,[[`render`,fS],[`__file`,`/Users/ynet/dsl-card/card-editor/components/ApiCallPanel.vue`]]),mS={name:`CardSelect`,emits:[`input`,`change`],props:{value:{type:String,default:``},options:{type:Array,default:()=>[]},disabled:{type:Boolean,default:!1}},data(){return{open:!1,query:``,highlighted:0,sortByTime:this.loadSortByTime()}},created(){this.saveSortByTime()},computed:{current(){return this.options.find(e=>e.id===this.value)||{id:this.value,name:this.value}},filtered(){let e=this.query.trim().toLowerCase(),t=this.options;return e&&(t=this.options.filter(t=>t.id.toLowerCase().includes(e)||String(t.name||``).toLowerCase().includes(e))),this.sortByTime?t.slice().sort((e,t)=>(t.mtime||0)-(e.mtime||0)):t.slice().sort((e,t)=>String(e.name||``).localeCompare(String(t.name||``)))}},watch:{open(e){e?(this.query=``,this.highlighted=Math.max(0,this.filtered.findIndex(e=>e.id===this.value)),this.$nextTick(()=>{this.$refs.search&&this.$refs.search.focus(),this.scrollToActive()}),document.addEventListener(`click`,this.onDocClick,!0)):document.removeEventListener(`click`,this.onDocClick,!0)},sortByTime(e){this.saveSortByTime()},disabled(e){e&&this.close()}},beforeUnmount(){document.removeEventListener(`click`,this.onDocClick,!0)},methods:{toggle(){this.disabled||(this.open=!this.open)},toggleSort(){this.sortByTime=!this.sortByTime,this.highlighted=Math.max(0,this.filtered.findIndex(e=>e.id===this.value))},loadSortByTime(){try{return localStorage.getItem(`cardbuddy:cardselect-sort-by-time`)===`1`}catch{return!1}},saveSortByTime(){try{localStorage.setItem(`cardbuddy:cardselect-sort-by-time`,this.sortByTime?`1`:`0`)}catch{}},close(){this.open=!1},onDocClick(e){this.$refs.root&&!this.$refs.root.contains(e.target)&&this.close()},move(e){if(!this.filtered.length)return;let t=this.filtered.length;this.highlighted=(this.highlighted+e+t)%t,this.$nextTick(this.scrollToActive)},scrollToActive(){let e=this.$refs.list;if(!e)return;let t=e.children[this.highlighted];t&&t.scrollIntoView&&t.scrollIntoView({block:`nearest`})},choose(e){e&&(this.close(),e.id!==this.value&&(this.$emit(`input`,e.id),this.$emit(`change`,e.id)))}}},hS=[`disabled`],gS={class:`csel__current`},_S={class:`csel__id`},vS={class:`csel__name`},yS={key:0,class:`csel__pop`},bS={class:`csel__search`},xS={ref:`list`,class:`csel__list`},SS=[`onMousemove`,`onClick`],CS=[`title`],wS={class:`csel__item-id`},TS={class:`csel__item-name`},ES={key:0,class:`csel__check`,viewBox:`0 0 16 16`,width:`14`,height:`14`,"aria-hidden":`true`},DS={key:0,class:`csel__empty`},OS={class:`csel__foot`},kS=[`title`,`aria-pressed`],AS={class:`csel__count`};function jS(e,t,n,r,i,a){return V(),H(`div`,{ref:`root`,class:j([`csel`,{"csel--open":i.open,"csel--disabled":n.disabled}])},[W(`button`,{type:`button`,class:j([`csel__trigger`,{"csel__trigger--active":i.open}]),disabled:n.disabled,onClick:t[0]||=(...e)=>a.toggle&&a.toggle(...e)},[W(`span`,gS,[W(`span`,_S,M(a.current.id),1),W(`span`,vS,M(a.current.name),1)]),t[7]||=W(`svg`,{class:`csel__chev`,viewBox:`0 0 16 16`,width:`14`,height:`14`,"aria-hidden":`true`},[W(`use`,{href:`#icon-chevron`})],-1)],10,hS),G(hc,{name:`csel-fade`},{default:I(()=>[i.open?(V(),H(`div`,yS,[W(`div`,bS,[t[8]||=W(`svg`,{class:`csel__search-icon`,viewBox:`0 0 16 16`,width:`13`,height:`13`,"aria-hidden":`true`},[W(`use`,{href:`#icon-search`})],-1),L(W(`input`,{ref:`search`,"onUpdate:modelValue":t[1]||=e=>i.query=e,class:`csel__input`,type:`text`,placeholder:`搜索卡片 ID / 名称…`,onKeydown:[t[2]||=jl(J(e=>a.move(1),[`prevent`]),[`down`]),t[3]||=jl(J(e=>a.move(-1),[`prevent`]),[`up`]),t[4]||=jl(J(e=>a.choose(a.filtered[i.highlighted]),[`prevent`]),[`enter`]),t[5]||=jl(J((...e)=>a.close&&a.close(...e),[`prevent`]),[`esc`])]},null,544),[[gl,i.query]])]),W(`ul`,xS,[(V(!0),H(B,null,z(a.filtered,(e,r)=>(V(),H(`li`,{key:e.id,class:j([`csel__item`,{"csel__item--active":r===i.highlighted,"csel__item--selected":e.id===n.value}]),onMousemove:e=>i.highlighted=r,onClick:t=>a.choose(e)},[W(`span`,{class:j([`csel__dot`,{"csel__dot--imported":e.imported}]),title:e.imported?`导入卡片(含 .import-meta.json 来源信息)`:`本地卡片(无导入来源信息)`,"aria-hidden":`true`},null,10,CS),W(`span`,wS,M(e.id),1),W(`span`,TS,M(e.name),1),e.id===n.value?(V(),H(`svg`,ES,[...t[9]||=[W(`use`,{href:`#icon-check`},null,-1)]])):q(`v-if`,!0)],42,SS))),128)),a.filtered.length?q(`v-if`,!0):(V(),H(`li`,DS,`无匹配卡片`))],512),W(`div`,OS,[W(`button`,{class:j([`csel__sort`,{"csel__sort--active":i.sortByTime}]),type:`button`,title:i.sortByTime?`已按修改时间排序(新→旧),点击取消`:`按修改时间排序(新→旧)`,"aria-pressed":i.sortByTime,onClick:t[6]||=(...e)=>a.toggleSort&&a.toggleSort(...e)},`按修改时间排序`,10,kS),W(`span`,AS,M(a.filtered.length)+` / `+M(n.options.length)+` 张卡片`,1)])])):q(`v-if`,!0)]),_:1})],2)}var MS=Z(mS,[[`render`,jS],[`__file`,`/Users/ynet/dsl-card/card-editor/components/CardSelect.vue`]]),NS=Z({name:`AlertCardInstance`,components:{RenderTree:vp},props:{entry:{type:Object,required:!0},mainRt:{type:Object,default:null}},data(){let e=new pu,t=vu(this.entry.scope,e),n=this.mainRt;if(n&&n.pushError&&n.pushApiCall){let e=t.pushError.bind(t);t.pushError=(t,r)=>{e(t,r),n.pushError(t,r)};let r=t.pushApiCall.bind(t);t.pushApiCall=(e,t)=>{r(e,t),n.pushApiCall(e,t)}}return{adapter:e,cardRuntime:t}},provide(){return{adapter:this.adapter,cardRuntime:this.cardRuntime,customComponents:{}}},render(){return Qs(vp,{node:this.entry.preview.view,scope:this.cardRuntime.state,key:this.entry.id})}},[[`__file`,`/Users/ynet/dsl-card/card-editor/components/AlertCardInstance.vue`]]),PS=cn({stack:[]}),FS=0;async function IS(e,t){let n=e||{},r=n.cardCode,i=null;try{let e=await Y(`/__card/${encodeURIComponent(r)}`);if(e.ok){let t=await e.json();t&&t.schema&&(i=t)}}catch{}if(!i||!i.schema){typeof t==`function`&&t({success:!1,error:`card_not_found`,errorMessage:`未找到卡片 `+r});return}let a=PS.stack;a.length&&a.splice(0,a.length).forEach(e=>{if(typeof e.callback==`function`)try{e.callback({success:!0,data:{event:`hidden`}})}catch{}});let o=i.data&&typeof i.data==`object`?i.data:{},s=cn(Object.assign({},o,n.data||{})),c=qu(i.schema),l=`alert-`+ ++FS;a.push({id:l,cardCode:r,preview:c,scope:s,gravity:n.gravity||`bottom`,width:typeof n.width==`number`?n.width:void 0,height:typeof n.height==`number`?n.height:void 0,offsetX:typeof n.offsetX==`number`?n.offsetX:0,offsetY:typeof n.offsetY==`number`?n.offsetY:0,clickOutsideCanHide:n.clickOutsideCanHide!==!1,callback:t})}function LS(e,t){let n=e||{},r=PS.stack,i=null;if(typeof n.index==`number`){let e=Math.abs(n.index);r.length>=e&&(i=r[r.length-e])}else if(n.cardCode){for(let e=r.length-1;e>=0;e--)if(r[e].cardCode===n.cardCode){i=r[e];break}}else i=r[r.length-1];if(!i){typeof t==`function`&&t({success:!1,error:`no_alert`,errorMessage:`没有可关闭的弹窗`});return}let a=r.indexOf(i);if(r.splice(a,1),typeof i.callback==`function`){if(n.data){let e=n.data;try{e=JSON.parse(JSON.stringify(n.data))}catch{}i.callback({success:!0,data:Object.assign({event:`hidden`},e)})}else i.callback({success:!0,data:{}})}typeof t==`function`&&t({success:!0})}function RS(){let e=PS.stack;e.length&&e.splice(0,e.length)}var zS={name:`AlertCardLayer`,components:{AlertCardInstance:NS},props:{mainRt:{type:Object,default:null}},computed:{top(){let e=PS.stack;return e.length?e[e.length-1]:null}},methods:{onMaskClick(e){e.clickOutsideCanHide&&LS({cardCode:e.cardCode})},panelStyle(e){let t={};e.width&&(t.width=e.width+`px`),e.height&&(t.height=e.height+`px`);let n=[];return e.offsetX&&n.push(`translateX(`+e.offsetX+`px)`),e.offsetY&&n.push(`translateY(`+e.offsetY+`px)`),n.length&&(t.transform=n.join(` `)),t}}},BS={key:0,class:`alert-layer`};function VS(e,t,n,r,i,a){let o=R(`AlertCardInstance`);return a.top?(V(),H(`div`,BS,[W(`div`,{class:j([`alert-mask`,`alert-mask--`+a.top.gravity]),onClick:t[0]||=J(e=>a.onMaskClick(a.top),[`self`])},[W(`div`,{class:`alert-panel`,style:A(a.panelStyle(a.top))},[q(` 必须按 entry.id 绑 key:弹窗栈切换(如 inputPasswordDialog → myCardNumberDialog)时
243
+ (varDlg.form.defaultValue),确定时仍由 parseDefault 按类型解析。 `),W(`div`,Lx,[t[132]||=W(`label`,{class:`ni-field-label`},`默认值`,-1),a.isComplexType(i.varDlg.form.type)?(V(),H(`div`,Rx,null,512)):i.varDlg.form.type===`string`?L((V(),H(`textarea`,{key:1,class:`ni-input vars-dlg__str`,"onUpdate:modelValue":t[54]||=e=>i.varDlg.form.defaultValue=e,placeholder:a.scalarPlaceholder(`string`)},null,8,zx)),[[gl,i.varDlg.form.defaultValue]]):i.varDlg.form.type===`number`?(V(),U(m,{key:2,class:`vars-dlg__ctrl`,value:i.varDlg.form.defaultValue,placeholder:a.scalarPlaceholder(`number`),onInput:t[55]||=e=>i.varDlg.form.defaultValue=e},null,8,[`value`,`placeholder`])):(V(),U(h,{key:3,class:`vars-dlg__ctrl`,value:i.varDlg.form.defaultValue,options:{iParamList:i.varBoolOptions},onInput:t[56]||=e=>i.varDlg.form.defaultValue=e},null,8,[`value`,`options`]))]),W(`div`,Bx,[t[133]||=W(`label`,{class:`ni-field-label`},`描述`,-1),L(W(`textarea`,{class:`ni-input vars-dlg__desc`,"onUpdate:modelValue":t[57]||=e=>i.varDlg.form.desc=e,placeholder:`可选`},null,512),[[gl,i.varDlg.form.desc]])]),i.varDlgError?(V(),H(`p`,Vx,M(i.varDlgError),1)):q(`v-if`,!0)])]),W(`div`,Hx,[t[134]||=W(`span`,{class:`ni-tip`},`默认值入 defaultValue;设计期覆盖见「配置变量 mock」`,-1),W(`div`,Ux,[W(`button`,{class:`ni-btn ni-btn--ghost`,type:`button`,onClick:t[58]||=e=>i.varDlg=null},`取消`),W(`button`,{class:`ni-btn`,type:`button`,onClick:t[59]||=(...e)=>a.confirmVarDlg&&a.confirmVarDlg(...e)},`确定`)])])],8,wx)])):q(`v-if`,!0)]),_:1}),G(g,{visible:i.delVarTarget!=null,title:`删除变量`,message:a.delVarMessage,severity:a.delVarSeverity,"confirm-text":a.delVarConfirmText,onConfirm:a.confirmDeleteVar,onCancel:t[61]||=e=>i.delVarTarget=null},null,8,[`visible`,`message`,`severity`,`confirm-text`,`onConfirm`])])}var Gx=Z(Wv,[[`render`,Wx],[`__file`,`/Users/ynet/dsl-card/card-editor/components/DebugPanel.vue`]]),Kx={name:`ApiCallPanel`,components:{ApiPayloadTree:T_},props:{rt:{type:Object,required:!0}},emits:[`close`],data(){return{filter:``,follow:!0,copiedIndex:null,apiCopyTimer:null}},computed:{apiCalls(){return this.rt.apiRev,this.rt.apiCalls.slice()},filteredCalls(){let e=this.filter.trim().toLowerCase();return e?this.apiCalls.filter(t=>String(t.api).toLowerCase().includes(e)):this.apiCalls}},watch:{"apiCalls.length"(){this.follow&&this.scrollToBottom()}},methods:{clearApiLog(){this.rt.clearApiCalls()},removeCall(e){this.rt.removeApiCall(e)},toggleFollow(){this.follow=!this.follow,this.follow&&this.scrollToBottom()},async copyApiPayload(e){let t=``;try{t=JSON.stringify(e.payload,null,2)}catch{t=String(e.payload)}await yp(t)&&(this.copiedIndex=e.id,this.apiCopyTimer&&clearTimeout(this.apiCopyTimer),this.apiCopyTimer=setTimeout(()=>{this.copiedIndex===e.id&&(this.copiedIndex=null)},1500))},scrollToBottom(){this.$nextTick(()=>{let e=this.$refs.body;e&&(e.scrollTop=e.scrollHeight)})},fmtTime(e){if(!e)return`--:--:--`;let t=new Date(e),n=e=>String(e).padStart(2,`0`);return n(t.getHours())+`:`+n(t.getMinutes())+`:`+n(t.getSeconds())}},beforeUnmount(){this.apiCopyTimer&&clearTimeout(this.apiCopyTimer)}},qx={class:`apipanel`},Jx={class:`apipanel__head`},Yx={class:`apipanel__title`},Xx={key:0,class:`debug__count`},Zx=[`disabled`],Qx={class:`apipanel__body`,ref:`body`},$x={class:`apipanel__tools`},eS={class:`apipanel__filter-wrap`},tS=[`title`],nS={key:0,class:`empty-state`},rS={key:1,class:`debug__list`},iS={class:`debug__api-row`},aS={class:`debug__kind`},oS={class:`apipanel__right`},sS={class:`apipanel__meta`},cS=[`title`,`onClick`],lS={key:0,width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},uS={key:1,class:`debug__copy-ok`},dS=[`onClick`];function fS(e,t,n,r,i,a){let o=R(`ApiPayloadTree`);return V(),H(`aside`,qx,[W(`div`,Jx,[W(`span`,Yx,[t[4]||=K(` API调用 `,-1),a.apiCalls.length?(V(),H(`span`,Xx,M(a.apiCalls.length),1)):q(`v-if`,!0)]),t[7]||=W(`span`,{class:`apipanel__spacer`},null,-1),W(`button`,{class:`apipanel__btn`,type:`button`,disabled:!a.apiCalls.length,title:`清空日志`,onClick:t[0]||=(...e)=>a.clearApiLog&&a.clearApiLog(...e)},[...t[5]||=[W(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[W(`use`,{href:`#icon-trash`})],-1)]],8,Zx),W(`button`,{class:`apipanel__btn`,type:`button`,title:`收起接口调用面板`,onClick:t[1]||=t=>e.$emit(`close`)},[...t[6]||=[W(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[W(`use`,{href:`#icon-x`})],-1)]])]),W(`div`,Qx,[q(` 工具条:方法名过滤(调试大量同类调用时快速收敛)+ 跟随最新开关 `),W(`div`,$x,[W(`div`,eS,[t[8]||=W(`svg`,{class:`apipanel__search-ic`,width:`15`,height:`15`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.4`,"stroke-linecap":`round`},[W(`use`,{href:`#icon-search`})],-1),L(W(`input`,{class:`apipanel__filter`,type:`text`,"onUpdate:modelValue":t[2]||=e=>i.filter=e,placeholder:`过滤方法名…`,spellcheck:`false`},null,512),[[gl,i.filter]])]),W(`button`,{class:j([`apipanel__follow`,{"is-on":i.follow}]),type:`button`,title:i.follow?`跟随最新(点击暂停)`:`已暂停跟随(点击回到最新)`,onClick:t[3]||=(...e)=>a.toggleFollow&&a.toggleFollow(...e)},[...t[9]||=[W(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[W(`use`,{href:`#icon-arrow-down`})],-1)]],10,tS)]),q(` 空状态占位:虚线圆形徽章 + 插头图标(与全局 24 网格线性图标同语言)+ 文案 + 弱提示 `),a.apiCalls.length?(V(),H(`ul`,rS,[(V(!0),H(B,null,z(a.filteredCalls,e=>(V(),H(`li`,{key:e.id,class:`debug__item debug__item--api`},[W(`div`,iS,[W(`span`,aS,M(e.api),1),W(`span`,oS,[W(`span`,sS,`#`+M(e.id)+` · `+M(a.fmtTime(e.t)),1),W(`button`,{class:`apipanel__op`,type:`button`,title:i.copiedIndex===e.id?`已复制 ✓`:`复制返回数据`,onClick:t=>a.copyApiPayload(e)},[i.copiedIndex===e.id?(V(),H(`span`,uS,`✓`)):(V(),H(`svg`,lS,[...t[11]||=[W(`use`,{href:`#icon-copy-sm`},null,-1)]]))],8,cS),W(`button`,{class:`apipanel__op apipanel__op--del`,type:`button`,title:`删除这条调用`,onClick:t=>a.removeCall(e)},[...t[12]||=[W(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[W(`use`,{href:`#icon-trash`})],-1)]],8,dS)])]),q(` 返回数据:结构化折叠树(Chrome 控制台风格) `),G(o,{value:e.payload},null,8,[`value`])]))),128))])):(V(),H(`div`,nS,[...t[10]||=[_s(`<span class="empty-state__badge" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-cup"></use></svg></span><p class="debug__empty">暂无API调用</p><p class="empty-state__hint">卡片事件触发 ynet.callJSAPI / postMessage 后,调用流水会实时显示在这里</p>`,3)]]))],512)])}var pS=Z(Kx,[[`render`,fS],[`__file`,`/Users/ynet/dsl-card/card-editor/components/ApiCallPanel.vue`]]),mS={name:`CardSelect`,emits:[`input`,`change`],props:{value:{type:String,default:``},options:{type:Array,default:()=>[]},disabled:{type:Boolean,default:!1}},data(){return{open:!1,query:``,highlighted:0,sortByTime:this.loadSortByTime()}},created(){this.saveSortByTime()},computed:{current(){return this.options.find(e=>e.id===this.value)||{id:this.value,name:this.value}},filtered(){let e=this.query.trim().toLowerCase(),t=this.options;return e&&(t=this.options.filter(t=>t.id.toLowerCase().includes(e)||String(t.name||``).toLowerCase().includes(e))),this.sortByTime?t.slice().sort((e,t)=>(t.mtime||0)-(e.mtime||0)):t.slice().sort((e,t)=>String(e.name||``).localeCompare(String(t.name||``)))}},watch:{open(e){e?(this.query=``,this.highlighted=Math.max(0,this.filtered.findIndex(e=>e.id===this.value)),this.$nextTick(()=>{this.$refs.search&&this.$refs.search.focus(),this.scrollToActive()}),document.addEventListener(`click`,this.onDocClick,!0)):document.removeEventListener(`click`,this.onDocClick,!0)},sortByTime(e){this.saveSortByTime()},disabled(e){e&&this.close()}},beforeUnmount(){document.removeEventListener(`click`,this.onDocClick,!0)},methods:{toggle(){this.disabled||(this.open=!this.open)},toggleSort(){this.sortByTime=!this.sortByTime,this.highlighted=Math.max(0,this.filtered.findIndex(e=>e.id===this.value))},loadSortByTime(){try{return localStorage.getItem(`cardbuddy:cardselect-sort-by-time`)===`1`}catch{return!1}},saveSortByTime(){try{localStorage.setItem(`cardbuddy:cardselect-sort-by-time`,this.sortByTime?`1`:`0`)}catch{}},close(){this.open=!1},onDocClick(e){this.$refs.root&&!this.$refs.root.contains(e.target)&&this.close()},move(e){if(!this.filtered.length)return;let t=this.filtered.length;this.highlighted=(this.highlighted+e+t)%t,this.$nextTick(this.scrollToActive)},scrollToActive(){let e=this.$refs.list;if(!e)return;let t=e.children[this.highlighted];t&&t.scrollIntoView&&t.scrollIntoView({block:`nearest`})},choose(e){e&&(this.close(),e.id!==this.value&&(this.$emit(`input`,e.id),this.$emit(`change`,e.id)))}}},hS=[`disabled`],gS={class:`csel__current`},_S={class:`csel__id`},vS={class:`csel__name`},yS={key:0,class:`csel__pop`},bS={class:`csel__search`},xS={ref:`list`,class:`csel__list`},SS=[`onMousemove`,`onClick`],CS=[`title`],wS={class:`csel__item-id`},TS={class:`csel__item-name`},ES={key:0,class:`csel__check`,viewBox:`0 0 16 16`,width:`14`,height:`14`,"aria-hidden":`true`},DS={key:0,class:`csel__empty`},OS={class:`csel__foot`},kS=[`title`,`aria-pressed`],AS={class:`csel__count`};function jS(e,t,n,r,i,a){return V(),H(`div`,{ref:`root`,class:j([`csel`,{"csel--open":i.open,"csel--disabled":n.disabled}])},[W(`button`,{type:`button`,class:j([`csel__trigger`,{"csel__trigger--active":i.open}]),disabled:n.disabled,onClick:t[0]||=(...e)=>a.toggle&&a.toggle(...e)},[W(`span`,gS,[W(`span`,_S,M(a.current.id),1),W(`span`,vS,M(a.current.name),1)]),t[7]||=W(`svg`,{class:`csel__chev`,viewBox:`0 0 16 16`,width:`14`,height:`14`,"aria-hidden":`true`},[W(`use`,{href:`#icon-chevron`})],-1)],10,hS),G(hc,{name:`csel-fade`},{default:I(()=>[i.open?(V(),H(`div`,yS,[W(`div`,bS,[t[8]||=W(`svg`,{class:`csel__search-icon`,viewBox:`0 0 16 16`,width:`13`,height:`13`,"aria-hidden":`true`},[W(`use`,{href:`#icon-search`})],-1),L(W(`input`,{ref:`search`,"onUpdate:modelValue":t[1]||=e=>i.query=e,class:`csel__input`,type:`text`,placeholder:`搜索卡片 ID / 名称…`,onKeydown:[t[2]||=jl(J(e=>a.move(1),[`prevent`]),[`down`]),t[3]||=jl(J(e=>a.move(-1),[`prevent`]),[`up`]),t[4]||=jl(J(e=>a.choose(a.filtered[i.highlighted]),[`prevent`]),[`enter`]),t[5]||=jl(J((...e)=>a.close&&a.close(...e),[`prevent`]),[`esc`])]},null,544),[[gl,i.query]])]),W(`ul`,xS,[(V(!0),H(B,null,z(a.filtered,(e,r)=>(V(),H(`li`,{key:e.id,class:j([`csel__item`,{"csel__item--active":r===i.highlighted,"csel__item--selected":e.id===n.value}]),onMousemove:e=>i.highlighted=r,onClick:t=>a.choose(e)},[W(`span`,{class:j([`csel__dot`,{"csel__dot--imported":e.imported}]),title:e.imported?`导入卡片(含 .import-meta.json 来源信息)`:`本地卡片(无导入来源信息)`,"aria-hidden":`true`},null,10,CS),W(`span`,wS,M(e.id),1),W(`span`,TS,M(e.name),1),e.id===n.value?(V(),H(`svg`,ES,[...t[9]||=[W(`use`,{href:`#icon-check`},null,-1)]])):q(`v-if`,!0)],42,SS))),128)),a.filtered.length?q(`v-if`,!0):(V(),H(`li`,DS,`无匹配卡片`))],512),W(`div`,OS,[W(`button`,{class:j([`csel__sort`,{"csel__sort--active":i.sortByTime}]),type:`button`,title:i.sortByTime?`已按修改时间排序(新→旧),点击取消`:`按修改时间排序(新→旧)`,"aria-pressed":i.sortByTime,onClick:t[6]||=(...e)=>a.toggleSort&&a.toggleSort(...e)},`按修改时间排序`,10,kS),W(`span`,AS,M(a.filtered.length)+` / `+M(n.options.length)+` 张卡片`,1)])])):q(`v-if`,!0)]),_:1})],2)}var MS=Z(mS,[[`render`,jS],[`__file`,`/Users/ynet/dsl-card/card-editor/components/CardSelect.vue`]]),NS=Z({name:`AlertCardInstance`,components:{RenderTree:vp},props:{entry:{type:Object,required:!0},mainRt:{type:Object,default:null}},data(){let e=new pu,t=vu(this.entry.scope,e),n=this.mainRt;if(n&&n.pushError&&n.pushApiCall){let e=t.pushError.bind(t);t.pushError=(t,r)=>{e(t,r),n.pushError(t,r)};let r=t.pushApiCall.bind(t);t.pushApiCall=(e,t)=>{r(e,t),n.pushApiCall(e,t)}}return{adapter:e,cardRuntime:t}},provide(){return{adapter:this.adapter,cardRuntime:this.cardRuntime,customComponents:{}}},render(){return Qs(vp,{node:this.entry.preview.view,scope:this.cardRuntime.state,key:this.entry.id})}},[[`__file`,`/Users/ynet/dsl-card/card-editor/components/AlertCardInstance.vue`]]),PS=cn({stack:[]}),FS=0;async function IS(e,t){let n=e||{},r=n.cardCode,i=null;try{let e=await Y(`/__card/${encodeURIComponent(r)}`);if(e.ok){let t=await e.json();t&&t.schema&&(i=t)}}catch{}if(!i||!i.schema){typeof t==`function`&&t({success:!1,error:`card_not_found`,errorMessage:`未找到卡片 `+r});return}let a=PS.stack;for(let e=a.length-1;e>=0;e--)if(a[e].cardCode===r){let[t]=a.splice(e,1);if(t&&typeof t.callback==`function`)try{t.callback({success:!0,data:{event:`hidden`}})}catch{}break}let o=i.data&&typeof i.data==`object`?i.data:{},s=cn(Object.assign({},o,n.data||{})),c=qu(i.schema),l=`alert-`+ ++FS;a.push({id:l,cardCode:r,preview:c,scope:s,gravity:n.gravity||`bottom`,width:typeof n.width==`number`?n.width:void 0,height:typeof n.height==`number`?n.height:void 0,offsetX:typeof n.offsetX==`number`?n.offsetX:0,offsetY:typeof n.offsetY==`number`?n.offsetY:0,clickOutsideCanHide:n.clickOutsideCanHide!==!1,callback:t})}function LS(e,t){let n=e||{},r=PS.stack,i=null;if(typeof n.index==`number`){let e=Math.abs(n.index);r.length>=e&&(i=r[r.length-e])}else if(n.cardCode){for(let e=r.length-1;e>=0;e--)if(r[e].cardCode===n.cardCode){i=r[e];break}}else i=r[r.length-1];if(!i){typeof t==`function`&&t({success:!1,error:`no_alert`,errorMessage:`没有可关闭的弹窗`});return}let a=r.indexOf(i);if(r.splice(a,1),typeof i.callback==`function`){if(n.data){let e=n.data;try{e=JSON.parse(JSON.stringify(n.data))}catch{}i.callback({success:!0,data:Object.assign({event:`hidden`},e)})}else i.callback({success:!0,data:{}})}typeof t==`function`&&t({success:!0})}function RS(){let e=PS.stack;e.length&&e.splice(0,e.length)}var zS={name:`AlertCardLayer`,components:{AlertCardInstance:NS},props:{mainRt:{type:Object,default:null}},computed:{stack(){return PS.stack},top(){let e=this.stack;return e.length?e[e.length-1]:null}},methods:{onMaskClick(e){e.clickOutsideCanHide&&LS({cardCode:e.cardCode})},panelStyle(e){let t={};e.width&&(t.width=e.width+`px`),e.height&&(t.height=e.height+`px`);let n=[];return e.offsetX&&n.push(`translateX(`+e.offsetX+`px)`),e.offsetY&&n.push(`translateY(`+e.offsetY+`px)`),n.length&&(t.transform=n.join(` `)),t}}},BS={key:0,class:`alert-layer`},VS=[`onClick`];function HS(e,t,n,r,i,a){let o=R(`AlertCardInstance`);return a.stack.length?(V(),H(`div`,BS,[(V(!0),H(B,null,z(a.stack,e=>L((V(),H(`div`,{key:e.id,class:j([`alert-mask`,`alert-mask--`+e.gravity]),onClick:J(t=>a.onMaskClick(e),[`self`])},[W(`div`,{class:`alert-panel`,style:A(a.panelStyle(e))},[q(` 必须按 entry.id 绑 key:弹窗栈切换(如 inputPasswordDialog → myCardNumberDialog)时
244
244
  Vue 会原地复用无 key 的组件实例,而 AlertCardInstance 的 cardRuntime 是在 data()
245
245
  里按「首个 entry.scope」一次性创建的——复用会导致新弹窗卡沿用旧运行时/旧作用域,
246
246
  表现如 myCardNumberDialog 的 $cardNumber 取不到值、绑定回落兜底文本。绑 key 后
247
- 每张弹窗卡都是全新实例,各自持有独立 cardRuntime(对齐组件头设计意图)。 `),(V(),U(o,{key:a.top.id,entry:a.top,"main-rt":n.mainRt},null,8,[`entry`,`main-rt`]))],4)],2)])):q(`v-if`,!0)}var HS=Z(zS,[[`render`,VS],[`__file`,`/Users/ynet/dsl-card/card-editor/components/AlertCardLayer.vue`]]);function US(){}var WS=Object.assign,GS=typeof window<`u`,KS=e=>typeof e==`object`&&!!e,qS=e=>e!=null,JS=e=>typeof e==`function`,YS=e=>KS(e)&&JS(e.then)&&JS(e.catch),XS=e=>typeof e==`number`||/^\d+(\.\d+)?$/.test(e),ZS=()=>GS?/ios|iphone|ipad|ipod/.test(navigator.userAgent.toLowerCase()):!1;function QS(e,t){let n=t.split(`.`),r=e;return n.forEach(e=>{r=KS(r)?r[e]??``:``}),r}function $S(e,t,n){return t.reduce((t,r)=>((!n||e[r]!==void 0)&&(t[r]=e[r]),t),{})}var eC=(e,t)=>JSON.stringify(e)===JSON.stringify(t),tC=[Number,String],nC={type:Boolean,default:!0},rC=e=>({type:e,required:!0}),iC=()=>({type:Array,default:()=>[]}),aC=e=>({type:Number,default:e}),oC=e=>({type:tC,default:e}),sC=e=>({type:String,default:e}),cC=typeof window<`u`;function lC(e){return cC?requestAnimationFrame(e):-1}function uC(e){cC&&cancelAnimationFrame(e)}function dC(e){lC(()=>lC(e))}var fC=e=>e===window,pC=(e,t)=>({top:0,left:0,right:e,bottom:t,width:e,height:t}),mC=e=>{let t=Cn(e);if(fC(t)){let e=t.innerWidth,n=t.innerHeight;return pC(e,n)}return t?.getBoundingClientRect?t.getBoundingClientRect():pC(0,0)};function hC(e){let t=Yr(e,null);if(t){let e=Os(),{link:n,unlink:r,internalChildren:i}=t;return n(e),Qi(()=>r(e)),{parent:t,index:Zs(()=>i.indexOf(e))}}return{parent:null,index:P(-1)}}function gC(e){let t=[],n=e=>{Array.isArray(e)&&e.forEach(e=>{ss(e)&&(t.push(e),e.component?.subTree&&(t.push(e.component.subTree),n(e.component.subTree.children)),e.children&&n(e.children))})};return n(e),t}var _C=(e,t)=>{let n=e.indexOf(t);return n===-1?e.findIndex(e=>t.key!==void 0&&t.key!==null&&e.type===t.type&&e.key===t.key):n};function vC(e,t,n){let r=gC(e.subTree.children);n.sort((e,t)=>_C(r,e.vnode)-_C(r,t.vnode));let i=n.map(e=>e.proxy);t.sort((e,t)=>i.indexOf(e)-i.indexOf(t))}function yC(e){let t=cn([]),n=cn([]),r=Os();return{children:t,linkChildren:i=>{Jr(e,Object.assign({link:e=>{e.proxy&&(n.push(e),t.push(e.proxy),vC(r,t,n))},unlink:e=>{let r=n.indexOf(e);t.splice(r,1),n.splice(r,1)},children:t,internalChildren:n},i))}}}function bC(e){let t;Ji(()=>{e(),rr(()=>{t=!0})}),Vi(()=>{t&&e()})}function xC(e,t,n={}){if(!cC)return;let{target:r=window,passive:i=!1,capture:a=!1}=n,o=!1,s,c=n=>{if(o)return;let r=Cn(n);r&&!s&&(r.addEventListener(e,t,{capture:a,passive:i}),s=!0)},l=n=>{if(o)return;let r=Cn(n);r&&s&&(r.removeEventListener(e,t,a),s=!1)};Qi(()=>l(r)),Hi(()=>l(r)),bC(()=>c(r));let u;return bn(r)&&(u=$r(r,(e,t)=>{l(t),c(e)})),()=>{u?.(),l(r),o=!0}}function SC(e,t,n={}){if(!cC)return;let{eventName:r=`click`}=n;xC(r,n=>{(Array.isArray(e)?e:[e]).every(e=>{let t=Cn(e);return t&&!t.contains(n.target)})&&t(n)},{target:document})}var CC,wC;function TC(){if(!CC&&(CC=P(0),wC=P(0),cC)){let e=()=>{CC.value=window.innerWidth,wC.value=window.innerHeight};e(),window.addEventListener(`resize`,e,{passive:!0}),window.addEventListener(`orientationchange`,e,{passive:!0})}return{width:CC,height:wC}}var EC=/scroll|auto|overlay/i,DC=cC?window:void 0;function OC(e){return e.tagName!==`HTML`&&e.tagName!==`BODY`&&e.nodeType===1}function kC(e,t=DC){let n=e;for(;n&&n!==t&&OC(n);){let{overflowY:e}=window.getComputedStyle(n);if(EC.test(e))return n;n=n.parentNode}return t}function AC(e,t=DC){let n=P();return Ji(()=>{e.value&&(n.value=kC(e.value,t))}),n}var jC;function MC(){if(!jC&&(jC=P(`visible`),cC)){let e=()=>{jC.value=document.hidden?`hidden`:`visible`};e(),window.addEventListener(`visibilitychange`,e)}return jC}function NC(e){let t=`scrollTop`in e?e.scrollTop:e.pageYOffset;return Math.max(t,0)}function PC(e,t){`scrollTop`in e?e.scrollTop=t:e.scrollTo(e.scrollX,t)}function FC(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0}function IC(e){PC(window,e),PC(document.body,e)}function LC(e,t){if(e===window)return 0;let n=t?NC(t):FC();return mC(e).top+n}ZS();var RC=e=>e.stopPropagation();function zC(e,t){(typeof e.cancelable!=`boolean`||e.cancelable)&&e.preventDefault(),t&&RC(e)}function BC(e){let t=Cn(e);if(!t)return!1;let n=window.getComputedStyle(t),r=n.display===`none`,i=t.offsetParent===null&&n.position!==`fixed`;return r||i}var{width:VC,height:HC}=TC();function UC(e){if(qS(e))return XS(e)?`${e}px`:String(e)}function WC(e){if(qS(e)){if(Array.isArray(e))return{width:UC(e[0]),height:UC(e[1])};let t=UC(e);return{width:t,height:t}}}function GC(e){let t={};return e!==void 0&&(t.zIndex=+e),t}var KC;function qC(){if(!KC){let e=document.documentElement,t=e.style.fontSize||window.getComputedStyle(e).fontSize;KC=parseFloat(t)}return KC}function JC(e){return e=e.replace(/rem/g,``),+e*qC()}function YC(e){return e=e.replace(/vw/g,``),+e*VC.value/100}function XC(e){return e=e.replace(/vh/g,``),+e*HC.value/100}function ZC(e){if(typeof e==`number`)return e;if(GS){if(e.includes(`rem`))return JC(e);if(e.includes(`vw`))return YC(e);if(e.includes(`vh`))return XC(e)}return parseFloat(e)}var QC=/-(\w)/g,$C=e=>e.replace(QC,(e,t)=>t.toUpperCase()),ew=(e,t,n)=>Math.min(Math.max(e,t),n),{hasOwnProperty:tw}=Object.prototype;function nw(e,t,n){let r=t[n];qS(r)&&(e[n]=!tw.call(e,n)||!KS(r)?r:rw(Object(e[n]),r))}function rw(e,t){return Object.keys(t).forEach(n=>{nw(e,t,n)}),e}var iw={name:`姓名`,tel:`电话`,save:`保存`,clear:`清空`,undo:`撤销`,cancel:`取消`,confirm:`确认`,delete:`删除`,loading:`加载中...`,noCoupon:`暂无优惠券`,nameEmpty:`请填写姓名`,addContact:`添加联系人`,telInvalid:`请填写正确的电话`,vanCalendar:{end:`结束`,start:`开始`,title:`日期选择`,weekdays:[`日`,`一`,`二`,`三`,`四`,`五`,`六`],monthTitle:(e,t)=>`${e}\u5E74${t}\u6708`,rangePrompt:e=>`\u6700\u591A\u9009\u62E9 ${e} \u5929`},vanCascader:{select:`请选择`},vanPagination:{prev:`上一页`,next:`下一页`},vanPullRefresh:{pulling:`下拉即可刷新...`,loosing:`释放即可刷新...`},vanSubmitBar:{label:`合计:`},vanCoupon:{unlimited:`无门槛`,discount:e=>`${e}\u6298`,condition:e=>`\u6EE1${e}\u5143\u53EF\u7528`},vanCouponCell:{title:`优惠券`,count:e=>`${e}\u5F20\u53EF\u7528`},vanCouponList:{exchange:`兑换`,close:`不使用`,enable:`可用`,disabled:`不可用`,placeholder:`输入优惠码`},vanAddressEdit:{area:`地区`,areaEmpty:`请选择地区`,addressEmpty:`请填写详细地址`,addressDetail:`详细地址`,defaultAddress:`设为默认收货地址`},vanAddressList:{add:`新增地址`}},aw=P(`zh-CN`),ow=cn({"zh-CN":iw}),sw={messages(){return ow[aw.value]},use(e,t){aw.value=e,this.add({[e]:t})},add(e={}){rw(ow,e)}};function cw(e){let t=$C(e)+`.`;return(e,...n)=>{let r=sw.messages(),i=QS(r,t+e)||QS(r,e);return JS(i)?i(...n):i}}function lw(e,t){return t?typeof t==`string`?` ${e}--${t}`:Array.isArray(t)?t.reduce((t,n)=>t+lw(e,n),``):Object.keys(t).reduce((n,r)=>n+(t[r]?lw(e,r):``),``):``}function uw(e){return(t,n)=>(t&&typeof t!=`string`&&(n=t,t=``),t=t?`${e}__${t}`:e,`${t}${lw(t,n)}`)}function dw(e){let t=`van-${e}`;return[t,uw(t),cw(t)]}var fw=`van-hairline`,pw=`${fw}--top-bottom`,mw=`${fw}-unset--top-bottom`,hw=`van-haptics-feedback`;function gw(e,{args:t=[],done:n,canceled:r,error:i}){if(e){let a=e.apply(null,t);YS(a)?a.then(e=>{e?n():r&&r()}).catch(i||US):a?n():r&&r()}else n()}function _w(e){return e.install=t=>{let{name:n}=e;n&&(t.component(n,e),t.component($C(`-${n}`),e))},e}var vw=Symbol();function yw(e){let t=Yr(vw,null);t&&$r(t,t=>{t&&e()})}function bw(e){let t=Os();t&&WS(t.proxy,e)}var xw={to:[String,Object],url:String,replace:Boolean};function Sw({to:e,url:t,replace:n,$router:r}){e&&r?r[n?`replace`:`push`](e):t&&(n?location.replace(t):location.href=t)}var[Cw,ww]=dw(`badge`),Tw=_w(Mi({name:Cw,props:{dot:Boolean,max:tC,tag:sC(`div`),color:String,offset:Array,content:tC,showZero:nC,position:sC(`top-right`)},setup(e,{slots:t}){let n=()=>{if(t.content)return!0;let{content:n,showZero:r}=e;return qS(n)&&n!==``&&(r||n!==0&&n!==`0`)},r=()=>{let{dot:r,max:i,content:a}=e;if(!r&&n())return t.content?t.content():qS(i)&&XS(a)&&+a>+i?`${i}+`:a},i=e=>e.startsWith(`-`)?e.replace(`-`,``):`-${e}`,a=Zs(()=>{let n={background:e.color};if(e.offset){let[r,a]=e.offset,{position:o}=e,[s,c]=o.split(`-`);t.default?(n[s]=typeof a==`number`?UC(s===`top`?a:-a):s===`top`?UC(a):i(a),n[c]=typeof r==`number`?UC(c===`left`?r:-r):c===`left`?UC(r):i(r)):(n.marginTop=UC(a),n.marginLeft=UC(r))}return n}),o=()=>{if(n()||e.dot)return G(`div`,{class:ww([e.position,{dot:e.dot,fixed:!!t.default}]),style:a.value},[r()])};return()=>{if(t.default){let{tag:n}=e;return G(n,{class:ww(`wrapper`)},{default:()=>[t.default(),o()]})}return o()}}})),Ew=2e3,Dw=()=>++Ew,[Ow,kw]=dw(`config-provider`),Aw=Symbol(Ow),[jw,Mw]=dw(`icon`),Nw=e=>e?.includes(`/`),Pw=_w(Mi({name:jw,props:{dot:Boolean,tag:sC(`i`),name:String,size:tC,badge:tC,color:String,badgeProps:Object,classPrefix:String},setup(e,{slots:t}){let n=Yr(Aw,null),r=Zs(()=>e.classPrefix||n?.iconPrefix||Mw());return()=>{let{tag:n,dot:i,name:a,size:o,badge:s,color:c}=e,l=Nw(a);return G(Tw,xs({dot:i,tag:n,class:[r.value,l?``:`${r.value}-${a}`],style:{color:c,fontSize:UC(o)},content:s},e.badgeProps),{default:()=>[t.default?.call(t),l&&G(`img`,{class:Mw(`image`),src:a},null)]})}}})),[Fw,Iw]=dw(`loading`),Lw=Array(12).fill(null).map((e,t)=>G(`i`,{class:Iw(`line`,String(t+1))},null)),Rw=G(`svg`,{class:Iw(`circular`),viewBox:`25 25 50 50`},[G(`circle`,{cx:`50`,cy:`50`,r:`20`,fill:`none`},null)]),zw=_w(Mi({name:Fw,props:{size:tC,type:sC(`circular`),color:String,vertical:Boolean,textSize:tC,textColor:String},setup(e,{slots:t}){let n=Zs(()=>WS({color:e.color},WC(e.size))),r=()=>{let r=e.type===`spinner`?Lw:Rw;return G(`span`,{class:Iw(`spinner`,e.type),style:n.value},[t.icon?t.icon():r])},i=()=>{if(t.default)return G(`span`,{class:Iw(`text`),style:{fontSize:UC(e.textSize),color:e.textColor??e.color}},[t.default()])};return()=>{let{type:t,vertical:n}=e;return G(`div`,{class:Iw([t,{vertical:n}]),"aria-live":`polite`,"aria-busy":!0},[r(),i()])}}})),Bw={show:Boolean,zIndex:tC,overlay:nC,duration:tC,teleport:[String,Object],lockScroll:nC,lazyRender:nC,beforeClose:Function,overlayProps:Object,overlayStyle:Object,overlayClass:null,transitionAppear:Boolean,closeOnClickOverlay:nC};Object.keys(Bw);function Vw(e,t){return e>t?`horizontal`:t>e?`vertical`:``}function Hw(){let e=P(0),t=P(0),n=P(0),r=P(0),i=P(0),a=P(0),o=P(``),s=P(!0),c=()=>o.value===`vertical`,l=()=>o.value===`horizontal`,u=()=>{n.value=0,r.value=0,i.value=0,a.value=0,o.value=``,s.value=!0};return{move:(c=>{let l=c.touches[0];n.value=(l.clientX<0?0:l.clientX)-e.value,r.value=l.clientY-t.value,i.value=Math.abs(n.value),a.value=Math.abs(r.value),(!o.value||i.value<10&&a.value<10)&&(o.value=Vw(i.value,a.value)),s.value&&(i.value>5||a.value>5)&&(s.value=!1)}),start:(n=>{u(),e.value=n.touches[0].clientX,t.value=n.touches[0].clientY}),reset:u,startX:e,startY:t,deltaX:n,deltaY:r,offsetX:i,offsetY:a,direction:o,isVertical:c,isHorizontal:l,isTap:s}}var Uw=0,Ww=`van-overflow-hidden`;function Gw(e,t){let n=Hw(),r=t=>{n.move(t);let r=n.deltaY.value>0?`10`:`01`,i=kC(t.target,e.value);for(;i.scrollHeight<=i.offsetHeight&&i!==e.value&&i.parentElement;)i=kC(i.parentElement,e.value);let{scrollHeight:a,offsetHeight:o,scrollTop:s}=i,c=`11`;s===0?c=o>=a?`00`:`01`:s+o>=a&&(c=`10`),c!==`11`&&n.isVertical()&&!(parseInt(c,2)&parseInt(r,2))&&zC(t,!0)},i=()=>{document.addEventListener(`touchstart`,n.start),document.addEventListener(`touchmove`,r,{passive:!1}),Uw||document.body.classList.add(Ww),Uw++},a=()=>{Uw&&(document.removeEventListener(`touchstart`,n.start),document.removeEventListener(`touchmove`,r),Uw--,Uw||document.body.classList.remove(Ww))},o=()=>t()&&i(),s=()=>t()&&a();bC(o),Hi(s),Zi(s),$r(t,e=>{e?i():a()})}function Kw(e){let t=P(!1);return $r(e,e=>{e&&(t.value=e)},{immediate:!0}),e=>()=>t.value?e():null}var qw=()=>{let{scopeId:e}=Os()?.vnode||{};return e?{[e]:``}:null},[Jw,Yw]=dw(`overlay`),Xw=_w(Mi({name:Jw,inheritAttrs:!1,props:{show:Boolean,zIndex:tC,duration:tC,className:null,lockScroll:nC,lazyRender:nC,customStyle:Object,teleport:[String,Object]},setup(e,{attrs:t,slots:n}){let r=P(),i=Kw(()=>e.show||!e.lazyRender),a=t=>{e.lockScroll&&zC(t,!0)},o=i(()=>{let i=WS(GC(e.zIndex),e.customStyle);return qS(e.duration)&&(i.animationDuration=`${e.duration}s`),L(G(`div`,xs({ref:r,style:i,class:[Yw(),e.className]},t),[n.default?.call(n)]),[[Nc,e.show]])});return xC(`touchmove`,a,{target:r}),()=>{let t=G(hc,{name:`van-fade`,appear:!0},{default:o});return e.teleport?G(mi,{to:e.teleport},{default:()=>[t]}):t}}})),Zw=WS({},Bw,{round:Boolean,position:sC(`center`),closeIcon:sC(`cross`),closeable:Boolean,transition:String,iconPrefix:String,closeOnPopstate:Boolean,closeIconPosition:sC(`top-right`),destroyOnClose:Boolean,safeAreaInsetTop:Boolean,safeAreaInsetBottom:Boolean}),[Qw,$w]=dw(`popup`),eT=_w(Mi({name:Qw,inheritAttrs:!1,props:Zw,emits:[`open`,`close`,`opened`,`closed`,`keydown`,`update:show`,`clickOverlay`,`clickCloseIcon`],setup(e,{emit:t,attrs:n,slots:r}){let i,a,o=P(),s=P(),c=Kw(()=>e.show||!e.lazyRender),l=Zs(()=>{let t={zIndex:o.value};if(qS(e.duration)){let n=e.position===`center`?`animationDuration`:`transitionDuration`;t[n]=`${e.duration}s`}return t}),u=()=>{i||(i=!0,o.value=e.zIndex===void 0?Dw():+e.zIndex,t(`open`))},d=()=>{i&&gw(e.beforeClose,{done(){i=!1,t(`close`),t(`update:show`,!1)}})},f=n=>{t(`clickOverlay`,n),e.closeOnClickOverlay&&d()},p=()=>{if(e.overlay)return G(Xw,xs(WS({show:e.show,class:e.overlayClass,zIndex:o.value,duration:e.duration,customStyle:e.overlayStyle,role:e.closeOnClickOverlay?`button`:void 0,tabindex:e.closeOnClickOverlay?0:void 0},e.overlayProps),qw(),{onClick:f}),{default:r[`overlay-content`]})},m=e=>{t(`clickCloseIcon`,e),d()},h=()=>{if(e.closeable)return G(Pw,{role:`button`,tabindex:0,name:e.closeIcon,class:[$w(`close-icon`,e.closeIconPosition),hw],classPrefix:e.iconPrefix,onClick:m},null)},g,_=()=>{g&&clearTimeout(g),g=setTimeout(()=>{t(`opened`)})},v=()=>t(`closed`),y=e=>t(`keydown`,e),b=c(()=>{let{destroyOnClose:t,round:i,position:a,safeAreaInsetTop:o,safeAreaInsetBottom:c,show:u}=e;if(u||!t)return L(G(`div`,xs({ref:s,style:l.value,role:`dialog`,tabindex:0,class:[$w({round:i,[a]:a}),{"van-safe-area-top":o,"van-safe-area-bottom":c}],onKeydown:y},n,qw()),[r.default?.call(r),h()]),[[Nc,u]])}),x=()=>{let{position:t,transition:n,transitionAppear:r}=e,i=t===`center`?`van-fade`:`van-popup-slide-${t}`;return G(hc,{name:n||i,appear:r,onAfterEnter:_,onAfterLeave:v},{default:b})};return $r(()=>e.show,e=>{e&&!i&&(u(),n.tabindex===0&&rr(()=>{var e;(e=s.value)==null||e.focus()})),!e&&i&&(i=!1,t(`close`))}),bw({popupRef:s}),Gw(s,()=>e.show&&e.lockScroll),xC(`popstate`,()=>{e.closeOnPopstate&&(d(),a=!1)}),Ji(()=>{e.show&&u()}),Vi(()=>{a&&=(t(`update:show`,!0),!1)}),Hi(()=>{e.show&&e.teleport&&(d(),a=!0)}),Jr(vw,()=>e.show),()=>e.teleport?G(mi,{to:e.teleport},{default:()=>[p(),x()]}):G(B,null,[p(),x()])}})),[tT,nT,rT]=dw(`picker`),iT=e=>e.find(e=>!e.disabled)||e[0];function aT(e,t){let n=e[0];if(n){if(Array.isArray(n))return`multiple`;if(t.children in n)return`cascade`}return`default`}function oT(e,t){t=ew(t,0,e.length);for(let n=t;n<e.length;n++)if(!e[n].disabled)return n;for(let n=t-1;n>=0;n--)if(!e[n].disabled)return n;return 0}var sT=(e,t,n)=>t!==void 0&&e.some(e=>e[n.value]===t);function cT(e,t,n){return e[oT(e,e.findIndex(e=>e[n.value]===t))]}function lT(e,t,n){let r=[],i={[t.children]:e},a=0;for(;i&&i[t.children];){let e=i[t.children],o=n.value[a];if(i=qS(o)?cT(e,o,t):void 0,!i&&e.length){let n=iT(e)[t.value];i=cT(e,n,t)}a++,r.push(e)}return r}function uT(e){let{transform:t}=window.getComputedStyle(e),n=t.slice(7,t.length-1).split(`, `)[5];return Number(n)}function dT(e){return WS({text:`text`,value:`value`,children:`children`},e)}var fT=200,pT=300,mT=15,[hT,gT]=dw(`picker-column`),_T=Symbol(hT),vT=Mi({name:hT,props:{value:tC,fields:rC(Object),options:iC(),readonly:Boolean,allowHtml:Boolean,optionHeight:rC(Number),swipeDuration:rC(tC),visibleOptionNum:rC(tC)},emits:[`change`,`clickOption`,`scrollInto`],setup(e,{emit:t,slots:n}){let r,i,a,o,s,c=P(),l=P(),u=P(0),d=P(0),f=Hw(),p=()=>e.options.length,m=()=>e.optionHeight*(e.visibleOptionNum-1)/2,h=n=>{let i=oT(e.options,n),a=-i*e.optionHeight,o=()=>{i>p()-1&&(i=oT(e.options,n));let r=e.options[i][e.fields.value];r!==e.value&&t(`change`,r)};r&&a!==u.value?s=o:o(),u.value=a},g=()=>e.readonly||!e.options.length,_=n=>{r||g()||(s=null,d.value=fT,h(n),t(`clickOption`,e.options[n]))},v=t=>ew(Math.round(-t/e.optionHeight),0,p()-1),y=Zs(()=>v(u.value)),b=(t,n)=>{let r=Math.abs(t/n);t=u.value+r/.003*(t<0?-1:1);let i=v(t);d.value=+e.swipeDuration,h(i)},x=()=>{r=!1,d.value=0,s&&=(s(),null)},S=e=>{if(!g()){if(f.start(e),r){let e=uT(l.value);u.value=Math.min(0,e-m())}d.value=0,i=u.value,a=Date.now(),o=i,s=null}},C=n=>{if(g())return;f.move(n),f.isVertical()&&(r=!0,zC(n,!0));let s=ew(i+f.deltaY.value,-(p()*e.optionHeight),e.optionHeight),c=v(s);c!==y.value&&t(`scrollInto`,e.options[c]),u.value=s;let l=Date.now();l-a>pT&&(a=l,o=s)},w=()=>{if(g())return;let e=u.value-o,t=Date.now()-a;if(t<pT&&Math.abs(e)>mT){b(e,t);return}let n=v(u.value);d.value=fT,h(n),setTimeout(()=>{r=!1},0)},ee=()=>{let t={height:`${e.optionHeight}px`};return e.options.map((r,i)=>{let a=r[e.fields.text],{disabled:o}=r,s=r[e.fields.value],c={role:`button`,style:t,tabindex:o?-1:0,class:[gT(`item`,{disabled:o,selected:s===e.value}),r.className],onClick:()=>_(i)},l={class:`van-ellipsis`,[e.allowHtml?`innerHTML`:`textContent`]:a};return G(`li`,c,[n.option?n.option(r,i):G(`div`,l,null)])})};return hC(_T),bw({stopMomentum:x}),Qr(()=>{let t=r?Math.floor(-u.value/e.optionHeight):e.options.findIndex(t=>t[e.fields.value]===e.value),n=oT(e.options,t),i=-n*e.optionHeight;r&&n<t&&x(),u.value=i}),xC(`touchmove`,C,{target:c}),()=>G(`div`,{ref:c,class:gT(),onTouchstartPassive:S,onTouchend:w,onTouchcancel:w},[G(`ul`,{ref:l,style:{transform:`translate3d(0, ${u.value+m()}px, 0)`,transitionDuration:`${d.value}ms`,transitionProperty:d.value?`all`:`none`},class:gT(`wrapper`),onTransitionend:x},[ee()])])}}),[yT]=dw(`picker-toolbar`),bT={title:String,cancelButtonText:String,confirmButtonText:String},xT=[`cancel`,`confirm`,`title`,`toolbar`],ST=Object.keys(bT),CT=Mi({name:yT,props:bT,emits:[`confirm`,`cancel`],setup(e,{emit:t,slots:n}){let r=()=>{if(n.title)return n.title();if(e.title)return G(`div`,{class:[nT(`title`),`van-ellipsis`]},[e.title])},i=()=>t(`cancel`),a=()=>t(`confirm`),o=()=>{let t=e.cancelButtonText??rT(`cancel`);if(n.cancel||t)return G(`button`,{type:`button`,class:[nT(`cancel`),hw],onClick:i},[n.cancel?n.cancel():t])},s=()=>{let t=e.confirmButtonText??rT(`confirm`);if(n.confirm||t)return G(`button`,{type:`button`,class:[nT(`confirm`),hw],onClick:a},[n.confirm?n.confirm():t])};return()=>G(`div`,{class:nT(`toolbar`)},[n.toolbar?n.toolbar():[o(),r(),s()]])}});function wT(e,t,n){let r,i=0,a=e.scrollLeft,o=n===0?1:Math.round(n*1e3/16),s=a;function c(){uC(r)}function l(){s+=(t-a)/o,e.scrollLeft=s,++i<o&&(r=lC(l))}return l(),c}function TT(e,t,n,r){let i,a=NC(e),o=a<t,s=n===0?1:Math.round(n*1e3/16),c=(t-a)/s;function l(){uC(i)}function u(){a+=c,(o&&a>t||!o&&a<t)&&(a=t),PC(e,a),o&&a<t||!o&&a>t?i=lC(u):r&&(i=lC(r))}return u(),l}var ET=0;function DT(){let{name:e=`unknown`}=Os()?.type||{};return`${e}-${++ET}`}function OT(){let e=P([]),t=[];return Yi(()=>{e.value=[]}),[e,n=>(t[n]||(t[n]=t=>{e.value[n]=t}),t[n])]}function kT(e,t){if(!GS||!window.IntersectionObserver)return;let n=new IntersectionObserver(e=>{t(e[0].intersectionRatio>0)},{root:document.body}),r=()=>{e.value&&n.observe(e.value)},i=()=>{e.value&&n.unobserve(e.value)};Hi(i),Zi(i),bC(r)}var[AT,jT]=dw(`sticky`),MT=_w(Mi({name:AT,props:{zIndex:tC,position:sC(`top`),container:Object,offsetTop:oC(0),offsetBottom:oC(0)},emits:[`scroll`,`change`],setup(e,{emit:t,slots:n}){let r=P(),i=AC(r),a=cn({fixed:!1,width:0,height:0,transform:0}),o=P(!1),s=Zs(()=>ZC(e.position===`top`?e.offsetTop:e.offsetBottom)),c=Zs(()=>{if(o.value)return;let{fixed:e,height:t,width:n}=a;if(e)return{width:`${n}px`,height:`${t}px`}}),l=Zs(()=>{if(!a.fixed||o.value)return;let t=WS(GC(e.zIndex),{width:`${a.width}px`,height:`${a.height}px`,[e.position]:`${s.value}px`});return a.transform&&(t.transform=`translate3d(0, ${a.transform}px, 0)`),t}),u=e=>t(`scroll`,{scrollTop:e,isFixed:a.fixed}),d=()=>{if(!r.value||BC(r))return;let{container:t,position:n}=e,i=mC(r),o=NC(window);if(a.width=i.width,a.height=i.height,n===`top`){if(t){let e=mC(t),n=e.bottom-s.value-a.height;a.fixed=s.value>i.top&&e.bottom>0,a.transform=n<0?n:0}else a.fixed=s.value>i.top}else{let{clientHeight:e}=document.documentElement;if(t){let n=mC(t),r=e-n.top-s.value-a.height;a.fixed=e-s.value<i.bottom&&e>n.top,a.transform=r<0?-r:0}else a.fixed=e-s.value<i.bottom}u(o)};return $r(()=>a.fixed,e=>t(`change`,e)),xC(`scroll`,d,{target:i,passive:!0}),kT(r,d),$r([VC,HC],()=>{r.value&&!BC(r)&&a.fixed&&(o.value=!0,rr(()=>{let e=mC(r);a.width=e.width,a.height=e.height,o.value=!1}))}),()=>G(`div`,{ref:r,style:c.value},[G(`div`,{class:jT({fixed:a.fixed&&!o.value}),style:l.value},[n.default?.call(n)])])}})),[NT,PT]=dw(`swipe`),FT={loop:nC,width:tC,height:tC,vertical:Boolean,autoplay:oC(0),duration:oC(500),touchable:nC,lazyRender:Boolean,initialSwipe:oC(0),indicatorColor:String,showIndicators:nC,stopPropagation:nC},IT=Symbol(NT),LT=_w(Mi({name:NT,props:FT,emits:[`change`,`dragStart`,`dragEnd`],setup(e,{emit:t,slots:n}){let r=P(),i=P(),a=cn({rect:null,width:0,height:0,offset:0,active:0,swiping:!1}),o=!1,s=Hw(),{children:c,linkChildren:l}=yC(IT),u=Zs(()=>c.length),d=Zs(()=>a[e.vertical?`height`:`width`]),f=Zs(()=>e.vertical?s.deltaY.value:s.deltaX.value),p=Zs(()=>a.rect?(e.vertical?a.rect.height:a.rect.width)-d.value*u.value:0),m=Zs(()=>d.value?Math.ceil(Math.abs(p.value)/d.value):u.value),h=Zs(()=>u.value*d.value),g=Zs(()=>(a.active+u.value)%u.value),_=Zs(()=>{let t=e.vertical?`vertical`:`horizontal`;return s.direction.value===t}),v=Zs(()=>{let t={transitionDuration:`${a.swiping?0:e.duration}ms`,transform:`translate${e.vertical?`Y`:`X`}(${+a.offset.toFixed(2)}px)`};if(d.value){let n=e.vertical?`height`:`width`,r=e.vertical?`width`:`height`;t[n]=`${h.value}px`,t[r]=e[r]?`${e[r]}px`:``}return t}),y=t=>{let{active:n}=a;return t?e.loop?ew(n+t,-1,u.value):ew(n+t,0,m.value):n},b=(t,n=0)=>{let r=t*d.value;e.loop||(r=Math.min(r,-p.value));let i=n-r;return e.loop||(i=ew(i,p.value,0)),i},x=({pace:n=0,offset:r=0,emitChange:i})=>{if(u.value<=1)return;let{active:o}=a,s=y(n),l=b(s,r);if(e.loop){if(c[0]&&l!==p.value){let e=l<p.value;c[0].setOffset(e?h.value:0)}if(c[u.value-1]&&l!==0){let e=l>0;c[u.value-1].setOffset(e?-h.value:0)}}a.active=s,a.offset=l,i&&s!==o&&t(`change`,g.value)},S=()=>{a.swiping=!0,a.active<=-1?x({pace:u.value}):a.active>=u.value&&x({pace:-u.value})},C=()=>{S(),s.reset(),dC(()=>{a.swiping=!1,x({pace:-1,emitChange:!0})})},w=()=>{S(),s.reset(),dC(()=>{a.swiping=!1,x({pace:1,emitChange:!0})})},ee,T=()=>clearTimeout(ee),E=()=>{T(),+e.autoplay>0&&u.value>1&&(ee=setTimeout(()=>{w(),E()},+e.autoplay))},D=(t=+e.initialSwipe)=>{if(!r.value)return;let n=()=>{if(!BC(r)){let t={width:r.value.offsetWidth,height:r.value.offsetHeight};a.rect=t,a.width=+(e.width??t.width),a.height=+(e.height??t.height)}u.value&&(t=Math.min(u.value-1,t),t===-1&&(t=u.value-1)),a.active=t,a.swiping=!0,a.offset=b(t),c.forEach(e=>{e.setOffset(0)}),E()};BC(r)?rr().then(n):n()},O=()=>D(a.active),te,ne=t=>{!e.touchable||t.touches.length>1||(s.start(t),o=!1,te=Date.now(),T(),S())},re=n=>{e.touchable&&a.swiping&&(s.move(n),_.value&&(!e.loop&&(a.active===0&&f.value>0||a.active===u.value-1&&f.value<0)||(zC(n,e.stopPropagation),x({offset:f.value}),o||=(t(`dragStart`,{index:g.value}),!0))))},ie=()=>{if(!e.touchable||!a.swiping)return;let n=Date.now()-te,r=f.value/n;if((Math.abs(r)>.25||Math.abs(f.value)>d.value/2)&&_.value){let t=e.vertical?s.offsetY.value:s.offsetX.value,n=0;n=e.loop?t>0?f.value>0?-1:1:0:-Math[f.value>0?`ceil`:`floor`](f.value/d.value),x({pace:n,emitChange:!0})}else f.value&&x({pace:0});o=!1,a.swiping=!1,t(`dragEnd`,{index:g.value}),E()},ae=(t,n={})=>{S(),s.reset(),dC(()=>{let r;r=e.loop&&t===u.value?a.active===0?0:t:t%u.value,n.immediate?dC(()=>{a.swiping=!1}):a.swiping=!1,x({pace:r-a.active,emitChange:!0})})},oe=(t,n)=>{let r=n===g.value;return G(`i`,{style:r?{backgroundColor:e.indicatorColor}:void 0,class:PT(`indicator`,{active:r})},null)},se=()=>{if(n.indicator)return n.indicator({active:g.value,total:u.value});if(e.showIndicators&&u.value>1)return G(`div`,{class:PT(`indicators`,{vertical:e.vertical})},[Array(u.value).fill(``).map(oe)])};return bw({prev:C,next:w,state:a,resize:O,swipeTo:ae}),l({size:d,props:e,count:u,activeIndicator:g}),$r(()=>e.initialSwipe,e=>D(+e)),$r(u,()=>D(a.active)),$r(()=>e.autoplay,E),$r([VC,HC,()=>e.width,()=>e.height],O),$r(MC(),e=>{e===`visible`?E():T()}),Ji(D),Vi(()=>D(a.active)),yw(()=>D(a.active)),Hi(T),Zi(T),xC(`touchmove`,re,{target:i}),()=>G(`div`,{ref:r,class:PT()},[G(`div`,{ref:i,style:v.value,class:PT(`track`,{vertical:e.vertical}),onTouchstartPassive:ne,onTouchend:ie,onTouchcancel:ie},[n.default?.call(n)]),se()])}})),[RT,zT]=dw(`tabs`),BT=Mi({name:RT,props:{count:rC(Number),inited:Boolean,animated:Boolean,duration:rC(tC),swipeable:Boolean,lazyRender:Boolean,currentIndex:rC(Number)},emits:[`change`],setup(e,{emit:t,slots:n}){let r=P(),i=e=>t(`change`,e),a=()=>{let t=n.default?.call(n);return e.animated||e.swipeable?G(LT,{ref:r,loop:!1,class:zT(`track`),duration:e.duration*1e3,touchable:e.swipeable,lazyRender:e.lazyRender,showIndicators:!1,onChange:i},{default:()=>[t]}):t},o=t=>{let n=r.value;n&&n.state.active!==t&&n.swipeTo(t,{immediate:!e.inited})};return $r(()=>e.currentIndex,o),Ji(()=>{o(e.currentIndex)}),bw({swipeRef:r}),()=>G(`div`,{class:zT(`content`,{animated:e.animated||e.swipeable})},[a()])}}),[VT,HT]=dw(`tabs`),UT={type:sC(`line`),color:String,border:Boolean,sticky:Boolean,shrink:Boolean,active:oC(0),duration:oC(.3),animated:Boolean,ellipsis:nC,swipeable:Boolean,scrollspy:Boolean,offsetTop:oC(0),background:String,lazyRender:nC,showHeader:nC,lineWidth:tC,lineHeight:tC,beforeChange:Function,swipeThreshold:oC(5),titleActiveColor:String,titleInactiveColor:String},WT=Symbol(VT),GT=Mi({name:VT,props:UT,emits:[`change`,`scroll`,`rendered`,`clickTab`,`update:active`],setup(e,{emit:t,slots:n}){let r,i,a,o,s,c=P(),l=P(),u=P(),d=P(),f=DT(),p=AC(c),[m,h]=OT(),{children:g,linkChildren:_}=yC(WT),v=cn({inited:!1,position:``,lineStyle:{},currentIndex:-1}),y=Zs(()=>g.length>+e.swipeThreshold||!e.ellipsis||e.shrink),b=Zs(()=>({borderColor:e.color,background:e.background})),x=(e,t)=>e.name??t,S=Zs(()=>{let e=g[v.currentIndex];if(e)return x(e,v.currentIndex)}),C=Zs(()=>ZC(e.offsetTop)),w=Zs(()=>e.sticky?C.value+r:0),ee=t=>{let n=l.value,r=m.value;if(!y.value||!n||!r||!r[v.currentIndex])return;let i=r[v.currentIndex].$el,a=i.offsetLeft-(n.offsetWidth-i.offsetWidth)/2;o&&o(),o=wT(n,a,t?0:+e.duration)},T=()=>{let t=v.inited;rr(()=>{let n=m.value;if(!n||!n[v.currentIndex]||e.type!==`line`||BC(c.value))return;let r=n[v.currentIndex].$el,{lineWidth:i,lineHeight:a}=e,o=r.offsetLeft+r.offsetWidth/2,s={width:UC(i),backgroundColor:e.color,transform:`translateX(${o}px) translateX(-50%)`};if(t&&(s.transitionDuration=`${e.duration}s`),qS(a)){let e=UC(a);s.height=e,s.borderRadius=e}v.lineStyle=s})},E=e=>{let t=e<v.currentIndex?-1:1;for(;e>=0&&e<g.length;){if(!g[e].disabled)return e;e+=t}},D=(n,r)=>{let i=E(n);if(!qS(i))return;let o=g[i],s=x(o,i),l=v.currentIndex!==null;v.currentIndex!==i&&(v.currentIndex=i,r||ee(),T()),s!==e.active&&(t(`update:active`,s),l&&t(`change`,s,o.title)),a&&!e.scrollspy&&IC(Math.ceil(LC(c.value)-C.value))},O=(e,t)=>{let n=g.findIndex((t,n)=>x(t,n)===e);D(n===-1?0:n,t)},te=(t=!1)=>{if(e.scrollspy){let n=g[v.currentIndex].$el;if(n&&p.value){let r=LC(n,p.value)-w.value;i=!0,s&&s(),s=TT(p.value,r,t?0:+e.duration,()=>{i=!1})}}},ne=(n,r,i)=>{let{title:a,disabled:o}=g[r],s=x(g[r],r);o||(gw(e.beforeChange,{args:[s],done:()=>{D(r),te()}}),Sw(n)),t(`clickTab`,{name:s,title:a,event:i,disabled:o})},re=e=>{a=e.isFixed,t(`scroll`,e)},ie=e=>{rr(()=>{O(e),te(!0)})},ae=()=>{for(let e=0;e<g.length;e++){let{top:t}=mC(g[e].$el);if(t>w.value)return e===0?0:e-1}return g.length-1},oe=()=>{if(e.scrollspy&&!i){let e=ae();D(e)}},se=()=>{if(e.type===`line`&&g.length)return G(`div`,{class:HT(`line`),style:v.lineStyle},null)},ce=()=>{let{type:t,border:r,sticky:i}=e,a=[G(`div`,{ref:i?void 0:u,class:[HT(`wrap`),{[pw]:t===`line`&&r}]},[G(`div`,{ref:l,role:`tablist`,class:HT(`nav`,[t,{shrink:e.shrink,complete:y.value}]),style:b.value,"aria-orientation":`horizontal`},[n[`nav-left`]?.call(n),g.map(e=>e.renderTitle(ne)),se(),n[`nav-right`]?.call(n)])]),n[`nav-bottom`]?.call(n)];return i?G(`div`,{ref:u},[a]):a},le=()=>{T(),rr(()=>{var e;ee(!0),(e=d.value?.swipeRef.value)==null||e.resize()})};return $r(()=>[e.color,e.duration,e.lineWidth,e.lineHeight],T),$r(VC,le),$r(()=>e.active,e=>{e!==S.value&&O(e)}),$r(()=>g.length,()=>{v.inited&&(O(e.active),T(),rr(()=>{ee(!0)}))}),bw({resize:le,scrollTo:ie}),Vi(T),yw(T),bC(()=>{O(e.active,!0),rr(()=>{v.inited=!0,u.value&&(r=mC(u.value).height),ee(!0)})}),kT(c,T),xC(`scroll`,oe,{target:p,passive:!0}),_({id:f,props:e,setLine:T,scrollable:y,onRendered:(e,n)=>t(`rendered`,e,n),currentName:S,setTitleRefs:h,scrollIntoView:ee}),()=>G(`div`,{ref:c,class:HT([e.type])},[e.showHeader?e.sticky?G(MT,{container:c.value,offsetTop:C.value,onScroll:re},{default:()=>[ce()]}):ce():null,G(BT,{ref:d,count:g.length,inited:v.inited,animated:e.animated,duration:e.duration,swipeable:e.swipeable,lazyRender:e.lazyRender,currentIndex:v.currentIndex,onChange:D},{default:()=>[n.default?.call(n)]})])}}),KT=Symbol(),qT=Symbol(),JT=()=>Yr(qT,null),YT=e=>{let t=JT();Jr(KT,e),Jr(qT,Zs(()=>(t==null||t.value)&&e.value))},[XT,ZT]=dw(`tab`),QT=Mi({name:XT,props:{id:String,dot:Boolean,type:String,color:String,title:String,badge:tC,shrink:Boolean,isActive:Boolean,disabled:Boolean,controls:String,scrollable:Boolean,activeColor:String,inactiveColor:String,showZeroBadge:nC},setup(e,{slots:t}){let n=Zs(()=>{let t={},{type:n,color:r,disabled:i,isActive:a,activeColor:o,inactiveColor:s}=e;r&&n===`card`&&(t.borderColor=r,i||(a?t.backgroundColor=r:t.color=r));let c=a?o:s;return c&&(t.color=c),t}),r=()=>{let n=G(`span`,{class:ZT(`text`,{ellipsis:!e.scrollable})},[t.title?t.title():e.title]);return e.dot||qS(e.badge)&&e.badge!==``?G(Tw,{dot:e.dot,content:e.badge,showZero:e.showZeroBadge},{default:()=>[n]}):n};return()=>G(`div`,{id:e.id,role:`tab`,class:[ZT([e.type,{grow:e.scrollable&&!e.shrink,shrink:e.shrink,active:e.isActive,disabled:e.disabled}])],style:n.value,tabindex:e.disabled?void 0:e.isActive?0:-1,"aria-selected":e.isActive,"aria-disabled":e.disabled||void 0,"aria-controls":e.controls,"data-allow-mismatch":`attribute`},[r()])}}),[$T,eE]=dw(`swipe-item`),tE=_w(Mi({name:$T,setup(e,{slots:t}){let n,r=cn({offset:0,inited:!1,mounted:!1}),{parent:i,index:a}=hC(IT);if(!i){console.error(`[Vant] <SwipeItem> must be a child component of <Swipe>.`);return}let o=Zs(()=>{let e={},{vertical:t}=i.props;return i.size.value&&(e[t?`height`:`width`]=`${i.size.value}px`),r.offset&&(e.transform=`translate${t?`Y`:`X`}(${r.offset}px)`),e}),s=Zs(()=>{let{loop:e,lazyRender:t}=i.props;if(!t||n)return!0;if(!r.mounted)return!1;let o=i.activeIndicator.value,s=i.count.value-1,c=o===0&&e?s:o-1,l=o===s&&e?0:o+1;return n=a.value===o||a.value===c||a.value===l,n});return Ji(()=>{rr(()=>{r.mounted=!0})}),bw({setOffset:e=>{r.offset=e}}),()=>G(`div`,{class:eE(),style:o.value},[s.value?t.default?.call(t):null])}})),[nE,rE]=dw(`tab`);_w(Mi({name:nE,props:WS({},xw,{dot:Boolean,name:tC,badge:tC,title:String,disabled:Boolean,titleClass:null,titleStyle:[String,Object],showZeroBadge:nC}),setup(e,{slots:t}){let n=DT(),r=P(!1),i=Os(),{parent:a,index:o}=hC(WT);if(!a){console.error(`[Vant] <Tab> must be a child component of <Tabs>.`);return}let s=()=>e.name??o.value,c=()=>{r.value=!0,a.props.lazyRender&&rr(()=>{a.onRendered(s(),e.title)})},l=Zs(()=>{let e=s()===a.currentName.value;return e&&!r.value&&c(),e}),u=P(``),d=P(``);Qr(()=>{let{titleClass:t,titleStyle:n}=e;u.value=t?j(t):``,d.value=n&&typeof n!=`string`?Ee(A(n)):n});let f=r=>G(QT,xs({key:n,id:`${a.id}-${o.value}`,ref:a.setTitleRefs(o.value),style:d.value,class:u.value,isActive:l.value,controls:n,scrollable:a.scrollable.value,activeColor:a.props.titleActiveColor,inactiveColor:a.props.titleInactiveColor,onClick:e=>r(i.proxy,o.value,e)},$S(a.props,[`type`,`color`,`shrink`]),$S(e,[`dot`,`badge`,`title`,`disabled`,`showZeroBadge`])),{title:t.title}),p=P(!l.value);return $r(l,e=>{e?p.value=!1:dC(()=>{p.value=!0})}),$r(()=>e.title,()=>{a.setLine(),a.scrollIntoView()}),YT(l),bw({id:n,renderTitle:f}),()=>{let e=`${a.id}-${o.value}`,{animated:i,swipeable:s,scrollspy:c,lazyRender:u}=a.props;if(!t.default&&!i)return;let d=c||l.value;if(i||s)return G(tE,{id:n,role:`tabpanel`,class:rE(`panel-wrapper`,{inactive:p.value}),tabindex:l.value?0:-1,"aria-hidden":!l.value,"aria-labelledby":e,"data-allow-mismatch":`attribute`},{default:()=>[G(`div`,{class:rE(`panel`)},[t.default?.call(t)])]});let f=r.value||c||!u?t.default?.call(t):null;return L(G(`div`,{id:n,role:`tabpanel`,class:rE(`panel`),tabindex:d?0:-1,"aria-labelledby":e,"data-allow-mismatch":`attribute`},[f]),[[Nc,d]])}}})),_w(GT);var[iE,aE]=dw(`picker-group`),oE=Symbol(iE);WS({tabs:iC(),activeTab:oC(0),nextStepText:String,showToolbar:nC},bT);var sE=_w(Mi({name:tT,props:WS({},WS({loading:Boolean,readonly:Boolean,allowHtml:Boolean,optionHeight:oC(44),showToolbar:nC,swipeDuration:oC(1e3),visibleOptionNum:oC(6)},bT),{columns:iC(),modelValue:iC(),toolbarPosition:sC(`top`),columnsFieldNames:Object}),emits:[`confirm`,`cancel`,`change`,`scrollInto`,`clickOption`,`update:modelValue`],setup(e,{emit:t,slots:n}){let r=P(),i=P(e.modelValue.slice(0)),{parent:a}=hC(oE),{children:o,linkChildren:s}=yC(_T);s();let c=Zs(()=>dT(e.columnsFieldNames)),l=Zs(()=>ZC(e.optionHeight)),u=Zs(()=>aT(e.columns,c.value)),d=Zs(()=>{let{columns:t}=e;switch(u.value){case`multiple`:return t;case`cascade`:return lT(t,c.value,i);default:return[t]}}),f=Zs(()=>d.value.some(e=>e.length)),p=Zs(()=>d.value.map((e,t)=>cT(e,i.value[t],c.value))),m=Zs(()=>d.value.map((e,t)=>e.findIndex(e=>e[c.value.value]===i.value[t]))),h=(e,t)=>{if(i.value[e]!==t){let n=i.value.slice(0);n[e]=t,i.value=n}},g=()=>({selectedValues:i.value.slice(0),selectedOptions:p.value,selectedIndexes:m.value}),_=(e,n)=>{h(n,e),u.value===`cascade`&&i.value.forEach((e,t)=>{let n=d.value[t];sT(n,e,c.value)||h(t,n.length?n[0][c.value.value]:void 0)}),rr(()=>{t(`change`,WS({columnIndex:n},g()))})},v=(e,n)=>{let r={columnIndex:n,currentOption:e};t(`clickOption`,WS(g(),r)),t(`scrollInto`,r)},y=()=>{o.forEach(e=>e.stopMomentum());let e=g();return rr(()=>{t(`confirm`,g())}),e},b=()=>t(`cancel`,g()),x=()=>d.value.map((r,a)=>G(vT,{value:i.value[a],fields:c.value,options:r,readonly:e.readonly,allowHtml:e.allowHtml,optionHeight:l.value,swipeDuration:e.swipeDuration,visibleOptionNum:e.visibleOptionNum,onChange:e=>_(e,a),onClickOption:e=>v(e,a),onScrollInto:e=>{t(`scrollInto`,{currentOption:e,columnIndex:a})}},{option:n.option})),S=e=>{if(f.value){let t={height:`${l.value}px`},n={backgroundSize:`100% ${(e-l.value)/2}px`};return[G(`div`,{class:nT(`mask`),style:n},null),G(`div`,{class:[mw,nT(`frame`)],style:t},null)]}},C=()=>{let t=l.value*+e.visibleOptionNum,i={height:`${t}px`};return!e.loading&&!f.value&&n.empty?n.empty():G(`div`,{ref:r,class:nT(`columns`),style:i},[x(),S(t)])},w=()=>{if(e.showToolbar&&!a)return G(CT,xs($S(e,ST),{onConfirm:y,onCancel:b}),$S(n,xT))},ee=e=>{e.forEach((e,t)=>{e.length&&!sT(e,i.value[t],c.value)&&h(t,iT(e)[c.value.value])})};$r(d,e=>ee(e),{immediate:!0});let T;return $r(()=>e.modelValue,t=>{!eC(t,i.value)&&!eC(t,T)&&(i.value=t.slice(0),T=t.slice(0)),e.modelValue.length===0&&ee(d.value)},{deep:!0}),$r(i,n=>{eC(n,e.modelValue)||(T=n.slice(0),t(`update:modelValue`,T))},{immediate:!0}),xC(`touchmove`,zC,{target:r}),bw({confirm:y,getSelectedOptions:()=>p.value}),()=>G(`div`,{class:nT()},[e.toolbarPosition===`top`?w():null,e.loading?G(zw,{class:nT(`loading`)},null):null,n[`columns-top`]?.call(n),C(),n[`columns-bottom`]?.call(n),e.toolbarPosition===`bottom`?w():null])}})),cE=0;function lE(e){e?(cE||document.body.classList.add(`van-toast--unclickable`),cE++):cE&&(cE--,cE||document.body.classList.remove(`van-toast--unclickable`))}var[uE,dE]=dw(`toast`),fE=[`show`,`overlay`,`teleport`,`transition`,`overlayClass`,`overlayStyle`,`closeOnClickOverlay`,`zIndex`],pE=Mi({name:uE,props:{icon:String,show:Boolean,type:sC(`text`),overlay:Boolean,message:tC,iconSize:tC,duration:aC(2e3),position:sC(`middle`),teleport:[String,Object],wordBreak:String,className:null,iconPrefix:String,transition:sC(`van-fade`),loadingType:String,forbidClick:Boolean,overlayClass:null,overlayStyle:Object,closeOnClick:Boolean,closeOnClickOverlay:Boolean,zIndex:tC},emits:[`update:show`],setup(e,{emit:t,slots:n}){let r,i=!1,a=()=>{let t=e.show&&e.forbidClick;i!==t&&(i=t,lE(i))},o=e=>t(`update:show`,e),s=()=>{e.closeOnClick&&o(!1)},c=()=>clearTimeout(r),l=()=>{let{icon:t,type:n,iconSize:r,iconPrefix:i,loadingType:a}=e;if(t||n===`success`||n===`fail`)return G(Pw,{name:t||n,size:r,class:dE(`icon`),classPrefix:i},null);if(n===`loading`)return G(zw,{class:dE(`loading`),size:r,type:a},null)},u=()=>{let{type:t,message:r}=e;if(n.message)return G(`div`,{class:dE(`text`)},[n.message()]);if(qS(r)&&r!==``)return t===`html`?G(`div`,{key:0,class:dE(`text`),innerHTML:String(r)},null):G(`div`,{class:dE(`text`)},[r])};return $r(()=>[e.show,e.forbidClick],a),$r(()=>[e.show,e.type,e.message,e.duration],()=>{c(),e.show&&e.duration>0&&(r=setTimeout(()=>{o(!1)},e.duration))}),Ji(a),Qi(a),()=>G(eT,xs({class:[dE([e.position,e.wordBreak===`normal`?`break-normal`:e.wordBreak,{[e.type]:!e.icon}]),e.className],lockScroll:!1,onClick:s,onClosed:c,"onUpdate:show":o},$S(e,fE)),{default:()=>[l(),u()]})}});function mE(){let e=cn({show:!1}),t=t=>{e.show=t},n=n=>{WS(e,n,{transitionAppear:!0}),t(!0)},r=()=>t(!1);return bw({open:n,close:r,toggle:t}),{open:n,close:r,state:e,toggle:t}}function hE(e){let t=Fl(e),n=document.createElement(`div`);return document.body.appendChild(n),{instance:t.mount(n),unmount(){t.unmount(),document.body.removeChild(n)}}}var gE={icon:``,type:`text`,message:``,className:``,overlay:!1,onClose:void 0,onOpened:void 0,duration:2e3,teleport:`body`,iconSize:void 0,iconPrefix:void 0,position:`middle`,transition:`van-fade`,forbidClick:!1,loadingType:void 0,overlayClass:``,overlayStyle:void 0,closeOnClick:!1,closeOnClickOverlay:!1},_E=[],vE=WS({},gE),yE=new Map;function bE(e){return KS(e)?e:{message:e}}function xE(){let{instance:e,unmount:t}=hE({setup(){let e=P(``),{open:t,state:n,close:r,toggle:i}=mE(),a=()=>{},o=()=>G(pE,xs(n,{onClosed:a,"onUpdate:show":i}),null);return $r(e,e=>{n.message=e}),Os().render=o,{open:t,close:r,message:e}}});return e}function SE(){if(!_E.length){let e=xE();_E.push(e)}return _E[_E.length-1]}function CE(e={}){if(!GS)return{};let t=SE(),n=bE(e);return t.open(WS({},vE,yE.get(n.type||vE.type),n)),t}var wE=e=>{_E.length&&(e?(_E.forEach(e=>{e.close()}),_E=[]):_E[0].close())},[TE,EE]=dw(`key`),DE=G(`svg`,{class:EE(`collapse-icon`),viewBox:`0 0 30 24`},[G(`path`,{d:`M26 13h-2v2h2v-2zm-8-3h2V8h-2v2zm2-4h2V4h-2v2zm2 4h4V4h-2v4h-2v2zm-7 14 3-3h-6l3 3zM6 13H4v2h2v-2zm16 0H8v2h14v-2zm-12-3h2V8h-2v2zM28 0l1 1 1 1v15l-1 2H1l-1-2V2l1-1 1-1zm0 2H2v15h26V2zM6 4v2H4V4zm10 2h2V4h-2v2zM8 9v1H4V8zm8 0v1h-2V8zm-6-5v2H8V4zm4 0v2h-2V4z`,fill:`currentColor`},null)]),OE=G(`svg`,{class:EE(`delete-icon`),viewBox:`0 0 32 22`},[G(`path`,{d:`M28 0a4 4 0 0 1 4 4v14a4 4 0 0 1-4 4H10.4a2 2 0 0 1-1.4-.6L1 13.1c-.6-.5-.9-1.3-.9-2 0-1 .3-1.7.9-2.2L9 .6a2 2 0 0 1 1.4-.6zm0 2H10.4l-8.2 8.3a1 1 0 0 0-.3.7c0 .3.1.5.3.7l8.2 8.4H28a2 2 0 0 0 2-2V4c0-1.1-.9-2-2-2zm-5 4a1 1 0 0 1 .7.3 1 1 0 0 1 0 1.4L20.4 11l3.3 3.3c.2.2.3.5.3.7 0 .3-.1.5-.3.7a1 1 0 0 1-.7.3 1 1 0 0 1-.7-.3L19 12.4l-3.4 3.3a1 1 0 0 1-.6.3 1 1 0 0 1-.7-.3 1 1 0 0 1-.3-.7c0-.2.1-.5.3-.7l3.3-3.3-3.3-3.3A1 1 0 0 1 14 7c0-.3.1-.5.3-.7A1 1 0 0 1 15 6a1 1 0 0 1 .6.3L19 9.6l3.3-3.3A1 1 0 0 1 23 6z`,fill:`currentColor`},null)]),kE=Mi({name:TE,props:{type:String,text:tC,color:String,wider:Boolean,large:Boolean,loading:Boolean},emits:[`press`],setup(e,{emit:t,slots:n}){let r=P(!1),i=Hw(),a=e=>{i.start(e),r.value=!0},o=e=>{i.move(e),i.direction.value&&(r.value=!1)},s=i=>{r.value&&(n.default||zC(i),r.value=!1,t(`press`,e.text,e.type))},c=()=>{if(e.loading)return G(zw,{class:EE(`loading-icon`)},null);let t=n.default?n.default():e.text;switch(e.type){case`delete`:return t||OE;case`extra`:return t||DE;default:return t}};return()=>G(`div`,{class:EE(`wrapper`,{wider:e.wider}),onTouchstartPassive:a,onTouchmovePassive:o,onTouchend:s,onTouchcancel:s},[G(`div`,{role:`button`,tabindex:0,class:EE([e.color,{large:e.large,active:r.value,delete:e.type===`delete`}])},[c()])])}}),[AE,jE]=dw(`number-keyboard`),ME={show:Boolean,title:String,theme:sC(`default`),zIndex:tC,teleport:[String,Object],maxlength:oC(1/0),modelValue:sC(``),transition:nC,blurOnClose:nC,showDeleteKey:nC,randomKeyOrder:Boolean,closeButtonText:String,deleteButtonText:String,closeButtonLoading:Boolean,hideOnClickOutside:nC,safeAreaInsetBottom:nC,extraKey:{type:[String,Array],default:``}};function NE(e){for(let t=e.length-1;t>0;t--){let n=Math.floor(Math.random()*(t+1)),r=e[t];e[t]=e[n],e[n]=r}return e}var PE=_w(Mi({name:AE,inheritAttrs:!1,props:ME,emits:[`show`,`hide`,`blur`,`input`,`close`,`delete`,`update:modelValue`],setup(e,{emit:t,slots:n,attrs:r}){let i=P(),a=()=>{let t=Array(9).fill(``).map((e,t)=>({text:t+1}));return e.randomKeyOrder&&NE(t),t},o=()=>[...a(),{text:e.extraKey,type:`extra`},{text:0},{text:e.showDeleteKey?e.deleteButtonText:``,type:e.showDeleteKey?`delete`:``}],s=()=>{let t=a(),{extraKey:n}=e,r=Array.isArray(n)?n:[n];return r.length===0?t.push({text:0,wider:!0}):r.length===1?t.push({text:0,wider:!0},{text:r[0],type:`extra`}):r.length===2&&t.push({text:r[0],type:`extra`},{text:0},{text:r[1],type:`extra`}),t},c=Zs(()=>e.theme===`custom`?s():o()),l=()=>{e.show&&t(`blur`)},u=()=>{t(`close`),e.blurOnClose&&l()},d=()=>t(e.show?`show`:`hide`),f=(n,r)=>{if(n===``){r===`extra`&&l();return}let i=e.modelValue;r===`delete`?(t(`delete`),t(`update:modelValue`,i.slice(0,i.length-1))):r===`close`?u():i.length<+e.maxlength&&(t(`input`,n),t(`update:modelValue`,i+n))},p=()=>{let{title:t,theme:r,closeButtonText:i}=e,a=n[`title-left`],o=i&&r==="default";if(t||o||a)return G(`div`,{class:jE(`header`)},[a&&G(`span`,{class:jE(`title-left`)},[a()]),t&&G(`h2`,{class:jE(`title`)},[t]),o&&G(`button`,{type:`button`,class:[jE(`close`),`van-haptics-feedback`],onClick:u},[i])])},m=()=>c.value.map(e=>{let t={};return e.type===`delete`&&(t.default=n.delete),e.type===`extra`&&(t.default=n[`extra-key`]),G(kE,{key:e.text,text:e.text,type:e.type,wider:e.wider,color:e.color,onPress:f},t)}),h=()=>{if(e.theme===`custom`)return G(`div`,{class:jE(`sidebar`)},[e.showDeleteKey&&G(kE,{large:!0,text:e.deleteButtonText,type:`delete`,onPress:f},{default:n.delete}),G(kE,{large:!0,text:e.closeButtonText,type:`close`,color:`blue`,loading:e.closeButtonLoading,onPress:f},null)])};return $r(()=>e.show,n=>{e.transition||t(n?`show`:`hide`)}),e.hideOnClickOutside&&SC(i,l,{eventName:`touchstart`}),()=>{let t=p(),n=G(hc,{name:e.transition?`van-slide-up`:``},{default:()=>[L(G(`div`,xs({ref:i,style:GC(e.zIndex),class:jE({unfit:!e.safeAreaInsetBottom,"with-title":!!t}),onAnimationend:d,onTouchstartPassive:RC},r),[t,G(`div`,{class:jE(`body`)},[G(`div`,{class:jE(`keys`)},[m()]),h()])]),[[Nc,e.show]])]});return e.teleport?G(mi,{to:e.teleport},{default:()=>[n]}):n}}})),FE=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21],IE=Array(64);for(let e=0;e<64;e++)IE[e]=Math.floor(Math.abs(Math.sin(e+1))*4294967296);var LE=(e,t,n)=>e&t|~e&n,RE=(e,t,n)=>e&n|t&~n,zE=(e,t,n)=>e^t^n,BE=(e,t,n)=>t^(e|~n);function VE(e){let t=``;for(let n=0;n<32;n+=8)t+=(e>>>n&255).toString(16).padStart(2,`0`);return t}function HE(e){let t=new TextEncoder().encode(String(e)),n=t.length,r=Math.ceil((n+9)/64)*16,i=new Uint32Array(r);for(let e=0;e<n;e++)i[e>>2]|=t[e]<<e%4*8;i[n>>2]|=128<<n%4*8;let a=n*8;i[r-2]=a>>>0,i[r-1]=Math.floor(a/4294967296);let o=1732584193,s=4023233417,c=2562383102,l=271733878;for(let e=0;e<r;e+=16){let t=o,n=s,r=c,a=l;for(let o=0;o<64;o++){let s,c;o<16?(s=LE(n,r,a),c=o):o<32?(s=RE(n,r,a),c=(5*o+1)%16):o<48?(s=zE(n,r,a),c=(3*o+5)%16):(s=BE(n,r,a),c=7*o%16);let l=a;a=r,r=n;let u=t+s+IE[o]+i[e+c]>>>0,d=FE[(o>>4)*4+o%4];n=((u<<d|u>>>32-d)>>>0)+n>>>0,t=l}o=o+t>>>0,s=s+n>>>0,c=c+r>>>0,l=l+a>>>0}return VE(o)+VE(s)+VE(c)+VE(l)}var UE=cn({dialog:null,picker:null,datePicker:null,keyboard:null,loadingEx:null}),WE=[],GE=0,KE=null,qE=[],JE=0,YE=[],XE=0,ZE=2200;function QE(e,t){if(typeof e==`function`)try{e(t)}catch{}}function $E(){UE.dialog=WE.length?WE.shift():null}function eD(e,t){let n=e||{};WE.push({id:++GE,title:n.title||``,message:n.message==null?``:String(n.message),okButton:n.okButton||`确定`,cancelButton:n.cancelButton||``,clickBgToHide:n.clickBgToHide===!0,cancelGrayStyle:n.cancelGrayStyle===!0,callback:t}),UE.dialog||$E()}function tD(e){let t=UE.dialog;t&&(UE.dialog=null,QE(t.callback,{success:!0,data:{ok:!!e.ok,dismissByClickBg:!!e.dismissByClickBg}}),$E())}function nD(e,t){let n=e||{},r=n.showIcon==null?``:String(n.showIcon),i=r===`1`?`success`:r===`0`?`fail`:`text`;try{CE({type:i,message:n.message==null?``:String(n.message),duration:ZE,teleport:document.querySelector(`.phone-viewport`)||void 0})}catch{}QE(t,{success:!0,data:{}})}function rD(e,t){let n=e||{},r=Array.isArray(n.currentValue)?n.currentValue:[];r.length&&Array.isArray(r[0])&&(r=r[0]),qE.push({id:++JE,title:n.title||``,mode:n.mode===`multi`?`multi`:`single`,dataSource:Array.isArray(n.dataSource)?n.dataSource:[],currentValue:r.map(e=>String(e)),callback:t}),UE.picker||iD()}function iD(){UE.picker=qE.length?qE.shift():null}function aD(e,t){let n=UE.picker;if(n){if(UE.picker=null,e){let e={success:!0,error:`0`,data:{result:t},result:t};QE(n.callback,e)}else QE(n.callback,{success:!0,data:{}});iD()}}function oD(e,t){let n=e||{},r=[`year_month_day`,`year_month`,`month_day`].includes(n.type)?n.type:`year_month_day`;YE.push({id:++XE,title:n.title||``,type:r,startDate:n.startDate||`1970-1-1`,endDate:n.endDate||`2100-12-31`,selectDate:n.selectDate||``,callback:t}),UE.datePicker||sD()}function sD(){UE.datePicker=YE.length?YE.shift():null}function cD(e,t){let n=UE.datePicker;if(n){if(UE.datePicker=null,e){let e={success:!0,error:`0`,currentDate:t.value,data:{year:t.year,month:t.month,day:t.day,value:t.value}};QE(n.callback,e)}else QE(n.callback,{success:!0,data:{}});sD()}}var lD=[`number`,`password`,`idcard`];function uD(e){let t=``;for(let n=0;n<e.length;n++)t+=e.charCodeAt(n).toString(16).padStart(2,`0`);return t}function dD(e){let t=!1,n=!1,r=!1;for(let i of e)i>=`0`&&i<=`9`?t=!0:i>=`a`&&i<=`z`||i>=`A`&&i<=`Z`?n=!0:r=!0;return+!!t+ +!!n+ +!!r}function fD(e){if(!e)return!1;if(/^(.)\1*$/.test(e))return!0;if(e.length>=3){let t=!0,n=!0;for(let r=1;r<e.length;r++){let i=e.charCodeAt(r)-e.charCodeAt(r-1);i!==1&&(t=!1),i!==-1&&(n=!1)}if(t||n)return!0}return!1}function pD(e,t){let n=e.value;return{success:!0,data:{value:e.isEncry?uD(n):n,md5:HE(n),inputSimple:fD(n),inputLevel:dD(n),isMatch:!e.regular||new RegExp(e.regular).test(n),length:n.length,action:t,error:`0`,errorMessage:``}}}function mD(e,t){let n=e||{},r=lD.includes(n.type)?n.type:`number`;UE.keyboard&&_D();let i=n.max==null?n.maxLength:n.max,a=Number(i)>0?Number(i):r===`password`?6:r===`idcard`?18:0,o=n.isEncry===void 0?r!==`number`:!!n.isEncry;UE.keyboard={type:r,maxLength:a,random:n.random===void 0?r!==`number`:!!n.random,extraKey:r===`idcard`?`X`:``,isEncry:o,encryptType:n.encryptType||(o?`SM2SM4`:``),randomKey:n.randomKey||``,regular:n.regular||``,value:``,callback:t}}function hD(e){let t=UE.keyboard;t&&(t.maxLength>0&&t.value.length>=t.maxLength||(t.value+=e,QE(t.callback,pD(t,`input`))))}function gD(){let e=UE.keyboard;e&&e.value&&(e.value=e.value.slice(0,-1),QE(e.callback,pD(e,`input`)))}function _D(){let e=UE.keyboard;e&&(UE.keyboard=null,QE(e.callback,pD(e,`hide`)))}function vD(e,t){_D(),QE(t,{success:!0,data:{}})}function yD(e,t){let n=e||{},r=n.message==null?``:String(n.message),i=Number(n.duration)>0?Number(n.duration):8;KE&&=(clearTimeout(KE),null),UE.loadingEx={message:r},KE=setTimeout(()=>{KE=null,UE.loadingEx=null},i*1e3),QE(t,{success:!0,data:{}})}function bD(e,t){KE&&=(clearTimeout(KE),null),UE.loadingEx=null,QE(t,{success:!0,data:{}})}function xD(e,t){let n=e||{},r=n.text==null?``:String(n.text),i=()=>QE(t,{success:!1,error:`-1`,errorMessage:`复制失败`,data:{}}),a=()=>QE(t,{success:!0,data:{}}),o=()=>{try{let e=document.createElement(`textarea`);e.value=r,e.style.cssText=`position:fixed;opacity:0;pointer-events:none`,document.body.appendChild(e),e.select();let t=document.execCommand(`copy`);return document.body.removeChild(e),t}catch{return!1}};navigator.clipboard&&window.isSecureContext?navigator.clipboard.writeText(r).then(a,()=>o()?a():i()):o()?a():i()}var SD={alertCard:(e,t)=>IS(e,t),closeAlertCard:(e,t)=>LS(e,t),alertDialog:eD,showToast:nD,showPicker:rD,showDatePicker:oD,showKeyboard:mD,hideKeyboard:vD,showLoadingEx:yD,hideLoadingEx:bD,copyToClipboard:xD};function CD(e){typeof window<`u`&&(window.ynet={callJSAPI(t,n,r){e&&e.pushApiCall&&e.pushApiCall(t,n);let i=SD[t];i?i(n,r):QE(r,{success:!0,data:{}})}})}function wD(){WE.length=0,UE.dialog=null;try{wE()}catch{}qE.length=0,UE.picker=null,YE.length=0,UE.datePicker=null,UE.keyboard=null,KE&&=(clearTimeout(KE),null),UE.loadingEx=null}var TD={name:`DeviceOverlay`,computed:{dialog(){return UE.dialog}},methods:{onOk(){tD({ok:!0,dismissByClickBg:!1})},onCancel(){tD({ok:!1,dismissByClickBg:!1})},onMaskClick(){this.dialog&&this.dialog.clickBgToHide&&tD({ok:!1,dismissByClickBg:!0})}}},ED={class:`device-ui`},DD={class:`dlg`},OD={key:0,class:`dlg__title`},kD={key:1,class:`dlg__msg`},AD={class:`dlg__btns`};function jD(e,t,n,r,i,a){return V(),H(`div`,ED,[q(` alertDialog:原生风格居中确认对话框 `),G(hc,{name:`dlg-fade`},{default:I(()=>[a.dialog?(V(),H(`div`,{key:0,class:`dlg-mask`,onClick:t[2]||=J((...e)=>a.onMaskClick&&a.onMaskClick(...e),[`self`])},[W(`div`,DD,[a.dialog.title?(V(),H(`div`,OD,M(a.dialog.title),1)):q(`v-if`,!0),a.dialog.message?(V(),H(`div`,kD,M(a.dialog.message),1)):q(`v-if`,!0),W(`div`,AD,[a.dialog.cancelButton?(V(),H(`button`,{key:0,type:`button`,class:j([`dlg__btn dlg__btn--cancel`,{"dlg__btn--gray":a.dialog.cancelGrayStyle}]),onClick:t[0]||=(...e)=>a.onCancel&&a.onCancel(...e)},M(a.dialog.cancelButton),3)):q(`v-if`,!0),W(`button`,{type:`button`,class:`dlg__btn dlg__btn--ok`,onClick:t[1]||=(...e)=>a.onOk&&a.onOk(...e)},M(a.dialog.okButton),1)])])])):q(`v-if`,!0)]),_:1})])}var MD=Z(TD,[[`render`,jD],[`__file`,`/Users/ynet/dsl-card/card-editor/components/DeviceOverlay.vue`]]),ND=0,PD=!1;typeof document<`u`&&(document.addEventListener(`touchmove`,()=>{PD=!0},{capture:!0,passive:!0}),document.addEventListener(`touchend`,()=>{PD&&(ND=Date.now()),PD=!1},{capture:!0}));function FD(){return Date.now()-ND<200}var ID={name:`PickerOverlay`,components:{VanPicker:sE},data(){return{selKeys:[],OPTION_H:44,VISIBLE_N:5,SWIPE_MS:240}},computed:{picker(){return UE.picker},fieldNames(){return{text:`text`,value:`key`,children:`children`}},columns(){if(!this.picker)return[];let e=this.picker.dataSource||[];return this.picker.mode===`multi`?e.map(e=>({text:e.text,key:String(e.key),children:e.children||[]})):e.map(e=>({text:e.text,key:String(e.key)}))}},watch:{picker:{immediate:!0,handler(e){if(!e){this.selKeys=[];return}let t=e.dataSource||[],n=(e.currentValue||[]).map(e=>String(e));if(e.mode===`multi`){let e=t.find(e=>String(e.key)===n[0])||t[0],r=e&&e.children||[],i=r.find(e=>String(e.key)===n[1])||r[0];this.selKeys=[e?String(e.key):``,i?String(i.key):``]}else{let e=t.find(e=>String(e.key)===n[0])||t[0];this.selKeys=[e?String(e.key):``]}}}},methods:{onChange(e){this.selKeys=(e.selectedValues||[]).map(e=>String(e))},buildResult(){let e=this.picker;if(!e)return[];let t=e.dataSource||[],n=e=>({key:String(e.key),text:e.text,value:e.text});if(e.mode===`multi`){let e=t.find(e=>String(e.key)===this.selKeys[0])||t[0],r=e&&e.children||[],i=r.find(e=>String(e.key)===this.selKeys[1])||r[0],a=[];return e&&a.push(n(e)),i&&a.push(n(i)),a}let r=t.find(e=>String(e.key)===this.selKeys[0])||t[0];return r?[n(r)]:[]},onConfirm(){aD(!0,this.buildResult())},onMaskClick(){FD()||this.onCancel()},onCancel(){aD(!1)}}},LD={class:`device-ui`},RD={class:`pk-sheet`},zD={class:`pk-bar`},BD={key:0,class:`pk-bar__title`};function VD(e,t,n,r,i,a){let o=R(`van-picker`);return V(),H(`div`,LD,[G(hc,{name:`picker-fade`},{default:I(()=>[a.picker?(V(),H(`div`,{key:0,class:`pk-mask`,onClick:t[2]||=J((...e)=>a.onMaskClick&&a.onMaskClick(...e),[`self`])},[W(`div`,RD,[W(`div`,zD,[W(`button`,{type:`button`,class:`pk-bar__btn pk-bar__btn--cancel`,onClick:t[0]||=(...e)=>a.onCancel&&a.onCancel(...e)},`取消`),a.picker.title?(V(),H(`div`,BD,M(a.picker.title),1)):q(`v-if`,!0),W(`button`,{type:`button`,class:`pk-bar__btn pk-bar__btn--ok`,onClick:t[1]||=(...e)=>a.onConfirm&&a.onConfirm(...e)},`确定`)]),q(` ⚠️ vant 4 属性名是 option-height / visible-option-num(Vant 2 的
247
+ 每张弹窗卡都是全新实例,各自持有独立 cardRuntime(对齐组件头设计意图)。 `),(V(),U(o,{key:e.id,entry:e,"main-rt":n.mainRt},null,8,[`entry`,`main-rt`]))],4)],10,VS)),[[Nc,e===a.top]])),128))])):q(`v-if`,!0)}var US=Z(zS,[[`render`,HS],[`__file`,`/Users/ynet/dsl-card/card-editor/components/AlertCardLayer.vue`]]);function WS(){}var GS=Object.assign,KS=typeof window<`u`,qS=e=>typeof e==`object`&&!!e,JS=e=>e!=null,YS=e=>typeof e==`function`,XS=e=>qS(e)&&YS(e.then)&&YS(e.catch),ZS=e=>typeof e==`number`||/^\d+(\.\d+)?$/.test(e),QS=()=>KS?/ios|iphone|ipad|ipod/.test(navigator.userAgent.toLowerCase()):!1;function $S(e,t){let n=t.split(`.`),r=e;return n.forEach(e=>{r=qS(r)?r[e]??``:``}),r}function eC(e,t,n){return t.reduce((t,r)=>((!n||e[r]!==void 0)&&(t[r]=e[r]),t),{})}var tC=(e,t)=>JSON.stringify(e)===JSON.stringify(t),nC=[Number,String],rC={type:Boolean,default:!0},iC=e=>({type:e,required:!0}),aC=()=>({type:Array,default:()=>[]}),oC=e=>({type:Number,default:e}),sC=e=>({type:nC,default:e}),cC=e=>({type:String,default:e}),lC=typeof window<`u`;function uC(e){return lC?requestAnimationFrame(e):-1}function dC(e){lC&&cancelAnimationFrame(e)}function fC(e){uC(()=>uC(e))}var pC=e=>e===window,mC=(e,t)=>({top:0,left:0,right:e,bottom:t,width:e,height:t}),hC=e=>{let t=Cn(e);if(pC(t)){let e=t.innerWidth,n=t.innerHeight;return mC(e,n)}return t?.getBoundingClientRect?t.getBoundingClientRect():mC(0,0)};function gC(e){let t=Yr(e,null);if(t){let e=Os(),{link:n,unlink:r,internalChildren:i}=t;return n(e),Qi(()=>r(e)),{parent:t,index:Zs(()=>i.indexOf(e))}}return{parent:null,index:P(-1)}}function _C(e){let t=[],n=e=>{Array.isArray(e)&&e.forEach(e=>{ss(e)&&(t.push(e),e.component?.subTree&&(t.push(e.component.subTree),n(e.component.subTree.children)),e.children&&n(e.children))})};return n(e),t}var vC=(e,t)=>{let n=e.indexOf(t);return n===-1?e.findIndex(e=>t.key!==void 0&&t.key!==null&&e.type===t.type&&e.key===t.key):n};function yC(e,t,n){let r=_C(e.subTree.children);n.sort((e,t)=>vC(r,e.vnode)-vC(r,t.vnode));let i=n.map(e=>e.proxy);t.sort((e,t)=>i.indexOf(e)-i.indexOf(t))}function bC(e){let t=cn([]),n=cn([]),r=Os();return{children:t,linkChildren:i=>{Jr(e,Object.assign({link:e=>{e.proxy&&(n.push(e),t.push(e.proxy),yC(r,t,n))},unlink:e=>{let r=n.indexOf(e);t.splice(r,1),n.splice(r,1)},children:t,internalChildren:n},i))}}}function xC(e){let t;Ji(()=>{e(),rr(()=>{t=!0})}),Vi(()=>{t&&e()})}function SC(e,t,n={}){if(!lC)return;let{target:r=window,passive:i=!1,capture:a=!1}=n,o=!1,s,c=n=>{if(o)return;let r=Cn(n);r&&!s&&(r.addEventListener(e,t,{capture:a,passive:i}),s=!0)},l=n=>{if(o)return;let r=Cn(n);r&&s&&(r.removeEventListener(e,t,a),s=!1)};Qi(()=>l(r)),Hi(()=>l(r)),xC(()=>c(r));let u;return bn(r)&&(u=$r(r,(e,t)=>{l(t),c(e)})),()=>{u?.(),l(r),o=!0}}function CC(e,t,n={}){if(!lC)return;let{eventName:r=`click`}=n;SC(r,n=>{(Array.isArray(e)?e:[e]).every(e=>{let t=Cn(e);return t&&!t.contains(n.target)})&&t(n)},{target:document})}var wC,TC;function EC(){if(!wC&&(wC=P(0),TC=P(0),lC)){let e=()=>{wC.value=window.innerWidth,TC.value=window.innerHeight};e(),window.addEventListener(`resize`,e,{passive:!0}),window.addEventListener(`orientationchange`,e,{passive:!0})}return{width:wC,height:TC}}var DC=/scroll|auto|overlay/i,OC=lC?window:void 0;function kC(e){return e.tagName!==`HTML`&&e.tagName!==`BODY`&&e.nodeType===1}function AC(e,t=OC){let n=e;for(;n&&n!==t&&kC(n);){let{overflowY:e}=window.getComputedStyle(n);if(DC.test(e))return n;n=n.parentNode}return t}function jC(e,t=OC){let n=P();return Ji(()=>{e.value&&(n.value=AC(e.value,t))}),n}var MC;function NC(){if(!MC&&(MC=P(`visible`),lC)){let e=()=>{MC.value=document.hidden?`hidden`:`visible`};e(),window.addEventListener(`visibilitychange`,e)}return MC}function PC(e){let t=`scrollTop`in e?e.scrollTop:e.pageYOffset;return Math.max(t,0)}function FC(e,t){`scrollTop`in e?e.scrollTop=t:e.scrollTo(e.scrollX,t)}function IC(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0}function LC(e){FC(window,e),FC(document.body,e)}function RC(e,t){if(e===window)return 0;let n=t?PC(t):IC();return hC(e).top+n}QS();var zC=e=>e.stopPropagation();function BC(e,t){(typeof e.cancelable!=`boolean`||e.cancelable)&&e.preventDefault(),t&&zC(e)}function VC(e){let t=Cn(e);if(!t)return!1;let n=window.getComputedStyle(t),r=n.display===`none`,i=t.offsetParent===null&&n.position!==`fixed`;return r||i}var{width:HC,height:UC}=EC();function WC(e){if(JS(e))return ZS(e)?`${e}px`:String(e)}function GC(e){if(JS(e)){if(Array.isArray(e))return{width:WC(e[0]),height:WC(e[1])};let t=WC(e);return{width:t,height:t}}}function KC(e){let t={};return e!==void 0&&(t.zIndex=+e),t}var qC;function JC(){if(!qC){let e=document.documentElement,t=e.style.fontSize||window.getComputedStyle(e).fontSize;qC=parseFloat(t)}return qC}function YC(e){return e=e.replace(/rem/g,``),+e*JC()}function XC(e){return e=e.replace(/vw/g,``),+e*HC.value/100}function ZC(e){return e=e.replace(/vh/g,``),+e*UC.value/100}function QC(e){if(typeof e==`number`)return e;if(KS){if(e.includes(`rem`))return YC(e);if(e.includes(`vw`))return XC(e);if(e.includes(`vh`))return ZC(e)}return parseFloat(e)}var $C=/-(\w)/g,ew=e=>e.replace($C,(e,t)=>t.toUpperCase()),tw=(e,t,n)=>Math.min(Math.max(e,t),n),{hasOwnProperty:nw}=Object.prototype;function rw(e,t,n){let r=t[n];JS(r)&&(e[n]=!nw.call(e,n)||!qS(r)?r:iw(Object(e[n]),r))}function iw(e,t){return Object.keys(t).forEach(n=>{rw(e,t,n)}),e}var aw={name:`姓名`,tel:`电话`,save:`保存`,clear:`清空`,undo:`撤销`,cancel:`取消`,confirm:`确认`,delete:`删除`,loading:`加载中...`,noCoupon:`暂无优惠券`,nameEmpty:`请填写姓名`,addContact:`添加联系人`,telInvalid:`请填写正确的电话`,vanCalendar:{end:`结束`,start:`开始`,title:`日期选择`,weekdays:[`日`,`一`,`二`,`三`,`四`,`五`,`六`],monthTitle:(e,t)=>`${e}\u5E74${t}\u6708`,rangePrompt:e=>`\u6700\u591A\u9009\u62E9 ${e} \u5929`},vanCascader:{select:`请选择`},vanPagination:{prev:`上一页`,next:`下一页`},vanPullRefresh:{pulling:`下拉即可刷新...`,loosing:`释放即可刷新...`},vanSubmitBar:{label:`合计:`},vanCoupon:{unlimited:`无门槛`,discount:e=>`${e}\u6298`,condition:e=>`\u6EE1${e}\u5143\u53EF\u7528`},vanCouponCell:{title:`优惠券`,count:e=>`${e}\u5F20\u53EF\u7528`},vanCouponList:{exchange:`兑换`,close:`不使用`,enable:`可用`,disabled:`不可用`,placeholder:`输入优惠码`},vanAddressEdit:{area:`地区`,areaEmpty:`请选择地区`,addressEmpty:`请填写详细地址`,addressDetail:`详细地址`,defaultAddress:`设为默认收货地址`},vanAddressList:{add:`新增地址`}},ow=P(`zh-CN`),sw=cn({"zh-CN":aw}),cw={messages(){return sw[ow.value]},use(e,t){ow.value=e,this.add({[e]:t})},add(e={}){iw(sw,e)}};function lw(e){let t=ew(e)+`.`;return(e,...n)=>{let r=cw.messages(),i=$S(r,t+e)||$S(r,e);return YS(i)?i(...n):i}}function uw(e,t){return t?typeof t==`string`?` ${e}--${t}`:Array.isArray(t)?t.reduce((t,n)=>t+uw(e,n),``):Object.keys(t).reduce((n,r)=>n+(t[r]?uw(e,r):``),``):``}function dw(e){return(t,n)=>(t&&typeof t!=`string`&&(n=t,t=``),t=t?`${e}__${t}`:e,`${t}${uw(t,n)}`)}function fw(e){let t=`van-${e}`;return[t,dw(t),lw(t)]}var pw=`van-hairline`,mw=`${pw}--top-bottom`,hw=`${pw}-unset--top-bottom`,gw=`van-haptics-feedback`;function _w(e,{args:t=[],done:n,canceled:r,error:i}){if(e){let a=e.apply(null,t);XS(a)?a.then(e=>{e?n():r&&r()}).catch(i||WS):a?n():r&&r()}else n()}function vw(e){return e.install=t=>{let{name:n}=e;n&&(t.component(n,e),t.component(ew(`-${n}`),e))},e}var yw=Symbol();function bw(e){let t=Yr(yw,null);t&&$r(t,t=>{t&&e()})}function xw(e){let t=Os();t&&GS(t.proxy,e)}var Sw={to:[String,Object],url:String,replace:Boolean};function Cw({to:e,url:t,replace:n,$router:r}){e&&r?r[n?`replace`:`push`](e):t&&(n?location.replace(t):location.href=t)}var[ww,Tw]=fw(`badge`),Ew=vw(Mi({name:ww,props:{dot:Boolean,max:nC,tag:cC(`div`),color:String,offset:Array,content:nC,showZero:rC,position:cC(`top-right`)},setup(e,{slots:t}){let n=()=>{if(t.content)return!0;let{content:n,showZero:r}=e;return JS(n)&&n!==``&&(r||n!==0&&n!==`0`)},r=()=>{let{dot:r,max:i,content:a}=e;if(!r&&n())return t.content?t.content():JS(i)&&ZS(a)&&+a>+i?`${i}+`:a},i=e=>e.startsWith(`-`)?e.replace(`-`,``):`-${e}`,a=Zs(()=>{let n={background:e.color};if(e.offset){let[r,a]=e.offset,{position:o}=e,[s,c]=o.split(`-`);t.default?(n[s]=typeof a==`number`?WC(s===`top`?a:-a):s===`top`?WC(a):i(a),n[c]=typeof r==`number`?WC(c===`left`?r:-r):c===`left`?WC(r):i(r)):(n.marginTop=WC(a),n.marginLeft=WC(r))}return n}),o=()=>{if(n()||e.dot)return G(`div`,{class:Tw([e.position,{dot:e.dot,fixed:!!t.default}]),style:a.value},[r()])};return()=>{if(t.default){let{tag:n}=e;return G(n,{class:Tw(`wrapper`)},{default:()=>[t.default(),o()]})}return o()}}})),Dw=2e3,Ow=()=>++Dw,[kw,Aw]=fw(`config-provider`),jw=Symbol(kw),[Mw,Nw]=fw(`icon`),Pw=e=>e?.includes(`/`),Fw=vw(Mi({name:Mw,props:{dot:Boolean,tag:cC(`i`),name:String,size:nC,badge:nC,color:String,badgeProps:Object,classPrefix:String},setup(e,{slots:t}){let n=Yr(jw,null),r=Zs(()=>e.classPrefix||n?.iconPrefix||Nw());return()=>{let{tag:n,dot:i,name:a,size:o,badge:s,color:c}=e,l=Pw(a);return G(Ew,xs({dot:i,tag:n,class:[r.value,l?``:`${r.value}-${a}`],style:{color:c,fontSize:WC(o)},content:s},e.badgeProps),{default:()=>[t.default?.call(t),l&&G(`img`,{class:Nw(`image`),src:a},null)]})}}})),[Iw,Lw]=fw(`loading`),Rw=Array(12).fill(null).map((e,t)=>G(`i`,{class:Lw(`line`,String(t+1))},null)),zw=G(`svg`,{class:Lw(`circular`),viewBox:`25 25 50 50`},[G(`circle`,{cx:`50`,cy:`50`,r:`20`,fill:`none`},null)]),Bw=vw(Mi({name:Iw,props:{size:nC,type:cC(`circular`),color:String,vertical:Boolean,textSize:nC,textColor:String},setup(e,{slots:t}){let n=Zs(()=>GS({color:e.color},GC(e.size))),r=()=>{let r=e.type===`spinner`?Rw:zw;return G(`span`,{class:Lw(`spinner`,e.type),style:n.value},[t.icon?t.icon():r])},i=()=>{if(t.default)return G(`span`,{class:Lw(`text`),style:{fontSize:WC(e.textSize),color:e.textColor??e.color}},[t.default()])};return()=>{let{type:t,vertical:n}=e;return G(`div`,{class:Lw([t,{vertical:n}]),"aria-live":`polite`,"aria-busy":!0},[r(),i()])}}})),Vw={show:Boolean,zIndex:nC,overlay:rC,duration:nC,teleport:[String,Object],lockScroll:rC,lazyRender:rC,beforeClose:Function,overlayProps:Object,overlayStyle:Object,overlayClass:null,transitionAppear:Boolean,closeOnClickOverlay:rC};Object.keys(Vw);function Hw(e,t){return e>t?`horizontal`:t>e?`vertical`:``}function Uw(){let e=P(0),t=P(0),n=P(0),r=P(0),i=P(0),a=P(0),o=P(``),s=P(!0),c=()=>o.value===`vertical`,l=()=>o.value===`horizontal`,u=()=>{n.value=0,r.value=0,i.value=0,a.value=0,o.value=``,s.value=!0};return{move:(c=>{let l=c.touches[0];n.value=(l.clientX<0?0:l.clientX)-e.value,r.value=l.clientY-t.value,i.value=Math.abs(n.value),a.value=Math.abs(r.value),(!o.value||i.value<10&&a.value<10)&&(o.value=Hw(i.value,a.value)),s.value&&(i.value>5||a.value>5)&&(s.value=!1)}),start:(n=>{u(),e.value=n.touches[0].clientX,t.value=n.touches[0].clientY}),reset:u,startX:e,startY:t,deltaX:n,deltaY:r,offsetX:i,offsetY:a,direction:o,isVertical:c,isHorizontal:l,isTap:s}}var Ww=0,Gw=`van-overflow-hidden`;function Kw(e,t){let n=Uw(),r=t=>{n.move(t);let r=n.deltaY.value>0?`10`:`01`,i=AC(t.target,e.value);for(;i.scrollHeight<=i.offsetHeight&&i!==e.value&&i.parentElement;)i=AC(i.parentElement,e.value);let{scrollHeight:a,offsetHeight:o,scrollTop:s}=i,c=`11`;s===0?c=o>=a?`00`:`01`:s+o>=a&&(c=`10`),c!==`11`&&n.isVertical()&&!(parseInt(c,2)&parseInt(r,2))&&BC(t,!0)},i=()=>{document.addEventListener(`touchstart`,n.start),document.addEventListener(`touchmove`,r,{passive:!1}),Ww||document.body.classList.add(Gw),Ww++},a=()=>{Ww&&(document.removeEventListener(`touchstart`,n.start),document.removeEventListener(`touchmove`,r),Ww--,Ww||document.body.classList.remove(Gw))},o=()=>t()&&i(),s=()=>t()&&a();xC(o),Hi(s),Zi(s),$r(t,e=>{e?i():a()})}function qw(e){let t=P(!1);return $r(e,e=>{e&&(t.value=e)},{immediate:!0}),e=>()=>t.value?e():null}var Jw=()=>{let{scopeId:e}=Os()?.vnode||{};return e?{[e]:``}:null},[Yw,Xw]=fw(`overlay`),Zw=vw(Mi({name:Yw,inheritAttrs:!1,props:{show:Boolean,zIndex:nC,duration:nC,className:null,lockScroll:rC,lazyRender:rC,customStyle:Object,teleport:[String,Object]},setup(e,{attrs:t,slots:n}){let r=P(),i=qw(()=>e.show||!e.lazyRender),a=t=>{e.lockScroll&&BC(t,!0)},o=i(()=>{let i=GS(KC(e.zIndex),e.customStyle);return JS(e.duration)&&(i.animationDuration=`${e.duration}s`),L(G(`div`,xs({ref:r,style:i,class:[Xw(),e.className]},t),[n.default?.call(n)]),[[Nc,e.show]])});return SC(`touchmove`,a,{target:r}),()=>{let t=G(hc,{name:`van-fade`,appear:!0},{default:o});return e.teleport?G(mi,{to:e.teleport},{default:()=>[t]}):t}}})),Qw=GS({},Vw,{round:Boolean,position:cC(`center`),closeIcon:cC(`cross`),closeable:Boolean,transition:String,iconPrefix:String,closeOnPopstate:Boolean,closeIconPosition:cC(`top-right`),destroyOnClose:Boolean,safeAreaInsetTop:Boolean,safeAreaInsetBottom:Boolean}),[$w,eT]=fw(`popup`),tT=vw(Mi({name:$w,inheritAttrs:!1,props:Qw,emits:[`open`,`close`,`opened`,`closed`,`keydown`,`update:show`,`clickOverlay`,`clickCloseIcon`],setup(e,{emit:t,attrs:n,slots:r}){let i,a,o=P(),s=P(),c=qw(()=>e.show||!e.lazyRender),l=Zs(()=>{let t={zIndex:o.value};if(JS(e.duration)){let n=e.position===`center`?`animationDuration`:`transitionDuration`;t[n]=`${e.duration}s`}return t}),u=()=>{i||(i=!0,o.value=e.zIndex===void 0?Ow():+e.zIndex,t(`open`))},d=()=>{i&&_w(e.beforeClose,{done(){i=!1,t(`close`),t(`update:show`,!1)}})},f=n=>{t(`clickOverlay`,n),e.closeOnClickOverlay&&d()},p=()=>{if(e.overlay)return G(Zw,xs(GS({show:e.show,class:e.overlayClass,zIndex:o.value,duration:e.duration,customStyle:e.overlayStyle,role:e.closeOnClickOverlay?`button`:void 0,tabindex:e.closeOnClickOverlay?0:void 0},e.overlayProps),Jw(),{onClick:f}),{default:r[`overlay-content`]})},m=e=>{t(`clickCloseIcon`,e),d()},h=()=>{if(e.closeable)return G(Fw,{role:`button`,tabindex:0,name:e.closeIcon,class:[eT(`close-icon`,e.closeIconPosition),gw],classPrefix:e.iconPrefix,onClick:m},null)},g,_=()=>{g&&clearTimeout(g),g=setTimeout(()=>{t(`opened`)})},v=()=>t(`closed`),y=e=>t(`keydown`,e),b=c(()=>{let{destroyOnClose:t,round:i,position:a,safeAreaInsetTop:o,safeAreaInsetBottom:c,show:u}=e;if(u||!t)return L(G(`div`,xs({ref:s,style:l.value,role:`dialog`,tabindex:0,class:[eT({round:i,[a]:a}),{"van-safe-area-top":o,"van-safe-area-bottom":c}],onKeydown:y},n,Jw()),[r.default?.call(r),h()]),[[Nc,u]])}),x=()=>{let{position:t,transition:n,transitionAppear:r}=e,i=t===`center`?`van-fade`:`van-popup-slide-${t}`;return G(hc,{name:n||i,appear:r,onAfterEnter:_,onAfterLeave:v},{default:b})};return $r(()=>e.show,e=>{e&&!i&&(u(),n.tabindex===0&&rr(()=>{var e;(e=s.value)==null||e.focus()})),!e&&i&&(i=!1,t(`close`))}),xw({popupRef:s}),Kw(s,()=>e.show&&e.lockScroll),SC(`popstate`,()=>{e.closeOnPopstate&&(d(),a=!1)}),Ji(()=>{e.show&&u()}),Vi(()=>{a&&=(t(`update:show`,!0),!1)}),Hi(()=>{e.show&&e.teleport&&(d(),a=!0)}),Jr(yw,()=>e.show),()=>e.teleport?G(mi,{to:e.teleport},{default:()=>[p(),x()]}):G(B,null,[p(),x()])}})),[nT,rT,iT]=fw(`picker`),aT=e=>e.find(e=>!e.disabled)||e[0];function oT(e,t){let n=e[0];if(n){if(Array.isArray(n))return`multiple`;if(t.children in n)return`cascade`}return`default`}function sT(e,t){t=tw(t,0,e.length);for(let n=t;n<e.length;n++)if(!e[n].disabled)return n;for(let n=t-1;n>=0;n--)if(!e[n].disabled)return n;return 0}var cT=(e,t,n)=>t!==void 0&&e.some(e=>e[n.value]===t);function lT(e,t,n){return e[sT(e,e.findIndex(e=>e[n.value]===t))]}function uT(e,t,n){let r=[],i={[t.children]:e},a=0;for(;i&&i[t.children];){let e=i[t.children],o=n.value[a];if(i=JS(o)?lT(e,o,t):void 0,!i&&e.length){let n=aT(e)[t.value];i=lT(e,n,t)}a++,r.push(e)}return r}function dT(e){let{transform:t}=window.getComputedStyle(e),n=t.slice(7,t.length-1).split(`, `)[5];return Number(n)}function fT(e){return GS({text:`text`,value:`value`,children:`children`},e)}var pT=200,mT=300,hT=15,[gT,_T]=fw(`picker-column`),vT=Symbol(gT),yT=Mi({name:gT,props:{value:nC,fields:iC(Object),options:aC(),readonly:Boolean,allowHtml:Boolean,optionHeight:iC(Number),swipeDuration:iC(nC),visibleOptionNum:iC(nC)},emits:[`change`,`clickOption`,`scrollInto`],setup(e,{emit:t,slots:n}){let r,i,a,o,s,c=P(),l=P(),u=P(0),d=P(0),f=Uw(),p=()=>e.options.length,m=()=>e.optionHeight*(e.visibleOptionNum-1)/2,h=n=>{let i=sT(e.options,n),a=-i*e.optionHeight,o=()=>{i>p()-1&&(i=sT(e.options,n));let r=e.options[i][e.fields.value];r!==e.value&&t(`change`,r)};r&&a!==u.value?s=o:o(),u.value=a},g=()=>e.readonly||!e.options.length,_=n=>{r||g()||(s=null,d.value=pT,h(n),t(`clickOption`,e.options[n]))},v=t=>tw(Math.round(-t/e.optionHeight),0,p()-1),y=Zs(()=>v(u.value)),b=(t,n)=>{let r=Math.abs(t/n);t=u.value+r/.003*(t<0?-1:1);let i=v(t);d.value=+e.swipeDuration,h(i)},x=()=>{r=!1,d.value=0,s&&=(s(),null)},S=e=>{if(!g()){if(f.start(e),r){let e=dT(l.value);u.value=Math.min(0,e-m())}d.value=0,i=u.value,a=Date.now(),o=i,s=null}},C=n=>{if(g())return;f.move(n),f.isVertical()&&(r=!0,BC(n,!0));let s=tw(i+f.deltaY.value,-(p()*e.optionHeight),e.optionHeight),c=v(s);c!==y.value&&t(`scrollInto`,e.options[c]),u.value=s;let l=Date.now();l-a>mT&&(a=l,o=s)},w=()=>{if(g())return;let e=u.value-o,t=Date.now()-a;if(t<mT&&Math.abs(e)>hT){b(e,t);return}let n=v(u.value);d.value=pT,h(n),setTimeout(()=>{r=!1},0)},ee=()=>{let t={height:`${e.optionHeight}px`};return e.options.map((r,i)=>{let a=r[e.fields.text],{disabled:o}=r,s=r[e.fields.value],c={role:`button`,style:t,tabindex:o?-1:0,class:[_T(`item`,{disabled:o,selected:s===e.value}),r.className],onClick:()=>_(i)},l={class:`van-ellipsis`,[e.allowHtml?`innerHTML`:`textContent`]:a};return G(`li`,c,[n.option?n.option(r,i):G(`div`,l,null)])})};return gC(vT),xw({stopMomentum:x}),Qr(()=>{let t=r?Math.floor(-u.value/e.optionHeight):e.options.findIndex(t=>t[e.fields.value]===e.value),n=sT(e.options,t),i=-n*e.optionHeight;r&&n<t&&x(),u.value=i}),SC(`touchmove`,C,{target:c}),()=>G(`div`,{ref:c,class:_T(),onTouchstartPassive:S,onTouchend:w,onTouchcancel:w},[G(`ul`,{ref:l,style:{transform:`translate3d(0, ${u.value+m()}px, 0)`,transitionDuration:`${d.value}ms`,transitionProperty:d.value?`all`:`none`},class:_T(`wrapper`),onTransitionend:x},[ee()])])}}),[bT]=fw(`picker-toolbar`),xT={title:String,cancelButtonText:String,confirmButtonText:String},ST=[`cancel`,`confirm`,`title`,`toolbar`],CT=Object.keys(xT),wT=Mi({name:bT,props:xT,emits:[`confirm`,`cancel`],setup(e,{emit:t,slots:n}){let r=()=>{if(n.title)return n.title();if(e.title)return G(`div`,{class:[rT(`title`),`van-ellipsis`]},[e.title])},i=()=>t(`cancel`),a=()=>t(`confirm`),o=()=>{let t=e.cancelButtonText??iT(`cancel`);if(n.cancel||t)return G(`button`,{type:`button`,class:[rT(`cancel`),gw],onClick:i},[n.cancel?n.cancel():t])},s=()=>{let t=e.confirmButtonText??iT(`confirm`);if(n.confirm||t)return G(`button`,{type:`button`,class:[rT(`confirm`),gw],onClick:a},[n.confirm?n.confirm():t])};return()=>G(`div`,{class:rT(`toolbar`)},[n.toolbar?n.toolbar():[o(),r(),s()]])}});function TT(e,t,n){let r,i=0,a=e.scrollLeft,o=n===0?1:Math.round(n*1e3/16),s=a;function c(){dC(r)}function l(){s+=(t-a)/o,e.scrollLeft=s,++i<o&&(r=uC(l))}return l(),c}function ET(e,t,n,r){let i,a=PC(e),o=a<t,s=n===0?1:Math.round(n*1e3/16),c=(t-a)/s;function l(){dC(i)}function u(){a+=c,(o&&a>t||!o&&a<t)&&(a=t),FC(e,a),o&&a<t||!o&&a>t?i=uC(u):r&&(i=uC(r))}return u(),l}var DT=0;function OT(){let{name:e=`unknown`}=Os()?.type||{};return`${e}-${++DT}`}function kT(){let e=P([]),t=[];return Yi(()=>{e.value=[]}),[e,n=>(t[n]||(t[n]=t=>{e.value[n]=t}),t[n])]}function AT(e,t){if(!KS||!window.IntersectionObserver)return;let n=new IntersectionObserver(e=>{t(e[0].intersectionRatio>0)},{root:document.body}),r=()=>{e.value&&n.observe(e.value)},i=()=>{e.value&&n.unobserve(e.value)};Hi(i),Zi(i),xC(r)}var[jT,MT]=fw(`sticky`),NT=vw(Mi({name:jT,props:{zIndex:nC,position:cC(`top`),container:Object,offsetTop:sC(0),offsetBottom:sC(0)},emits:[`scroll`,`change`],setup(e,{emit:t,slots:n}){let r=P(),i=jC(r),a=cn({fixed:!1,width:0,height:0,transform:0}),o=P(!1),s=Zs(()=>QC(e.position===`top`?e.offsetTop:e.offsetBottom)),c=Zs(()=>{if(o.value)return;let{fixed:e,height:t,width:n}=a;if(e)return{width:`${n}px`,height:`${t}px`}}),l=Zs(()=>{if(!a.fixed||o.value)return;let t=GS(KC(e.zIndex),{width:`${a.width}px`,height:`${a.height}px`,[e.position]:`${s.value}px`});return a.transform&&(t.transform=`translate3d(0, ${a.transform}px, 0)`),t}),u=e=>t(`scroll`,{scrollTop:e,isFixed:a.fixed}),d=()=>{if(!r.value||VC(r))return;let{container:t,position:n}=e,i=hC(r),o=PC(window);if(a.width=i.width,a.height=i.height,n===`top`){if(t){let e=hC(t),n=e.bottom-s.value-a.height;a.fixed=s.value>i.top&&e.bottom>0,a.transform=n<0?n:0}else a.fixed=s.value>i.top}else{let{clientHeight:e}=document.documentElement;if(t){let n=hC(t),r=e-n.top-s.value-a.height;a.fixed=e-s.value<i.bottom&&e>n.top,a.transform=r<0?-r:0}else a.fixed=e-s.value<i.bottom}u(o)};return $r(()=>a.fixed,e=>t(`change`,e)),SC(`scroll`,d,{target:i,passive:!0}),AT(r,d),$r([HC,UC],()=>{r.value&&!VC(r)&&a.fixed&&(o.value=!0,rr(()=>{let e=hC(r);a.width=e.width,a.height=e.height,o.value=!1}))}),()=>G(`div`,{ref:r,style:c.value},[G(`div`,{class:MT({fixed:a.fixed&&!o.value}),style:l.value},[n.default?.call(n)])])}})),[PT,FT]=fw(`swipe`),IT={loop:rC,width:nC,height:nC,vertical:Boolean,autoplay:sC(0),duration:sC(500),touchable:rC,lazyRender:Boolean,initialSwipe:sC(0),indicatorColor:String,showIndicators:rC,stopPropagation:rC},LT=Symbol(PT),RT=vw(Mi({name:PT,props:IT,emits:[`change`,`dragStart`,`dragEnd`],setup(e,{emit:t,slots:n}){let r=P(),i=P(),a=cn({rect:null,width:0,height:0,offset:0,active:0,swiping:!1}),o=!1,s=Uw(),{children:c,linkChildren:l}=bC(LT),u=Zs(()=>c.length),d=Zs(()=>a[e.vertical?`height`:`width`]),f=Zs(()=>e.vertical?s.deltaY.value:s.deltaX.value),p=Zs(()=>a.rect?(e.vertical?a.rect.height:a.rect.width)-d.value*u.value:0),m=Zs(()=>d.value?Math.ceil(Math.abs(p.value)/d.value):u.value),h=Zs(()=>u.value*d.value),g=Zs(()=>(a.active+u.value)%u.value),_=Zs(()=>{let t=e.vertical?`vertical`:`horizontal`;return s.direction.value===t}),v=Zs(()=>{let t={transitionDuration:`${a.swiping?0:e.duration}ms`,transform:`translate${e.vertical?`Y`:`X`}(${+a.offset.toFixed(2)}px)`};if(d.value){let n=e.vertical?`height`:`width`,r=e.vertical?`width`:`height`;t[n]=`${h.value}px`,t[r]=e[r]?`${e[r]}px`:``}return t}),y=t=>{let{active:n}=a;return t?e.loop?tw(n+t,-1,u.value):tw(n+t,0,m.value):n},b=(t,n=0)=>{let r=t*d.value;e.loop||(r=Math.min(r,-p.value));let i=n-r;return e.loop||(i=tw(i,p.value,0)),i},x=({pace:n=0,offset:r=0,emitChange:i})=>{if(u.value<=1)return;let{active:o}=a,s=y(n),l=b(s,r);if(e.loop){if(c[0]&&l!==p.value){let e=l<p.value;c[0].setOffset(e?h.value:0)}if(c[u.value-1]&&l!==0){let e=l>0;c[u.value-1].setOffset(e?-h.value:0)}}a.active=s,a.offset=l,i&&s!==o&&t(`change`,g.value)},S=()=>{a.swiping=!0,a.active<=-1?x({pace:u.value}):a.active>=u.value&&x({pace:-u.value})},C=()=>{S(),s.reset(),fC(()=>{a.swiping=!1,x({pace:-1,emitChange:!0})})},w=()=>{S(),s.reset(),fC(()=>{a.swiping=!1,x({pace:1,emitChange:!0})})},ee,T=()=>clearTimeout(ee),E=()=>{T(),+e.autoplay>0&&u.value>1&&(ee=setTimeout(()=>{w(),E()},+e.autoplay))},D=(t=+e.initialSwipe)=>{if(!r.value)return;let n=()=>{if(!VC(r)){let t={width:r.value.offsetWidth,height:r.value.offsetHeight};a.rect=t,a.width=+(e.width??t.width),a.height=+(e.height??t.height)}u.value&&(t=Math.min(u.value-1,t),t===-1&&(t=u.value-1)),a.active=t,a.swiping=!0,a.offset=b(t),c.forEach(e=>{e.setOffset(0)}),E()};VC(r)?rr().then(n):n()},O=()=>D(a.active),te,ne=t=>{!e.touchable||t.touches.length>1||(s.start(t),o=!1,te=Date.now(),T(),S())},re=n=>{e.touchable&&a.swiping&&(s.move(n),_.value&&(!e.loop&&(a.active===0&&f.value>0||a.active===u.value-1&&f.value<0)||(BC(n,e.stopPropagation),x({offset:f.value}),o||=(t(`dragStart`,{index:g.value}),!0))))},ie=()=>{if(!e.touchable||!a.swiping)return;let n=Date.now()-te,r=f.value/n;if((Math.abs(r)>.25||Math.abs(f.value)>d.value/2)&&_.value){let t=e.vertical?s.offsetY.value:s.offsetX.value,n=0;n=e.loop?t>0?f.value>0?-1:1:0:-Math[f.value>0?`ceil`:`floor`](f.value/d.value),x({pace:n,emitChange:!0})}else f.value&&x({pace:0});o=!1,a.swiping=!1,t(`dragEnd`,{index:g.value}),E()},ae=(t,n={})=>{S(),s.reset(),fC(()=>{let r;r=e.loop&&t===u.value?a.active===0?0:t:t%u.value,n.immediate?fC(()=>{a.swiping=!1}):a.swiping=!1,x({pace:r-a.active,emitChange:!0})})},oe=(t,n)=>{let r=n===g.value;return G(`i`,{style:r?{backgroundColor:e.indicatorColor}:void 0,class:FT(`indicator`,{active:r})},null)},se=()=>{if(n.indicator)return n.indicator({active:g.value,total:u.value});if(e.showIndicators&&u.value>1)return G(`div`,{class:FT(`indicators`,{vertical:e.vertical})},[Array(u.value).fill(``).map(oe)])};return xw({prev:C,next:w,state:a,resize:O,swipeTo:ae}),l({size:d,props:e,count:u,activeIndicator:g}),$r(()=>e.initialSwipe,e=>D(+e)),$r(u,()=>D(a.active)),$r(()=>e.autoplay,E),$r([HC,UC,()=>e.width,()=>e.height],O),$r(NC(),e=>{e===`visible`?E():T()}),Ji(D),Vi(()=>D(a.active)),bw(()=>D(a.active)),Hi(T),Zi(T),SC(`touchmove`,re,{target:i}),()=>G(`div`,{ref:r,class:FT()},[G(`div`,{ref:i,style:v.value,class:FT(`track`,{vertical:e.vertical}),onTouchstartPassive:ne,onTouchend:ie,onTouchcancel:ie},[n.default?.call(n)]),se()])}})),[zT,BT]=fw(`tabs`),VT=Mi({name:zT,props:{count:iC(Number),inited:Boolean,animated:Boolean,duration:iC(nC),swipeable:Boolean,lazyRender:Boolean,currentIndex:iC(Number)},emits:[`change`],setup(e,{emit:t,slots:n}){let r=P(),i=e=>t(`change`,e),a=()=>{let t=n.default?.call(n);return e.animated||e.swipeable?G(RT,{ref:r,loop:!1,class:BT(`track`),duration:e.duration*1e3,touchable:e.swipeable,lazyRender:e.lazyRender,showIndicators:!1,onChange:i},{default:()=>[t]}):t},o=t=>{let n=r.value;n&&n.state.active!==t&&n.swipeTo(t,{immediate:!e.inited})};return $r(()=>e.currentIndex,o),Ji(()=>{o(e.currentIndex)}),xw({swipeRef:r}),()=>G(`div`,{class:BT(`content`,{animated:e.animated||e.swipeable})},[a()])}}),[HT,UT]=fw(`tabs`),WT={type:cC(`line`),color:String,border:Boolean,sticky:Boolean,shrink:Boolean,active:sC(0),duration:sC(.3),animated:Boolean,ellipsis:rC,swipeable:Boolean,scrollspy:Boolean,offsetTop:sC(0),background:String,lazyRender:rC,showHeader:rC,lineWidth:nC,lineHeight:nC,beforeChange:Function,swipeThreshold:sC(5),titleActiveColor:String,titleInactiveColor:String},GT=Symbol(HT),KT=Mi({name:HT,props:WT,emits:[`change`,`scroll`,`rendered`,`clickTab`,`update:active`],setup(e,{emit:t,slots:n}){let r,i,a,o,s,c=P(),l=P(),u=P(),d=P(),f=OT(),p=jC(c),[m,h]=kT(),{children:g,linkChildren:_}=bC(GT),v=cn({inited:!1,position:``,lineStyle:{},currentIndex:-1}),y=Zs(()=>g.length>+e.swipeThreshold||!e.ellipsis||e.shrink),b=Zs(()=>({borderColor:e.color,background:e.background})),x=(e,t)=>e.name??t,S=Zs(()=>{let e=g[v.currentIndex];if(e)return x(e,v.currentIndex)}),C=Zs(()=>QC(e.offsetTop)),w=Zs(()=>e.sticky?C.value+r:0),ee=t=>{let n=l.value,r=m.value;if(!y.value||!n||!r||!r[v.currentIndex])return;let i=r[v.currentIndex].$el,a=i.offsetLeft-(n.offsetWidth-i.offsetWidth)/2;o&&o(),o=TT(n,a,t?0:+e.duration)},T=()=>{let t=v.inited;rr(()=>{let n=m.value;if(!n||!n[v.currentIndex]||e.type!==`line`||VC(c.value))return;let r=n[v.currentIndex].$el,{lineWidth:i,lineHeight:a}=e,o=r.offsetLeft+r.offsetWidth/2,s={width:WC(i),backgroundColor:e.color,transform:`translateX(${o}px) translateX(-50%)`};if(t&&(s.transitionDuration=`${e.duration}s`),JS(a)){let e=WC(a);s.height=e,s.borderRadius=e}v.lineStyle=s})},E=e=>{let t=e<v.currentIndex?-1:1;for(;e>=0&&e<g.length;){if(!g[e].disabled)return e;e+=t}},D=(n,r)=>{let i=E(n);if(!JS(i))return;let o=g[i],s=x(o,i),l=v.currentIndex!==null;v.currentIndex!==i&&(v.currentIndex=i,r||ee(),T()),s!==e.active&&(t(`update:active`,s),l&&t(`change`,s,o.title)),a&&!e.scrollspy&&LC(Math.ceil(RC(c.value)-C.value))},O=(e,t)=>{let n=g.findIndex((t,n)=>x(t,n)===e);D(n===-1?0:n,t)},te=(t=!1)=>{if(e.scrollspy){let n=g[v.currentIndex].$el;if(n&&p.value){let r=RC(n,p.value)-w.value;i=!0,s&&s(),s=ET(p.value,r,t?0:+e.duration,()=>{i=!1})}}},ne=(n,r,i)=>{let{title:a,disabled:o}=g[r],s=x(g[r],r);o||(_w(e.beforeChange,{args:[s],done:()=>{D(r),te()}}),Cw(n)),t(`clickTab`,{name:s,title:a,event:i,disabled:o})},re=e=>{a=e.isFixed,t(`scroll`,e)},ie=e=>{rr(()=>{O(e),te(!0)})},ae=()=>{for(let e=0;e<g.length;e++){let{top:t}=hC(g[e].$el);if(t>w.value)return e===0?0:e-1}return g.length-1},oe=()=>{if(e.scrollspy&&!i){let e=ae();D(e)}},se=()=>{if(e.type===`line`&&g.length)return G(`div`,{class:UT(`line`),style:v.lineStyle},null)},ce=()=>{let{type:t,border:r,sticky:i}=e,a=[G(`div`,{ref:i?void 0:u,class:[UT(`wrap`),{[mw]:t===`line`&&r}]},[G(`div`,{ref:l,role:`tablist`,class:UT(`nav`,[t,{shrink:e.shrink,complete:y.value}]),style:b.value,"aria-orientation":`horizontal`},[n[`nav-left`]?.call(n),g.map(e=>e.renderTitle(ne)),se(),n[`nav-right`]?.call(n)])]),n[`nav-bottom`]?.call(n)];return i?G(`div`,{ref:u},[a]):a},le=()=>{T(),rr(()=>{var e;ee(!0),(e=d.value?.swipeRef.value)==null||e.resize()})};return $r(()=>[e.color,e.duration,e.lineWidth,e.lineHeight],T),$r(HC,le),$r(()=>e.active,e=>{e!==S.value&&O(e)}),$r(()=>g.length,()=>{v.inited&&(O(e.active),T(),rr(()=>{ee(!0)}))}),xw({resize:le,scrollTo:ie}),Vi(T),bw(T),xC(()=>{O(e.active,!0),rr(()=>{v.inited=!0,u.value&&(r=hC(u.value).height),ee(!0)})}),AT(c,T),SC(`scroll`,oe,{target:p,passive:!0}),_({id:f,props:e,setLine:T,scrollable:y,onRendered:(e,n)=>t(`rendered`,e,n),currentName:S,setTitleRefs:h,scrollIntoView:ee}),()=>G(`div`,{ref:c,class:UT([e.type])},[e.showHeader?e.sticky?G(NT,{container:c.value,offsetTop:C.value,onScroll:re},{default:()=>[ce()]}):ce():null,G(VT,{ref:d,count:g.length,inited:v.inited,animated:e.animated,duration:e.duration,swipeable:e.swipeable,lazyRender:e.lazyRender,currentIndex:v.currentIndex,onChange:D},{default:()=>[n.default?.call(n)]})])}}),qT=Symbol(),JT=Symbol(),YT=()=>Yr(JT,null),XT=e=>{let t=YT();Jr(qT,e),Jr(JT,Zs(()=>(t==null||t.value)&&e.value))},[ZT,QT]=fw(`tab`),$T=Mi({name:ZT,props:{id:String,dot:Boolean,type:String,color:String,title:String,badge:nC,shrink:Boolean,isActive:Boolean,disabled:Boolean,controls:String,scrollable:Boolean,activeColor:String,inactiveColor:String,showZeroBadge:rC},setup(e,{slots:t}){let n=Zs(()=>{let t={},{type:n,color:r,disabled:i,isActive:a,activeColor:o,inactiveColor:s}=e;r&&n===`card`&&(t.borderColor=r,i||(a?t.backgroundColor=r:t.color=r));let c=a?o:s;return c&&(t.color=c),t}),r=()=>{let n=G(`span`,{class:QT(`text`,{ellipsis:!e.scrollable})},[t.title?t.title():e.title]);return e.dot||JS(e.badge)&&e.badge!==``?G(Ew,{dot:e.dot,content:e.badge,showZero:e.showZeroBadge},{default:()=>[n]}):n};return()=>G(`div`,{id:e.id,role:`tab`,class:[QT([e.type,{grow:e.scrollable&&!e.shrink,shrink:e.shrink,active:e.isActive,disabled:e.disabled}])],style:n.value,tabindex:e.disabled?void 0:e.isActive?0:-1,"aria-selected":e.isActive,"aria-disabled":e.disabled||void 0,"aria-controls":e.controls,"data-allow-mismatch":`attribute`},[r()])}}),[eE,tE]=fw(`swipe-item`),nE=vw(Mi({name:eE,setup(e,{slots:t}){let n,r=cn({offset:0,inited:!1,mounted:!1}),{parent:i,index:a}=gC(LT);if(!i){console.error(`[Vant] <SwipeItem> must be a child component of <Swipe>.`);return}let o=Zs(()=>{let e={},{vertical:t}=i.props;return i.size.value&&(e[t?`height`:`width`]=`${i.size.value}px`),r.offset&&(e.transform=`translate${t?`Y`:`X`}(${r.offset}px)`),e}),s=Zs(()=>{let{loop:e,lazyRender:t}=i.props;if(!t||n)return!0;if(!r.mounted)return!1;let o=i.activeIndicator.value,s=i.count.value-1,c=o===0&&e?s:o-1,l=o===s&&e?0:o+1;return n=a.value===o||a.value===c||a.value===l,n});return Ji(()=>{rr(()=>{r.mounted=!0})}),xw({setOffset:e=>{r.offset=e}}),()=>G(`div`,{class:tE(),style:o.value},[s.value?t.default?.call(t):null])}})),[rE,iE]=fw(`tab`);vw(Mi({name:rE,props:GS({},Sw,{dot:Boolean,name:nC,badge:nC,title:String,disabled:Boolean,titleClass:null,titleStyle:[String,Object],showZeroBadge:rC}),setup(e,{slots:t}){let n=OT(),r=P(!1),i=Os(),{parent:a,index:o}=gC(GT);if(!a){console.error(`[Vant] <Tab> must be a child component of <Tabs>.`);return}let s=()=>e.name??o.value,c=()=>{r.value=!0,a.props.lazyRender&&rr(()=>{a.onRendered(s(),e.title)})},l=Zs(()=>{let e=s()===a.currentName.value;return e&&!r.value&&c(),e}),u=P(``),d=P(``);Qr(()=>{let{titleClass:t,titleStyle:n}=e;u.value=t?j(t):``,d.value=n&&typeof n!=`string`?Ee(A(n)):n});let f=r=>G($T,xs({key:n,id:`${a.id}-${o.value}`,ref:a.setTitleRefs(o.value),style:d.value,class:u.value,isActive:l.value,controls:n,scrollable:a.scrollable.value,activeColor:a.props.titleActiveColor,inactiveColor:a.props.titleInactiveColor,onClick:e=>r(i.proxy,o.value,e)},eC(a.props,[`type`,`color`,`shrink`]),eC(e,[`dot`,`badge`,`title`,`disabled`,`showZeroBadge`])),{title:t.title}),p=P(!l.value);return $r(l,e=>{e?p.value=!1:fC(()=>{p.value=!0})}),$r(()=>e.title,()=>{a.setLine(),a.scrollIntoView()}),XT(l),xw({id:n,renderTitle:f}),()=>{let e=`${a.id}-${o.value}`,{animated:i,swipeable:s,scrollspy:c,lazyRender:u}=a.props;if(!t.default&&!i)return;let d=c||l.value;if(i||s)return G(nE,{id:n,role:`tabpanel`,class:iE(`panel-wrapper`,{inactive:p.value}),tabindex:l.value?0:-1,"aria-hidden":!l.value,"aria-labelledby":e,"data-allow-mismatch":`attribute`},{default:()=>[G(`div`,{class:iE(`panel`)},[t.default?.call(t)])]});let f=r.value||c||!u?t.default?.call(t):null;return L(G(`div`,{id:n,role:`tabpanel`,class:iE(`panel`),tabindex:d?0:-1,"aria-labelledby":e,"data-allow-mismatch":`attribute`},[f]),[[Nc,d]])}}})),vw(KT);var[aE,oE]=fw(`picker-group`),sE=Symbol(aE);GS({tabs:aC(),activeTab:sC(0),nextStepText:String,showToolbar:rC},xT);var cE=vw(Mi({name:nT,props:GS({},GS({loading:Boolean,readonly:Boolean,allowHtml:Boolean,optionHeight:sC(44),showToolbar:rC,swipeDuration:sC(1e3),visibleOptionNum:sC(6)},xT),{columns:aC(),modelValue:aC(),toolbarPosition:cC(`top`),columnsFieldNames:Object}),emits:[`confirm`,`cancel`,`change`,`scrollInto`,`clickOption`,`update:modelValue`],setup(e,{emit:t,slots:n}){let r=P(),i=P(e.modelValue.slice(0)),{parent:a}=gC(sE),{children:o,linkChildren:s}=bC(vT);s();let c=Zs(()=>fT(e.columnsFieldNames)),l=Zs(()=>QC(e.optionHeight)),u=Zs(()=>oT(e.columns,c.value)),d=Zs(()=>{let{columns:t}=e;switch(u.value){case`multiple`:return t;case`cascade`:return uT(t,c.value,i);default:return[t]}}),f=Zs(()=>d.value.some(e=>e.length)),p=Zs(()=>d.value.map((e,t)=>lT(e,i.value[t],c.value))),m=Zs(()=>d.value.map((e,t)=>e.findIndex(e=>e[c.value.value]===i.value[t]))),h=(e,t)=>{if(i.value[e]!==t){let n=i.value.slice(0);n[e]=t,i.value=n}},g=()=>({selectedValues:i.value.slice(0),selectedOptions:p.value,selectedIndexes:m.value}),_=(e,n)=>{h(n,e),u.value===`cascade`&&i.value.forEach((e,t)=>{let n=d.value[t];cT(n,e,c.value)||h(t,n.length?n[0][c.value.value]:void 0)}),rr(()=>{t(`change`,GS({columnIndex:n},g()))})},v=(e,n)=>{let r={columnIndex:n,currentOption:e};t(`clickOption`,GS(g(),r)),t(`scrollInto`,r)},y=()=>{o.forEach(e=>e.stopMomentum());let e=g();return rr(()=>{t(`confirm`,g())}),e},b=()=>t(`cancel`,g()),x=()=>d.value.map((r,a)=>G(yT,{value:i.value[a],fields:c.value,options:r,readonly:e.readonly,allowHtml:e.allowHtml,optionHeight:l.value,swipeDuration:e.swipeDuration,visibleOptionNum:e.visibleOptionNum,onChange:e=>_(e,a),onClickOption:e=>v(e,a),onScrollInto:e=>{t(`scrollInto`,{currentOption:e,columnIndex:a})}},{option:n.option})),S=e=>{if(f.value){let t={height:`${l.value}px`},n={backgroundSize:`100% ${(e-l.value)/2}px`};return[G(`div`,{class:rT(`mask`),style:n},null),G(`div`,{class:[hw,rT(`frame`)],style:t},null)]}},C=()=>{let t=l.value*+e.visibleOptionNum,i={height:`${t}px`};return!e.loading&&!f.value&&n.empty?n.empty():G(`div`,{ref:r,class:rT(`columns`),style:i},[x(),S(t)])},w=()=>{if(e.showToolbar&&!a)return G(wT,xs(eC(e,CT),{onConfirm:y,onCancel:b}),eC(n,ST))},ee=e=>{e.forEach((e,t)=>{e.length&&!cT(e,i.value[t],c.value)&&h(t,aT(e)[c.value.value])})};$r(d,e=>ee(e),{immediate:!0});let T;return $r(()=>e.modelValue,t=>{!tC(t,i.value)&&!tC(t,T)&&(i.value=t.slice(0),T=t.slice(0)),e.modelValue.length===0&&ee(d.value)},{deep:!0}),$r(i,n=>{tC(n,e.modelValue)||(T=n.slice(0),t(`update:modelValue`,T))},{immediate:!0}),SC(`touchmove`,BC,{target:r}),xw({confirm:y,getSelectedOptions:()=>p.value}),()=>G(`div`,{class:rT()},[e.toolbarPosition===`top`?w():null,e.loading?G(Bw,{class:rT(`loading`)},null):null,n[`columns-top`]?.call(n),C(),n[`columns-bottom`]?.call(n),e.toolbarPosition===`bottom`?w():null])}})),lE=0;function uE(e){e?(lE||document.body.classList.add(`van-toast--unclickable`),lE++):lE&&(lE--,lE||document.body.classList.remove(`van-toast--unclickable`))}var[dE,fE]=fw(`toast`),pE=[`show`,`overlay`,`teleport`,`transition`,`overlayClass`,`overlayStyle`,`closeOnClickOverlay`,`zIndex`],mE=Mi({name:dE,props:{icon:String,show:Boolean,type:cC(`text`),overlay:Boolean,message:nC,iconSize:nC,duration:oC(2e3),position:cC(`middle`),teleport:[String,Object],wordBreak:String,className:null,iconPrefix:String,transition:cC(`van-fade`),loadingType:String,forbidClick:Boolean,overlayClass:null,overlayStyle:Object,closeOnClick:Boolean,closeOnClickOverlay:Boolean,zIndex:nC},emits:[`update:show`],setup(e,{emit:t,slots:n}){let r,i=!1,a=()=>{let t=e.show&&e.forbidClick;i!==t&&(i=t,uE(i))},o=e=>t(`update:show`,e),s=()=>{e.closeOnClick&&o(!1)},c=()=>clearTimeout(r),l=()=>{let{icon:t,type:n,iconSize:r,iconPrefix:i,loadingType:a}=e;if(t||n===`success`||n===`fail`)return G(Fw,{name:t||n,size:r,class:fE(`icon`),classPrefix:i},null);if(n===`loading`)return G(Bw,{class:fE(`loading`),size:r,type:a},null)},u=()=>{let{type:t,message:r}=e;if(n.message)return G(`div`,{class:fE(`text`)},[n.message()]);if(JS(r)&&r!==``)return t===`html`?G(`div`,{key:0,class:fE(`text`),innerHTML:String(r)},null):G(`div`,{class:fE(`text`)},[r])};return $r(()=>[e.show,e.forbidClick],a),$r(()=>[e.show,e.type,e.message,e.duration],()=>{c(),e.show&&e.duration>0&&(r=setTimeout(()=>{o(!1)},e.duration))}),Ji(a),Qi(a),()=>G(tT,xs({class:[fE([e.position,e.wordBreak===`normal`?`break-normal`:e.wordBreak,{[e.type]:!e.icon}]),e.className],lockScroll:!1,onClick:s,onClosed:c,"onUpdate:show":o},eC(e,pE)),{default:()=>[l(),u()]})}});function hE(){let e=cn({show:!1}),t=t=>{e.show=t},n=n=>{GS(e,n,{transitionAppear:!0}),t(!0)},r=()=>t(!1);return xw({open:n,close:r,toggle:t}),{open:n,close:r,state:e,toggle:t}}function gE(e){let t=Fl(e),n=document.createElement(`div`);return document.body.appendChild(n),{instance:t.mount(n),unmount(){t.unmount(),document.body.removeChild(n)}}}var _E={icon:``,type:`text`,message:``,className:``,overlay:!1,onClose:void 0,onOpened:void 0,duration:2e3,teleport:`body`,iconSize:void 0,iconPrefix:void 0,position:`middle`,transition:`van-fade`,forbidClick:!1,loadingType:void 0,overlayClass:``,overlayStyle:void 0,closeOnClick:!1,closeOnClickOverlay:!1},vE=[],yE=GS({},_E),bE=new Map;function xE(e){return qS(e)?e:{message:e}}function SE(){let{instance:e,unmount:t}=gE({setup(){let e=P(``),{open:t,state:n,close:r,toggle:i}=hE(),a=()=>{},o=()=>G(mE,xs(n,{onClosed:a,"onUpdate:show":i}),null);return $r(e,e=>{n.message=e}),Os().render=o,{open:t,close:r,message:e}}});return e}function CE(){if(!vE.length){let e=SE();vE.push(e)}return vE[vE.length-1]}function wE(e={}){if(!KS)return{};let t=CE(),n=xE(e);return t.open(GS({},yE,bE.get(n.type||yE.type),n)),t}var TE=e=>{vE.length&&(e?(vE.forEach(e=>{e.close()}),vE=[]):vE[0].close())},[EE,DE]=fw(`key`),OE=G(`svg`,{class:DE(`collapse-icon`),viewBox:`0 0 30 24`},[G(`path`,{d:`M26 13h-2v2h2v-2zm-8-3h2V8h-2v2zm2-4h2V4h-2v2zm2 4h4V4h-2v4h-2v2zm-7 14 3-3h-6l3 3zM6 13H4v2h2v-2zm16 0H8v2h14v-2zm-12-3h2V8h-2v2zM28 0l1 1 1 1v15l-1 2H1l-1-2V2l1-1 1-1zm0 2H2v15h26V2zM6 4v2H4V4zm10 2h2V4h-2v2zM8 9v1H4V8zm8 0v1h-2V8zm-6-5v2H8V4zm4 0v2h-2V4z`,fill:`currentColor`},null)]),kE=G(`svg`,{class:DE(`delete-icon`),viewBox:`0 0 32 22`},[G(`path`,{d:`M28 0a4 4 0 0 1 4 4v14a4 4 0 0 1-4 4H10.4a2 2 0 0 1-1.4-.6L1 13.1c-.6-.5-.9-1.3-.9-2 0-1 .3-1.7.9-2.2L9 .6a2 2 0 0 1 1.4-.6zm0 2H10.4l-8.2 8.3a1 1 0 0 0-.3.7c0 .3.1.5.3.7l8.2 8.4H28a2 2 0 0 0 2-2V4c0-1.1-.9-2-2-2zm-5 4a1 1 0 0 1 .7.3 1 1 0 0 1 0 1.4L20.4 11l3.3 3.3c.2.2.3.5.3.7 0 .3-.1.5-.3.7a1 1 0 0 1-.7.3 1 1 0 0 1-.7-.3L19 12.4l-3.4 3.3a1 1 0 0 1-.6.3 1 1 0 0 1-.7-.3 1 1 0 0 1-.3-.7c0-.2.1-.5.3-.7l3.3-3.3-3.3-3.3A1 1 0 0 1 14 7c0-.3.1-.5.3-.7A1 1 0 0 1 15 6a1 1 0 0 1 .6.3L19 9.6l3.3-3.3A1 1 0 0 1 23 6z`,fill:`currentColor`},null)]),AE=Mi({name:EE,props:{type:String,text:nC,color:String,wider:Boolean,large:Boolean,loading:Boolean},emits:[`press`],setup(e,{emit:t,slots:n}){let r=P(!1),i=Uw(),a=e=>{i.start(e),r.value=!0},o=e=>{i.move(e),i.direction.value&&(r.value=!1)},s=i=>{r.value&&(n.default||BC(i),r.value=!1,t(`press`,e.text,e.type))},c=()=>{if(e.loading)return G(Bw,{class:DE(`loading-icon`)},null);let t=n.default?n.default():e.text;switch(e.type){case`delete`:return t||kE;case`extra`:return t||OE;default:return t}};return()=>G(`div`,{class:DE(`wrapper`,{wider:e.wider}),onTouchstartPassive:a,onTouchmovePassive:o,onTouchend:s,onTouchcancel:s},[G(`div`,{role:`button`,tabindex:0,class:DE([e.color,{large:e.large,active:r.value,delete:e.type===`delete`}])},[c()])])}}),[jE,ME]=fw(`number-keyboard`),NE={show:Boolean,title:String,theme:cC(`default`),zIndex:nC,teleport:[String,Object],maxlength:sC(1/0),modelValue:cC(``),transition:rC,blurOnClose:rC,showDeleteKey:rC,randomKeyOrder:Boolean,closeButtonText:String,deleteButtonText:String,closeButtonLoading:Boolean,hideOnClickOutside:rC,safeAreaInsetBottom:rC,extraKey:{type:[String,Array],default:``}};function PE(e){for(let t=e.length-1;t>0;t--){let n=Math.floor(Math.random()*(t+1)),r=e[t];e[t]=e[n],e[n]=r}return e}var FE=vw(Mi({name:jE,inheritAttrs:!1,props:NE,emits:[`show`,`hide`,`blur`,`input`,`close`,`delete`,`update:modelValue`],setup(e,{emit:t,slots:n,attrs:r}){let i=P(),a=()=>{let t=Array(9).fill(``).map((e,t)=>({text:t+1}));return e.randomKeyOrder&&PE(t),t},o=()=>[...a(),{text:e.extraKey,type:`extra`},{text:0},{text:e.showDeleteKey?e.deleteButtonText:``,type:e.showDeleteKey?`delete`:``}],s=()=>{let t=a(),{extraKey:n}=e,r=Array.isArray(n)?n:[n];return r.length===0?t.push({text:0,wider:!0}):r.length===1?t.push({text:0,wider:!0},{text:r[0],type:`extra`}):r.length===2&&t.push({text:r[0],type:`extra`},{text:0},{text:r[1],type:`extra`}),t},c=Zs(()=>e.theme===`custom`?s():o()),l=()=>{e.show&&t(`blur`)},u=()=>{t(`close`),e.blurOnClose&&l()},d=()=>t(e.show?`show`:`hide`),f=(n,r)=>{if(n===``){r===`extra`&&l();return}let i=e.modelValue;r===`delete`?(t(`delete`),t(`update:modelValue`,i.slice(0,i.length-1))):r===`close`?u():i.length<+e.maxlength&&(t(`input`,n),t(`update:modelValue`,i+n))},p=()=>{let{title:t,theme:r,closeButtonText:i}=e,a=n[`title-left`],o=i&&r==="default";if(t||o||a)return G(`div`,{class:ME(`header`)},[a&&G(`span`,{class:ME(`title-left`)},[a()]),t&&G(`h2`,{class:ME(`title`)},[t]),o&&G(`button`,{type:`button`,class:[ME(`close`),`van-haptics-feedback`],onClick:u},[i])])},m=()=>c.value.map(e=>{let t={};return e.type===`delete`&&(t.default=n.delete),e.type===`extra`&&(t.default=n[`extra-key`]),G(AE,{key:e.text,text:e.text,type:e.type,wider:e.wider,color:e.color,onPress:f},t)}),h=()=>{if(e.theme===`custom`)return G(`div`,{class:ME(`sidebar`)},[e.showDeleteKey&&G(AE,{large:!0,text:e.deleteButtonText,type:`delete`,onPress:f},{default:n.delete}),G(AE,{large:!0,text:e.closeButtonText,type:`close`,color:`blue`,loading:e.closeButtonLoading,onPress:f},null)])};return $r(()=>e.show,n=>{e.transition||t(n?`show`:`hide`)}),e.hideOnClickOutside&&CC(i,l,{eventName:`touchstart`}),()=>{let t=p(),n=G(hc,{name:e.transition?`van-slide-up`:``},{default:()=>[L(G(`div`,xs({ref:i,style:KC(e.zIndex),class:ME({unfit:!e.safeAreaInsetBottom,"with-title":!!t}),onAnimationend:d,onTouchstartPassive:zC},r),[t,G(`div`,{class:ME(`body`)},[G(`div`,{class:ME(`keys`)},[m()]),h()])]),[[Nc,e.show]])]});return e.teleport?G(mi,{to:e.teleport},{default:()=>[n]}):n}}})),IE=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21],LE=Array(64);for(let e=0;e<64;e++)LE[e]=Math.floor(Math.abs(Math.sin(e+1))*4294967296);var RE=(e,t,n)=>e&t|~e&n,zE=(e,t,n)=>e&n|t&~n,BE=(e,t,n)=>e^t^n,VE=(e,t,n)=>t^(e|~n);function HE(e){let t=``;for(let n=0;n<32;n+=8)t+=(e>>>n&255).toString(16).padStart(2,`0`);return t}function UE(e){let t=new TextEncoder().encode(String(e)),n=t.length,r=Math.ceil((n+9)/64)*16,i=new Uint32Array(r);for(let e=0;e<n;e++)i[e>>2]|=t[e]<<e%4*8;i[n>>2]|=128<<n%4*8;let a=n*8;i[r-2]=a>>>0,i[r-1]=Math.floor(a/4294967296);let o=1732584193,s=4023233417,c=2562383102,l=271733878;for(let e=0;e<r;e+=16){let t=o,n=s,r=c,a=l;for(let o=0;o<64;o++){let s,c;o<16?(s=RE(n,r,a),c=o):o<32?(s=zE(n,r,a),c=(5*o+1)%16):o<48?(s=BE(n,r,a),c=(3*o+5)%16):(s=VE(n,r,a),c=7*o%16);let l=a;a=r,r=n;let u=t+s+LE[o]+i[e+c]>>>0,d=IE[(o>>4)*4+o%4];n=((u<<d|u>>>32-d)>>>0)+n>>>0,t=l}o=o+t>>>0,s=s+n>>>0,c=c+r>>>0,l=l+a>>>0}return HE(o)+HE(s)+HE(c)+HE(l)}var WE=cn({dialog:null,picker:null,datePicker:null,keyboard:null,loadingEx:null}),GE=[],KE=0,qE=null,JE=[],YE=0,XE=[],ZE=0,QE=2200;function $E(e,t){if(typeof e==`function`)try{e(t)}catch{}}function eD(){WE.dialog=GE.length?GE.shift():null}function tD(e,t){let n=e||{};GE.push({id:++KE,title:n.title||``,message:n.message==null?``:String(n.message),okButton:n.okButton||`确定`,cancelButton:n.cancelButton||``,clickBgToHide:n.clickBgToHide===!0,cancelGrayStyle:n.cancelGrayStyle===!0,callback:t}),WE.dialog||eD()}function nD(e){let t=WE.dialog;t&&(WE.dialog=null,$E(t.callback,{success:!0,data:{ok:!!e.ok,dismissByClickBg:!!e.dismissByClickBg}}),eD())}function rD(e,t){let n=e||{},r=n.showIcon==null?``:String(n.showIcon),i=r===`1`?`success`:r===`0`?`fail`:`text`;try{wE({type:i,message:n.message==null?``:String(n.message),duration:QE,teleport:document.querySelector(`.phone-viewport`)||void 0})}catch{}$E(t,{success:!0,data:{}})}function iD(e,t){let n=e||{},r=Array.isArray(n.currentValue)?n.currentValue:[];r.length&&Array.isArray(r[0])&&(r=r[0]),JE.push({id:++YE,title:n.title||``,mode:n.mode===`multi`?`multi`:`single`,dataSource:Array.isArray(n.dataSource)?n.dataSource:[],currentValue:r.map(e=>String(e)),callback:t}),WE.picker||aD()}function aD(){WE.picker=JE.length?JE.shift():null}function oD(e,t){let n=WE.picker;if(n){if(WE.picker=null,e){let e={success:!0,error:`0`,data:{result:t},result:t};$E(n.callback,e)}else $E(n.callback,{success:!0,data:{}});aD()}}function sD(e,t){let n=e||{},r=[`year_month_day`,`year_month`,`month_day`].includes(n.type)?n.type:`year_month_day`;XE.push({id:++ZE,title:n.title||``,type:r,startDate:n.startDate||`1970-1-1`,endDate:n.endDate||`2100-12-31`,selectDate:n.selectDate||``,callback:t}),WE.datePicker||cD()}function cD(){WE.datePicker=XE.length?XE.shift():null}function lD(e,t){let n=WE.datePicker;if(n){if(WE.datePicker=null,e){let e={success:!0,error:`0`,currentDate:t.value,data:{year:t.year,month:t.month,day:t.day,value:t.value}};$E(n.callback,e)}else $E(n.callback,{success:!0,data:{}});cD()}}var uD=[`number`,`password`,`idcard`];function dD(e){let t=``;for(let n=0;n<e.length;n++)t+=e.charCodeAt(n).toString(16).padStart(2,`0`);return t}function fD(e){let t=!1,n=!1,r=!1;for(let i of e)i>=`0`&&i<=`9`?t=!0:i>=`a`&&i<=`z`||i>=`A`&&i<=`Z`?n=!0:r=!0;return+!!t+ +!!n+ +!!r}function pD(e){if(!e)return!1;if(/^(.)\1*$/.test(e))return!0;if(e.length>=3){let t=!0,n=!0;for(let r=1;r<e.length;r++){let i=e.charCodeAt(r)-e.charCodeAt(r-1);i!==1&&(t=!1),i!==-1&&(n=!1)}if(t||n)return!0}return!1}function mD(e,t){let n=e.value;return{success:!0,data:{value:e.isEncry?dD(n):n,md5:UE(n),inputSimple:pD(n),inputLevel:fD(n),isMatch:!e.regular||new RegExp(e.regular).test(n),length:n.length,action:t,error:`0`,errorMessage:``}}}function hD(e,t){let n=e||{},r=uD.includes(n.type)?n.type:`number`;WE.keyboard&&vD();let i=n.max==null?n.maxLength:n.max,a=Number(i)>0?Number(i):r===`password`?6:r===`idcard`?18:0,o=n.isEncry===void 0?r!==`number`:!!n.isEncry;WE.keyboard={type:r,maxLength:a,random:n.random===void 0?r!==`number`:!!n.random,extraKey:r===`idcard`?`X`:``,isEncry:o,encryptType:n.encryptType||(o?`SM2SM4`:``),randomKey:n.randomKey||``,regular:n.regular||``,value:``,callback:t}}function gD(e){let t=WE.keyboard;t&&(t.maxLength>0&&t.value.length>=t.maxLength||(t.value+=e,$E(t.callback,mD(t,`input`))))}function _D(){let e=WE.keyboard;e&&e.value&&(e.value=e.value.slice(0,-1),$E(e.callback,mD(e,`input`)))}function vD(){let e=WE.keyboard;e&&(WE.keyboard=null,$E(e.callback,mD(e,`hide`)))}function yD(e,t){vD(),$E(t,{success:!0,data:{}})}function bD(e,t){let n=e||{},r=n.message==null?``:String(n.message),i=Number(n.duration)>0?Number(n.duration):8;qE&&=(clearTimeout(qE),null),WE.loadingEx={message:r},qE=setTimeout(()=>{qE=null,WE.loadingEx=null},i*1e3),$E(t,{success:!0,data:{}})}function xD(e,t){qE&&=(clearTimeout(qE),null),WE.loadingEx=null,$E(t,{success:!0,data:{}})}function SD(e,t){let n=e||{},r=n.text==null?``:String(n.text),i=()=>$E(t,{success:!1,error:`-1`,errorMessage:`复制失败`,data:{}}),a=()=>$E(t,{success:!0,data:{}}),o=()=>{try{let e=document.createElement(`textarea`);e.value=r,e.style.cssText=`position:fixed;opacity:0;pointer-events:none`,document.body.appendChild(e),e.select();let t=document.execCommand(`copy`);return document.body.removeChild(e),t}catch{return!1}};navigator.clipboard&&window.isSecureContext?navigator.clipboard.writeText(r).then(a,()=>o()?a():i()):o()?a():i()}var CD={alertCard:(e,t)=>IS(e,t),closeAlertCard:(e,t)=>LS(e,t),alertDialog:tD,showToast:rD,showPicker:iD,showDatePicker:sD,showKeyboard:hD,hideKeyboard:yD,showLoadingEx:bD,hideLoadingEx:xD,copyToClipboard:SD};function wD(e){typeof window<`u`&&(window.ynet={callJSAPI(t,n,r){e&&e.pushApiCall&&e.pushApiCall(t,n);let i=CD[t];i?i(n,r):$E(r,{success:!0,data:{}})}})}function TD(){GE.length=0,WE.dialog=null;try{TE()}catch{}JE.length=0,WE.picker=null,XE.length=0,WE.datePicker=null,WE.keyboard=null,qE&&=(clearTimeout(qE),null),WE.loadingEx=null}var ED={name:`DeviceOverlay`,computed:{dialog(){return WE.dialog}},methods:{onOk(){nD({ok:!0,dismissByClickBg:!1})},onCancel(){nD({ok:!1,dismissByClickBg:!1})},onMaskClick(){this.dialog&&this.dialog.clickBgToHide&&nD({ok:!1,dismissByClickBg:!0})}}},DD={class:`device-ui`},OD={class:`dlg`},kD={key:0,class:`dlg__title`},AD={key:1,class:`dlg__msg`},jD={class:`dlg__btns`};function MD(e,t,n,r,i,a){return V(),H(`div`,DD,[q(` alertDialog:原生风格居中确认对话框 `),G(hc,{name:`dlg-fade`},{default:I(()=>[a.dialog?(V(),H(`div`,{key:0,class:`dlg-mask`,onClick:t[2]||=J((...e)=>a.onMaskClick&&a.onMaskClick(...e),[`self`])},[W(`div`,OD,[a.dialog.title?(V(),H(`div`,kD,M(a.dialog.title),1)):q(`v-if`,!0),a.dialog.message?(V(),H(`div`,AD,M(a.dialog.message),1)):q(`v-if`,!0),W(`div`,jD,[a.dialog.cancelButton?(V(),H(`button`,{key:0,type:`button`,class:j([`dlg__btn dlg__btn--cancel`,{"dlg__btn--gray":a.dialog.cancelGrayStyle}]),onClick:t[0]||=(...e)=>a.onCancel&&a.onCancel(...e)},M(a.dialog.cancelButton),3)):q(`v-if`,!0),W(`button`,{type:`button`,class:`dlg__btn dlg__btn--ok`,onClick:t[1]||=(...e)=>a.onOk&&a.onOk(...e)},M(a.dialog.okButton),1)])])])):q(`v-if`,!0)]),_:1})])}var ND=Z(ED,[[`render`,MD],[`__file`,`/Users/ynet/dsl-card/card-editor/components/DeviceOverlay.vue`]]),PD=0,FD=!1;typeof document<`u`&&(document.addEventListener(`touchmove`,()=>{FD=!0},{capture:!0,passive:!0}),document.addEventListener(`touchend`,()=>{FD&&(PD=Date.now()),FD=!1},{capture:!0}));function ID(){return Date.now()-PD<200}var LD={name:`PickerOverlay`,components:{VanPicker:cE},data(){return{selKeys:[],OPTION_H:44,VISIBLE_N:5,SWIPE_MS:240}},computed:{picker(){return WE.picker},fieldNames(){return{text:`text`,value:`key`,children:`children`}},columns(){if(!this.picker)return[];let e=this.picker.dataSource||[];return this.picker.mode===`multi`?e.map(e=>({text:e.text,key:String(e.key),children:e.children||[]})):e.map(e=>({text:e.text,key:String(e.key)}))}},watch:{picker:{immediate:!0,handler(e){if(!e){this.selKeys=[];return}let t=e.dataSource||[],n=(e.currentValue||[]).map(e=>String(e));if(e.mode===`multi`){let e=t.find(e=>String(e.key)===n[0])||t[0],r=e&&e.children||[],i=r.find(e=>String(e.key)===n[1])||r[0];this.selKeys=[e?String(e.key):``,i?String(i.key):``]}else{let e=t.find(e=>String(e.key)===n[0])||t[0];this.selKeys=[e?String(e.key):``]}}}},methods:{onChange(e){this.selKeys=(e.selectedValues||[]).map(e=>String(e))},buildResult(){let e=this.picker;if(!e)return[];let t=e.dataSource||[],n=e=>({key:String(e.key),text:e.text,value:e.text});if(e.mode===`multi`){let e=t.find(e=>String(e.key)===this.selKeys[0])||t[0],r=e&&e.children||[],i=r.find(e=>String(e.key)===this.selKeys[1])||r[0],a=[];return e&&a.push(n(e)),i&&a.push(n(i)),a}let r=t.find(e=>String(e.key)===this.selKeys[0])||t[0];return r?[n(r)]:[]},onConfirm(){oD(!0,this.buildResult())},onMaskClick(){ID()||this.onCancel()},onCancel(){oD(!1)}}},RD={class:`device-ui`},zD={class:`pk-sheet`},BD={class:`pk-bar`},VD={key:0,class:`pk-bar__title`};function HD(e,t,n,r,i,a){let o=R(`van-picker`);return V(),H(`div`,RD,[G(hc,{name:`picker-fade`},{default:I(()=>[a.picker?(V(),H(`div`,{key:0,class:`pk-mask`,onClick:t[2]||=J((...e)=>a.onMaskClick&&a.onMaskClick(...e),[`self`])},[W(`div`,zD,[W(`div`,BD,[W(`button`,{type:`button`,class:`pk-bar__btn pk-bar__btn--cancel`,onClick:t[0]||=(...e)=>a.onCancel&&a.onCancel(...e)},`取消`),a.picker.title?(V(),H(`div`,VD,M(a.picker.title),1)):q(`v-if`,!0),W(`button`,{type:`button`,class:`pk-bar__btn pk-bar__btn--ok`,onClick:t[1]||=(...e)=>a.onConfirm&&a.onConfirm(...e)},`确定`)]),q(` ⚠️ vant 4 属性名是 option-height / visible-option-num(Vant 2 的
248
248
  item-height / visible-item-count 已改名):写错不报错、静默落默认值
249
- (optionHeight=44 / visibleOptionNum=6),滚轮会被拉成 6 槽。 `),G(o,{columns:a.columns,"columns-field-names":a.fieldNames,"model-value":i.selKeys,"option-height":i.OPTION_H,"visible-option-num":i.VISIBLE_N,"swipe-duration":i.SWIPE_MS,"show-toolbar":!1,onChange:a.onChange},null,8,[`columns`,`columns-field-names`,`model-value`,`option-height`,`visible-option-num`,`swipe-duration`,`onChange`])])])):q(`v-if`,!0)]),_:1})])}var HD=Z(ID,[[`render`,VD],[`__file`,`/Users/ynet/dsl-card/card-editor/components/PickerOverlay.vue`]]);function UD(e){return String(e).padStart(2,`0`)}function WD(e,t){let n=[];for(let r=e;r<=t;r++)n.push(r);return n}function GD(e,t){return[31,e%4==0&&e%100!=0||e%400==0?29:28,31,30,31,30,31,31,30,31,30,31][(t-1+12)%12]}function KD(e){if(!e)return null;let t=String(e).split(`-`).map(e=>parseInt(e,10));return t.some(e=>Number.isNaN(e))?null:t.length===3?{y:t[0],m:t[1],d:t[2]}:t.length===2?{m:t[0],d:t[1]}:null}var qD={name:`DatePickerOverlay`,components:{VanPicker:sE},data(){return{sel:[],OPTION_H:44,VISIBLE_N:5,SWIPE_MS:240}},computed:{datePicker(){return UE.datePicker},yearRange(){let e=this.datePicker,t=KD(e&&e.startDate)||{y:1970},n=KD(e&&e.endDate)||{y:2100};return{minY:t.y||1970,maxY:n.y||2100}},columns(){let e=this.datePicker;if(!e)return[];let{minY:t}=this.yearRange;if(e.type===`month_day`)return[{key:`month`,items:WD(1,12).map(e=>({text:UD(e)}))},{key:`day`,items:WD(1,31).map(e=>({text:UD(e)}))}];if(e.type===`year_month`)return[{key:`year`,items:WD(t,this.yearRange.maxY).map(e=>({text:String(e)}))},{key:`month`,items:WD(1,12).map(e=>({text:UD(e)}))}];let n=GD(t+(this.sel[0]||0),(this.sel[1]||0)+1);return[{key:`year`,items:WD(t,this.yearRange.maxY).map(e=>({text:String(e)}))},{key:`month`,items:WD(1,12).map(e=>({text:UD(e)}))},{key:`day`,items:WD(1,n).map(e=>({text:UD(e)}))}]},dateColumns(){return this.columns.map(e=>e.items.map(e=>({text:e.text,value:e.text})))},selectedValues(){return this.columns.map((e,t)=>{let n=e.items[this.sel[t]||0];return n?n.text:``})}},watch:{datePicker:{immediate:!0,handler(e){if(!e){this.sel=[];return}let t=KD(e.selectDate)||this.todayConstrained(e),{minY:n}=this.yearRange;if(e.type===`month_day`)this.sel=[t.m-1,t.d-1];else if(e.type===`year_month`)this.sel=[t.y-n,t.m-1];else{let e=GD(t.y,t.m);this.sel=[t.y-n,t.m-1,Math.min(t.d,e)-1]}}},sel:{deep:!0,handler(){let e=this.datePicker;if(!e||e.type!==`year_month_day`)return;let t=this.sel.slice(),n=GD(this.yearRange.minY+(t[0]||0),(t[1]||0)+1);t[2]>n-1&&(t[2]=n-1,this.sel=t)}}},methods:{onChange(e){let t=(e.selectedIndexes||[]).slice(),n=this.datePicker;if(n&&n.type===`year_month_day`&&(e.columnIndex===0||e.columnIndex===1)){let e=GD(this.yearRange.minY+(t[0]||0),(t[1]||0)+1);t[2]>e-1&&(t[2]=e-1)}this.sel=t},todayConstrained(e){let t=new Date,{minY:n,maxY:r}=this.yearRange,i=t.getFullYear();i=Math.max(n,Math.min(r,i));let a=t.getMonth()+1,o=GD(i,a),s=Math.min(t.getDate(),o);return{y:i,m:a,d:s}},buildResult(){let e=this.datePicker;if(!e)return null;let{minY:t}=this.yearRange,n=``,r=0,i=0;e.type===`month_day`?(r=(this.sel[0]||0)+1,i=(this.sel[1]||0)+1):e.type===`year_month`?(n=t+(this.sel[0]||0),r=(this.sel[1]||0)+1):(n=t+(this.sel[0]||0),r=(this.sel[1]||0)+1,i=(this.sel[2]||0)+1);let a=UD(r),o=UD(i),s;return s=e.type===`year_month_day`?`${n}-${a}-${o}`:e.type===`year_month`?`${n}-${a}`:`${a}-${o}`,{year:e.type===`month_day`?``:String(n),month:a,day:e.type===`year_month`?``:o,value:s}},onConfirm(){cD(!0,this.buildResult())},onMaskClick(){FD()||this.onCancel()},onCancel(){cD(!1)}}},JD={class:`device-ui`},YD={class:`pk-sheet`},XD={class:`pk-bar`},ZD={key:0,class:`pk-bar__title`};function QD(e,t,n,r,i,a){let o=R(`van-picker`);return V(),H(`div`,JD,[G(hc,{name:`picker-fade`},{default:I(()=>[a.datePicker?(V(),H(`div`,{key:0,class:`pk-mask`,onClick:t[2]||=J((...e)=>a.onMaskClick&&a.onMaskClick(...e),[`self`])},[W(`div`,YD,[W(`div`,XD,[W(`button`,{type:`button`,class:`pk-bar__btn pk-bar__btn--cancel`,onClick:t[0]||=(...e)=>a.onCancel&&a.onCancel(...e)},`取消`),a.datePicker.title?(V(),H(`div`,ZD,M(a.datePicker.title),1)):q(`v-if`,!0),W(`button`,{type:`button`,class:`pk-bar__btn pk-bar__btn--ok`,onClick:t[1]||=(...e)=>a.onConfirm&&a.onConfirm(...e)},`确定`)]),q(` ⚠️ vant 4 属性名是 option-height / visible-option-num(Vant 2 的
249
+ (optionHeight=44 / visibleOptionNum=6),滚轮会被拉成 6 槽。 `),G(o,{columns:a.columns,"columns-field-names":a.fieldNames,"model-value":i.selKeys,"option-height":i.OPTION_H,"visible-option-num":i.VISIBLE_N,"swipe-duration":i.SWIPE_MS,"show-toolbar":!1,onChange:a.onChange},null,8,[`columns`,`columns-field-names`,`model-value`,`option-height`,`visible-option-num`,`swipe-duration`,`onChange`])])])):q(`v-if`,!0)]),_:1})])}var UD=Z(LD,[[`render`,HD],[`__file`,`/Users/ynet/dsl-card/card-editor/components/PickerOverlay.vue`]]);function WD(e){return String(e).padStart(2,`0`)}function GD(e,t){let n=[];for(let r=e;r<=t;r++)n.push(r);return n}function KD(e,t){return[31,e%4==0&&e%100!=0||e%400==0?29:28,31,30,31,30,31,31,30,31,30,31][(t-1+12)%12]}function qD(e){if(!e)return null;let t=String(e).split(`-`).map(e=>parseInt(e,10));return t.some(e=>Number.isNaN(e))?null:t.length===3?{y:t[0],m:t[1],d:t[2]}:t.length===2?{m:t[0],d:t[1]}:null}var JD={name:`DatePickerOverlay`,components:{VanPicker:cE},data(){return{sel:[],OPTION_H:44,VISIBLE_N:5,SWIPE_MS:240}},computed:{datePicker(){return WE.datePicker},yearRange(){let e=this.datePicker,t=qD(e&&e.startDate)||{y:1970},n=qD(e&&e.endDate)||{y:2100};return{minY:t.y||1970,maxY:n.y||2100}},columns(){let e=this.datePicker;if(!e)return[];let{minY:t}=this.yearRange;if(e.type===`month_day`)return[{key:`month`,items:GD(1,12).map(e=>({text:WD(e)}))},{key:`day`,items:GD(1,31).map(e=>({text:WD(e)}))}];if(e.type===`year_month`)return[{key:`year`,items:GD(t,this.yearRange.maxY).map(e=>({text:String(e)}))},{key:`month`,items:GD(1,12).map(e=>({text:WD(e)}))}];let n=KD(t+(this.sel[0]||0),(this.sel[1]||0)+1);return[{key:`year`,items:GD(t,this.yearRange.maxY).map(e=>({text:String(e)}))},{key:`month`,items:GD(1,12).map(e=>({text:WD(e)}))},{key:`day`,items:GD(1,n).map(e=>({text:WD(e)}))}]},dateColumns(){return this.columns.map(e=>e.items.map(e=>({text:e.text,value:e.text})))},selectedValues(){return this.columns.map((e,t)=>{let n=e.items[this.sel[t]||0];return n?n.text:``})}},watch:{datePicker:{immediate:!0,handler(e){if(!e){this.sel=[];return}let t=qD(e.selectDate)||this.todayConstrained(e),{minY:n}=this.yearRange;if(e.type===`month_day`)this.sel=[t.m-1,t.d-1];else if(e.type===`year_month`)this.sel=[t.y-n,t.m-1];else{let e=KD(t.y,t.m);this.sel=[t.y-n,t.m-1,Math.min(t.d,e)-1]}}},sel:{deep:!0,handler(){let e=this.datePicker;if(!e||e.type!==`year_month_day`)return;let t=this.sel.slice(),n=KD(this.yearRange.minY+(t[0]||0),(t[1]||0)+1);t[2]>n-1&&(t[2]=n-1,this.sel=t)}}},methods:{onChange(e){let t=(e.selectedIndexes||[]).slice(),n=this.datePicker;if(n&&n.type===`year_month_day`&&(e.columnIndex===0||e.columnIndex===1)){let e=KD(this.yearRange.minY+(t[0]||0),(t[1]||0)+1);t[2]>e-1&&(t[2]=e-1)}this.sel=t},todayConstrained(e){let t=new Date,{minY:n,maxY:r}=this.yearRange,i=t.getFullYear();i=Math.max(n,Math.min(r,i));let a=t.getMonth()+1,o=KD(i,a),s=Math.min(t.getDate(),o);return{y:i,m:a,d:s}},buildResult(){let e=this.datePicker;if(!e)return null;let{minY:t}=this.yearRange,n=``,r=0,i=0;e.type===`month_day`?(r=(this.sel[0]||0)+1,i=(this.sel[1]||0)+1):e.type===`year_month`?(n=t+(this.sel[0]||0),r=(this.sel[1]||0)+1):(n=t+(this.sel[0]||0),r=(this.sel[1]||0)+1,i=(this.sel[2]||0)+1);let a=WD(r),o=WD(i),s;return s=e.type===`year_month_day`?`${n}-${a}-${o}`:e.type===`year_month`?`${n}-${a}`:`${a}-${o}`,{year:e.type===`month_day`?``:String(n),month:a,day:e.type===`year_month`?``:o,value:s}},onConfirm(){lD(!0,this.buildResult())},onMaskClick(){ID()||this.onCancel()},onCancel(){lD(!1)}}},YD={class:`device-ui`},XD={class:`pk-sheet`},ZD={class:`pk-bar`},QD={key:0,class:`pk-bar__title`};function $D(e,t,n,r,i,a){let o=R(`van-picker`);return V(),H(`div`,YD,[G(hc,{name:`picker-fade`},{default:I(()=>[a.datePicker?(V(),H(`div`,{key:0,class:`pk-mask`,onClick:t[2]||=J((...e)=>a.onMaskClick&&a.onMaskClick(...e),[`self`])},[W(`div`,XD,[W(`div`,ZD,[W(`button`,{type:`button`,class:`pk-bar__btn pk-bar__btn--cancel`,onClick:t[0]||=(...e)=>a.onCancel&&a.onCancel(...e)},`取消`),a.datePicker.title?(V(),H(`div`,QD,M(a.datePicker.title),1)):q(`v-if`,!0),W(`button`,{type:`button`,class:`pk-bar__btn pk-bar__btn--ok`,onClick:t[1]||=(...e)=>a.onConfirm&&a.onConfirm(...e)},`确定`)]),q(` ⚠️ vant 4 属性名是 option-height / visible-option-num(Vant 2 的
250
250
  item-height / visible-item-count 已改名):写错不报错、静默落默认值
251
- (optionHeight=44 / visibleOptionNum=6),滚轮会被拉成 6 槽。 `),G(o,{columns:a.dateColumns,"model-value":a.selectedValues,"option-height":i.OPTION_H,"visible-option-num":i.VISIBLE_N,"swipe-duration":i.SWIPE_MS,"show-toolbar":!1,onChange:a.onChange},null,8,[`columns`,`model-value`,`option-height`,`visible-option-num`,`swipe-duration`,`onChange`])])])):q(`v-if`,!0)]),_:1})])}var $D=Z(qD,[[`render`,QD],[`__file`,`/Users/ynet/dsl-card/card-editor/components/DatePickerOverlay.vue`]]),eO={name:`KeyboardOverlay`,components:{VanNumberKeyboard:PE},computed:{keyboard(){return UE.keyboard}},methods:{onInput(e){hD(e)},onDelete(){gD()},onClose(){_D()}}},tO={class:`device-ui`},nO={key:0,class:`kb-mask`},rO={class:`kb-sheet`};function iO(e,t,n,r,i,a){let o=R(`van-number-keyboard`);return V(),H(`div`,tO,[G(hc,{name:`kb-fade`},{default:I(()=>[a.keyboard?(V(),H(`div`,nO,[W(`div`,rO,[q(` vant 键盘:内联渲染(不传 teleport),CSS 覆盖 position 落到 .kb-sheet 内 `),G(o,{show:!0,title:``,theme:`default`,"extra-key":a.keyboard.extraKey,maxlength:a.keyboard.maxLength||void 0,"random-key-order":a.keyboard.random,"hide-on-click-outside":!1,"safe-area-inset-bottom":!1,onInput:a.onInput,onDelete:a.onDelete,onBlur:a.onClose,onClose:a.onClose},null,8,[`extra-key`,`maxlength`,`random-key-order`,`onInput`,`onDelete`,`onBlur`,`onClose`])])])):q(`v-if`,!0)]),_:1})])}var aO=Z(eO,[[`render`,iO],[`__scopeId`,`data-v-faf5726f`],[`__file`,`/Users/ynet/dsl-card/card-editor/components/KeyboardOverlay.vue`]]),oO={name:`LoadingExOverlay`,components:{VanLoading:zw},computed:{loadingEx(){return UE.loadingEx}}},sO={class:`device-ui`},cO={key:0,class:`lx`},lO={key:0,class:`lx__msg`};function uO(e,t,n,r,i,a){let o=R(`van-loading`);return V(),H(`div`,sO,[G(hc,{name:`lx-fade`},{default:I(()=>[a.loadingEx?(V(),H(`div`,cO,[G(o,{type:`circular`,color:`#ffffff`,size:30}),a.loadingEx.message?(V(),H(`span`,lO,M(a.loadingEx.message),1)):q(`v-if`,!0)])):q(`v-if`,!0)]),_:1})])}var dO=Z(oO,[[`render`,uO],[`__scopeId`,`data-v-5a54c14d`],[`__file`,`/Users/ynet/dsl-card/card-editor/components/LoadingExOverlay.vue`]]),fO={name:`SelectionOverlay`,props:{store:{type:Object,default:()=>dp},boxClass:{type:String,default:`ce-sel-overlay`}},data(){return{boxStyle:{top:`0px`,left:`0px`,width:`0px`,height:`0px`},_ro:null,_onScroll:null,_onResize:null,_raf:0}},watch:{"store.el"(){this.bindTarget(),this.schedule()}},mounted(){this._onScroll=()=>this.schedule(),this._onResize=()=>this.schedule(),document.addEventListener(`scroll`,this._onScroll,{passive:!0,capture:!0}),window.addEventListener(`resize`,this._onResize),this.bindTarget(),this.schedule()},beforeUnmount(){document.removeEventListener(`scroll`,this._onScroll,{capture:!0}),window.removeEventListener(`resize`,this._onResize),this._ro&&=(this._ro.disconnect(),null),this._raf&&cancelAnimationFrame(this._raf)},methods:{bindTarget(){this._ro&&=(this._ro.disconnect(),null);let e=this.store.el;e&&typeof ResizeObserver<`u`&&(this._ro=new ResizeObserver(()=>this.schedule()),this._ro.observe(e))},schedule(){this._raf||=requestAnimationFrame(()=>{this._raf=0,this.recompute()})},recompute(){let e=this.store.el;if(!e||!this.store.visible)return;let t=e.closest(`.phone__screen`);if(!t){this.store.visible=!1;return}let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=r.top-n.top+t.scrollTop,a=r.left-n.left+t.scrollLeft;this.boxStyle={top:i+`px`,left:a+`px`,width:r.width+`px`,height:r.height+`px`}}}},pO={width:`100%`,height:`100%`,style:{display:`block`},xmlns:`http://www.w3.org/2000/svg`};function mO(e,t,n,r,i,a){return L((V(),H(`div`,{class:j(n.boxClass),style:A(i.boxStyle)},[(V(),H(`svg`,pO,[...t[0]||=[W(`rect`,{id:`controls_bounding_rect`,x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`transparent`,style:{stroke:`var(--accent)`},"stroke-width":`1`,"stroke-dasharray":`4`},null,-1)]]))],6)),[[Nc,n.store.visible]])}var hO=Z(fO,[[`render`,mO],[`__file`,`/Users/ynet/dsl-card/card-editor/components/SelectionOverlay.vue`]]),gO=cn({el:null,visible:!1,nodeId:null});function _O(e,t){gO.el=e,gO.nodeId=t,gO.visible=!0}function vO(e){gO.el&&(e==null||gO.nodeId===e)&&(gO.el=null,gO.nodeId=null,gO.visible=!1)}var yO={name:`HoverGuides`,setup(){return{hoverGuide:gO}},data(){return{box:{left:0,top:0,right:0,bottom:0},containerStyle:{width:`0px`,height:`0px`},_ro:null,_onScroll:null,_onResize:null,_raf:0,_stopWatch:null}},created(){this._stopWatch=$r(()=>gO.el,()=>{this.bindTarget(),this.schedule()})},mounted(){this._onScroll=()=>this.schedule(),this._onResize=()=>this.schedule(),document.addEventListener(`scroll`,this._onScroll,{passive:!0,capture:!0}),window.addEventListener(`resize`,this._onResize),this.bindTarget(),this.schedule()},beforeUnmount(){document.removeEventListener(`scroll`,this._onScroll,{capture:!0}),window.removeEventListener(`resize`,this._onResize),this._stopWatch&&=(this._stopWatch(),null),this._ro&&=(this._ro.disconnect(),null),this._raf&&cancelAnimationFrame(this._raf)},methods:{bindTarget(){this._ro&&=(this._ro.disconnect(),null);let e=gO.el;e&&typeof ResizeObserver<`u`&&(this._ro=new ResizeObserver(()=>this.schedule()),this._ro.observe(e))},schedule(){this._raf||=requestAnimationFrame(()=>{this._raf=0,this.recompute()})},recompute(){let e=gO.el;if(!e||!gO.visible)return;let t=e.closest(`.phone__screen`);if(!t){gO.visible=!1;return}let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=r.left-n.left+t.scrollLeft,a=r.top-n.top+t.scrollTop,o=r.width,s=r.height;this.box={left:i,top:a,right:i+o,bottom:a+s},this.containerStyle={width:t.clientWidth+`px`,height:t.scrollHeight+`px`}}}};function bO(e,t,n,r,i,a){return L((V(),H(`div`,{class:`ce-guides`,style:A(i.containerStyle)},[q(` 左 / 右竖线:贯穿画布全高 `),W(`div`,{class:`ce-guide ce-guide--v`,style:A({left:i.box.left+`px`})},null,4),W(`div`,{class:`ce-guide ce-guide--v`,style:A({left:i.box.right+`px`})},null,4),q(` 上 / 下横线:贯穿画布全宽 `),W(`div`,{class:`ce-guide ce-guide--h`,style:A({top:i.box.top+`px`})},null,4),W(`div`,{class:`ce-guide ce-guide--h`,style:A({top:i.box.bottom+`px`})},null,4)],4)),[[Nc,r.hoverGuide.visible]])}var xO=Z(yO,[[`render`,bO],[`__file`,`/Users/ynet/dsl-card/card-editor/components/HoverGuides.vue`]]),SO=o(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),CO=o((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),wO=o((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),TO=o(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),EO=o(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),DO=o((e=>{var t=CO().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),OO=o((e=>{var t=CO().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),kO=o((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),AO=o((e=>{var t=wO(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),jO=o((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),MO=o((e=>{var t=jO();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),NO=o(((e,t)=>{var n=MO();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),PO=o((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),FO=o((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
252
- ]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^[0-9]+$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),IO=o((e=>{var t=PO(),n=FO();e.NUMERIC={id:`Numeric`,bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:`Alphanumeric`,bit:2,ccBits:[9,11,13]},e.BYTE={id:`Byte`,bit:4,ccBits:[8,16,16]},e.KANJI={id:`Kanji`,bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`numeric`:return e.NUMERIC;case`alphanumeric`:return e.ALPHANUMERIC;case`kanji`:return e.KANJI;case`byte`:return e.BYTE;default:throw Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),LO=o((e=>{var t=CO(),n=AO(),r=wO(),i=IO(),a=PO(),o=7973,s=t.getBCHDigit(o);function c(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}function l(e,t){return i.getCharCountIndicator(e,t)+4}function u(e,t){let n=0;return e.forEach(function(e){let r=l(e.mode,t);n+=r+e.getBitsLength()}),n}function d(t,n){for(let r=1;r<=40;r++)if(u(t,r)<=e.getCapacity(r,n,i.MIXED))return r}e.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!a.isValid(e))throw Error(`Invalid QR Code version`);o===void 0&&(o=i.BYTE);let s=(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r))*8;if(o===i.MIXED)return s;let c=s-l(o,e);switch(o){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(e,t){let n,i=r.from(t,r.M);if(Array.isArray(e)){if(e.length>1)return d(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return c(n.mode,n.getLength(),i)},e.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-s>=0;)n^=o<<t.getBCHDigit(n)-s;return e<<12|n}})),RO=o((e=>{var t=CO(),n=1335,r=21522,i=t.getBCHDigit(n);e.getEncodedBits=function(e,a){let o=e.bit<<3|a,s=o<<10;for(;t.getBCHDigit(s)-i>=0;)s^=n<<t.getBCHDigit(s)-i;return(o<<10|s)^r}})),zO=o(((e,t)=>{var n=IO();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),BO=o(((e,t)=>{var n=IO(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t=0;for(;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),VO=o(((e,t)=>{var n=IO();function r(e){this.mode=n.BYTE,this.data=typeof e==`string`?new TextEncoder().encode(e):new Uint8Array(e)}r.getBitsLength=function(e){return e*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=r})),HO=o(((e,t)=>{var n=IO(),r=CO();function i(e){this.mode=n.KANJI,this.data=e}i.getBitsLength=function(e){return e*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t=0;for(;t<this.data.length;t++){let n=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`Invalid SJIS character: `+this.data[t]+`
253
- Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=i})),UO=o(((e,t)=>{var n={single_source_shortest_paths:function(e,t,r){var i={},a={};a[t]=0;var o=n.PriorityQueue.make();o.push(t,0);for(var s,c,l,u,d,f,p,m,h;!o.empty();)for(l in s=o.pop(),c=s.value,u=s.cost,d=e[c]||{},d)d.hasOwnProperty(l)&&(f=d[l],p=u+f,m=a[l],h=a[l]===void 0,(h||m>p)&&(a[l]=p,o.push(l,p),i[l]=c));if(r!==void 0&&a[r]===void 0){var g=[`Could not find a path from `,t,` to `,r,`.`].join(``);throw Error(g)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,t,r){var i=n.single_source_shortest_paths(e,t,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var t=n.PriorityQueue,r={},i;for(i in e||={},t)t.hasOwnProperty(i)&&(r[i]=t[i]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t!==void 0&&(t.exports=n)})),WO=o((e=>{var t=IO(),n=zO(),r=BO(),i=VO(),a=HO(),o=FO(),s=CO(),c=UO();function l(e){return unescape(encodeURIComponent(e)).length}function u(e,t,n){let r=[],i;for(;(i=e.exec(n))!==null;)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function d(e){let n=u(o.NUMERIC,t.NUMERIC,e),r=u(o.ALPHANUMERIC,t.ALPHANUMERIC,e),i,a;return s.isKanjiModeEnabled()?(i=u(o.BYTE,t.BYTE,e),a=u(o.KANJI,t.KANJI,e)):(i=u(o.BYTE_KANJI,t.BYTE,e),a=[]),n.concat(r,i,a).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function f(e,o){switch(o){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return a.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function p(e){return e.reduce(function(e,t){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function m(e){let n=[];for(let r=0;r<e.length;r++){let i=e[r];switch(i.mode){case t.NUMERIC:n.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:n.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:n.push([i,{data:i.data,mode:t.BYTE,length:l(i.data)}]);break;case t.BYTE:n.push([{data:i.data,mode:t.BYTE,length:l(i.data)}])}}return n}function h(e,n){let r={},i={start:{}},a=[`start`];for(let o=0;o<e.length;o++){let s=e[o],c=[];for(let e=0;e<s.length;e++){let l=s[e],u=``+o+e;c.push(u),r[u]={node:l,lastCount:0},i[u]={};for(let e=0;e<a.length;e++){let o=a[e];r[o]&&r[o].node.mode===l.mode?(i[o][u]=f(r[o].lastCount+l.length,l.mode)-f(r[o].lastCount,l.mode),r[o].lastCount+=l.length):(r[o]&&(r[o].lastCount=l.length),i[o][u]=f(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,n))}}a=c}for(let e=0;e<a.length;e++)i[a[e]].end=0;return{map:i,table:r}}function g(e,o){let c,l=t.getBestModeForData(e);if(c=t.from(o,l),c!==t.BYTE&&c.bit<l.bit)throw Error(`"`+e+`" cannot be encoded with mode `+t.toString(c)+`.
254
- Suggested mode is: `+t.toString(l));switch(c===t.KANJI&&!s.isKanjiModeEnabled()&&(c=t.BYTE),c){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new a(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce(function(e,t){return typeof t==`string`?e.push(g(t,null)):t.data&&e.push(g(t.data,t.mode)),e},[])},e.fromString=function(t,n){let r=h(m(d(t,s.isKanjiModeEnabled())),n),i=c.find_path(r.map,`start`,`end`),a=[];for(let e=1;e<i.length-1;e++)a.push(r.table[i[e]].node);return e.fromArray(p(a))},e.rawSplit=function(t){return e.fromArray(d(t,s.isKanjiModeEnabled()))}})),GO=o((e=>{var t=CO(),n=wO(),r=TO(),i=EO(),a=DO(),o=OO(),s=kO(),c=AO(),l=NO(),u=LO(),d=RO(),f=IO(),p=WO();function m(e,t){let n=e.size,r=o.getPositions(t);for(let t=0;t<r.length;t++){let i=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(i+t<=-1||n<=i+t))for(let r=-1;r<=7;r++)a+r<=-1||n<=a+r||(t>=0&&t<=6&&(r===0||r===6)||r>=0&&r<=6&&(t===0||t===6)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,a+r,!0,!0):e.set(i+t,a+r,!1,!0))}}function h(e){let t=e.size;for(let n=8;n<t-8;n++){let t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}function g(e,t){let n=a.getPositions(t);for(let t=0;t<n.length;t++){let r=n[t][0],i=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)t===-2||t===2||n===-2||n===2||t===0&&n===0?e.set(r+t,i+n,!0,!0):e.set(r+t,i+n,!1,!0)}}function _(e,t){let n=e.size,r=u.getEncodedBits(t),i,a,o;for(let t=0;t<18;t++)i=Math.floor(t/3),a=t%3+n-8-3,o=(r>>t&1)==1,e.set(i,a,o,!0),e.set(a,i,o,!0)}function v(e,t,n){let r=e.size,i=d.getEncodedBits(t,n),a,o;for(a=0;a<15;a++)o=(i>>a&1)==1,a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(r-15+a,8,o,!0),a<8?e.set(8,r-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(r-8,8,1,!0)}function y(e,t){let n=e.size,r=-1,i=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(s===6&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,s-n)){let r=!1;o<t.length&&(r=(t[o]>>>a&1)==1),e.set(i,s-n,r),a--,a===-1&&(o++,a=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}function b(e,n,i){let a=new r;i.forEach(function(t){a.put(t.mode.bit,4),a.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(a)});let o=(t.getSymbolTotalCodewords(e)-c.getTotalCodewordsCount(e,n))*8;for(a.getLengthInBits()+4<=o&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(0);let s=(o-a.getLengthInBits())/8;for(let e=0;e<s;e++)a.put(e%2?17:236,8);return x(a,e,n)}function x(e,n,r){let i=t.getSymbolTotalCodewords(n),a=i-c.getTotalCodewordsCount(n,r),o=c.getBlocksCount(n,r),s=o-i%o,u=Math.floor(i/o),d=Math.floor(a/o),f=d+1,p=u-d,m=new l(p),h=0,g=Array(o),_=Array(o),v=0,y=new Uint8Array(e.buffer);for(let e=0;e<o;e++){let t=e<s?d:f;g[e]=y.slice(h,h+t),_[e]=m.encode(g[e]),h+=t,v=Math.max(v,t)}let b=new Uint8Array(i),x=0,S,C;for(S=0;S<v;S++)for(C=0;C<o;C++)S<g[C].length&&(b[x++]=g[C][S]);for(S=0;S<p;S++)for(C=0;C<o;C++)b[x++]=_[C][S];return b}function S(e,n,r,a){let o;if(Array.isArray(e))o=p.fromArray(e);else if(typeof e==`string`){let t=n;if(!t){let n=p.rawSplit(e);t=u.getBestVersionForData(n,r)}o=p.fromString(e,t||40)}else throw Error(`Invalid data`);let c=u.getBestVersionForData(o,r);if(!c)throw Error(`The amount of data is too big to be stored in a QR Code`);if(!n)n=c;else if(n<c)throw Error(`
251
+ (optionHeight=44 / visibleOptionNum=6),滚轮会被拉成 6 槽。 `),G(o,{columns:a.dateColumns,"model-value":a.selectedValues,"option-height":i.OPTION_H,"visible-option-num":i.VISIBLE_N,"swipe-duration":i.SWIPE_MS,"show-toolbar":!1,onChange:a.onChange},null,8,[`columns`,`model-value`,`option-height`,`visible-option-num`,`swipe-duration`,`onChange`])])])):q(`v-if`,!0)]),_:1})])}var eO=Z(JD,[[`render`,$D],[`__file`,`/Users/ynet/dsl-card/card-editor/components/DatePickerOverlay.vue`]]),tO={name:`KeyboardOverlay`,components:{VanNumberKeyboard:FE},computed:{keyboard(){return WE.keyboard}},methods:{onInput(e){gD(e)},onDelete(){_D()},onClose(){vD()}}},nO={class:`device-ui`},rO={key:0,class:`kb-mask`},iO={class:`kb-sheet`};function aO(e,t,n,r,i,a){let o=R(`van-number-keyboard`);return V(),H(`div`,nO,[G(hc,{name:`kb-fade`},{default:I(()=>[a.keyboard?(V(),H(`div`,rO,[W(`div`,iO,[q(` vant 键盘:内联渲染(不传 teleport),CSS 覆盖 position 落到 .kb-sheet 内 `),G(o,{show:!0,title:``,theme:`default`,"extra-key":a.keyboard.extraKey,maxlength:a.keyboard.maxLength||void 0,"random-key-order":a.keyboard.random,"hide-on-click-outside":!1,"safe-area-inset-bottom":!1,onInput:a.onInput,onDelete:a.onDelete,onBlur:a.onClose,onClose:a.onClose},null,8,[`extra-key`,`maxlength`,`random-key-order`,`onInput`,`onDelete`,`onBlur`,`onClose`])])])):q(`v-if`,!0)]),_:1})])}var oO=Z(tO,[[`render`,aO],[`__scopeId`,`data-v-faf5726f`],[`__file`,`/Users/ynet/dsl-card/card-editor/components/KeyboardOverlay.vue`]]),sO={name:`LoadingExOverlay`,components:{VanLoading:Bw},computed:{loadingEx(){return WE.loadingEx}}},cO={class:`device-ui`},lO={key:0,class:`lx`},uO={key:0,class:`lx__msg`};function dO(e,t,n,r,i,a){let o=R(`van-loading`);return V(),H(`div`,cO,[G(hc,{name:`lx-fade`},{default:I(()=>[a.loadingEx?(V(),H(`div`,lO,[G(o,{type:`circular`,color:`#ffffff`,size:30}),a.loadingEx.message?(V(),H(`span`,uO,M(a.loadingEx.message),1)):q(`v-if`,!0)])):q(`v-if`,!0)]),_:1})])}var fO=Z(sO,[[`render`,dO],[`__scopeId`,`data-v-5a54c14d`],[`__file`,`/Users/ynet/dsl-card/card-editor/components/LoadingExOverlay.vue`]]),pO={name:`SelectionOverlay`,props:{store:{type:Object,default:()=>dp},boxClass:{type:String,default:`ce-sel-overlay`}},data(){return{boxStyle:{top:`0px`,left:`0px`,width:`0px`,height:`0px`},_ro:null,_onScroll:null,_onResize:null,_raf:0}},watch:{"store.el"(){this.bindTarget(),this.schedule()}},mounted(){this._onScroll=()=>this.schedule(),this._onResize=()=>this.schedule(),document.addEventListener(`scroll`,this._onScroll,{passive:!0,capture:!0}),window.addEventListener(`resize`,this._onResize),this.bindTarget(),this.schedule()},beforeUnmount(){document.removeEventListener(`scroll`,this._onScroll,{capture:!0}),window.removeEventListener(`resize`,this._onResize),this._ro&&=(this._ro.disconnect(),null),this._raf&&cancelAnimationFrame(this._raf)},methods:{bindTarget(){this._ro&&=(this._ro.disconnect(),null);let e=this.store.el;e&&typeof ResizeObserver<`u`&&(this._ro=new ResizeObserver(()=>this.schedule()),this._ro.observe(e))},schedule(){this._raf||=requestAnimationFrame(()=>{this._raf=0,this.recompute()})},recompute(){let e=this.store.el;if(!e||!this.store.visible)return;let t=e.closest(`.phone__screen`);if(!t){this.store.visible=!1;return}let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=r.top-n.top+t.scrollTop,a=r.left-n.left+t.scrollLeft;this.boxStyle={top:i+`px`,left:a+`px`,width:r.width+`px`,height:r.height+`px`}}}},mO={width:`100%`,height:`100%`,style:{display:`block`},xmlns:`http://www.w3.org/2000/svg`};function hO(e,t,n,r,i,a){return L((V(),H(`div`,{class:j(n.boxClass),style:A(i.boxStyle)},[(V(),H(`svg`,mO,[...t[0]||=[W(`rect`,{id:`controls_bounding_rect`,x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`transparent`,style:{stroke:`var(--accent)`},"stroke-width":`1`,"stroke-dasharray":`4`},null,-1)]]))],6)),[[Nc,n.store.visible]])}var gO=Z(pO,[[`render`,hO],[`__file`,`/Users/ynet/dsl-card/card-editor/components/SelectionOverlay.vue`]]),_O=cn({el:null,visible:!1,nodeId:null});function vO(e,t){_O.el=e,_O.nodeId=t,_O.visible=!0}function yO(e){_O.el&&(e==null||_O.nodeId===e)&&(_O.el=null,_O.nodeId=null,_O.visible=!1)}var bO={name:`HoverGuides`,setup(){return{hoverGuide:_O}},data(){return{box:{left:0,top:0,right:0,bottom:0},containerStyle:{width:`0px`,height:`0px`},_ro:null,_onScroll:null,_onResize:null,_raf:0,_stopWatch:null}},created(){this._stopWatch=$r(()=>_O.el,()=>{this.bindTarget(),this.schedule()})},mounted(){this._onScroll=()=>this.schedule(),this._onResize=()=>this.schedule(),document.addEventListener(`scroll`,this._onScroll,{passive:!0,capture:!0}),window.addEventListener(`resize`,this._onResize),this.bindTarget(),this.schedule()},beforeUnmount(){document.removeEventListener(`scroll`,this._onScroll,{capture:!0}),window.removeEventListener(`resize`,this._onResize),this._stopWatch&&=(this._stopWatch(),null),this._ro&&=(this._ro.disconnect(),null),this._raf&&cancelAnimationFrame(this._raf)},methods:{bindTarget(){this._ro&&=(this._ro.disconnect(),null);let e=_O.el;e&&typeof ResizeObserver<`u`&&(this._ro=new ResizeObserver(()=>this.schedule()),this._ro.observe(e))},schedule(){this._raf||=requestAnimationFrame(()=>{this._raf=0,this.recompute()})},recompute(){let e=_O.el;if(!e||!_O.visible)return;let t=e.closest(`.phone__screen`);if(!t){_O.visible=!1;return}let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=r.left-n.left+t.scrollLeft,a=r.top-n.top+t.scrollTop,o=r.width,s=r.height;this.box={left:i,top:a,right:i+o,bottom:a+s},this.containerStyle={width:t.clientWidth+`px`,height:t.scrollHeight+`px`}}}};function xO(e,t,n,r,i,a){return L((V(),H(`div`,{class:`ce-guides`,style:A(i.containerStyle)},[q(` 左 / 右竖线:贯穿画布全高 `),W(`div`,{class:`ce-guide ce-guide--v`,style:A({left:i.box.left+`px`})},null,4),W(`div`,{class:`ce-guide ce-guide--v`,style:A({left:i.box.right+`px`})},null,4),q(` 上 / 下横线:贯穿画布全宽 `),W(`div`,{class:`ce-guide ce-guide--h`,style:A({top:i.box.top+`px`})},null,4),W(`div`,{class:`ce-guide ce-guide--h`,style:A({top:i.box.bottom+`px`})},null,4)],4)),[[Nc,r.hoverGuide.visible]])}var SO=Z(bO,[[`render`,xO],[`__file`,`/Users/ynet/dsl-card/card-editor/components/HoverGuides.vue`]]),CO=o(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),wO=o((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),TO=o((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),EO=o(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),DO=o(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),OO=o((e=>{var t=wO().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),kO=o((e=>{var t=wO().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),AO=o((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),jO=o((e=>{var t=TO(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),MO=o((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),NO=o((e=>{var t=MO();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),PO=o(((e,t)=>{var n=NO();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),FO=o((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),IO=o((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
252
+ ]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^[0-9]+$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),LO=o((e=>{var t=FO(),n=IO();e.NUMERIC={id:`Numeric`,bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:`Alphanumeric`,bit:2,ccBits:[9,11,13]},e.BYTE={id:`Byte`,bit:4,ccBits:[8,16,16]},e.KANJI={id:`Kanji`,bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`numeric`:return e.NUMERIC;case`alphanumeric`:return e.ALPHANUMERIC;case`kanji`:return e.KANJI;case`byte`:return e.BYTE;default:throw Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),RO=o((e=>{var t=wO(),n=jO(),r=TO(),i=LO(),a=FO(),o=7973,s=t.getBCHDigit(o);function c(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}function l(e,t){return i.getCharCountIndicator(e,t)+4}function u(e,t){let n=0;return e.forEach(function(e){let r=l(e.mode,t);n+=r+e.getBitsLength()}),n}function d(t,n){for(let r=1;r<=40;r++)if(u(t,r)<=e.getCapacity(r,n,i.MIXED))return r}e.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!a.isValid(e))throw Error(`Invalid QR Code version`);o===void 0&&(o=i.BYTE);let s=(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r))*8;if(o===i.MIXED)return s;let c=s-l(o,e);switch(o){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(e,t){let n,i=r.from(t,r.M);if(Array.isArray(e)){if(e.length>1)return d(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return c(n.mode,n.getLength(),i)},e.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-s>=0;)n^=o<<t.getBCHDigit(n)-s;return e<<12|n}})),zO=o((e=>{var t=wO(),n=1335,r=21522,i=t.getBCHDigit(n);e.getEncodedBits=function(e,a){let o=e.bit<<3|a,s=o<<10;for(;t.getBCHDigit(s)-i>=0;)s^=n<<t.getBCHDigit(s)-i;return(o<<10|s)^r}})),BO=o(((e,t)=>{var n=LO();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),VO=o(((e,t)=>{var n=LO(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t=0;for(;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),HO=o(((e,t)=>{var n=LO();function r(e){this.mode=n.BYTE,this.data=typeof e==`string`?new TextEncoder().encode(e):new Uint8Array(e)}r.getBitsLength=function(e){return e*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=r})),UO=o(((e,t)=>{var n=LO(),r=wO();function i(e){this.mode=n.KANJI,this.data=e}i.getBitsLength=function(e){return e*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t=0;for(;t<this.data.length;t++){let n=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`Invalid SJIS character: `+this.data[t]+`
253
+ Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=i})),WO=o(((e,t)=>{var n={single_source_shortest_paths:function(e,t,r){var i={},a={};a[t]=0;var o=n.PriorityQueue.make();o.push(t,0);for(var s,c,l,u,d,f,p,m,h;!o.empty();)for(l in s=o.pop(),c=s.value,u=s.cost,d=e[c]||{},d)d.hasOwnProperty(l)&&(f=d[l],p=u+f,m=a[l],h=a[l]===void 0,(h||m>p)&&(a[l]=p,o.push(l,p),i[l]=c));if(r!==void 0&&a[r]===void 0){var g=[`Could not find a path from `,t,` to `,r,`.`].join(``);throw Error(g)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,t,r){var i=n.single_source_shortest_paths(e,t,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var t=n.PriorityQueue,r={},i;for(i in e||={},t)t.hasOwnProperty(i)&&(r[i]=t[i]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t!==void 0&&(t.exports=n)})),GO=o((e=>{var t=LO(),n=BO(),r=VO(),i=HO(),a=UO(),o=IO(),s=wO(),c=WO();function l(e){return unescape(encodeURIComponent(e)).length}function u(e,t,n){let r=[],i;for(;(i=e.exec(n))!==null;)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function d(e){let n=u(o.NUMERIC,t.NUMERIC,e),r=u(o.ALPHANUMERIC,t.ALPHANUMERIC,e),i,a;return s.isKanjiModeEnabled()?(i=u(o.BYTE,t.BYTE,e),a=u(o.KANJI,t.KANJI,e)):(i=u(o.BYTE_KANJI,t.BYTE,e),a=[]),n.concat(r,i,a).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function f(e,o){switch(o){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return a.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function p(e){return e.reduce(function(e,t){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function m(e){let n=[];for(let r=0;r<e.length;r++){let i=e[r];switch(i.mode){case t.NUMERIC:n.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:n.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:n.push([i,{data:i.data,mode:t.BYTE,length:l(i.data)}]);break;case t.BYTE:n.push([{data:i.data,mode:t.BYTE,length:l(i.data)}])}}return n}function h(e,n){let r={},i={start:{}},a=[`start`];for(let o=0;o<e.length;o++){let s=e[o],c=[];for(let e=0;e<s.length;e++){let l=s[e],u=``+o+e;c.push(u),r[u]={node:l,lastCount:0},i[u]={};for(let e=0;e<a.length;e++){let o=a[e];r[o]&&r[o].node.mode===l.mode?(i[o][u]=f(r[o].lastCount+l.length,l.mode)-f(r[o].lastCount,l.mode),r[o].lastCount+=l.length):(r[o]&&(r[o].lastCount=l.length),i[o][u]=f(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,n))}}a=c}for(let e=0;e<a.length;e++)i[a[e]].end=0;return{map:i,table:r}}function g(e,o){let c,l=t.getBestModeForData(e);if(c=t.from(o,l),c!==t.BYTE&&c.bit<l.bit)throw Error(`"`+e+`" cannot be encoded with mode `+t.toString(c)+`.
254
+ Suggested mode is: `+t.toString(l));switch(c===t.KANJI&&!s.isKanjiModeEnabled()&&(c=t.BYTE),c){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new a(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce(function(e,t){return typeof t==`string`?e.push(g(t,null)):t.data&&e.push(g(t.data,t.mode)),e},[])},e.fromString=function(t,n){let r=h(m(d(t,s.isKanjiModeEnabled())),n),i=c.find_path(r.map,`start`,`end`),a=[];for(let e=1;e<i.length-1;e++)a.push(r.table[i[e]].node);return e.fromArray(p(a))},e.rawSplit=function(t){return e.fromArray(d(t,s.isKanjiModeEnabled()))}})),KO=o((e=>{var t=wO(),n=TO(),r=EO(),i=DO(),a=OO(),o=kO(),s=AO(),c=jO(),l=PO(),u=RO(),d=zO(),f=LO(),p=GO();function m(e,t){let n=e.size,r=o.getPositions(t);for(let t=0;t<r.length;t++){let i=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(i+t<=-1||n<=i+t))for(let r=-1;r<=7;r++)a+r<=-1||n<=a+r||(t>=0&&t<=6&&(r===0||r===6)||r>=0&&r<=6&&(t===0||t===6)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,a+r,!0,!0):e.set(i+t,a+r,!1,!0))}}function h(e){let t=e.size;for(let n=8;n<t-8;n++){let t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}function g(e,t){let n=a.getPositions(t);for(let t=0;t<n.length;t++){let r=n[t][0],i=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)t===-2||t===2||n===-2||n===2||t===0&&n===0?e.set(r+t,i+n,!0,!0):e.set(r+t,i+n,!1,!0)}}function _(e,t){let n=e.size,r=u.getEncodedBits(t),i,a,o;for(let t=0;t<18;t++)i=Math.floor(t/3),a=t%3+n-8-3,o=(r>>t&1)==1,e.set(i,a,o,!0),e.set(a,i,o,!0)}function v(e,t,n){let r=e.size,i=d.getEncodedBits(t,n),a,o;for(a=0;a<15;a++)o=(i>>a&1)==1,a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(r-15+a,8,o,!0),a<8?e.set(8,r-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(r-8,8,1,!0)}function y(e,t){let n=e.size,r=-1,i=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(s===6&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,s-n)){let r=!1;o<t.length&&(r=(t[o]>>>a&1)==1),e.set(i,s-n,r),a--,a===-1&&(o++,a=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}function b(e,n,i){let a=new r;i.forEach(function(t){a.put(t.mode.bit,4),a.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(a)});let o=(t.getSymbolTotalCodewords(e)-c.getTotalCodewordsCount(e,n))*8;for(a.getLengthInBits()+4<=o&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(0);let s=(o-a.getLengthInBits())/8;for(let e=0;e<s;e++)a.put(e%2?17:236,8);return x(a,e,n)}function x(e,n,r){let i=t.getSymbolTotalCodewords(n),a=i-c.getTotalCodewordsCount(n,r),o=c.getBlocksCount(n,r),s=o-i%o,u=Math.floor(i/o),d=Math.floor(a/o),f=d+1,p=u-d,m=new l(p),h=0,g=Array(o),_=Array(o),v=0,y=new Uint8Array(e.buffer);for(let e=0;e<o;e++){let t=e<s?d:f;g[e]=y.slice(h,h+t),_[e]=m.encode(g[e]),h+=t,v=Math.max(v,t)}let b=new Uint8Array(i),x=0,S,C;for(S=0;S<v;S++)for(C=0;C<o;C++)S<g[C].length&&(b[x++]=g[C][S]);for(S=0;S<p;S++)for(C=0;C<o;C++)b[x++]=_[C][S];return b}function S(e,n,r,a){let o;if(Array.isArray(e))o=p.fromArray(e);else if(typeof e==`string`){let t=n;if(!t){let n=p.rawSplit(e);t=u.getBestVersionForData(n,r)}o=p.fromString(e,t||40)}else throw Error(`Invalid data`);let c=u.getBestVersionForData(o,r);if(!c)throw Error(`The amount of data is too big to be stored in a QR Code`);if(!n)n=c;else if(n<c)throw Error(`
255
255
  The chosen QR Code version cannot contain this amount of data.
256
256
  Minimum version required to store current data is: `+c+`.
257
- `);let l=b(n,r,o),d=new i(t.getSymbolSize(n));return m(d,n),h(d),g(d,n),v(d,r,0),n>=7&&_(d,n),y(d,l),isNaN(a)&&(a=s.getBestMask(d,v.bind(null,d,r))),s.applyMask(a,d),v(d,r,a),{modules:d,version:n,errorCorrectionLevel:r,maskPattern:a,segments:o}}e.create=function(e,r){if(e===void 0||e===``)throw Error(`No input text`);let i=n.M,a,o;return r!==void 0&&(i=n.from(r.errorCorrectionLevel,n.M),a=u.from(r.version),o=s.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),S(e,a,i,o)}})),KO=o((e=>{function t(e){if(typeof e==`number`&&(e=e.toString()),typeof e!=`string`)throw Error(`Color should be defined as hex string`);let t=e.slice().replace(`#`,``).split(``);if(t.length<3||t.length===5||t.length>8)throw Error(`Invalid hex color: `+e);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),t.length===6&&t.push(`F`,`F`);let n=parseInt(t.join(``),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:`#`+t.slice(0,6).join(``)}}e.getOptions=function(e){e||={},e.color||(e.color={});let n=e.margin===void 0||e.margin===null||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:t(e.color.dark||`#000000ff`),light:t(e.color.light||`#ffffffff`)},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale},e.getImageWidth=function(t,n){let r=e.getScale(t,n);return Math.floor((t+n.margin*2)*r)},e.qrToImageData=function(t,n,r){let i=n.modules.size,a=n.modules.data,o=e.getScale(i,r),s=Math.floor((i+r.margin*2)*o),c=r.margin*o,l=[r.color.light,r.color.dark];for(let e=0;e<s;e++)for(let n=0;n<s;n++){let u=(e*s+n)*4,d=r.color.light;if(e>=c&&n>=c&&e<s-c&&n<s-c){let t=Math.floor((e-c)/o),r=Math.floor((n-c)/o);d=l[+!!a[t*i+r]]}t[u++]=d.r,t[u++]=d.g,t[u++]=d.b,t[u]=d.a}}})),qO=o((e=>{var t=KO();function n(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||={},t.height=n,t.width=n,t.style.height=n+`px`,t.style.width=n+`px`}function r(){try{return document.createElement(`canvas`)}catch{throw Error(`You need to specify a canvas element`)}}e.render=function(e,i,a){let o=a,s=i;o===void 0&&(!i||!i.getContext)&&(o=i,i=void 0),i||(s=r()),o=t.getOptions(o);let c=t.getImageWidth(e.modules.size,o),l=s.getContext(`2d`),u=l.createImageData(c,c);return t.qrToImageData(u.data,e,o),n(l,s,c),l.putImageData(u,0,0),s},e.renderToDataURL=function(t,n,r){let i=r;i===void 0&&(!n||!n.getContext)&&(i=n,n=void 0),i||={};let a=e.render(t,n,i),o=i.type||`image/png`,s=i.rendererOpts||{};return a.toDataURL(o,s.quality)}})),JO=o((e=>{var t=KO();function n(e,t){let n=e.a/255,r=t+`="`+e.hex+`"`;return n<1?r+` `+t+`-opacity="`+n.toFixed(2).slice(1)+`"`:r}function r(e,t,n){let r=e+t;return n!==void 0&&(r+=` `+n),r}function i(e,t,n){let i=``,a=0,o=!1,s=0;for(let c=0;c<e.length;c++){let l=Math.floor(c%t),u=Math.floor(c/t);!l&&!o&&(o=!0),e[c]?(s++,c>0&&l>0&&e[c-1]||(i+=o?r(`M`,l+n,.5+u+n):r(`m`,a,0),a=0,o=!1),l+1<t&&e[c+1]||(i+=r(`h`,s),s=0)):a++}return i}e.render=function(e,r,a){let o=t.getOptions(r),s=e.modules.size,c=e.modules.data,l=s+o.margin*2,u=o.color.light.a?`<path `+n(o.color.light,`fill`)+` d="M0 0h`+l+`v`+l+`H0z"/>`:``,d=`<path `+n(o.color.dark,`stroke`)+` d="`+i(c,s,o.margin)+`"/>`,f=`viewBox="0 0 `+l+` `+l+`"`,p=`<svg xmlns="http://www.w3.org/2000/svg" `+(o.width?`width="`+o.width+`" height="`+o.width+`" `:``)+f+` shape-rendering="crispEdges">`+u+d+`</svg>
258
- `;return typeof a==`function`&&a(null,p),p}})),YO=c(o((e=>{var t=SO(),n=GO(),r=qO(),i=JO();function a(e,r,i,a,o){let s=[].slice.call(arguments,1),c=s.length,l=typeof s[c-1]==`function`;if(!l&&!t())throw Error(`Callback required as last argument`);if(l){if(c<2)throw Error(`Too few arguments provided`);c===2?(o=i,i=r,r=a=void 0):c===3&&(r.getContext&&o===void 0?(o=a,a=void 0):(o=a,a=i,i=r,r=void 0))}else{if(c<1)throw Error(`Too few arguments provided`);return c===1?(i=r,r=a=void 0):c===2&&!r.getContext&&(a=i,i=r,r=void 0),new Promise(function(t,o){try{t(e(n.create(i,a),r,a))}catch(e){o(e)}})}try{let t=n.create(i,a);o(null,e(t,r,a))}catch(e){o(e)}}e.create=n.create,e.toCanvas=a.bind(null,r.render),e.toDataURL=a.bind(null,r.renderToDataURL),e.toString=a.bind(null,function(e,t,n){return i.render(e,n)})}))()),XO={name:`RemotePreview`,props:{visible:{type:Boolean,default:!1},pageId:{type:[String,Number],default:``},schema:{type:Object,default:null},cardCode:{type:String,default:``}},data(){return{qrDataUrl:``,url:``,loading:!1,publishing:!1,copied:!1,copyTimer:null,warn:``,code:``}},watch:{visible(e){e&&this.open()},pageId(){this.visible&&this.open()}},beforeUnmount(){this.copyTimer&&clearTimeout(this.copyTimer)},methods:{buildSocket(e){return`${`https://uat-pkg.finmall.com`.replace(/^https?:/,`wss:`)}/pmb-web/websocket/card/${e}`},fullUrl(e,t){let n=this.buildSocket(e);return`app://previewCard?cardId=${encodeURIComponent(e)}&cardCode=${encodeURIComponent(t||``)}&cardVersion=00000000&socket=${encodeURIComponent(n)}`},async makeQr(e){return YO.toDataURL(e,{width:220,margin:1,errorCorrectionLevel:`H`,color:{dark:`#10131a`,light:`#ffffff`}})},async open(){this.qrDataUrl=``,this.url=``,this.loading=!0,this.publishing=!1,this.copied=!1,this.warn=``,this.code=this.cardCode||``;let e=String(this.pageId||``).trim();if(!e)this.warn=`当前卡片缺少 pageId(远端卡片 id),无法生成预览二维码`,this.loading=!1;else{this.url=`app://previewCard?cardId=${encodeURIComponent(e)}`;try{this.qrDataUrl=await this.makeQr(this.url)}catch(e){this.warn=`二维码生成失败:`+(e&&e.message)}this.publishing=!0;try{let t=await Y(`/__preview`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({schema:this.schema||{pageId:e}})}),n=await t.json().catch(()=>({}));if(!t.ok)throw Error(n.message||`preview failed`);n.cardCode!==void 0&&(this.code=n.cardCode),this.url=this.fullUrl(e,this.code),this.qrDataUrl=await this.makeQr(this.url)}catch(e){this.warn=`远端发布失败:`+(e&&e.message)}finally{this.publishing=!1,this.loading=!1}}},async copyUrl(){if(this.url)try{if(navigator.clipboard&&navigator.clipboard.writeText)await navigator.clipboard.writeText(this.url);else{let e=document.createElement(`textarea`);e.value=this.url,e.style.position=`fixed`,e.style.opacity=`0`,document.body.appendChild(e),e.select(),document.execCommand(`copy`),document.body.removeChild(e)}this.copied=!0,this.copyTimer&&clearTimeout(this.copyTimer),this.copyTimer=setTimeout(()=>{this.copied=!1},1500)}catch(e){this.warn=`复制失败:`+(e&&e.message)}}}},ZO={class:`rp-card modal-card`,role:`dialog`,"aria-label":`远端预览二维码`},QO={class:`rp-head`},$O={class:`rp-body`},ek={class:`rp-qr-wrap`},tk=[`src`],nk={key:1,class:`rp-qr rp-qr--loading`},rk={key:2,class:`rp-qr-loading`},ik={class:`rp-url`},ak={class:`rp-url-text`},ok=[`disabled`],sk={key:0,class:`rp-warn`};function ck(e,t,n,r,i,a){return V(),U(hc,{name:`modal`},{default:I(()=>[n.visible?(V(),H(`div`,{key:0,class:`rp-mask`,onClick:t[2]||=J(t=>e.$emit(`close`),[`self`])},[W(`div`,ZO,[W(`div`,QO,[t[3]||=W(`span`,{class:`rp-title`},`远端预览(真机扫码)`,-1),W(`button`,{class:`rp-x`,type:`button`,onClick:t[0]||=t=>e.$emit(`close`),"aria-label":`关闭`},`×`)]),W(`div`,$O,[W(`div`,ek,[i.qrDataUrl?(V(),H(`img`,{key:0,src:i.qrDataUrl,class:j([`rp-qr`,{"rp-qr--blurred":i.publishing}]),alt:`preview qr`},null,10,tk)):(V(),H(`div`,nk,M(i.loading?`准备中…`:`—`),1)),i.publishing?(V(),H(`div`,rk,[...t[4]||=[W(`span`,{class:`rp-spinner`},null,-1),W(`span`,{class:`rp-loading-text`},`正在发布预览…`,-1)]])):q(`v-if`,!0)]),t[5]||=W(`p`,{class:`rp-tip`},`手机(FinMall App)扫一扫,真机查看当前卡片预览`,-1),W(`div`,ik,[W(`code`,ak,M(i.url||`—`),1),W(`button`,{class:`rp-copy`,type:`button`,disabled:!i.url,onClick:t[1]||=(...e)=>a.copyUrl&&a.copyUrl(...e)},M(i.copied?`已复制 ✓`:`复制链接`),9,ok)]),i.warn?(V(),H(`p`,sk,M(i.warn),1)):q(`v-if`,!0)])])])):q(`v-if`,!0)]),_:1})}var lk=Z(XO,[[`render`,ck],[`__file`,`/Users/ynet/dsl-card/card-editor/components/RemotePreview.vue`]]),uk={name:`AppToast`,computed:{toast(){return bp},iconHref(){return this.toast.type===`ok`?`#icon-check-plain`:this.toast.type===`warn`?`#icon-alert-triangle`:`#icon-x`}}},dk={class:`apptoast__icon`},fk={class:`apptoast__icon-svg`,viewBox:`0 0 24 24`,"aria-hidden":`true`},pk=[`href`],mk={class:`apptoast__msg`};function hk(e,t,n,r,i,a){return V(),U(hc,{name:`apptoast-fade`},{default:I(()=>[a.toast.visible?(V(),H(`div`,{key:0,class:j([`apptoast`,`apptoast--`+a.toast.type]),role:`status`,"aria-live":`polite`},[W(`span`,dk,[(V(),H(`svg`,fk,[W(`use`,{href:a.iconHref},null,8,pk)]))]),W(`span`,mk,M(a.toast.message),1)],2)):q(`v-if`,!0)]),_:1})}var gk=Z(uk,[[`render`,hk],[`__file`,`/Users/ynet/dsl-card/card-editor/components/AppToast.vue`]]),_k=[{key:`blue`,name:`默认`,swatch:`#4F6BF2`},{key:`yellow`,name:`黄`,swatch:`#E0A32B`},{key:`green`,name:`绿`,swatch:`#2FA35B`},{key:`orange`,name:`橙`,swatch:`#E8761F`}],vk=`cardbuddy:accent`,yk=`blue`;function bk(e){return _k.some(t=>t.key===e)}function xk(){try{let e=localStorage.getItem(vk);return bk(e)?e:yk}catch{return yk}}function Sk(e){let t=document.documentElement;!bk(e)||e===`blue`?t.removeAttribute(`data-accent`):t.dataset.accent=e}function Ck(e){try{localStorage.setItem(vk,e)}catch{}}var wk=[{key:`light`,name:`浅色`,icon:`#icon-sun`},{key:`dark`,name:`深色`,icon:`#icon-moon`}],Tk={name:`ThemeSettings`,props:{theme:{type:String,default:`dark`},accent:{type:String,default:`blue`},disabled:{type:Boolean,default:!1}},emits:[`update:theme`,`update:accent`],data(){return{open:!1,MODES:wk,presets:_k}},watch:{disabled(e){e&&(this.open=!1)},open(e){e?document.addEventListener(`keydown`,this.onKeydown):document.removeEventListener(`keydown`,this.onKeydown)}},beforeUnmount(){document.removeEventListener(`keydown`,this.onKeydown)},methods:{toggle(){this.disabled||(this.open=!this.open)},pickTheme(e){e!==this.theme&&this.$emit(`update:theme`,e)},pickAccent(e){e!==this.accent&&this.$emit(`update:accent`,e)},onKeydown(e){e.key===`Escape`&&(this.open=!1)}}},Ek={class:`app__theme`},Dk=[`disabled`,`title`,`aria-expanded`],Ok={class:`app__theme-head`},kk={class:`app__theme-body`},Ak={class:`app__theme-seg`,role:`radiogroup`,"aria-label":`外观`},jk=[`aria-checked`,`data-testid`,`onClick`],Mk={class:`app__theme-seg-icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},Nk=[`href`],Pk={class:`app__theme-swatches`,role:`radiogroup`,"aria-label":`主题色`},Fk=[`aria-checked`,`title`,`data-testid`,`onClick`];function Ik(e,t,n,r,i,a){return V(),H(`div`,Ek,[W(`button`,{class:j([`app__btn app__btn--icon`,{"app__btn--active":i.open}]),type:`button`,disabled:n.disabled,title:i.open?`收起主题设置`:`主题设置(外观 / 主题色)`,"aria-haspopup":`dialog`,"aria-expanded":i.open?`true`:`false`,"data-testid":`theme-settings-trigger`,onClick:t[0]||=(...e)=>a.toggle&&a.toggle(...e)},[...t[4]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-palette`})],-1)]],10,Dk),q(` 点遮罩关闭:与本顶栏「本地开发服务」浮层同一交互 `),i.open?(V(),H(`div`,{key:0,class:`app__theme-mask`,onClick:t[1]||=e=>i.open=!1})):q(`v-if`,!0),G(hc,{name:`pop`},{default:I(()=>[i.open?(V(),H(`div`,{key:0,class:`app__theme-panel`,role:`dialog`,"aria-label":`主题设置`,onClick:t[3]||=J(()=>{},[`stop`])},[W(`div`,Ok,[t[5]||=W(`span`,{class:`app__theme-title`},`主题设置`,-1),W(`button`,{class:`app__theme-close`,type:`button`,title:`关闭`,onClick:t[2]||=e=>i.open=!1})]),W(`div`,kk,[q(` 外观:浅色 / 深色分段控件 `),W(`section`,null,[t[6]||=W(`div`,{class:`app__theme-label`},[W(`span`,null,`外观`)],-1),W(`div`,Ak,[(V(!0),H(B,null,z(i.MODES,e=>(V(),H(`button`,{key:e.key,class:j([`app__theme-seg-btn`,{"is-active":n.theme===e.key}]),type:`button`,role:`radio`,"aria-checked":n.theme===e.key?`true`:`false`,"data-testid":`theme-mode-`+e.key,onClick:t=>a.pickTheme(e.key)},[(V(),H(`svg`,Mk,[W(`use`,{href:e.icon},null,8,Nk)])),W(`span`,null,M(e.name),1)],10,jk))),128))])]),q(` 主题色:四档色板(默认 / 黄 / 绿 / 橙) `),W(`section`,null,[t[7]||=W(`div`,{class:`app__theme-label`},[W(`span`,null,`主题色`),W(`span`,{class:`app__theme-label-note`},`强调色`)],-1),W(`div`,Pk,[(V(!0),H(B,null,z(i.presets,e=>(V(),H(`button`,{key:e.key,class:j([`app__theme-swatch`,{"is-active":n.accent===e.key}]),type:`button`,role:`radio`,"aria-checked":n.accent===e.key?`true`:`false`,title:e.name+(e.key===`blue`?`(品牌蓝)`:``),"data-testid":`accent-`+e.key,onClick:t=>a.pickAccent(e.key)},[W(`span`,{class:`app__theme-dot`,style:A({background:e.swatch})},null,4),W(`span`,null,M(e.name),1)],10,Fk))),128))])])]),t[8]||=W(`p`,{class:`app__theme-hint`},`主题色作用于按钮、选中态、链接与高亮等外壳元素,不影响卡片内容本身的配色。`,-1)])):q(`v-if`,!0)]),_:1})])}var Lk=Z(Tk,[[`render`,Ik],[`__file`,`/Users/ynet/dsl-card/card-editor/components/ThemeSettings.vue`]]),Rk=cn({open:!1,index:0,items:[]});function zk(e,t=0){let n=Array.isArray(e)?e.filter(e=>e&&e.src):[];n.length&&(Rk.items=n,Rk.index=Math.max(0,Math.min(n.length-1,t|0)),Rk.open=!0)}function Bk(e){if(!Rk.open)return;let t=Rk.index+e;t<0||t>=Rk.items.length||(Rk.index=t)}function Vk(){Rk.open=!1}var Hk=1.25,Uk=.05,Wk=16,Gk={name:`ImageLightbox`,data(){return{STEP:Hk,scale:1,tx:0,ty:0,natW:0,natH:0,loaded:!1,failed:!1,dragging:!1,fitScale:1,_pan:null,_prevFocus:null}},computed:{box(){return Rk},current(){return this.box.items[this.box.index]||{src:``,alt:``,title:``}},displayName(){return(this.current.alt||this.current.title||``).split(/[\\/]/).pop()||`图片`},zoomLabel(){return`${Math.round(this.scale*100)}%`},atFit(){return Math.abs(this.scale-this.fitScale)<.001&&this.tx===0&&this.ty===0},imgStyle(){let e={transform:`translate(${this.tx}px, ${this.ty}px) scale(${this.scale})`};return this.natW&&this.natH&&(e.width=`${this.natW}px`,e.height=`${this.natH}px`),e}},watch:{"box.open"(e){e?(this._prevFocus=document.activeElement,this.resetView(),this.$nextTick(()=>this.$refs.rootEl?.focus())):this._prevFocus&&this._prevFocus.focus&&(this._prevFocus.focus(),this._prevFocus=null)},"box.index"(){this.resetView()}},mounted(){window.addEventListener(`resize`,this.onResize)},beforeUnmount(){window.removeEventListener(`resize`,this.onResize),this.stopPan()},methods:{resetView(){this.scale=1,this.fitScale=1,this.tx=0,this.ty=0,this.natW=0,this.natH=0,this.loaded=!1,this.failed=!1},onLoaded(e){let t=e.target;this.natW=t.naturalWidth||0,this.natH=t.naturalHeight||0,this.loaded=!0,this.fit()},fit(){let e=this.$refs.stageEl;if(!e||!this.natW||!this.natH)return;let t=Math.max(80,e.clientWidth-96),n=Math.max(80,e.clientHeight-96);this.fitScale=Math.min(t/this.natW,n/this.natH),this.scale=this.fitScale,this.tx=0,this.ty=0},toggleFit(){this.atFit?(this.scale=1,this.tx=0,this.ty=0):this.fit()},clampScale(e){return Math.max(Uk,Math.min(Wk,e))},zoomAt(e,t,n){let r=this.$refs.stageEl;if(!r)return;let i=this.clampScale(n),a=r.getBoundingClientRect(),o=e-a.left-a.width/2,s=t-a.top-a.height/2,c=i/this.scale;this.tx=o-(o-this.tx)*c,this.ty=s-(s-this.ty)*c,this.scale=i},zoomBy(e){let t=this.$refs.stageEl;if(!t)return;let n=t.getBoundingClientRect();this.zoomAt(n.left+n.width/2,n.top+n.height/2,this.scale*e)},onWheel(e){e.preventDefault();let t=Math.exp(-e.deltaY*(e.ctrlKey?.01:.0022));this.zoomAt(e.clientX,e.clientY,this.scale*t)},onPanStart(e){e.button!==0||this.failed||(e.preventDefault(),this.dragging=!0,this._pan={x:e.clientX,y:e.clientY,tx:this.tx,ty:this.ty,id:e.pointerId},e.currentTarget.setPointerCapture?.(e.pointerId),window.addEventListener(`pointermove`,this.onPanMove),window.addEventListener(`pointerup`,this.onPanEnd))},onPanMove(e){this._pan&&(this.tx=this._pan.tx+(e.clientX-this._pan.x),this.ty=this._pan.ty+(e.clientY-this._pan.y))},onPanEnd(){this.stopPan()},stopPan(){this.dragging=!1,this._pan=null,window.removeEventListener(`pointermove`,this.onPanMove),window.removeEventListener(`pointerup`,this.onPanEnd)},onResize(){this.box.open&&this.atFit&&this.fit()},onKey(e){let t=e.key;t===`Escape`?(e.preventDefault(),this.close()):t===`ArrowLeft`?(e.preventDefault(),this.step(-1)):t===`ArrowRight`?(e.preventDefault(),this.step(1)):t===`+`||t===`=`?(e.preventDefault(),this.zoomBy(Hk)):t===`-`||t===`_`?(e.preventDefault(),this.zoomBy(1/Hk)):t===`0`?(e.preventDefault(),this.fit()):t===`1`&&(e.preventDefault(),this.scale=1,this.tx=0,this.ty=0)},step(e){Bk(e)},close(){Vk()},openRaw(){this.current.src&&window.open(this.current.src,`_blank`,`noopener`)},async copyPath(){let e=await yp(this.current.title||this.current.src);Q(e?`已复制图片路径`:`复制失败`,e?`ok`:`err`)}}},Kk=[`title`],qk={class:`imgbox__name`},Jk={key:0,class:`imgbox__count`},Yk={key:1,class:`imgbox__dims`},Xk={class:`imgbox__acts`},Zk=[`title`],Qk={key:0,class:`imgbox__fail`},$k=[`title`],eA=[`src`,`alt`],tA={key:2,class:`imgbox__spin`,"aria-hidden":`true`};function nA(e,t,n,r,i,a){return V(),U(mi,{to:`body`},[G(hc,{name:`imgbox-fade`},{default:I(()=>[a.box.open?(V(),H(`div`,{key:0,ref:`rootEl`,class:`imgbox`,role:`dialog`,"aria-modal":`true`,"aria-label":`图片预览`,tabindex:`-1`,onKeydown:t[16]||=(...e)=>a.onKey&&a.onKey(...e),onClick:t[17]||=J((...e)=>a.close&&a.close(...e),[`self`])},[q(` 顶栏:左=图名与序号 / 右=工具 `),W(`header`,{class:`imgbox__bar`,onClick:t[7]||=J(()=>{},[`stop`])},[W(`span`,{class:`imgbox__meta`,title:a.current.title||a.current.alt},[W(`span`,qk,M(a.displayName),1),a.box.items.length>1?(V(),H(`span`,Jk,M(a.box.index+1)+` / `+M(a.box.items.length),1)):q(`v-if`,!0),i.natW?(V(),H(`span`,Yk,M(i.natW)+`×`+M(i.natH),1)):q(`v-if`,!0)],8,Kk),W(`span`,Xk,[W(`button`,{type:`button`,class:`imgbox__btn`,title:`缩小(-)`,onClick:t[0]||=e=>a.zoomBy(1/i.STEP)},[...t[18]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-zoom-out`})],-1)]]),W(`button`,{type:`button`,class:`imgbox__zoom`,title:a.atFit?`当前为适应窗口,点击恢复 1:1`:`点击恢复适应窗口`,onClick:t[1]||=(...e)=>a.toggleFit&&a.toggleFit(...e)},M(a.zoomLabel),9,Zk),W(`button`,{type:`button`,class:`imgbox__btn`,title:`放大(+)`,onClick:t[2]||=e=>a.zoomBy(i.STEP)},[...t[19]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-zoom-in`})],-1)]]),t[24]||=W(`span`,{class:`imgbox__sep`},null,-1),W(`button`,{type:`button`,class:j([`imgbox__btn`,{"is-on":a.atFit}]),title:`适应窗口(0)`,onClick:t[3]||=(...e)=>a.fit&&a.fit(...e)},[...t[20]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-maximize`})],-1)]],2),W(`button`,{type:`button`,class:`imgbox__btn`,title:`复制图片路径`,onClick:t[4]||=(...e)=>a.copyPath&&a.copyPath(...e)},[...t[21]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-copy-sm`})],-1)]]),W(`button`,{type:`button`,class:`imgbox__btn`,title:`在新标签打开原图`,onClick:t[5]||=(...e)=>a.openRaw&&a.openRaw(...e)},[...t[22]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-external`})],-1)]]),t[25]||=W(`span`,{class:`imgbox__sep`},null,-1),W(`button`,{type:`button`,class:`imgbox__btn`,title:`关闭(Esc)`,onClick:t[6]||=(...e)=>a.close&&a.close(...e)},[...t[23]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-x`})],-1)]])])]),q(` 画布:图片居中,transform 承担缩放与平移 `),W(`div`,{ref:`stageEl`,class:`imgbox__stage`,onWheel:t[10]||=(...e)=>a.onWheel&&a.onWheel(...e),onPointerdown:t[11]||=(...e)=>a.onPanStart&&a.onPanStart(...e),onDblclick:t[12]||=(...e)=>a.toggleFit&&a.toggleFit(...e)},[i.failed?(V(),H(`div`,Qk,[t[26]||=W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-alert-triangle`})],-1),t[27]||=W(`span`,null,`图片加载失败`,-1),W(`code`,{title:a.current.src},M(a.displayName),9,$k)])):(V(),H(`img`,{key:a.current.src,class:j([`imgbox__img`,{"is-dragging":i.dragging,"is-loading":!i.loaded}]),src:a.current.src,alt:a.current.alt||`预览图`,draggable:`false`,style:A(a.imgStyle),onLoad:t[8]||=(...e)=>a.onLoaded&&a.onLoaded(...e),onError:t[9]||=e=>i.failed=!0},null,46,eA)),!i.loaded&&!i.failed?(V(),H(`div`,tA,[...t[28]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[W(`use`,{href:`#icon-loading`})],-1)]])):q(`v-if`,!0)],544),q(` 多张时的左右翻页 `),a.box.index>0?(V(),H(`button`,{key:0,type:`button`,class:`imgbox__nav imgbox__nav--prev`,title:`上一张(←)`,onClick:t[13]||=J(e=>a.step(-1),[`stop`])},[...t[29]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-chevron-right`})],-1)]])):q(`v-if`,!0),a.box.index<a.box.items.length-1?(V(),H(`button`,{key:1,type:`button`,class:`imgbox__nav imgbox__nav--next`,title:`下一张(→)`,onClick:t[14]||=J(e=>a.step(1),[`stop`])},[...t[30]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-chevron-right`})],-1)]])):q(`v-if`,!0),W(`footer`,{class:`imgbox__hint`,onClick:t[15]||=J(()=>{},[`stop`])},`滚轮缩放 · 拖拽平移 · 双击切换 1:1 · ←/→ 翻页 · Esc 关闭`)],544)):q(`v-if`,!0)]),_:1})])}var rA=Z(Gk,[[`render`,nA],[`__file`,`/Users/ynet/dsl-card/card-editor/components/ImageLightbox.vue`]]),iA={name:`CardGallery`,components:{ConfirmDialog:Ap},props:{visible:{type:Boolean,default:!1},cards:{type:Array,default:()=>[]},selectedId:{type:String,default:``}},emits:[`select`,`close`,`delete`,`export`],data(){return{query:``,sortByTime:this.loadSortByTime(),selectMode:!1,checked:new Set,visibleIds:new Set,failed:new Set,observer:null,base:``,pendingDelete:null,placeholderUrl:kd}},created(){this.saveSortByTime()},computed:{filtered(){let e=this.query.trim().toLowerCase(),t=this.cards;return e&&(t=t.filter(t=>t.id.toLowerCase().includes(e)||String(t.name||``).toLowerCase().includes(e))),this.sortByTime?t.slice().sort((e,t)=>(t.mtime||0)-(e.mtime||0)):t.slice().sort((e,t)=>String(e.name||``).localeCompare(String(t.name||``)))},checkedCount(){return this.checked.size},allChecked(){return this.filtered.length>0&&this.filtered.every(e=>this.checked.has(e.id))},someChecked(){return!this.allChecked&&this.filtered.some(e=>this.checked.has(e.id))}},watch:{visible(e){e?(this.query=``,this.failed=new Set,this.$nextTick(()=>{this.setupObserver(),this.focusSearch()}),window.addEventListener(`keydown`,this.onKey)):(this.teardownObserver(),window.removeEventListener(`keydown`,this.onKey),this.selectMode=!1,this.checked=new Set)},query(){this.visible&&this.$nextTick(this.setupObserver)},sortByTime(e){this.saveSortByTime()},selectMode(e){e||(this.checked=new Set)}},beforeUnmount(){this.teardownObserver(),window.removeEventListener(`keydown`,this.onKey)},methods:{askDelete(e){this.pendingDelete=e},confirmDelete(){let e=this.pendingDelete;this.pendingDelete=null,e&&(this.visibleIds.delete(e.id),this.failed.delete(e.id),this.$emit(`delete`,e.id))},thumbUrl(e){return(this.base||Jl()||``)+`/__card-image/`+encodeURIComponent(e)},setupObserver(){this.base=Jl()||``;let e=this.$refs.grid;e&&(this.teardownObserver(),this.observer=new IntersectionObserver(e=>{for(let t of e){if(!t.isIntersecting)continue;let e=t.target.getAttribute(`data-id`);if(e&&!this.visibleIds.has(e)){let t=new Set(this.visibleIds);t.add(e),this.visibleIds=t}this.observer.unobserve(t.target)}},{root:e,rootMargin:`200px`}),e.querySelectorAll(`.cg-tile`).forEach(e=>this.observer.observe(e)))},teardownObserver(){this.observer&&=(this.observer.disconnect(),null)},onImgError(e){let t=new Set(this.failed);t.add(e),this.failed=t},loadSortByTime(){try{return localStorage.getItem(`cardbuddy:cardgallery-sort-by-time`)===`1`}catch{return!1}},saveSortByTime(){try{localStorage.setItem(`cardbuddy:cardgallery-sort-by-time`,this.sortByTime?`1`:`0`)}catch{}},toggleSort(){this.sortByTime=!this.sortByTime},onKey(e){e.key===`Escape`&&this.close()},focusSearch(){this.$refs.search&&this.$refs.search.focus()},onTileClick(e){e&&(this.selectMode?this.toggleOne(e.id):this.choose(e))},toggleOne(e){let t=new Set(this.checked);t.has(e)?t.delete(e):t.add(e),this.checked=t},toggleAll(){if(this.allChecked){let e=new Set(this.checked);for(let t of this.filtered)e.delete(t.id);this.checked=e}else{let e=new Set(this.checked);for(let t of this.filtered)e.add(t.id);this.checked=e}},requestExport(){this.checkedCount&&this.$emit(`export`,[...this.checked])},choose(e){e&&(this.$emit(`select`,e.id),this.close())},close(){this.$emit(`close`)}}},aA={class:`cg-modal modal-card`,role:`dialog`,"aria-modal":`true`,"aria-label":`卡片网格预览`},oA={class:`cg-modal__head`},sA={class:`cg-modal__title`},cA={class:`cg-modal__count`},lA={class:`cg-modal__search`},uA=[`title`,`aria-pressed`],dA=[`title`],fA={ref:`grid`,class:`cg-grid`},pA=[`data-id`,`onClick`],mA={class:`cg-tile__thumb`},hA={key:0,class:`cg-tile__tag`,title:`导入卡片(含 .import-meta.json 来源信息)`},gA=[`aria-checked`,`aria-label`,`title`,`onClick`],_A={key:0,class:`cg-tile__cb-mark`,viewBox:`0 0 12 12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},vA=[`src`,`alt`,`onError`],yA={key:3,class:`cg-tile__skeleton`},bA=[`src`,`alt`],xA={class:`cg-tile__meta`},SA=[`title`],CA=[`title`],wA=[`title`,`aria-label`,`onClick`,`onKeydown`],TA={key:0,class:`cg-empty`},EA={key:0,class:`cg-foot`},DA=[`title`],OA=[`checked`,`.indeterminate`,`disabled`],kA=[`disabled`,`title`];function AA(e,t,n,r,i,a){let o=R(`ConfirmDialog`);return V(),U(hc,{name:`modal`},{default:I(()=>[n.visible?(V(),H(`div`,{key:0,class:`cg-mask`,onClick:t[7]||=J((...e)=>a.close&&a.close(...e),[`self`])},[W(`div`,aA,[W(`header`,oA,[W(`div`,sA,[t[8]||=W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-grid`})],-1),t[9]||=W(`span`,null,`卡片网格预览`,-1),W(`span`,cA,M(n.cards.length)+` 张本地卡片`,1)]),W(`div`,lA,[t[10]||=W(`svg`,{class:`cg-modal__search-icon`,viewBox:`0 0 16 16`,width:`13`,height:`13`,"aria-hidden":`true`},[W(`use`,{href:`#icon-search`})],-1),L(W(`input`,{ref:`search`,"onUpdate:modelValue":t[0]||=e=>i.query=e,class:`cg-modal__input`,type:`text`,placeholder:`搜索卡片 ID / 名称…`},null,512),[[gl,i.query]])]),W(`button`,{class:j([`cg-modal__sort`,{"cg-modal__sort--active":i.sortByTime}]),type:`button`,title:i.sortByTime?`已按修改时间排序(新→旧),点击取消`:`按修改时间排序(新→旧)`,"aria-pressed":i.sortByTime,onClick:t[1]||=(...e)=>a.toggleSort&&a.toggleSort(...e)},`按修改时间排序`,10,uA),q(` 导出选择模式开关:头部右上角(关闭钮左侧),进入后格子出勾选框、底部出导出操作栏 `),W(`label`,{class:j([`cg-modal__selmode`,{"cg-modal__selmode--active":i.selectMode}]),title:i.selectMode?`退出选择模式`:`进入选择模式(勾选卡片后导出)`},[L(W(`input`,{class:`cg-cb`,type:`checkbox`,"onUpdate:modelValue":t[2]||=e=>i.selectMode=e},null,512),[[_l,i.selectMode]]),t[11]||=W(`span`,{class:`cg-modal__selmode-text`},`选择`,-1)],10,dA),W(`button`,{class:`cg-modal__close`,type:`button`,title:`关闭`,onClick:t[3]||=(...e)=>a.close&&a.close(...e),"aria-label":`关闭`},[...t[12]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-x`})],-1)]])]),W(`div`,fA,[(V(!0),H(B,null,z(a.filtered,e=>(V(),H(`button`,{key:e.id,"data-id":e.id,type:`button`,class:j([`cg-tile`,{"cg-tile--active":e.id===n.selectedId,"cg-tile--failed":i.failed.has(e.id),"cg-tile--checked":i.selectMode&&i.checked.has(e.id)}]),onClick:t=>a.onTileClick(e)},[W(`div`,mA,[q(` 导入标记:仅含 .import-meta.json 侧车的卡(经远端同步导入)显示,悬浮于缩略图右上角 `),e.imported?(V(),H(`span`,hA,`导入`)):q(`v-if`,!0),q(` 选择模式勾选框:格子左上角(与 rac-tile__cb 同观感)。
257
+ `);let l=b(n,r,o),d=new i(t.getSymbolSize(n));return m(d,n),h(d),g(d,n),v(d,r,0),n>=7&&_(d,n),y(d,l),isNaN(a)&&(a=s.getBestMask(d,v.bind(null,d,r))),s.applyMask(a,d),v(d,r,a),{modules:d,version:n,errorCorrectionLevel:r,maskPattern:a,segments:o}}e.create=function(e,r){if(e===void 0||e===``)throw Error(`No input text`);let i=n.M,a,o;return r!==void 0&&(i=n.from(r.errorCorrectionLevel,n.M),a=u.from(r.version),o=s.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),S(e,a,i,o)}})),qO=o((e=>{function t(e){if(typeof e==`number`&&(e=e.toString()),typeof e!=`string`)throw Error(`Color should be defined as hex string`);let t=e.slice().replace(`#`,``).split(``);if(t.length<3||t.length===5||t.length>8)throw Error(`Invalid hex color: `+e);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),t.length===6&&t.push(`F`,`F`);let n=parseInt(t.join(``),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:`#`+t.slice(0,6).join(``)}}e.getOptions=function(e){e||={},e.color||(e.color={});let n=e.margin===void 0||e.margin===null||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:t(e.color.dark||`#000000ff`),light:t(e.color.light||`#ffffffff`)},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale},e.getImageWidth=function(t,n){let r=e.getScale(t,n);return Math.floor((t+n.margin*2)*r)},e.qrToImageData=function(t,n,r){let i=n.modules.size,a=n.modules.data,o=e.getScale(i,r),s=Math.floor((i+r.margin*2)*o),c=r.margin*o,l=[r.color.light,r.color.dark];for(let e=0;e<s;e++)for(let n=0;n<s;n++){let u=(e*s+n)*4,d=r.color.light;if(e>=c&&n>=c&&e<s-c&&n<s-c){let t=Math.floor((e-c)/o),r=Math.floor((n-c)/o);d=l[+!!a[t*i+r]]}t[u++]=d.r,t[u++]=d.g,t[u++]=d.b,t[u]=d.a}}})),JO=o((e=>{var t=qO();function n(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||={},t.height=n,t.width=n,t.style.height=n+`px`,t.style.width=n+`px`}function r(){try{return document.createElement(`canvas`)}catch{throw Error(`You need to specify a canvas element`)}}e.render=function(e,i,a){let o=a,s=i;o===void 0&&(!i||!i.getContext)&&(o=i,i=void 0),i||(s=r()),o=t.getOptions(o);let c=t.getImageWidth(e.modules.size,o),l=s.getContext(`2d`),u=l.createImageData(c,c);return t.qrToImageData(u.data,e,o),n(l,s,c),l.putImageData(u,0,0),s},e.renderToDataURL=function(t,n,r){let i=r;i===void 0&&(!n||!n.getContext)&&(i=n,n=void 0),i||={};let a=e.render(t,n,i),o=i.type||`image/png`,s=i.rendererOpts||{};return a.toDataURL(o,s.quality)}})),YO=o((e=>{var t=qO();function n(e,t){let n=e.a/255,r=t+`="`+e.hex+`"`;return n<1?r+` `+t+`-opacity="`+n.toFixed(2).slice(1)+`"`:r}function r(e,t,n){let r=e+t;return n!==void 0&&(r+=` `+n),r}function i(e,t,n){let i=``,a=0,o=!1,s=0;for(let c=0;c<e.length;c++){let l=Math.floor(c%t),u=Math.floor(c/t);!l&&!o&&(o=!0),e[c]?(s++,c>0&&l>0&&e[c-1]||(i+=o?r(`M`,l+n,.5+u+n):r(`m`,a,0),a=0,o=!1),l+1<t&&e[c+1]||(i+=r(`h`,s),s=0)):a++}return i}e.render=function(e,r,a){let o=t.getOptions(r),s=e.modules.size,c=e.modules.data,l=s+o.margin*2,u=o.color.light.a?`<path `+n(o.color.light,`fill`)+` d="M0 0h`+l+`v`+l+`H0z"/>`:``,d=`<path `+n(o.color.dark,`stroke`)+` d="`+i(c,s,o.margin)+`"/>`,f=`viewBox="0 0 `+l+` `+l+`"`,p=`<svg xmlns="http://www.w3.org/2000/svg" `+(o.width?`width="`+o.width+`" height="`+o.width+`" `:``)+f+` shape-rendering="crispEdges">`+u+d+`</svg>
258
+ `;return typeof a==`function`&&a(null,p),p}})),XO=c(o((e=>{var t=CO(),n=KO(),r=JO(),i=YO();function a(e,r,i,a,o){let s=[].slice.call(arguments,1),c=s.length,l=typeof s[c-1]==`function`;if(!l&&!t())throw Error(`Callback required as last argument`);if(l){if(c<2)throw Error(`Too few arguments provided`);c===2?(o=i,i=r,r=a=void 0):c===3&&(r.getContext&&o===void 0?(o=a,a=void 0):(o=a,a=i,i=r,r=void 0))}else{if(c<1)throw Error(`Too few arguments provided`);return c===1?(i=r,r=a=void 0):c===2&&!r.getContext&&(a=i,i=r,r=void 0),new Promise(function(t,o){try{t(e(n.create(i,a),r,a))}catch(e){o(e)}})}try{let t=n.create(i,a);o(null,e(t,r,a))}catch(e){o(e)}}e.create=n.create,e.toCanvas=a.bind(null,r.render),e.toDataURL=a.bind(null,r.renderToDataURL),e.toString=a.bind(null,function(e,t,n){return i.render(e,n)})}))()),ZO={name:`RemotePreview`,props:{visible:{type:Boolean,default:!1},pageId:{type:[String,Number],default:``},schema:{type:Object,default:null},cardCode:{type:String,default:``}},data(){return{qrDataUrl:``,url:``,loading:!1,publishing:!1,copied:!1,copyTimer:null,warn:``,code:``}},watch:{visible(e){e&&this.open()},pageId(){this.visible&&this.open()}},beforeUnmount(){this.copyTimer&&clearTimeout(this.copyTimer)},methods:{buildSocket(e){return`${`https://uat-pkg.finmall.com`.replace(/^https?:/,`wss:`)}/pmb-web/websocket/card/${e}`},fullUrl(e,t){let n=this.buildSocket(e);return`app://previewCard?cardId=${encodeURIComponent(e)}&cardCode=${encodeURIComponent(t||``)}&cardVersion=00000000&socket=${encodeURIComponent(n)}`},async makeQr(e){return XO.toDataURL(e,{width:220,margin:1,errorCorrectionLevel:`H`,color:{dark:`#10131a`,light:`#ffffff`}})},async open(){this.qrDataUrl=``,this.url=``,this.loading=!0,this.publishing=!1,this.copied=!1,this.warn=``,this.code=this.cardCode||``;let e=String(this.pageId||``).trim();if(!e)this.warn=`当前卡片缺少 pageId(远端卡片 id),无法生成预览二维码`,this.loading=!1;else{this.url=`app://previewCard?cardId=${encodeURIComponent(e)}`;try{this.qrDataUrl=await this.makeQr(this.url)}catch(e){this.warn=`二维码生成失败:`+(e&&e.message)}this.publishing=!0;try{let t=await Y(`/__preview`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({schema:this.schema||{pageId:e}})}),n=await t.json().catch(()=>({}));if(!t.ok)throw Error(n.message||`preview failed`);n.cardCode!==void 0&&(this.code=n.cardCode),this.url=this.fullUrl(e,this.code),this.qrDataUrl=await this.makeQr(this.url)}catch(e){this.warn=`远端发布失败:`+(e&&e.message)}finally{this.publishing=!1,this.loading=!1}}},async copyUrl(){if(this.url)try{if(navigator.clipboard&&navigator.clipboard.writeText)await navigator.clipboard.writeText(this.url);else{let e=document.createElement(`textarea`);e.value=this.url,e.style.position=`fixed`,e.style.opacity=`0`,document.body.appendChild(e),e.select(),document.execCommand(`copy`),document.body.removeChild(e)}this.copied=!0,this.copyTimer&&clearTimeout(this.copyTimer),this.copyTimer=setTimeout(()=>{this.copied=!1},1500)}catch(e){this.warn=`复制失败:`+(e&&e.message)}}}},QO={class:`rp-card modal-card`,role:`dialog`,"aria-label":`远端预览二维码`},$O={class:`rp-head`},ek={class:`rp-body`},tk={class:`rp-qr-wrap`},nk=[`src`],rk={key:1,class:`rp-qr rp-qr--loading`},ik={key:2,class:`rp-qr-loading`},ak={class:`rp-url`},ok={class:`rp-url-text`},sk=[`disabled`],ck={key:0,class:`rp-warn`};function lk(e,t,n,r,i,a){return V(),U(hc,{name:`modal`},{default:I(()=>[n.visible?(V(),H(`div`,{key:0,class:`rp-mask`,onClick:t[2]||=J(t=>e.$emit(`close`),[`self`])},[W(`div`,QO,[W(`div`,$O,[t[3]||=W(`span`,{class:`rp-title`},`远端预览(真机扫码)`,-1),W(`button`,{class:`rp-x`,type:`button`,onClick:t[0]||=t=>e.$emit(`close`),"aria-label":`关闭`},`×`)]),W(`div`,ek,[W(`div`,tk,[i.qrDataUrl?(V(),H(`img`,{key:0,src:i.qrDataUrl,class:j([`rp-qr`,{"rp-qr--blurred":i.publishing}]),alt:`preview qr`},null,10,nk)):(V(),H(`div`,rk,M(i.loading?`准备中…`:`—`),1)),i.publishing?(V(),H(`div`,ik,[...t[4]||=[W(`span`,{class:`rp-spinner`},null,-1),W(`span`,{class:`rp-loading-text`},`正在发布预览…`,-1)]])):q(`v-if`,!0)]),t[5]||=W(`p`,{class:`rp-tip`},`手机(远端 App)扫一扫,真机查看当前卡片预览`,-1),W(`div`,ak,[W(`code`,ok,M(i.url||`—`),1),W(`button`,{class:`rp-copy`,type:`button`,disabled:!i.url,onClick:t[1]||=(...e)=>a.copyUrl&&a.copyUrl(...e)},M(i.copied?`已复制 ✓`:`复制链接`),9,sk)]),i.warn?(V(),H(`p`,ck,M(i.warn),1)):q(`v-if`,!0)])])])):q(`v-if`,!0)]),_:1})}var uk=Z(ZO,[[`render`,lk],[`__file`,`/Users/ynet/dsl-card/card-editor/components/RemotePreview.vue`]]),dk={name:`AppToast`,computed:{toast(){return bp},iconHref(){return this.toast.type===`ok`?`#icon-check-plain`:this.toast.type===`warn`?`#icon-alert-triangle`:`#icon-x`}}},fk={class:`apptoast__icon`},pk={class:`apptoast__icon-svg`,viewBox:`0 0 24 24`,"aria-hidden":`true`},mk=[`href`],hk={class:`apptoast__msg`};function gk(e,t,n,r,i,a){return V(),U(hc,{name:`apptoast-fade`},{default:I(()=>[a.toast.visible?(V(),H(`div`,{key:0,class:j([`apptoast`,`apptoast--`+a.toast.type]),role:`status`,"aria-live":`polite`},[W(`span`,fk,[(V(),H(`svg`,pk,[W(`use`,{href:a.iconHref},null,8,mk)]))]),W(`span`,hk,M(a.toast.message),1)],2)):q(`v-if`,!0)]),_:1})}var _k=Z(dk,[[`render`,gk],[`__file`,`/Users/ynet/dsl-card/card-editor/components/AppToast.vue`]]),vk=[{key:`blue`,name:`默认`,swatch:`#4F6BF2`},{key:`yellow`,name:`黄`,swatch:`#E0A32B`},{key:`green`,name:`绿`,swatch:`#2FA35B`},{key:`orange`,name:`橙`,swatch:`#E8761F`}],yk=`cardbuddy:accent`,bk=`blue`;function xk(e){return vk.some(t=>t.key===e)}function Sk(){try{let e=localStorage.getItem(yk);return xk(e)?e:bk}catch{return bk}}function Ck(e){let t=document.documentElement;!xk(e)||e===`blue`?t.removeAttribute(`data-accent`):t.dataset.accent=e}function wk(e){try{localStorage.setItem(yk,e)}catch{}}var Tk=[{key:`light`,name:`浅色`,icon:`#icon-sun`},{key:`dark`,name:`深色`,icon:`#icon-moon`}],Ek={name:`ThemeSettings`,props:{theme:{type:String,default:`dark`},accent:{type:String,default:`blue`},disabled:{type:Boolean,default:!1}},emits:[`update:theme`,`update:accent`],data(){return{open:!1,MODES:Tk,presets:vk}},watch:{disabled(e){e&&(this.open=!1)},open(e){e?document.addEventListener(`keydown`,this.onKeydown):document.removeEventListener(`keydown`,this.onKeydown)}},beforeUnmount(){document.removeEventListener(`keydown`,this.onKeydown)},methods:{toggle(){this.disabled||(this.open=!this.open)},pickTheme(e){e!==this.theme&&this.$emit(`update:theme`,e)},pickAccent(e){e!==this.accent&&this.$emit(`update:accent`,e)},onKeydown(e){e.key===`Escape`&&(this.open=!1)}}},Dk={class:`app__theme`},Ok=[`disabled`,`title`,`aria-expanded`],kk={class:`app__theme-head`},Ak={class:`app__theme-body`},jk={class:`app__theme-seg`,role:`radiogroup`,"aria-label":`外观`},Mk=[`aria-checked`,`data-testid`,`onClick`],Nk={class:`app__theme-seg-icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},Pk=[`href`],Fk={class:`app__theme-swatches`,role:`radiogroup`,"aria-label":`主题色`},Ik=[`aria-checked`,`title`,`data-testid`,`onClick`];function Lk(e,t,n,r,i,a){return V(),H(`div`,Dk,[W(`button`,{class:j([`app__btn app__btn--icon`,{"app__btn--active":i.open}]),type:`button`,disabled:n.disabled,title:i.open?`收起主题设置`:`主题设置(外观 / 主题色)`,"aria-haspopup":`dialog`,"aria-expanded":i.open?`true`:`false`,"data-testid":`theme-settings-trigger`,onClick:t[0]||=(...e)=>a.toggle&&a.toggle(...e)},[...t[4]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-palette`})],-1)]],10,Ok),q(` 点遮罩关闭:与本顶栏「本地开发服务」浮层同一交互 `),i.open?(V(),H(`div`,{key:0,class:`app__theme-mask`,onClick:t[1]||=e=>i.open=!1})):q(`v-if`,!0),G(hc,{name:`pop`},{default:I(()=>[i.open?(V(),H(`div`,{key:0,class:`app__theme-panel`,role:`dialog`,"aria-label":`主题设置`,onClick:t[3]||=J(()=>{},[`stop`])},[W(`div`,kk,[t[5]||=W(`span`,{class:`app__theme-title`},`主题设置`,-1),W(`button`,{class:`app__theme-close`,type:`button`,title:`关闭`,onClick:t[2]||=e=>i.open=!1})]),W(`div`,Ak,[q(` 外观:浅色 / 深色分段控件 `),W(`section`,null,[t[6]||=W(`div`,{class:`app__theme-label`},[W(`span`,null,`外观`)],-1),W(`div`,jk,[(V(!0),H(B,null,z(i.MODES,e=>(V(),H(`button`,{key:e.key,class:j([`app__theme-seg-btn`,{"is-active":n.theme===e.key}]),type:`button`,role:`radio`,"aria-checked":n.theme===e.key?`true`:`false`,"data-testid":`theme-mode-`+e.key,onClick:t=>a.pickTheme(e.key)},[(V(),H(`svg`,Nk,[W(`use`,{href:e.icon},null,8,Pk)])),W(`span`,null,M(e.name),1)],10,Mk))),128))])]),q(` 主题色:四档色板(默认 / 黄 / 绿 / 橙) `),W(`section`,null,[t[7]||=W(`div`,{class:`app__theme-label`},[W(`span`,null,`主题色`),W(`span`,{class:`app__theme-label-note`},`强调色`)],-1),W(`div`,Fk,[(V(!0),H(B,null,z(i.presets,e=>(V(),H(`button`,{key:e.key,class:j([`app__theme-swatch`,{"is-active":n.accent===e.key}]),type:`button`,role:`radio`,"aria-checked":n.accent===e.key?`true`:`false`,title:e.name+(e.key===`blue`?`(品牌蓝)`:``),"data-testid":`accent-`+e.key,onClick:t=>a.pickAccent(e.key)},[W(`span`,{class:`app__theme-dot`,style:A({background:e.swatch})},null,4),W(`span`,null,M(e.name),1)],10,Ik))),128))])])]),t[8]||=W(`p`,{class:`app__theme-hint`},`主题色作用于按钮、选中态、链接与高亮等外壳元素,不影响卡片内容本身的配色。`,-1)])):q(`v-if`,!0)]),_:1})])}var Rk=Z(Ek,[[`render`,Lk],[`__file`,`/Users/ynet/dsl-card/card-editor/components/ThemeSettings.vue`]]),zk=cn({open:!1,index:0,items:[]});function Bk(e,t=0){let n=Array.isArray(e)?e.filter(e=>e&&e.src):[];n.length&&(zk.items=n,zk.index=Math.max(0,Math.min(n.length-1,t|0)),zk.open=!0)}function Vk(e){if(!zk.open)return;let t=zk.index+e;t<0||t>=zk.items.length||(zk.index=t)}function Hk(){zk.open=!1}var Uk=1.25,Wk=.05,Gk=16,Kk={name:`ImageLightbox`,data(){return{STEP:Uk,scale:1,tx:0,ty:0,natW:0,natH:0,loaded:!1,failed:!1,dragging:!1,fitScale:1,_pan:null,_prevFocus:null}},computed:{box(){return zk},current(){return this.box.items[this.box.index]||{src:``,alt:``,title:``}},displayName(){return(this.current.alt||this.current.title||``).split(/[\\/]/).pop()||`图片`},zoomLabel(){return`${Math.round(this.scale*100)}%`},atFit(){return Math.abs(this.scale-this.fitScale)<.001&&this.tx===0&&this.ty===0},imgStyle(){let e={transform:`translate(${this.tx}px, ${this.ty}px) scale(${this.scale})`};return this.natW&&this.natH&&(e.width=`${this.natW}px`,e.height=`${this.natH}px`),e}},watch:{"box.open"(e){e?(this._prevFocus=document.activeElement,this.resetView(),this.$nextTick(()=>this.$refs.rootEl?.focus())):this._prevFocus&&this._prevFocus.focus&&(this._prevFocus.focus(),this._prevFocus=null)},"box.index"(){this.resetView()}},mounted(){window.addEventListener(`resize`,this.onResize)},beforeUnmount(){window.removeEventListener(`resize`,this.onResize),this.stopPan()},methods:{resetView(){this.scale=1,this.fitScale=1,this.tx=0,this.ty=0,this.natW=0,this.natH=0,this.loaded=!1,this.failed=!1},onLoaded(e){let t=e.target;this.natW=t.naturalWidth||0,this.natH=t.naturalHeight||0,this.loaded=!0,this.fit()},fit(){let e=this.$refs.stageEl;if(!e||!this.natW||!this.natH)return;let t=Math.max(80,e.clientWidth-96),n=Math.max(80,e.clientHeight-96);this.fitScale=Math.min(t/this.natW,n/this.natH),this.scale=this.fitScale,this.tx=0,this.ty=0},toggleFit(){this.atFit?(this.scale=1,this.tx=0,this.ty=0):this.fit()},clampScale(e){return Math.max(Wk,Math.min(Gk,e))},zoomAt(e,t,n){let r=this.$refs.stageEl;if(!r)return;let i=this.clampScale(n),a=r.getBoundingClientRect(),o=e-a.left-a.width/2,s=t-a.top-a.height/2,c=i/this.scale;this.tx=o-(o-this.tx)*c,this.ty=s-(s-this.ty)*c,this.scale=i},zoomBy(e){let t=this.$refs.stageEl;if(!t)return;let n=t.getBoundingClientRect();this.zoomAt(n.left+n.width/2,n.top+n.height/2,this.scale*e)},onWheel(e){e.preventDefault();let t=Math.exp(-e.deltaY*(e.ctrlKey?.01:.0022));this.zoomAt(e.clientX,e.clientY,this.scale*t)},onPanStart(e){e.button!==0||this.failed||(e.preventDefault(),this.dragging=!0,this._pan={x:e.clientX,y:e.clientY,tx:this.tx,ty:this.ty,id:e.pointerId},e.currentTarget.setPointerCapture?.(e.pointerId),window.addEventListener(`pointermove`,this.onPanMove),window.addEventListener(`pointerup`,this.onPanEnd))},onPanMove(e){this._pan&&(this.tx=this._pan.tx+(e.clientX-this._pan.x),this.ty=this._pan.ty+(e.clientY-this._pan.y))},onPanEnd(){this.stopPan()},stopPan(){this.dragging=!1,this._pan=null,window.removeEventListener(`pointermove`,this.onPanMove),window.removeEventListener(`pointerup`,this.onPanEnd)},onResize(){this.box.open&&this.atFit&&this.fit()},onKey(e){let t=e.key;t===`Escape`?(e.preventDefault(),this.close()):t===`ArrowLeft`?(e.preventDefault(),this.step(-1)):t===`ArrowRight`?(e.preventDefault(),this.step(1)):t===`+`||t===`=`?(e.preventDefault(),this.zoomBy(Uk)):t===`-`||t===`_`?(e.preventDefault(),this.zoomBy(1/Uk)):t===`0`?(e.preventDefault(),this.fit()):t===`1`&&(e.preventDefault(),this.scale=1,this.tx=0,this.ty=0)},step(e){Vk(e)},close(){Hk()},openRaw(){this.current.src&&window.open(this.current.src,`_blank`,`noopener`)},async copyPath(){let e=await yp(this.current.title||this.current.src);Q(e?`已复制图片路径`:`复制失败`,e?`ok`:`err`)}}},qk=[`title`],Jk={class:`imgbox__name`},Yk={key:0,class:`imgbox__count`},Xk={key:1,class:`imgbox__dims`},Zk={class:`imgbox__acts`},Qk=[`title`],$k={key:0,class:`imgbox__fail`},eA=[`title`],tA=[`src`,`alt`],nA={key:2,class:`imgbox__spin`,"aria-hidden":`true`};function rA(e,t,n,r,i,a){return V(),U(mi,{to:`body`},[G(hc,{name:`imgbox-fade`},{default:I(()=>[a.box.open?(V(),H(`div`,{key:0,ref:`rootEl`,class:`imgbox`,role:`dialog`,"aria-modal":`true`,"aria-label":`图片预览`,tabindex:`-1`,onKeydown:t[16]||=(...e)=>a.onKey&&a.onKey(...e),onClick:t[17]||=J((...e)=>a.close&&a.close(...e),[`self`])},[q(` 顶栏:左=图名与序号 / 右=工具 `),W(`header`,{class:`imgbox__bar`,onClick:t[7]||=J(()=>{},[`stop`])},[W(`span`,{class:`imgbox__meta`,title:a.current.title||a.current.alt},[W(`span`,Jk,M(a.displayName),1),a.box.items.length>1?(V(),H(`span`,Yk,M(a.box.index+1)+` / `+M(a.box.items.length),1)):q(`v-if`,!0),i.natW?(V(),H(`span`,Xk,M(i.natW)+`×`+M(i.natH),1)):q(`v-if`,!0)],8,qk),W(`span`,Zk,[W(`button`,{type:`button`,class:`imgbox__btn`,title:`缩小(-)`,onClick:t[0]||=e=>a.zoomBy(1/i.STEP)},[...t[18]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-zoom-out`})],-1)]]),W(`button`,{type:`button`,class:`imgbox__zoom`,title:a.atFit?`当前为适应窗口,点击恢复 1:1`:`点击恢复适应窗口`,onClick:t[1]||=(...e)=>a.toggleFit&&a.toggleFit(...e)},M(a.zoomLabel),9,Qk),W(`button`,{type:`button`,class:`imgbox__btn`,title:`放大(+)`,onClick:t[2]||=e=>a.zoomBy(i.STEP)},[...t[19]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-zoom-in`})],-1)]]),t[24]||=W(`span`,{class:`imgbox__sep`},null,-1),W(`button`,{type:`button`,class:j([`imgbox__btn`,{"is-on":a.atFit}]),title:`适应窗口(0)`,onClick:t[3]||=(...e)=>a.fit&&a.fit(...e)},[...t[20]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-maximize`})],-1)]],2),W(`button`,{type:`button`,class:`imgbox__btn`,title:`复制图片路径`,onClick:t[4]||=(...e)=>a.copyPath&&a.copyPath(...e)},[...t[21]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-copy-sm`})],-1)]]),W(`button`,{type:`button`,class:`imgbox__btn`,title:`在新标签打开原图`,onClick:t[5]||=(...e)=>a.openRaw&&a.openRaw(...e)},[...t[22]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-external`})],-1)]]),t[25]||=W(`span`,{class:`imgbox__sep`},null,-1),W(`button`,{type:`button`,class:`imgbox__btn`,title:`关闭(Esc)`,onClick:t[6]||=(...e)=>a.close&&a.close(...e)},[...t[23]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-x`})],-1)]])])]),q(` 画布:图片居中,transform 承担缩放与平移 `),W(`div`,{ref:`stageEl`,class:`imgbox__stage`,onWheel:t[10]||=(...e)=>a.onWheel&&a.onWheel(...e),onPointerdown:t[11]||=(...e)=>a.onPanStart&&a.onPanStart(...e),onDblclick:t[12]||=(...e)=>a.toggleFit&&a.toggleFit(...e)},[i.failed?(V(),H(`div`,$k,[t[26]||=W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-alert-triangle`})],-1),t[27]||=W(`span`,null,`图片加载失败`,-1),W(`code`,{title:a.current.src},M(a.displayName),9,eA)])):(V(),H(`img`,{key:a.current.src,class:j([`imgbox__img`,{"is-dragging":i.dragging,"is-loading":!i.loaded}]),src:a.current.src,alt:a.current.alt||`预览图`,draggable:`false`,style:A(a.imgStyle),onLoad:t[8]||=(...e)=>a.onLoaded&&a.onLoaded(...e),onError:t[9]||=e=>i.failed=!0},null,46,tA)),!i.loaded&&!i.failed?(V(),H(`div`,nA,[...t[28]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[W(`use`,{href:`#icon-loading`})],-1)]])):q(`v-if`,!0)],544),q(` 多张时的左右翻页 `),a.box.index>0?(V(),H(`button`,{key:0,type:`button`,class:`imgbox__nav imgbox__nav--prev`,title:`上一张(←)`,onClick:t[13]||=J(e=>a.step(-1),[`stop`])},[...t[29]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-chevron-right`})],-1)]])):q(`v-if`,!0),a.box.index<a.box.items.length-1?(V(),H(`button`,{key:1,type:`button`,class:`imgbox__nav imgbox__nav--next`,title:`下一张(→)`,onClick:t[14]||=J(e=>a.step(1),[`stop`])},[...t[30]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-chevron-right`})],-1)]])):q(`v-if`,!0),W(`footer`,{class:`imgbox__hint`,onClick:t[15]||=J(()=>{},[`stop`])},`滚轮缩放 · 拖拽平移 · 双击切换 1:1 · ←/→ 翻页 · Esc 关闭`)],544)):q(`v-if`,!0)]),_:1})])}var iA=Z(Kk,[[`render`,rA],[`__file`,`/Users/ynet/dsl-card/card-editor/components/ImageLightbox.vue`]]),aA={name:`CardGallery`,components:{ConfirmDialog:Ap},props:{visible:{type:Boolean,default:!1},cards:{type:Array,default:()=>[]},selectedId:{type:String,default:``},compiling:{type:Boolean,default:!1}},emits:[`select`,`close`,`delete`,`export`,`compile`],data(){return{query:``,sortByTime:this.loadSortByTime(),selectMode:!1,checked:new Set,visibleIds:new Set,failed:new Set,observer:null,base:``,pendingDelete:null,placeholderUrl:kd,busyVisible:!1,busyCount:0,busyElapsed:0,busyShowTimer:null,busyTickTimer:null}},created(){this.saveSortByTime()},computed:{filtered(){let e=this.query.trim().toLowerCase(),t=this.cards;return e&&(t=t.filter(t=>t.id.toLowerCase().includes(e)||String(t.name||``).toLowerCase().includes(e))),this.sortByTime?t.slice().sort((e,t)=>(t.mtime||0)-(e.mtime||0)):t.slice().sort((e,t)=>String(e.name||``).localeCompare(String(t.name||``)))},checkedCount(){return this.checked.size},allChecked(){return this.filtered.length>0&&this.filtered.every(e=>this.checked.has(e.id))},someChecked(){return!this.allChecked&&this.filtered.some(e=>this.checked.has(e.id))}},watch:{visible(e){e?(this.query=``,this.failed=new Set,this.$nextTick(()=>{this.setupObserver(),this.focusSearch()}),window.addEventListener(`keydown`,this.onKey)):(this.teardownObserver(),window.removeEventListener(`keydown`,this.onKey),this.selectMode=!1,this.checked=new Set)},query(){this.visible&&this.$nextTick(this.setupObserver)},sortByTime(e){this.saveSortByTime()},selectMode(e){e||(this.checked=new Set)},compiling(e){e?this.startBusy():this.stopBusy()}},beforeUnmount(){this.teardownObserver(),this.stopBusy(),window.removeEventListener(`keydown`,this.onKey)},methods:{askDelete(e){this.pendingDelete=e},confirmDelete(){let e=this.pendingDelete;this.pendingDelete=null,e&&(this.visibleIds.delete(e.id),this.failed.delete(e.id),this.$emit(`delete`,e.id))},thumbUrl(e){return(this.base||Jl()||``)+`/__card-image/`+encodeURIComponent(e)},setupObserver(){this.base=Jl()||``;let e=this.$refs.grid;e&&(this.teardownObserver(),this.observer=new IntersectionObserver(e=>{for(let t of e){if(!t.isIntersecting)continue;let e=t.target.getAttribute(`data-id`);if(e&&!this.visibleIds.has(e)){let t=new Set(this.visibleIds);t.add(e),this.visibleIds=t}this.observer.unobserve(t.target)}},{root:e,rootMargin:`200px`}),e.querySelectorAll(`.cg-tile`).forEach(e=>this.observer.observe(e)))},teardownObserver(){this.observer&&=(this.observer.disconnect(),null)},onImgError(e){let t=new Set(this.failed);t.add(e),this.failed=t},loadSortByTime(){try{return localStorage.getItem(`cardbuddy:cardgallery-sort-by-time`)===`1`}catch{return!1}},saveSortByTime(){try{localStorage.setItem(`cardbuddy:cardgallery-sort-by-time`,this.sortByTime?`1`:`0`)}catch{}},toggleSort(){this.sortByTime=!this.sortByTime},onKey(e){e.key===`Escape`&&this.close()},focusSearch(){this.$refs.search&&this.$refs.search.focus()},onTileClick(e){e&&(this.selectMode?this.toggleOne(e.id):this.choose(e))},toggleOne(e){let t=new Set(this.checked);t.has(e)?t.delete(e):t.add(e),this.checked=t},toggleAll(){if(this.allChecked){let e=new Set(this.checked);for(let t of this.filtered)e.delete(t.id);this.checked=e}else{let e=new Set(this.checked);for(let t of this.filtered)e.add(t.id);this.checked=e}},requestExport(){this.checkedCount&&this.$emit(`export`,[...this.checked])},requestCompile(){this.checkedCount&&!this.compiling&&(this.busyCount=this.checkedCount,this.$emit(`compile`,[...this.checked]))},startBusy(){this.stopBusy(),this.busyElapsed=0,this.busyShowTimer=setTimeout(()=>{this.busyShowTimer=null,this.busyVisible=!0,this.busyTickTimer=setInterval(()=>{this.busyElapsed+=1},1e3)},240)},stopBusy(){this.busyShowTimer&&=(clearTimeout(this.busyShowTimer),null),this.busyTickTimer&&=(clearInterval(this.busyTickTimer),null),this.busyVisible=!1,this.busyElapsed=0},setChecked(e){this.checked=new Set(Array.isArray(e)?e:[])},choose(e){e&&(this.$emit(`select`,e.id),this.close())},close(){this.compiling?Q(`编译进行中,完成后自动解除`,`warn`,1600):this.$emit(`close`)}}},oA={class:`cg-modal modal-card`,role:`dialog`,"aria-modal":`true`,"aria-label":`卡片网格预览`},sA={class:`cg-modal__head`},cA={class:`cg-modal__title`},lA={class:`cg-modal__count`},uA={class:`cg-modal__search`},dA=[`title`,`aria-pressed`],fA=[`title`],pA={ref:`grid`,class:`cg-grid`},mA=[`data-id`,`onClick`],hA={class:`cg-tile__thumb`},gA={key:0,class:`cg-tile__tag`,title:`导入卡片(含 .import-meta.json 来源信息)`},_A=[`aria-checked`,`aria-label`,`title`,`onClick`],vA={key:0,class:`cg-tile__cb-mark`,viewBox:`0 0 12 12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},yA=[`src`,`alt`,`onError`],bA={key:3,class:`cg-tile__skeleton`},xA=[`src`,`alt`],SA={class:`cg-tile__meta`},CA=[`title`],wA=[`title`],TA=[`title`,`aria-label`,`onClick`,`onKeydown`],EA={key:0,class:`cg-empty`},DA={key:0,class:`cg-foot`},OA=[`title`],kA=[`checked`,`.indeterminate`,`disabled`],AA=[`disabled`,`title`],jA=[`disabled`,`title`],MA={key:0,class:`cg-busy`,role:`status`,"aria-live":`polite`,"aria-busy":`true`},NA={class:`cg-busy__box`},PA={class:`cg-busy__title`},FA={class:`cg-busy__time`};function IA(e,t,n,r,i,a){let o=R(`ConfirmDialog`);return V(),U(hc,{name:`modal`},{default:I(()=>[n.visible?(V(),H(`div`,{key:0,class:`cg-mask`,onClick:t[8]||=J((...e)=>a.close&&a.close(...e),[`self`])},[W(`div`,oA,[W(`header`,sA,[W(`div`,cA,[t[9]||=W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-grid`})],-1),t[10]||=W(`span`,null,`卡片网格预览`,-1),W(`span`,lA,M(n.cards.length)+` 张本地卡片`,1)]),W(`div`,uA,[t[11]||=W(`svg`,{class:`cg-modal__search-icon`,viewBox:`0 0 16 16`,width:`13`,height:`13`,"aria-hidden":`true`},[W(`use`,{href:`#icon-search`})],-1),L(W(`input`,{ref:`search`,"onUpdate:modelValue":t[0]||=e=>i.query=e,class:`cg-modal__input`,type:`text`,placeholder:`搜索卡片 ID / 名称…`},null,512),[[gl,i.query]])]),W(`button`,{class:j([`cg-modal__sort`,{"cg-modal__sort--active":i.sortByTime}]),type:`button`,title:i.sortByTime?`已按修改时间排序(新→旧),点击取消`:`按修改时间排序(新→旧)`,"aria-pressed":i.sortByTime,onClick:t[1]||=(...e)=>a.toggleSort&&a.toggleSort(...e)},`按修改时间排序`,10,dA),q(` 导出选择模式开关:头部右上角(关闭钮左侧),进入后格子出勾选框、底部出导出操作栏 `),W(`label`,{class:j([`cg-modal__selmode`,{"cg-modal__selmode--active":i.selectMode}]),title:i.selectMode?`退出选择模式`:`进入选择模式(勾选卡片后导出)`},[L(W(`input`,{class:`cg-cb`,type:`checkbox`,"onUpdate:modelValue":t[2]||=e=>i.selectMode=e},null,512),[[_l,i.selectMode]]),t[12]||=W(`span`,{class:`cg-modal__selmode-text`},`选择`,-1)],10,fA),W(`button`,{class:`cg-modal__close`,type:`button`,title:`关闭`,onClick:t[3]||=(...e)=>a.close&&a.close(...e),"aria-label":`关闭`},[...t[13]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-x`})],-1)]])]),W(`div`,pA,[(V(!0),H(B,null,z(a.filtered,e=>(V(),H(`button`,{key:e.id,"data-id":e.id,type:`button`,class:j([`cg-tile`,{"cg-tile--active":e.id===n.selectedId,"cg-tile--failed":i.failed.has(e.id),"cg-tile--checked":i.selectMode&&i.checked.has(e.id)}]),onClick:t=>a.onTileClick(e)},[W(`div`,hA,[q(` 导入标记:仅含 .import-meta.json 侧车的卡(经远端同步导入)显示,悬浮于缩略图右上角 `),e.imported?(V(),H(`span`,gA,`导入`)):q(`v-if`,!0),q(` 选择模式勾选框:格子左上角(与 rac-tile__cb 同观感)。
259
259
  格子本身是 button,嵌套原生 input 非法,用 span+role=checkbox;
260
- 回车/空格由格子按钮的 click 统一承接(onTileClick 切勾选) `),i.selectMode?(V(),H(`span`,{key:1,class:`cg-tile__cb`,role:`checkbox`,"aria-checked":i.checked.has(e.id)?`true`:`false`,"aria-label":`选择卡片 ${e.id}`,title:i.checked.has(e.id)?`取消勾选`:`勾选此卡`,onClick:J(t=>a.toggleOne(e.id),[`stop`])},[i.checked.has(e.id)?(V(),H(`svg`,_A,[...t[13]||=[W(`path`,{d:`M2.5 6.4l2.4 2.4 4.6-5.2`},null,-1)]])):q(`v-if`,!0)],8,gA)):q(`v-if`,!0),i.visibleIds.has(e.id)&&!i.failed.has(e.id)?(V(),H(`img`,{key:2,class:`cg-tile__img`,src:a.thumbUrl(e.id),alt:e.name,loading:`lazy`,onError:t=>a.onImgError(e.id)},null,40,vA)):i.visibleIds.has(e.id)?(V(),H(B,{key:4},[q(` 无封面(空白新卡无位图、且空白卡跳过无头截图直接 404):
261
- 回退工程统一占位图(与 Image 组件兜底图同源),浅色底与缩略图区调性一致 `),W(`img`,{class:`cg-tile__img cg-tile__img--placeholder`,src:i.placeholderUrl,alt:`暂无封面:${e.name}`},null,8,bA)],2112)):(V(),H(`div`,yA,`预览加载中…`))]),W(`div`,xA,[W(`span`,{class:`cg-tile__name`,title:e.name},M(e.name),9,SA),W(`span`,{class:`cg-tile__id`,title:e.id},M(e.id),9,CA)]),q(` 删除钮:仅图标不带文字,悬浮于格子右下角。格子本身是 button,
260
+ 回车/空格由格子按钮的 click 统一承接(onTileClick 切勾选) `),i.selectMode?(V(),H(`span`,{key:1,class:`cg-tile__cb`,role:`checkbox`,"aria-checked":i.checked.has(e.id)?`true`:`false`,"aria-label":`选择卡片 ${e.id}`,title:i.checked.has(e.id)?`取消勾选`:`勾选此卡`,onClick:J(t=>a.toggleOne(e.id),[`stop`])},[i.checked.has(e.id)?(V(),H(`svg`,vA,[...t[14]||=[W(`path`,{d:`M2.5 6.4l2.4 2.4 4.6-5.2`},null,-1)]])):q(`v-if`,!0)],8,_A)):q(`v-if`,!0),i.visibleIds.has(e.id)&&!i.failed.has(e.id)?(V(),H(`img`,{key:2,class:`cg-tile__img`,src:a.thumbUrl(e.id),alt:e.name,loading:`lazy`,onError:t=>a.onImgError(e.id)},null,40,yA)):i.visibleIds.has(e.id)?(V(),H(B,{key:4},[q(` 无封面(空白新卡无位图、且空白卡跳过无头截图直接 404):
261
+ 回退工程统一占位图(与 Image 组件兜底图同源),浅色底与缩略图区调性一致 `),W(`img`,{class:`cg-tile__img cg-tile__img--placeholder`,src:i.placeholderUrl,alt:`暂无封面:${e.name}`},null,8,xA)],2112)):(V(),H(`div`,bA,`预览加载中…`))]),W(`div`,SA,[W(`span`,{class:`cg-tile__name`,title:e.name},M(e.name),9,CA),W(`span`,{class:`cg-tile__id`,title:e.id},M(e.id),9,wA)]),q(` 删除钮:仅图标不带文字,悬浮于格子右下角。格子本身是 button,
262
262
  这里用 span + role=button 避免 button 套 button 的非法结构;
263
- click.stop 阻止冒泡到格子的「选中载入 / 切换勾选」。 `),W(`span`,{class:`cg-tile__del`,role:`button`,tabindex:`0`,title:`删除本地卡片 ${e.id}`,"aria-label":`删除本地卡片 ${e.id}`,onClick:J(t=>a.askDelete(e),[`stop`]),onKeydown:[jl(J(t=>a.askDelete(e),[`stop`,`prevent`]),[`enter`]),jl(J(t=>a.askDelete(e),[`stop`,`prevent`]),[`space`])]},[...t[14]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-trash`})],-1)]],40,wA)],10,pA))),128)),a.filtered.length?q(`v-if`,!0):(V(),H(`p`,TA,`无匹配卡片`))],512),q(` 导出操作栏(仅选择模式出现):仿 RemoteAllCards 底栏 —— 左全选 / 右导出 `),i.selectMode?(V(),H(`footer`,EA,[W(`label`,{class:j([`cg-selectall`,{"cg-selectall--active":a.checkedCount>0}]),title:a.allChecked?`取消全选(当前筛选结果)`:`全选当前筛选结果`},[W(`input`,{class:`cg-cb`,type:`checkbox`,checked:a.allChecked,".indeterminate":a.someChecked,disabled:!a.filtered.length,onChange:t[4]||=(...e)=>a.toggleAll&&a.toggleAll(...e)},null,40,OA),t[15]||=W(`span`,{class:`cg-selectall__text`},`全选`,-1)],10,DA),t[17]||=W(`span`,{class:`cg-foot__hint`},`勾选卡片后「导出选中」生成 zip 包(含 schema / 预览数据 / 图片资源)`,-1),W(`button`,{class:`cg-btn cg-btn--primary`,type:`button`,disabled:!a.checkedCount,title:a.checkedCount?`导出勾选的 ${a.checkedCount} 张卡片`:`先勾选要导出的卡片`,onClick:t[5]||=(...e)=>a.requestExport&&a.requestExport(...e)},[t[16]||=W(`svg`,{class:`cg-btn__icn`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-download`})],-1),K(` 导出选中`+M(a.checkedCount?`(${a.checkedCount})`:``),1)],8,kA)])):q(`v-if`,!0)]),q(` 删除确认:警告级(橙黄 + 三角图标);删除本地目录不可逆,文案明示影响范围 `),G(o,{visible:i.pendingDelete!=null,title:`删除卡片`,message:i.pendingDelete?`将删除本地卡片目录 src/cards/${i.pendingDelete.id}/(schema / 切图 / 预览图一并删除),不可恢复。确定删除「${i.pendingDelete.name}」吗?`:``,"confirm-text":`删除`,severity:`warn`,onConfirm:a.confirmDelete,onCancel:t[6]||=e=>i.pendingDelete=null},null,8,[`visible`,`message`,`onConfirm`])])):q(`v-if`,!0)]),_:1})}var jA=Z(iA,[[`render`,AA],[`__file`,`/Users/ynet/dsl-card/card-editor/components/CardGallery.vue`]]),MA={name:`RemoteAllCards`,props:{visible:{type:Boolean,default:!1},cards:{type:Array,default:()=>[]},loading:{type:Boolean,default:!1},error:{type:String,default:``},importedIds:{type:Array,default:()=>[]},downloading:{type:Boolean,default:!1},refreshing:{type:Boolean,default:!1},drawerOpen:{type:Boolean,default:!1},deletingId:{type:String,default:``}},emits:[`close`,`refresh`,`download-selected`,`download-all`,`create`,`edit`,`delete`],data(){return{query:``,checked:new Set,visibleIds:new Set,failed:new Set,observer:null,base:``,placeholderUrl:kd}},computed:{importedSet(){return new Set(this.importedIds)},filtered(){let e=this.query.trim().toLowerCase();return e?this.cards.filter(t=>String(t.id).toLowerCase().includes(e)||String(t.title||``).toLowerCase().includes(e)):this.cards},checkedCount(){return this.checked.size},allChecked(){return this.filtered.length>0&&this.filtered.every(e=>this.checked.has(e.id))},someChecked(){return!this.allChecked&&this.filtered.some(e=>this.checked.has(e.id))}},watch:{visible(e){e?(this.query=``,this.failed=new Set,this.$nextTick(()=>{this.setupObserver(),this.focusSearch()}),window.addEventListener(`keydown`,this.onKey)):(this.teardownObserver(),window.removeEventListener(`keydown`,this.onKey),this.checked=new Set)},filtered(){this.visible&&this.$nextTick(this.setupObserver)}},beforeUnmount(){this.teardownObserver(),window.removeEventListener(`keydown`,this.onKey)},methods:{isImported(e){return this.importedSet.has(e)},thumbUrl(e){return this.isImported(e.id)?(this.base||Jl()||``)+`/__card-image/`+encodeURIComponent(e.id):e.coverUrl||``},setupObserver(){this.base=Jl()||``;let e=this.$refs.grid;e&&(this.teardownObserver(),this.observer=new IntersectionObserver(e=>{for(let t of e){if(!t.isIntersecting)continue;let e=t.target.getAttribute(`data-id`);if(e&&!this.visibleIds.has(e)){let t=new Set(this.visibleIds);t.add(e),this.visibleIds=t}this.observer.unobserve(t.target)}},{root:e,rootMargin:`200px`}),e.querySelectorAll(`.rac-tile`).forEach(e=>this.observer.observe(e)))},teardownObserver(){this.observer&&=(this.observer.disconnect(),null)},onImgError(e){let t=new Set(this.failed);t.add(e),this.failed=t},viewCover(e){let t=this.filtered.filter(e=>this.thumbUrl(e)),n=t.findIndex(t=>t.id===e.id);n<0||zk(t.map(e=>{let t=this.thumbUrl(e);return{src:t,alt:e.title||e.id,title:t}}),n)},toggleOne(e){let t=new Set(this.checked);t.has(e)?t.delete(e):t.add(e),this.checked=t},toggleAll(){if(this.allChecked){let e=new Set(this.checked);for(let t of this.filtered)e.delete(t.id);this.checked=e}else{let e=new Set(this.checked);for(let t of this.filtered)e.add(t.id);this.checked=e}},onKey(e){this.drawerOpen||e.key===`Escape`&&this.close()},focusSearch(){this.$refs.search&&this.$refs.search.focus()},downloadSelected(){this.checkedCount&&this.$emit(`download-selected`,[...this.checked])},downloadAll(){this.$emit(`download-all`)},close(){this.$emit(`close`)}}},NA={class:`rac-modal modal-card`,role:`dialog`,"aria-modal":`true`,"aria-label":`远端全部卡片`},PA={class:`rac-head`},FA={class:`rac-title`},IA={class:`rac-count`},LA={class:`rac-search`},RA=[`disabled`],zA={class:`rac-body`},BA={key:0,class:`empty-state`},VA={key:1,class:`empty-state`},HA={class:`empty-state__hint`},UA={key:2,ref:`grid`,class:`rac-grid`},WA=[`data-id`,`onClick`],GA=[`checked`,`aria-label`,`onChange`],KA=[`title`],qA={class:`rac-tile__thumb`},JA=[`src`,`alt`,`onError`],YA={key:1,class:`rac-tile__skeleton`},XA=[`src`,`alt`],ZA={class:`rac-tile__ops`},QA=[`title`,`aria-label`,`disabled`,`onClick`],$A=[`href`],ej=[`title`,`aria-label`,`onClick`],tj=[`title`,`aria-label`,`disabled`,`onClick`],nj={class:`rac-tile__meta`},rj=[`title`],ij=[`title`],aj={key:0,class:`empty-state rac-gridempty`},oj={class:`rac-foot`},sj=[`title`],cj=[`checked`,`.indeterminate`,`disabled`],lj=[`disabled`,`title`],uj=[`disabled`];function dj(e,t,n,r,i,a){return V(),U(hc,{name:`modal`},{default:I(()=>[n.visible?(V(),H(`div`,{key:0,class:`rac-mask`,onClick:t[8]||=J((...e)=>a.close&&a.close(...e),[`self`])},[W(`div`,NA,[W(`header`,PA,[W(`div`,FA,[t[9]||=W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-cloud`})],-1),t[10]||=W(`span`,null,`远端全部卡片`,-1),W(`span`,IA,M(n.cards.length)+` 张`,1)]),W(`div`,LA,[t[11]||=W(`svg`,{class:`rac-search__icon`,viewBox:`0 0 16 16`,width:`13`,height:`13`,"aria-hidden":`true`},[W(`use`,{href:`#icon-search`})],-1),L(W(`input`,{ref:`search`,"onUpdate:modelValue":t[0]||=e=>i.query=e,class:`rac-search__input`,type:`text`,placeholder:`搜索卡片 ID / 名称…`},null,512),[[gl,i.query]])]),q(` 添加卡片:在搜索框右侧(线上内管同位置)。打开的是远端「新建卡片」抽屉,
264
- 与本地 src/cards 的新建无关——只在 FinMall 侧建卡,本地目录需另行下载。 `),W(`button`,{class:`rac-add`,type:`button`,title:`在远端 FinMall 新建一张卡片`,"aria-label":`添加远端卡片`,onClick:t[1]||=t=>e.$emit(`create`)},[...t[12]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-plus`})],-1),K(` 添加卡片 `,-1)]]),W(`button`,{class:`rac-refresh`,type:`button`,title:`重新拉取远端列表(平时走本地缓存,超过 5 分钟自动后台更新)`,"aria-label":`刷新远端卡片列表`,disabled:n.refreshing,onClick:t[2]||=t=>e.$emit(`refresh`)},[(V(),H(`svg`,{class:j([`app__icon`,{"app__icon--spin":n.refreshing}]),viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[...t[13]||=[W(`use`,{href:`#icon-refresh`},null,-1)]],2))],8,RA),W(`button`,{class:`rac-close`,type:`button`,title:`关闭`,"aria-label":`关闭`,onClick:t[3]||=(...e)=>a.close&&a.close(...e)},[...t[14]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-x`})],-1)]])]),q(` 弹窗体:加载 / 失败态用全局 .empty-state 家族(与 API 面板 / 导入信息 tab 同款),
265
- 与网格互斥渲染;.rac-body 接管弹窗剩余高度,空态在其中垂直居中(同 .hist 范式) `),W(`div`,zA,[n.loading?(V(),H(`div`,BA,[...t[15]||=[W(`span`,{class:`empty-state__badge`,"aria-hidden":`true`},[W(`svg`,{class:`app__icon app__icon--spin`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[W(`use`,{href:`#icon-loading`})])],-1),W(`p`,{class:`debug__empty`},`正在拉取远端卡片列表…`,-1),W(`p`,{class:`empty-state__hint`},`首次打开会确保后台 FinMall 会话就绪,可能需要十几秒`,-1)]])):n.error?(V(),H(`div`,VA,[t[16]||=W(`span`,{class:`empty-state__badge`,"aria-hidden":`true`},[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[W(`use`,{href:`#icon-cloud-alert`})])],-1),t[17]||=W(`p`,{class:`debug__empty`},`远端卡片列表加载失败`,-1),W(`p`,HA,M(n.error),1)])):(V(),H(`div`,UA,[(V(!0),H(B,null,z(a.filtered,r=>(V(),H(`div`,{key:r.id,class:j([`rac-tile`,{"rac-tile--checked":i.checked.has(r.id)}]),"data-id":r.id,onClick:e=>a.toggleOne(r.id)},[q(` 勾选 checkbox:格子左上角;label 阻止冒泡避免与格子点击双触 `),W(`label`,{class:`rac-tile__cb`,onClick:t[4]||=J(()=>{},[`stop`])},[W(`input`,{class:`rac-cb`,type:`checkbox`,checked:i.checked.has(r.id),"aria-label":`选择卡片 ${r.id}`,onChange:e=>a.toggleOne(r.id)},null,40,GA)]),q(` 导入标记:右上角;已导入=成功实心标签(与 CardGallery「导入」同源),未导入=中性灰 `),W(`span`,{class:j([`rac-tile__tag`,a.isImported(r.id)?`rac-tile__tag--ok`:`rac-tile__tag--off`]),title:a.isImported(r.id)?`本地已导入(下载将覆盖本地同名卡)`:`本地未导入`},M(a.isImported(r.id)?`已导入`:`未导入`),11,KA),W(`div`,qA,[i.visibleIds.has(r.id)&&a.thumbUrl(r)&&!i.failed.has(r.id)?(V(),H(`img`,{key:0,class:`rac-tile__img`,src:a.thumbUrl(r),alt:r.title||r.id,loading:`lazy`,onError:e=>a.onImgError(r.id)},null,40,JA)):i.visibleIds.has(r.id)?(V(),H(`img`,{key:2,class:`rac-tile__img rac-tile__img--placeholder`,src:i.placeholderUrl,alt:`暂无封面:${r.title||r.id}`},null,8,XA)):(V(),H(`div`,YA,`预览加载中…`)),q(` 卡片操作:浮在缩略图右下角(hover 格子才显形),不占用下方文字区的宽度。
263
+ click.stop 阻止冒泡到格子的「选中载入 / 切换勾选」。 `),W(`span`,{class:`cg-tile__del`,role:`button`,tabindex:`0`,title:`删除本地卡片 ${e.id}`,"aria-label":`删除本地卡片 ${e.id}`,onClick:J(t=>a.askDelete(e),[`stop`]),onKeydown:[jl(J(t=>a.askDelete(e),[`stop`,`prevent`]),[`enter`]),jl(J(t=>a.askDelete(e),[`stop`,`prevent`]),[`space`])]},[...t[15]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-trash`})],-1)]],40,TA)],10,mA))),128)),a.filtered.length?q(`v-if`,!0):(V(),H(`p`,EA,`无匹配卡片`))],512),q(` 导出操作栏(仅选择模式出现):仿 RemoteAllCards 底栏 —— 左全选 / 右导出 `),i.selectMode?(V(),H(`footer`,DA,[W(`label`,{class:j([`cg-selectall`,{"cg-selectall--active":a.checkedCount>0}]),title:a.allChecked?`取消全选(当前筛选结果)`:`全选当前筛选结果`},[W(`input`,{class:`cg-cb`,type:`checkbox`,checked:a.allChecked,".indeterminate":a.someChecked,disabled:!a.filtered.length,onChange:t[4]||=(...e)=>a.toggleAll&&a.toggleAll(...e)},null,40,kA),t[16]||=W(`span`,{class:`cg-selectall__text`},`全选`,-1)],10,OA),t[19]||=W(`span`,{class:`cg-foot__hint`},`勾选后可导出 zip 包(schema / 预览数据 / 图片资源),或编译成客户端与 H5 两套产物`,-1),W(`button`,{class:`cg-btn`,type:`button`,disabled:!a.checkedCount||n.compiling,title:a.checkedCount?`编译勾选的 ${a.checkedCount} 张卡片(生成客户端模板与 H5 脚本)`:`先勾选要编译的卡片`,onClick:t[5]||=(...e)=>a.requestCompile&&a.requestCompile(...e)},[t[17]||=W(`svg`,{class:`cg-btn__icn`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-model`})],-1),K(` `+M(n.compiling?`编译中…`:`编译选中${a.checkedCount?`(${a.checkedCount})`:``}`),1)],8,AA),W(`button`,{class:`cg-btn cg-btn--primary`,type:`button`,disabled:!a.checkedCount,title:a.checkedCount?`导出勾选的 ${a.checkedCount} 张卡片`:`先勾选要导出的卡片`,onClick:t[6]||=(...e)=>a.requestExport&&a.requestExport(...e)},[t[18]||=W(`svg`,{class:`cg-btn__icn`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-download`})],-1),K(` 导出选中`+M(a.checkedCount?`(${a.checkedCount})`:``),1)],8,jA)])):q(`v-if`,!0)]),q(` 删除确认:警告级(橙黄 + 三角图标);删除本地目录不可逆,文案明示影响范围 `),G(o,{visible:i.pendingDelete!=null,title:`删除卡片`,message:i.pendingDelete?`将删除本地卡片目录 src/cards/${i.pendingDelete.id}/(schema / 切图 / 预览图一并删除),不可恢复。确定删除「${i.pendingDelete.name}」吗?`:``,"confirm-text":`删除`,severity:`warn`,onConfirm:a.confirmDelete,onCancel:t[7]||=e=>i.pendingDelete=null},null,8,[`visible`,`message`,`onConfirm`]),q(` 编译等待层:编译期间整窗遮挡(连带头部关闭钮与底部操作栏),既防重复提交也防误关。
264
+ 请求很快时在 240ms 内已返回,本层不会闪现(延迟见 startBusy)。 `),i.busyVisible?(V(),H(`div`,MA,[W(`div`,NA,[t[20]||=W(`svg`,{class:`app__icon app__icon--spin cg-busy__ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-loading`})],-1),W(`p`,PA,`正在编译 `+M(i.busyCount)+` 张卡片`,1),t[21]||=W(`p`,{class:`cg-busy__sub`},`客户端模板与 H5 脚本 · 写入 flame-build 目录`,-1),W(`p`,FA,`已用时 `+M(i.busyElapsed)+`s · 期间请勿重复操作`,1)])])):q(`v-if`,!0)])):q(`v-if`,!0)]),_:1})}var LA=Z(aA,[[`render`,IA],[`__file`,`/Users/ynet/dsl-card/card-editor/components/CardGallery.vue`]]),RA={name:`RemoteAllCards`,props:{visible:{type:Boolean,default:!1},cards:{type:Array,default:()=>[]},loading:{type:Boolean,default:!1},error:{type:String,default:``},importedIds:{type:Array,default:()=>[]},downloading:{type:Boolean,default:!1},refreshing:{type:Boolean,default:!1},drawerOpen:{type:Boolean,default:!1},deletingId:{type:String,default:``}},emits:[`close`,`refresh`,`download-selected`,`download-all`,`create`,`edit`,`delete`],data(){return{query:``,checked:new Set,visibleIds:new Set,failed:new Set,observer:null,base:``,placeholderUrl:kd}},computed:{importedSet(){return new Set(this.importedIds)},filtered(){let e=this.query.trim().toLowerCase();return e?this.cards.filter(t=>String(t.id).toLowerCase().includes(e)||String(t.title||``).toLowerCase().includes(e)):this.cards},checkedCount(){return this.checked.size},allChecked(){return this.filtered.length>0&&this.filtered.every(e=>this.checked.has(e.id))},someChecked(){return!this.allChecked&&this.filtered.some(e=>this.checked.has(e.id))}},watch:{visible(e){e?(this.query=``,this.failed=new Set,this.$nextTick(()=>{this.setupObserver(),this.focusSearch()}),window.addEventListener(`keydown`,this.onKey)):(this.teardownObserver(),window.removeEventListener(`keydown`,this.onKey),this.checked=new Set)},filtered(){this.visible&&this.$nextTick(this.setupObserver)}},beforeUnmount(){this.teardownObserver(),window.removeEventListener(`keydown`,this.onKey)},methods:{isImported(e){return this.importedSet.has(e)},thumbUrl(e){return this.isImported(e.id)?(this.base||Jl()||``)+`/__card-image/`+encodeURIComponent(e.id):e.coverUrl||``},setupObserver(){this.base=Jl()||``;let e=this.$refs.grid;e&&(this.teardownObserver(),this.observer=new IntersectionObserver(e=>{for(let t of e){if(!t.isIntersecting)continue;let e=t.target.getAttribute(`data-id`);if(e&&!this.visibleIds.has(e)){let t=new Set(this.visibleIds);t.add(e),this.visibleIds=t}this.observer.unobserve(t.target)}},{root:e,rootMargin:`200px`}),e.querySelectorAll(`.rac-tile`).forEach(e=>this.observer.observe(e)))},teardownObserver(){this.observer&&=(this.observer.disconnect(),null)},onImgError(e){let t=new Set(this.failed);t.add(e),this.failed=t},viewCover(e){let t=this.filtered.filter(e=>this.thumbUrl(e)),n=t.findIndex(t=>t.id===e.id);n<0||Bk(t.map(e=>{let t=this.thumbUrl(e);return{src:t,alt:e.title||e.id,title:t}}),n)},toggleOne(e){let t=new Set(this.checked);t.has(e)?t.delete(e):t.add(e),this.checked=t},toggleAll(){if(this.allChecked){let e=new Set(this.checked);for(let t of this.filtered)e.delete(t.id);this.checked=e}else{let e=new Set(this.checked);for(let t of this.filtered)e.add(t.id);this.checked=e}},onKey(e){this.drawerOpen||e.key===`Escape`&&this.close()},focusSearch(){this.$refs.search&&this.$refs.search.focus()},downloadSelected(){this.checkedCount&&this.$emit(`download-selected`,[...this.checked])},downloadAll(){this.$emit(`download-all`)},close(){this.$emit(`close`)}}},zA={class:`rac-modal modal-card`,role:`dialog`,"aria-modal":`true`,"aria-label":`远端全部卡片`},BA={class:`rac-head`},VA={class:`rac-title`},HA={class:`rac-count`},UA={class:`rac-search`},WA=[`disabled`],GA={class:`rac-body`},KA={key:0,class:`empty-state`},qA={key:1,class:`empty-state`},JA={class:`empty-state__hint`},YA={key:2,ref:`grid`,class:`rac-grid`},XA=[`data-id`,`onClick`],ZA=[`checked`,`aria-label`,`onChange`],QA=[`title`],$A={class:`rac-tile__thumb`},ej=[`src`,`alt`,`onError`],tj={key:1,class:`rac-tile__skeleton`},nj=[`src`,`alt`],rj={class:`rac-tile__ops`},ij=[`title`,`aria-label`,`disabled`,`onClick`],aj=[`href`],oj=[`title`,`aria-label`,`onClick`],sj=[`title`,`aria-label`,`disabled`,`onClick`],cj={class:`rac-tile__meta`},lj=[`title`],uj=[`title`],dj={key:0,class:`empty-state rac-gridempty`},fj={class:`rac-foot`},pj=[`title`],mj=[`checked`,`.indeterminate`,`disabled`],hj=[`disabled`,`title`],gj=[`disabled`];function _j(e,t,n,r,i,a){return V(),U(hc,{name:`modal`},{default:I(()=>[n.visible?(V(),H(`div`,{key:0,class:`rac-mask`,onClick:t[8]||=J((...e)=>a.close&&a.close(...e),[`self`])},[W(`div`,zA,[W(`header`,BA,[W(`div`,VA,[t[9]||=W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-cloud`})],-1),t[10]||=W(`span`,null,`远端全部卡片`,-1),W(`span`,HA,M(n.cards.length)+` 张`,1)]),W(`div`,UA,[t[11]||=W(`svg`,{class:`rac-search__icon`,viewBox:`0 0 16 16`,width:`13`,height:`13`,"aria-hidden":`true`},[W(`use`,{href:`#icon-search`})],-1),L(W(`input`,{ref:`search`,"onUpdate:modelValue":t[0]||=e=>i.query=e,class:`rac-search__input`,type:`text`,placeholder:`搜索卡片 ID / 名称…`},null,512),[[gl,i.query]])]),q(` 添加卡片:在搜索框右侧(线上内管同位置)。打开的是远端「新建卡片」抽屉,
265
+ 与本地 src/cards 的新建无关——只在远端侧建卡,本地目录需另行下载。 `),W(`button`,{class:`rac-add`,type:`button`,title:`在远端新建一张卡片`,"aria-label":`添加远端卡片`,onClick:t[1]||=t=>e.$emit(`create`)},[...t[12]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-plus`})],-1),K(` 添加卡片 `,-1)]]),W(`button`,{class:`rac-refresh`,type:`button`,title:`重新拉取远端列表(平时走本地缓存,超过 5 分钟自动后台更新)`,"aria-label":`刷新远端卡片列表`,disabled:n.refreshing,onClick:t[2]||=t=>e.$emit(`refresh`)},[(V(),H(`svg`,{class:j([`app__icon`,{"app__icon--spin":n.refreshing}]),viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[...t[13]||=[W(`use`,{href:`#icon-refresh`},null,-1)]],2))],8,WA),W(`button`,{class:`rac-close`,type:`button`,title:`关闭`,"aria-label":`关闭`,onClick:t[3]||=(...e)=>a.close&&a.close(...e)},[...t[14]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-x`})],-1)]])]),q(` 弹窗体:加载 / 失败态用全局 .empty-state 家族(与 API 面板 / 导入信息 tab 同款),
266
+ 与网格互斥渲染;.rac-body 接管弹窗剩余高度,空态在其中垂直居中(同 .hist 范式) `),W(`div`,GA,[n.loading?(V(),H(`div`,KA,[...t[15]||=[W(`span`,{class:`empty-state__badge`,"aria-hidden":`true`},[W(`svg`,{class:`app__icon app__icon--spin`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[W(`use`,{href:`#icon-loading`})])],-1),W(`p`,{class:`debug__empty`},`正在拉取远端卡片列表…`,-1),W(`p`,{class:`empty-state__hint`},`首次打开会确保后台远端会话就绪,可能需要十几秒`,-1)]])):n.error?(V(),H(`div`,qA,[t[16]||=W(`span`,{class:`empty-state__badge`,"aria-hidden":`true`},[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[W(`use`,{href:`#icon-cloud-alert`})])],-1),t[17]||=W(`p`,{class:`debug__empty`},`远端卡片列表加载失败`,-1),W(`p`,JA,M(n.error),1)])):(V(),H(`div`,YA,[(V(!0),H(B,null,z(a.filtered,r=>(V(),H(`div`,{key:r.id,class:j([`rac-tile`,{"rac-tile--checked":i.checked.has(r.id)}]),"data-id":r.id,onClick:e=>a.toggleOne(r.id)},[q(` 勾选 checkbox:格子左上角;label 阻止冒泡避免与格子点击双触 `),W(`label`,{class:`rac-tile__cb`,onClick:t[4]||=J(()=>{},[`stop`])},[W(`input`,{class:`rac-cb`,type:`checkbox`,checked:i.checked.has(r.id),"aria-label":`选择卡片 ${r.id}`,onChange:e=>a.toggleOne(r.id)},null,40,ZA)]),q(` 导入标记:右上角;已导入=成功实心标签(与 CardGallery「导入」同源),未导入=中性灰 `),W(`span`,{class:j([`rac-tile__tag`,a.isImported(r.id)?`rac-tile__tag--ok`:`rac-tile__tag--off`]),title:a.isImported(r.id)?`本地已导入(下载将覆盖本地同名卡)`:`本地未导入`},M(a.isImported(r.id)?`已导入`:`未导入`),11,QA),W(`div`,$A,[i.visibleIds.has(r.id)&&a.thumbUrl(r)&&!i.failed.has(r.id)?(V(),H(`img`,{key:0,class:`rac-tile__img`,src:a.thumbUrl(r),alt:r.title||r.id,loading:`lazy`,onError:e=>a.onImgError(r.id)},null,40,ej)):i.visibleIds.has(r.id)?(V(),H(`img`,{key:2,class:`rac-tile__img rac-tile__img--placeholder`,src:i.placeholderUrl,alt:`暂无封面:${r.title||r.id}`},null,8,nj)):(V(),H(`div`,tj,`预览加载中…`)),q(` 卡片操作:浮在缩略图右下角(hover 格子才显形),不占用下方文字区的宽度。
266
267
  编辑 → 打开基本信息抽屉;删除 → 父级弹「不可撤销」警告确认。
267
- @click.stop 隔开格子的勾选行为。 `),W(`div`,ZA,[W(`button`,{class:`rac-tile__op rac-tile__del`,type:`button`,title:`删除远端卡片「${r.title||r.id}」(不可撤销)`,"aria-label":`删除远端卡片 ${r.title||r.id}`,disabled:n.deletingId===r.id,onClick:J(t=>e.$emit(`delete`,r),[`stop`])},[(V(),H(`svg`,{class:j([`app__icon`,{"app__icon--spin":n.deletingId===r.id}]),viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:n.deletingId===r.id?`#icon-loading`:`#icon-trash`},null,8,$A)],2))],8,QA),W(`button`,{class:`rac-tile__op rac-tile__edit`,type:`button`,title:`编辑「${r.title||r.id}」的基本信息`,"aria-label":`编辑卡片 ${r.title||r.id} 的基本信息`,onClick:J(t=>e.$emit(`edit`,r),[`stop`])},[...t[18]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-edit`})],-1)]],8,ej),q(` 查看封面大图:复用全局 ImageLightbox(与对话图片同一查看器),
268
+ @click.stop 隔开格子的勾选行为。 `),W(`div`,rj,[W(`button`,{class:`rac-tile__op rac-tile__del`,type:`button`,title:`删除远端卡片「${r.title||r.id}」(不可撤销)`,"aria-label":`删除远端卡片 ${r.title||r.id}`,disabled:n.deletingId===r.id,onClick:J(t=>e.$emit(`delete`,r),[`stop`])},[(V(),H(`svg`,{class:j([`app__icon`,{"app__icon--spin":n.deletingId===r.id}]),viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:n.deletingId===r.id?`#icon-loading`:`#icon-trash`},null,8,aj)],2))],8,ij),W(`button`,{class:`rac-tile__op rac-tile__edit`,type:`button`,title:`编辑「${r.title||r.id}」的基本信息`,"aria-label":`编辑卡片 ${r.title||r.id} 的基本信息`,onClick:J(t=>e.$emit(`edit`,r),[`stop`])},[...t[18]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-edit`})],-1)]],8,oj),q(` 查看封面大图:复用全局 ImageLightbox(与对话图片同一查看器),
268
269
  在查看器里可用 ←/→ 连翻当前筛选结果里其它卡的封面。
269
- 封面为空(无远端 coverUrl 且未导入)时禁用,避免点开一个空查看器。 `),W(`button`,{class:`rac-tile__op rac-tile__zoom`,type:`button`,title:a.thumbUrl(r)?`查看「${r.title||r.id}」的封面大图`:`「${r.title||r.id}」没有封面,无法查看大图`,"aria-label":`查看卡片 ${r.title||r.id} 的封面大图`,disabled:!a.thumbUrl(r),onClick:J(e=>a.viewCover(r),[`stop`])},[...t[19]||=[W(`svg`,{viewBox:`0 0 16 16`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.4`,"aria-hidden":`true`},[W(`use`,{href:`#icon-search`})],-1)]],8,tj)])]),W(`div`,nj,[W(`span`,{class:`rac-tile__name`,title:r.title||r.id},M(r.title||r.id),9,rj),W(`span`,{class:`rac-tile__id`,title:r.id},M(r.id),9,ij)])],10,WA))),128)),a.filtered.length?q(`v-if`,!0):(V(),H(`div`,aj,[...t[20]||=[W(`span`,{class:`empty-state__badge`,"aria-hidden":`true`},[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[W(`use`,{href:`#icon-search`})])],-1),W(`p`,{class:`debug__empty`},`无匹配卡片`,-1),W(`p`,{class:`empty-state__hint`},`换个关键字试试(支持卡片 ID 与名称)`,-1)]]))],512))]),W(`footer`,oj,[q(` 左下角全选:作用于当前筛选结果;部分选中显示 indeterminate。
270
- 与右侧下载按钮同区排布,选择动作与下载动作在同一操作条上闭合 `),W(`label`,{class:j([`rac-selectall`,{"rac-selectall--active":a.checkedCount>0}]),title:a.allChecked?`取消全选(当前筛选结果)`:`全选当前筛选结果`},[W(`input`,{class:`rac-cb`,type:`checkbox`,checked:a.allChecked,".indeterminate":a.someChecked,disabled:!a.filtered.length,onChange:t[5]||=(...e)=>a.toggleAll&&a.toggleAll(...e)},null,40,cj),t[21]||=W(`span`,{class:`rac-selectall__text`},`全选`,-1)],10,sj),t[24]||=W(`span`,{class:`rac-foot__hint`},`勾选卡片后「下载选中」拉取到本地;「全部下载」逐张覆盖本地同名卡`,-1),W(`button`,{class:`rac-btn rac-btn--primary`,type:`button`,disabled:!a.checkedCount||n.downloading,title:a.checkedCount?`下载勾选的 ${a.checkedCount} 张卡片到本地`:`先勾选要下载的卡片`,onClick:t[6]||=(...e)=>a.downloadSelected&&a.downloadSelected(...e)},[t[22]||=W(`svg`,{class:`rac-btn__icn`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-download`})],-1),K(` 下载选中`+M(a.checkedCount?`(${a.checkedCount})`:``),1)],8,lj),W(`button`,{class:`rac-btn rac-btn--warn`,type:`button`,disabled:n.downloading,title:`下载远端全部卡片并覆盖本地同名卡(与旧「拉取全部」一致)`,onClick:t[7]||=(...e)=>a.downloadAll&&a.downloadAll(...e)},[...t[23]||=[W(`svg`,{class:`rac-btn__icn`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-alert-triangle`})],-1),K(` 全部下载 `,-1)]],8,uj)])])])):q(`v-if`,!0)]),_:1})}var fj=Z(MA,[[`render`,dj],[`__file`,`/Users/ynet/dsl-card/card-editor/components/RemoteAllCards.vue`]]),pj=[`image/png`,`image/jpeg`,`image/webp`,`image/gif`],mj=5242880,hj=/^[A-Za-z0-9_-]+$/,gj={name:`RemoteCardFormDialog`,components:{Dropdown:B_},props:{visible:{type:Boolean,default:!1},mode:{type:String,default:`create`},card:{type:Object,default:null}},emits:[`close`,`submitted`],data(){return{code:``,cardName:``,cardClassId:``,picUrl:``,types:[],typesLoading:!1,uploading:!1,busy:!1,error:``,uploadError:``}},computed:{isEdit(){return this.mode===`edit`},title(){return this.isEdit?`编辑卡片`:`新建卡片`},coverSrc(){let e=this.picUrl;return e?/^https?:\/\//i.test(e)?e:e.startsWith(`@filestore/`)?(Jl()||``)+`/minio/`+e.slice(11):e:``},footHint(){return this.isEdit?`保存后仅更新远端元数据,不影响已发布版本`:`新建后卡片会立即出现在远端列表`},typeOptions(){return(this.types||[]).map(e=>({key:String(e.id),value:e.count?`${e.name}(${e.count})`:String(e.name||``)}))},busyHint(){return this.isEdit?`正在提交远端…`:`正在创建远端卡片…`}},watch:{visible(e){e?(this.reset(),this.loadTypes(),window.addEventListener(`keydown`,this.onKey),this.$nextTick(()=>{let e=this.isEdit?this.$refs.name:this.$refs.code;e&&e.focus()})):window.removeEventListener(`keydown`,this.onKey)}},beforeUnmount(){window.removeEventListener(`keydown`,this.onKey)},methods:{reset(){let e=this.card||{};this.code=this.isEdit?String(e.id||``):``,this.cardName=this.isEdit?String(e.title||``):``,this.cardClassId=this.isEdit?String(e.cardClassId||``):``,this.picUrl=this.isEdit?e.picUrl||this.derivePicUrl(e.coverUrl):``,this.error=``,this.uploadError=``,this.busy=!1,this.uploading=!1},derivePicUrl(e){let t=String(e||``),n=t.indexOf(`/minio/`);return n>=0?`@filestore/`+t.slice(n+7):``},async loadTypes(){if(!this.types.length){this.typesLoading=!0;try{let e=await Y(`/__remote-card-types`),t=await e.json().catch(()=>({}));if(!e.ok||!t.ok)throw Error(t.message||t.error||`HTTP `+e.status);this.types=Array.isArray(t.types)?t.types:[]}catch(e){this.error=`卡片类型加载失败:`+(e&&e.message||e)}finally{this.typesLoading=!1}}},pickFile(){if(this.busy)return;this.uploadError=``;let e=this.$refs.file;e&&(e.value=``,e.click())},onFile(e){let t=e.target.files&&e.target.files[0];if(!t)return;if(!pj.includes(t.type)){this.uploadError=`仅支持 PNG / JPG / WebP / GIF`;return}if(t.size>mj){this.uploadError=`图片过大(${(t.size/1024/1024).toFixed(1)}MB),请压缩到 5MB 以内`;return}let n=new FileReader;n.onload=()=>{let e=String(n.result||``),r=e.slice(e.indexOf(`,`)+1);this.uploadCover({fileName:t.name,base64:r,mime:t.type})},n.onerror=()=>{this.uploadError=`读取图片失败`},n.readAsDataURL(t)},async uploadCover({fileName:e,base64:t,mime:n}){this.uploading=!0,this.uploadError=``;try{let r=await Y(`/__remote-card/cover`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({fileName:e,base64:t,mime:n})}),i=await r.json().catch(()=>({}));if(!r.ok||!i.ok)throw Error(i.message||i.error||`HTTP `+r.status);if(!i.url)throw Error(`上传未返回图片地址`);this.picUrl=i.url}catch(e){this.uploadError=`封面上传失败:`+(e&&e.message||e)}finally{this.uploading=!1}},clearCover(){this.picUrl=``,this.uploadError=``},validate(){return this.code?hj.test(this.code)?this.code.length>64?`卡片编码不超过 64 个字符`:this.cardName?this.cardClassId?this.picUrl?``:`请上传卡片封面`:`请选择卡片类型`:`请填写卡片名称`:`卡片编码只能包含字母/数字/_/-`:this.isEdit?`远端未返回卡片编码,无法保存(请刷新列表后重试)`:`请填写卡片编码`},async submit(){if(this.busy||this.uploading)return;let e=this.validate();if(e)this.error=e;else{this.busy=!0,this.error=``;try{let e={code:this.code,cardName:this.cardName,cardClassId:this.cardClassId,picUrl:this.picUrl};this.isEdit&&(e.cardId=this.card&&this.card.cardId);let t=await Y(this.isEdit?`/__remote-card/update`:`/__remote-card/create`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),n=await t.json().catch(()=>({}));if(!t.ok||!n.ok)throw Error(n.message||n.error||`HTTP `+t.status);this.$emit(`submitted`,{mode:this.mode,code:n.code||this.code,cardId:n.cardId||``})}catch(e){this.error=(this.isEdit?`保存失败:`:`新建失败:`)+(e&&e.message||e),this.busy=!1}}},onKey(e){e.key===`Escape`&&this.close()},onMask(){this.close()},close(){this.busy||this.$emit(`close`)}}},_j=[`aria-label`],vj={class:`rcf-head`},yj={class:`rcf-title`},bj=[`disabled`],xj={class:`rcf-body`},Sj={class:`rcf-field`},Cj={class:`rcf-control`},wj=[`readonly`,`aria-readonly`,`disabled`,`title`],Tj={key:0,class:`rcf-tip`},Ej={class:`rcf-field`},Dj={class:`rcf-control`},Oj=[`disabled`],kj={class:`rcf-field`},Aj={class:`rcf-control`},jj={class:`rcf-field`},Mj={class:`rcf-control`},Nj={key:0,class:`rcf-cover rcf-cover--busy`},Pj={key:1,class:`rcf-cover rcf-cover--filled`},Fj=[`src`],Ij={class:`rcf-cover__ops`},Lj=[`disabled`],Rj=[`disabled`],zj=[`disabled`],Bj={key:3,class:`rcf-err`,role:`alert`},Vj={key:0,class:`rcf-err rcf-err--block`,role:`alert`},Hj={class:`rcf-foot`},Uj={class:`rcf-hint`},Wj=[`disabled`],Gj=[`disabled`];function Kj(e,t,n,r,i,a){let o=R(`Dropdown`);return V(),U(hc,{name:`rcf`},{default:I(()=>[n.visible?(V(),H(`div`,{key:0,class:`rcf-mask`,onClick:t[12]||=J((...e)=>a.onMask&&a.onMask(...e),[`self`])},[W(`aside`,{class:`rcf-drawer`,role:`dialog`,"aria-modal":`true`,"aria-label":a.title},[W(`header`,vj,[W(`span`,yj,M(a.title),1),W(`button`,{class:`rcf-close`,type:`button`,title:`关闭`,"aria-label":`关闭`,disabled:i.busy,onClick:t[0]||=(...e)=>a.close&&a.close(...e)},[...t[13]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-x`})],-1)]],8,bj)]),W(`div`,xj,[W(`div`,Sj,[t[14]||=W(`label`,{class:`rcf-label`,for:`rcf-code`},[W(`i`,null,`*`),K(`卡片编码`)],-1),W(`div`,Cj,[q(` 编辑模式只读:远端用编码把卡片与已发布版本、本地目录名绑在一起,
270
+ 封面为空(无远端 coverUrl 且未导入)时禁用,避免点开一个空查看器。 `),W(`button`,{class:`rac-tile__op rac-tile__zoom`,type:`button`,title:a.thumbUrl(r)?`查看「${r.title||r.id}」的封面大图`:`「${r.title||r.id}」没有封面,无法查看大图`,"aria-label":`查看卡片 ${r.title||r.id} 的封面大图`,disabled:!a.thumbUrl(r),onClick:J(e=>a.viewCover(r),[`stop`])},[...t[19]||=[W(`svg`,{viewBox:`0 0 16 16`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.4`,"aria-hidden":`true`},[W(`use`,{href:`#icon-search`})],-1)]],8,sj)])]),W(`div`,cj,[W(`span`,{class:`rac-tile__name`,title:r.title||r.id},M(r.title||r.id),9,lj),W(`span`,{class:`rac-tile__id`,title:r.id},M(r.id),9,uj)])],10,XA))),128)),a.filtered.length?q(`v-if`,!0):(V(),H(`div`,dj,[...t[20]||=[W(`span`,{class:`empty-state__badge`,"aria-hidden":`true`},[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[W(`use`,{href:`#icon-search`})])],-1),W(`p`,{class:`debug__empty`},`无匹配卡片`,-1),W(`p`,{class:`empty-state__hint`},`换个关键字试试(支持卡片 ID 与名称)`,-1)]]))],512))]),W(`footer`,fj,[q(` 左下角全选:作用于当前筛选结果;部分选中显示 indeterminate。
271
+ 与右侧下载按钮同区排布,选择动作与下载动作在同一操作条上闭合 `),W(`label`,{class:j([`rac-selectall`,{"rac-selectall--active":a.checkedCount>0}]),title:a.allChecked?`取消全选(当前筛选结果)`:`全选当前筛选结果`},[W(`input`,{class:`rac-cb`,type:`checkbox`,checked:a.allChecked,".indeterminate":a.someChecked,disabled:!a.filtered.length,onChange:t[5]||=(...e)=>a.toggleAll&&a.toggleAll(...e)},null,40,mj),t[21]||=W(`span`,{class:`rac-selectall__text`},`全选`,-1)],10,pj),t[24]||=W(`span`,{class:`rac-foot__hint`},`勾选卡片后「下载选中」拉取到本地;「全部下载」逐张覆盖本地同名卡`,-1),W(`button`,{class:`rac-btn rac-btn--primary`,type:`button`,disabled:!a.checkedCount||n.downloading,title:a.checkedCount?`下载勾选的 ${a.checkedCount} 张卡片到本地`:`先勾选要下载的卡片`,onClick:t[6]||=(...e)=>a.downloadSelected&&a.downloadSelected(...e)},[t[22]||=W(`svg`,{class:`rac-btn__icn`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-download`})],-1),K(` 下载选中`+M(a.checkedCount?`(${a.checkedCount})`:``),1)],8,hj),W(`button`,{class:`rac-btn rac-btn--warn`,type:`button`,disabled:n.downloading,title:`下载远端全部卡片并覆盖本地同名卡(与旧「拉取全部」一致)`,onClick:t[7]||=(...e)=>a.downloadAll&&a.downloadAll(...e)},[...t[23]||=[W(`svg`,{class:`rac-btn__icn`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-alert-triangle`})],-1),K(` 全部下载 `,-1)]],8,gj)])])])):q(`v-if`,!0)]),_:1})}var vj=Z(RA,[[`render`,_j],[`__file`,`/Users/ynet/dsl-card/card-editor/components/RemoteAllCards.vue`]]),yj=[`image/png`,`image/jpeg`,`image/webp`,`image/gif`],bj=5242880,xj=/^[A-Za-z0-9_-]+$/,Sj={name:`RemoteCardFormDialog`,components:{Dropdown:B_},props:{visible:{type:Boolean,default:!1},mode:{type:String,default:`create`},card:{type:Object,default:null}},emits:[`close`,`submitted`],data(){return{code:``,cardName:``,cardClassId:``,picUrl:``,types:[],typesLoading:!1,uploading:!1,busy:!1,error:``,uploadError:``}},computed:{isEdit(){return this.mode===`edit`},title(){return this.isEdit?`编辑卡片`:`新建卡片`},coverSrc(){let e=this.picUrl;return e?/^https?:\/\//i.test(e)?e:e.startsWith(`@filestore/`)?(Jl()||``)+`/minio/`+e.slice(11):e:``},footHint(){return this.isEdit?`保存后仅更新远端元数据,不影响已发布版本`:`新建后卡片会立即出现在远端列表`},typeOptions(){return(this.types||[]).map(e=>({key:String(e.id),value:e.count?`${e.name}(${e.count})`:String(e.name||``)}))},busyHint(){return this.isEdit?`正在提交远端…`:`正在创建远端卡片…`}},watch:{visible(e){e?(this.reset(),this.loadTypes(),window.addEventListener(`keydown`,this.onKey),this.$nextTick(()=>{let e=this.isEdit?this.$refs.name:this.$refs.code;e&&e.focus()})):window.removeEventListener(`keydown`,this.onKey)}},beforeUnmount(){window.removeEventListener(`keydown`,this.onKey)},methods:{reset(){let e=this.card||{};this.code=this.isEdit?String(e.id||``):``,this.cardName=this.isEdit?String(e.title||``):``,this.cardClassId=this.isEdit?String(e.cardClassId||``):``,this.picUrl=this.isEdit?e.picUrl||this.derivePicUrl(e.coverUrl):``,this.error=``,this.uploadError=``,this.busy=!1,this.uploading=!1},derivePicUrl(e){let t=String(e||``),n=t.indexOf(`/minio/`);return n>=0?`@filestore/`+t.slice(n+7):``},async loadTypes(){if(!this.types.length){this.typesLoading=!0;try{let e=await Y(`/__remote-card-types`),t=await e.json().catch(()=>({}));if(!e.ok||!t.ok)throw Error(t.message||t.error||`HTTP `+e.status);this.types=Array.isArray(t.types)?t.types:[]}catch(e){this.error=`卡片类型加载失败:`+(e&&e.message||e)}finally{this.typesLoading=!1}}},pickFile(){if(this.busy)return;this.uploadError=``;let e=this.$refs.file;e&&(e.value=``,e.click())},onFile(e){let t=e.target.files&&e.target.files[0];if(!t)return;if(!yj.includes(t.type)){this.uploadError=`仅支持 PNG / JPG / WebP / GIF`;return}if(t.size>bj){this.uploadError=`图片过大(${(t.size/1024/1024).toFixed(1)}MB),请压缩到 5MB 以内`;return}let n=new FileReader;n.onload=()=>{let e=String(n.result||``),r=e.slice(e.indexOf(`,`)+1);this.uploadCover({fileName:t.name,base64:r,mime:t.type})},n.onerror=()=>{this.uploadError=`读取图片失败`},n.readAsDataURL(t)},async uploadCover({fileName:e,base64:t,mime:n}){this.uploading=!0,this.uploadError=``;try{let r=await Y(`/__remote-card/cover`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({fileName:e,base64:t,mime:n})}),i=await r.json().catch(()=>({}));if(!r.ok||!i.ok)throw Error(i.message||i.error||`HTTP `+r.status);if(!i.url)throw Error(`上传未返回图片地址`);this.picUrl=i.url}catch(e){this.uploadError=`封面上传失败:`+(e&&e.message||e)}finally{this.uploading=!1}},clearCover(){this.picUrl=``,this.uploadError=``},validate(){return this.code?xj.test(this.code)?this.code.length>64?`卡片编码不超过 64 个字符`:this.cardName?this.cardClassId?this.picUrl?``:`请上传卡片封面`:`请选择卡片类型`:`请填写卡片名称`:`卡片编码只能包含字母/数字/_/-`:this.isEdit?`远端未返回卡片编码,无法保存(请刷新列表后重试)`:`请填写卡片编码`},async submit(){if(this.busy||this.uploading)return;let e=this.validate();if(e)this.error=e;else{this.busy=!0,this.error=``;try{let e={code:this.code,cardName:this.cardName,cardClassId:this.cardClassId,picUrl:this.picUrl};this.isEdit&&(e.cardId=this.card&&this.card.cardId);let t=await Y(this.isEdit?`/__remote-card/update`:`/__remote-card/create`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),n=await t.json().catch(()=>({}));if(!t.ok||!n.ok)throw Error(n.message||n.error||`HTTP `+t.status);this.$emit(`submitted`,{mode:this.mode,code:n.code||this.code,cardId:n.cardId||``})}catch(e){this.error=(this.isEdit?`保存失败:`:`新建失败:`)+(e&&e.message||e),this.busy=!1}}},onKey(e){e.key===`Escape`&&this.close()},onMask(){this.close()},close(){this.busy||this.$emit(`close`)}}},Cj=[`aria-label`],wj={class:`rcf-head`},Tj={class:`rcf-title`},Ej=[`disabled`],Dj={class:`rcf-body`},Oj={class:`rcf-field`},kj={class:`rcf-control`},Aj=[`readonly`,`aria-readonly`,`disabled`,`title`],jj={key:0,class:`rcf-tip`},Mj={class:`rcf-field`},Nj={class:`rcf-control`},Pj=[`disabled`],Fj={class:`rcf-field`},Ij={class:`rcf-control`},Lj={class:`rcf-field`},Rj={class:`rcf-control`},zj={key:0,class:`rcf-cover rcf-cover--busy`},Bj={key:1,class:`rcf-cover rcf-cover--filled`},Vj=[`src`],Hj={class:`rcf-cover__ops`},Uj=[`disabled`],Wj=[`disabled`],Gj=[`disabled`],Kj={key:3,class:`rcf-err`,role:`alert`},qj={key:0,class:`rcf-err rcf-err--block`,role:`alert`},Jj={class:`rcf-foot`},Yj={class:`rcf-hint`},Xj=[`disabled`],Zj=[`disabled`];function Qj(e,t,n,r,i,a){let o=R(`Dropdown`);return V(),U(hc,{name:`rcf`},{default:I(()=>[n.visible?(V(),H(`div`,{key:0,class:`rcf-mask`,onClick:t[12]||=J((...e)=>a.onMask&&a.onMask(...e),[`self`])},[W(`aside`,{class:`rcf-drawer`,role:`dialog`,"aria-modal":`true`,"aria-label":a.title},[W(`header`,wj,[W(`span`,Tj,M(a.title),1),W(`button`,{class:`rcf-close`,type:`button`,title:`关闭`,"aria-label":`关闭`,disabled:i.busy,onClick:t[0]||=(...e)=>a.close&&a.close(...e)},[...t[13]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-x`})],-1)]],8,Ej)]),W(`div`,Dj,[W(`div`,Oj,[t[14]||=W(`label`,{class:`rcf-label`,for:`rcf-code`},[W(`i`,null,`*`),K(`卡片编码`)],-1),W(`div`,kj,[q(` 编辑模式只读:远端用编码把卡片与已发布版本、本地目录名绑在一起,
271
272
  改了会让本地目录与远端对不上号(改名只能新建卡,不能改编码)。
272
- 用 readonly 而非 disabled:值还能选中复制,方便排查;灰底 + 默认光标表达不可改。 `),L(W(`input`,{id:`rcf-code`,ref:`code`,"onUpdate:modelValue":t[1]||=e=>i.code=e,class:j([`rcf-input`,{"rcf-input--locked":a.isEdit}]),type:`text`,placeholder:`英文标识,如 myNewCard(字母/数字/_/-)`,readonly:a.isEdit,"aria-readonly":a.isEdit,disabled:i.busy,title:a.isEdit?`卡片编码创建后不可修改`:``,onKeydown:t[2]||=jl((...e)=>a.submit&&a.submit(...e),[`enter`])},null,42,wj),[[gl,i.code,void 0,{trim:!0}]]),a.isEdit?(V(),H(`p`,Tj,`卡片编码创建后不可修改(远端以此关联卡片与已发布版本,本地目录也以它为名)`)):q(`v-if`,!0)])]),W(`div`,Ej,[t[15]||=W(`label`,{class:`rcf-label`,for:`rcf-name`},[W(`i`,null,`*`),K(`卡片名称`)],-1),W(`div`,Dj,[L(W(`input`,{id:`rcf-name`,ref:`name`,"onUpdate:modelValue":t[3]||=e=>i.cardName=e,class:`rcf-input`,type:`text`,placeholder:`请输入卡片名称`,disabled:i.busy,onKeydown:t[4]||=jl((...e)=>a.submit&&a.submit(...e),[`enter`])},null,40,Oj),[[gl,i.cardName,void 0,{trim:!0}]])])]),W(`div`,kj,[t[16]||=W(`label`,{class:`rcf-label`,id:`rcf-type-label`},[W(`i`,null,`*`),K(`卡片类型`)],-1),W(`div`,Aj,[q(` 通用下拉(Dropdown.vue)而非原生 <select>:与顶栏/变量面板同一套交互
273
- (点外部收起、下方空间不足自动向上翻、选中打勾),视觉也与 .rcf-input 对齐 `),G(o,{class:j([`rcf-dd`,{"rcf-dd--empty":!i.cardClassId}]),block:``,size:`md`,value:i.cardClassId,options:a.typeOptions,disabled:i.busy||i.typesLoading,placeholder:i.typesLoading?`正在加载类型…`:`请选择卡片类型`,"aria-labelledby":`rcf-type-label`,onChange:t[5]||=e=>i.cardClassId=e},null,8,[`class`,`value`,`options`,`disabled`,`placeholder`])])]),W(`div`,jj,[t[19]||=W(`label`,{class:`rcf-label`},[W(`i`,null,`*`),K(`卡片封面`)],-1),W(`div`,Mj,[i.uploading?(V(),H(`div`,Nj,[...t[17]||=[W(`svg`,{class:`app__icon app__icon--spin`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-loading`})],-1),W(`span`,null,`正在上传封面…`,-1)]])):a.coverSrc?(V(),H(`div`,Pj,[W(`img`,{class:`rcf-cover__img`,src:a.coverSrc,alt:`卡片封面`},null,8,Fj),W(`div`,Ij,[W(`button`,{class:`rcf-cover__op`,type:`button`,disabled:i.busy,onClick:t[6]||=(...e)=>a.pickFile&&a.pickFile(...e)},`重新上传`,8,Lj),W(`button`,{class:`rcf-cover__op rcf-cover__op--danger`,type:`button`,disabled:i.busy,onClick:t[7]||=(...e)=>a.clearCover&&a.clearCover(...e)},`删除`,8,Rj)])])):(V(),H(`button`,{key:2,class:`rcf-cover rcf-cover--empty`,type:`button`,disabled:i.busy,onClick:t[8]||=(...e)=>a.pickFile&&a.pickFile(...e)},[...t[18]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-image-upload`})],-1),W(`span`,null,`上传图片`,-1)]],8,zj)),W(`input`,{ref:`file`,class:`rcf-file`,type:`file`,accept:`image/png,image/jpeg,image/webp,image/gif`,onChange:t[9]||=(...e)=>a.onFile&&a.onFile(...e)},null,544),i.uploadError?(V(),H(`p`,Bj,M(i.uploadError),1)):q(`v-if`,!0)])]),i.error?(V(),H(`p`,Vj,M(i.error),1)):q(`v-if`,!0)]),W(`footer`,Hj,[W(`span`,Uj,M(i.busy?a.busyHint:a.footHint),1),W(`button`,{class:`ni-btn ni-btn--ghost`,type:`button`,disabled:i.busy,onClick:t[10]||=(...e)=>a.close&&a.close(...e)},`取消`,8,Wj),W(`button`,{class:`ni-btn`,type:`button`,disabled:i.busy||i.uploading,onClick:t[11]||=(...e)=>a.submit&&a.submit(...e)},M(i.busy?`提交中…`:`确定`),9,Gj)])],8,_j)])):q(`v-if`,!0)]),_:1})}var qj=Z(gj,[[`render`,Kj],[`__file`,`/Users/ynet/dsl-card/card-editor/components/RemoteCardFormDialog.vue`]]),Jj={name:`SyncProgressModal`,props:{visible:{type:Boolean,default:!1},done:{type:Number,default:0},total:{type:Number,default:0},current:{type:String,default:``}},emits:[`cancel`],computed:{pct(){return this.total?Math.min(100,Math.round(this.done/this.total*100)):0}}},Yj={key:0,class:`sp-mask`},Xj={class:`sp-card modal-card`,role:`dialog`,"aria-modal":`true`,"aria-label":`拉取进度`},Zj=[`aria-valuenow`,`aria-valuemin`,`aria-valuemax`],Qj={class:`sp-text`},$j={class:`sp-num`},eM={class:`sp-num`},tM={key:0,class:`sp-current`},nM={class:`sp-actions`};function rM(e,t,n,r,i,a){return V(),U(hc,{name:`modal`},{default:I(()=>[n.visible?(V(),H(`div`,Yj,[W(`div`,Xj,[t[3]||=W(`div`,{class:`sp-title`},[W(`svg`,{class:`app__icon app__icon--spin`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-loading`})]),W(`span`,null,`正在拉取远端卡片`)],-1),q(` 进度条:轨道 + 已完成填充;total 未知时(0)退化为不定动画 `),W(`div`,{class:j([`sp-bar`,{"sp-bar--indeterminate":!n.total}]),role:`progressbar`,"aria-valuenow":n.total?n.done:void 0,"aria-valuemin":n.total?0:void 0,"aria-valuemax":n.total?n.total:void 0},[W(`div`,{class:`sp-bar__fill`,style:A(n.total?{width:a.pct+`%`}:{})},null,4)],10,Zj),W(`p`,Qj,[t[1]||=K(` 已完成 `,-1),W(`b`,$j,M(n.done),1),t[2]||=K(` / 全部 `,-1),W(`b`,eM,M(n.total||`…`),1),n.current?(V(),H(`span`,tM,` · 当前 `+M(n.current),1)):q(`v-if`,!0)]),W(`div`,nM,[W(`button`,{class:`sp-btn`,type:`button`,onClick:t[0]||=t=>e.$emit(`cancel`)},`取消`)])])])):q(`v-if`,!0)]),_:1})}var iM=Z(Jj,[[`render`,rM],[`__file`,`/Users/ynet/dsl-card/card-editor/components/SyncProgressModal.vue`]]),aM=`cardbuddy:export-dir`,oM={name:`ExportDirDialog`,props:{visible:{type:Boolean,default:!1},count:{type:Number,default:0}},emits:[`confirm`,`cancel`],data(){return{dirInput:``,suggestions:{home:``,desktop:``,downloads:``,default:``},error:``}},computed:{quickPicks(){let e=this.suggestions,t=[{label:`桌面`,path:e.desktop},{label:`下载`,path:e.downloads},{label:`主目录`,path:e.home}],n=new Set;return t.filter(e=>e.path&&!n.has(e.path)&&n.add(e.path))}},watch:{visible(e){if(!e)return;this.error=``;let t=``;try{t=localStorage.getItem(aM)||``}catch{}this.loadSuggestions().then(e=>{this.dirInput=t||e&&e.default||``,this.$nextTick(()=>{this.$refs.dirInput&&(this.$refs.dirInput.focus(),this.$refs.dirInput.select())})})}},methods:{async loadSuggestions(){try{let e=await(await Y(`/__export/dir-suggestions`)).json().catch(()=>({}));e&&e.ok&&(this.suggestions={home:e.home||``,desktop:e.desktop||``,downloads:e.downloads||``,default:e.default||e.desktop||e.home||``})}catch{}return this.suggestions},confirm(){let e=this.dirInput.trim();if(!e)this.error=`请填写导出目录`;else if(!/^([a-zA-Z]:[\\/]|\/|\\)/.test(e))this.error=`需要绝对路径(如 /Users/you/Desktop 或 C:\\Users\\you\\Desktop)`;else{try{localStorage.setItem(aM,e)}catch{}this.$emit(`confirm`,e)}},close(){this.$emit(`cancel`)}}},sM={class:`xdir-modal modal-card`,role:`dialog`,"aria-modal":`true`,"aria-label":`选择导出目录`},cM={class:`xdir-head`},lM={class:`xdir-body`},uM={class:`xdir-desc`},dM={class:`xdir-num`},fM={class:`xdir-field`},pM={key:0,class:`xdir-quick`},mM=[`title`,`onClick`],hM={key:1,class:`xdir-error`},gM={key:2,class:`xdir-hint`},_M={class:`xdir-foot`},vM=[`disabled`];function yM(e,t,n,r,i,a){return V(),U(hc,{name:`modal`},{default:I(()=>[n.visible?(V(),H(`div`,{key:0,class:`xdir-mask`,onClick:t[5]||=J((...e)=>a.close&&a.close(...e),[`self`])},[W(`div`,sM,[W(`header`,cM,[t[7]||=W(`div`,{class:`xdir-title`},[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-folder`})]),W(`span`,null,`选择导出目录`)],-1),W(`button`,{class:`xdir-close`,type:`button`,title:`关闭`,"aria-label":`关闭`,onClick:t[0]||=(...e)=>a.close&&a.close(...e)},[...t[6]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-x`})],-1)]])]),W(`div`,lM,[W(`p`,uM,[t[8]||=K(` 将导出 `,-1),W(`b`,dM,M(n.count),1),t[9]||=K(` 张卡片,产物为同名 zip 包 (命名规则:`,-1),t[10]||=W(`code`,null,`年月日时分秒 + 4 位序号`,-1),t[11]||=K(`,如 `,-1),t[12]||=W(`code`,null,`2610221425000004.zip`,-1),t[13]||=K(`), 完成后自动在文件管理器中打开所在目录。 `,-1)]),W(`label`,fM,[t[14]||=W(`span`,{class:`xdir-field__label`},`导出目录`,-1),L(W(`input`,{ref:`dirInput`,"onUpdate:modelValue":t[1]||=e=>i.dirInput=e,class:`xdir-input`,type:`text`,spellcheck:`false`,placeholder:`绝对路径,如 /Users/you/Desktop`,onKeydown:t[2]||=jl(J((...e)=>a.confirm&&a.confirm(...e),[`stop`,`prevent`]),[`enter`])},null,544),[[gl,i.dirInput]])]),a.quickPicks.length?(V(),H(`div`,pM,[t[15]||=W(`span`,{class:`xdir-quick__label`},`快捷:`,-1),(V(!0),H(B,null,z(a.quickPicks,e=>(V(),H(`button`,{key:e.path,class:`xdir-chip`,type:`button`,title:e.path,onClick:t=>i.dirInput=e.path},M(e.label),9,mM))),128))])):q(`v-if`,!0),i.error?(V(),H(`p`,hM,M(i.error),1)):(V(),H(`p`,gM,`目录不存在时会自动创建;路径已记住,下次导出默认填入。`))]),W(`footer`,_M,[W(`button`,{class:`xdir-btn`,type:`button`,onClick:t[3]||=(...e)=>a.close&&a.close(...e)},`取消`),W(`button`,{class:`xdir-btn xdir-btn--primary`,type:`button`,disabled:!i.dirInput.trim(),title:`开始导出(随后显示导出进度)`,onClick:t[4]||=(...e)=>a.confirm&&a.confirm(...e)},[...t[16]||=[W(`svg`,{class:`xdir-btn__icn`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-download`})],-1),K(` 确认导出 `,-1)]],8,vM)])])])):q(`v-if`,!0)]),_:1})}var bM=Z(oM,[[`render`,yM],[`__file`,`/Users/ynet/dsl-card/card-editor/components/ExportDirDialog.vue`]]),xM={name:`ExportProgressModal`,props:{visible:{type:Boolean,default:!1},done:{type:Number,default:0},total:{type:Number,default:0},current:{type:String,default:``}},emits:[`cancel`],computed:{pct(){return this.total?Math.min(100,Math.round(this.done/this.total*100)):0}}},SM={key:0,class:`xp-mask`},CM={class:`xp-card modal-card`,role:`dialog`,"aria-modal":`true`,"aria-label":`导出进度`},wM=[`aria-valuenow`,`aria-valuemin`,`aria-valuemax`],TM={class:`xp-text`},EM={class:`xp-num`},DM={class:`xp-num`},OM={key:0,class:`xp-current`},kM={class:`xp-actions`};function AM(e,t,n,r,i,a){return V(),U(hc,{name:`modal`},{default:I(()=>[n.visible?(V(),H(`div`,SM,[W(`div`,CM,[t[3]||=W(`div`,{class:`xp-title`},[W(`svg`,{class:`app__icon app__icon--spin`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-loading`})]),W(`span`,null,`正在导出卡片`)],-1),q(` 进度条:轨道 + 已完成填充;total 未知时(0)退化为不定动画 `),W(`div`,{class:j([`xp-bar`,{"xp-bar--indeterminate":!n.total}]),role:`progressbar`,"aria-valuenow":n.total?n.done:void 0,"aria-valuemin":n.total?0:void 0,"aria-valuemax":n.total?n.total:void 0},[W(`div`,{class:`xp-bar__fill`,style:A(n.total?{width:a.pct+`%`}:{})},null,4)],10,wM),W(`p`,TM,[t[1]||=K(` 已完成 `,-1),W(`b`,EM,M(n.done),1),t[2]||=K(` / 全部 `,-1),W(`b`,DM,M(n.total||`…`),1),n.current?(V(),H(`span`,OM,` · 当前 `+M(n.current),1)):q(`v-if`,!0)]),W(`div`,kM,[W(`button`,{class:`xp-btn`,type:`button`,onClick:t[0]||=t=>e.$emit(`cancel`)},`取消`)])])])):q(`v-if`,!0)]),_:1})}var jM=Z(xM,[[`render`,AM],[`__file`,`/Users/ynet/dsl-card/card-editor/components/ExportProgressModal.vue`]]),MM=/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/,NM={name:`NewCardDialog`,props:{visible:{type:Boolean,default:!1},mode:{type:String,default:`create`},cardId:{type:String,default:``},cardDesc:{type:String,default:``},existingIds:{type:Array,default:()=>[]}},emits:[`close`,`created`,`renamed`],data(){return{id:``,desc:``,error:``,busy:!1}},computed:{isRename(){return this.mode===`rename`},title(){return this.isRename?`卡片重命名`:`新增空白卡片`},submitLabel(){return this.isRename?`保存`:`创建`},busyLabel(){return this.isRename?`保存中…`:`创建中…`},tip(){return this.isRename?`保存后重命名卡片目录并重载卡片`:`创建后写入 src/cards/<id>/ 空骨架,并切换到新卡`},dupId(){let e=this.id.trim();return!e||this.isRename&&e===this.cardId?``:this.existingIds.find(t=>t===e)||``}},watch:{visible(e){e&&this.resetFields()},mode(){this.visible&&this.resetFields()}},methods:{resetFields(){this.error=``,this.busy=!1,this.isRename?(this.id=this.cardId||``,this.desc=this.cardDesc||``):(this.id=``,this.desc=``)},validate(){let e=this.id.trim(),t=this.desc.trim();return e?MM.test(e)?this.dupId?`卡片 ID 已存在:本地已有「${this.dupId}」,换一个 ID`:t.length>200?`卡片描述过长(≤200 字)`:``:`卡片 ID 只能以字母/数字开头,含字母/数字/_/-(≤64 字符)`:`卡片 ID 必填`},async submit(){if(this.busy)return;let e=this.validate();if(e){this.error=e;return}this.busy=!0,this.error=``;let t=this.id.trim(),n=this.desc.trim();try{if(this.isRename){let e=await Y(`/__card/${encodeURIComponent(this.cardId)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({id:t,desc:n})}),r=await e.json().catch(()=>null);if(!e.ok)throw Error(r&&(r.message||r.error)||`HTTP ${e.status}`);this.$emit(`renamed`,{oldId:this.cardId,id:r&&r.id||t})}else{let e=await Y(`/__cards`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({id:t,desc:n})}),r=await e.json().catch(()=>null);if(!e.ok)throw Error(r&&(r.message||r.error)||`HTTP ${e.status}`);this.$emit(`created`,t)}}catch(e){this.error=`${this.isRename?`保存`:`创建`}失败:${e.message}`}finally{this.busy=!1}}}},PM=[`aria-label`],FM={class:`ni-head`},IM={class:`ni-title`},LM={class:`ni-body`},RM={class:`ni-scroll`},zM={class:`ni-field-row`},BM=[`placeholder`,`aria-invalid`,`disabled`],VM={class:`ni-field-row`},HM=[`disabled`],UM={key:0,class:`newcard-dlg__err`,role:`alert`},WM={key:1,class:`newcard-dlg__err`,role:`alert`},GM={class:`ni-foot`},KM={class:`ni-tip`},qM={class:`ni-foot-btns`},JM=[`disabled`],YM=[`disabled`];function XM(e,t,n,r,i,a){return V(),U(hc,{name:`modal`},{default:I(()=>[n.visible?(V(),H(`div`,{key:0,class:`ni-overlay`,onClick:t[7]||=J(t=>e.$emit(`close`),[`self`])},[W(`div`,{class:`ni-panel modal-card newcard-dlg`,role:`alertdialog`,"aria-modal":`true`,"aria-label":a.title},[W(`div`,FM,[W(`span`,IM,M(a.title),1),W(`button`,{class:`ni-close`,type:`button`,title:`关闭`,onClick:t[0]||=t=>e.$emit(`close`)})]),W(`div`,LM,[W(`div`,RM,[W(`div`,zM,[t[8]||=W(`label`,{class:`ni-field-label`},[W(`i`,null,`*`),K(`卡片 ID`)],-1),L(W(`input`,{class:j([`ni-input`,{"newcard-dlg__input--dup":!!a.dupId}]),type:`text`,"onUpdate:modelValue":t[1]||=e=>i.id=e,placeholder:a.isRename?`英文标识,改名即重命名卡片目录(字母/数字/_/-)`:`英文标识,如 myNewCard(字母/数字/_/-)`,"aria-invalid":a.dupId?`true`:null,disabled:i.busy,onKeydown:t[2]||=jl((...e)=>a.submit&&a.submit(...e),[`enter`])},null,42,BM),[[gl,i.id]])]),W(`div`,VM,[t[9]||=W(`label`,{class:`ni-field-label`},`卡片描述`,-1),L(W(`input`,{class:`ni-input`,type:`text`,"onUpdate:modelValue":t[3]||=e=>i.desc=e,placeholder:`选填,卡片用途简述;留空则用卡片 ID 作显示名`,disabled:i.busy,onKeydown:t[4]||=jl((...e)=>a.submit&&a.submit(...e),[`enter`])},null,40,HM),[[gl,i.desc]])]),a.dupId?(V(),H(`p`,UM,`卡片 ID 已存在:本地已有「`+M(a.dupId)+`」,换一个 ID`,1)):i.error?(V(),H(`p`,WM,M(i.error),1)):q(`v-if`,!0)])]),W(`div`,GM,[W(`span`,KM,M(a.tip),1),W(`div`,qM,[W(`button`,{class:`ni-btn ni-btn--ghost`,type:`button`,disabled:i.busy,onClick:t[5]||=t=>e.$emit(`close`)},`取消`,8,JM),W(`button`,{class:`ni-btn`,type:`button`,disabled:i.busy||!!a.dupId,onClick:t[6]||=(...e)=>a.submit&&a.submit(...e)},M(i.busy?a.busyLabel:a.submitLabel),9,YM)])])],8,PM)])):q(`v-if`,!0)]),_:1})}var ZM=Z(NM,[[`render`,XM],[`__file`,`/Users/ynet/dsl-card/card-editor/components/NewCardDialog.vue`]]),QM=[`Row`,`Column`,`MultiColumn`,`ListLayout`,`GridLayout`,`AbsoluteLayout`,`ViewContainer`,`Text`,`Button`,`Image`,`Icon`,`MultiText`,`Canvas`,`Input`,`CheckGroup`,`RadioButton`,`ProgressSlider`,`Video`,`Map`,`Divider`];function $M(){let e=Tu.groups&&Tu.groups.length?Tu.groups:[`布局组件`,`基础组件`],t={},n=Tu.components||{};for(let e in n){let r=n[e],i=r.group||`基础组件`;t[i]||(t[i]=[]);let a=r.name||e;t[i].push({className:e,name:a,glyph:e})}return e.filter(e=>t[e]&&t[e].length).map(e=>({key:e,items:t[e]}))}var eN={name:`ComponentPalette`,emits:[`pick`,`close`],data(){return{groups:$M(),query:``}},computed:{filteredGroups(){let e=(this.query||``).trim().toLowerCase();return e?this.groups.map(t=>({key:t.key,items:t.items.filter(t=>{let n=(t.name||``).toLowerCase(),r=(t.className||``).toLowerCase();return n.indexOf(e)!==-1||r.indexOf(e)!==-1})})).filter(e=>e.items.length):this.groups}},methods:{iconSvg(e){return QM.indexOf(e)===-1?`<span class="cp__avatar-text">`+String(e).slice(0,1)+`</span>`:`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" width="18" height="18"><use href="#icon-glyph-`+e+`"></use></svg>`}}},tN={class:`cp modal-card`,role:`dialog`,"aria-label":`选择组件类型`},nN={class:`cp__head`},rN={class:`cp__body`},iN={class:`cp__group-title`},aN={class:`cp__grid`},oN=[`title`,`onClick`],sN=[`data-g`,`innerHTML`],cN={class:`cp__item-name`},lN={class:`cp__item-class`},uN={key:0,class:`cp__empty`};function dN(e,t,n,r,i,a){return V(),H(`div`,{class:`cp__mask`,onClick:t[2]||=J(t=>e.$emit(`close`),[`self`])},[W(`div`,tN,[W(`div`,nN,[t[3]||=W(`span`,{class:`cp__title`},`添加组件`,-1),t[4]||=W(`span`,{class:`cp__hint`},`选择要插入的组件类型`,-1),W(`button`,{class:`cp__close`,type:`button`,title:`关闭`,onClick:t[0]||=t=>e.$emit(`close`)},`✕`)]),W(`div`,rN,[L(W(`input`,{class:`cp__search`,type:`text`,"onUpdate:modelValue":t[1]||=e=>i.query=e,placeholder:`搜索组件…`,title:`按组件名 / 类型过滤`},null,512),[[gl,i.query]]),(V(!0),H(B,null,z(a.filteredGroups,t=>(V(),H(`section`,{key:t.key,class:`cp__group`},[W(`h4`,iN,M(t.key),1),W(`div`,aN,[(V(!0),H(B,null,z(t.items,n=>(V(),H(`button`,{key:n.className,class:`cp__item`,type:`button`,title:n.className,onClick:t=>e.$emit(`pick`,n.className)},[W(`span`,{class:`cp__avatar`,"data-g":t.key===`布局组件`?`layout`:`basic`,innerHTML:a.iconSvg(n.glyph)},null,8,sN),W(`span`,cN,M(n.name),1),W(`span`,lN,M(n.className),1)],8,oN))),128))])]))),128)),i.query&&!a.filteredGroups.length?(V(),H(`p`,uN,`无匹配组件`)):q(`v-if`,!0)])])])}var fN=Z(eN,[[`render`,dN],[`__scopeId`,`data-v-88e70dcf`],[`__file`,`/Users/ynet/dsl-card/card-editor/components/ComponentPalette.vue`]]),pN={name:`Switch`,props:{modelValue:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:[`update:modelValue`],methods:{onClick(){this.disabled||this.$emit(`update:modelValue`,!this.modelValue)}}},mN=[`aria-checked`,`disabled`];function hN(e,t,n,r,i,a){return V(),H(`button`,{type:`button`,class:j([`switch`,{"switch--on":n.modelValue,"switch--disabled":n.disabled}]),role:`switch`,"aria-checked":String(n.modelValue),disabled:n.disabled,onClick:t[0]||=(...e)=>a.onClick&&a.onClick(...e)},[...t[1]||=[W(`span`,{class:`switch__track`},[W(`span`,{class:`switch__thumb`})],-1)]],10,mN)}var gN=Z(pN,[[`render`,hN],[`__file`,`/Users/ynet/dsl-card/card-editor/components/Switch.vue`]]);function _N(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var vN=_N();function yN(e){vN=e}var bN={exec:()=>null};function xN(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function $(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(CN.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var SN=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),CN={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,numericCharacterReferenceOrAmpersand:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:xN(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:xN(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:xN(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:xN(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:xN(e=>RegExp(`^ {0,${e}}(?:</?(?:${RN})(?: +|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`,`i`)),blockquoteBeginRegex:xN(e=>RegExp(`^ {0,${e}}>`))},wN=/^(?:[ \t]*(?:\n|$))+/,TN=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,EN=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,DN=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ON=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,kN=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,AN=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,jN=$(AN).replace(/bull/g,kN).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),MN=$(AN).replace(/bull/g,kN).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),NN=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,PN=/^[^\n]+/,FN=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,IN=$(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,FN).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),LN=$(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,kN).getRegex(),RN=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,zN=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,BN=$(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,zN).replace(`tag`,RN).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),VN=e=>$(NN).replace(`hr`,DN).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,RN).getRegex(),HN=VN(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),UN=VN(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),WN={blockquote:$(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,UN).getRegex(),code:TN,def:IN,fences:EN,heading:ON,hr:DN,html:BN,lheading:jN,list:LN,newline:wN,paragraph:HN,table:bN,text:PN},GN=$(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,DN).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,RN).getRegex(),KN={...WN,lheading:MN,table:GN,paragraph:$(NN).replace(`hr`,DN).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,GN).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,RN).getRegex()},qN={...WN,html:$(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,zN).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:bN,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:$(NN).replace(`hr`,DN).replace(`heading`,` *#{1,6} *[^
274
- ]`).replace(`lheading`,jN).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},JN=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,YN=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,XN=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,ZN=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,QN=/[\p{P}\p{S}]/u,$N=/[\s\p{P}\p{S}]/u,eP=/[^\s\p{P}\p{S}]/u,tP=$(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,$N).getRegex(),nP=/[\p{Pi}\p{Ps}"']/u,rP=/(?!~)[\p{P}\p{S}]/u,iP=/(?!~)[\s\p{P}\p{S}]/u,aP=/(?:[^\s\p{P}\p{S}]|~)/u,oP=$(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,SN?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),sP=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,cP=$(sP,`u`).replace(/punct/g,QN).getRegex(),lP=$(sP,`u`).replace(/punct/g,rP).getRegex(),uP=$(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,nP).replace(/punct/g,QN).getRegex(),dP=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,fP=$(dP,`gu`).replace(/notPunctSpace/g,eP).replace(/punctSpace/g,$N).replace(/punct/g,QN).getRegex(),pP=$(dP,`gu`).replace(/notPunctSpace/g,aP).replace(/punctSpace/g,iP).replace(/punct/g,rP).getRegex(),mP=$(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,eP).replace(/punctSpace/g,$N).replace(/punct/g,QN).getRegex(),hP=$(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,eP).replace(/punctSpace/g,$N).replace(/punct/g,QN).getRegex(),gP=$(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,eP).replace(/punctSpace/g,$N).replace(/punct/g,QN).getRegex(),_P=$(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,QN).getRegex(),vP=$(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,eP).replace(/punctSpace/g,$N).replace(/punct/g,QN).getRegex(),yP=$(/\\(punct)/,`gu`).replace(/punct/g,QN).getRegex(),bP=$(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,`gu`).replace(/punct/g,QN).getRegex(),xP=$(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),SP=$(zN).replace(`(?:-->|$)`,`-->`).getRegex(),CP=$(`^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,SP).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),wP=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,TP=$(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace(`brackets`,wP).getRegex(),EP=$(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace(`label`,TP).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),DP=$(/^!?\[(label)\]\[(ref)\]/).replace(`label`,TP).replace(`ref`,FN).getRegex(),OP=$(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,FN).getRegex(),kP=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,AP=$(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace(`brackets`,wP).getRegex(),jP=$(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,$(/^!?\[(label)\]\[(ref)\]/).replace(`label`,AP).replace(`ref`,kP).getRegex()).replace(`nolink`,$(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,kP).getRegex()).getRegex(),MP=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,NP=$(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),PP={_backpedal:bN,anyPunctuation:yP,anyPunctuationOutsideCode:bP,autolink:xP,blockSkip:oP,br:XN,code:YN,del:bN,delLDelim:bN,delRDelim:bN,emStrongLDelim:cP,emStrongRDelimAst:fP,emStrongRDelimUnd:hP,escape:JN,link:EP,nolink:OP,punctuation:tP,reflink:DP,reflinkSearch:jP,tag:CP,text:ZN,url:bN},FP={...PP,emStrongLDelim:uP,emStrongRDelimAst:mP,emStrongRDelimUnd:gP,link:$(/^!?\[(label)\]\((.*?)\)/).replace(`label`,TP).getRegex(),reflink:$(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,TP).getRegex()},IP={...PP,emStrongRDelimAst:pP,emStrongLDelim:lP,delLDelim:_P,delRDelim:vP,url:$(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`emailProtocol`,NP).replace(`protocol`,MP).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:$(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace(`protocol`,MP).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},LP={...IP,br:$(XN).replace(`{2,}`,`*`).getRegex(),text:$(IP.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},RP={normal:WN,gfm:KN,pedantic:qN},zP={normal:PP,gfm:IP,breaks:LP,pedantic:FP},BP={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},VP=e=>BP[e];function HP(e,t){if(t){if(CN.escapeTest.test(e))return e.replace(CN.escapeReplace,VP)}else if(CN.escapeTestNoEncode.test(e))return e.replace(CN.escapeReplaceNoEncode,VP);return e}function UP(e){return CN.numericCharacterReference.test(e)?e.replace(CN.numericCharacterReferenceOrAmpersand,(e,t,n)=>{if(t===void 0&&n===void 0)return`&amp;`;let r=t===void 0?Number.parseInt(n,16):Number.parseInt(t,10);return r===0||r>1114111||r>=55296&&r<=57343?`�`:r===38?`&amp;`:String.fromCodePoint(r)}):e}function WP(e){try{e=encodeURI(e).replace(CN.percentDecode,`%`)}catch{return null}return e}function GP(e,t){let n=e.replace(CN.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(CN.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(CN.slashPipe,`|`);return n}function KP(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function qP(e){let t=e.split(`
275
- `),n=t.length-1;for(;n>=0&&CN.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
276
- `)}function JP(e){return e.trim().toLowerCase().toUpperCase().toLowerCase()}function YP(e,t){if(e.indexOf(t[0])===-1&&e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function XP(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function ZP(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`),c=e[0].charAt(0)===`!`,l=r.state.inLink,u=r.state.linkEmitted,d=r.state.inRawBlock;r.state.inLink=!0,r.state.linkEmitted=!1;let f=r.inlineTokens(s),p=r.state.linkEmitted;if(r.state.linkEmitted=u,r.state.inLink=l,!c){if(p){r.state.inRawBlock=d;return}r.state.linkEmitted=!0}return{type:c?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:f}}function QP(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
273
+ 用 readonly 而非 disabled:值还能选中复制,方便排查;灰底 + 默认光标表达不可改。 `),L(W(`input`,{id:`rcf-code`,ref:`code`,"onUpdate:modelValue":t[1]||=e=>i.code=e,class:j([`rcf-input`,{"rcf-input--locked":a.isEdit}]),type:`text`,placeholder:`英文标识,如 myNewCard(字母/数字/_/-)`,readonly:a.isEdit,"aria-readonly":a.isEdit,disabled:i.busy,title:a.isEdit?`卡片编码创建后不可修改`:``,onKeydown:t[2]||=jl((...e)=>a.submit&&a.submit(...e),[`enter`])},null,42,Aj),[[gl,i.code,void 0,{trim:!0}]]),a.isEdit?(V(),H(`p`,jj,`卡片编码创建后不可修改(远端以此关联卡片与已发布版本,本地目录也以它为名)`)):q(`v-if`,!0)])]),W(`div`,Mj,[t[15]||=W(`label`,{class:`rcf-label`,for:`rcf-name`},[W(`i`,null,`*`),K(`卡片名称`)],-1),W(`div`,Nj,[L(W(`input`,{id:`rcf-name`,ref:`name`,"onUpdate:modelValue":t[3]||=e=>i.cardName=e,class:`rcf-input`,type:`text`,placeholder:`请输入卡片名称`,disabled:i.busy,onKeydown:t[4]||=jl((...e)=>a.submit&&a.submit(...e),[`enter`])},null,40,Pj),[[gl,i.cardName,void 0,{trim:!0}]])])]),W(`div`,Fj,[t[16]||=W(`label`,{class:`rcf-label`,id:`rcf-type-label`},[W(`i`,null,`*`),K(`卡片类型`)],-1),W(`div`,Ij,[q(` 通用下拉(Dropdown.vue)而非原生 <select>:与顶栏/变量面板同一套交互
274
+ (点外部收起、下方空间不足自动向上翻、选中打勾),视觉也与 .rcf-input 对齐 `),G(o,{class:j([`rcf-dd`,{"rcf-dd--empty":!i.cardClassId}]),block:``,size:`md`,value:i.cardClassId,options:a.typeOptions,disabled:i.busy||i.typesLoading,placeholder:i.typesLoading?`正在加载类型…`:`请选择卡片类型`,"aria-labelledby":`rcf-type-label`,onChange:t[5]||=e=>i.cardClassId=e},null,8,[`class`,`value`,`options`,`disabled`,`placeholder`])])]),W(`div`,Lj,[t[19]||=W(`label`,{class:`rcf-label`},[W(`i`,null,`*`),K(`卡片封面`)],-1),W(`div`,Rj,[i.uploading?(V(),H(`div`,zj,[...t[17]||=[W(`svg`,{class:`app__icon app__icon--spin`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-loading`})],-1),W(`span`,null,`正在上传封面…`,-1)]])):a.coverSrc?(V(),H(`div`,Bj,[W(`img`,{class:`rcf-cover__img`,src:a.coverSrc,alt:`卡片封面`},null,8,Vj),W(`div`,Hj,[W(`button`,{class:`rcf-cover__op`,type:`button`,disabled:i.busy,onClick:t[6]||=(...e)=>a.pickFile&&a.pickFile(...e)},`重新上传`,8,Uj),W(`button`,{class:`rcf-cover__op rcf-cover__op--danger`,type:`button`,disabled:i.busy,onClick:t[7]||=(...e)=>a.clearCover&&a.clearCover(...e)},`删除`,8,Wj)])])):(V(),H(`button`,{key:2,class:`rcf-cover rcf-cover--empty`,type:`button`,disabled:i.busy,onClick:t[8]||=(...e)=>a.pickFile&&a.pickFile(...e)},[...t[18]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-image-upload`})],-1),W(`span`,null,`上传图片`,-1)]],8,Gj)),W(`input`,{ref:`file`,class:`rcf-file`,type:`file`,accept:`image/png,image/jpeg,image/webp,image/gif`,onChange:t[9]||=(...e)=>a.onFile&&a.onFile(...e)},null,544),i.uploadError?(V(),H(`p`,Kj,M(i.uploadError),1)):q(`v-if`,!0)])]),i.error?(V(),H(`p`,qj,M(i.error),1)):q(`v-if`,!0)]),W(`footer`,Jj,[W(`span`,Yj,M(i.busy?a.busyHint:a.footHint),1),W(`button`,{class:`ni-btn ni-btn--ghost`,type:`button`,disabled:i.busy,onClick:t[10]||=(...e)=>a.close&&a.close(...e)},`取消`,8,Xj),W(`button`,{class:`ni-btn`,type:`button`,disabled:i.busy||i.uploading,onClick:t[11]||=(...e)=>a.submit&&a.submit(...e)},M(i.busy?`提交中…`:`确定`),9,Zj)])],8,Cj)])):q(`v-if`,!0)]),_:1})}var $j=Z(Sj,[[`render`,Qj],[`__file`,`/Users/ynet/dsl-card/card-editor/components/RemoteCardFormDialog.vue`]]),eM={name:`SyncProgressModal`,props:{visible:{type:Boolean,default:!1},done:{type:Number,default:0},total:{type:Number,default:0},current:{type:String,default:``}},emits:[`cancel`],computed:{pct(){return this.total?Math.min(100,Math.round(this.done/this.total*100)):0}}},tM={key:0,class:`sp-mask`},nM={class:`sp-card modal-card`,role:`dialog`,"aria-modal":`true`,"aria-label":`拉取进度`},rM=[`aria-valuenow`,`aria-valuemin`,`aria-valuemax`],iM={class:`sp-text`},aM={class:`sp-num`},oM={class:`sp-num`},sM={key:0,class:`sp-current`},cM={class:`sp-actions`};function lM(e,t,n,r,i,a){return V(),U(hc,{name:`modal`},{default:I(()=>[n.visible?(V(),H(`div`,tM,[W(`div`,nM,[t[3]||=W(`div`,{class:`sp-title`},[W(`svg`,{class:`app__icon app__icon--spin`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-loading`})]),W(`span`,null,`正在拉取远端卡片`)],-1),q(` 进度条:轨道 + 已完成填充;total 未知时(0)退化为不定动画 `),W(`div`,{class:j([`sp-bar`,{"sp-bar--indeterminate":!n.total}]),role:`progressbar`,"aria-valuenow":n.total?n.done:void 0,"aria-valuemin":n.total?0:void 0,"aria-valuemax":n.total?n.total:void 0},[W(`div`,{class:`sp-bar__fill`,style:A(n.total?{width:a.pct+`%`}:{})},null,4)],10,rM),W(`p`,iM,[t[1]||=K(` 已完成 `,-1),W(`b`,aM,M(n.done),1),t[2]||=K(` / 全部 `,-1),W(`b`,oM,M(n.total||`…`),1),n.current?(V(),H(`span`,sM,` · 当前 `+M(n.current),1)):q(`v-if`,!0)]),W(`div`,cM,[W(`button`,{class:`sp-btn`,type:`button`,onClick:t[0]||=t=>e.$emit(`cancel`)},`取消`)])])])):q(`v-if`,!0)]),_:1})}var uM=Z(eM,[[`render`,lM],[`__file`,`/Users/ynet/dsl-card/card-editor/components/SyncProgressModal.vue`]]),dM=`cardbuddy:export-dir`,fM={name:`ExportDirDialog`,props:{visible:{type:Boolean,default:!1},count:{type:Number,default:0}},emits:[`confirm`,`cancel`],data(){return{dirInput:``,suggestions:{home:``,desktop:``,downloads:``,default:``},error:``}},computed:{quickPicks(){let e=this.suggestions,t=[{label:`桌面`,path:e.desktop},{label:`下载`,path:e.downloads},{label:`主目录`,path:e.home}],n=new Set;return t.filter(e=>e.path&&!n.has(e.path)&&n.add(e.path))}},watch:{visible(e){if(!e)return;this.error=``;let t=``;try{t=localStorage.getItem(dM)||``}catch{}this.loadSuggestions().then(e=>{this.dirInput=t||e&&e.default||``,this.$nextTick(()=>{this.$refs.dirInput&&(this.$refs.dirInput.focus(),this.$refs.dirInput.select())})})}},methods:{async loadSuggestions(){try{let e=await(await Y(`/__export/dir-suggestions`)).json().catch(()=>({}));e&&e.ok&&(this.suggestions={home:e.home||``,desktop:e.desktop||``,downloads:e.downloads||``,default:e.default||e.desktop||e.home||``})}catch{}return this.suggestions},confirm(){let e=this.dirInput.trim();if(!e)this.error=`请填写导出目录`;else if(!/^([a-zA-Z]:[\\/]|\/|\\)/.test(e))this.error=`需要绝对路径(如 /Users/you/Desktop 或 C:\\Users\\you\\Desktop)`;else{try{localStorage.setItem(dM,e)}catch{}this.$emit(`confirm`,e)}},close(){this.$emit(`cancel`)}}},pM={class:`xdir-modal modal-card`,role:`dialog`,"aria-modal":`true`,"aria-label":`选择导出目录`},mM={class:`xdir-head`},hM={class:`xdir-body`},gM={class:`xdir-desc`},_M={class:`xdir-num`},vM={class:`xdir-field`},yM={key:0,class:`xdir-quick`},bM=[`title`,`onClick`],xM={key:1,class:`xdir-error`},SM={key:2,class:`xdir-hint`},CM={class:`xdir-foot`},wM=[`disabled`];function TM(e,t,n,r,i,a){return V(),U(hc,{name:`modal`},{default:I(()=>[n.visible?(V(),H(`div`,{key:0,class:`xdir-mask`,onClick:t[5]||=J((...e)=>a.close&&a.close(...e),[`self`])},[W(`div`,pM,[W(`header`,mM,[t[7]||=W(`div`,{class:`xdir-title`},[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-folder`})]),W(`span`,null,`选择导出目录`)],-1),W(`button`,{class:`xdir-close`,type:`button`,title:`关闭`,"aria-label":`关闭`,onClick:t[0]||=(...e)=>a.close&&a.close(...e)},[...t[6]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-x`})],-1)]])]),W(`div`,hM,[W(`p`,gM,[t[8]||=K(` 将导出 `,-1),W(`b`,_M,M(n.count),1),t[9]||=K(` 张卡片,产物为同名 zip 包 (命名规则:`,-1),t[10]||=W(`code`,null,`年月日时分秒 + 4 位序号`,-1),t[11]||=K(`,如 `,-1),t[12]||=W(`code`,null,`2610221425000004.zip`,-1),t[13]||=K(`), 完成后自动在文件管理器中打开所在目录。 `,-1)]),W(`label`,vM,[t[14]||=W(`span`,{class:`xdir-field__label`},`导出目录`,-1),L(W(`input`,{ref:`dirInput`,"onUpdate:modelValue":t[1]||=e=>i.dirInput=e,class:`xdir-input`,type:`text`,spellcheck:`false`,placeholder:`绝对路径,如 /Users/you/Desktop`,onKeydown:t[2]||=jl(J((...e)=>a.confirm&&a.confirm(...e),[`stop`,`prevent`]),[`enter`])},null,544),[[gl,i.dirInput]])]),a.quickPicks.length?(V(),H(`div`,yM,[t[15]||=W(`span`,{class:`xdir-quick__label`},`快捷:`,-1),(V(!0),H(B,null,z(a.quickPicks,e=>(V(),H(`button`,{key:e.path,class:`xdir-chip`,type:`button`,title:e.path,onClick:t=>i.dirInput=e.path},M(e.label),9,bM))),128))])):q(`v-if`,!0),i.error?(V(),H(`p`,xM,M(i.error),1)):(V(),H(`p`,SM,`目录不存在时会自动创建;路径已记住,下次导出默认填入。`))]),W(`footer`,CM,[W(`button`,{class:`xdir-btn`,type:`button`,onClick:t[3]||=(...e)=>a.close&&a.close(...e)},`取消`),W(`button`,{class:`xdir-btn xdir-btn--primary`,type:`button`,disabled:!i.dirInput.trim(),title:`开始导出(随后显示导出进度)`,onClick:t[4]||=(...e)=>a.confirm&&a.confirm(...e)},[...t[16]||=[W(`svg`,{class:`xdir-btn__icn`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-download`})],-1),K(` 确认导出 `,-1)]],8,wM)])])])):q(`v-if`,!0)]),_:1})}var EM=Z(fM,[[`render`,TM],[`__file`,`/Users/ynet/dsl-card/card-editor/components/ExportDirDialog.vue`]]),DM={name:`ExportProgressModal`,props:{visible:{type:Boolean,default:!1},done:{type:Number,default:0},total:{type:Number,default:0},current:{type:String,default:``}},emits:[`cancel`],computed:{pct(){return this.total?Math.min(100,Math.round(this.done/this.total*100)):0}}},OM={key:0,class:`xp-mask`},kM={class:`xp-card modal-card`,role:`dialog`,"aria-modal":`true`,"aria-label":`导出进度`},AM=[`aria-valuenow`,`aria-valuemin`,`aria-valuemax`],jM={class:`xp-text`},MM={class:`xp-num`},NM={class:`xp-num`},PM={key:0,class:`xp-current`},FM={class:`xp-actions`};function IM(e,t,n,r,i,a){return V(),U(hc,{name:`modal`},{default:I(()=>[n.visible?(V(),H(`div`,OM,[W(`div`,kM,[t[3]||=W(`div`,{class:`xp-title`},[W(`svg`,{class:`app__icon app__icon--spin`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-loading`})]),W(`span`,null,`正在导出卡片`)],-1),q(` 进度条:轨道 + 已完成填充;total 未知时(0)退化为不定动画 `),W(`div`,{class:j([`xp-bar`,{"xp-bar--indeterminate":!n.total}]),role:`progressbar`,"aria-valuenow":n.total?n.done:void 0,"aria-valuemin":n.total?0:void 0,"aria-valuemax":n.total?n.total:void 0},[W(`div`,{class:`xp-bar__fill`,style:A(n.total?{width:a.pct+`%`}:{})},null,4)],10,AM),W(`p`,jM,[t[1]||=K(` 已完成 `,-1),W(`b`,MM,M(n.done),1),t[2]||=K(` / 全部 `,-1),W(`b`,NM,M(n.total||`…`),1),n.current?(V(),H(`span`,PM,` · 当前 `+M(n.current),1)):q(`v-if`,!0)]),W(`div`,FM,[W(`button`,{class:`xp-btn`,type:`button`,onClick:t[0]||=t=>e.$emit(`cancel`)},`取消`)])])])):q(`v-if`,!0)]),_:1})}var LM=Z(DM,[[`render`,IM],[`__file`,`/Users/ynet/dsl-card/card-editor/components/ExportProgressModal.vue`]]),RM=/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/,zM={name:`NewCardDialog`,props:{visible:{type:Boolean,default:!1},mode:{type:String,default:`create`},cardId:{type:String,default:``},cardDesc:{type:String,default:``},existingIds:{type:Array,default:()=>[]}},emits:[`close`,`created`,`renamed`],data(){return{id:``,desc:``,error:``,busy:!1}},computed:{isRename(){return this.mode===`rename`},title(){return this.isRename?`卡片重命名`:`新增空白卡片`},submitLabel(){return this.isRename?`保存`:`创建`},busyLabel(){return this.isRename?`保存中…`:`创建中…`},tip(){return this.isRename?`保存后重命名卡片目录并重载卡片`:`创建后写入 src/cards/<id>/ 空骨架,并切换到新卡`},dupId(){let e=this.id.trim();return!e||this.isRename&&e===this.cardId?``:this.existingIds.find(t=>t===e)||``}},watch:{visible(e){e&&this.resetFields()},mode(){this.visible&&this.resetFields()}},methods:{resetFields(){this.error=``,this.busy=!1,this.isRename?(this.id=this.cardId||``,this.desc=this.cardDesc||``):(this.id=``,this.desc=``)},validate(){let e=this.id.trim(),t=this.desc.trim();return e?RM.test(e)?this.dupId?`卡片 ID 已存在:本地已有「${this.dupId}」,换一个 ID`:t.length>200?`卡片描述过长(≤200 字)`:``:`卡片 ID 只能以字母/数字开头,含字母/数字/_/-(≤64 字符)`:`卡片 ID 必填`},async submit(){if(this.busy)return;let e=this.validate();if(e){this.error=e;return}this.busy=!0,this.error=``;let t=this.id.trim(),n=this.desc.trim();try{if(this.isRename){let e=await Y(`/__card/${encodeURIComponent(this.cardId)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({id:t,desc:n})}),r=await e.json().catch(()=>null);if(!e.ok)throw Error(r&&(r.message||r.error)||`HTTP ${e.status}`);this.$emit(`renamed`,{oldId:this.cardId,id:r&&r.id||t})}else{let e=await Y(`/__cards`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({id:t,desc:n})}),r=await e.json().catch(()=>null);if(!e.ok)throw Error(r&&(r.message||r.error)||`HTTP ${e.status}`);this.$emit(`created`,t)}}catch(e){this.error=`${this.isRename?`保存`:`创建`}失败:${e.message}`}finally{this.busy=!1}}}},BM=[`aria-label`],VM={class:`ni-head`},HM={class:`ni-title`},UM={class:`ni-body`},WM={class:`ni-scroll`},GM={class:`ni-field-row`},KM=[`placeholder`,`aria-invalid`,`disabled`],qM={class:`ni-field-row`},JM=[`disabled`],YM={key:0,class:`newcard-dlg__err`,role:`alert`},XM={key:1,class:`newcard-dlg__err`,role:`alert`},ZM={class:`ni-foot`},QM={class:`ni-tip`},$M={class:`ni-foot-btns`},eN=[`disabled`],tN=[`disabled`];function nN(e,t,n,r,i,a){return V(),U(hc,{name:`modal`},{default:I(()=>[n.visible?(V(),H(`div`,{key:0,class:`ni-overlay`,onClick:t[7]||=J(t=>e.$emit(`close`),[`self`])},[W(`div`,{class:`ni-panel modal-card newcard-dlg`,role:`alertdialog`,"aria-modal":`true`,"aria-label":a.title},[W(`div`,VM,[W(`span`,HM,M(a.title),1),W(`button`,{class:`ni-close`,type:`button`,title:`关闭`,onClick:t[0]||=t=>e.$emit(`close`)})]),W(`div`,UM,[W(`div`,WM,[W(`div`,GM,[t[8]||=W(`label`,{class:`ni-field-label`},[W(`i`,null,`*`),K(`卡片 ID`)],-1),L(W(`input`,{class:j([`ni-input`,{"newcard-dlg__input--dup":!!a.dupId}]),type:`text`,"onUpdate:modelValue":t[1]||=e=>i.id=e,placeholder:a.isRename?`英文标识,改名即重命名卡片目录(字母/数字/_/-)`:`英文标识,如 myNewCard(字母/数字/_/-)`,"aria-invalid":a.dupId?`true`:null,disabled:i.busy,onKeydown:t[2]||=jl((...e)=>a.submit&&a.submit(...e),[`enter`])},null,42,KM),[[gl,i.id]])]),W(`div`,qM,[t[9]||=W(`label`,{class:`ni-field-label`},`卡片描述`,-1),L(W(`input`,{class:`ni-input`,type:`text`,"onUpdate:modelValue":t[3]||=e=>i.desc=e,placeholder:`选填,卡片用途简述;留空则用卡片 ID 作显示名`,disabled:i.busy,onKeydown:t[4]||=jl((...e)=>a.submit&&a.submit(...e),[`enter`])},null,40,JM),[[gl,i.desc]])]),a.dupId?(V(),H(`p`,YM,`卡片 ID 已存在:本地已有「`+M(a.dupId)+`」,换一个 ID`,1)):i.error?(V(),H(`p`,XM,M(i.error),1)):q(`v-if`,!0)])]),W(`div`,ZM,[W(`span`,QM,M(a.tip),1),W(`div`,$M,[W(`button`,{class:`ni-btn ni-btn--ghost`,type:`button`,disabled:i.busy,onClick:t[5]||=t=>e.$emit(`close`)},`取消`,8,eN),W(`button`,{class:`ni-btn`,type:`button`,disabled:i.busy||!!a.dupId,onClick:t[6]||=(...e)=>a.submit&&a.submit(...e)},M(i.busy?a.busyLabel:a.submitLabel),9,tN)])])],8,BM)])):q(`v-if`,!0)]),_:1})}var rN=Z(zM,[[`render`,nN],[`__file`,`/Users/ynet/dsl-card/card-editor/components/NewCardDialog.vue`]]),iN=[`Row`,`Column`,`MultiColumn`,`ListLayout`,`GridLayout`,`AbsoluteLayout`,`ViewContainer`,`Text`,`Button`,`Image`,`Icon`,`MultiText`,`Canvas`,`Input`,`CheckGroup`,`RadioButton`,`ProgressSlider`,`Video`,`Map`,`Divider`];function aN(){let e=Tu.groups&&Tu.groups.length?Tu.groups:[`布局组件`,`基础组件`],t={},n=Tu.components||{};for(let e in n){let r=n[e],i=r.group||`基础组件`;t[i]||(t[i]=[]);let a=r.name||e;t[i].push({className:e,name:a,glyph:e})}return e.filter(e=>t[e]&&t[e].length).map(e=>({key:e,items:t[e]}))}var oN={name:`ComponentPalette`,emits:[`pick`,`close`],data(){return{groups:aN(),query:``}},computed:{filteredGroups(){let e=(this.query||``).trim().toLowerCase();return e?this.groups.map(t=>({key:t.key,items:t.items.filter(t=>{let n=(t.name||``).toLowerCase(),r=(t.className||``).toLowerCase();return n.indexOf(e)!==-1||r.indexOf(e)!==-1})})).filter(e=>e.items.length):this.groups}},methods:{iconSvg(e){return iN.indexOf(e)===-1?`<span class="cp__avatar-text">`+String(e).slice(0,1)+`</span>`:`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" width="18" height="18"><use href="#icon-glyph-`+e+`"></use></svg>`}}},sN={class:`cp modal-card`,role:`dialog`,"aria-label":`选择组件类型`},cN={class:`cp__head`},lN={class:`cp__body`},uN={class:`cp__group-title`},dN={class:`cp__grid`},fN=[`title`,`onClick`],pN=[`data-g`,`innerHTML`],mN={class:`cp__item-name`},hN={class:`cp__item-class`},gN={key:0,class:`cp__empty`};function _N(e,t,n,r,i,a){return V(),H(`div`,{class:`cp__mask`,onClick:t[2]||=J(t=>e.$emit(`close`),[`self`])},[W(`div`,sN,[W(`div`,cN,[t[3]||=W(`span`,{class:`cp__title`},`添加组件`,-1),t[4]||=W(`span`,{class:`cp__hint`},`选择要插入的组件类型`,-1),W(`button`,{class:`cp__close`,type:`button`,title:`关闭`,onClick:t[0]||=t=>e.$emit(`close`)},`✕`)]),W(`div`,lN,[L(W(`input`,{class:`cp__search`,type:`text`,"onUpdate:modelValue":t[1]||=e=>i.query=e,placeholder:`搜索组件…`,title:`按组件名 / 类型过滤`},null,512),[[gl,i.query]]),(V(!0),H(B,null,z(a.filteredGroups,t=>(V(),H(`section`,{key:t.key,class:`cp__group`},[W(`h4`,uN,M(t.key),1),W(`div`,dN,[(V(!0),H(B,null,z(t.items,n=>(V(),H(`button`,{key:n.className,class:`cp__item`,type:`button`,title:n.className,onClick:t=>e.$emit(`pick`,n.className)},[W(`span`,{class:`cp__avatar`,"data-g":t.key===`布局组件`?`layout`:`basic`,innerHTML:a.iconSvg(n.glyph)},null,8,pN),W(`span`,mN,M(n.name),1),W(`span`,hN,M(n.className),1)],8,fN))),128))])]))),128)),i.query&&!a.filteredGroups.length?(V(),H(`p`,gN,`无匹配组件`)):q(`v-if`,!0)])])])}var vN=Z(oN,[[`render`,_N],[`__scopeId`,`data-v-88e70dcf`],[`__file`,`/Users/ynet/dsl-card/card-editor/components/ComponentPalette.vue`]]),yN={name:`Switch`,props:{modelValue:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:[`update:modelValue`],methods:{onClick(){this.disabled||this.$emit(`update:modelValue`,!this.modelValue)}}},bN=[`aria-checked`,`disabled`];function xN(e,t,n,r,i,a){return V(),H(`button`,{type:`button`,class:j([`switch`,{"switch--on":n.modelValue,"switch--disabled":n.disabled}]),role:`switch`,"aria-checked":String(n.modelValue),disabled:n.disabled,onClick:t[0]||=(...e)=>a.onClick&&a.onClick(...e)},[...t[1]||=[W(`span`,{class:`switch__track`},[W(`span`,{class:`switch__thumb`})],-1)]],10,bN)}var SN=Z(yN,[[`render`,xN],[`__file`,`/Users/ynet/dsl-card/card-editor/components/Switch.vue`]]);function CN(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var wN=CN();function TN(e){wN=e}var EN={exec:()=>null};function DN(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function $(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(kN.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var ON=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),kN={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,numericCharacterReferenceOrAmpersand:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:DN(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:DN(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:DN(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:DN(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:DN(e=>RegExp(`^ {0,${e}}(?:</?(?:${WN})(?: +|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`,`i`)),blockquoteBeginRegex:DN(e=>RegExp(`^ {0,${e}}>`))},AN=/^(?:[ \t]*(?:\n|$))+/,jN=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,MN=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,NN=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,PN=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,FN=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,IN=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,LN=$(IN).replace(/bull/g,FN).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),RN=$(IN).replace(/bull/g,FN).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),zN=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,BN=/^[^\n]+/,VN=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,HN=$(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,VN).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),UN=$(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,FN).getRegex(),WN=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,GN=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,KN=$(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,GN).replace(`tag`,WN).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),qN=e=>$(zN).replace(`hr`,NN).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,WN).getRegex(),JN=qN(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),YN=qN(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),XN={blockquote:$(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,YN).getRegex(),code:jN,def:HN,fences:MN,heading:PN,hr:NN,html:KN,lheading:LN,list:UN,newline:AN,paragraph:JN,table:EN,text:BN},ZN=$(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,NN).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,WN).getRegex(),QN={...XN,lheading:RN,table:ZN,paragraph:$(zN).replace(`hr`,NN).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,ZN).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,WN).getRegex()},$N={...XN,html:$(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,GN).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:EN,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:$(zN).replace(`hr`,NN).replace(`heading`,` *#{1,6} *[^
275
+ ]`).replace(`lheading`,LN).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},eP=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,tP=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,nP=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,rP=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,iP=/[\p{P}\p{S}]/u,aP=/[\s\p{P}\p{S}]/u,oP=/[^\s\p{P}\p{S}]/u,sP=$(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,aP).getRegex(),cP=/[\p{Pi}\p{Ps}"']/u,lP=/(?!~)[\p{P}\p{S}]/u,uP=/(?!~)[\s\p{P}\p{S}]/u,dP=/(?:[^\s\p{P}\p{S}]|~)/u,fP=$(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,ON?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),pP=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,mP=$(pP,`u`).replace(/punct/g,iP).getRegex(),hP=$(pP,`u`).replace(/punct/g,lP).getRegex(),gP=$(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,cP).replace(/punct/g,iP).getRegex(),_P=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,vP=$(_P,`gu`).replace(/notPunctSpace/g,oP).replace(/punctSpace/g,aP).replace(/punct/g,iP).getRegex(),yP=$(_P,`gu`).replace(/notPunctSpace/g,dP).replace(/punctSpace/g,uP).replace(/punct/g,lP).getRegex(),bP=$(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,oP).replace(/punctSpace/g,aP).replace(/punct/g,iP).getRegex(),xP=$(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,oP).replace(/punctSpace/g,aP).replace(/punct/g,iP).getRegex(),SP=$(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,oP).replace(/punctSpace/g,aP).replace(/punct/g,iP).getRegex(),CP=$(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,iP).getRegex(),wP=$(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,oP).replace(/punctSpace/g,aP).replace(/punct/g,iP).getRegex(),TP=$(/\\(punct)/,`gu`).replace(/punct/g,iP).getRegex(),EP=$(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,`gu`).replace(/punct/g,iP).getRegex(),DP=$(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),OP=$(GN).replace(`(?:-->|$)`,`-->`).getRegex(),kP=$(`^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,OP).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),AP=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,jP=$(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace(`brackets`,AP).getRegex(),MP=$(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace(`label`,jP).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),NP=$(/^!?\[(label)\]\[(ref)\]/).replace(`label`,jP).replace(`ref`,VN).getRegex(),PP=$(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,VN).getRegex(),FP=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,IP=$(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace(`brackets`,AP).getRegex(),LP=$(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,$(/^!?\[(label)\]\[(ref)\]/).replace(`label`,IP).replace(`ref`,FP).getRegex()).replace(`nolink`,$(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,FP).getRegex()).getRegex(),RP=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,zP=$(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),BP={_backpedal:EN,anyPunctuation:TP,anyPunctuationOutsideCode:EP,autolink:DP,blockSkip:fP,br:nP,code:tP,del:EN,delLDelim:EN,delRDelim:EN,emStrongLDelim:mP,emStrongRDelimAst:vP,emStrongRDelimUnd:xP,escape:eP,link:MP,nolink:PP,punctuation:sP,reflink:NP,reflinkSearch:LP,tag:kP,text:rP,url:EN},VP={...BP,emStrongLDelim:gP,emStrongRDelimAst:bP,emStrongRDelimUnd:SP,link:$(/^!?\[(label)\]\((.*?)\)/).replace(`label`,jP).getRegex(),reflink:$(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,jP).getRegex()},HP={...BP,emStrongRDelimAst:yP,emStrongLDelim:hP,delLDelim:CP,delRDelim:wP,url:$(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`emailProtocol`,zP).replace(`protocol`,RP).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:$(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace(`protocol`,RP).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},UP={...HP,br:$(nP).replace(`{2,}`,`*`).getRegex(),text:$(HP.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},WP={normal:XN,gfm:QN,pedantic:$N},GP={normal:BP,gfm:HP,breaks:UP,pedantic:VP},KP={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},qP=e=>KP[e];function JP(e,t){if(t){if(kN.escapeTest.test(e))return e.replace(kN.escapeReplace,qP)}else if(kN.escapeTestNoEncode.test(e))return e.replace(kN.escapeReplaceNoEncode,qP);return e}function YP(e){return kN.numericCharacterReference.test(e)?e.replace(kN.numericCharacterReferenceOrAmpersand,(e,t,n)=>{if(t===void 0&&n===void 0)return`&amp;`;let r=t===void 0?Number.parseInt(n,16):Number.parseInt(t,10);return r===0||r>1114111||r>=55296&&r<=57343?`�`:r===38?`&amp;`:String.fromCodePoint(r)}):e}function XP(e){try{e=encodeURI(e).replace(kN.percentDecode,`%`)}catch{return null}return e}function ZP(e,t){let n=e.replace(kN.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(kN.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(kN.slashPipe,`|`);return n}function QP(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function $P(e){let t=e.split(`
276
+ `),n=t.length-1;for(;n>=0&&kN.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
277
+ `)}function eF(e){return e.trim().toLowerCase().toUpperCase().toLowerCase()}function tF(e,t){if(e.indexOf(t[0])===-1&&e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function nF(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function rF(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`),c=e[0].charAt(0)===`!`,l=r.state.inLink,u=r.state.linkEmitted,d=r.state.inRawBlock;r.state.inLink=!0,r.state.linkEmitted=!1;let f=r.inlineTokens(s),p=r.state.linkEmitted;if(r.state.linkEmitted=u,r.state.inLink=l,!c){if(p){r.state.inRawBlock=d;return}r.state.linkEmitted=!0}return{type:c?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:f}}function iF(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
277
278
  `).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return e.slice(Math.min(r.length,i.length))}).join(`
278
- `)}function $P(e,t,n,r){if(!t.includes(`<`))return!1;for(let i=0;i<t.length;i++){if(t[i]===`\\`){i++;continue}if(t[i]==="`"){let e=r.inline.code.exec(t.slice(i));if(e){i+=e[0].length-1;continue}}if(t[i]!==`<`)continue;let a=e.slice(n+i),o=r.inline.tag.exec(a)||r.inline.autolink.exec(a);if(o){if(o[0].length>t.length-i)return!0;i+=o[0].length-1}}return!1}var eF=class{options;rules;lexer;constructor(e){this.options=e||vN}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:qP(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=QP(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=KP(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceTabChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:KP(t[0],`
279
- `),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:KP(t[0],`
280
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=KP(t[0],`
279
+ `)}function aF(e,t,n,r){if(!t.includes(`<`))return!1;for(let i=0;i<t.length;i++){if(t[i]===`\\`){i++;continue}if(t[i]==="`"){let e=r.inline.code.exec(t.slice(i));if(e){i+=e[0].length-1;continue}}if(t[i]!==`<`)continue;let a=e.slice(n+i),o=r.inline.tag.exec(a)||r.inline.autolink.exec(a);if(o){if(o[0].length>t.length-i)return!0;i+=o[0].length-1}}return!1}var oF=class{options;rules;lexer;constructor(e){this.options=e||wN}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:$P(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=iF(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=QP(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceTabChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:QP(t[0],`
280
+ `),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:QP(t[0],`
281
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=QP(t[0],`
281
282
  `).split(`
282
283
  `),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o=0;for(;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
283
284
  `),c=s.replace(this.rules.other.blockquoteSetextReplace,`
@@ -292,17 +293,17 @@ ${d.join(`
292
293
  `+e.join(`
293
294
  `),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
294
295
  `)}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=e,r=()=>n.length-e.length,i=t[1].trim(),a=i.length>1,o={type:`list`,raw:``,ordered:a,start:a?+i.slice(0,-1):``,loose:!1,items:[]};i=a?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=a?i:`[*+-]`);let s=this.rules.other.listItemRegex(i),c=!1;for(;e;){let i=!1,a=``;if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;let l=r();e=e.substring(t[0].length);let u=t[2].split(`
295
- `,1)[0],d=t[1].length,f=this.options.pedantic?XP(u,d):u.replace(this.rules.other.leadingSpaceTab,e=>XP(e,d)),p=e.split(`
296
+ `,1)[0],d=t[1].length,f=this.options.pedantic?nF(u,d):u.replace(this.rules.other.leadingSpaceTab,e=>nF(e,d)),p=e.split(`
296
297
  `,1)[0],m=!f.trim(),h=0;if(this.options.pedantic?(h=2,a=f.trimStart()):m?h=d+1:(h=f.search(this.rules.other.nonSpaceChar),h=h>4?1:h,a=f.slice(h),h+=d),m&&this.rules.other.blankLine.test(p)&&(e=e.substring(p.length+1),i=!0),!i){let t=this.rules.other.nextBulletRegex(h),n=this.rules.other.hrRegex(h),r=this.rules.other.fencesBeginRegex(h),i=this.rules.other.headingBeginRegex(h),o=this.rules.other.htmlBeginRegex(h),s=this.rules.other.blockquoteBeginRegex(h);for(;e;){let c=e.split(`
297
- `,1)[0],l;if(p=c,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting,` `),l=p):l=p.replace(this.rules.other.leadingSpaceTab,e=>XP(e)),r.test(p)||i.test(p)||o.test(p)||s.test(p)||t.test(p)||n.test(p))break;if(l.search(this.rules.other.nonSpaceChar)>=h||!p.trim())a+=`
298
+ `,1)[0],l;if(p=c,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting,` `),l=p):l=p.replace(this.rules.other.leadingSpaceTab,e=>nF(e)),r.test(p)||i.test(p)||o.test(p)||s.test(p)||t.test(p)||n.test(p))break;if(l.search(this.rules.other.nonSpaceChar)>=h||!p.trim())a+=`
298
299
  `+l.slice(h);else{if(m||f.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||r.test(f)||i.test(f)||n.test(f))break;a+=`
299
- `+p}m=!p.trim(),e=e.substring(c.length+1),f=l.slice(h)}}let g=n.slice(l,r());o.loose||(c?o.loose=!0:this.rules.other.doubleBlankLine.test(g)&&(c=!0)),o.items.push({type:`list_item`,raw:g,task:!!this.options.gfm&&this.rules.other.listIsTask.test(a),loose:!1,text:a,tokens:[]})}let l=o.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;o.raw=n.slice(0,r()).trimEnd();for(let e of o.items)if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),!o.loose){let t=e.tokens.filter(e=>e.type===`space`);o.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}for(let e of o.items){let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,o.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1}if(o.loose)for(let e of o.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return o}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=qP(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){if(!this.rules.other.startAngleBracket.test(t[2])&&YP(t[2],`()`)!==-1)return;let e=JP(t[1]).replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:KP(t[0],`
300
- `),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=GP(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
301
- `):[],a={type:`table`,raw:KP(t[0],`
302
- `),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(GP(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:KP(t[0],`
300
+ `+p}m=!p.trim(),e=e.substring(c.length+1),f=l.slice(h)}}let g=n.slice(l,r());o.loose||(c?o.loose=!0:this.rules.other.doubleBlankLine.test(g)&&(c=!0)),o.items.push({type:`list_item`,raw:g,task:!!this.options.gfm&&this.rules.other.listIsTask.test(a),loose:!1,text:a,tokens:[]})}let l=o.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;o.raw=n.slice(0,r()).trimEnd();for(let e of o.items)if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),!o.loose){let t=e.tokens.filter(e=>e.type===`space`);o.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}for(let e of o.items){let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,o.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1}if(o.loose)for(let e of o.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return o}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=$P(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){if(!this.rules.other.startAngleBracket.test(t[2])&&tF(t[2],`()`)!==-1)return;let e=eF(t[1]).replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:QP(t[0],`
301
+ `),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=ZP(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
302
+ `):[],a={type:`table`,raw:QP(t[0],`
303
+ `),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(ZP(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:QP(t[0],`
303
304
  `),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
304
- `?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){if(this.lexer.state.linkParenPossible===!1)return;let t=this.rules.inline.link.exec(e);if(t){let n=t[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&$P(e,t[1],n,this.rules))return;let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let e=KP(r.slice(0,-1),`\\`);if((r.length-e.length)%2==0)return}else{let e=YP(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let i=t[2],a=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(i);e&&(i=e[1],a=e[3])}else a=t[3]?t[3].slice(1,-1):``;return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(i=this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?i.slice(1):i.slice(1,-1)),ZP(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,`$1`),title:a&&a.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=n[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&$P(e,n[1],r,this.rules))return;let i=t[JP((n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `))];if(!i){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return ZP(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,a,o,s=i,c=0,l=r[0][0],u=n===l,d=l===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+i);(r=d.exec(t))!==null;){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a)continue;if(o=[...a].length,r[3]||r[4]){s+=o;continue}if(r[5]||r[6]){if(i%3&&!((i+o)%3)){c+=o;continue}if(u)break}if(s-=o,s>0)continue;o=Math.min(o,o+s+c);let t=[...r[0]][0].length,n=e.slice(0,i+r.index+t+o);if(Math.min(i,o)%2){let e=n.slice(1,-1);return{type:`em`,raw:n,text:e,tokens:this.lexer.inlineTokens(e)}}let l=n.slice(2,-2);return{type:`strong`,raw:n,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:e?t[0]:UP(t[0]),escaped:e}}}},tF=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||vN,this.options.tokenizer=this.options.tokenizer||new eF,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0};let t={other:CN,block:RP.normal,inline:zP.normal};this.options.pedantic?(t.block=RP.pedantic,t.inline=zP.pedantic):this.options.gfm&&(t.block=RP.gfm,t.inline=this.options.breaks?zP.breaks:zP.gfm),this.tokenizer.rules=t}static get rules(){return{block:RP,inline:zP}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(CN.carriageReturn,`
305
- `),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(CN.tabCharGlobal,` `).replace(CN.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
305
+ `?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){if(this.lexer.state.linkParenPossible===!1)return;let t=this.rules.inline.link.exec(e);if(t){let n=t[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&aF(e,t[1],n,this.rules))return;let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let e=QP(r.slice(0,-1),`\\`);if((r.length-e.length)%2==0)return}else{let e=tF(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let i=t[2],a=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(i);e&&(i=e[1],a=e[3])}else a=t[3]?t[3].slice(1,-1):``;return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(i=this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?i.slice(1):i.slice(1,-1)),rF(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,`$1`),title:a&&a.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=n[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&aF(e,n[1],r,this.rules))return;let i=t[eF((n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `))];if(!i){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return rF(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,a,o,s=i,c=0,l=r[0][0],u=n===l,d=l===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+i);(r=d.exec(t))!==null;){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a)continue;if(o=[...a].length,r[3]||r[4]){s+=o;continue}if(r[5]||r[6]){if(i%3&&!((i+o)%3)){c+=o;continue}if(u)break}if(s-=o,s>0)continue;o=Math.min(o,o+s+c);let t=[...r[0]][0].length,n=e.slice(0,i+r.index+t+o);if(Math.min(i,o)%2){let e=n.slice(1,-1);return{type:`em`,raw:n,text:e,tokens:this.lexer.inlineTokens(e)}}let l=n.slice(2,-2);return{type:`strong`,raw:n,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:e?t[0]:YP(t[0]),escaped:e}}}},sF=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||wN,this.options.tokenizer=this.options.tokenizer||new oF,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0};let t={other:kN,block:WP.normal,inline:GP.normal};this.options.pedantic?(t.block=WP.pedantic,t.inline=GP.pedantic):this.options.gfm&&(t.block=WP.gfm,t.inline=this.options.breaks?GP.breaks:GP.gfm),this.tokenizer.rules=t}static get rules(){return{block:WP,inline:GP}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(kN.carriageReturn,`
306
+ `),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(kN.tabCharGlobal,` `).replace(kN.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
306
307
  `:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
307
308
  `)?``:`
308
309
  `)+i.raw,n.text+=`
@@ -315,9 +316,9 @@ ${d.join(`
315
316
  `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length)}else if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
316
317
  `)?``:`
317
318
  `)+i.raw,n.text+=`
318
- `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i)}else if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes(`[`))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!==`!`)return!0;for(let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let e=t[0],n=e.lastIndexOf(`[`);if(e.charAt(0)!==`!`&&Object.hasOwn(this.tokens.links,JP(e.slice(n+1,-1)))&&!(n>1&&this.linkInText(e.slice(1,n-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=this.state.linkParenPossible;this.state.linkParenPossible=n&&e.includes(`)`);try{return this.#e(e,t)}finally{this.state.linkParenPossible=n}}#e(e,t){let n=e;if(this.tokens.links&&e.includes(`[`)){let e=this.tokenizer.rules.inline.reflinkSearch,t=n=>{let r=n.lastIndexOf(`[`);if(!Object.hasOwn(this.tokens.links,JP(n.slice(r+1,-1))))return n;if(r>1&&n.charAt(0)!==`!`){let i=n.slice(1,r-1);if(this.linkInText(i))return`[`+i.replace(e,t)+`][`+`a`.repeat(n.length-r-2)+`]`}return`[`+`a`.repeat(n.length-2)+`]`};n=n.replace(e,t)}n=n.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode,(e,t,n)=>n?`+`.repeat(e.length):t?t+e.slice(t.length,-t.length).replace(/`/g,`+`)+t:e),n=n.replace(this.tokenizer.rules.inline.blockSkip,(e,t,n)=>{let r=n?n.length:0;return e.slice(0,r)+`[`+`a`.repeat(e.length-r-2)+`]`}),n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(n=>(o=n.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if((o=this.tokenizer.escape(e))||(o=this.tokenizer.tag(e))||(o=this.tokenizer.link(e))){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let n=t.at(-1);o.type===`text`&&n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if((o=this.tokenizer.emStrong(e,n,i))||(o=this.tokenizer.codespan(e))||(o=this.tokenizer.br(e))||(o=this.tokenizer.del(e,n,i))||(o=this.tokenizer.autolink(e))||!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let s=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o)}else if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},nF=class{options;parser;constructor(e){this.options=e||vN}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(CN.notSpaceStart)?.[0],i=e?e.replace(CN.endingNewline,``)+`
319
- `:``;return r?`<pre><code class="language-`+HP(r)+`">`+(n?i:HP(i,!0))+`</code></pre>
320
- `:`<pre><code>`+(n?i:HP(i,!0))+`</code></pre>
319
+ `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i)}else if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes(`[`))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!==`!`)return!0;for(let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let e=t[0],n=e.lastIndexOf(`[`);if(e.charAt(0)!==`!`&&Object.hasOwn(this.tokens.links,eF(e.slice(n+1,-1)))&&!(n>1&&this.linkInText(e.slice(1,n-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=this.state.linkParenPossible;this.state.linkParenPossible=n&&e.includes(`)`);try{return this.#e(e,t)}finally{this.state.linkParenPossible=n}}#e(e,t){let n=e;if(this.tokens.links&&e.includes(`[`)){let e=this.tokenizer.rules.inline.reflinkSearch,t=n=>{let r=n.lastIndexOf(`[`);if(!Object.hasOwn(this.tokens.links,eF(n.slice(r+1,-1))))return n;if(r>1&&n.charAt(0)!==`!`){let i=n.slice(1,r-1);if(this.linkInText(i))return`[`+i.replace(e,t)+`][`+`a`.repeat(n.length-r-2)+`]`}return`[`+`a`.repeat(n.length-2)+`]`};n=n.replace(e,t)}n=n.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode,(e,t,n)=>n?`+`.repeat(e.length):t?t+e.slice(t.length,-t.length).replace(/`/g,`+`)+t:e),n=n.replace(this.tokenizer.rules.inline.blockSkip,(e,t,n)=>{let r=n?n.length:0;return e.slice(0,r)+`[`+`a`.repeat(e.length-r-2)+`]`}),n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(n=>(o=n.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if((o=this.tokenizer.escape(e))||(o=this.tokenizer.tag(e))||(o=this.tokenizer.link(e))){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let n=t.at(-1);o.type===`text`&&n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if((o=this.tokenizer.emStrong(e,n,i))||(o=this.tokenizer.codespan(e))||(o=this.tokenizer.br(e))||(o=this.tokenizer.del(e,n,i))||(o=this.tokenizer.autolink(e))||!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let s=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o)}else if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},cF=class{options;parser;constructor(e){this.options=e||wN}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(kN.notSpaceStart)?.[0],i=e?e.replace(kN.endingNewline,``)+`
320
+ `:``;return r?`<pre><code class="language-`+JP(r)+`">`+(n?i:JP(i,!0))+`</code></pre>
321
+ `:`<pre><code>`+(n?i:JP(i,!0))+`</code></pre>
321
322
  `}blockquote({tokens:e}){return`<blockquote>
322
323
  ${this.parser.parse(e)}</blockquote>
323
324
  `}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
@@ -333,53 +334,53 @@ ${this.parser.parse(e)}</blockquote>
333
334
  `}tablerow({text:e}){return`<tr>
334
335
  ${e}</tr>
335
336
  `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
336
- `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${HP(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,text:n,tokens:r,autolink:i}){let a=i?HP(n,!0):this.parser.parseInline(r),o=WP(e);if(o===null)return a;e=HP(o,i);let s=`<a href="`+e+`"`;return t&&(s+=` title="`+HP(t)+`"`),s+=`>`+a+`</a>`,s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=WP(e);if(i===null)return HP(n);e=i;let a=`<img src="${HP(e)}" alt="${HP(n)}"`;return t&&(a+=` title="${HP(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:HP(e.text)}},rF=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},iF=class e{options;renderer;textRenderer;constructor(e){this.options=e||vN,this.options.renderer=this.options.renderer||new nF,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new rF}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},aF=class{options;block;constructor(e){this.options=e||vN}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?tF.lex:tF.lexInline}provideParser(e=this.block){return e?iF.parse:iF.parseInline}};function oF(e,t){if(Array.isArray(t))for(let n=0;n<t.length;n++)e.push(t[n]);else e.push(t)}var sF=new class{defaults=_N();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=iF;Renderer=nF;TextRenderer=rF;Lexer=tF;Tokenizer=eF;Hooks=aF;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(oF(n,t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)oF(n,this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)oF(n,this.walkTokens(e.tokens,t));break}case`list`:{let e=r;oF(n,this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);oF(n,this.walkTokens(i,t))}):e.tokens&&oF(n,this.walkTokens(e.tokens,t))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new nF(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new eF(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new aF;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=aF.passThroughHooks.has(n)?e=>{if(this.defaults.async&&aF.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&oF(n,t.call(this,e)),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return tF.lex(e,t??this.defaults)}parser(e,t){return iF.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?tF.lex:tF.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?iF.parse:iF.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?tF.lex:tF.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?iF.parse:iF.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
337
- Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+HP(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function cF(e,t){return sF.parse(e,t)}cF.options=cF.setOptions=function(e){return sF.setOptions(e),cF.defaults=sF.defaults,yN(cF.defaults),cF},cF.getDefaults=_N,cF.defaults=vN;function lF(...e){return sF.use(...e),cF.defaults=sF.defaults,yN(cF.defaults),cF}cF.use=lF,cF.walkTokens=function(e,t){return sF.walkTokens(e,t)},cF.parseInline=sF.parseInline,cF.Parser=iF,cF.parser=iF.parse,cF.Renderer=nF,cF.TextRenderer=rF,cF.Lexer=tF,cF.lexer=tF.lex,cF.Tokenizer=eF,cF.Hooks=aF,cF.parse=cF,cF.options,cF.setOptions,cF.walkTokens,cF.parseInline,iF.parse,tF.lex;function uF(e,t){this.v=e,this.k=t}function dF(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function fF(e){if(Array.isArray(e))return e}function pF(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function mF(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
338
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hF(e,t){return fF(e)||pF(e,t)||gF(e,t)||mF()}function gF(e,t){if(e){if(typeof e==`string`)return dF(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?dF(e,t):void 0}}function _F(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof uF;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`&&o.k?t:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(!!a.done,n)},function(e){r(`throw`,e)})}catch(e){i(2,e)}}function i(e,i){e===2?t.reject(i):t.resolve({value:i,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}_F.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},_F.prototype.next=function(e){return this._invoke(`next`,e)},_F.prototype.throw=function(e){return this._invoke(`throw`,e)},_F.prototype.return=function(e){return this._invoke(`return`,e)};var vF=Object.entries,yF=Object.setPrototypeOf,bF=Object.isFrozen,xF=Object.getPrototypeOf,SF=Object.getOwnPropertyDescriptor,CF=Object.freeze,wF=Object.seal,TF=Object.create,EF=typeof Reflect<`u`&&Reflect,DF=EF.apply,OF=EF.construct;CF||=function(e){return e},wF||=function(e){return e},DF||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},OF||=function(e){return new e(...[...arguments].slice(1))};var kF=$F(Array.prototype.forEach);Array.prototype.indexOf;var AF=$F(Array.prototype.lastIndexOf),jF=$F(Array.prototype.pop),MF=$F(Array.prototype.push),NF=$F(Array.prototype.slice),PF=$F(Array.prototype.splice),FF=Array.isArray,IF=eI(Set),LF=$F(Set.prototype.add),RF=$F(Set.prototype.has),zF=$F(String.prototype.toLowerCase),BF=$F(String.prototype.toString),VF=$F(String.prototype.match),HF=$F(String.prototype.replace),UF=$F(String.prototype.indexOf),WF=$F(String.prototype.trim),GF=$F(Number.prototype.toString),KF=$F(Boolean.prototype.toString),qF=typeof BigInt>`u`?null:$F(BigInt.prototype.toString),JF=typeof Symbol>`u`?null:$F(Symbol.prototype.toString),YF=$F(Object.prototype.hasOwnProperty),XF=$F(Object.prototype.toString),ZF=$F(RegExp.prototype.test),QF=eI(TypeError);function $F(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return DF(e,t,n)}}function eI(e){return function(){return OF(e,[...arguments])}}function tI(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:zF;if(yF&&yF(e,null),!FF(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(bF(t)||(t[r]=e),i=e)}e[i]=!0}return e}function nI(e){for(let t=0;t<e.length;t++)YF(e,t)||(e[t]=null);return e}function rI(e){let t=TF(null);for(let r of vF(e)){var n=hF(r,2);let i=n[0],a=n[1];YF(e,i)&&(t[i]=FF(a)?nI(a):a&&typeof a==`object`&&a.constructor===Object?rI(a):a)}return t}function iI(e){switch(typeof e){case`string`:return e;case`number`:return GF(e);case`boolean`:return KF(e);case`bigint`:return qF?qF(e):`0`;case`symbol`:return JF?JF(e):`Symbol()`;case`undefined`:return XF(e);case`function`:case`object`:{if(e===null)return XF(e);let t=e,n=aI(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:XF(e)}return XF(e)}default:return XF(e)}}function aI(e,t){for(;e!==null;){let n=SF(e,t);if(n){if(n.get)return $F(n.get);if(typeof n.value==`function`)return $F(n.value)}e=xF(e)}function n(){return null}return n}function oI(e,t){for(;e!==null;){let n=SF(e,t);if(n)return n.get?$F(n.get):null;e=xF(e)}return null}function sI(e){try{return ZF(e,``),!0}catch{return!1}}var cI=CF(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),lI=CF(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),uI=CF([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),dI=CF([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),fI=CF(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),pI=CF([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),mI=CF([`#text`]),hI=CF(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),gI=CF(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),_I=CF(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),vI=CF([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),yI=wF(/{{[\w\W]*|^[\w\W]*}}/g),bI=wF(/<%[\w\W]*|^[\w\W]*%>/g),xI=wF(/\${[\w\W]*/g),SI=wF(/^data-[\-\w.\u00B7-\uFFFF]+$/),CI=wF(/^aria-[\-\w]+$/),wI=wF(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),TI=wF(/^(?:\w+script|data):/i),EI=wF(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),DI=wF(/^html$/i),OI=wF(/^[a-z][.\w]*(-[.\w]+)+$/i),kI=wF(/<[/\w!]/g),AI=wF(/<[/\w]/g),jI=wF(/<\/no(script|embed|frames)/i),MI=wF(/\/>/i),NI={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},PI=CF(tI({},[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`])),FI=function(){return typeof window>`u`?null:window},II=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},LI=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},RI=function(e,t,n,r){return YF(e,t)&&FF(e[t])?tI(r.base?rI(r.base):{},e[t],r.transform):n},zI=function(e,t,n){let r=YF(e,t)?e[t]:void 0;return r&&typeof r==`object`?rI(r):n()};function BI(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:FI(),t=e=>BI(e);if(t.version=`3.4.17`,t.removed=[],!e||!e.document||e.document.nodeType!==NI.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=aI(d,`cloneNode`),p=aI(d,`remove`),m=aI(d,`removeAttributeNode`),h=aI(d,`nextSibling`),g=aI(d,`childNodes`),_=aI(d,`parentNode`),v=aI(d,`shadowRoot`),y=aI(d,`attributes`),b=o&&o.prototype?aI(o.prototype,`nodeType`):null,x=o&&o.prototype?aI(o.prototype,`nodeName`):null,S=o&&o.prototype?aI(o.prototype,`ownerDocument`):null,C=function(e){return b?b(e):e.nodeType},w=function(e){return x?x(e):e.nodeName},ee=oI(d,`namespaceURI`),T=function(e){return ee?ee(e):e.namespaceURI};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let E,D=``,O,te=!1,ne=0,re=function(){if(ne>0)throw QF(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},ie=function(e){re(),ne++;try{return E.createHTML(e)}finally{ne--}},ae=function(e){re(),ne++;try{return E.createScriptURL(e)}finally{ne--}},oe=function(){return te||=(O=II(u,i),!0),O},se=n,ce=se.implementation,le=se.createNodeIterator,ue=se.createDocumentFragment,de=se.getElementsByTagName,fe=r.importNode,k=LI();t.isSupported=typeof vF==`function`&&typeof _==`function`&&ce&&ce.createHTMLDocument!==void 0;let pe=yI,me=bI,he=xI,ge=SI,_e=CI,ve=TI,ye=EI,be=OI,xe=wI,A=null,Se=tI({},[...cI,...lI,...uI,...fI,...mI]),Ce=null,we=tI({},[...hI,...gI,..._I,...vI]),Te=Object.seal(TF(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ee=null,j=null,De=Object.seal(TF(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Oe=!0,ke=!0,Ae=!1,je=!0,Me=!1,Ne=!0,Pe=!1,Fe=!1,Ie=null,Le=null,Re=!1,ze=!1,Be=!1,Ve=!1,M=!0,He=!1,Ue=`user-content-`,We=!0,Ge=!1,Ke=null,qe={},Je=null,Ye=tI({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),Xe=null,Ze=tI({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Qe=null,$e=tI({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),et=`http://www.w3.org/1998/Math/MathML`,tt=`http://www.w3.org/2000/svg`,nt=`http://www.w3.org/1999/xhtml`,rt=nt,it=!1,at=null,ot=tI({},[et,tt,nt],BF),st=CF([`mi`,`mo`,`mn`,`ms`,`mtext`]),ct=tI({},st),lt=CF([`annotation-xml`]),ut=tI({},lt),dt=tI({},[`title`,`style`,`font`,`a`,`script`]),ft=null,pt=[`application/xhtml+xml`,`text/html`],mt=null,ht=null,gt=n.createElement(`form`),_t=function(e){return e instanceof RegExp||e instanceof Function},vt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(ht&&ht===e)return;(!e||typeof e!=`object`)&&(e={}),e=rI(e),ft=pt.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,mt=ft===`application/xhtml+xml`?BF:zF,A=RI(e,`ALLOWED_TAGS`,Se,{transform:mt}),Ce=RI(e,`ALLOWED_ATTR`,we,{transform:mt}),at=RI(e,`ALLOWED_NAMESPACES`,ot,{transform:BF}),Qe=RI(e,`ADD_URI_SAFE_ATTR`,$e,{transform:mt,base:$e}),Xe=RI(e,`ADD_DATA_URI_TAGS`,Ze,{transform:mt,base:Ze}),Je=RI(e,`FORBID_CONTENTS`,Ye,{transform:mt}),Ee=RI(e,`FORBID_TAGS`,rI({}),{transform:mt}),j=RI(e,`FORBID_ATTR`,rI({}),{transform:mt}),qe=YF(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?rI(e.USE_PROFILES):e.USE_PROFILES:!1,Oe=e.ALLOW_ARIA_ATTR!==!1,ke=e.ALLOW_DATA_ATTR!==!1,Ae=e.ALLOW_UNKNOWN_PROTOCOLS||!1,je=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Me=e.SAFE_FOR_TEMPLATES||!1,Ne=e.SAFE_FOR_XML!==!1,Pe=e.WHOLE_DOCUMENT||!1,ze=e.RETURN_DOM||!1,Be=e.RETURN_DOM_FRAGMENT||!1,Ve=e.RETURN_TRUSTED_TYPE||!1,Re=e.FORCE_BODY||!1,M=e.SANITIZE_DOM!==!1,He=e.SANITIZE_NAMED_PROPS||!1,We=e.KEEP_CONTENT!==!1,Ge=e.IN_PLACE||!1,xe=sI(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:wI,rt=typeof e.NAMESPACE==`string`?e.NAMESPACE:nt,ct=zI(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>tI({},st)),ut=zI(e,`HTML_INTEGRATION_POINTS`,()=>tI({},lt));let t=zI(e,`CUSTOM_ELEMENT_HANDLING`,()=>TF(null));if(Te=TF(null),YF(t,`tagNameCheck`)&&_t(t.tagNameCheck)&&(Te.tagNameCheck=t.tagNameCheck),YF(t,`attributeNameCheck`)&&_t(t.attributeNameCheck)&&(Te.attributeNameCheck=t.attributeNameCheck),YF(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(Te.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),wF(Te),Me&&(ke=!1),Be&&(ze=!0),qe&&(A=tI({},mI),Ce=TF(null),qe.html===!0&&(tI(A,cI),tI(Ce,hI)),qe.svg===!0&&(tI(A,lI),tI(Ce,gI),tI(Ce,vI)),qe.svgFilters===!0&&(tI(A,uI),tI(Ce,gI),tI(Ce,vI)),qe.mathMl===!0&&(tI(A,fI),tI(Ce,_I),tI(Ce,vI))),De.tagCheck=null,De.attributeCheck=null,YF(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?De.tagCheck=e.ADD_TAGS:FF(e.ADD_TAGS)&&(A===Se&&(A=rI(A)),tI(A,e.ADD_TAGS,mt))),YF(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?De.attributeCheck=e.ADD_ATTR:FF(e.ADD_ATTR)&&(Ce===we&&(Ce=rI(Ce)),tI(Ce,e.ADD_ATTR,mt))),YF(e,`ADD_FORBID_CONTENTS`)&&FF(e.ADD_FORBID_CONTENTS)&&(Je===Ye&&(Je=rI(Je)),tI(Je,e.ADD_FORBID_CONTENTS,mt)),We&&(A[`#text`]=!0),Pe&&tI(A,[`html`,`head`,`body`]),A.table&&(tI(A,[`tbody`]),delete Ee.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw QF(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw QF(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=E;E=e.TRUSTED_TYPES_POLICY;try{D=ie(``)}catch(e){throw E=t,e}}else e.TRUSTED_TYPES_POLICY===null?(E=void 0,D=``):(E===void 0&&(E=oe()),E&&typeof D==`string`&&(D=ie(``)));CF&&CF(e),ht=e},yt=tI({},[...lI,...uI,...dI]),bt=tI({},[...fI,...pI]),xt=function(e,t,n){return t.namespaceURI===nt?e===`svg`:t.namespaceURI===et?e===`svg`&&(n===`annotation-xml`||ct[n]):!!yt[e]},St=function(e,t,n){return t.namespaceURI===nt?e===`math`:t.namespaceURI===tt?e===`math`&&ut[n]:!!bt[e]},Ct=function(e,t,n){return t.namespaceURI===tt&&!ut[n]||t.namespaceURI===et&&!ct[n]?!1:!bt[e]&&(dt[e]||!yt[e])},wt=function(e){let t=T(e),n=zF(w(e)),r=_(e),i,a;return r&&C(r)===NI.element?(i={namespaceURI:T(r)},a=zF(w(r))):(i={namespaceURI:rt},a=`template`),at[t]?t===tt?xt(n,i,a):t===et?St(n,i,a):t===nt?Ct(n,i,a):!!(ft===`application/xhtml+xml`&&at[t]):!1},Tt=function(e){MF(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(p(e),!_(e))throw QF(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},Et=function(e,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},Dt=function(e){jt(e);let t=g(e);t&&kF(NF(t),e=>{try{p(e)}catch{}});let n=C(e)===NI.element?y(e):null;if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&Et(e,r,i)}},Ot=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}MF(t.removed,{attribute:r||null,from:n});try{r?m(n,r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`){if(ze||Be)try{Tt(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},kt=function(e){let t=y(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||Ce[mt(i)]||Et(e,r,i)}},At=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0&&arguments[2],r=[e];for(;r.length>0;){let e=r.pop();if(t(e)===!1)continue;if(n&&C(e)===NI.element){let t=v(e);Kt(t)&&r.push(t)}let i=g(e);if(i)for(let e=i.length-1;e>=0;--e)r.push(i[e])}},jt=function(e){At(e,e=>{C(e)===NI.element&&kt(e)})},Mt=function(e){let t=[];return At(e,e=>{t.push(e)},!0),t},Nt=function(e,t){let n=IF();kF(Mt(e),e=>{C(e)===NI.element&&LF(n,e)}),kF(t,e=>{C(e)===NI.element&&!RF(n,e)&&kt(e)})},Pt=function(e,n){let r=!1;return kF(t.removed,t=>{t.element&&(r||=t.element===e,jt(t.element))}),Nt(e,n),r},Ft=function(e,t){let n=Ke,r=null,i=()=>(r||(r=IF(),kF(t,e=>{LF(r,e)})),r);for(let t=0;;t++){let r=Mt(e),a=[e],o=!1;if(kF(r,e=>{C(e)===NI.documentFragment?MF(a,e):!o&&!RF(n,e)&&(o=RF(i(),e))}),!o)return;if(t>=8)throw QF(`the tree kept changing during in-place sanitization; refusing to return it`);kF(a,(t,n)=>{It(t,n>0,e,i())})}},It=function(e,t,n,r){let i=Vt(e),a;for(;a=i.nextNode();)RF(r,a)&&!RF(Ke,a)&&(t&&Jt(k.uponSanitizeShadowNode,a,null),en(a,n),cn(a,n),Kt(a.content)&&ln(a.content))},Lt=function(e){Ke&&LF(Ke,e)},Rt=function(e,t){return Ne?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},zt=function(e){Ne&&At(e,e=>{let t=C(e);if(t===NI.processingInstruction||t===NI.comment&&ZF(AI,e.data)){try{p(e)}catch{}return!1}if(t===NI.element){let t=e,n=mt(w(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&Rt(`for`,n)&&t.removeAttribute(`for`)}catch{}}return!0})},Bt=function(e){let t=null,r=null;if(Re)e=`<remove></remove>`+e;else{let t=VF(e,/^[\r\n\t ]+/);r=t&&t[0]}ft===`application/xhtml+xml`&&rt===nt&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=E?ie(e):e;if(rt===nt)try{t=new l().parseFromString(i,ft)}catch{}if(!t||!t.documentElement){t=ce.createDocument(rt,`template`,null);try{t.documentElement.innerHTML=it?D:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),rt===nt?de.call(t,Pe?`html`:`body`)[0]:Pe?t.documentElement:a},Vt=function(e){let t=S?S(e):e.ownerDocument;return le.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Ht=function(e){return e=HF(e,pe,` `),e=HF(e,me,` `),e=HF(e,he,` `),e},Ut=function(e){Wt(e);let t=e.querySelectorAll?.call(e,`template`);t&&kF(t,e=>{Kt(e.content)&&Ut(e.content)})},Wt=function(e){e.normalize();let t=S?S(e):e.ownerDocument,n=le.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=Ht(r.data),r=n.nextNode()},Gt=function(e){let t=x?x(e):null;return typeof t!=`string`||mt(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==y(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==b(e)||e.childNodes!==g(e)},Kt=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return b(e)===NI.documentFragment}catch{return!1}},qt=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return typeof b(e)==`number`}catch{return!1}};function Jt(e,n,r){e.length!==0&&kF(e,e=>{e.call(t,n,r,ht)})}let Yt=function(e,t){return!!(Ne&&e.hasChildNodes()&&!qt(e.firstElementChild)&&ZF(kI,e.textContent)&&ZF(kI,e.innerHTML)||Ne&&PI[t]&&C(e)===NI.element&&T(e)===nt&&(qt(e.firstElementChild)||typeof e.textContent==`string`&&ZF(kI,e.textContent))||e.nodeType===NI.processingInstruction||Ne&&e.nodeType===NI.comment&&ZF(AI,e.data))},Xt=function(e,t){return e instanceof RegExp?ZF(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},Zt=function(e,t,n){if(!Ee[t]&&rn(t)&&Xt(Te.tagNameCheck,t))return!1;if(We&&!Je[t]&&!Je[zF(t)]){let t=_(e),r=g(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,h(e))}}}return Tt(e),!0},Qt=function(e,t,n,r){return e.length===0?t:t===n||t===r?rI(t):t},$t=function(e,t){return e===t||_(e)!==null?!1:(Ge&&jt(e),!0)},en=function(e,n){if(Lt(e),Jt(k.beforeSanitizeElements,e,null),$t(e,n))return!0;if(Gt(e))return Tt(e),!0;let r=mt(w(e));if(A=Qt(k.uponSanitizeElement,A,Se,Ie),Jt(k.uponSanitizeElement,e,{tagName:r,allowedTags:A}),$t(e,n))return!0;if(Yt(e,r))return Tt(e),!0;if(Ee[r]||!(De.tagCheck instanceof Function&&De.tagCheck(r))&&!A[r]){let t=Zt(e,r,n);return t===!1&&(Jt(k.afterSanitizeElements,e,null),$t(e,n))?!0:t}if(C(e)===NI.element&&!wt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&ZF(jI,e.innerHTML))return Tt(e),!0;if(Me&&e.nodeType===NI.text){let n=Ht(e.textContent);e.textContent!==n&&(MF(t.removed,{element:e.cloneNode()}),e.textContent=n)}return Jt(k.afterSanitizeElements,e,null),$t(e,n)},tn=function(e,t,r){if(j[t]||Rt(t,e)||M&&(t===`id`||t===`name`)&&(r in n||r in gt))return!1;let i=Ce[t]||De.attributeCheck instanceof Function&&De.attributeCheck(t,e);return ke&&ZF(ge,t)||Oe&&ZF(_e,t)?!0:i?Qe[t]||ZF(xe,HF(r,ye,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&UF(r,`data:`)===0&&Xe[e]||Ae&&!ZF(ve,HF(r,ye,``))?!0:!r:rn(e)&&Xt(Te.tagNameCheck,e)&&Xt(Te.attributeNameCheck,t,e)||t===`is`&&Te.allowCustomizedBuiltInElements&&Xt(Te.tagNameCheck,r)},nn=tI({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),rn=function(e){return!nn[zF(e)]&&ZF(be,e)},an=function(e,t,n,r){if(E&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return ie(r);case`TrustedScriptURL`:return ae(r)}return r},on=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!Gt(e)||(Tt(e),!1)}catch{return Ot(t,e),!1}},sn=function(e,t){return Ne&&ZF(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,t)?!0:zF(e)===`attributename`&&VF(t,`href`)!==null},cn=function(e,n){if(Jt(k.beforeSanitizeAttributes,e,null),$t(e,n))return;let r=e.attributes;if(!r||Gt(e))return;Ce=Qt(k.uponSanitizeAttribute,Ce,we,Le);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:Ce,forceKeepAttr:void 0},a=r.length,o=mt(e.nodeName);for(;a--;){let n=r[a],s=n.name,c=n.namespaceURI,l=n.value,u=mt(s),d=l,f=s===`value`?d:WF(d),p=!1;i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,Jt(k.uponSanitizeAttribute,e,i),f=i.attrValue,He&&(u===`id`||u===`name`)&&UF(f,Ue)!==0&&(Ot(s,e,n),f=Ue+f,p=!0),sn(s,f)?Ot(s,e,n):i.forceKeepAttr||(i.keepAttr?!je&&ZF(MI,f)?Ot(s,e,n):(Me&&(f=Ht(f)),tn(o,u,f)?(f=an(o,u,c,f),f!==d&&on(e,s,c,f)&&p&&jF(t.removed)):Ot(s,e,n)):Ot(s,e,n))}Jt(k.afterSanitizeAttributes,e,null),$t(e,n)},ln=function(e){let t=null,n=Vt(e);for(Jt(k.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(Jt(k.uponSanitizeShadowNode,t,null),en(t,e),cn(t,e),Kt(t.content)&&ln(t.content),C(t)===NI.element){let e=v(t);Kt(e)&&(un(e),ln(e))}Me&&Wt(e),Jt(k.afterSanitizeShadowDOM,e,null)},un=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){ln(e.shadow);continue}let n=e.node,r=C(n)===NI.element,i=g(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=x?x(n):null;if(typeof e==`string`&&mt(e)===`template`){let e=n.content;Kt(e)&&t.push({node:e,shadow:null})}}if(r){let e=v(n);Kt(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(it=!e,it&&(e=`<!-->`),typeof e!=`string`&&!qt(e)&&(e=iI(e),typeof e!=`string`))throw QF(`dirty is not a string, aborting`);if(!t.isSupported)return e;Fe?(A=Ie,Ce=Le):vt(n),(k.uponSanitizeElement.length>0||k.uponSanitizeAttribute.length>0)&&(A=rI(A)),k.uponSanitizeAttribute.length>0&&(Ce=rI(Ce)),t.removed=[];let c=Ge&&typeof e!=`string`&&qt(e),l=[],u=Ke;if(c){zt(e);let t=w(e);if(typeof t==`string`){let n=mt(t);if(!A[n]||Ee[n])throw Dt(e),QF(`root node is forbidden and cannot be sanitized in-place`)}if(Gt(e))throw Dt(e),QF(`root node is clobbered and cannot be sanitized in-place`);l=Mt(e),Ke=IF()}else if(qt(e))i=Bt(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===NI.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),un(i);else{if(!ze&&!Me&&!Pe&&e.indexOf(`<`)===-1)return E&&Ve?ie(e):e;if(i=Bt(e),!i)return ze?null:Ve?D:``}i&&Re&&Tt(i.firstChild);let d=c?e:i;try{c&&un(e);let t=Vt(d);for(;o=t.nextNode();)en(o,d),cn(o,d),Kt(o.content)&&ln(o.content);c&&Ft(e,l)}catch(t){throw c&&(Dt(e),Pt(e,l)),t}finally{Ke=u}if(c){if(Pt(e,l))throw QF(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return Me&&Ut(e),e}if(ze){if(Me&&Ut(i),Be)for(s=ue.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(Ce.shadowroot||Ce.shadowrootmode)&&(s=fe.call(r,s,!0)),s}let f=Pe?i.outerHTML:i.innerHTML;return Pe&&A[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&ZF(DI,i.ownerDocument.doctype.name)&&(f=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
339
- `+f),Me&&(f=Ht(f)),E&&Ve?ie(f):f},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};vt(e),Fe=!0,Ie=A,Le=Ce},t.clearConfig=function(){ht=null,Fe=!1,Ie=null,Le=null,E=O,D=``},t.isValidAttribute=function(e,t,n){ht||vt({});let r=mt(e),i=mt(t);return typeof n==`string`&&(sn(t,n)||!je&&ZF(MI,n))?!1:tn(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&YF(k,e)&&MF(k[e],t)},t.removeHook=function(e,t){if(YF(k,e)){if(t!==void 0){let n=AF(k[e],t);return n===-1?void 0:PF(k[e],n,1)[0]}return jF(k[e])}},t.removeHooks=function(e){YF(k,e)&&(k[e]=[])},t.removeAllHooks=function(){k=LI()},t}var VI=BI(),HI=`png|jpe?g|gif|webp|bmp|svg|avif|ico|tiff?`,UI=`(?:file:\\/\\/(?:(?:localhost)?\\/(?=[^\\s])|[A-Za-z]:[\\\\/]|[^\\/\\s:]+\\/)|\\/(?!\\/)(?!\\s)|[A-Za-z]:[\\\\/](?!\\s)|\\\\\\\\[^\\\\/\\s]+[\\\\/](?!\\s))`,WI=`(?:(?:图|图片|预览图|预览|截图|设计稿|整图|效果图|封面|原图|缩略图|路径|image|img|preview|screenshot|pic|photo|file|path)\\s*[::]\\s*)?`,GI=RegExp(`^(\\s*(?:[-*+]\\s+|\\d+[.)]\\s+)?)(?:(?:图|图片|预览图|预览|截图|设计稿|整图|效果图|封面|原图|缩略图|路径|image|img|preview|screenshot|pic|photo|file|path)\\s*[::]\\s*)?(${UI}.+?\\.(?:${HI}))\\s*$`,`i`),KI=RegExp(`(^|[\\s(「『【>])(${UI}[^\`"'<>()\\[\\]{}\\s()「」『』【】,。;、!?:…·]+?\\.(?:${HI}))(?=$|[\\s))」』】.,;:!?,。;、!?])`,`gi`),qI=/^\s*(?:```|~~~)/,JI=RegExp(`\\.(?:${HI})`,`i`);function YI(e){return GI.test(e)||iL.test(e)||e.match(cL)!=null||e.match(lL)!=null}function XI(e){let t=[];for(let n=0;n<e.length;){if(!qI.test(e[n])){t.push(e[n]),n++;continue}let r=n+1;for(;r<e.length&&!qI.test(e[r]);)r++;let i=e.slice(n+1,r);i.filter(YI).length>=2?(t.push(...i),n=r<e.length?r+1:e.length):(t.push(e[n]),n++)}return t}var ZI=/^\/(?:slices|assets|icons|favicon|__)(?:[/.]|$)/i,QI=e=>ZI.test(String(e)),$I=e=>/[*{}]/.test(String(e)),eL=e=>QI(e)||$I(e),tL=/^(?:…|\.{3,})[\\/]/,nL=`(?:…|\\.{3,})[\\\\/][^\\s\`"'<>()「」『』【】,。;、!?:…]+?\\.(?:${HI})`,rL=RegExp(`(^|[\\s(「『【>→::])(\`?)(${nL})(\`?)`,`gi`),iL=RegExp(`^(\\s*(?:[-*+]\\s+|\\d+[.)]\\s+)?)${WI}(${nL})\\s*$`,`i`);function aL(e,t){let n=String(e).replace(tL,``).replace(/\\/g,`/`);if($I(n))return null;let r=`/${n.replace(/^\/+/,``)}`;return QI(r)?`![${uL(r)}](${pL(r)} "${fL(e)}")`:vL(e,t)}var oL=/!\[([^\]]*)\]\(\s*(data:[^)]*)\)/gi;function sL(e){let t=String(e??``);return!t||!/!\[[^\]]*\]\(\s*data:/i.test(t)?t:t.replace(oL,(e,t,n)=>{let r=/^data:([^;,]*)((?:;[^,]*)*),([\s\S]*)$/i.exec(n),i=String(t||``).trim()||`未命名`;return r?String(r[3]||``).trim()?e:`\`⚠ 图片缺失:${i}(data URI 载荷为空)\``:`\`⚠ 图片缺失:${i}(data URI 结构异常)\``})}var cL=RegExp(`(!\\[[^\\]]*\\]\\()\\s*(${UI}(?:[^\\s?#()]|\\([^\\s()]*\\))+?\\.(?:${HI}))(?=\\s*(?:"[^"]*"|'[^']*')?\\s*\\))`,`gi`),lL=RegExp(`(!\\[[^\\]]*\\]\\()\\s*([^\\s()/?#\\\\](?:[^\\s?#()]|\\([^\\s()]*\\))*?\\.(?:${HI}))(?=\\s*(?:"[^"]*"|'[^']*')?\\s*\\))`,`gi`);function uL(e){return dL(e).replace(/[[\]!]/g,``).trim().slice(0,120)||`预览图`}function dL(e){let t=String(e??``).trim();if(!t||/^(?:data|blob):/i.test(t))return``;let n=t;try{let e=new URL(t,`http://localhost/`);n=e.searchParams.get(`path`)||e.pathname||t,n=decodeURIComponent(n)}catch{try{n=decodeURIComponent(n)}catch{}}return(n.split(/[\\/]/).pop()||``).trim()}function fL(e){return String(e).replace(/"/g,`'`)}function pL(e){return String(e).replace(/\(/g,`%28`).replace(/\)/g,`%29`).replace(/ /g,`%20`)}function mL(e){let t=String(e);if(!t.includes(`%`))return t;try{return decodeURIComponent(t)}catch{return t}}function hL(e){let t=String(e);if(!/^file:\/\//i.test(t))return t;let n=t.replace(/^file:\/\//i,``),r=/^(?:localhost)?(\/.*)$/i.exec(n);if(r){let e=r[1];return/^\/[A-Za-z]:[\\/]/.test(e)?e.slice(1):e}if(/^[A-Za-z]:[\\/]/.test(n))return n;let i=/^([^\/\s:]+)\/(.*)$/.exec(n);return i?`\\\\${i[1]}\\${i[2].replace(/\//g,`\\`)}`:t}function gL(e,t){let n=hL(mL(e));if(eL(n))return null;let r=``;try{r=t(n)}catch{return null}return r?pL(r):null}function _L(e,t){let n=mL(e).replace(/\\/g,`/`);if(/^[A-Za-z][A-Za-z0-9+.-]*:/.test(n)||n.startsWith(`.`)||n.split(`/`).includes(`..`))return null;let r=``;try{r=t(n)}catch{return null}return r?pL(r):null}function vL(e,t){let n=hL(e);if(eL(n))return null;let r=``;try{r=t(n)}catch{return null}if(!r)return null;let i=pL(r);return`![${uL(n)}](${i} "${fL(n)}")`}function yL(e,t){let n=sL(e);if(!n||typeof t!=`function`||!JI.test(n))return n;let r=!1;return XI(n.split(`
340
- `)).map(e=>{if(qI.test(e))return r=!r,e;if(r||!JI.test(e))return e;let n=e.match(GI);if(n){let r=vL(n[2],t);return r===null?e:n[1]+r}let i=e.match(iL);if(i){let n=aL(i[2],t);return n===null?e:i[1]+n}return e.replace(cL,(e,n,r)=>n+(gL(r,t)??r)).replace(lL,(e,n,r)=>n+(_L(r,t)??r)).replace(KI,(e,n,r)=>n+(vL(r,t)??r)).replace(rL,(e,n,r,i)=>{let a=aL(i,t);return a===null?e:n+a})}).join(`
341
- `)}(function(e){var t=`\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b`,n={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:`punctuation`,inside:null},r={bash:n,environment:{pattern:RegExp(`\\$`+t),alias:`constant`},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp(`(\\{)`+t),lookbehind:!0,alias:`constant`}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:`important`},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:`function`},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:`function`}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:`variable`,lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp(`(^|[\\s;|&]|[<>]\\()`+t),lookbehind:!0,alias:`constant`}},alias:`variable`,lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:`variable`,lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:r},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:r},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:r.entity}}],environment:{pattern:RegExp(`\\$?`+t),alias:`constant`},variable:r.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:`class-name`},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:`important`},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:`important`}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=e.languages.bash;for(var i=[`comment`,`function-name`,`for-or-select`,`assign-left`,`parameter`,`string`,`environment`,`function`,`keyword`,`builtin`,`boolean`,`file-descriptor`,`operator`,`punctuation`,`number`],a=r.variable[1].inside,o=0;o<i.length;o++)a[i[o]]=e.languages.bash[i[o]];e.languages.sh=e.languages.bash,e.languages.shell=e.languages.bash})(Prism),(function(e){e.languages.typescript=e.languages.extend(`javascript`,{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript[`literal-property`];var t=e.languages.extend(`typescript`,{});delete t[`class-name`],e.languages.typescript[`class-name`].inside=t,e.languages.insertBefore(`typescript`,`function`,{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:`operator`},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:`class-name`,inside:t}}}}),e.languages.ts=e.languages.typescript})(Prism),(function(e){var t=e.util.clone(e.languages.javascript),n=`(?:\\s|\\/\\/.*(?!.)|\\/\\*(?:[^*]|\\*(?!\\/))\\*\\/)`,r=`(?:\\{(?:\\{(?:\\{[^{}]*\\}|[^{}])*\\}|[^{}])*\\})`,i=`(?:\\{<S>*\\.{3}(?:[^{}]|<BRACES>)*\\})`;function a(e,t){return e=e.replace(/<S>/g,function(){return n}).replace(/<BRACES>/g,function(){return r}).replace(/<SPREAD>/g,function(){return i}),RegExp(e,t)}i=a(i).source,e.languages.jsx=e.languages.extend(`markup`,t),e.languages.jsx.tag.pattern=a(`<\\/?(?:[\\w.:-]+(?:<S>+(?:[\\w.:$-]+(?:=(?:"(?:\\\\[\\s\\S]|[^\\\\"])*"|'(?:\\\\[\\s\\S]|[^\\\\'])*'|[^\\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\\/?)?>`),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside[`attr-value`].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside[`class-name`]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore(`inside`,`attr-name`,{spread:{pattern:a(`<SPREAD>`),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore(`inside`,`special-attr`,{script:{pattern:a(`=<BRACES>`),alias:`language-javascript`,inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:`punctuation`},rest:e.languages.jsx}}},e.languages.jsx.tag);var o=function(e){return e?typeof e==`string`?e:typeof e.content==`string`?e.content:e.content.map(o).join(``):``},s=function(t){for(var n=[],r=0;r<t.length;r++){var i=t[r],a=!1;if(typeof i!=`string`&&(i.type===`tag`&&i.content[0]&&i.content[0].type===`tag`?i.content[0].content[0].content===`</`?n.length>0&&n[n.length-1].tagName===o(i.content[0].content[1])&&n.pop():i.content[i.content.length-1].content===`/>`||n.push({tagName:o(i.content[0].content[1]),openedBraces:0}):n.length>0&&i.type===`punctuation`&&i.content===`{`?n[n.length-1].openedBraces++:n.length>0&&n[n.length-1].openedBraces>0&&i.type===`punctuation`&&i.content===`}`?n[n.length-1].openedBraces--:a=!0),(a||typeof i==`string`)&&n.length>0&&n[n.length-1].openedBraces===0){var c=o(i);r<t.length-1&&(typeof t[r+1]==`string`||t[r+1].type===`plain-text`)&&(c+=o(t[r+1]),t.splice(r+1,1)),r>0&&(typeof t[r-1]==`string`||t[r-1].type===`plain-text`)&&(c=o(t[r-1])+c,t.splice(r-1,1),r--),t[r]=new e.Token(`plain-text`,c,null,c)}i.content&&typeof i.content!=`string`&&s(i.content)}};e.hooks.add(`after-tokenize`,function(e){(e.language===`jsx`||e.language===`tsx`)&&s(e.tokens)})})(Prism),cF.setOptions({gfm:!0,breaks:!0}),VI.addHook(`afterSanitizeAttributes`,e=>{e.tagName===`A`&&e.getAttribute(`href`)&&(e.setAttribute(`target`,`_blank`),e.setAttribute(`rel`,`noopener noreferrer`)),e.tagName===`IMG`&&(e.setAttribute(`loading`,`lazy`),e.setAttribute(`decoding`,`async`))});var bL={js:`javascript`,mjs:`javascript`,cjs:`javascript`,node:`javascript`,ts:`typescript`,sh:`bash`,shell:`bash`,zsh:`bash`,console:`bash`,html:`markup`,vue:`markup`,xml:`markup`,svg:`markup`,jsonc:`json`,json5:`json`,py:`python`,yml:`yaml`};function xL(e){let t=String(e||``).trim().toLowerCase();if(!t)return``;let n=bL[t]||t;return pv.default.languages[n]?n:``}function SL(e){let t=String(e??``);if(!t.trim())return``;let n=``;try{n=cF.parse(t)}catch{n=`<p>${t.replace(/[&<>]/g,e=>({"&":`&amp;`,"<":`&lt;`,">":`&gt;`})[e])}</p>`}return VI.sanitize(n,{ADD_ATTR:[`target`,`rel`]})}function CL(e){if(e&&e.querySelectorAll)for(let t of e.querySelectorAll(`pre`)){let e=t.querySelector(`code`);if(!e)continue;let n=xL((e.className.match(/language-([\w+-]+)/)||[])[1]||``);if(n&&e.className.indexOf(`language-`)<0&&(e.className=`language-${n}`),n&&!e.dataset.mdHighlighted){try{pv.default.highlightElement(e)}catch{}e.dataset.mdHighlighted=`1`}if(t.dataset.mdCode)continue;t.dataset.mdCode=`1`;let r=document.createElement(`div`);r.className=`md-code`;let i=document.createElement(`div`);i.className=`md-code__bar`;let a=document.createElement(`span`);a.className=`md-code__lang`,a.textContent=n||`text`;let o=document.createElement(`button`);o.type=`button`,o.className=`md-code__copy`,o.textContent=`复制`,o.addEventListener(`click`,async()=>{await yp(e.textContent||``)?(o.textContent=`已复制`,o.classList.add(`is-ok`)):o.textContent=`复制失败`,setTimeout(()=>{o.textContent=`复制`,o.classList.remove(`is-ok`)},1600)}),i.append(a,o),t.parentNode?.insertBefore(r,t),r.append(i,t)}}function wL(e){if(e&&e.querySelectorAll)for(let t of e.querySelectorAll(`pre code[data-md-highlighted]`))delete t.dataset.mdHighlighted}function TL(e){return e?e.nodeType===3?!e.textContent.trim():e.nodeType===1&&e.tagName===`BR`:!1}function EL(e){if(e.length>1)return`${e.length} 张图像`;let t=e[0],n=(t.getAttribute(`alt`)||``).trim();if(n)return n;let r=(t.getAttribute(`title`)||``).trim();return(r?(r.split(/[\\/]/).pop()||``).trim():``)||dL(t.getAttribute(`src`))||`1 张图像`}function DL(e){let t=document.createElement(`div`);t.className=`md-imggroup`,t.dataset.mdImggroup=`1`;let n=document.createElement(`button`);n.type=`button`,n.className=`md-imggroup__head`,n.setAttribute(`aria-expanded`,`false`),n.innerHTML=`<svg class="md-imggroup__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><use href="#icon-images" /></svg><span class="md-imggroup__label"></span><svg class="md-imggroup__chev" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><use href="#icon-chevron-right" /></svg>`,n.querySelector(`.md-imggroup__label`).textContent=EL(e);let r=document.createElement(`div`);return r.className=`md-imggroup__body`,r.hidden=!0,n.addEventListener(`click`,()=>{let e=r.hidden;r.hidden=!e,t.classList.toggle(`is-open`,e),n.setAttribute(`aria-expanded`,e?`true`:`false`)}),t.append(n,r),{group:t,body:r}}function OL(e){if(e.dataset.mdImgFallback)return;e.dataset.mdImgFallback=`1`;let t=()=>{if(!e.isConnected||!(e.complete&&e.naturalWidth===0))return;let t=e.getAttribute(`src`)||``;if(/\.svgz?(?:[?#]|$)/i.test(t)||/^data:image\/svg/i.test(t))return;let n=dL(t)||(e.getAttribute(`alt`)||``).trim()||`未知图片`,r=document.createElement(`span`);r.className=`md-imgfail`,r.textContent=`图片加载失败:${n}`,r.title=t,e.replaceWith(r);let i=r.closest(`.md-imggroup__body`);if(i&&!i.querySelector(`img`)){let e=r.closest(`[data-md-imggroup]`);if(e){let t=e.querySelector(`.md-imggroup__head`);t&&t.remove(),e.classList.add(`is-open`)}}};e.addEventListener(`error`,t,{once:!0}),t()}function kL(e){if(!e||!e.querySelectorAll)return;let t=[...e.querySelectorAll(`img`)];for(let e of t)OL(e);for(let e of t){if(e.closest(`[data-md-imggroup]`))continue;let t=[e],n=e.nextSibling;for(;n;)if(TL(n))n=n.nextSibling;else if(n.tagName===`IMG`&&!n.closest(`[data-md-imggroup]`))t.push(n),n=n.nextSibling;else break;let{group:r,body:i}=DL(t);e.parentNode.insertBefore(r,e);for(let e of t)i.append(e)}}var AL={name:`MarkdownBody`,props:{source:{type:String,default:``},streaming:{type:Boolean,default:!1}},data(){return{html:``,_raf:0}},watch:{source:{immediate:!0,handler(){this.scheduleRender()}},streaming(e){e||this.renderNow()}},beforeUnmount(){this._raf&&cancelAnimationFrame(this._raf),this._raf=0},methods:{scheduleRender(){this.streaming?this._raf||=requestAnimationFrame(()=>{this._raf=0,this.renderNow()}):this.renderNow()},renderNow(){this._raf&&=(cancelAnimationFrame(this._raf),0),this.html=SL(this.source),this.$nextTick(()=>{let e=this.$refs.bodyEl;e&&(wL(e),CL(e),kL(e))})}}},jL=[`innerHTML`];function ML(e,t,n,r,i,a){return V(),H(B,null,[q(` 模型输出经 marked 解析 + DOMPurify 消毒后注入;代码块由 enhanceCodeBlocks 补高亮与复制按钮 `),W(`div`,{ref:`bodyEl`,class:`md-body`,innerHTML:i.html},null,8,jL)],2112)}var NL=Z(AL,[[`render`,ML],[`__file`,`/Users/ynet/dsl-card/card-editor/components/MarkdownBody.vue`]]),PL={card_list:`列出卡片`,card_read:`读取卡片`,card_write:`写入卡片`,card_validate:`校验卡片`,card_render_status:`渲染状态`,card_node_models:`组件模型`,card_screenshot:`截图预览`,card_sync:`同步远端卡片`,card_save:`推送到远端`,card_slice_upload:`上传切图`,card_import_meta:`来源侧车`,card_route_input:`输入路由`,card_scaffold:`生成骨架`,card_add_component:`添加组件`,card_history:`编辑历史`,card_rollback:`回滚版本`,skill_read:`读技能文档`,skill_exec:`跑技能脚本`,card_grep:`定位卡片字段`,card_patch:`最小改写卡片`,fs_read:`读文件`,fs_list:`列目录`,fs_write:`写草稿文件`,fs_copy:`复制文件`,shell_exec:`本地命令`};function FL(e){return PL[e]||e||`工具`}function IL(e){let t=e&&e.args||{};return`${typeof t.script==`string`?t.script:``} ${Array.isArray(t.args)?t.args.join(` `):typeof t.command==`string`?t.command:``} ${typeof t.name==`string`?t.name:``}`.toLowerCase()}var LL=[{order:6,id:`S6`,label:`收尾门禁`,hit:(e,t)=>/check_fidelity/.test(t)||/iterate/.test(t)&&/--gate/.test(t)},{order:5,id:`S5`,label:`像素自循环`,hit:(e,t)=>/iterate|diff_bands/.test(t)||e===`card_screenshot`},{order:4,id:`S4`,label:`组件填充`,hit:e=>e===`card_add_component`||e===`card_patch`||e===`card_write`},{order:3,id:`S3`,label:`骨架落盘`,hit:(e,t)=>e===`card_scaffold`||/expand_ir/.test(t)||e===`fs_write`&&/\.ir\.json/.test(t)},{order:2,id:`S2`,label:`设计稿审计`,hit:(e,t)=>/spec_tree|sketch_spec|design_sample|audit_|slice_/.test(t)},{order:1,id:`S1`,label:`输入路由`,hit:e=>e===`card_route_input`}];function RL(e){let t=Math.max(0,Math.round(Number(e||0)/1e3));if(t<60)return`${t} 秒`;let n=Math.floor(t/60);return n<60?`${n} 分 ${t%60} 秒`:`${Math.floor(n/60)} 小时 ${n%60} 分`}function zL(e){let t=Number(e||0);if(!t)return``;let n=new Date(t),r=e=>String(e).padStart(2,`0`);return`${r(n.getHours())}:${r(n.getMinutes())}:${r(n.getSeconds())}`}function BL(e){let t=Number(e||0);return t>0?`+${RL(t)}`:``}function VL(e,t=0){let n=Number(e&&e.startedAt)||0;if(!n)return 0;let r=Number(e&&e.ms)||0;if(r>0)return n+r;let i=Number(t)||0;return i>n?i:0}function HL(e){let t=e&&e.toolName||``,n=IL(e);for(let e of LL)if(e.hit(t,n))return e;return null}var UL=new Set([`card_write`,`card_patch`,`card_scaffold`,`card_add_component`,`fs_write`,`fs_copy`,`card_save`,`card_sync`,`card_slice_upload`]),WL=new Set([`card_read`,`card_list`,`card_node_models`,`card_grep`,`card_history`,`card_validate`,`card_render_status`,`fs_read`,`fs_list`,`skill_read`]);function GL(e){let t=e&&e.toolName||``;return e&&e.error||UL.has(t)||t===`skill_exec`||t===`shell_exec`||t===`card_screenshot`?!0:!WL.has(t)}function KL(e){if(e==null||e===``)return null;if(typeof e==`object`)return e;let t=String(e);try{return JSON.parse(t)}catch{}let n=t.indexOf(`{`),r=t.lastIndexOf(`}`);if(n>=0&&r>n)try{return JSON.parse(t.slice(n,r+1))}catch{return null}return null}function qL(e){let t=IL(e);if(!/--gate|check_fidelity/.test(t))return null;let n=KL(e&&e.result),r=n&&typeof n==`object`?n.gate:null;if(r&&typeof r.passed==`boolean`)return{passed:r.passed,verdict:String(r.verdict||``)};let i=String(e&&e.result||``);if(!/"passed"\s*:/.test(i))return null;let a=/"passed"\s*:\s*(true|false)/.exec(i),o=/"verdict"\s*:\s*"((?:[^"\\]|\\.)*)"/.exec(i);return a?{passed:a[1]===`true`,verdict:o?o[1].replace(/\\n/g,` `):``}:null}var JL=/\s#([^\s#]+)\s*$/;function YL(e){let t=String(e??``),n=JL.exec(t);return n?{text:t.slice(0,n.index).trim(),cid:n[1]}:{text:t,cid:``}}var XL=12;function ZL(e){let t=e&&e.toolName||``,n=KL(e&&e.result);if(!n||typeof n!=`object`)return null;let r=t===`card_validate`?n:n.verify&&n.verify.validate;if(!r||typeof r!=`object`||!Array.isArray(r.errors))return null;let i=Array.isArray(r.warnings)?r.warnings:[],a=[...r.errors.map(e=>({level:`error`,...YL(e)})),...i.map(e=>({level:`warn`,...YL(e)}))].slice(0,XL);return{ok:r.ok!==!1&&r.errors.length===0,errors:r.errors.length,warnings:i.length,issues:a}}function QL(e){let t=Array.isArray(e)?e:[],n=0,r=0,i=0,a=0,o=null,s=null;for(let e of t){e.error&&a++,UL.has(e.toolName)&&(e.error?r++:n++),e.toolName===`card_screenshot`&&!e.error&&i++;let t=ZL(e);t&&(o=t);let c=qL(e);c&&(s=c)}return{total:t.length,writes:n,writeFails:r,shots:i,failed:a,validate:o,gate:s}}var $L={length:`单次输出上限截断:调高「单次输出上限」,或要求 AI 走紧凑 IR 路线(fs_write 写 IR → expand_ir 展开)`,stall:`上游长时间静默:多为网关 / 网络抖动。上下文与已落盘产物都在,重试本轮即可接着做`,empty:`网关连续返回空响应:重试本轮,或检查网关额度 / 换个时间段`,context:`上下文超出网关窗口:后端已自动压缩重试仍失败,建议新开一轮或清理对话记录`,network:`连不上网关:检查网络与 Base URL 后重试本轮`,"rate-limit":`网关限流或额度不足:稍后重试,或换一个 API Key`,auth:`API Key 无效或权限不足:到设置里更新 Key 再重试`,"wrap-failed":`熔断收尾的进度汇总也没拿到:上下文已保留,回复「继续」接着做`,aborted:`本轮已中止:已执行的写入都保留,可从中断处继续`,unknown:`未归类的失败:复制错误原文排查,或换个说法重试本轮`};function eR(e){return{hint:$L[e]||``,action:e===`length`||e===`auth`?`settings`:e===`wrap-failed`||e===`aborted`?`continue`:`retry`}}var tR=/^\s*(\d+)\.\s+(.+?)\s+\((\d+x\d+|\?)\)\s*(.*)$/,nR=/--pick\s+([\d.,~]+)/;function rR(e){if(typeof e!=`string`||!e.includes(`--pick`))return[];let t=[];for(let n of e.split(`
342
- `)){let e=n.match(tR);if(!e)continue;let r=(e[4].match(nR)||[])[1];r&&t.push({no:Number(e[1]),name:e[2].trim(),size:e[3],pick:r})}return t}var iR=/^(\d+)\.(\d+)~(\d+)\.(\d+)$/,aR=/^\d+\.\d+$/;function oR(e){let t=[];for(let n of e||[]){if(!n||!n.pick)continue;let e=String(n.pick),r=e.match(iR),i=r?Number(r[2]):0,a=r?Number(r[4]):0;if(r&&r[1]===r[3]&&a>i){for(let e=i;e<=a;e+=1)t.push({...n,pick:`${r[1]}.${e}`,token:`${r[1]}.${e}`,kind:`card`});t.push({...n,token:`全 ${a-i+1} 张`,kind:`all`})}else t.push({...n,token:e,kind:aR.test(e)?`card`:`board`})}return t}function sR(e){let t=Array.isArray(e)?e:[];for(let e=t.length-1;e>=0;--e){let n=t[e]&&t[e].toolCalls;if(Array.isArray(n)){for(let e=n.length-1;e>=0;--e)if(n[e]&&rR(n[e].result).length)return n[e]}}return null}function cR(e,t=``){if(!e||!e.pick)return``;let n=e.name?`「${e.name}」`:``,r=e.kind===`card`||aR.test(String(e.pick))?`(只建这一张卡,同画板的其它卡不要一起建)`:``,i=t?`落点卡 = 当前卡 ${t}(覆盖它,不是新建;要另建新卡我会直说)。`:``;return`建卡:画板 ${e.no}${n}。${i}参数已选好,照抄重跑:parse_meaxure.py --build --pick ${e.pick}${r}`}var lR={name:`ChatToolRow`,components:{MarkdownBody:NL},props:{tc:{type:Object,required:!0},turnTs:{type:Number,default:0},nowTs:{type:Number,default:0},pickOwner:{type:Object,default:null}},emits:[`approval`,`pick-board`],data(){return{opened:null}},computed:{state(){return this.tc.error?`error`:this.tc.result!==void 0&&this.tc.result!==null?`done`:this.tc.pending?`pending`:`running`},open(){return this.opened===null?!!this.tc.error||this.boardPicks.length>0:this.opened},boardPicks(){return this.pickOwner&&this.tc!==this.pickOwner?[]:oR(rR(this.tc.result))},msText(){let e=this.tc.ms;return e?e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`:``},stampText(){return zL(this.tc.startedAt)},cumText(){let e=VL(this.tc,this.nowTs);return e&&this.turnTs?BL(e-this.turnTs):``},clockText(){return[this.stampText,this.cumText].filter(Boolean).join(` · `)},clockTitle(){let e=[];return this.stampText&&e.push(`开始于 ${this.stampText}`),this.cumText&&e.push(`距本轮开始 ${this.cumText.slice(1)}`),this.msText&&e.push(`本步耗时 ${this.msText}`),e.join(` · `)},approvalCommand(){if(this.tc.command)return String(this.tc.command);let e=this.tc.args||{};return typeof e.command==`string`&&e.command?e.command:this.tc.toolName===`skill_exec`?[e.script,Array.isArray(e.args)?e.args.join(` `):``].filter(Boolean).join(` `):JSON.stringify(e)},argSummary(){if(this.tc.toolName===`skill_exec`&&this.tc.args?.script){let e=[String(this.tc.args.script).replace(/^skills\//,``),(Array.isArray(this.tc.args.args)?this.tc.args.args:[]).map(e=>String(e).replace(/^\/[^\s]{20,}$/,e=>`…/${e.slice(-14)}`)).join(` `)].filter(Boolean).join(` `);return e.length>96?`${e.slice(0,96)}…`:e}let e=this.tc.args||{},t=[];for(let[n,r]of Object.entries(e)){if(r==null||r===``)continue;let e=typeof r==`object`?JSON.stringify(r):String(r);if(t.push(`${n}=${e.length>28?`${e.slice(0,28)}…`:e}`),t.join(` `).length>56)break}let n=t.join(` `);return n.length>72?`${n.slice(0,72)}…`:n},argsSource(){let e=this.tc.args||{};if(!Object.keys(e).length)return``;if(this.tc.toolName===`skill_exec`&&typeof e.script==`string`){if(!this.tc.error)return``;let t=Array.isArray(e.args)?e.args.join(` `):``;return`\`\`\`\n${[e.script,t].filter(Boolean).join(` `)}\n\`\`\``}if(this.tc.toolName===`shell_exec`&&typeof e.command==`string`)return this.tc.error?`\`\`\`\n${e.command}\n\`\`\``:``;let t=``;try{t=JSON.stringify(e,null,2)}catch{t=String(e)}return`\`\`\`json\n${t}\n\`\`\``},resultSource(){let e=this.tc.result;if(e==null||e===``||this.boardPicks.length&&!this.tc.error)return``;let t=typeof e==`string`?e:JSON.stringify(e);try{t=JSON.stringify(JSON.parse(t),null,2)}catch{}t.length>4e3&&(t=`${t.slice(0,4e3)}\n…(已截断)`);let n=`\`\`\`json\n${t}\n\`\`\``;return this.tc.truncated?`${n}\n\n> 结果过长,面板只显示前 4000 字;喂给模型的上下文另有额度,不受此限。`:n}},methods:{toolLabel:FL,toggle(){this.opened=!this.open}}},uR=[`aria-expanded`],dR={key:0,class:`aitool__spin`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},fR={key:1,class:`aitool__status`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},pR={key:2,class:`aitool__status`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},mR={class:`aitool__name`},hR={class:`aitool__args`},gR=[`title`],_R=[`title`],vR={key:0,class:`aitool__approve`},yR=[`title`],bR={class:`aitool__approve-hint`},xR={class:`aitool__approve-hint`},SR=[`title`],CR={class:`aitool__body`},wR={key:0,class:`aitool__picks`},TR=[`title`,`aria-label`,`onClick`],ER={class:`aitool__pick-no`},DR={class:`aitool__pick-arg`},OR=[`src`],kR={key:3,class:`aitool__error`};function AR(e,t,n,r,i,a){let o=R(`MarkdownBody`);return V(),H(B,null,[q(` 单次工具调用:一行摘要,可展开看参数 / 结果 / 截图。
337
+ `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${JP(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,text:n,tokens:r,autolink:i}){let a=i?JP(n,!0):this.parser.parseInline(r),o=XP(e);if(o===null)return a;e=JP(o,i);let s=`<a href="`+e+`"`;return t&&(s+=` title="`+JP(t)+`"`),s+=`>`+a+`</a>`,s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=XP(e);if(i===null)return JP(n);e=i;let a=`<img src="${JP(e)}" alt="${JP(n)}"`;return t&&(a+=` title="${JP(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:JP(e.text)}},lF=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},uF=class e{options;renderer;textRenderer;constructor(e){this.options=e||wN,this.options.renderer=this.options.renderer||new cF,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new lF}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},dF=class{options;block;constructor(e){this.options=e||wN}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?sF.lex:sF.lexInline}provideParser(e=this.block){return e?uF.parse:uF.parseInline}};function fF(e,t){if(Array.isArray(t))for(let n=0;n<t.length;n++)e.push(t[n]);else e.push(t)}var pF=new class{defaults=CN();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=uF;Renderer=cF;TextRenderer=lF;Lexer=sF;Tokenizer=oF;Hooks=dF;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(fF(n,t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)fF(n,this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)fF(n,this.walkTokens(e.tokens,t));break}case`list`:{let e=r;fF(n,this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);fF(n,this.walkTokens(i,t))}):e.tokens&&fF(n,this.walkTokens(e.tokens,t))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new cF(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new oF(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new dF;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=dF.passThroughHooks.has(n)?e=>{if(this.defaults.async&&dF.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&fF(n,t.call(this,e)),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return sF.lex(e,t??this.defaults)}parser(e,t){return uF.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?sF.lex:sF.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?uF.parse:uF.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?sF.lex:sF.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?uF.parse:uF.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
338
+ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+JP(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function mF(e,t){return pF.parse(e,t)}mF.options=mF.setOptions=function(e){return pF.setOptions(e),mF.defaults=pF.defaults,TN(mF.defaults),mF},mF.getDefaults=CN,mF.defaults=wN;function hF(...e){return pF.use(...e),mF.defaults=pF.defaults,TN(mF.defaults),mF}mF.use=hF,mF.walkTokens=function(e,t){return pF.walkTokens(e,t)},mF.parseInline=pF.parseInline,mF.Parser=uF,mF.parser=uF.parse,mF.Renderer=cF,mF.TextRenderer=lF,mF.Lexer=sF,mF.lexer=sF.lex,mF.Tokenizer=oF,mF.Hooks=dF,mF.parse=mF,mF.options,mF.setOptions,mF.walkTokens,mF.parseInline,uF.parse,sF.lex;function gF(e,t){this.v=e,this.k=t}function _F(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function vF(e){if(Array.isArray(e))return e}function yF(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function bF(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
339
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xF(e,t){return vF(e)||yF(e,t)||SF(e,t)||bF()}function SF(e,t){if(e){if(typeof e==`string`)return _F(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_F(e,t):void 0}}function CF(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof gF;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`&&o.k?t:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(!!a.done,n)},function(e){r(`throw`,e)})}catch(e){i(2,e)}}function i(e,i){e===2?t.reject(i):t.resolve({value:i,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}CF.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},CF.prototype.next=function(e){return this._invoke(`next`,e)},CF.prototype.throw=function(e){return this._invoke(`throw`,e)},CF.prototype.return=function(e){return this._invoke(`return`,e)};var wF=Object.entries,TF=Object.setPrototypeOf,EF=Object.isFrozen,DF=Object.getPrototypeOf,OF=Object.getOwnPropertyDescriptor,kF=Object.freeze,AF=Object.seal,jF=Object.create,MF=typeof Reflect<`u`&&Reflect,NF=MF.apply,PF=MF.construct;kF||=function(e){return e},AF||=function(e){return e},NF||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},PF||=function(e){return new e(...[...arguments].slice(1))};var FF=aI(Array.prototype.forEach);Array.prototype.indexOf;var IF=aI(Array.prototype.lastIndexOf),LF=aI(Array.prototype.pop),RF=aI(Array.prototype.push),zF=aI(Array.prototype.slice),BF=aI(Array.prototype.splice),VF=Array.isArray,HF=oI(Set),UF=aI(Set.prototype.add),WF=aI(Set.prototype.has),GF=aI(String.prototype.toLowerCase),KF=aI(String.prototype.toString),qF=aI(String.prototype.match),JF=aI(String.prototype.replace),YF=aI(String.prototype.indexOf),XF=aI(String.prototype.trim),ZF=aI(Number.prototype.toString),QF=aI(Boolean.prototype.toString),$F=typeof BigInt>`u`?null:aI(BigInt.prototype.toString),eI=typeof Symbol>`u`?null:aI(Symbol.prototype.toString),tI=aI(Object.prototype.hasOwnProperty),nI=aI(Object.prototype.toString),rI=aI(RegExp.prototype.test),iI=oI(TypeError);function aI(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return NF(e,t,n)}}function oI(e){return function(){return PF(e,[...arguments])}}function sI(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:GF;if(TF&&TF(e,null),!VF(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(EF(t)||(t[r]=e),i=e)}e[i]=!0}return e}function cI(e){for(let t=0;t<e.length;t++)tI(e,t)||(e[t]=null);return e}function lI(e){let t=jF(null);for(let r of wF(e)){var n=xF(r,2);let i=n[0],a=n[1];tI(e,i)&&(t[i]=VF(a)?cI(a):a&&typeof a==`object`&&a.constructor===Object?lI(a):a)}return t}function uI(e){switch(typeof e){case`string`:return e;case`number`:return ZF(e);case`boolean`:return QF(e);case`bigint`:return $F?$F(e):`0`;case`symbol`:return eI?eI(e):`Symbol()`;case`undefined`:return nI(e);case`function`:case`object`:{if(e===null)return nI(e);let t=e,n=dI(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:nI(e)}return nI(e)}default:return nI(e)}}function dI(e,t){for(;e!==null;){let n=OF(e,t);if(n){if(n.get)return aI(n.get);if(typeof n.value==`function`)return aI(n.value)}e=DF(e)}function n(){return null}return n}function fI(e,t){for(;e!==null;){let n=OF(e,t);if(n)return n.get?aI(n.get):null;e=DF(e)}return null}function pI(e){try{return rI(e,``),!0}catch{return!1}}var mI=kF(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),hI=kF(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),gI=kF([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),_I=kF([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),vI=kF(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),yI=kF([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),bI=kF([`#text`]),xI=kF(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),SI=kF(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),CI=kF(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),wI=kF([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),TI=AF(/{{[\w\W]*|^[\w\W]*}}/g),EI=AF(/<%[\w\W]*|^[\w\W]*%>/g),DI=AF(/\${[\w\W]*/g),OI=AF(/^data-[\-\w.\u00B7-\uFFFF]+$/),kI=AF(/^aria-[\-\w]+$/),AI=AF(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),jI=AF(/^(?:\w+script|data):/i),MI=AF(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),NI=AF(/^html$/i),PI=AF(/^[a-z][.\w]*(-[.\w]+)+$/i),FI=AF(/<[/\w!]/g),II=AF(/<[/\w]/g),LI=AF(/<\/no(script|embed|frames)/i),RI=AF(/\/>/i),zI={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},BI=kF(sI({},[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`])),VI=function(){return typeof window>`u`?null:window},HI=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},UI=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},WI=function(e,t,n,r){return tI(e,t)&&VF(e[t])?sI(r.base?lI(r.base):{},e[t],r.transform):n},GI=function(e,t,n){let r=tI(e,t)?e[t]:void 0;return r&&typeof r==`object`?lI(r):n()};function KI(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:VI(),t=e=>KI(e);if(t.version=`3.4.17`,t.removed=[],!e||!e.document||e.document.nodeType!==zI.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=dI(d,`cloneNode`),p=dI(d,`remove`),m=dI(d,`removeAttributeNode`),h=dI(d,`nextSibling`),g=dI(d,`childNodes`),_=dI(d,`parentNode`),v=dI(d,`shadowRoot`),y=dI(d,`attributes`),b=o&&o.prototype?dI(o.prototype,`nodeType`):null,x=o&&o.prototype?dI(o.prototype,`nodeName`):null,S=o&&o.prototype?dI(o.prototype,`ownerDocument`):null,C=function(e){return b?b(e):e.nodeType},w=function(e){return x?x(e):e.nodeName},ee=fI(d,`namespaceURI`),T=function(e){return ee?ee(e):e.namespaceURI};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let E,D=``,O,te=!1,ne=0,re=function(){if(ne>0)throw iI(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},ie=function(e){re(),ne++;try{return E.createHTML(e)}finally{ne--}},ae=function(e){re(),ne++;try{return E.createScriptURL(e)}finally{ne--}},oe=function(){return te||=(O=HI(u,i),!0),O},se=n,ce=se.implementation,le=se.createNodeIterator,ue=se.createDocumentFragment,de=se.getElementsByTagName,fe=r.importNode,k=UI();t.isSupported=typeof wF==`function`&&typeof _==`function`&&ce&&ce.createHTMLDocument!==void 0;let pe=TI,me=EI,he=DI,ge=OI,_e=kI,ve=jI,ye=MI,be=PI,xe=AI,A=null,Se=sI({},[...mI,...hI,...gI,...vI,...bI]),Ce=null,we=sI({},[...xI,...SI,...CI,...wI]),Te=Object.seal(jF(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ee=null,j=null,De=Object.seal(jF(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Oe=!0,ke=!0,Ae=!1,je=!0,Me=!1,Ne=!0,Pe=!1,Fe=!1,Ie=null,Le=null,Re=!1,ze=!1,Be=!1,Ve=!1,M=!0,He=!1,Ue=`user-content-`,We=!0,Ge=!1,Ke=null,qe={},Je=null,Ye=sI({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),Xe=null,Ze=sI({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Qe=null,$e=sI({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),et=`http://www.w3.org/1998/Math/MathML`,tt=`http://www.w3.org/2000/svg`,nt=`http://www.w3.org/1999/xhtml`,rt=nt,it=!1,at=null,ot=sI({},[et,tt,nt],KF),st=kF([`mi`,`mo`,`mn`,`ms`,`mtext`]),ct=sI({},st),lt=kF([`annotation-xml`]),ut=sI({},lt),dt=sI({},[`title`,`style`,`font`,`a`,`script`]),ft=null,pt=[`application/xhtml+xml`,`text/html`],mt=null,ht=null,gt=n.createElement(`form`),_t=function(e){return e instanceof RegExp||e instanceof Function},vt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(ht&&ht===e)return;(!e||typeof e!=`object`)&&(e={}),e=lI(e),ft=pt.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,mt=ft===`application/xhtml+xml`?KF:GF,A=WI(e,`ALLOWED_TAGS`,Se,{transform:mt}),Ce=WI(e,`ALLOWED_ATTR`,we,{transform:mt}),at=WI(e,`ALLOWED_NAMESPACES`,ot,{transform:KF}),Qe=WI(e,`ADD_URI_SAFE_ATTR`,$e,{transform:mt,base:$e}),Xe=WI(e,`ADD_DATA_URI_TAGS`,Ze,{transform:mt,base:Ze}),Je=WI(e,`FORBID_CONTENTS`,Ye,{transform:mt}),Ee=WI(e,`FORBID_TAGS`,lI({}),{transform:mt}),j=WI(e,`FORBID_ATTR`,lI({}),{transform:mt}),qe=tI(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?lI(e.USE_PROFILES):e.USE_PROFILES:!1,Oe=e.ALLOW_ARIA_ATTR!==!1,ke=e.ALLOW_DATA_ATTR!==!1,Ae=e.ALLOW_UNKNOWN_PROTOCOLS||!1,je=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Me=e.SAFE_FOR_TEMPLATES||!1,Ne=e.SAFE_FOR_XML!==!1,Pe=e.WHOLE_DOCUMENT||!1,ze=e.RETURN_DOM||!1,Be=e.RETURN_DOM_FRAGMENT||!1,Ve=e.RETURN_TRUSTED_TYPE||!1,Re=e.FORCE_BODY||!1,M=e.SANITIZE_DOM!==!1,He=e.SANITIZE_NAMED_PROPS||!1,We=e.KEEP_CONTENT!==!1,Ge=e.IN_PLACE||!1,xe=pI(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:AI,rt=typeof e.NAMESPACE==`string`?e.NAMESPACE:nt,ct=GI(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>sI({},st)),ut=GI(e,`HTML_INTEGRATION_POINTS`,()=>sI({},lt));let t=GI(e,`CUSTOM_ELEMENT_HANDLING`,()=>jF(null));if(Te=jF(null),tI(t,`tagNameCheck`)&&_t(t.tagNameCheck)&&(Te.tagNameCheck=t.tagNameCheck),tI(t,`attributeNameCheck`)&&_t(t.attributeNameCheck)&&(Te.attributeNameCheck=t.attributeNameCheck),tI(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(Te.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),AF(Te),Me&&(ke=!1),Be&&(ze=!0),qe&&(A=sI({},bI),Ce=jF(null),qe.html===!0&&(sI(A,mI),sI(Ce,xI)),qe.svg===!0&&(sI(A,hI),sI(Ce,SI),sI(Ce,wI)),qe.svgFilters===!0&&(sI(A,gI),sI(Ce,SI),sI(Ce,wI)),qe.mathMl===!0&&(sI(A,vI),sI(Ce,CI),sI(Ce,wI))),De.tagCheck=null,De.attributeCheck=null,tI(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?De.tagCheck=e.ADD_TAGS:VF(e.ADD_TAGS)&&(A===Se&&(A=lI(A)),sI(A,e.ADD_TAGS,mt))),tI(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?De.attributeCheck=e.ADD_ATTR:VF(e.ADD_ATTR)&&(Ce===we&&(Ce=lI(Ce)),sI(Ce,e.ADD_ATTR,mt))),tI(e,`ADD_FORBID_CONTENTS`)&&VF(e.ADD_FORBID_CONTENTS)&&(Je===Ye&&(Je=lI(Je)),sI(Je,e.ADD_FORBID_CONTENTS,mt)),We&&(A[`#text`]=!0),Pe&&sI(A,[`html`,`head`,`body`]),A.table&&(sI(A,[`tbody`]),delete Ee.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw iI(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw iI(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=E;E=e.TRUSTED_TYPES_POLICY;try{D=ie(``)}catch(e){throw E=t,e}}else e.TRUSTED_TYPES_POLICY===null?(E=void 0,D=``):(E===void 0&&(E=oe()),E&&typeof D==`string`&&(D=ie(``)));kF&&kF(e),ht=e},yt=sI({},[...hI,...gI,..._I]),bt=sI({},[...vI,...yI]),xt=function(e,t,n){return t.namespaceURI===nt?e===`svg`:t.namespaceURI===et?e===`svg`&&(n===`annotation-xml`||ct[n]):!!yt[e]},St=function(e,t,n){return t.namespaceURI===nt?e===`math`:t.namespaceURI===tt?e===`math`&&ut[n]:!!bt[e]},Ct=function(e,t,n){return t.namespaceURI===tt&&!ut[n]||t.namespaceURI===et&&!ct[n]?!1:!bt[e]&&(dt[e]||!yt[e])},wt=function(e){let t=T(e),n=GF(w(e)),r=_(e),i,a;return r&&C(r)===zI.element?(i={namespaceURI:T(r)},a=GF(w(r))):(i={namespaceURI:rt},a=`template`),at[t]?t===tt?xt(n,i,a):t===et?St(n,i,a):t===nt?Ct(n,i,a):!!(ft===`application/xhtml+xml`&&at[t]):!1},Tt=function(e){RF(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(p(e),!_(e))throw iI(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},Et=function(e,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},Dt=function(e){jt(e);let t=g(e);t&&FF(zF(t),e=>{try{p(e)}catch{}});let n=C(e)===zI.element?y(e):null;if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&Et(e,r,i)}},Ot=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}RF(t.removed,{attribute:r||null,from:n});try{r?m(n,r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`){if(ze||Be)try{Tt(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},kt=function(e){let t=y(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||Ce[mt(i)]||Et(e,r,i)}},At=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0&&arguments[2],r=[e];for(;r.length>0;){let e=r.pop();if(t(e)===!1)continue;if(n&&C(e)===zI.element){let t=v(e);Kt(t)&&r.push(t)}let i=g(e);if(i)for(let e=i.length-1;e>=0;--e)r.push(i[e])}},jt=function(e){At(e,e=>{C(e)===zI.element&&kt(e)})},Mt=function(e){let t=[];return At(e,e=>{t.push(e)},!0),t},Nt=function(e,t){let n=HF();FF(Mt(e),e=>{C(e)===zI.element&&UF(n,e)}),FF(t,e=>{C(e)===zI.element&&!WF(n,e)&&kt(e)})},Pt=function(e,n){let r=!1;return FF(t.removed,t=>{t.element&&(r||=t.element===e,jt(t.element))}),Nt(e,n),r},Ft=function(e,t){let n=Ke,r=null,i=()=>(r||(r=HF(),FF(t,e=>{UF(r,e)})),r);for(let t=0;;t++){let r=Mt(e),a=[e],o=!1;if(FF(r,e=>{C(e)===zI.documentFragment?RF(a,e):!o&&!WF(n,e)&&(o=WF(i(),e))}),!o)return;if(t>=8)throw iI(`the tree kept changing during in-place sanitization; refusing to return it`);FF(a,(t,n)=>{It(t,n>0,e,i())})}},It=function(e,t,n,r){let i=Vt(e),a;for(;a=i.nextNode();)WF(r,a)&&!WF(Ke,a)&&(t&&Jt(k.uponSanitizeShadowNode,a,null),en(a,n),cn(a,n),Kt(a.content)&&ln(a.content))},Lt=function(e){Ke&&UF(Ke,e)},Rt=function(e,t){return Ne?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},zt=function(e){Ne&&At(e,e=>{let t=C(e);if(t===zI.processingInstruction||t===zI.comment&&rI(II,e.data)){try{p(e)}catch{}return!1}if(t===zI.element){let t=e,n=mt(w(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&Rt(`for`,n)&&t.removeAttribute(`for`)}catch{}}return!0})},Bt=function(e){let t=null,r=null;if(Re)e=`<remove></remove>`+e;else{let t=qF(e,/^[\r\n\t ]+/);r=t&&t[0]}ft===`application/xhtml+xml`&&rt===nt&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=E?ie(e):e;if(rt===nt)try{t=new l().parseFromString(i,ft)}catch{}if(!t||!t.documentElement){t=ce.createDocument(rt,`template`,null);try{t.documentElement.innerHTML=it?D:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),rt===nt?de.call(t,Pe?`html`:`body`)[0]:Pe?t.documentElement:a},Vt=function(e){let t=S?S(e):e.ownerDocument;return le.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Ht=function(e){return e=JF(e,pe,` `),e=JF(e,me,` `),e=JF(e,he,` `),e},Ut=function(e){Wt(e);let t=e.querySelectorAll?.call(e,`template`);t&&FF(t,e=>{Kt(e.content)&&Ut(e.content)})},Wt=function(e){e.normalize();let t=S?S(e):e.ownerDocument,n=le.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=Ht(r.data),r=n.nextNode()},Gt=function(e){let t=x?x(e):null;return typeof t!=`string`||mt(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==y(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==b(e)||e.childNodes!==g(e)},Kt=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return b(e)===zI.documentFragment}catch{return!1}},qt=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return typeof b(e)==`number`}catch{return!1}};function Jt(e,n,r){e.length!==0&&FF(e,e=>{e.call(t,n,r,ht)})}let Yt=function(e,t){return!!(Ne&&e.hasChildNodes()&&!qt(e.firstElementChild)&&rI(FI,e.textContent)&&rI(FI,e.innerHTML)||Ne&&BI[t]&&C(e)===zI.element&&T(e)===nt&&(qt(e.firstElementChild)||typeof e.textContent==`string`&&rI(FI,e.textContent))||e.nodeType===zI.processingInstruction||Ne&&e.nodeType===zI.comment&&rI(II,e.data))},Xt=function(e,t){return e instanceof RegExp?rI(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},Zt=function(e,t,n){if(!Ee[t]&&rn(t)&&Xt(Te.tagNameCheck,t))return!1;if(We&&!Je[t]&&!Je[GF(t)]){let t=_(e),r=g(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,h(e))}}}return Tt(e),!0},Qt=function(e,t,n,r){return e.length===0?t:t===n||t===r?lI(t):t},$t=function(e,t){return e===t||_(e)!==null?!1:(Ge&&jt(e),!0)},en=function(e,n){if(Lt(e),Jt(k.beforeSanitizeElements,e,null),$t(e,n))return!0;if(Gt(e))return Tt(e),!0;let r=mt(w(e));if(A=Qt(k.uponSanitizeElement,A,Se,Ie),Jt(k.uponSanitizeElement,e,{tagName:r,allowedTags:A}),$t(e,n))return!0;if(Yt(e,r))return Tt(e),!0;if(Ee[r]||!(De.tagCheck instanceof Function&&De.tagCheck(r))&&!A[r]){let t=Zt(e,r,n);return t===!1&&(Jt(k.afterSanitizeElements,e,null),$t(e,n))?!0:t}if(C(e)===zI.element&&!wt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&rI(LI,e.innerHTML))return Tt(e),!0;if(Me&&e.nodeType===zI.text){let n=Ht(e.textContent);e.textContent!==n&&(RF(t.removed,{element:e.cloneNode()}),e.textContent=n)}return Jt(k.afterSanitizeElements,e,null),$t(e,n)},tn=function(e,t,r){if(j[t]||Rt(t,e)||M&&(t===`id`||t===`name`)&&(r in n||r in gt))return!1;let i=Ce[t]||De.attributeCheck instanceof Function&&De.attributeCheck(t,e);return ke&&rI(ge,t)||Oe&&rI(_e,t)?!0:i?Qe[t]||rI(xe,JF(r,ye,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&YF(r,`data:`)===0&&Xe[e]||Ae&&!rI(ve,JF(r,ye,``))?!0:!r:rn(e)&&Xt(Te.tagNameCheck,e)&&Xt(Te.attributeNameCheck,t,e)||t===`is`&&Te.allowCustomizedBuiltInElements&&Xt(Te.tagNameCheck,r)},nn=sI({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),rn=function(e){return!nn[GF(e)]&&rI(be,e)},an=function(e,t,n,r){if(E&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return ie(r);case`TrustedScriptURL`:return ae(r)}return r},on=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!Gt(e)||(Tt(e),!1)}catch{return Ot(t,e),!1}},sn=function(e,t){return Ne&&rI(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,t)?!0:GF(e)===`attributename`&&qF(t,`href`)!==null},cn=function(e,n){if(Jt(k.beforeSanitizeAttributes,e,null),$t(e,n))return;let r=e.attributes;if(!r||Gt(e))return;Ce=Qt(k.uponSanitizeAttribute,Ce,we,Le);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:Ce,forceKeepAttr:void 0},a=r.length,o=mt(e.nodeName);for(;a--;){let n=r[a],s=n.name,c=n.namespaceURI,l=n.value,u=mt(s),d=l,f=s===`value`?d:XF(d),p=!1;i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,Jt(k.uponSanitizeAttribute,e,i),f=i.attrValue,He&&(u===`id`||u===`name`)&&YF(f,Ue)!==0&&(Ot(s,e,n),f=Ue+f,p=!0),sn(s,f)?Ot(s,e,n):i.forceKeepAttr||(i.keepAttr?!je&&rI(RI,f)?Ot(s,e,n):(Me&&(f=Ht(f)),tn(o,u,f)?(f=an(o,u,c,f),f!==d&&on(e,s,c,f)&&p&&LF(t.removed)):Ot(s,e,n)):Ot(s,e,n))}Jt(k.afterSanitizeAttributes,e,null),$t(e,n)},ln=function(e){let t=null,n=Vt(e);for(Jt(k.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(Jt(k.uponSanitizeShadowNode,t,null),en(t,e),cn(t,e),Kt(t.content)&&ln(t.content),C(t)===zI.element){let e=v(t);Kt(e)&&(un(e),ln(e))}Me&&Wt(e),Jt(k.afterSanitizeShadowDOM,e,null)},un=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){ln(e.shadow);continue}let n=e.node,r=C(n)===zI.element,i=g(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=x?x(n):null;if(typeof e==`string`&&mt(e)===`template`){let e=n.content;Kt(e)&&t.push({node:e,shadow:null})}}if(r){let e=v(n);Kt(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(it=!e,it&&(e=`<!-->`),typeof e!=`string`&&!qt(e)&&(e=uI(e),typeof e!=`string`))throw iI(`dirty is not a string, aborting`);if(!t.isSupported)return e;Fe?(A=Ie,Ce=Le):vt(n),(k.uponSanitizeElement.length>0||k.uponSanitizeAttribute.length>0)&&(A=lI(A)),k.uponSanitizeAttribute.length>0&&(Ce=lI(Ce)),t.removed=[];let c=Ge&&typeof e!=`string`&&qt(e),l=[],u=Ke;if(c){zt(e);let t=w(e);if(typeof t==`string`){let n=mt(t);if(!A[n]||Ee[n])throw Dt(e),iI(`root node is forbidden and cannot be sanitized in-place`)}if(Gt(e))throw Dt(e),iI(`root node is clobbered and cannot be sanitized in-place`);l=Mt(e),Ke=HF()}else if(qt(e))i=Bt(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===zI.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),un(i);else{if(!ze&&!Me&&!Pe&&e.indexOf(`<`)===-1)return E&&Ve?ie(e):e;if(i=Bt(e),!i)return ze?null:Ve?D:``}i&&Re&&Tt(i.firstChild);let d=c?e:i;try{c&&un(e);let t=Vt(d);for(;o=t.nextNode();)en(o,d),cn(o,d),Kt(o.content)&&ln(o.content);c&&Ft(e,l)}catch(t){throw c&&(Dt(e),Pt(e,l)),t}finally{Ke=u}if(c){if(Pt(e,l))throw iI(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return Me&&Ut(e),e}if(ze){if(Me&&Ut(i),Be)for(s=ue.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(Ce.shadowroot||Ce.shadowrootmode)&&(s=fe.call(r,s,!0)),s}let f=Pe?i.outerHTML:i.innerHTML;return Pe&&A[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&rI(NI,i.ownerDocument.doctype.name)&&(f=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
340
+ `+f),Me&&(f=Ht(f)),E&&Ve?ie(f):f},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};vt(e),Fe=!0,Ie=A,Le=Ce},t.clearConfig=function(){ht=null,Fe=!1,Ie=null,Le=null,E=O,D=``},t.isValidAttribute=function(e,t,n){ht||vt({});let r=mt(e),i=mt(t);return typeof n==`string`&&(sn(t,n)||!je&&rI(RI,n))?!1:tn(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&tI(k,e)&&RF(k[e],t)},t.removeHook=function(e,t){if(tI(k,e)){if(t!==void 0){let n=IF(k[e],t);return n===-1?void 0:BF(k[e],n,1)[0]}return LF(k[e])}},t.removeHooks=function(e){tI(k,e)&&(k[e]=[])},t.removeAllHooks=function(){k=UI()},t}var qI=KI(),JI=`png|jpe?g|gif|webp|bmp|svg|avif|ico|tiff?`,YI=`(?:file:\\/\\/(?:(?:localhost)?\\/(?=[^\\s])|[A-Za-z]:[\\\\/]|[^\\/\\s:]+\\/)|\\/(?!\\/)(?!\\s)|[A-Za-z]:[\\\\/](?!\\s)|\\\\\\\\[^\\\\/\\s]+[\\\\/](?!\\s))`,XI=`(?:(?:图|图片|预览图|预览|截图|设计稿|整图|效果图|封面|原图|缩略图|路径|image|img|preview|screenshot|pic|photo|file|path)\\s*[::]\\s*)?`,ZI=RegExp(`^(\\s*(?:[-*+]\\s+|\\d+[.)]\\s+)?)(?:(?:图|图片|预览图|预览|截图|设计稿|整图|效果图|封面|原图|缩略图|路径|image|img|preview|screenshot|pic|photo|file|path)\\s*[::]\\s*)?(${YI}.+?\\.(?:${JI}))\\s*$`,`i`),QI=RegExp(`(^|[\\s(「『【>])(${YI}[^\`"'<>()\\[\\]{}\\s()「」『』【】,。;、!?:…·]+?\\.(?:${JI}))(?=$|[\\s))」』】.,;:!?,。;、!?])`,`gi`),$I=/^\s*(?:```|~~~)/,eL=RegExp(`\\.(?:${JI})`,`i`);function tL(e){return ZI.test(e)||uL.test(e)||e.match(mL)!=null||e.match(hL)!=null}function nL(e){let t=[];for(let n=0;n<e.length;){if(!$I.test(e[n])){t.push(e[n]),n++;continue}let r=n+1;for(;r<e.length&&!$I.test(e[r]);)r++;let i=e.slice(n+1,r);i.filter(tL).length>=2?(t.push(...i),n=r<e.length?r+1:e.length):(t.push(e[n]),n++)}return t}var rL=/^\/(?:slices|assets|icons|favicon|__)(?:[/.]|$)/i,iL=e=>rL.test(String(e)),aL=e=>/[*{}]/.test(String(e)),oL=e=>iL(e)||aL(e),sL=/^(?:…|\.{3,})[\\/]/,cL=`(?:…|\\.{3,})[\\\\/][^\\s\`"'<>()「」『』【】,。;、!?:…]+?\\.(?:${JI})`,lL=RegExp(`(^|[\\s(「『【>→::])(\`?)(${cL})(\`?)`,`gi`),uL=RegExp(`^(\\s*(?:[-*+]\\s+|\\d+[.)]\\s+)?)${XI}(${cL})\\s*$`,`i`);function dL(e,t){let n=String(e).replace(sL,``).replace(/\\/g,`/`);if(aL(n))return null;let r=`/${n.replace(/^\/+/,``)}`;return iL(r)?`![${gL(r)}](${yL(r)} "${vL(e)}")`:wL(e,t)}var fL=/!\[([^\]]*)\]\(\s*(data:[^)]*)\)/gi;function pL(e){let t=String(e??``);return!t||!/!\[[^\]]*\]\(\s*data:/i.test(t)?t:t.replace(fL,(e,t,n)=>{let r=/^data:([^;,]*)((?:;[^,]*)*),([\s\S]*)$/i.exec(n),i=String(t||``).trim()||`未命名`;return r?String(r[3]||``).trim()?e:`\`⚠ 图片缺失:${i}(data URI 载荷为空)\``:`\`⚠ 图片缺失:${i}(data URI 结构异常)\``})}var mL=RegExp(`(!\\[[^\\]]*\\]\\()\\s*(${YI}(?:[^\\s?#()]|\\([^\\s()]*\\))+?\\.(?:${JI}))(?=\\s*(?:"[^"]*"|'[^']*')?\\s*\\))`,`gi`),hL=RegExp(`(!\\[[^\\]]*\\]\\()\\s*([^\\s()/?#\\\\](?:[^\\s?#()]|\\([^\\s()]*\\))*?\\.(?:${JI}))(?=\\s*(?:"[^"]*"|'[^']*')?\\s*\\))`,`gi`);function gL(e){return _L(e).replace(/[[\]!]/g,``).trim().slice(0,120)||`预览图`}function _L(e){let t=String(e??``).trim();if(!t||/^(?:data|blob):/i.test(t))return``;let n=t;try{let e=new URL(t,`http://localhost/`);n=e.searchParams.get(`path`)||e.pathname||t,n=decodeURIComponent(n)}catch{try{n=decodeURIComponent(n)}catch{}}return(n.split(/[\\/]/).pop()||``).trim()}function vL(e){return String(e).replace(/"/g,`'`)}function yL(e){return String(e).replace(/\(/g,`%28`).replace(/\)/g,`%29`).replace(/ /g,`%20`)}function bL(e){let t=String(e);if(!t.includes(`%`))return t;try{return decodeURIComponent(t)}catch{return t}}function xL(e){let t=String(e);if(!/^file:\/\//i.test(t))return t;let n=t.replace(/^file:\/\//i,``),r=/^(?:localhost)?(\/.*)$/i.exec(n);if(r){let e=r[1];return/^\/[A-Za-z]:[\\/]/.test(e)?e.slice(1):e}if(/^[A-Za-z]:[\\/]/.test(n))return n;let i=/^([^\/\s:]+)\/(.*)$/.exec(n);return i?`\\\\${i[1]}\\${i[2].replace(/\//g,`\\`)}`:t}function SL(e,t){let n=xL(bL(e));if(oL(n))return null;let r=``;try{r=t(n)}catch{return null}return r?yL(r):null}function CL(e,t){let n=bL(e).replace(/\\/g,`/`);if(/^[A-Za-z][A-Za-z0-9+.-]*:/.test(n)||n.startsWith(`.`)||n.split(`/`).includes(`..`))return null;let r=``;try{r=t(n)}catch{return null}return r?yL(r):null}function wL(e,t){let n=xL(e);if(oL(n))return null;let r=``;try{r=t(n)}catch{return null}if(!r)return null;let i=yL(r);return`![${gL(n)}](${i} "${vL(n)}")`}function TL(e,t){let n=pL(e);if(!n||typeof t!=`function`||!eL.test(n))return n;let r=!1;return nL(n.split(`
341
+ `)).map(e=>{if($I.test(e))return r=!r,e;if(r||!eL.test(e))return e;let n=e.match(ZI);if(n){let r=wL(n[2],t);return r===null?e:n[1]+r}let i=e.match(uL);if(i){let n=dL(i[2],t);return n===null?e:i[1]+n}return e.replace(mL,(e,n,r)=>n+(SL(r,t)??r)).replace(hL,(e,n,r)=>n+(CL(r,t)??r)).replace(QI,(e,n,r)=>n+(wL(r,t)??r)).replace(lL,(e,n,r,i)=>{let a=dL(i,t);return a===null?e:n+a})}).join(`
342
+ `)}(function(e){var t=`\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b`,n={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:`punctuation`,inside:null},r={bash:n,environment:{pattern:RegExp(`\\$`+t),alias:`constant`},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp(`(\\{)`+t),lookbehind:!0,alias:`constant`}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:`important`},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:`function`},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:`function`}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:`variable`,lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp(`(^|[\\s;|&]|[<>]\\()`+t),lookbehind:!0,alias:`constant`}},alias:`variable`,lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:`variable`,lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:r},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:r},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:r.entity}}],environment:{pattern:RegExp(`\\$?`+t),alias:`constant`},variable:r.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:`class-name`},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:`important`},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:`important`}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=e.languages.bash;for(var i=[`comment`,`function-name`,`for-or-select`,`assign-left`,`parameter`,`string`,`environment`,`function`,`keyword`,`builtin`,`boolean`,`file-descriptor`,`operator`,`punctuation`,`number`],a=r.variable[1].inside,o=0;o<i.length;o++)a[i[o]]=e.languages.bash[i[o]];e.languages.sh=e.languages.bash,e.languages.shell=e.languages.bash})(Prism),(function(e){e.languages.typescript=e.languages.extend(`javascript`,{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript[`literal-property`];var t=e.languages.extend(`typescript`,{});delete t[`class-name`],e.languages.typescript[`class-name`].inside=t,e.languages.insertBefore(`typescript`,`function`,{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:`operator`},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:`class-name`,inside:t}}}}),e.languages.ts=e.languages.typescript})(Prism),(function(e){var t=e.util.clone(e.languages.javascript),n=`(?:\\s|\\/\\/.*(?!.)|\\/\\*(?:[^*]|\\*(?!\\/))\\*\\/)`,r=`(?:\\{(?:\\{(?:\\{[^{}]*\\}|[^{}])*\\}|[^{}])*\\})`,i=`(?:\\{<S>*\\.{3}(?:[^{}]|<BRACES>)*\\})`;function a(e,t){return e=e.replace(/<S>/g,function(){return n}).replace(/<BRACES>/g,function(){return r}).replace(/<SPREAD>/g,function(){return i}),RegExp(e,t)}i=a(i).source,e.languages.jsx=e.languages.extend(`markup`,t),e.languages.jsx.tag.pattern=a(`<\\/?(?:[\\w.:-]+(?:<S>+(?:[\\w.:$-]+(?:=(?:"(?:\\\\[\\s\\S]|[^\\\\"])*"|'(?:\\\\[\\s\\S]|[^\\\\'])*'|[^\\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\\/?)?>`),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside[`attr-value`].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside[`class-name`]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore(`inside`,`attr-name`,{spread:{pattern:a(`<SPREAD>`),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore(`inside`,`special-attr`,{script:{pattern:a(`=<BRACES>`),alias:`language-javascript`,inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:`punctuation`},rest:e.languages.jsx}}},e.languages.jsx.tag);var o=function(e){return e?typeof e==`string`?e:typeof e.content==`string`?e.content:e.content.map(o).join(``):``},s=function(t){for(var n=[],r=0;r<t.length;r++){var i=t[r],a=!1;if(typeof i!=`string`&&(i.type===`tag`&&i.content[0]&&i.content[0].type===`tag`?i.content[0].content[0].content===`</`?n.length>0&&n[n.length-1].tagName===o(i.content[0].content[1])&&n.pop():i.content[i.content.length-1].content===`/>`||n.push({tagName:o(i.content[0].content[1]),openedBraces:0}):n.length>0&&i.type===`punctuation`&&i.content===`{`?n[n.length-1].openedBraces++:n.length>0&&n[n.length-1].openedBraces>0&&i.type===`punctuation`&&i.content===`}`?n[n.length-1].openedBraces--:a=!0),(a||typeof i==`string`)&&n.length>0&&n[n.length-1].openedBraces===0){var c=o(i);r<t.length-1&&(typeof t[r+1]==`string`||t[r+1].type===`plain-text`)&&(c+=o(t[r+1]),t.splice(r+1,1)),r>0&&(typeof t[r-1]==`string`||t[r-1].type===`plain-text`)&&(c=o(t[r-1])+c,t.splice(r-1,1),r--),t[r]=new e.Token(`plain-text`,c,null,c)}i.content&&typeof i.content!=`string`&&s(i.content)}};e.hooks.add(`after-tokenize`,function(e){(e.language===`jsx`||e.language===`tsx`)&&s(e.tokens)})})(Prism),mF.setOptions({gfm:!0,breaks:!0}),qI.addHook(`afterSanitizeAttributes`,e=>{e.tagName===`A`&&e.getAttribute(`href`)&&(e.setAttribute(`target`,`_blank`),e.setAttribute(`rel`,`noopener noreferrer`)),e.tagName===`IMG`&&(e.setAttribute(`loading`,`lazy`),e.setAttribute(`decoding`,`async`))});var EL={js:`javascript`,mjs:`javascript`,cjs:`javascript`,node:`javascript`,ts:`typescript`,sh:`bash`,shell:`bash`,zsh:`bash`,console:`bash`,html:`markup`,vue:`markup`,xml:`markup`,svg:`markup`,jsonc:`json`,json5:`json`,py:`python`,yml:`yaml`};function DL(e){let t=String(e||``).trim().toLowerCase();if(!t)return``;let n=EL[t]||t;return pv.default.languages[n]?n:``}function OL(e){let t=String(e??``);if(!t.trim())return``;let n=``;try{n=mF.parse(t)}catch{n=`<p>${t.replace(/[&<>]/g,e=>({"&":`&amp;`,"<":`&lt;`,">":`&gt;`})[e])}</p>`}return qI.sanitize(n,{ADD_ATTR:[`target`,`rel`]})}function kL(e){if(e&&e.querySelectorAll)for(let t of e.querySelectorAll(`pre`)){let e=t.querySelector(`code`);if(!e)continue;let n=DL((e.className.match(/language-([\w+-]+)/)||[])[1]||``);if(n&&e.className.indexOf(`language-`)<0&&(e.className=`language-${n}`),n&&!e.dataset.mdHighlighted){try{pv.default.highlightElement(e)}catch{}e.dataset.mdHighlighted=`1`}if(t.dataset.mdCode)continue;t.dataset.mdCode=`1`;let r=document.createElement(`div`);r.className=`md-code`;let i=document.createElement(`div`);i.className=`md-code__bar`;let a=document.createElement(`span`);a.className=`md-code__lang`,a.textContent=n||`text`;let o=document.createElement(`button`);o.type=`button`,o.className=`md-code__copy`,o.textContent=`复制`,o.addEventListener(`click`,async()=>{await yp(e.textContent||``)?(o.textContent=`已复制`,o.classList.add(`is-ok`)):o.textContent=`复制失败`,setTimeout(()=>{o.textContent=`复制`,o.classList.remove(`is-ok`)},1600)}),i.append(a,o),t.parentNode?.insertBefore(r,t),r.append(i,t)}}function AL(e){if(e&&e.querySelectorAll)for(let t of e.querySelectorAll(`pre code[data-md-highlighted]`))delete t.dataset.mdHighlighted}function jL(e){return e?e.nodeType===3?!e.textContent.trim():e.nodeType===1&&e.tagName===`BR`:!1}function ML(e){if(e.length>1)return`${e.length} 张图像`;let t=e[0],n=(t.getAttribute(`alt`)||``).trim();if(n)return n;let r=(t.getAttribute(`title`)||``).trim();return(r?(r.split(/[\\/]/).pop()||``).trim():``)||_L(t.getAttribute(`src`))||`1 张图像`}function NL(e){let t=document.createElement(`div`);t.className=`md-imggroup`,t.dataset.mdImggroup=`1`;let n=document.createElement(`button`);n.type=`button`,n.className=`md-imggroup__head`,n.setAttribute(`aria-expanded`,`false`),n.innerHTML=`<svg class="md-imggroup__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><use href="#icon-images" /></svg><span class="md-imggroup__label"></span><svg class="md-imggroup__chev" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><use href="#icon-chevron-right" /></svg>`,n.querySelector(`.md-imggroup__label`).textContent=ML(e);let r=document.createElement(`div`);return r.className=`md-imggroup__body`,r.hidden=!0,n.addEventListener(`click`,()=>{let e=r.hidden;r.hidden=!e,t.classList.toggle(`is-open`,e),n.setAttribute(`aria-expanded`,e?`true`:`false`)}),t.append(n,r),{group:t,body:r}}function PL(e){if(e.dataset.mdImgFallback)return;e.dataset.mdImgFallback=`1`;let t=()=>{if(!e.isConnected||!(e.complete&&e.naturalWidth===0))return;let t=e.getAttribute(`src`)||``;if(/\.svgz?(?:[?#]|$)/i.test(t)||/^data:image\/svg/i.test(t))return;let n=_L(t)||(e.getAttribute(`alt`)||``).trim()||`未知图片`,r=document.createElement(`span`);r.className=`md-imgfail`,r.textContent=`图片加载失败:${n}`,r.title=t,e.replaceWith(r);let i=r.closest(`.md-imggroup__body`);if(i&&!i.querySelector(`img`)){let e=r.closest(`[data-md-imggroup]`);if(e){let t=e.querySelector(`.md-imggroup__head`);t&&t.remove(),e.classList.add(`is-open`)}}};e.addEventListener(`error`,t,{once:!0}),t()}function FL(e){if(!e||!e.querySelectorAll)return;let t=[...e.querySelectorAll(`img`)];for(let e of t)PL(e);for(let e of t){if(e.closest(`[data-md-imggroup]`))continue;let t=[e],n=e.nextSibling;for(;n;)if(jL(n))n=n.nextSibling;else if(n.tagName===`IMG`&&!n.closest(`[data-md-imggroup]`))t.push(n),n=n.nextSibling;else break;let{group:r,body:i}=NL(t);e.parentNode.insertBefore(r,e);for(let e of t)i.append(e)}}var IL={name:`MarkdownBody`,props:{source:{type:String,default:``},streaming:{type:Boolean,default:!1}},data(){return{html:``,_raf:0}},watch:{source:{immediate:!0,handler(){this.scheduleRender()}},streaming(e){e||this.renderNow()}},beforeUnmount(){this._raf&&cancelAnimationFrame(this._raf),this._raf=0},methods:{scheduleRender(){this.streaming?this._raf||=requestAnimationFrame(()=>{this._raf=0,this.renderNow()}):this.renderNow()},renderNow(){this._raf&&=(cancelAnimationFrame(this._raf),0),this.html=OL(this.source),this.$nextTick(()=>{let e=this.$refs.bodyEl;e&&(AL(e),kL(e),FL(e))})}}},LL=[`innerHTML`];function RL(e,t,n,r,i,a){return V(),H(B,null,[q(` 模型输出经 marked 解析 + DOMPurify 消毒后注入;代码块由 enhanceCodeBlocks 补高亮与复制按钮 `),W(`div`,{ref:`bodyEl`,class:`md-body`,innerHTML:i.html},null,8,LL)],2112)}var zL=Z(IL,[[`render`,RL],[`__file`,`/Users/ynet/dsl-card/card-editor/components/MarkdownBody.vue`]]),BL={card_list:`列出卡片`,card_read:`读取卡片`,card_write:`写入卡片`,card_validate:`校验卡片`,card_render_status:`渲染状态`,card_node_models:`组件模型`,card_screenshot:`截图预览`,card_sync:`同步远端卡片`,card_save:`推送到远端`,card_slice_upload:`上传切图`,card_import_meta:`来源侧车`,card_route_input:`输入路由`,card_scaffold:`生成骨架`,card_add_component:`添加组件`,card_history:`编辑历史`,card_rollback:`回滚版本`,skill_read:`读技能文档`,skill_exec:`跑技能脚本`,card_grep:`定位卡片字段`,card_patch:`最小改写卡片`,fs_read:`读文件`,fs_list:`列目录`,fs_write:`写草稿文件`,fs_copy:`复制文件`,shell_exec:`本地命令`};function VL(e){return BL[e]||e||`工具`}function HL(e){let t=e&&e.args||{};return`${typeof t.script==`string`?t.script:``} ${Array.isArray(t.args)?t.args.join(` `):typeof t.command==`string`?t.command:``} ${typeof t.name==`string`?t.name:``}`.toLowerCase()}var UL=[{order:6,id:`S6`,label:`收尾门禁`,hit:(e,t)=>/check_fidelity/.test(t)||/iterate/.test(t)&&/--gate/.test(t)},{order:5,id:`S5`,label:`像素自循环`,hit:(e,t)=>/iterate|diff_bands/.test(t)||e===`card_screenshot`},{order:4,id:`S4`,label:`组件填充`,hit:e=>e===`card_add_component`||e===`card_patch`||e===`card_write`},{order:3,id:`S3`,label:`骨架落盘`,hit:(e,t)=>e===`card_scaffold`||/expand_ir/.test(t)||e===`fs_write`&&/\.ir\.json/.test(t)},{order:2,id:`S2`,label:`设计稿审计`,hit:(e,t)=>/spec_tree|sketch_spec|design_sample|audit_|slice_/.test(t)},{order:1,id:`S1`,label:`输入路由`,hit:e=>e===`card_route_input`}];function WL(e){let t=Math.max(0,Math.round(Number(e||0)/1e3));if(t<60)return`${t} 秒`;let n=Math.floor(t/60);return n<60?`${n} 分 ${t%60} 秒`:`${Math.floor(n/60)} 小时 ${n%60} 分`}function GL(e){let t=Number(e||0);if(!t)return``;let n=new Date(t),r=e=>String(e).padStart(2,`0`);return`${r(n.getHours())}:${r(n.getMinutes())}:${r(n.getSeconds())}`}function KL(e){let t=Number(e||0);return t>0?`+${WL(t)}`:``}function qL(e,t=0){let n=Number(e&&e.startedAt)||0;if(!n)return 0;let r=Number(e&&e.ms)||0;if(r>0)return n+r;let i=Number(t)||0;return i>n?i:0}function JL(e){let t=e&&e.toolName||``,n=HL(e);for(let e of UL)if(e.hit(t,n))return e;return null}var YL=new Set([`card_write`,`card_patch`,`card_scaffold`,`card_add_component`,`fs_write`,`fs_copy`,`card_save`,`card_sync`,`card_slice_upload`]),XL=new Set([`card_read`,`card_list`,`card_node_models`,`card_grep`,`card_history`,`card_validate`,`card_render_status`,`fs_read`,`fs_list`,`skill_read`]);function ZL(e){let t=e&&e.toolName||``;return e&&e.error||YL.has(t)||t===`skill_exec`||t===`shell_exec`||t===`card_screenshot`?!0:!XL.has(t)}function QL(e){if(e==null||e===``)return null;if(typeof e==`object`)return e;let t=String(e);try{return JSON.parse(t)}catch{}let n=t.indexOf(`{`),r=t.lastIndexOf(`}`);if(n>=0&&r>n)try{return JSON.parse(t.slice(n,r+1))}catch{return null}return null}function $L(e){let t=HL(e);if(!/--gate|check_fidelity/.test(t))return null;let n=QL(e&&e.result),r=n&&typeof n==`object`?n.gate:null;if(r&&typeof r.passed==`boolean`)return{passed:r.passed,verdict:String(r.verdict||``)};let i=String(e&&e.result||``);if(!/"passed"\s*:/.test(i))return null;let a=/"passed"\s*:\s*(true|false)/.exec(i),o=/"verdict"\s*:\s*"((?:[^"\\]|\\.)*)"/.exec(i);return a?{passed:a[1]===`true`,verdict:o?o[1].replace(/\\n/g,` `):``}:null}var eR=/\s#([^\s#]+)\s*$/;function tR(e){let t=String(e??``),n=eR.exec(t);return n?{text:t.slice(0,n.index).trim(),cid:n[1]}:{text:t,cid:``}}var nR=12;function rR(e){let t=e&&e.toolName||``,n=QL(e&&e.result);if(!n||typeof n!=`object`)return null;let r=t===`card_validate`?n:n.verify&&n.verify.validate;if(!r||typeof r!=`object`||!Array.isArray(r.errors))return null;let i=Array.isArray(r.warnings)?r.warnings:[],a=[...r.errors.map(e=>({level:`error`,...tR(e)})),...i.map(e=>({level:`warn`,...tR(e)}))].slice(0,nR);return{ok:r.ok!==!1&&r.errors.length===0,errors:r.errors.length,warnings:i.length,issues:a}}function iR(e){let t=Array.isArray(e)?e:[],n=0,r=0,i=0,a=0,o=null,s=null;for(let e of t){e.error&&a++,YL.has(e.toolName)&&(e.error?r++:n++),e.toolName===`card_screenshot`&&!e.error&&i++;let t=rR(e);t&&(o=t);let c=$L(e);c&&(s=c)}return{total:t.length,writes:n,writeFails:r,shots:i,failed:a,validate:o,gate:s}}var aR={length:`单次输出上限截断:调高「单次输出上限」,或要求 AI 走紧凑 IR 路线(fs_write 写 IR → expand_ir 展开)`,stall:`上游长时间静默:多为网关 / 网络抖动。上下文与已落盘产物都在,重试本轮即可接着做`,empty:`网关连续返回空响应:重试本轮,或检查网关额度 / 换个时间段`,context:`上下文超出网关窗口:后端已自动压缩重试仍失败,建议新开一轮或清理对话记录`,network:`连不上网关:检查网络与 Base URL 后重试本轮`,"rate-limit":`网关限流或额度不足:稍后重试,或换一个 API Key`,auth:`API Key 无效或权限不足:到设置里更新 Key 再重试`,"wrap-failed":`熔断收尾的进度汇总也没拿到:上下文已保留,回复「继续」接着做`,aborted:`本轮已中止:已执行的写入都保留,可从中断处继续`,unknown:`未归类的失败:复制错误原文排查,或换个说法重试本轮`};function oR(e){return{hint:aR[e]||``,action:e===`length`||e===`auth`?`settings`:e===`wrap-failed`||e===`aborted`?`continue`:`retry`}}var sR=/^\s*(\d+)\.\s+(.+?)\s+\((\d+x\d+|\?)\)\s*(.*)$/,cR=/--pick\s+([\d.,~]+)/;function lR(e){if(typeof e!=`string`||!e.includes(`--pick`))return[];let t=[];for(let n of e.split(`
343
+ `)){let e=n.match(sR);if(!e)continue;let r=(e[4].match(cR)||[])[1];r&&t.push({no:Number(e[1]),name:e[2].trim(),size:e[3],pick:r})}return t}var uR=/^(\d+)\.(\d+)~(\d+)\.(\d+)$/,dR=/^\d+\.\d+$/;function fR(e){let t=[];for(let n of e||[]){if(!n||!n.pick)continue;let e=String(n.pick),r=e.match(uR),i=r?Number(r[2]):0,a=r?Number(r[4]):0;if(r&&r[1]===r[3]&&a>i){for(let e=i;e<=a;e+=1)t.push({...n,pick:`${r[1]}.${e}`,token:`${r[1]}.${e}`,kind:`card`});t.push({...n,token:`全 ${a-i+1} 张`,kind:`all`})}else t.push({...n,token:e,kind:dR.test(e)?`card`:`board`})}return t}function pR(e){let t=Array.isArray(e)?e:[];for(let e=t.length-1;e>=0;--e){let n=t[e]&&t[e].toolCalls;if(Array.isArray(n)){for(let e=n.length-1;e>=0;--e)if(n[e]&&lR(n[e].result).length)return n[e]}}return null}function mR(e,t=``){if(!e||!e.pick)return``;let n=e.name?`「${e.name}」`:``,r=e.kind===`card`||dR.test(String(e.pick))?`(只建这一张卡,同画板的其它卡不要一起建)`:``,i=t?`落点卡 = 当前卡 ${t}(覆盖它,不是新建;要另建新卡我会直说)。`:``;return`建卡:画板 ${e.no}${n}。${i}参数已选好,照抄重跑:parse_meaxure.py --build --pick ${e.pick}${r}`}var hR={name:`ChatToolRow`,components:{MarkdownBody:zL},props:{tc:{type:Object,required:!0},turnTs:{type:Number,default:0},nowTs:{type:Number,default:0},pickOwner:{type:Object,default:null}},emits:[`approval`,`pick-board`],data(){return{opened:null}},computed:{state(){return this.tc.error?`error`:this.tc.result!==void 0&&this.tc.result!==null?`done`:this.tc.pending?`pending`:`running`},open(){return this.opened===null?!!this.tc.error||this.boardPicks.length>0:this.opened},boardPicks(){return this.pickOwner&&this.tc!==this.pickOwner?[]:fR(lR(this.tc.result))},msText(){let e=this.tc.ms;return e?e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`:``},stampText(){return GL(this.tc.startedAt)},cumText(){let e=qL(this.tc,this.nowTs);return e&&this.turnTs?KL(e-this.turnTs):``},clockText(){return[this.stampText,this.cumText].filter(Boolean).join(` · `)},clockTitle(){let e=[];return this.stampText&&e.push(`开始于 ${this.stampText}`),this.cumText&&e.push(`距本轮开始 ${this.cumText.slice(1)}`),this.msText&&e.push(`本步耗时 ${this.msText}`),e.join(` · `)},approvalCommand(){if(this.tc.command)return String(this.tc.command);let e=this.tc.args||{};return typeof e.command==`string`&&e.command?e.command:this.tc.toolName===`skill_exec`?[e.script,Array.isArray(e.args)?e.args.join(` `):``].filter(Boolean).join(` `):JSON.stringify(e)},argSummary(){if(this.tc.toolName===`skill_exec`&&this.tc.args?.script){let e=[String(this.tc.args.script).replace(/^skills\//,``),(Array.isArray(this.tc.args.args)?this.tc.args.args:[]).map(e=>String(e).replace(/^\/[^\s]{20,}$/,e=>`…/${e.slice(-14)}`)).join(` `)].filter(Boolean).join(` `);return e.length>96?`${e.slice(0,96)}…`:e}let e=this.tc.args||{},t=[];for(let[n,r]of Object.entries(e)){if(r==null||r===``)continue;let e=typeof r==`object`?JSON.stringify(r):String(r);if(t.push(`${n}=${e.length>28?`${e.slice(0,28)}…`:e}`),t.join(` `).length>56)break}let n=t.join(` `);return n.length>72?`${n.slice(0,72)}…`:n},argsSource(){let e=this.tc.args||{};if(!Object.keys(e).length)return``;if(this.tc.toolName===`skill_exec`&&typeof e.script==`string`){if(!this.tc.error)return``;let t=Array.isArray(e.args)?e.args.join(` `):``;return`\`\`\`\n${[e.script,t].filter(Boolean).join(` `)}\n\`\`\``}if(this.tc.toolName===`shell_exec`&&typeof e.command==`string`)return this.tc.error?`\`\`\`\n${e.command}\n\`\`\``:``;let t=``;try{t=JSON.stringify(e,null,2)}catch{t=String(e)}return`\`\`\`json\n${t}\n\`\`\``},resultSource(){let e=this.tc.result;if(e==null||e===``||this.boardPicks.length&&!this.tc.error)return``;let t=typeof e==`string`?e:JSON.stringify(e);try{t=JSON.stringify(JSON.parse(t),null,2)}catch{}t.length>4e3&&(t=`${t.slice(0,4e3)}\n…(已截断)`);let n=`\`\`\`json\n${t}\n\`\`\``;return this.tc.truncated?`${n}\n\n> 结果过长,面板只显示前 4000 字;喂给模型的上下文另有额度,不受此限。`:n}},methods:{toolLabel:VL,toggle(){this.opened=!this.open}}},gR=[`aria-expanded`],_R={key:0,class:`aitool__spin`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},vR={key:1,class:`aitool__status`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},yR={key:2,class:`aitool__status`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},bR={class:`aitool__name`},xR={class:`aitool__args`},SR=[`title`],CR=[`title`],wR={key:0,class:`aitool__approve`},TR=[`title`],ER={class:`aitool__approve-hint`},DR={class:`aitool__approve-hint`},OR=[`title`],kR={class:`aitool__body`},AR={key:0,class:`aitool__picks`},jR=[`title`,`aria-label`,`onClick`],MR={class:`aitool__pick-no`},NR={class:`aitool__pick-arg`},PR=[`src`],FR={key:3,class:`aitool__error`};function IR(e,t,n,r,i,a){let o=R(`MarkdownBody`);return V(),H(B,null,[q(` 单次工具调用:一行摘要,可展开看参数 / 结果 / 截图。
343
344
  抽成独立组件的原因:ChatMessage 要把「连续同名调用」折叠成分组行,
344
- 分组展开后的成员行与平铺行走的是同一份标记,复制两遍必然漂移 `),W(`div`,{class:j([`aitool`,[`aitool--${a.state}`,{"is-open":a.open}]])},[W(`button`,{type:`button`,class:`aitool__head`,"aria-expanded":a.open?`true`:`false`,onClick:t[0]||=(...e)=>a.toggle&&a.toggle(...e)},[t[7]||=W(`svg`,{class:`aitool__chev`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-chevron-right`})],-1),a.state===`running`||a.state===`pending`?(V(),H(`svg`,dR,[...t[4]||=[W(`use`,{href:`#icon-loading`},null,-1)]])):a.state===`error`?(V(),H(`svg`,fR,[...t[5]||=[W(`use`,{href:`#icon-alert-triangle`},null,-1)]])):(V(),H(`svg`,pR,[...t[6]||=[W(`use`,{href:`#icon-check`},null,-1)]])),W(`span`,mR,M(a.toolLabel(n.tc.toolName)),1),W(`code`,hR,M(n.tc.pending?`参数生成中…`:a.argSummary),1),q(` 时间三件套:这一步什么时候开始(墙钟)· 距回合起点多久(累计)· 自身耗时。
345
- 长任务里「卡在哪一步、卡了多久」全靠这三个数互相对齐 `),a.clockText?(V(),H(`span`,{key:3,class:`aitool__clock`,title:a.clockTitle},M(a.clockText),9,gR)):q(`v-if`,!0),a.msText?(V(),H(`span`,{key:4,class:`aitool__ms`,title:`本步耗时 ${a.msText}`},M(a.msText),9,_R)):q(`v-if`,!0)],8,uR),q(` 高危执行逐次确认:命令原文 + 允许一次 / 本回合不再询问 / 拒绝(Codex 审批的同款交互) `),n.tc.needsApproval?(V(),H(`div`,vR,[t[8]||=W(`svg`,{class:`aitool__approve-icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-alert-triangle`})],-1),W(`code`,{class:`aitool__approve-cmd`,title:a.approvalCommand},M(a.approvalCommand),9,yR),W(`span`,bR,M(n.tc.toolName===`skill_exec`?`技能脚本,需要你确认`:`本地命令,需要你确认`),1),W(`button`,{type:`button`,class:`aitool__approve-btn`,onClick:t[1]||=J(t=>e.$emit(`approval`,{tc:n.tc,ok:!0,scope:`once`}),[`stop`])},`允许一次`),W(`button`,{type:`button`,class:`aitool__approve-btn aitool__approve-btn--ghost`,onClick:t[2]||=J(t=>e.$emit(`approval`,{tc:n.tc,ok:!0,scope:`turn`}),[`stop`])},`本回合不再询问`),W(`button`,{type:`button`,class:`aitool__approve-btn aitool__approve-btn--deny`,onClick:t[3]||=J(t=>e.$emit(`approval`,{tc:n.tc,ok:!1}),[`stop`])},`拒绝`)])):n.tc.approvalNote?(V(),H(B,{key:1},[q(` 免确认策略命中:没有审批条,但照样把「跑了什么命令」摆出来,免确认不等于无痕迹 `),W(`div`,{class:j([`aitool__approve-note`,{"is-auto":n.tc.autoApproved}])},[W(`span`,xR,M(n.tc.approvalNote),1),n.tc.autoApproved&&n.tc.command?(V(),H(`code`,{key:0,class:`aitool__approve-cmd`,title:n.tc.command},M(n.tc.command),9,SR)):q(`v-if`,!0)],2)],2112)):q(`v-if`,!0),L(W(`div`,CR,[q(` 画板清单点选:清单里是 1 起的板号、--indices 是 0 起,让用户/模型去换算,实测就是这么
346
- 错一位建错画板的。点一下 = 把清单行尾那串原样的 --pick 直接发给模型,中间零翻译 `),a.boardPicks.length?(V(),H(`div`,wR,[t[9]||=W(`div`,{class:`aitool__picks-hint`},`点一下直接建卡 = 照抄清单行尾的 --pick,不用换算序号;一板多卡已按张拆开:`,-1),(V(!0),H(B,null,z(a.boardPicks,t=>(V(),H(`button`,{key:t.pick,type:`button`,class:`aitool__pick`,title:`${t.name}(${t.size})→ parse_meaxure.py --pick ${t.pick}`,"aria-label":`建卡:画板 ${t.no} ${t.name}(${t.size})--pick ${t.pick}`,onClick:n=>e.$emit(`pick-board`,t)},[W(`span`,ER,`第 `+M(t.no)+` 板`,1),W(`code`,DR,M(t.token),1)],8,TR))),128))])):q(`v-if`,!0),a.argsSource?(V(),U(o,{key:1,source:a.argsSource},null,8,[`source`])):q(`v-if`,!0),n.tc.image?(V(),H(`img`,{key:2,class:`aitool__shot`,src:`data:${n.tc.image.mime||`image/png`};base64,${n.tc.image.base64}`,alt:`卡片截图`},null,8,OR)):q(`v-if`,!0),n.tc.error?(V(),H(`div`,kR,M(n.tc.error),1)):a.resultSource?(V(),U(o,{key:4,source:a.resultSource},null,8,[`source`])):q(`v-if`,!0)],512),[[Nc,a.open]])],2)],2112)}var jR=Z(lR,[[`render`,AR],[`__scopeId`,`data-v-c80ddf1d`],[`__file`,`/Users/ynet/dsl-card/card-editor/components/ChatToolRow.vue`]]);function MR(e){return`${Jl()||``}/__ai/fs/raw?path=${encodeURIComponent(e)}`}async function NR(e){let t=await e.json().catch(()=>({}));if(!e.ok){let n=``;try{n=new URL(e.url).pathname}catch{}let r=(e.status===404||e.status===405)&&n.startsWith(`/__ai/`)?`本地开发服务仍在运行改造前的旧代码(缺少该接口),请重启 npm run dev(cardbuddy)后重试`:t.message||t.error||`HTTP ${e.status}`,i=Error(r);throw i.code=t.error,i.payload=t,i}return t}async function PR(e=!1){return NR(await Y(`/__ai/config${e?`?reveal=1`:``}`))}async function FR(e){return NR(await Y(`/__ai/config`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}))}async function IR(){return NR(await Y(`/__ai/models`))}async function LR(){return NR(await Y(`/__ai/cc-switch-providers`))}async function RR(e,t=!1){return NR(await Y(`/__ai/models/${encodeURIComponent(e)}${t?`?reveal=1`:``}`))}async function zR(e){return NR(await Y(`/__ai/models`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}))}async function BR(e,t){return NR(await Y(`/__ai/models/${encodeURIComponent(e)}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}))}async function VR(e){return NR(await Y(`/__ai/models/${encodeURIComponent(e)}`,{method:`DELETE`}))}async function HR(e){return NR(await Y(`/__ai/models/${encodeURIComponent(e)}/activate`,{method:`POST`}))}async function UR(e={}){let{baseUrl:t=``,apiKey:n=``,model:r=``}=e||{};return NR(await Y(`/__ai/probe-maxtokens`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({baseUrl:t,apiKey:n,model:r})}))}async function WR(e){return NR(await Y(`/__ai/ping`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}))}async function GR(e=`image`){return NR(await Y(`/__ai/fs/pick`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,multiple:!0})}))}async function KR(e){return NR(await Y(`/__ai/fs/stat?path=${encodeURIComponent(e)}`))}async function qR({name:e,relPath:t,size:n,child:r=``}){return NR(await Y(`/__ai/fs/locate`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:e,relPath:t,size:n,child:r})}))}function JR(e,t,n=`request`){return new Promise((r,i)=>{let a=setTimeout(()=>{let e=Error(`${n}-timeout`);e.code=`timeout`,i(e)},t);e.then(e=>{clearTimeout(a),r(e)},e=>{clearTimeout(a),i(e)})})}async function YR(e){return NR(await Y(`/__ai/fs/stash`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({dataUrl:e})}))}async function XR({approvalId:e,ok:t,scope:n=`once`}){return NR(await Y(`/__ai/approve`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({approvalId:e,ok:t,scope:n})}))}async function ZR(e){return e?NR(await Y(`/__ai/history?cardId=${encodeURIComponent(e)}`)):{cardId:``,messages:[],updatedAt:0}}async function QR(e,t,n={}){return e?NR(await Y(`/__ai/history`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cardId:e,messages:t}),keepalive:n.keepalive===!0})):{ok:!1,error:`missing-card-id`}}async function $R(e){return e?NR(await Y(`/__ai/history?cardId=${encodeURIComponent(e)}`,{method:`DELETE`})):{ok:!1,error:`missing-card-id`}}async function ez(e,t){let n=e.body.getReader(),r=new TextDecoder,i=``,a=e=>{i+=e;let n=i.split(`
347
- `);i=n.pop()||``;for(let e of n){let n=e.trim();if(!n.startsWith(`data:`))continue;let r=n.slice(5).trim();if(!r)continue;let i;try{i=JSON.parse(r)}catch{continue}if(t(i)===!0)return!0}return!1};try{for(;;){let{done:e,value:t}=await n.read();if(e||a(r.decode(t,{stream:!0})))break}a(r.decode())}finally{try{n.releaseLock?.()}catch{}}}async function tz({messages:e,cardContext:t,attachments:n=[],config:r={},signal:i,onEvent:a}){let o=await Y(`/__ai/chat`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({messages:e,cardContext:t,attachments:n,config:r}),signal:i});if(!o.ok||!o.body){let e=await o.json().catch(()=>({})),t=Error(e.message||e.error||`HTTP ${o.status}`);throw t.code=e.error||`http-${o.status}`,t.status=o.status,t.payload=e,t}await ez(o,e=>(a(e),e.type===`done`))}async function nz(e){return e?NR(await Y(`/__ai/turns?cardId=${encodeURIComponent(e)}`)):{cardId:``,active:null,recent:[]}}async function rz(e){return e?NR(await Y(`/__ai/stop`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cardId:e})})):{ok:!1,error:`missing-card-id`}}async function iz({cardId:e,afterSeq:t=0,turnId:n=``,signal:r,onEvent:i}){if(!e){let e=Error(`缺少 cardId,无法续订回合`);throw e.code=`missing-card-id`,e}let a=new URLSearchParams({cardId:e,afterSeq:String(Number(t)||0)});n&&a.set(`turnId`,String(n));let o=await Y(`/__ai/turn?${a}`,{signal:r});if(!o.ok||!o.body){let e=await o.json().catch(()=>({})),t=Error(e.message||e.error||`HTTP ${o.status}`);throw t.code=e.error||`http-${o.status}`,t.status=o.status,t}let s=Number(t)||0;return await ez(o,e=>{let t=Number(e.seq)||0;return t>s&&(s=t),i(e),!1}),s}function az(e,t,n=300){let r=String(e??``),i=Math.max(0,Math.min(Number(t)||0,r.length));return i<Math.max(0,Number(n)||0)?{head:``,tail:r,folded:!1}:{head:r.slice(0,i),tail:r.slice(i),folded:!0}}var oz=3,sz={name:`ChatMessage`,components:{MarkdownBody:NL,ChatToolRow:jR},props:{msg:{type:Object,required:!0},streaming:{type:Boolean,default:!1},compact:{type:Boolean,default:!1},canRollback:{type:Boolean,default:!1},nowTs:{type:Number,default:0},canRegenerate:{type:Boolean,default:!1},pickOwner:{type:Object,default:null}},emits:[`regenerate`,`approval`,`continue`,`rollback`,`open-settings`,`show-all-steps`,`locate-node`,`pick-board`],data(){return{thinkOpen:!1,narrOpen:!1,eventsOpen:null,copied:!1,elapsed:0,openGroups:Object.create(null),errorCopied:!1,_tick:0}},computed:{budgetLabel(){return{loop:`死循环熔断`,timeout:`墙钟熔断`,steps:`步数硬顶`}[this.msg.budget?.reason]||`本轮收尾`},budgetHint(){return{loop:`连续多轮同工具同参数 = 拿不到新信息。回复「继续」前最好补一句新思路(换证据链 / 指定要改的字段),否则大概率原地再转一次。`,timeout:`本轮跑到墙钟上限(AI_TURN_TIMEOUT_MS 可调)。回复「继续」会带着完整上下文从中断处接着做。`,steps:`你在设置里配了「单轮步数上限」。留空即不限步数,失控由死循环 / 墙钟熔断兜住。`}[this.msg.budget?.reason]||`上下文已保留,回复「继续」可接着做。`},attachments(){return Array.isArray(this.msg.attachments)?this.msg.attachments:[]},toolCalls(){return Array.isArray(this.msg.toolCalls)?this.msg.toolCalls:[]},msgTs(){return Number(this.msg.ts)||0},turnClock(){let e=this.msgTs,t=Number(this.msg.elapsedMs)||0,n=e&&t>0?e+t:0;if(!n)for(let e of this.toolCalls)n=Math.max(n,VL(e,this.nowTs));return{stamp:zL(e),endStamp:n>e?zL(n):``,total:n>e?RL(n-e):``}},toolGroups(){let e=[],t=[],n=()=>{if(t.length>=oz)e.push({kind:`group`,key:`g-${t[0].toolCallId||e.length}`,toolName:t[0].toolName,rows:t.slice(),ms:t.reduce((e,t)=>e+(Number(t.ms)||0),0),failed:t.filter(e=>e.error).length,clock:this.groupClock(t)});else for(let n of t)e.push({kind:`row`,key:n.toolCallId||`r-${e.length}`,tc:n});t=[]};for(let e of this.toolCalls)(!this.compact||GL(e))&&(t.length&&t[0].toolName===e.toolName?t.push(e):(n(),t=[e]));return n(),e},hiddenSteps(){return this.compact?this.toolCalls.filter(e=>!GL(e)).length:0},summary(){return QL(this.toolCalls)},showSummary(){if(this.streaming)return!1;let e=this.summary;return!!(e.writes||e.writeFails||e.gate||e.validate||e.failed||this.cacheBadge)},cacheBadge(){let e=this.msg.usage;if(!e||!Number(e.promptTokens))return null;let t=Number(e.promptTokens)||0,n=Number(e.cachedTokens)||0,r=Number(e.steps)||0,i=e=>e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e);if(!e.reported)return{label:`缓存未提供`,ok:!1,title:`本回合累计输入 ${i(t)} token(${r} 步):该网关未回缓存命中字段,无法统计命中率`};let a=Number(e.hitRate)||0;return{label:`缓存命中 ${a}%`,ok:a>=50,title:`本回合累计输入 ${i(t)} token(${r} 步,命中 ${i(n)} / 未命中 ${i(t-n)}):命中量按网关的 64 token 块对齐,未命中部分多为本轮新增的工具结果与收尾提示`}},validateIssues(){let e=this.summary.validate;return e&&Array.isArray(e.issues)?e.issues:[]},validateMore(){let e=this.summary.validate;return e?Math.max(0,(e.errors||0)+(e.warnings||0)-this.validateIssues.length):0},advice(){return this.msg.error?eR(this.msg.errorCode||``):{hint:``,action:``}},errorHint(){return this.advice.hint},errorAction(){return this.advice.action},events(){return Array.isArray(this.msg.events)?this.msg.events:[]},hasErrorEvent(){return this.events.some(e=>e.level===`error`)},eventsExpanded(){return this.eventsOpen===null?this.hasErrorEvent:this.eventsOpen},eventsLabel(){let e=this.events.filter(e=>e.level!==`info`).length;return e?`过程事件 ${this.events.length} 条(${e} 条需留意)`:`过程事件 ${this.events.length} 条`},bodyText(){return yL(this.bodySplit.tail.replace(/\n*\[\s*(?:任务完成|需用户确认)\s*\]\s*$/,``).trimEnd(),MR)},bodySplit(){return az(this.msg.content,this.msg.narrationChars)},narrationText(){return this.bodySplit.head?yL(this.bodySplit.head,MR):``},narrationSize(){return this.bodySplit.head.length.toLocaleString(`zh-CN`)},thinking(){return!(!this.streaming||this.msg.content||this.toolCalls.length)},streamingText(){return!!(this.streaming&&this.msg.content)},waiting(){return!(!this.streaming||this.msg.reasoning||this.msg.content||this.toolCalls.length||this.msg.error)},thinkLabel(){return this.thinking?`思考中… ${this.fmtClock(this.elapsedMs)}`:`已思考 ${this.fmtClock(this.msg.reasoningMs||this.elapsedMs)}`},elapsedMs(){return this.thinking?this.elapsed:this.msg.reasoningMs||this.elapsed},peek(){let e=String(this.msg.reasoning||``).split(`
348
- `).map(e=>e.trim()).filter(Boolean),t=e[e.length-1]||``;return t.length>72?`${t.slice(0,72)}…`:t}},watch:{streaming:{immediate:!0,handler(e){e?this.startTick():this.stopTick()}},thinking(e){e||this.stopTick()}},beforeUnmount(){this.stopTick()},updated(){let e=this.$refs.thinkPre;e&&this.thinkOpen&&this.thinking&&(e.scrollTop=e.scrollHeight)},methods:{startTick(){this.stopTick(),this.elapsed=0,this._tick=setInterval(()=>{this.elapsed+=250},250)},stopTick(){this._tick&&clearInterval(this._tick),this._tick=0},fmtStamp:zL,fmtClock:RL,evOff(e){let t=Number(e&&e.ts)||0;return t>this.msgTs?BL(t-this.msgTs):``},groupClock(e){let t=VL(e[e.length-1],this.nowTs),n=t>this.msgTs?BL(t-this.msgTs):``;return[zL(e[0]&&e[0].startedAt),n].filter(Boolean).join(` · `)},fileUrl(e){return MR(e)},attSub(e){return e.exists===!1?`路径不可读`:e.isDir?`${e.entryCount??e.entries?.length??0} 项`:this.formatSize(e.size)},formatSize(e){let t=Number(e||0);return t?t<1024?`${t} B`:t<1048576?`${(t/1024).toFixed(1)} KB`:`${(t/1024/1024).toFixed(1)} MB`:`0 B`},toolLabel:FL,msText(e){let t=Number(e)||0;return t?t<1e3?`${t}ms`:`${(t/1e3).toFixed(1)}s`:``},groupOpen(e){let t=this.openGroups[e.key];if(t!==void 0)return t;if(e.failed)return!0;let n=e.rows[e.rows.length-1];return!(!n||n.result!==void 0||n.error)},toggleGroup(e){this.openGroups={...this.openGroups,[e.key]:!this.groupOpen(e)}},onApproval(e){this.$emit(`approval`,e)},async copyError(){await yp(`${this.msg.errorCode?`[${this.msg.errorCode}] `:``}${String(this.msg.error||``)}`)&&(this.errorCopied=!0,setTimeout(()=>{this.errorCopied=!1},1600))},async copyText(){await yp(String(this.msg.content||``))&&(this.copied=!0,setTimeout(()=>{this.copied=!1},1600))}}},cz={key:0,class:`aimsg__files`},lz=[`title`],uz=[`src`,`alt`],dz={key:1,class:`aifile__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},fz=[`href`],pz={class:`aifile__meta`},mz={class:`aifile__name`},hz={class:`aifile__sub`},gz={key:1,class:`aimsg__bubble`},_z=[`aria-expanded`],vz={key:0,class:`aithink__spin`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},yz={key:1,class:`aithink__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},bz={class:`aithink__label`},xz={key:2,class:`aithink__peek`},Sz={class:`aithink__body`},Cz={key:1,class:`aiwait`},wz=[`aria-expanded`,`onClick`],Tz={class:`aitool__status`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},Ez=[`href`],Dz={class:`aitool__name`},Oz={class:`aitool__count`},kz={class:`aitool__args`},Az=[`title`],jz=[`title`],Mz={class:`aitool__groupbody`},Nz=[`aria-expanded`],Pz={class:`aiev__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},Fz=[`href`],Iz={class:`aiev__label`},Lz={class:`aiev__body`},Rz={class:`aiev__time`},zz={key:0,class:`aiev__off`,title:`距本轮开始的累计耗时`},Bz={class:`aiev__msg`},Vz=[`aria-expanded`,`title`],Hz={class:`ainarr__label`},Uz={class:`ainarr__hint`},Wz={class:`ainarr__body`},Gz={key:6,class:`aisum`},Kz={class:`aisum__head`},qz=[`title`],Jz={class:`aisum__chips`},Yz={key:0,class:`aisum__chip aisum__chip--ok`},Xz={key:1,class:`aisum__chip aisum__chip--danger`},Zz={key:2,class:`aisum__chip`},Qz={key:4,class:`aisum__chip aisum__chip--warn`},$z=[`title`],eB={key:1,class:`aisum__issues`},tB={class:`aisum__issue-list`},nB={class:`aisum__issue-text`},rB=[`title`,`onClick`],iB={key:0,class:`aisum__issues-more`},aB={key:7,class:`aimsg__error`},oB={class:`aimsg__error-main`},sB={class:`aimsg__error-text`},cB={key:0,class:`aimsg__error-hint`},lB={key:1,class:`aimsg__error-time`},uB={key:2,class:`aimsg__error-acts`},dB={key:8,class:`aimsg__aborted`},fB={key:0,class:`aimsg__aborted-time`},pB=[`title`],mB={class:`aimsg__budget-text`},hB={key:10,class:`aimsg__acts`},gB=[`title`],_B={viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},vB=[`href`];function yB(e,t,n,r,i,a){let o=R(`ChatToolRow`),s=R(`MarkdownBody`);return V(),H(`article`,{class:j([`aimsg`,[`aimsg--${n.msg.role}`,{"aimsg--live":n.streaming}]])},[q(` ===== 用户消息:附件芯片 + 文本气泡 ===== `),n.msg.role===`user`?(V(),H(B,{key:0},[a.attachments.length?(V(),H(`div`,cz,[(V(!0),H(B,null,z(a.attachments,e=>(V(),H(`div`,{key:e.path,class:j([`aifile`,{"aifile--dir":e.isDir,"aifile--missing":e.exists===!1}]),title:e.path},[e.isImage?(V(),H(`img`,{key:0,class:`aifile__thumb`,src:a.fileUrl(e.path),alt:e.name,loading:`lazy`},null,8,uz)):(V(),H(`svg`,dz,[W(`use`,{href:e.isDir?`#icon-folder-plus`:`#icon-file-text`},null,8,fz)])),W(`span`,pz,[W(`span`,mz,M(e.name),1),W(`span`,hz,M(a.attSub(e)),1)])],10,lz))),128))])):q(`v-if`,!0),n.msg.content?(V(),H(`div`,gz,M(n.msg.content),1)):q(`v-if`,!0)],64)):(V(),H(B,{key:1},[q(` ===== 助手消息:思考 → 工具 → 正文(与 Codex 同序) ===== `),q(` 思考过程:默认折叠成一行,进行中给「计时 + 最新一行」预览,结束收成「已思考 N 秒」 `),n.msg.reasoning?(V(),H(`div`,{key:0,class:j([`aithink`,{"is-open":i.thinkOpen,"is-live":a.thinking}])},[W(`button`,{type:`button`,class:`aithink__head`,"aria-expanded":i.thinkOpen?`true`:`false`,onClick:t[0]||=e=>i.thinkOpen=!i.thinkOpen},[t[17]||=W(`svg`,{class:`aithink__chev`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-chevron-right`})],-1),a.thinking?(V(),H(`svg`,vz,[...t[15]||=[W(`use`,{href:`#icon-loading`},null,-1)]])):(V(),H(`svg`,yz,[...t[16]||=[W(`use`,{href:`#icon-sparkles`},null,-1)]])),W(`span`,bz,M(a.thinkLabel),1),a.thinking&&!i.thinkOpen?(V(),H(`span`,xz,M(a.peek),1)):q(`v-if`,!0)],8,_z),L(W(`div`,Sz,[W(`pre`,{ref:`thinkPre`},M(n.msg.reasoning),513)],512),[[Nc,i.thinkOpen]])],2)):q(`v-if`,!0),q(` 首个 token 之前的等待态 `),a.waiting?(V(),H(`div`,Cz,[...t[18]||=[W(`span`,{class:`aiwait__dot`},null,-1),W(`span`,{class:`aiwait__dot`},null,-1),W(`span`,{class:`aiwait__dot`},null,-1),W(`span`,{class:`aiwait__text`},`正在思考`,-1)]])):q(`v-if`,!0),q(` 工具调用:平铺单次调用;连续同名 ≥3 次折叠成分组行(长任务里几十次 card_read 不该刷屏)。
349
- 行标记抽到 ChatToolRow:分组内成员与平铺行走同一份模板,两处不会漂移 `),(V(!0),H(B,null,z(a.toolGroups,r=>(V(),H(B,{key:r.key},[r.kind===`row`?(V(),U(o,{key:0,tc:r.tc,"turn-ts":a.msgTs,"now-ts":n.nowTs,"pick-owner":n.pickOwner,onApproval:a.onApproval,onPickBoard:t[1]||=t=>e.$emit(`pick-board`,t)},null,8,[`tc`,`turn-ts`,`now-ts`,`pick-owner`,`onApproval`])):(V(),H(`div`,{key:1,class:j([`aitool aitool--group`,[r.failed?`aitool--error`:`aitool--done`,{"is-open":a.groupOpen(r)}]])},[W(`button`,{type:`button`,class:`aitool__head`,"aria-expanded":a.groupOpen(r)?`true`:`false`,onClick:e=>a.toggleGroup(r)},[t[19]||=W(`svg`,{class:`aitool__chev`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-chevron-right`})],-1),(V(),H(`svg`,Tz,[W(`use`,{href:r.failed?`#icon-alert-triangle`:`#icon-check`},null,8,Ez)])),W(`span`,Dz,M(a.toolLabel(r.toolName)),1),W(`span`,Oz,`×`+M(r.rows.length),1),W(`code`,kz,M(r.failed?`${r.failed} 次失败,点开看原因`:`连续 ${r.rows.length} 次,点开逐条查看`),1),q(` 分组行同样给「首次调用时刻 · 累计到最后一次」:折叠不等于把时间线也折掉 `),r.clock?(V(),H(`span`,{key:0,class:`aitool__clock`,title:`首次调用 ${r.clock.split(` · `)[0]} · 距本轮开始的累计耗时(算到最后一次)`},M(r.clock),9,Az)):q(`v-if`,!0),r.ms?(V(),H(`span`,{key:1,class:`aitool__ms`,title:`${r.rows.length} 次调用合计耗时`},M(a.msText(r.ms)),9,jz)):q(`v-if`,!0)],8,wz),L(W(`div`,Mz,[(V(!0),H(B,null,z(r.rows,r=>(V(),U(o,{key:r.toolCallId,tc:r,"turn-ts":a.msgTs,"now-ts":n.nowTs,"pick-owner":n.pickOwner,onApproval:a.onApproval,onPickBoard:t[2]||=t=>e.$emit(`pick-board`,t)},null,8,[`tc`,`turn-ts`,`now-ts`,`pick-owner`,`onApproval`]))),128))],512),[[Nc,a.groupOpen(r)]])],2))],64))),128)),q(` 紧凑视图折叠掉的读取类调用:留一行出口,一键回到全量视图(不必去面板头部找开关) `),a.hiddenSteps?(V(),H(`button`,{key:2,type:`button`,class:`aitool__hidden`,onClick:t[3]||=t=>e.$emit(`show-all-steps`)},[t[20]||=W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-eye`})],-1),W(`span`,null,`紧凑视图已折叠 `+M(a.hiddenSteps)+` 次读取类调用,点这里显示全部步骤`,1)])):q(`v-if`,!0),q(` 过程事件时间线:后端 notice / round-retry 的持久落点。横幅只留最近一条且 6 秒即逝,
350
- 「上下文折叠过几次 / 自动续跑过几次 / 网关重试过没有」这些线索全靠这里留存 `),a.events.length?(V(),H(`div`,{key:3,class:j([`aiev`,{"is-open":a.eventsExpanded}])},[W(`button`,{type:`button`,class:`aiev__head`,"aria-expanded":a.eventsExpanded?`true`:`false`,onClick:t[4]||=e=>i.eventsOpen=!a.eventsExpanded},[t[21]||=W(`svg`,{class:`aiev__chev`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-chevron-right`})],-1),(V(),H(`svg`,Pz,[W(`use`,{href:a.hasErrorEvent?`#icon-alert-triangle`:`#icon-activity`},null,8,Fz)])),W(`span`,Iz,M(a.eventsLabel),1)],8,Nz),L(W(`ol`,Lz,[(V(!0),H(B,null,z(a.events,(e,t)=>(V(),H(`li`,{key:t,class:j([`aiev__row`,`aiev__row--${e.level}`])},[W(`span`,Rz,M(a.fmtStamp(e.ts)),1),a.evOff(e)?(V(),H(`span`,zz,M(a.evOff(e)),1)):q(`v-if`,!0),W(`span`,Bz,M(e.message),1)],2))),128))],512),[[Nc,a.eventsExpanded]])],2)):q(`v-if`,!0),q(` 过程性正文:模型把推理过程当正文写出来时(实测单回合 46.7 万字),
351
- 把「最后一次工具调用之前」那段折成一行——收尾结论照常展开,记录不再是一堵墙 `),a.narrationText?(V(),H(`div`,{key:4,class:j([`ainarr`,{"is-open":i.narrOpen}])},[W(`button`,{type:`button`,class:`ainarr__head`,"aria-expanded":i.narrOpen?`true`:`false`,title:i.narrOpen?`收起过程说明`:`展开过程说明(模型在本轮工具调用前的推理正文)`,onClick:t[5]||=e=>i.narrOpen=!i.narrOpen},[t[22]||=W(`svg`,{class:`ainarr__chev`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-chevron-right`})],-1),t[23]||=W(`svg`,{class:`ainarr__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-activity`})],-1),W(`span`,Hz,`过程说明 `+M(a.narrationSize)+` 字`,1),W(`span`,Uz,M(i.narrOpen?`收起`:`展开`),1)],8,Vz),L(W(`div`,Wz,[G(s,{source:a.narrationText},null,8,[`source`])],512),[[Nc,i.narrOpen]])],2)):q(`v-if`,!0),q(` 正文:Markdown(流式重渲染 + 代码块高亮 / 复制) `),a.bodyText?(V(),U(s,{key:5,class:j([`aimsg__md`,{"is-streaming":a.streamingText}]),source:a.bodyText,streaming:a.streamingText},null,8,[`class`,`source`,`streaming`])):q(`v-if`,!0),q(` 本次改动摘要:写入次数 / 校验错误 / 门禁结论都从工具行就地算——落盘记录里同样算得出来,
352
- 所以重开面板、刷新之后这条摘要依然在,而不是只在当轮可见 `),a.showSummary?(V(),H(`div`,Gz,[W(`span`,Kz,[t[25]||=W(`svg`,{class:`aisum__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-activity`})],-1),t[26]||=W(`span`,{class:`aisum__title`},`本次改动`,-1),q(` 本轮的时间坐标:几点开始、一共跑了多久。摘要条是回合的收尾锚点,这两个数在这里最有用 `),a.turnClock.stamp?(V(),H(`span`,{key:0,class:`aisum__clock`,title:`本轮 ${a.turnClock.stamp} 开始${a.turnClock.endStamp?`,${a.turnClock.endStamp} 收尾`:``}`},[K(M(a.turnClock.stamp)+` 开始`,1),a.turnClock.total?(V(),H(B,{key:0},[K(` · 累计 `+M(a.turnClock.total),1)],64)):q(`v-if`,!0)],8,qz)):q(`v-if`,!0),W(`span`,Jz,[a.summary.writes?(V(),H(`span`,Yz,`写入 `+M(a.summary.writes)+` 次`,1)):q(`v-if`,!0),a.summary.writeFails?(V(),H(`span`,Xz,`写入失败 `+M(a.summary.writeFails)+` 次`,1)):q(`v-if`,!0),a.summary.shots?(V(),H(`span`,Zz,`截图自检 `+M(a.summary.shots)+` 次`,1)):q(`v-if`,!0),a.summary.validate?(V(),H(`span`,{key:3,class:j([`aisum__chip`,a.summary.validate.ok?`aisum__chip--ok`:`aisum__chip--danger`])},`校验 `+M(a.summary.validate.errors)+` 错 / `+M(a.summary.validate.warnings)+` 警`,3)):q(`v-if`,!0),a.summary.failed?(V(),H(`span`,Qz,M(a.summary.failed)+` 次调用报错`,1)):q(`v-if`,!0),a.cacheBadge?(V(),H(`span`,{key:5,class:j([`aisum__chip`,a.cacheBadge.ok?`aisum__chip--ok`:``]),title:a.cacheBadge.title},M(a.cacheBadge.label),11,$z)):q(`v-if`,!0)]),n.canRollback&&a.summary.writes?(V(),H(`button`,{key:1,type:`button`,class:`aisum__rollback`,title:`取本轮第一次写入前的历史快照,回到 AI 动手之前的版本;回滚本身可再撤销,确认后仍需点「保存到本地」才落盘`,onClick:t[6]||=t=>e.$emit(`rollback`,n.msg)},[...t[24]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-undo`})],-1),W(`span`,null,`回滚到本轮之前`,-1)]])):q(`v-if`,!0)]),q(` 门禁结论原样透出:这是唯一的机器判定,不能被模型自述的「已通过」覆盖 `),a.summary.gate?(V(),H(`p`,{key:0,class:j([`aisum__verdict`,a.summary.gate.passed?`is-pass`:`is-fail`])},[W(`strong`,null,`收尾门禁`+M(a.summary.gate.passed?`通过`:`未通过`),1),a.summary.gate.verdict?(V(),H(B,{key:0},[K(`:`+M(a.summary.gate.verdict),1)],64)):q(`v-if`,!0)],2)):q(`v-if`,!0),q(` 校验问题可点定位(P2-14):校验器在每条消息末尾挂了 #componentId,点「定位」就在画布与
353
- 组件结构里选中那个节点——不用再照着一句 "at depth 1[0]" 自己去树里翻 `),a.validateIssues.length?(V(),H(`div`,eB,[t[28]||=W(`p`,{class:`aisum__issues-head`},[K(`校验问题`),W(`span`,{class:`aisum__issues-hint`},`点图标跳到该节点`)],-1),W(`ul`,tB,[(V(!0),H(B,null,z(a.validateIssues,(n,r)=>(V(),H(`li`,{key:r,class:j([`aisum__issue`,n.level===`error`?`is-error`:`is-warn`])},[W(`span`,nB,M(n.text),1),n.cid?(V(),H(`button`,{key:0,type:`button`,class:`aisum__issue-go`,title:`在画布与组件结构中定位 `+n.cid,"aria-label":`定位该节点`,onClick:t=>e.$emit(`locate-node`,n.cid)},[...t[27]||=[W(`svg`,{class:`aisum__issue-go-icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-locate`})],-1)]],8,rB)):q(`v-if`,!0)],2))),128))]),a.validateMore?(V(),H(`p`,iB,`另有 `+M(a.validateMore)+` 条:展开对应工具行看全部原文`,1)):q(`v-if`,!0)])):q(`v-if`,!0)])):q(`v-if`,!0),n.msg.error?(V(),H(`div`,aB,[t[29]||=W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-alert-triangle`})],-1),W(`span`,oB,[W(`span`,sB,M(n.msg.error),1),q(` 错误分级:后端给 code,这里给「怎么办」与对应的定向动作,不再只丢一句原文让人自己猜 `),a.errorHint?(V(),H(`span`,cB,M(a.errorHint),1)):q(`v-if`,!0),q(` 失败也要有时刻与累计:报网关工单 / 对后端日志时,「几点失败、跑了多久」是第一句要交代的话 `),a.turnClock.endStamp?(V(),H(`span`,lB,M(a.turnClock.endStamp)+` 失败 · 本轮已用 `+M(a.turnClock.total),1)):q(`v-if`,!0),n.streaming?q(`v-if`,!0):(V(),H(`span`,uB,[a.errorAction===`settings`?(V(),H(`button`,{key:0,type:`button`,class:`aimsg__budget-go`,onClick:t[7]||=t=>e.$emit(`open-settings`)},`打开设置`)):q(`v-if`,!0),n.canRegenerate?(V(),H(`button`,{key:1,type:`button`,class:`aimsg__budget-go`,onClick:t[8]||=t=>e.$emit(`regenerate`,n.msg)},`重试本轮`)):q(`v-if`,!0),n.canRegenerate?(V(),H(`button`,{key:2,type:`button`,class:`aimsg__budget-go aimsg__budget-go--ghost`,onClick:t[9]||=t=>e.$emit(`continue`)},`从中断处继续`)):q(`v-if`,!0),W(`button`,{type:`button`,class:`aimsg__budget-go aimsg__budget-go--ghost`,onClick:t[10]||=(...e)=>a.copyError&&a.copyError(...e)},M(i.errorCopied?`已复制`:`复制错误`),1)]))])])):q(`v-if`,!0),q(` 手动终止同样给续跑入口:已落盘产物与上下文都还在,点一下就能接着做。
354
- 此前只有熔断收尾(budget)分支有按钮,手滑终止后用户只能自己打字 `),n.msg.status===`aborted`?(V(),H(`div`,dB,[t[30]||=W(`span`,{class:`aimsg__aborted-text`},`已终止生成`,-1),a.turnClock.endStamp?(V(),H(`span`,fB,M(a.turnClock.endStamp)+` 终止 · 已用 `+M(a.turnClock.total),1)):q(`v-if`,!0),n.canRegenerate&&!n.streaming?(V(),H(`button`,{key:1,type:`button`,class:`aimsg__budget-go`,onClick:t[11]||=t=>e.$emit(`continue`)},`从中断处继续`)):q(`v-if`,!0)])):n.msg.budget?.message?(V(),H(`div`,{key:9,class:`aimsg__budget`,title:a.budgetHint},[t[31]||=W(`svg`,{class:`aimsg__budget-icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-alert-triangle`})],-1),W(`span`,mB,[W(`strong`,null,M(a.budgetLabel),1),K(`:`+M(n.msg.budget.message)+`(上下文已保留)`,1)]),n.canRegenerate&&!n.streaming?(V(),H(`button`,{key:0,type:`button`,class:`aimsg__budget-go`,onClick:t[12]||=t=>e.$emit(`continue`)},`继续这轮`)):q(`v-if`,!0)],8,pB)):q(`v-if`,!0),q(` 悬停操作:复制 / 重新生成(仅最后一条助手消息可重发) `),n.msg.content||n.msg.error?(V(),H(`footer`,hB,[W(`button`,{type:`button`,class:`aimsg__act`,title:i.copied?`已复制`:`复制回答`,onClick:t[13]||=(...e)=>a.copyText&&a.copyText(...e)},[(V(),H(`svg`,_B,[W(`use`,{href:i.copied?`#icon-check`:`#icon-copy-sm`},null,8,vB)])),W(`span`,null,M(i.copied?`已复制`:`复制`),1)],8,gB),n.canRegenerate&&!n.streaming?(V(),H(`button`,{key:0,type:`button`,class:`aimsg__act`,title:`丢弃这次回答并重新生成`,onClick:t[14]||=t=>e.$emit(`regenerate`,n.msg)},[...t[32]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-reset`})],-1),W(`span`,null,`重新生成`,-1)]])):q(`v-if`,!0)])):q(`v-if`,!0)],64))],2)}var bB=Z(sz,[[`render`,yB],[`__file`,`/Users/ynet/dsl-card/card-editor/components/ChatMessage.vue`]]),xB=106,SB=.5,CB=`cardbuddy:ai-composer-height`,wB={name:`ChatComposer`,props:{busy:{type:Boolean,default:!1},model:{type:String,default:``},attachments:{type:Array,default:()=>[]},placeholder:{type:String,default:`描述你要改的卡片,Enter 发送 / Shift+Enter 换行`},context:{type:Object,default:null}},emits:[`send`,`stop`,`pick`,`add-path`,`remove-attachment`,`drop-files`,`paste-image`,`escape`],data(){return{text:``,attachOpen:!1,pathInputOpen:!1,pathText:``,dragOver:!1,heightPx:0,resizing:!1,_outside:null,_onWinResize:null}},computed:{canSend(){return!!(this.text.trim()||this.attachments.some(e=>!e.pending&&e.exists!==!1))},compStyle(){return this.heightPx>0?{height:`${this.heightPx}px`}:null},ctx(){let e=this.context;if(!e)return null;let t=Number(e.window)>0?Number(e.window):Number(e.total)>0?Number(e.total):0,n=Math.max(0,Number(e.used)||0);if(!(t>0))return null;let r=Math.min(1,n/t),i=2*Math.PI*8;return{pct:r,arc:(i*r).toFixed(2),circ:i.toFixed(2),pctLabel:`${Math.round(r*100)}%`,level:r>=.85?`danger`:r>=.6?`warn`:`ok`,used:n,total:t}},ctxTitle(){let e=this.ctx;if(!e)return``;let t=e=>e>=1e3?`${(e/1e3).toFixed(1)}k`:String(Math.round(e)),n=Number(this.context?.window)>0?` · 网关窗口 ${t(Number(this.context.window))}`:``;return`上下文占用 ${t(e.used)} / ${t(e.total)} token(${e.pctLabel})${n};接近上限时后端会自动折叠早期工具结果`}},mounted(){this._outside=e=>{let t=this.$refs.attachEl;t&&!t.contains(e.target)&&(this.attachOpen=!1)},document.addEventListener(`mousedown`,this._outside),this.loadHeight(),this._onWinResize=()=>this.clampHeight(),window.addEventListener(`resize`,this._onWinResize),this.autoGrow()},beforeUnmount(){this._outside&&document.removeEventListener(`mousedown`,this._outside),this._onWinResize&&window.removeEventListener(`resize`,this._onWinResize)},methods:{focus(){this.$nextTick(()=>this.$refs.taEl?.focus())},setText(e){this.text=e,this.focus(),this.autoGrow()},fileUrl(e){return MR(e)},chipSub(e){if(e.exists===!1)return`不可读`;if(e.isDir)return`${e.entryCount??e.entries?.length??0} 项`;let t=Number(e.size||0);return t?t<1024?`${t} B`:t<1048576?`${(t/1024).toFixed(0)} KB`:`${(t/1024/1024).toFixed(1)} MB`:``},autoGrow(){let e=this.$refs.taEl;e&&(this.heightPx>0?e.style.height=``:(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,168)}px`))},heightLimits(){let e=this.$el?.closest(`.aichat`)?.clientHeight||window.innerHeight;return{min:xB,max:Math.max(xB,Math.floor(e*SB))}},clampHeight(){if(!this.heightPx)return;let{min:e,max:t}=this.heightLimits();this.heightPx=Math.max(e,Math.min(t,this.heightPx))},loadHeight(){try{let e=localStorage.getItem(CB),t=e==null?0:parseInt(e,10);!Number.isNaN(t)&&t>=xB&&(this.heightPx=t)}catch{}this.clampHeight()},saveHeight(){try{this.heightPx?localStorage.setItem(CB,String(Math.round(this.heightPx))):localStorage.removeItem(CB)}catch{}},startResize(e){let t=e&&e.currentTarget;if(!t)return;this.resizing=!0,document.body.style.cursor=`row-resize`,document.body.style.userSelect=`none`;let n=e.pointerId;try{t.setPointerCapture(n)}catch{}let r=this.$el.getBoundingClientRect().bottom,i=e=>{let{min:t,max:n}=this.heightLimits();this.heightPx=Math.max(t,Math.min(n,Math.round(r-e.clientY)))},a=()=>{t.removeEventListener(`pointermove`,i),t.removeEventListener(`pointerup`,a),t.removeEventListener(`pointercancel`,a),window.removeEventListener(`blur`,a);try{t.hasPointerCapture?.(n)&&t.releasePointerCapture(n)}catch{}this.resizing=!1,document.body.style.cursor=``,document.body.style.userSelect=``,this.saveHeight()};t.addEventListener(`pointermove`,i),t.addEventListener(`pointerup`,a),t.addEventListener(`pointercancel`,a),window.addEventListener(`blur`,a)},resetHeight(){this.heightPx=0,this.saveHeight(),this.$nextTick(this.autoGrow)},onKeydown(e){e.key===`Escape`?(e.preventDefault(),this.$emit(`escape`)):e.key===`Enter`&&(e.isComposing||e.keyCode===229||e.shiftKey||(e.preventDefault(),this.busy||this.submit()))},submit(){if(this.busy||!this.canSend)return;let e={text:this.text.trim(),attachments:this.attachments.filter(e=>!e.pending&&e.exists!==!1)};this.text=``,this.attachOpen=!1,this.$nextTick(this.autoGrow),this.$emit(`send`,e)},toggleAttach(){this.attachOpen=!this.attachOpen},pick(e){this.attachOpen=!1,this.$emit(`pick`,e)},openPathInput(){this.attachOpen=!1,this.pathInputOpen=!0,this.pathText=``,this.$nextTick(()=>this.$refs.pathEl?.focus())},closePathInput(){this.pathInputOpen=!1,this.pathText=``},confirmPath(){let e=this.pathText.trim();e&&(this.$emit(`add-path`,e),this.closePathInput())},onDragEnter(){this.dragOver=!0},onDragOver(){this.dragOver=!0},onDragLeave(){this.dragOver=!1},onDrop(e){this.dragOver=!1;let t=e.dataTransfer;t&&this.$emit(`drop-files`,t)},async onPaste(e){let t=e.clipboardData?.items;if(t){for(let n of t)if(n.type&&n.type.indexOf(`image/`)===0){let t=n.getAsFile();if(!t)continue;e.preventDefault();let r=await new Promise(e=>{let n=new FileReader;n.onload=()=>e(String(n.result||``)),n.onerror=()=>e(``),n.readAsDataURL(t)});r&&this.$emit(`paste-image`,r);return}}}}},TB={key:0,class:`aicomp__files`},EB=[`title`],DB=[`src`,`alt`],OB={key:1,class:`aichip__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},kB=[`href`],AB={class:`aichip__name`},jB={key:2,class:`aichip__sub`},MB=[`onClick`],NB={key:1,class:`aicomp__path`},PB=[`disabled`],FB=[`placeholder`],IB={class:`aicomp__bar`},LB={class:`aicomp__tools`},RB={class:`aicomp__attach`,ref:`attachEl`},zB={key:0,class:`aicomp__menu`,role:`menu`},BB={class:`aicomp__right`},VB=[`title`],HB={class:`aicomp__ctx-ring`,viewBox:`0 0 20 20`,"aria-hidden":`true`},UB=[`stroke-dasharray`],WB={class:`aicomp__ctx-pct`},GB=[`title`],KB=[`disabled`,`title`];function qB(e,t,n,r,i,a){return V(),H(`div`,{class:j([`aicomp`,{"is-busy":n.busy,"is-drag":i.dragOver,"is-manual":i.heightPx>0,"is-resizing":i.resizing}]),style:A(a.compStyle)},[q(` 上缘拖拽把手:调输入区高度(106px ~ 面板高度 50%,双击恢复自适应),与面板宽度把手同一套交互 `),W(`div`,{class:j([`aicomp__grip`,{"is-dragging":i.resizing}]),title:`拖拽调整输入区高度(双击恢复自适应)`,onPointerdown:t[0]||=J((...e)=>a.startResize&&a.startResize(...e),[`prevent`]),onDblclick:t[1]||=J((...e)=>a.resetHeight&&a.resetHeight(...e),[`prevent`])},null,34),q(` 已挂载的本地文件:只预览 + 传路径,不上传 `),n.attachments.length?(V(),H(`div`,TB,[(V(!0),H(B,null,z(n.attachments,n=>(V(),H(`div`,{key:n.id||n.path,class:j([`aichip`,{"aichip--dir":n.isDir,"aichip--pending":n.pending,"aichip--missing":n.exists===!1}]),title:n.path},[n.isImage&&!n.pending?(V(),H(`img`,{key:0,class:`aichip__thumb`,src:a.fileUrl(n.path),alt:n.name,loading:`lazy`},null,8,DB)):(V(),H(`svg`,OB,[W(`use`,{href:n.pending?`#icon-loading`:n.isDir?`#icon-folder-plus`:n.isImage?`#icon-image`:`#icon-file-text`},null,8,kB)])),W(`span`,AB,M(n.pending?`解析路径中…`:n.name),1),n.pending?q(`v-if`,!0):(V(),H(`span`,jB,M(a.chipSub(n)),1)),W(`button`,{type:`button`,class:`aichip__rm`,title:`移除`,onClick:t=>e.$emit(`remove-attachment`,n.id||n.path)},[...t[22]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-x`})],-1)]],8,MB)],10,EB))),128))])):q(`v-if`,!0),q(` 粘贴绝对路径(非 macOS / 拖拽反查失败时的兜底入口) `),i.pathInputOpen?(V(),H(`div`,NB,[L(W(`input`,{ref:`pathEl`,"onUpdate:modelValue":t[2]||=e=>i.pathText=e,class:`aicomp__path-input`,type:`text`,placeholder:`粘贴本地图片或文件夹的绝对路径,回车确认`,spellcheck:`false`,onKeydown:[t[3]||=jl(J((...e)=>a.confirmPath&&a.confirmPath(...e),[`prevent`]),[`enter`]),t[4]||=jl(J((...e)=>a.closePathInput&&a.closePathInput(...e),[`stop`,`prevent`]),[`esc`])]},null,544),[[gl,i.pathText]]),W(`button`,{type:`button`,class:`aicomp__path-ok`,disabled:!i.pathText.trim(),onClick:t[5]||=(...e)=>a.confirmPath&&a.confirmPath(...e)},`添加`,8,PB),W(`button`,{type:`button`,class:`aicomp__path-no`,onClick:t[6]||=(...e)=>a.closePathInput&&a.closePathInput(...e)},`取消`)])):q(`v-if`,!0),W(`div`,{class:`aicomp__box`,onDragenter:t[18]||=J((...e)=>a.onDragEnter&&a.onDragEnter(...e),[`prevent`]),onDragover:t[19]||=J((...e)=>a.onDragOver&&a.onDragOver(...e),[`prevent`]),onDragleave:t[20]||=J((...e)=>a.onDragLeave&&a.onDragLeave(...e),[`prevent`]),onDrop:t[21]||=J((...e)=>a.onDrop&&a.onDrop(...e),[`prevent`])},[L(W(`textarea`,{ref:`taEl`,"onUpdate:modelValue":t[7]||=e=>i.text=e,class:`aicomp__ta`,placeholder:n.placeholder,rows:`1`,onInput:t[8]||=(...e)=>a.autoGrow&&a.autoGrow(...e),onKeydown:t[9]||=(...e)=>a.onKeydown&&a.onKeydown(...e),onPaste:t[10]||=(...e)=>a.onPaste&&a.onPaste(...e)},null,40,FB),[[gl,i.text]]),W(`div`,IB,[W(`div`,LB,[W(`div`,RB,[W(`button`,{type:`button`,class:j([`aicomp__iconbtn`,{"is-open":i.attachOpen}]),title:`挂载本地图片 / 文件 / 文件夹`,onClick:t[11]||=(...e)=>a.toggleAttach&&a.toggleAttach(...e)},[...t[23]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-paperclip`})],-1)]],2),i.attachOpen?(V(),H(`div`,zB,[W(`button`,{type:`button`,role:`menuitem`,onClick:t[12]||=e=>a.pick(`image`)},[...t[24]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-image`})],-1),K(` 本地图片… `,-1)]]),W(`button`,{type:`button`,role:`menuitem`,onClick:t[13]||=e=>a.pick(`file`)},[...t[25]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-file-text`})],-1),K(` 本地文件… `,-1)]]),W(`button`,{type:`button`,role:`menuitem`,onClick:t[14]||=e=>a.pick(`folder`)},[...t[26]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-folder-plus`})],-1),K(` 本地文件夹… `,-1)]]),t[28]||=W(`div`,{class:`aicomp__menu-sep`},null,-1),W(`button`,{type:`button`,role:`menuitem`,onClick:t[15]||=(...e)=>a.openPathInput&&a.openPathInput(...e)},[...t[27]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-link`})],-1),K(` 粘贴路径… `,-1)]])])):q(`v-if`,!0)],512),t[29]||=W(`span`,{class:`aicomp__hint`},`拖拽文件 / 文件夹到此,或直接 ⌘V 粘贴截图`,-1)]),W(`div`,BB,[a.ctx?(V(),H(`span`,{key:0,class:j([`aicomp__ctx`,`is-${a.ctx.level}`]),title:a.ctxTitle},[(V(),H(`svg`,HB,[t[30]||=W(`circle`,{class:`aicomp__ctx-track`,cx:`10`,cy:`10`,r:`8`},null,-1),W(`circle`,{class:`aicomp__ctx-arc`,cx:`10`,cy:`10`,r:`8`,"stroke-dasharray":`${a.ctx.arc} ${a.ctx.circ}`,transform:`rotate(-90 10 10)`},null,8,UB)])),W(`span`,WB,M(a.ctx.pctLabel),1)],10,VB)):q(`v-if`,!0),n.model?(V(),H(`span`,{key:1,class:`aicomp__model`,title:`当前模型:${n.model}`},M(n.model),9,GB)):q(`v-if`,!0),n.busy?(V(),H(`button`,{key:2,type:`button`,class:`aicomp__send aicomp__send--stop`,title:`终止生成(Esc)`,onClick:t[16]||=t=>e.$emit(`stop`)},[...t[31]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"aria-hidden":`true`},[W(`use`,{href:`#icon-stop`})],-1)]])):(V(),H(`button`,{key:3,type:`button`,class:`aicomp__send`,disabled:!a.canSend,title:a.canSend?`发送(Enter)`:`输入内容后发送`,onClick:t[17]||=(...e)=>a.submit&&a.submit(...e)},[...t[32]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-send`})],-1)]],8,KB))])])],32)],6)}var JB=Z(wB,[[`render`,qB],[`__file`,`/Users/ynet/dsl-card/card-editor/components/ChatComposer.vue`]]),YB={name:`AiSettings`,components:{NumberStepper:J_,Switch:gN},props:{config:{type:Object,default:()=>({baseUrl:``,model:``,hasKey:!1,apiKeyMasked:``})},modelId:{type:String,default:null},initialModel:{type:Object,default:null}},emits:[`close`,`saved`],data(){let e=this.modelId&&this.initialModel||{};return{form:{name:e.name||``,baseUrl:e.baseUrl||``,model:e.model||``,apiKey:``,thinking:e.thinking!==!1,vision:e.vision===!0,maxTokens:e.maxTokensAuto?0:Number(e.maxTokens)>0?Number(e.maxTokens):0},reveal:!1,saving:!1,testing:!1,probing:!1,ping:null,help:null,keyLoaded:!1,submitted:!1,touched:{}}},computed:{title(){return this.modelId?`编辑模型`:`添加模型`},errors(){let e={},t=this.form.baseUrl.trim(),n=this.form.model.trim();return t?/^https?:\/\/[^\s]+$/i.test(t)||(e.baseUrl=`Base URL 需以 http:// 或 https:// 开头`):e.baseUrl=`请填写 Base URL`,n||(e.model=`请填写模型名`),!this.keyLoaded&&!this.form.apiKey.trim()&&(e.apiKey=`请填写 API Key`),e},isValid(){return Object.keys(this.errors).length===0},knownCapLimit(){return(Number(this.config.maxTokensCap)>0?Number(this.config.maxTokensCap):0)||(Number(this.config.maxTokensWindow)>0?Number(this.config.maxTokensWindow):0)},maxTokensOver(){return this.knownCapLimit>0&&this.form.maxTokens>this.knownCapLimit},maxTokensPlaceholder(){let e=Number(this.config.maxTokens)>0?Number(this.config.maxTokens):0;return e>0?`留空 = 自动(当前按 ${e})`:`留空 = 自动`},keyPlaceholder(){return this.keyLoaded?this.form.apiKey?``:`已保存的密钥为空,请填写新密钥`:this.config.hasKey?`已保存(${this.config.apiKeyMasked||`••••`}),回显失败:留空沿用、填写覆盖`:`sk-…`}},created(){this.loadKey()},mounted(){document.addEventListener(`click`,this.onDocClick,!0),document.addEventListener(`keydown`,this.onKeydown)},beforeUnmount(){document.removeEventListener(`click`,this.onDocClick,!0),document.removeEventListener(`keydown`,this.onKeydown)},methods:{toggleHelp(e){this.help=this.help===e?null:e},showError(e){return!!this.errors[e]&&(this.submitted||this.touched[e])},markTouched(e){this.$set(this.touched,e,!0)},onDocClick(e){if(!this.help)return;let t=e.target;t instanceof Element&&t.closest(`.aiset__pop, .aiset__help`)||(this.help=null)},onKeydown(e){e.key===`Escape`&&this.help&&(e.stopPropagation(),this.help=null)},onMaxTokens(e){let t=Number(String(e).trim());this.form.maxTokens=Number.isFinite(t)&&t>=0?Math.round(t):0},async probe(){let e=[];if(this.form.baseUrl.trim()||e.push(`Base URL`),this.form.apiKey.trim()||e.push(`API Key`),this.form.model.trim()||e.push(`模型名`),e.length)this.ping={ok:!1,text:`探测前请先填写:${e.join(` / `)}`};else{this.probing=!0,this.ping=null;try{let e=await UR({baseUrl:this.form.baseUrl,apiKey:this.form.apiKey,model:this.form.model}),t=Number(e.window)>0?Number(e.window):0,n=Number(e.cap)>0?Number(e.cap):0;if(n>0){this.form.maxTokens=n;let r=e.source===`models-meta`?`模型元数据`:e.source===`probe`?`二分试探`:e.source===`halved`?`减半回写`:e.source||`探测`,i=[`接受单次输出上限 ${n}`];t>0&&i.push(`上下文窗口 ${t}`),this.ping={ok:!0,text:`网关${i.join(`、`)}(来源:${r})→ 已填入 ${n};留空则走自动(取 min(上限, ${Number(e.ceiling)>0?e.ceiling:32768}) = ${Number(e.autoMax)>0?e.autoMax:n})`}}else{let n=[];t>0&&n.push(`上下文窗口 ${t}`),e.source===`fallback`?n.push(`网关未接受任何档位(可能是地址 / 密钥 / 模型名有误,或该网关不暴露上限)`):n.push(`未探到网关接受的单次输出上限`),this.ping={ok:!1,text:`${n.join(`;`)}。建议留空走自动:后端按默认值开跑,被网关拒绝时自动减半并记下真实上限`}}}catch(e){this.ping={ok:!1,text:`探测失败:${e.message||e}`}}finally{this.probing=!1}}},async loadKey(){if(this.modelId)try{let e=await RR(this.modelId,!0),t=typeof e.apiKey==`string`?e.apiKey:``;t&&(this.form.apiKey=t,this.keyLoaded=!0),typeof e.name==`string`&&(this.form.name=e.name),typeof e.baseUrl==`string`&&(this.form.baseUrl=e.baseUrl),typeof e.model==`string`&&(this.form.model=e.model),this.form.maxTokens=e.maxTokensAuto||!(Number(e.maxTokens)>0)?0:Number(e.maxTokens),e.thinking!==void 0&&(this.form.thinking=e.thinking!==!1),e.vision!==void 0&&(this.form.vision=e.vision===!0)}catch{}},payload(){let e={name:this.form.name.trim(),baseUrl:this.form.baseUrl.trim(),model:this.form.model.trim(),thinking:!!this.form.thinking,vision:!!this.form.vision,maxTokens:Number(this.form.maxTokens)>0?Number(this.form.maxTokens):0};return(this.keyLoaded||this.form.apiKey.trim())&&(e.apiKey=this.form.apiKey.trim()),e},async test(){if(!this.isValid)this.submitted=!0,this.help=null,this.ping={ok:!1,text:`请先补全必填项(Base URL / 模型名 / API Key)再测试连接`};else{this.testing=!0,this.ping=null;try{let e=await WR(this.payload());this.ping=e.ok?{ok:!0,text:`连接正常 · ${e.model||this.form.model} · ${e.latencyMs}ms`}:{ok:!1,text:`连接失败${e.status?`(HTTP ${e.status})`:``}:${e.message||`未知错误`}`}}catch(e){this.ping={ok:!1,text:`测试失败:${e.message||e}`}}finally{this.testing=!1}}},async save(){if(this.submitted=!0,!this.isValid){this.help=null;let e={baseUrl:`aiset-baseurl`,model:`aiset-model`,apiKey:`aiset-key`},t=Object.keys(this.errors)[0],n=t?this.$el.querySelector(`#${e[t]}`):null;n&&typeof n.focus==`function`&&n.focus(),this.ping={ok:!1,text:`请先补全必填项(Base URL / 模型名 / API Key)`}}else{this.saving=!0;try{let e=this.modelId?await BR(this.modelId,this.payload()):await zR(this.payload());this.$emit(`saved`,e)}catch(e){this.ping={ok:!1,text:`保存失败:${e.message||e}`}}finally{this.saving=!1}}}}},XB={class:`aiset__mask`},ZB={class:`aiset`,role:`dialog`,"aria-modal":`true`,"aria-label":`AI 模型设置`},QB={class:`aiset__head`},$B={class:`aiset__title`},eV={class:`aiset__body`},tV={class:`aiset__field`},nV={class:`aiset__field`},rV={class:`aiset__labelrow`},iV=[`aria-expanded`],aV=[`aria-invalid`],oV={key:0,class:`aiset__errline`},sV={key:1,class:`aiset__pop`},cV={class:`aiset__field`},lV={class:`aiset__labelrow`},uV=[`aria-expanded`],dV=[`aria-invalid`],fV={key:0,class:`aiset__errline`},pV={key:1,class:`aiset__pop`},mV={class:`aiset__field`},hV={class:`aiset__labelrow`},gV=[`aria-expanded`],_V={class:`aiset__keywrap`},vV=[`type`,`placeholder`,`aria-invalid`],yV=[`title`,`aria-pressed`],bV={viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},xV=[`href`],SV={key:0,class:`aiset__errline`},CV={key:1,class:`aiset__pop`},wV={class:`aiset__field`},TV={class:`aiset__labelrow`},EV=[`aria-expanded`],DV={class:`aiset__stepperrow`},OV=[`disabled`],kV={key:0,class:`aiset__warnline`},AV={key:1,class:`aiset__pop`},jV={class:`aiset__field`},MV={class:`aiset__labelrow`},NV=[`aria-expanded`],PV={key:0,class:`aiset__pop`},FV={class:`aiset__field`},IV={class:`aiset__labelrow`},LV=[`aria-expanded`],RV={key:0,class:`aiset__pop`},zV={viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},BV=[`href`],VV={class:`aiset__foot`},HV=[`disabled`],UV={class:`aiset__btn-icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},WV=[`href`],GV=[`disabled`],KV=[`disabled`];function qV(e,t,n,r,i,a){let o=R(`NumberStepper`),s=R(`Switch`);return V(),H(`div`,XB,[W(`section`,ZB,[W(`header`,QB,[t[22]||=W(`svg`,{class:`aiset__head-icon is-solid-icon`,viewBox:`0 0 1024 1024`,"aria-hidden":`true`},[W(`use`,{href:`#icon-model`})],-1),W(`span`,$B,M(a.title),1),W(`button`,{type:`button`,class:`aiset__x`,title:`关闭`,onClick:t[0]||=t=>e.$emit(`close`)},[...t[21]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-x`})],-1)]])]),q(` 字段说明一律收进「?」浮层:面板只留标签 + 控件,需要时点开看详情 `),W(`div`,eV,[W(`div`,tV,[t[23]||=W(`div`,{class:`aiset__labelrow`},[W(`label`,{class:`aiset__label`,for:`aiset-name`},`名称`)],-1),L(W(`input`,{id:`aiset-name`,"onUpdate:modelValue":t[1]||=e=>i.form.name=e,class:`aiset__input`,type:`text`,placeholder:`模型显示名(如 GPT-4o / 我的 GLM)`,spellcheck:`false`,autocomplete:`off`},null,512),[[gl,i.form.name]])]),W(`div`,nV,[W(`div`,rV,[t[25]||=W(`label`,{class:`aiset__label`,for:`aiset-baseurl`},[K(`Base URL`),W(`i`,{class:`aiset__req`,"aria-hidden":`true`},`*`)],-1),W(`button`,{type:`button`,class:j([`aiset__help`,{"is-on":i.help===`baseUrl`}]),"aria-expanded":i.help===`baseUrl`,title:`查看说明`,onClick:t[2]||=J(e=>a.toggleHelp(`baseUrl`),[`stop`])},[...t[24]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-help`})],-1)]],10,iV)]),L(W(`input`,{id:`aiset-baseurl`,"onUpdate:modelValue":t[3]||=e=>i.form.baseUrl=e,class:j([`aiset__input`,{"is-invalid":a.showError(`baseUrl`)}]),type:`text`,placeholder:`https://api.example.com/v1`,spellcheck:`false`,autocomplete:`off`,"aria-invalid":a.showError(`baseUrl`)?`true`:`false`,onBlur:t[4]||=e=>a.markTouched(`baseUrl`)},null,42,aV),[[gl,i.form.baseUrl]]),a.showError(`baseUrl`)?(V(),H(`p`,oV,M(a.errors.baseUrl),1)):q(`v-if`,!0),i.help===`baseUrl`?(V(),H(`p`,sV,[...t[26]||=[K(`OpenAI 兼容网关的基址,`,-1),W(`strong`,null,`不含`,-1),K(),W(`code`,null,`/chat/completions`,-1),K(` 后缀(后端会自己拼)。例:`,-1),W(`code`,null,`https://api.openai.com/v1`,-1),K(`。`,-1)]])):q(`v-if`,!0)]),W(`div`,cV,[W(`div`,lV,[t[28]||=W(`label`,{class:`aiset__label`,for:`aiset-model`},[K(`模型名`),W(`i`,{class:`aiset__req`,"aria-hidden":`true`},`*`)],-1),W(`button`,{type:`button`,class:j([`aiset__help`,{"is-on":i.help===`model`}]),"aria-expanded":i.help===`model`,title:`查看说明`,onClick:t[5]||=J(e=>a.toggleHelp(`model`),[`stop`])},[...t[27]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-help`})],-1)]],10,uV)]),L(W(`input`,{id:`aiset-model`,"onUpdate:modelValue":t[6]||=e=>i.form.model=e,class:j([`aiset__input`,{"is-invalid":a.showError(`model`)}]),type:`text`,placeholder:`gpt-4o / GLM-4.6 / deepseek-chat`,spellcheck:`false`,autocomplete:`off`,"aria-invalid":a.showError(`model`)?`true`:`false`,onBlur:t[7]||=e=>a.markTouched(`model`)},null,42,dV),[[gl,i.form.model]]),a.showError(`model`)?(V(),H(`p`,fV,M(a.errors.model),1)):q(`v-if`,!0),i.help===`model`?(V(),H(`p`,pV,`必须与网关侧的模型标识完全一致。建卡这类多步工具调用建议用支持 function calling 的模型。`)):q(`v-if`,!0)]),W(`div`,mV,[W(`div`,hV,[t[30]||=W(`label`,{class:`aiset__label`,for:`aiset-key`},[K(`API Key`),W(`i`,{class:`aiset__req`,"aria-hidden":`true`},`*`)],-1),W(`button`,{type:`button`,class:j([`aiset__help`,{"is-on":i.help===`apiKey`}]),"aria-expanded":i.help===`apiKey`,title:`查看说明`,onClick:t[8]||=J(e=>a.toggleHelp(`apiKey`),[`stop`])},[...t[29]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-help`})],-1)]],10,gV)]),W(`div`,_V,[L(W(`input`,{id:`aiset-key`,"onUpdate:modelValue":t[9]||=e=>i.form.apiKey=e,class:j([`aiset__input aiset__input--key`,{"is-invalid":a.showError(`apiKey`)}]),type:i.reveal?`text`:`password`,placeholder:a.keyPlaceholder,spellcheck:`false`,autocomplete:`off`,"aria-invalid":a.showError(`apiKey`)?`true`:`false`,onBlur:t[10]||=e=>a.markTouched(`apiKey`)},null,42,vV),[[Tl,i.form.apiKey]]),W(`button`,{type:`button`,class:`aiset__eye`,title:i.reveal?`掩码显示密钥`:`明文显示密钥`,"aria-pressed":i.reveal,onClick:t[11]||=e=>i.reveal=!i.reveal},[(V(),H(`svg`,bV,[W(`use`,{href:i.reveal?`#icon-eye-off`:`#icon-eye`},null,8,xV)]))],8,yV)]),a.showError(`apiKey`)?(V(),H(`p`,SV,M(a.errors.apiKey),1)):q(`v-if`,!0),i.help===`apiKey`?(V(),H(`p`,CV,[...t[31]||=[K(` 密钥保存在项目根 `,-1),W(`code`,null,`.env.cb.local`,-1),K(`(个人覆盖层,已被 .gitignore 忽略,不会进版本库)。 打开面板自动回填已保存的密钥(默认掩码),点输入框尾部小眼睛切换明文;`,-1),W(`strong`,null,`清空后保存即删除`,-1),K(`已保存的密钥。 `,-1)]])):q(`v-if`,!0)]),W(`div`,wV,[W(`div`,TV,[t[33]||=W(`label`,{class:`aiset__label`},`单次输出上限`,-1),t[34]||=W(`span`,{class:`aiset__unit`},`max_tokens`,-1),W(`button`,{type:`button`,class:j([`aiset__help`,{"is-on":i.help===`maxTokens`}]),"aria-expanded":i.help===`maxTokens`,title:`查看说明`,onClick:t[12]||=J(e=>a.toggleHelp(`maxTokens`),[`stop`])},[...t[32]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-help`})],-1)]],10,EV)]),W(`div`,DV,[G(o,{id:`aiset-maxtok`,class:`aiset__stepper`,value:i.form.maxTokens>0?String(i.form.maxTokens):``,step:1024,min:0,max:262144,placeholder:a.maxTokensPlaceholder,onInput:a.onMaxTokens},null,8,[`value`,`placeholder`,`onInput`]),W(`button`,{type:`button`,class:`aiset__btn`,disabled:i.probing||i.saving||i.testing,onClick:t[13]||=(...e)=>a.probe&&a.probe(...e)},M(i.probing?`探测中…`:`探测`),9,OV)]),a.maxTokensOver?(V(),H(`p`,kV,` 超过网关已知上限 `+M(a.knownCapLimit)+`:对话时会主动夹取到该值,建议留空走自动 `,1)):q(`v-if`,!0),i.help===`maxTokens`?(V(),H(`p`,AV,[t[35]||=W(`strong`,null,`普通用户不用管这一项:留空 = 自动`,-1),t[36]||=K(`。后端自己协商:先读网关 `,-1),t[37]||=W(`code`,null,`/v1/models`,-1),t[38]||=K(` 的上下文窗口(免费、毫秒级,最多等 2 秒,超时先用默认 24576 开跑), 拿到后取 `,-1),t[39]||=W(`code`,null,`min(窗口, 32768)`,-1),t[40]||=K(` 当作单次输出上限(输出预算 ≠ 上下文窗口,建卡一轮 32k 足够)。 读不到元数据也不会偷偷发试探请求;想知道窗口多大就点「探测」做一次二分试探(会产生一次真实补全,约十几秒)。 手填值超过网关接受上限时,对话开跑前会主动夹取并说明;真被 400 拒绝才会自动减半重试, 减半成功的值记为「接受上限」(**不是窗口**:窗口与输出上限是两回事,有网关窗口 262144 但 max_tokens 硬上限 131072)。 只有某轮明确报「被单次输出上限截断」才需要手填更大值。注意:推理模型的思考过程也算进这个上限。 `,-1),t[41]||=W(`br`,null,null,-1),t[42]||=W(`strong`,null,[K(`注意:`),W(`code`,null,`32768`),K(` 是自动模式的「封顶假设值」,不是网关能力上限。`)],-1),t[43]||=K(` 真实上限只能实测得到,请以「接受的单次输出上限」为准(如 qwen-max 实测仅 8192)。 `,-1),t[44]||=W(`br`,null,null,-1),t[45]||=K(`当前自动生效值:`,-1),W(`strong`,null,M(n.config.maxTokens>0?n.config.maxTokens:24576),1),K(`; 网关上下文窗口:`+M(n.config.maxTokensWindow>0?n.config.maxTokensWindow:`未拿到(网关可能不提供元数据)`)+`; 接受的单次输出上限:`+M(n.config.maxTokensCap>0?n.config.maxTokensCap:`未知(点「探测」,或撞过一次 400 后自动回写)`)+`。 `,1)])):q(`v-if`,!0)]),W(`div`,jV,[q(` 仅「勾选框 + 标题」包进 label:点说明 / 问号不应误触开关 `),W(`div`,MV,[t[47]||=W(`span`,{class:`aiset__label`},`深度思考`,-1),W(`button`,{type:`button`,class:j([`aiset__help`,{"is-on":i.help===`thinking`}]),"aria-expanded":i.help===`thinking`,title:`查看说明`,onClick:t[14]||=J(e=>a.toggleHelp(`thinking`),[`stop`])},[...t[46]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-help`})],-1)]],10,NV),G(s,{modelValue:i.form.thinking,"onUpdate:modelValue":t[15]||=e=>i.form.thinking=e,class:`aiset__switch`},null,8,[`modelValue`])]),i.help===`thinking`?(V(),H(`p`,PV,[...t[48]||=[K(` 开启:模型先长篇推理再动手,规划更稳但慢很多、更费 token。关闭:直接出结果,实测同一网关快数倍。 关闭依赖网关支持 `,-1),W(`code`,null,`chat_template_kwargs.enable_thinking`,-1),K(`(vLLM / SGLang 系);网关不认时后端会自动回退成带思考并在对话里提示一次。 另外,`,-1),W(`strong`,null,`某一轮思考超时`,-1),K(`时后端会自动只在那一轮关闭深度思考并重试,逼出结果。 `,-1)]])):q(`v-if`,!0)]),W(`div`,FV,[W(`div`,IV,[t[50]||=W(`span`,{class:`aiset__label`},`多模态视觉`,-1),W(`button`,{type:`button`,class:j([`aiset__help`,{"is-on":i.help===`vision`}]),"aria-expanded":i.help===`vision`,title:`查看说明`,onClick:t[16]||=J(e=>a.toggleHelp(`vision`),[`stop`])},[...t[49]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-help`})],-1)]],10,LV),G(s,{modelValue:i.form.vision,"onUpdate:modelValue":t[17]||=e=>i.form.vision=e,class:`aiset__switch`},null,8,[`modelValue`])]),i.help===`vision`?(V(),H(`p`,RV,[...t[51]||=[K(` 开启后首轮对话会`,-1),W(`strong`,null,`自动探测`,-1),K(`网关是否真支持图像(比较带图 / 不带图的 prompt_tokens):支持则把渲染截图、设计稿 vs 渲染并排对比图、你挂载的图片注入上下文,AI 可直接读图找差异; 不支持会自动降级为数值闭环(pixelDiff.match)并在对话里提示一次。注入前降采样到长边 ≤ 1024px / ≤ 900KB,每轮最多 2 张;对话记录落盘不含图像。 `,-1)]])):q(`v-if`,!0)]),i.ping?(V(),H(`div`,{key:0,class:j([`aiset__ping`,i.ping.ok?`is-ok`:`is-bad`])},[(V(),H(`svg`,zV,[W(`use`,{href:i.ping.ok?`#icon-check`:`#icon-alert-triangle`},null,8,BV)])),W(`span`,null,M(i.ping.text),1)],2)):q(`v-if`,!0)]),W(`footer`,VV,[W(`button`,{type:`button`,class:`aiset__btn`,disabled:i.testing||i.saving,onClick:t[18]||=(...e)=>a.test&&a.test(...e)},[(V(),H(`svg`,UV,[W(`use`,{href:i.testing?`#icon-loading`:`#icon-activity`},null,8,WV)])),W(`span`,null,M(i.testing?`测试中…`:`测试连接`),1)],8,HV),t[52]||=W(`span`,{class:`aiset__foot-gap`},null,-1),W(`button`,{type:`button`,class:`aiset__btn`,disabled:i.saving,onClick:t[19]||=t=>e.$emit(`close`)},`取消`,8,GV),W(`button`,{type:`button`,class:`aiset__btn aiset__btn--primary`,disabled:i.saving||i.testing,onClick:t[20]||=(...e)=>a.save&&a.save(...e)},M(i.saving?`保存中…`:`保存`),9,KV)])])])}var JV=Z(YB,[[`render`,qV],[`__file`,`/Users/ynet/dsl-card/card-editor/components/AiSettings.vue`]]),YV={name:`ModelList`,props:{models:{type:Array,default:()=>[]},activeId:{type:String,default:null},turnRunning:{type:Boolean,default:!1}},emits:[`add`,`edit`,`delete`,`activate`,`close`,`open-common`,`import-ccswitch`],methods:{locked(e){return!!(this.turnRunning&&e&&e.id===this.activeId)},hostOf(e){let t=String(e||``).trim();if(!t)return`未填地址`;try{return new URL(t).host}catch{return t.replace(/^https?:\/\//,``).replace(/\/+$/,``)||t}}}},XV={class:`aiset__mask`},ZV={class:`aiset modellist`,role:`dialog`,"aria-modal":`true`,"aria-label":`模型选择`},QV={class:`aiset__head`},$V={class:`aiset__body ml__body`},eH={class:`ml__toolbar`},tH={key:0,class:`ml__lock`,role:`status`},nH={key:1,class:`empty-state`},rH={class:`ml__list`},iH=[`aria-disabled`,`onClick`],aH={key:0,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`,"stroke-linecap":`round`,"stroke-linejoin":`round`},oH={class:`ml__info`},sH={class:`ml__name`},cH={class:`ml__meta`},lH={class:`ml__model`},uH={class:`ml__host`},dH={key:0,class:`ml__key`,title:`已配置密钥`},fH={key:1,class:`ml__key ml__key--off`,title:`未配置密钥`},pH={key:2,class:`ml__key ml__key--lock`,title:`对话进行中,正在使用的模型已锁定`},mH={class:`ml__actions`},hH=[`disabled`,`title`,`onClick`],gH=[`disabled`,`title`,`onClick`],_H={class:`ml__foot`},vH={class:`ml__hint`};function yH(e,t,n,r,i,a){return V(),H(`div`,XV,[W(`section`,ZV,[W(`header`,QV,[t[5]||=W(`svg`,{class:`aiset__head-icon is-solid-icon`,viewBox:`0 0 1024 1024`,"aria-hidden":`true`},[W(`use`,{href:`#icon-model`})],-1),t[6]||=W(`span`,{class:`aiset__title`},`模型`,-1),W(`button`,{type:`button`,class:`aiset__x`,title:`关闭`,onClick:t[0]||=t=>e.$emit(`close`)},[...t[4]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-x`})],-1)]])]),W(`div`,$V,[q(` 操作工具条:添加模型 / 从 cc-switch 导入,靠右对齐 `),W(`div`,eH,[W(`button`,{type:`button`,class:`ml__import`,title:`从 cc-switch 导入`,onClick:t[1]||=t=>e.$emit(`import-ccswitch`)},[...t[7]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-download`})],-1),W(`span`,null,`导入`,-1)]]),W(`button`,{type:`button`,class:`ml__add`,title:`添加模型`,onClick:t[2]||=t=>e.$emit(`add`)},[...t[8]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-plus`})],-1),W(`span`,null,`添加模型`,-1)]])]),q(` 对话进行中:正在使用的模型被锁,说明原因与解除方式,避免用户反复点却没反应 `),n.turnRunning?(V(),H(`div`,tH,[...t[9]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-alert-triangle`})],-1),W(`span`,null,`有对话正在进行:正在使用的模型已锁定,本轮结束后可切换或修改。其他模型仍可编辑。`,-1)]])):q(`v-if`,!0),q(` 空状态:与其他面板占位(图标 + 文字)同一语言 `),n.models.length?(V(),H(B,{key:2},[q(` 模型列表:参考 cc-switch 的 provider 列表——每条可编辑 / 删除,当前生效项高亮 `),W(`ul`,rH,[(V(!0),H(B,null,z(n.models,r=>(V(),H(`li`,{key:r.id,class:j([`ml__item`,{"is-active":r.id===n.activeId,"is-locked":a.locked(r)}]),"aria-disabled":a.locked(r)?`true`:`false`,onClick:t=>e.$emit(`activate`,r)},[W(`span`,{class:j([`ml__check`,{"is-on":r.id===n.activeId}]),"aria-hidden":`true`},[r.id===n.activeId?(V(),H(`svg`,aH,[...t[11]||=[W(`use`,{href:`#icon-check`},null,-1)]])):q(`v-if`,!0)],2),W(`span`,oH,[W(`span`,sH,M(r.name||r.model||`未命名模型`),1),W(`span`,cH,[W(`span`,lH,M(r.model||`未填模型名`),1),t[12]||=W(`span`,{class:`ml__dot`},`·`,-1),W(`span`,uH,M(a.hostOf(r.baseUrl)),1),r.hasKey?(V(),H(`span`,dH,`已配密钥`)):(V(),H(`span`,fH,`无密钥`)),a.locked(r)?(V(),H(`span`,pH,`运行中 · 锁定`)):q(`v-if`,!0)])]),W(`span`,mH,[W(`button`,{type:`button`,class:`ml__btn`,disabled:a.locked(r),title:a.locked(r)?`对话进行中,正在使用的模型不可编辑`:`编辑`,onClick:J(t=>e.$emit(`edit`,r),[`stop`])},[...t[13]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-edit`})],-1)]],8,hH),W(`button`,{type:`button`,class:`ml__btn ml__btn--danger`,disabled:a.locked(r),title:a.locked(r)?`对话进行中,正在使用的模型不可删除`:`删除`,onClick:J(t=>e.$emit(`delete`,r),[`stop`])},[...t[14]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-trash`})],-1)]],8,gH)])],10,iH))),128))])],2112)):(V(),H(`div`,nH,[...t[10]||=[_s(`<span class="empty-state__badge" aria-hidden="true"><svg class="is-solid-icon" viewBox="0 0 1024 1024"><use href="#icon-model"></use></svg></span><p class="debug__empty">还没有模型</p><p class="empty-state__hint">点上方「添加模型」配置第一个 AI 模型(Base URL / API Key / 模型名),或「导入」从 cc-switch 拉取已有的 Codex 供应商。配置保存在项目根 .env.cb.local,不进版本库。</p>`,3)]]))]),W(`footer`,_H,[W(`span`,vH,M(n.turnRunning?`对话进行中:正在使用的模型已锁定,无法切换`:`点击任意模型即可切换为当前生效模型`),1),W(`button`,{type:`button`,class:`ml__common`,title:`通用设置(执行策略 / 环境参数,所有模型共享)`,onClick:t[3]||=t=>e.$emit(`open-common`)},[...t[15]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-settings`})],-1),W(`span`,null,`通用设置`,-1)]])])])])}var bH=Z(YV,[[`render`,yH],[`__file`,`/Users/ynet/dsl-card/card-editor/components/ModelList.vue`]]),xH=6e4,SH={name:`AiCommonSettings`,components:{NumberStepper:J_,Switch:gN},emits:[`close`,`saved`],data(){return{form:{allowShell:!0,autoApprove:`all`,maxSteps:0,turnTimeoutMin:60,stallTimeoutMin:120,stallRetries:-1,reasoningTimeoutMin:600,autoContinueMax:-1},saving:!1,ping:null,help:null,adv:!1,approveOptions:[{value:`none`,label:`逐次确认`},{value:`skill`,label:`免技能`},{value:`all`,label:`全免确认`}]}},created(){this.loadConfig()},mounted(){document.addEventListener(`click`,this.onDocClick,!0),document.addEventListener(`keydown`,this.onKeydown)},beforeUnmount(){document.removeEventListener(`click`,this.onDocClick,!0),document.removeEventListener(`keydown`,this.onKeydown)},methods:{toggleHelp(e){this.help=this.help===e?null:e},onDocClick(e){if(!this.help)return;let t=e.target;t instanceof Element&&t.closest(`.aiset__pop, .aiset__help`)||(this.help=null)},onKeydown(e){e.key===`Escape`&&this.help&&(e.stopPropagation(),this.help=null)},onInt(e,t){let n=String(t).trim();if(!n){this.form[e]=e===`stallRetries`||e===`autoContinueMax`?-1:0;return}let r=Number(n);this.form[e]=Number.isFinite(r)?Math.round(r):0},async loadConfig(){try{let e=await PR();e.shellEnabled!==void 0&&(this.form.allowShell=e.shellEnabled!==!1),e.autoApprove&&(this.form.autoApprove=e.autoApprove),Number(e.maxSteps)>0&&(this.form.maxSteps=Number(e.maxSteps)),Number(e.turnTimeoutMs)>0&&(this.form.turnTimeoutMin=Math.round(Number(e.turnTimeoutMs)/xH)),Number(e.stallTimeoutMs)>0&&(this.form.stallTimeoutMin=Math.round(Number(e.stallTimeoutMs)/xH)),e.stallRetries!==void 0&&e.stallRetries>=0&&(this.form.stallRetries=Number(e.stallRetries)),Number(e.reasoningTimeoutMs)>0&&(this.form.reasoningTimeoutMin=Math.round(Number(e.reasoningTimeoutMs)/xH)),e.autoContinueMax!==void 0&&e.autoContinueMax>=0&&(this.form.autoContinueMax=Number(e.autoContinueMax))}catch{}},async save(){this.saving=!0,this.ping=null;try{let e=await FR({allowShell:!!this.form.allowShell,autoApprove:this.form.autoApprove,maxSteps:Number(this.form.maxSteps)>0?Number(this.form.maxSteps):0,turnTimeoutMs:Number(this.form.turnTimeoutMin)>0?Number(this.form.turnTimeoutMin)*xH:0,stallTimeoutMs:Number(this.form.stallTimeoutMin)>0?Number(this.form.stallTimeoutMin)*xH:0,stallRetries:Number(this.form.stallRetries)>=0?Number(this.form.stallRetries):-1,reasoningTimeoutMs:Number(this.form.reasoningTimeoutMin)>0?Number(this.form.reasoningTimeoutMin)*xH:0,autoContinueMax:Number(this.form.autoContinueMax)>=0?Number(this.form.autoContinueMax):-1});this.$emit(`saved`,e)}catch(e){this.ping={ok:!1,text:`保存失败:${e.message||e}`}}finally{this.saving=!1}}}},CH={class:`aiset__mask`},wH={class:`aiset`,role:`dialog`,"aria-modal":`true`,"aria-label":`AI 通用设置`},TH={class:`aiset__head`},EH={class:`aiset__body`},DH={class:`aiset__field`},OH={class:`aiset__labelrow`},kH=[`aria-expanded`],AH={key:0,class:`aiset__pop`},jH={class:`aiset__field`},MH={class:`aiset__labelrow`},NH=[`aria-expanded`],PH={class:`aiset__seg`},FH=[`onClick`],IH={key:0,class:`aiset__pop`},LH={class:`aiset__adv`},RH=[`aria-expanded`],zH={class:`aiset__adv-hint`},BH={key:0,class:`aiset__adv-body`},VH={class:`aiset__field`},HH={class:`aiset__labelrow`},UH=[`aria-expanded`],WH={class:`aiset__stepperrow`},GH={key:0,class:`aiset__pop`},KH={class:`aiset__field`},qH={class:`aiset__labelrow`},JH=[`aria-expanded`],YH={class:`aiset__stepperrow`},XH={key:0,class:`aiset__pop`},ZH={class:`aiset__field`},QH={class:`aiset__labelrow`},$H=[`aria-expanded`],eU={class:`aiset__stepperrow`},tU={key:0,class:`aiset__pop`},nU={class:`aiset__field`},rU={class:`aiset__labelrow`},iU=[`aria-expanded`],aU={class:`aiset__stepperrow`},oU={key:0,class:`aiset__pop`},sU={class:`aiset__field`},cU={class:`aiset__labelrow`},lU=[`aria-expanded`],uU={class:`aiset__stepperrow`},dU={key:0,class:`aiset__pop`},fU={class:`aiset__field`},pU={class:`aiset__labelrow`},mU=[`aria-expanded`],hU={class:`aiset__stepperrow`},gU={key:0,class:`aiset__pop`},_U={viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},vU=[`href`],yU={class:`aiset__foot`},bU=[`disabled`],xU=[`disabled`];function SU(e,t,n,r,i,a){let o=R(`Switch`),s=R(`NumberStepper`);return V(),H(`div`,CH,[W(`section`,wH,[W(`header`,TH,[t[20]||=W(`svg`,{class:`aiset__head-icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-settings`})],-1),t[21]||=W(`span`,{class:`aiset__title`},`通用设置`,-1),W(`button`,{type:`button`,class:`aiset__x`,title:`关闭`,onClick:t[0]||=t=>e.$emit(`close`)},[...t[19]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-x`})],-1)]])]),W(`div`,EH,[t[51]||=W(`p`,{class:`aiset__note`},[K(`以下为`),W(`strong`,null,`所有模型共享`),K(`的执行策略 / 环境参数,与具体模型无关,故不放在每个模型条目里。`)],-1),W(`div`,DH,[W(`div`,OH,[t[23]||=W(`span`,{class:`aiset__label`},`本地命令执行`,-1),W(`button`,{type:`button`,class:j([`aiset__help`,{"is-on":i.help===`allowShell`}]),"aria-expanded":i.help===`allowShell`,title:`查看说明`,onClick:t[1]||=J(e=>a.toggleHelp(`allowShell`),[`stop`])},[...t[22]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-help`})],-1)]],10,kH),G(o,{modelValue:i.form.allowShell,"onUpdate:modelValue":t[2]||=e=>i.form.allowShell=e,class:`aiset__switch`},null,8,[`modelValue`])]),i.help===`allowShell`?(V(),H(`p`,AH,[...t[24]||=[K(` 是否注册 `,-1),W(`code`,null,`shell_exec`,-1),K(` 本地命令执行。默认开(工具只监听 127.0.0.1,命令过白名单 + 全量审计)。 关掉后 AI 不能跑本地命令,但仍可执行技能脚本(由 `,-1),W(`code`,null,`autoApprove`,-1),K(` 控制是否逐次确认)。 `,-1)]])):q(`v-if`,!0)]),W(`div`,jH,[W(`div`,MH,[t[26]||=W(`span`,{class:`aiset__label`},`免确认执行策略`,-1),W(`button`,{type:`button`,class:j([`aiset__help`,{"is-on":i.help===`autoApprove`}]),"aria-expanded":i.help===`autoApprove`,title:`查看说明`,onClick:t[3]||=J(e=>a.toggleHelp(`autoApprove`),[`stop`])},[...t[25]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-help`})],-1)]],10,NH)]),W(`div`,PH,[(V(!0),H(B,null,z(i.approveOptions,e=>(V(),H(`button`,{key:e.value,type:`button`,class:j([`aiset__seg-btn`,{"is-on":i.form.autoApprove===e.value}]),onClick:t=>i.form.autoApprove=e.value},M(e.label),11,FH))),128))]),i.help===`autoApprove`?(V(),H(`p`,IH,[...t[27]||=[W(`code`,null,`none`,-1),K(`=逐次弹审批;`,-1),W(`code`,null,`skill`,-1),K(`=只免技能脚本;`,-1),W(`code`,null,`all`,-1),K(`=技能脚本 + 本地命令都免确认(默认)。 建卡管线连跑十几次脚本 / 命令,`,-1),W(`code`,null,`all`,-1),K(` 避免每次等用户点「允许」。 `,-1)]])):q(`v-if`,!0)]),q(` 保活 / 预算阈值:实测调优出来的值,改只会变坏,故默认收起。
355
- 全部有代码默认值,留空即走默认;折叠区保留可写入口,真要调时不用去翻 .env `),W(`div`,LH,[W(`button`,{type:`button`,class:`aiset__adv-head`,"aria-expanded":i.adv,onClick:t[4]||=e=>i.adv=!i.adv},[(V(),H(`svg`,{class:j([`aiset__adv-caret`,{"is-open":i.adv}]),viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[...t[28]||=[W(`use`,{href:`#icon-chevron-right`},null,-1)]],2)),t[29]||=W(`span`,{class:`aiset__adv-title`},`高级:保活与预算阈值`,-1),W(`span`,zH,M(i.adv?``:`默认值经实测调优,不建议修改`),1)],8,RH),i.adv?(V(),H(`div`,BH,[t[50]||=W(`p`,{class:`aiset__adv-note`},[K(` 这几项是长程任务的`),W(`strong`,null,`熔断与保活阈值`),K(`,数值由实测调优得出(如纯思考预算从 90s 放宽到 600s,因 240s 会误伤正常轮次)。 留空即走默认,`),W(`strong`,null,`没有明确理由不建议改动`),K(`。 `)],-1),W(`div`,VH,[W(`div`,HH,[t[31]||=W(`span`,{class:`aiset__label`},`单轮步数上限`,-1),t[32]||=W(`span`,{class:`aiset__unit`},`0 / 留空 = 不限`,-1),W(`button`,{type:`button`,class:j([`aiset__help`,{"is-on":i.help===`maxSteps`}]),"aria-expanded":i.help===`maxSteps`,title:`查看说明`,onClick:t[5]||=J(e=>a.toggleHelp(`maxSteps`),[`stop`])},[...t[30]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-help`})],-1)]],10,UH)]),W(`div`,WH,[G(s,{id:`common-maxsteps`,class:`aiset__stepper`,value:i.form.maxSteps>0?String(i.form.maxSteps):``,step:8,min:0,max:1e3,placeholder:`留空 = 不限(推荐)`,onInput:t[6]||=e=>a.onInt(`maxSteps`,e)},null,8,[`value`])]),i.help===`maxSteps`?(V(),H(`p`,GH,[...t[33]||=[W(`strong`,null,`普通用户不用管:留空 = 不限`,-1),K(`。失控由三道精准熔断兜住(同参打转跳过 / 单轮墙钟到点收尾 / 每 24 步提醒)。 只有想硬性控成本时才填(>0 即恢复旧硬顶行为)。 `,-1)]])):q(`v-if`,!0)]),W(`div`,KH,[W(`div`,qH,[t[35]||=W(`span`,{class:`aiset__label`},`单轮墙钟上限`,-1),t[36]||=W(`span`,{class:`aiset__unit`},`分钟`,-1),W(`button`,{type:`button`,class:j([`aiset__help`,{"is-on":i.help===`turnTimeout`}]),"aria-expanded":i.help===`turnTimeout`,title:`查看说明`,onClick:t[7]||=J(e=>a.toggleHelp(`turnTimeout`),[`stop`])},[...t[34]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-help`})],-1)]],10,JH)]),W(`div`,YH,[G(s,{id:`common-turn`,class:`aiset__stepper`,value:i.form.turnTimeoutMin>0?String(i.form.turnTimeoutMin):``,step:5,min:0,max:240,placeholder:`留空 = 60`,onInput:t[8]||=e=>a.onInt(`turnTimeoutMin`,e)},null,8,[`value`])]),i.help===`turnTimeout`?(V(),H(`p`,XH,` 单轮允许跑的最长时间(分钟)。到点收尾汇报、上下文不丢,回复「继续」接着做。默认 60 分钟,不限步数后的唯一兜底闸门。 `)):q(`v-if`,!0)]),W(`div`,ZH,[W(`div`,QH,[t[38]||=W(`span`,{class:`aiset__label`},`网关静默阈值`,-1),t[39]||=W(`span`,{class:`aiset__unit`},`分钟`,-1),W(`button`,{type:`button`,class:j([`aiset__help`,{"is-on":i.help===`stall`}]),"aria-expanded":i.help===`stall`,title:`查看说明`,onClick:t[9]||=J(e=>a.toggleHelp(`stall`),[`stop`])},[...t[37]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-help`})],-1)]],10,$H)]),W(`div`,eU,[G(s,{id:`common-stall`,class:`aiset__stepper`,value:i.form.stallTimeoutMin>0?String(i.form.stallTimeoutMin):``,step:1,min:0,max:120,placeholder:`留空 = 2`,onInput:t[10]||=e=>a.onInt(`stallTimeoutMin`,e)},null,8,[`value`])]),i.help===`stall`?(V(),H(`p`,tU,` 上游多少分钟不回任何字节算「网关静默」;静默自动重试本步而非整轮报废。默认 2 分钟(120 秒)。 `)):q(`v-if`,!0)]),W(`div`,nU,[W(`div`,rU,[t[41]||=W(`span`,{class:`aiset__label`},`静默重试次数`,-1),t[42]||=W(`span`,{class:`aiset__unit`},`-1 = 默认`,-1),W(`button`,{type:`button`,class:j([`aiset__help`,{"is-on":i.help===`stallRetries`}]),"aria-expanded":i.help===`stallRetries`,title:`查看说明`,onClick:t[11]||=J(e=>a.toggleHelp(`stallRetries`),[`stop`])},[...t[40]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-help`})],-1)]],10,iU)]),W(`div`,aU,[G(s,{id:`common-stallretries`,class:`aiset__stepper`,value:i.form.stallRetries>=0?String(i.form.stallRetries):``,step:1,min:-1,max:20,placeholder:`留空 / -1 = 3`,onInput:t[12]||=e=>a.onInt(`stallRetries`,e)},null,8,[`value`])]),i.help===`stallRetries`?(V(),H(`p`,oU,` 网关静默后的自动重试次数。0 = 回到「一次静默即报错」的旧行为;留空 / -1 = 用默认 3 次。 `)):q(`v-if`,!0)]),W(`div`,sU,[W(`div`,cU,[t[44]||=W(`span`,{class:`aiset__label`},`纯思考预算`,-1),t[45]||=W(`span`,{class:`aiset__unit`},`分钟`,-1),W(`button`,{type:`button`,class:j([`aiset__help`,{"is-on":i.help===`reasoning`}]),"aria-expanded":i.help===`reasoning`,title:`查看说明`,onClick:t[13]||=J(e=>a.toggleHelp(`reasoning`),[`stop`])},[...t[43]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-help`})],-1)]],10,lU)]),W(`div`,uU,[G(s,{id:`common-reasoning`,class:`aiset__stepper`,value:i.form.reasoningTimeoutMin>0?String(i.form.reasoningTimeoutMin):``,step:1,min:0,max:300,placeholder:`留空 = 10`,onInput:t[14]||=e=>a.onInt(`reasoningTimeoutMin`,e)},null,8,[`value`])]),i.help===`reasoning`?(V(),H(`p`,dU,` 单轮「纯思考」(不调工具)的预算(分钟)。到点催促 + 关深度思考重试;催 3 次仍无产出则停该熔断,改墙钟兜底。默认 10 分钟(600 秒)。 `)):q(`v-if`,!0)]),W(`div`,fU,[W(`div`,pU,[t[47]||=W(`span`,{class:`aiset__label`},`自动续跑上限`,-1),t[48]||=W(`span`,{class:`aiset__unit`},`-1 = 默认`,-1),W(`button`,{type:`button`,class:j([`aiset__help`,{"is-on":i.help===`autoContinue`}]),"aria-expanded":i.help===`autoContinue`,title:`查看说明`,onClick:t[15]||=J(e=>a.toggleHelp(`autoContinue`),[`stop`])},[...t[46]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-help`})],-1)]],10,mU)]),W(`div`,hU,[G(s,{id:`common-autocont`,class:`aiset__stepper`,value:i.form.autoContinueMax>=0?String(i.form.autoContinueMax):``,step:1,min:-1,max:200,placeholder:`留空 / -1 = 12`,onInput:t[16]||=e=>a.onInt(`autoContinueMax`,e)},null,8,[`value`])]),i.help===`autoContinue`?(V(),H(`p`,gU,[...t[49]||=[K(` 模型没给收尾标记(`,-1),W(`code`,null,`[任务完成]`,-1),K(` / `,-1),W(`code`,null,`[需用户确认]`,-1),K(`)就停手时的自动续跑次数上限。0 = 关闭(等你手打「继续」);留空 / -1 = 用默认 12。 `,-1)]])):q(`v-if`,!0)])])):q(`v-if`,!0)]),i.ping?(V(),H(`div`,{key:0,class:j([`aiset__ping`,i.ping.ok?`is-ok`:`is-bad`])},[(V(),H(`svg`,_U,[W(`use`,{href:i.ping.ok?`#icon-check`:`#icon-alert-triangle`},null,8,vU)])),W(`span`,null,M(i.ping.text),1)],2)):q(`v-if`,!0)]),W(`footer`,yU,[t[52]||=W(`span`,{class:`aiset__foot-gap`},null,-1),W(`button`,{type:`button`,class:`aiset__btn`,disabled:i.saving,onClick:t[17]||=t=>e.$emit(`close`)},`取消`,8,bU),W(`button`,{type:`button`,class:`aiset__btn aiset__btn--primary`,disabled:i.saving,onClick:t[18]||=(...e)=>a.save&&a.save(...e)},M(i.saving?`保存中…`:`保存`),9,xU)])])])}var CU=Z(SH,[[`render`,SU],[`__file`,`/Users/ynet/dsl-card/card-editor/components/AiCommonSettings.vue`]]),wU=2e3;function TU(e){try{let t=JSON.stringify(e);return t==null?0:t.length}catch{return 1/0}}function EU(e,t){let n=typeof e==`string`?e:e==null?``:JSON.stringify(e);return n.length<=t?e:`${n.slice(0,t)}\n…(历史归档已裁剪,完整内容以卡片与落盘产物为准)`}function DU(e,t){if(!e||typeof e!=`object`)return e;let n={};for(let[r,i]of Object.entries(e))n[r]=typeof i==`string`||typeof i==`object`&&i?EU(i,t):i;return n}function OU(e,t=!1){let n=Array.isArray(e)?e:[],r=t?400:wU;return n.map(e=>{if(!e||!Array.isArray(e.toolCalls)||!e.toolCalls.length)return e;let n=!1,i=e.toolCalls.map(e=>{if(!e||typeof e!=`object`)return e;let i=DU(e.args,r),a=t?e.result==null||e.result===``?e.result:`[历史归档已裁剪]`:EU(e.result,r);return(JSON.stringify(i)!==JSON.stringify(e.args)||String(a)!==String(e.result))&&(n=!0),{...e,args:i,result:a}});return n?{...e,toolCalls:i,trimmedArchive:!0}:e})}var kU={card_read:12e3,skill_read:1e4,card_grep:4e3,skill_exec:3e3,fs_read:4e3,fs_write:2e3,fs_list:2e3,fs_copy:1e3,ir_patch:2e3,card_patch:2e3,card_validate:4e3,card_render_status:6e3,card_node_models:4e3,card_screenshot:1e3},AU=6e3;function jU(e){return kU[e]||6e3}function MU(e,t){return(typeof t==`string`?t:String(t??``)).slice(0,jU(e))}Math.max(AU,...Object.values(kU));var NU={pick:{id:`pick`,label:`选一张已有的卡`,hint:`从顶栏下拉里挑`,icon:`#icon-search`,weight:`read`,text:`列出仓库里现有的卡片,按用途分组,帮我挑一张适合修改的。`},scaffold:{id:`scaffold`,label:`新建一张卡`,hint:`从空白骨架开始`,icon:`#icon-folder-plus`,weight:`write`,text:`帮我新建一张卡片:先用 card_scaffold 生成骨架,再按我的需求补齐结构与示例内容,最后自检。`},spec:{id:`spec`,label:`按设计稿标注建卡`,hint:`先拖入 MeaXure 目录`,icon:`#icon-image-upload`,weight:`write`,attach:!0,text:`我会挂载一份 Sketch MeaXure 标注导出目录,请按标注生成卡片 schema 并自检。`},fromimage:{id:`fromimage`,label:`从参考图建卡`,hint:`拖一张设计图进来`,icon:`#icon-image`,weight:`write`,attach:!0,text:`我会拖入一张参考设计图(本机路径),请按图生成卡片 schema 并截图自检还原度。`},learn:{id:`learn`,label:`看已有卡学写法`,hint:`只读,不改卡`,icon:`#icon-search`,weight:`read`,text:`列出仓库里结构最完整的几张卡片,读 1-2 张的关键片段,说明本仓库的建卡约定与常用范式。`},component:{id:`component`,label:`加一个常用组件`,hint:`列表 / 按钮 / 金额卡`,icon:`#icon-plus`,weight:`write`,text:`帮我给这张卡加一个常用组件(列表 / 按钮组 / 金额统计卡),按仓库范式写并自检。`},explain:{id:`explain`,label:`解释结构与数据来源`,hint:`只读,不改卡`,icon:`#icon-search`,weight:`read`,text:`读取当前卡片 schema,用中文解释它的结构、关键绑定与数据来源,指出可能的问题。`},bind:{id:`bind`,label:`把写死文案抽成变量`,hint:`绑定 data.json`,icon:`#icon-link`,weight:`write`,text:`把当前卡片里写死的动态值(金额 / 日期 / 名称等)抽成变量并绑定 data.json,保持展示文案与设计稿一致。`},fix:{id:`fix`,label:`校验并修复`,hint:`会改动卡片`,icon:`#icon-wrench`,weight:`write`,text:`对当前卡片执行校验,列出全部错误并按规则修复,修完再校验一次确认清零。`},shot:{id:`shot`,label:`截图自检还原度`,hint:`多尺寸预览比对`,icon:`#icon-images`,weight:`read`,text:`给当前卡片截图,检查布局、字号、间距与配色是否协调,指出需要调整的地方。`},interact:{id:`interact`,label:`加按钮点击行为`,hint:`customAction / 发消息`,icon:`#icon-send`,weight:`write`,text:`给当前卡片里的主按钮加点击行为(customAction 或发送一条消息),参照现有卡片的写法。`},diagnose:{id:`diagnose`,label:`定位并修复刚才的报错`,hint:`接上一轮`,icon:`#icon-alert-triangle`,weight:`write`,text:`上一轮失败了,请读取错误信息与上下文,定位原因并修复,修完再校验一次。`},resume:{id:`resume`,label:`从中断处继续`,hint:`不重做已完成部分`,icon:`#icon-redo`,weight:`write`,text:`上一轮被中断了,请按上下文里的中断标记从中断处继续,不要从零重做。`},rollback:{id:`rollback`,label:`回滚上一轮改动`,hint:`恢复到改动前`,icon:`#icon-undo`,weight:`write`,text:`把上一轮对卡片做的改动回滚到改动前,并说明回滚了什么。`}},PU={nocare:[`pick`,`scaffold`,`spec`,`learn`,`component`],empty:[`spec`,`fromimage`,`scaffold`,`component`,`learn`],card:[`explain`,`bind`,`fix`,`shot`,`interact`],error:[`diagnose`,`resume`,`rollback`,`explain`,`fix`]},FU={nocare:{title:`选择或新建一张卡`,desc:`先从顶栏选一张卡,或让 AI 新建一张;也可以把设计稿标注目录、参考图拖进来,只传本机路径不上传。`},empty:{title:`把这张空卡搭起来`,desc:`描述想要的效果,或拖入设计稿标注目录 / 参考图,AI 会按标注生成卡片并截图自检。`},error:{title:`接着上一轮往下做`,desc:`上一轮失败或被中断了:可以接着修、从中断处继续,或回滚到改动前。`},card:{title:`让 AI 直接改这张卡`,desc:`描述需求即可,AI 会调用卡片工具读改校验并截图自检;也可以把设计稿标注目录、参考图拖进来,只传本机路径不上传。`}};function IU(e){let t=Array.isArray(e)?e:[];for(let e=t.length-1;e>=0;--e){let n=t[e];if(n&&n.role===`assistant`)return n.status||`done`}return``}function LU({cardId:e,cardEmpty:t,messages:n}={}){if(!e)return`nocare`;if(t)return`empty`;let r=IU(n);return r===`error`||r===`aborted`?`error`:`card`}function RU(e){return(PU[e]||PU.card).map(e=>NU[e]).filter(Boolean)}function zU(e,t,n=4){let r=Array.isArray(e)?e:[];if(r.length<=n)return r.slice();let i=r.length,a=((Number(t)||0)%i+i)%i;return[...r.slice(a),...r.slice(0,a)].slice(0,n)}function BU(e,t=4){return(Array.isArray(e)?e:[]).slice(0,t)}var VU=`cardbuddy:ai-panel-width`,HU=2e4,UU=`cardbuddy:ai-compact-steps`,WU=380,GU=.5,KU=.33,qU=0;function JU(e=`m`){return qU+=1,`${e}${Date.now().toString(36)}-${qU}`}var YU=`有对话正在进行,无法修改正在使用的模型:请先等这一轮结束,或在输入区点「停止」`,XU={name:`ChatPanel`,components:{ChatMessage:bB,ChatComposer:JB,AiSettings:JV,ModelList:bH,AiCommonSettings:CU,ConfirmDialog:Ap},props:{visible:{type:Boolean,default:!1},cardId:{type:String,default:``},cardName:{type:String,default:``},cardEmpty:{type:Boolean,default:!1}},emits:[`close`,`busy`,`turn-progress`,`turn-finished`,`rollback-turn`,`locate-node`],data(){return{messages:[],draftAttachments:[],busy:!1,loadingHistory:!1,modelListOpen:!1,models:[],activeId:null,turnRunning:!1,modelEditOpen:!1,editModelId:null,editInitialModel:null,confirmDeleteModel:null,ccSwitchOpen:!1,ccSwitchProviders:[],ccSwitchLoading:!1,ccSwitchReason:``,ccSwitchSelected:{},commonOpen:!1,confirmClear:!1,notice:null,config:{baseUrl:``,model:``,hasKey:!1,apiKeyMasked:``},widthPx:0,winW:typeof window<`u`?window.innerWidth:1280,resizing:!1,pinned:!0,contextUsage:null,compactSteps:!1,archiveTrimmed:!1,suggestOffset:0,suggestStats:{},confirmStop:!1,turnStep:0,turnStage:null,turnToolLabel:``,turnStartedAt:0,lastByteAt:0,turnId:``,lastSeq:0,_resumeProbe:!1,nowTs:0,_abort:null,_saveTimer:0,_loadedCard:``,_cardRenamedTo:``,_saving:!1,_liveTicker:0,_turnPersistTimer:0}},computed:{pickOwnerRow(){return sR(this.messages)},suggestBatchKey(){return LU({cardId:this.cardId,cardEmpty:this.cardEmpty,messages:this.messages})},suggestBatch(){return RU(this.suggestBatchKey)},suggestions(){return zU(this.suggestBatch,this.suggestOffset)},canShuffle(){return this.suggestBatch.length>4},quickChips(){return BU(this.suggestBatch)},emptyTitle(){return(FU[this.suggestBatchKey]||FU.card).title},emptyDesc(){return(FU[this.suggestBatchKey]||FU.card).desc},ccSwitchCheckedCount(){let e=this.ccSwitchSelected||{};return Object.keys(e).filter(t=>e[t]).length},ccSwitchDupCount(){return(this.ccSwitchProviders||[]).filter(e=>e.duplicate).length},configReady(){return!!(this.config.baseUrl&&this.config.model&&this.config.hasKey)},panelWidth(){let e=this.winW||1280,t=Math.max(WU,Math.floor(e*GU)),n=Math.round(e*KU),r=this.widthPx||n;return Math.max(WU,Math.min(t,r))},panelStyle(){return{width:`${this.panelWidth}px`}},stallLimitMs(){let e=Number(this.config.stallTimeoutMs)>0?Number(this.config.stallTimeoutMs):12e4;return Math.round(e*1.5)},idleMs(){return this.lastByteAt?Math.max(0,(this.nowTs||Date.now())-this.lastByteAt):0},stalled(){return!!(this.busy&&this.idleMs>this.stallLimitMs)},liveText(){if(!this.busy)return``;let e=[];return this.turnStartedAt&&e.push(`${zL(this.turnStartedAt)} 开始`),this.turnStep>0&&e.push(`第 ${this.turnStep} 步`),e.push(`已用 ${this.fmtClock(this.nowTs-this.turnStartedAt)}`),this.turnStage?e.push(`${this.turnStage.id} ${this.turnStage.label}`):this.turnToolLabel&&e.push(this.turnToolLabel),this.stalled?`${Math.round(this.idleMs/1e3)} 秒没收到任何数据,连接可能已中断(${e.join(` · `)})`:(e.push(`最近数据 ${Math.round(this.idleMs/1e3)} 秒前`),e.join(` · `))}},watch:{suggestBatchKey(){this.suggestOffset=0},visible(e){e?(this.refreshConfig(),this.ensureHistory().then(()=>this.checkResumableTurn()),this.$nextTick(()=>{this.scrollToBottom(!0),this.$refs.composerEl?.focus()})):this.busy&&this.flushHistory()},cardId(e,t){if(this._cardRenamedTo&&this._cardRenamedTo===e){this._cardRenamedTo=``,this._dirtyFor===t&&(this._dirtyFor=e),this._loadedCard===t?(this._loadedCard=e,this._dirtyFor===e&&this.flushHistory(e)):(this._loadedCard=``,this.ensureHistory());return}this._saveTimer&&=(clearTimeout(this._saveTimer),0);let n=this._dirtyFor===t?this.serialize():null;this._dirtyFor=null,this.draftAttachments=[],this.messages=[],n&&t&&this.flushHistory(t,n),this.ensureHistory()}},mounted(){this.loadWidth(),this.loadCompact(),window.addEventListener(`resize`,this.onWinResize),window.addEventListener(`pagehide`,this.onPagehide),this.refreshConfig(),this.ensureHistory()},beforeUnmount(){window.removeEventListener(`resize`,this.onWinResize),window.removeEventListener(`pagehide`,this.onPagehide),this.stopTurnTimers(),this.stopTickers(),this.flushHistory(),this._abort&&this._abort.abort()},methods:{onWinResize(){this.winW=window.innerWidth},onImageClick(e){let t=e.target&&e.target.closest?e.target.closest(`img`):null;if(!t||t.dataset.noZoom===`1`)return;let n=Array.from(this.$el.querySelectorAll(`img`)).filter(e=>e.dataset.noZoom!==`1`),r=n.indexOf(t);r<0||zk(n.map(e=>({src:e.currentSrc||e.src,alt:e.alt||``,title:e.getAttribute(`title`)||e.closest(`[title]`)?.getAttribute(`title`)||``})),r)},loadWidth(){try{let e=localStorage.getItem(VU);if(e!=null){let t=parseInt(e,10);!Number.isNaN(t)&&t>=WU&&(this.widthPx=t)}}catch{}},saveWidth(){try{this.widthPx?localStorage.setItem(VU,String(Math.round(this.panelWidth))):localStorage.removeItem(VU)}catch{}},startResize(e){let t=e&&e.currentTarget;if(!t)return;this.resizing=!0,document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`;let n=e.pointerId;try{t.setPointerCapture(n)}catch{}let r=e=>{let t=Math.max(WU,Math.floor(window.innerWidth*GU));this.widthPx=Math.max(WU,Math.min(t,Math.round(window.innerWidth-e.clientX)))},i=()=>{t.removeEventListener(`pointermove`,r),t.removeEventListener(`pointerup`,i),t.removeEventListener(`pointercancel`,i),window.removeEventListener(`blur`,i);try{t.hasPointerCapture?.(n)&&t.releasePointerCapture(n)}catch{}this.resizing=!1,document.body.style.cursor=``,document.body.style.userSelect=``,this.saveWidth()};t.addEventListener(`pointermove`,r),t.addEventListener(`pointerup`,i),t.addEventListener(`pointercancel`,i),window.addEventListener(`blur`,i)},resetWidth(){this.widthPx=0,this.saveWidth()},async refreshConfig(){try{let e=await PR();this.config={...e,hasKey:!!(e.hasKey||e.apiKey)},e.turnRunning!==void 0&&(this.turnRunning=e.turnRunning===!0)}catch{this.config={baseUrl:``,model:``,hasKey:!1,apiKeyMasked:``}}},async loadModels(){try{let e=await IR();this.models=Array.isArray(e.models)?e.models:[],this.activeId=e.activeId||null,this.turnRunning=e.turnRunning===!0}catch{this.models=[],this.activeId=null}},openModelList(){this.modelListOpen=!0,this.loadModels(),this.refreshConfig()},closeModelList(){this.modelListOpen=!1},onModelAdd(){this.modelListOpen=!1,this.editModelId=null,this.editInitialModel=null,this.modelEditOpen=!0},onModelEdit(e){if(this.turnRunning&&e&&e.id===this.activeId)return this.notify(`warn`,YU);this.modelListOpen=!1,this.editModelId=e&&e.id?e.id:null,this.editInitialModel=e||null,this.modelEditOpen=!0},onModelEditClose(){this.modelEditOpen=!1,this.modelListOpen=!0},async onModelSaved(){this.modelEditOpen=!1,this.modelListOpen=!0,await this.loadModels(),await this.refreshConfig()},async onModelActivate(e){if(e&&e.id){if(this.turnRunning&&e.id!==this.activeId)return this.notify(`warn`,YU);try{await HR(e.id)}catch(e){this.notify(`warn`,`切换模型失败:${e.message||e}`)}await this.loadModels(),await this.refreshConfig()}},onModelDelete(e){if(e&&e.id){if(this.turnRunning&&e.id===this.activeId)return this.notify(`warn`,YU);this.confirmDeleteModel=e}},async doDeleteModel(){let e=this.confirmDeleteModel;if(this.confirmDeleteModel=null,e&&e.id){try{await VR(e.id)}catch(e){this.notify(`warn`,`删除失败:${e.message||e}`);return}await this.loadModels(),await this.refreshConfig(),this.notify(`ok`,`已删除模型「${e.name||e.model||e.id}」`)}},get deleteModelMessage(){let e=this.confirmDeleteModel;return`确定删除模型「${e?e.name||e.model||e.id:``}」吗?此操作不可撤销,配置将从 .env.cb.local 移除${e&&e.id===this.activeId?`。该模型当前为生效模型,删除后会自动回落到剩余模型中的第一条(若已无模型则需重新添加)。`:`。`}`},async onImportCcSwitch(){this.ccSwitchOpen=!0,this.ccSwitchLoading=!0,this.ccSwitchProviders=[],this.ccSwitchReason=``,this.ccSwitchSelected={};try{let e=await LR(),t=Array.isArray(e.providers)?e.providers:[],n=this.models.map(e=>e.model).filter(Boolean);t.forEach(e=>{e.duplicate=n.includes(e.model)}),this.ccSwitchProviders=t,t.length||(this.ccSwitchReason=e.reason||`cc-switch 中没有可导入的 Codex 类供应商`)}catch(e){this.ccSwitchReason=`读取 cc-switch 失败:${e&&e.message||e}`}finally{this.ccSwitchLoading=!1}},toggleCcSwitchItem(e){if(!e||e.duplicate)return;let t={...this.ccSwitchSelected};t[e.id]?delete t[e.id]:t[e.id]=!0,this.ccSwitchSelected=t},async confirmImportCcSwitch(){let e=this.ccSwitchProviders.filter(e=>this.ccSwitchSelected[e.id]&&!e.duplicate);if(!e.length)return;let t=0,n=0;for(let r of e)try{await zR({name:r.name||r.model,baseUrl:r.baseUrl,apiKey:r.apiKey||``,model:r.model,maxTokens:0,thinking:!1,vision:!1}),t++}catch(e){n++,console.error(`[cc-switch 导入失败]`,r.name,e)}this.ccSwitchOpen=!1,await this.loadModels(),await this.refreshConfig(),n?this.notify(`warn`,`导入完成:成功 ${t} 个、失败 ${n} 个`):this.notify(`ok`,`已从 cc-switch 导入 ${t} 个模型`)},openCommon(){this.modelListOpen=!1,this.commonOpen=!0},async onCommonSaved(){this.commonOpen=!1,await this.refreshConfig(),this.notify(`ok`,`通用设置已保存`)},async ensureHistory(){let e=this.cardId;if(e&&this._loadedCard!==e){this._loadedCard=e,this.loadingHistory=!0;try{let t=await ZR(e);if(this.cardId!==e)return;let n=this.busy?this.turnId:``,r=(t.messages||[]).map(e=>this.revive(e)).filter(e=>!(n&&e.role===`assistant`&&e.turnId===n));this.archiveTrimmed=r.some(e=>e.trimmedArchive===!0);let i=new Set(r.map(e=>e.id)),a=this.messages.filter(e=>!i.has(e.id));this.messages=[...r,...a],this.contextUsage=null,this._dirtyFor=null,this.checkResumableTurn(),this.$nextTick(()=>this.scrollToBottom(!0))}catch{this.cardId===e&&(this.messages=[]),this._dirtyFor=null}finally{this.cardId===e&&(this.loadingHistory=!1)}}},serialize(){return this.messages.map(e=>{let t={id:e.id,role:e.role,content:e.content||``,ts:e.ts};return e.role===`assistant`?(t.reasoning=e.reasoning||``,t.reasoningMs=e.reasoningMs||0,t.error=e.error||``,e.errorCode&&(t.errorCode=e.errorCode),e.events?.length&&(t.events=e.events.map(e=>({ts:e.ts||0,level:e.level||`warn`,code:e.code||``,message:e.message||``}))),t.elapsedMs=e.elapsedMs||0,t.status=e.status===`streaming`?`aborted`:e.status||`done`,e.turnId&&(t.turnId=e.turnId),e.serverAuthored&&(t.serverAuthored=!0),e.budget?.message&&(t.budget={reason:e.budget.reason||``,message:e.budget.message}),e.usage&&(t.usage=e.usage),e.toolCalls?.length&&(t.toolCalls=e.toolCalls.map(e=>({toolCallId:e.toolCallId,toolName:e.toolName,args:e.args||{},result:e.result,error:e.error||``,ms:e.ms||0,startedAt:e.startedAt||0,command:e.command||``,approvalNote:e.approvalNote||``,autoApproved:!!e.autoApproved,truncated:!!e.truncated})))):e.attachments?.length&&(t.attachments=e.attachments.map(e=>({path:e.path,name:e.name,isDir:!!e.isDir,isImage:!!e.isImage,size:e.size||0,entryCount:e.entryCount||0,exists:e.exists!==!1}))),t})},revive(e){return{id:e.id||JU(),role:e.role===`user`?`user`:`assistant`,content:e.content||``,narrationChars:Math.max(0,Number(e.narrationChars)||0),reasoning:e.reasoning||``,reasoningMs:e.reasoningMs||0,elapsedMs:Number(e.elapsedMs)||0,toolCalls:Array.isArray(e.toolCalls)?e.toolCalls.map(t=>(e.status===`aborted`||e.status===`streaming`)&&t&&!t.error&&t.result==null?{...t,error:`已终止:该调用未拿到结果(轮次被中断)`}:t):[],attachments:Array.isArray(e.attachments)?e.attachments:[],events:Array.isArray(e.events)?e.events:[],error:e.error||``,errorCode:e.errorCode||``,trimmedArchive:e.trimmedArchive===!0,status:e.status||`done`,turnId:e.turnId||``,serverAuthored:e.serverAuthored===!0,budget:e.budget?.message?{reason:e.budget.reason||``,message:e.budget.message}:void 0,usage:e.usage||void 0,ts:e.ts||0}},persist(){this.cardId&&(this._dirtyFor=this.cardId,this._saveTimer&&clearTimeout(this._saveTimer),this._saveTimer=setTimeout(()=>this.flushHistory(),500))},fitArchive(e){if(TU(e)<=4e6)return e;let t=OU(e,!1);return TU(t)>4e6&&(t=OU(t,!0)),this.archiveTrimmed=!0,t},async flushHistory(e=this.cardId,t=null){if(this._saveTimer&&=(clearTimeout(this._saveTimer),0),e){if(this._saving)this._saveTimer=setTimeout(()=>this.flushHistory(e,t),800);else{this._saving=!0;try{await QR(e,this.fitArchive(t||this.serialize())),this._dirtyFor===e&&(this._dirtyFor=null)}catch(e){this.notify(`warn`,`对话记录保存失败:${e.message||e}`)}finally{this._saving=!1}}}},migrateCard(e,t){e&&t&&e!==t&&this.cardId===e&&(this._saveTimer&&=(clearTimeout(this._saveTimer),0),this._cardRenamedTo=t,this._dirtyFor===e&&(this._dirtyFor=t))},discardCard(e){e&&(this._saveTimer&&=(clearTimeout(this._saveTimer),0),this._dirtyFor===e&&(this._dirtyFor=null),(this._loadedCard===e||this.cardId===e)&&(this.busy&&this._abort&&this._abort.abort(),this.messages=[],this.draftAttachments=[],this.contextUsage=null,this._loadedCard=``))},askClear(){this.messages.length&&(this.confirmClear=!0)},async doClear(){this.confirmClear=!1;let e=this.cardId;this.messages=[],this.contextUsage=null,this._loadedCard=e,this._dirtyFor=null,this._saveTimer&&=(clearTimeout(this._saveTimer),0);try{await $R(e),this.notify(`ok`,`已清空本卡片的对话记录`)}catch(e){this.notify(`warn`,`清空失败:${e.message||e}`)}},async onPick(e){try{let t=await GR(e);if(t.cancelled)return;for(let e of t.items||[])this.pushAttachment(e);t.items?.length||this.notify(`warn`,`未选到可用文件`)}catch(e){this.notify(`warn`,e.message||`无法调起系统选择器,可改用拖拽或粘贴路径`)}},async onAddPath(e){try{let t=await KR(e);this.pushAttachment(t)}catch(t){this.notify(`warn`,`路径不可用:${e}(${t.message||t})`)}},async onPasteImage(e){try{let t=await YR(e);this.pushAttachment(t,`粘贴的截图已存到本机 .cache/ai-attachments/`)}catch(e){this.notify(`warn`,`截图保存失败:${e.message||e}`)}},async onDropFiles(e){let t=Array.from(e.items||[]).map(e=>e.webkitGetAsEntry?e.webkitGetAsEntry():null).filter(Boolean),n=Array.from(e.files||[]),r=[];if(t.length)for(let e of t)r.push(this.resolveEntry(e));else for(let e of n)r.push(this.resolveFile(e));if(!r.length){this.notify(`warn`,`没有识别到可挂载的文件`);return}let i=(await Promise.all(r)).filter(e=>e!==`cancelled`&&!e).length;i&&this.notify(`warn`,`${i} 项未能定位本机路径,可改用「粘贴路径」添加`)},async resolveEntry(e){if(e.isDirectory){let t=await this.firstFileInDir(e);return this.resolveByName(e.name,e.fullPath||e.name,t?.size??-1,t?.name||``)}let t=await this.entryToFile(e);return t?this.resolveFile(t):this.resolveByName(e.name,e.fullPath||e.name,-1)},async resolveFile(e){return this.resolveByName(e.name,e.webkitRelativePath||e.name,e.size)},async resolveByName(e,t,n,r=``){let i={id:JU(`att`),path:``,name:e,isDir:!1,isImage:!1,pending:!0};this.draftAttachments=[...this.draftAttachments,i];try{let a=await JR(qR({name:e,relPath:t,size:n,child:r}),HU,`locate`);return i.removed?`cancelled`:(this.pushAttachment(a),a)}catch{return i.removed?`cancelled`:null}finally{this.draftAttachments=this.draftAttachments.filter(e=>e.id!==i.id)}},entryToFile(e){return new Promise(t=>{try{e.file(e=>t(e),()=>t(null))}catch{t(null)}})},firstFileInDir(e){return new Promise(t=>{try{e.createReader().readEntries(async e=>{for(let n of e||[])if(!n.isDirectory){let e=await this.entryToFile(n);if(e)return t(e)}t(null)},()=>t(null))}catch{t(null)}})},pushAttachment(e,t){e?.path&&(this.draftAttachments.some(t=>t.path===e.path)||(this.draftAttachments=[...this.draftAttachments,{...e,note:t}],t&&this.notify(`ok`,t)))},removeAttachment(e){if(!e)return;let t=this.draftAttachments.find(t=>(t.id||t.path)===e);t&&t.pending&&(t.removed=!0),this.draftAttachments=this.draftAttachments.filter(t=>(t.id||t.path)!==e)},cancelPendingLocates(){for(let e of this.draftAttachments)e.pending&&(e.removed=!0)},useSuggestion(e){this.$refs.composerEl?.setText(e.text),this.trackSuggest(e)},shuffleSuggestions(){let e=this.suggestBatch.length;e&&(this.suggestOffset=(this.suggestOffset+4)%e)},trackSuggest(e){if(e&&e.id){this.suggestStats[e.id]=(this.suggestStats[e.id]||0)+1;try{window.dispatchEvent(new CustomEvent(`cardbuddy:suggest`,{detail:{id:e.id,label:e.label,weight:e.weight,batch:this.suggestBatchKey}}))}catch{}}},async onSend({text:e,attachments:t}){if(this.busy||!await this.ensureConfig())return;this.notice=null;let n={id:JU(`u`),role:`user`,content:e,attachments:t.map(e=>({...e})),ts:Date.now()};this.messages.push(n),this.cancelPendingLocates(),this.draftAttachments=[],this.pinned=!0,await this.runTurn({retractMsgId:n.id,draft:{text:e,attachments:n.attachments}})},async ensureConfig(){return await this.refreshConfig(),this.configReady?!0:(this.modelListOpen=!0,this.loadModels(),this.notify(`warn`,`请先在模型库中添加并配置模型(Base URL / API Key / 模型名)`),!1)},onPickBoard(e){if(this.busy)return;let t=cR(e,this.cardId);t&&this.onSend({text:t,attachments:[]})},onContinue(){this.busy||this.onSend({text:`继续`,attachments:[]})},async regenerate(e){if(this.busy)return;let t=this.messages.findIndex(t=>t.id===e.id);t>0&&(this.messages=this.messages.slice(0,t)),await this.runTurn()},async runTurn(e={}){this.messages.push({id:JU(`a`),role:`assistant`,content:``,narrationChars:0,reasoning:``,reasoningMs:0,toolCalls:[],events:[],error:``,status:`streaming`,ts:Date.now()});let t=this.messages[this.messages.length-1],n=t.id;this.busy=!0,this.pinned=!0,this.startTurn();let r=new AbortController;this._abort=r;let i=!1,a=Date.now(),o=()=>{t.reasoning&&!t.reasoningMs&&(t.reasoningMs=Date.now()-a)};try{await tz({messages:this.toWire(this.messages.filter(e=>e.id!==n)),cardContext:this.cardId?{id:this.cardId}:void 0,attachments:this.lastAttachments(),signal:r.signal,onEvent:e=>this.onEvent(e,t,o)}),t.status===`streaming`&&(t.status=`done`)}catch(a){let s=r.signal.aborted||/abort/i.test(String(a?.message||a));o(),a?.code===`turn-in-flight`?(i=!0,this.messages=this.messages.filter(t=>t.id!==n&&t.id!==e.retractMsgId),e.draft&&(this.draftAttachments=(e.draft.attachments||[]).map(e=>({...e})),this.$refs.composerEl?.setText(e.draft.text||``)),this.notify(`warn`,String(a?.message||`这张卡片已有一个回合在跑:请先终止或等它结束,再发新消息`)),this.$nextTick(()=>this.checkResumableTurn())):s?t.status=`aborted`:await this.reattachAfterDrop(t,o)?this.pushEvent(t,{level:`info`,code:`stream-resumed`,message:`已接回本回合,继续跟随进度`}):(t.error=String(a?.message||a),t.errorCode=String(a?.code||``),t.status=`error`)}finally{o(),this.endTurn(t,{rejected:i})}},endTurn(e,{rejected:t=!1}={}){e.status===`streaming`&&(e.status=`done`),t||(e.elapsedMs=Math.max(0,Date.now()-this.turnStartedAt)),this.busy=!1,this._abort=null,this.stopTurnTimers(),this.persist(),this.$emit(`busy`,!1),t||this.$emit(`turn-finished`,{status:e.status,error:e.error||``,steps:this.turnStep,ms:Date.now()-this.turnStartedAt,startedAt:this.turnStartedAt,finishedAt:Date.now(),turnId:this.turnId||e.turnId||``}),this.$nextTick(()=>this.scrollToBottom())},async checkResumableTurn(){let e=this.cardId;if(!(!e||this.busy||this._resumeProbe)){this._resumeProbe=!0;try{let t;try{t=await nz(e)}catch{return}let n=t&&t.active;if(!n||!n.turnId||this.cardId!==e||this.busy)return;await this.attachToTurn({cardId:e,turnId:String(n.turnId),startedAt:Number(n.startedAt)||0,afterSeq:0,note:n.detached?`接回一个仍在服务端运行的回合(上次连接已中断,进度与已落盘产物都在)`:`接回本回合的实时进度`})}finally{this._resumeProbe=!1}}},async attachToTurn({cardId:e,turnId:t,startedAt:n=0,afterSeq:r=0,note:i=``}){let a=this.messages.find(e=>e.role===`assistant`&&e.turnId===t);a||=(this.messages.push({id:JU(`a`),role:`assistant`,content:``,narrationChars:0,reasoning:``,reasoningMs:0,toolCalls:[],events:[],error:``,status:`streaming`,ts:n||Date.now(),turnId:t}),this.messages[this.messages.length-1]),a.content=``,a.reasoning=``,a.reasoningMs=0,a.toolCalls=[],a.events=[],a.error=``,a.errorCode=``,a.budget=void 0,a.status=`streaming`,a.turnId=t,this.busy=!0,this.pinned=!0,this.startTurn(),this.turnId=t,this.lastSeq=Number(r)||0,n&&(this.turnStartedAt=n,a.ts=n);let o=new AbortController;this._abort=o;let s=n||Date.now(),c=()=>{a.reasoning&&!a.reasoningMs&&(a.reasoningMs=Date.now()-s)};i&&this.notify(`warn`,i);try{this.lastSeq=await iz({cardId:e,turnId:t,afterSeq:this.lastSeq,signal:o.signal,onEvent:e=>this.onEvent(e,a,c)})}catch(e){o.signal.aborted||/abort/i.test(String(e?.message||e))||(a.error=String(e?.message||e),a.errorCode=String(e?.code||``),a.status=`error`)}finally{c(),this.endTurn(a)}},async reattachAfterDrop(e,t){let n=this.cardId,r=this.turnId||e.turnId,i=this._abort;if(!n||!r||!i||i.signal.aborted)return!1;try{return this.pushEvent(e,{level:`warn`,code:`stream-dropped`,message:`连接中断:正在按断点续订本回合(服务端仍在跑,已执行的写入不受影响)`}),this.lastSeq=await iz({cardId:n,turnId:r,afterSeq:this.lastSeq,signal:i.signal,onEvent:n=>this.onEvent(n,e,t)}),!0}catch{return!1}},onEvent(e,t,n){this.lastByteAt=Date.now();let r=Number(e.seq)||0;switch(r>this.lastSeq&&(this.lastSeq=r),e.type){case`turn-start`:e.turnId&&(this.turnId=String(e.turnId),t.turnId=String(e.turnId)),Number(e.startedAt)&&(this.turnStartedAt=Number(e.startedAt),t.ts=Number(e.startedAt));break;case`client-detached`:this.pushEvent(t,{level:`info`,code:`client-detached`,message:`连接曾中断,回合在服务端继续跑(事件已全部落日志)`});break;case`turn-end`:(e.status===`aborted`||e.status===`error`)&&(t.status=e.status),e.usage&&this.applyUsage(t,e.usage);break;case`usage`:this.applyUsage(t,e);break;case`reasoning-delta`:t.reasoning+=e.text||``;break;case`text-delta`:n(),t.content+=e.text||``;break;case`tool-call-start`:n(),t.content&&(t.narrationChars=t.content.length),this.findToolRow(t,e)||t.toolCalls.push({toolCallId:e.toolCallId||JU(`tc`),toolName:e.toolName,args:{},pending:!0,result:void 0,error:``,startedAt:Date.now(),ms:0});break;case`tool-call`:{n(),t.content&&(t.narrationChars=t.content.length);let r=this.findToolRow(t,e);r?(e.toolCallId&&(r.toolCallId=e.toolCallId),e.toolName&&(r.toolName=e.toolName),r.args=e.args||{},r.pending=!1):t.toolCalls.push({toolCallId:e.toolCallId||JU(`tc`),toolName:e.toolName,args:e.args||{},result:void 0,error:``,startedAt:Date.now(),ms:0});break}case`tool-result`:{let n=t.toolCalls.find(t=>t.toolCallId===e.toolCallId||!e.toolCallId&&t.toolName===e.toolName&&t.result===void 0);n&&(n.result=e.result??``,n.truncated=!!e.truncated,e.error&&(n.error=String(e.error)),e.image&&(n.image=e.image),n.ms=Date.now()-(n.startedAt||Date.now())),this.persist();break}case`approval-request`:{let n=this.findToolRow(t,e)||t.toolCalls[t.toolCalls.length-1];n&&n.toolName===e.toolName&&n.result===void 0?(n.approvalId=e.approvalId,e.command&&(n.command=e.command),n.needsApproval=!0):t.toolCalls.push({toolCallId:e.toolCallId||JU(`tc`),toolName:e.toolName,args:e.args||{},command:e.command||``,approvalId:e.approvalId,needsApproval:!0,result:void 0,error:``,startedAt:Date.now(),ms:0});break}case`approval-decided`:{let n=(t.toolCalls||[]).find(t=>t.approvalId===e.approvalId);n&&(n.needsApproval=!1,n.approvalNote=e.ok?e.scope===`turn`?`已允许,本回合后续同类执行不再询问…`:`已允许,执行中…`:e.reason||`已拒绝执行`);break}case`approval-auto`:{let n=this.findToolRow(t,e)||[...t.toolCalls||[]].reverse().find(t=>t.toolName===e.toolName&&t.result===void 0);n&&(e.command&&(n.command=e.command),n.autoApproved=!0,n.approvalNote=`按设置免确认执行`);break}case`notice`:{let n=e.level===`info`||e.level===`error`?e.level:`warn`;this.pushEvent(t,{level:n,code:e.code||``,message:e.message||``}),n!==`info`&&this.notify(n===`error`?`danger`:`warn`,e.message||``);break}case`round-retry`:{let n=Number(e.dropReasoning)||0,r=Number(e.dropText)||0,i=Number(e.dropTools)||0;n>0&&(t.reasoning=t.reasoning.slice(0,Math.max(0,t.reasoning.length-n))),r>0&&(t.content=t.content.slice(0,Math.max(0,t.content.length-r))),i>0&&t.toolCalls.splice(Math.max(0,t.toolCalls.length-i),i),t.reasoning||(t.reasoningMs=0),this.pushEvent(t,{level:`warn`,code:`retry-${e.reason||`unknown`}`,message:e.message||``}),this.notify(`warn`,e.message||``);break}case`context-usage`:this.contextUsage={used:Number(e.used)||0,total:Number(e.total)||0,window:Number(e.window)||0};break;case`turn-ended`:t.budget={reason:String(e.reason||``),message:String(e.message||``)};break;case`error`:t.error=t.error?`${t.error}\n${e.message}`:String(e.message||``),e.code&&(t.errorCode=String(e.code)),t.status=`error`;break;case`aborted`:t.status=`aborted`}let i=t.toolCalls||[];this.turnStep=i.length;let a=i[i.length-1];if(a){this.turnToolLabel=`正在${FL(a.toolName)}…`;let e=HL(a);e&&(!this.turnStage||e.order>this.turnStage.order)&&(this.turnStage=e)}this.$nextTick(()=>this.scrollToBottom())},async onApproval({tc:e,ok:t,scope:n=`once`}){if(e?.approvalId){e.needsApproval=!1,e.approvalNote=t?n===`turn`?`已允许,本回合后续同类执行不再询问…`:`已允许,执行中…`:`已拒绝执行`;try{await XR({approvalId:e.approvalId,ok:t,scope:n})}catch(e){this.notify(`warn`,`审批提交失败:${e.message}`)}}},findToolRow(e,t){let n=e.toolCalls||[];if(t.toolCallId){let e=n.find(e=>e.toolCallId===t.toolCallId);if(e)return e}return n.find(e=>e.pending&&e.toolName===t.toolName)||null},stop(){this.confirmStop=!1;let e=this._abort,t=this.cardId,n=this.turnId||``;t&&n&&rz(t).catch(e=>{e?.code!==`no-turn`&&this.notify(`warn`,`终止请求未送达:${e.message}`)}),e&&(e.abort(),this.notify(`ok`,`已终止本次生成`))},doStop(){this.stop()},onEscape(){this.confirmStop?this.confirmStop=!1:this.confirmDeleteModel?this.confirmDeleteModel=null:this.commonOpen?this.commonOpen=!1:this.modelListOpen||this.modelEditOpen?(this.modelListOpen=!1,this.modelEditOpen=!1):this.busy?this.confirmStop=!0:this.$emit(`close`)},lastAttachments(){for(let e=this.messages.length-1;e>=0;e--){let t=this.messages[e];if(t.role===`user`)return(t.attachments||[]).map(e=>({path:e.path,name:e.name,isDir:e.isDir,isImage:e.isImage}))}return[]},toWire(e){return e.map(e=>{if(e.role===`user`){let t=e.attachments||[],n=e.content||``;if(t.length){let e=t.map(e=>`- ${e.isDir?`文件夹`:e.isImage?`图片`:`文件`}:${e.path}`);n=`${n}${n?`
345
+ 分组展开后的成员行与平铺行走的是同一份标记,复制两遍必然漂移 `),W(`div`,{class:j([`aitool`,[`aitool--${a.state}`,{"is-open":a.open}]])},[W(`button`,{type:`button`,class:`aitool__head`,"aria-expanded":a.open?`true`:`false`,onClick:t[0]||=(...e)=>a.toggle&&a.toggle(...e)},[t[7]||=W(`svg`,{class:`aitool__chev`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-chevron-right`})],-1),a.state===`running`||a.state===`pending`?(V(),H(`svg`,_R,[...t[4]||=[W(`use`,{href:`#icon-loading`},null,-1)]])):a.state===`error`?(V(),H(`svg`,vR,[...t[5]||=[W(`use`,{href:`#icon-alert-triangle`},null,-1)]])):(V(),H(`svg`,yR,[...t[6]||=[W(`use`,{href:`#icon-check`},null,-1)]])),W(`span`,bR,M(a.toolLabel(n.tc.toolName)),1),W(`code`,xR,M(n.tc.pending?`参数生成中…`:a.argSummary),1),q(` 时间三件套:这一步什么时候开始(墙钟)· 距回合起点多久(累计)· 自身耗时。
346
+ 长任务里「卡在哪一步、卡了多久」全靠这三个数互相对齐 `),a.clockText?(V(),H(`span`,{key:3,class:`aitool__clock`,title:a.clockTitle},M(a.clockText),9,SR)):q(`v-if`,!0),a.msText?(V(),H(`span`,{key:4,class:`aitool__ms`,title:`本步耗时 ${a.msText}`},M(a.msText),9,CR)):q(`v-if`,!0)],8,gR),q(` 高危执行逐次确认:命令原文 + 允许一次 / 本回合不再询问 / 拒绝(Codex 审批的同款交互) `),n.tc.needsApproval?(V(),H(`div`,wR,[t[8]||=W(`svg`,{class:`aitool__approve-icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-alert-triangle`})],-1),W(`code`,{class:`aitool__approve-cmd`,title:a.approvalCommand},M(a.approvalCommand),9,TR),W(`span`,ER,M(n.tc.toolName===`skill_exec`?`技能脚本,需要你确认`:`本地命令,需要你确认`),1),W(`button`,{type:`button`,class:`aitool__approve-btn`,onClick:t[1]||=J(t=>e.$emit(`approval`,{tc:n.tc,ok:!0,scope:`once`}),[`stop`])},`允许一次`),W(`button`,{type:`button`,class:`aitool__approve-btn aitool__approve-btn--ghost`,onClick:t[2]||=J(t=>e.$emit(`approval`,{tc:n.tc,ok:!0,scope:`turn`}),[`stop`])},`本回合不再询问`),W(`button`,{type:`button`,class:`aitool__approve-btn aitool__approve-btn--deny`,onClick:t[3]||=J(t=>e.$emit(`approval`,{tc:n.tc,ok:!1}),[`stop`])},`拒绝`)])):n.tc.approvalNote?(V(),H(B,{key:1},[q(` 免确认策略命中:没有审批条,但照样把「跑了什么命令」摆出来,免确认不等于无痕迹 `),W(`div`,{class:j([`aitool__approve-note`,{"is-auto":n.tc.autoApproved}])},[W(`span`,DR,M(n.tc.approvalNote),1),n.tc.autoApproved&&n.tc.command?(V(),H(`code`,{key:0,class:`aitool__approve-cmd`,title:n.tc.command},M(n.tc.command),9,OR)):q(`v-if`,!0)],2)],2112)):q(`v-if`,!0),L(W(`div`,kR,[q(` 画板清单点选:清单里是 1 起的板号、--indices 是 0 起,让用户/模型去换算,实测就是这么
347
+ 错一位建错画板的。点一下 = 把清单行尾那串原样的 --pick 直接发给模型,中间零翻译 `),a.boardPicks.length?(V(),H(`div`,AR,[t[9]||=W(`div`,{class:`aitool__picks-hint`},`点一下直接建卡 = 照抄清单行尾的 --pick,不用换算序号;一板多卡已按张拆开:`,-1),(V(!0),H(B,null,z(a.boardPicks,t=>(V(),H(`button`,{key:t.pick,type:`button`,class:`aitool__pick`,title:`${t.name}(${t.size})→ parse_meaxure.py --pick ${t.pick}`,"aria-label":`建卡:画板 ${t.no} ${t.name}(${t.size})--pick ${t.pick}`,onClick:n=>e.$emit(`pick-board`,t)},[W(`span`,MR,`第 `+M(t.no)+` 板`,1),W(`code`,NR,M(t.token),1)],8,jR))),128))])):q(`v-if`,!0),a.argsSource?(V(),U(o,{key:1,source:a.argsSource},null,8,[`source`])):q(`v-if`,!0),n.tc.image?(V(),H(`img`,{key:2,class:`aitool__shot`,src:`data:${n.tc.image.mime||`image/png`};base64,${n.tc.image.base64}`,alt:`卡片截图`},null,8,PR)):q(`v-if`,!0),n.tc.error?(V(),H(`div`,FR,M(n.tc.error),1)):a.resultSource?(V(),U(o,{key:4,source:a.resultSource},null,8,[`source`])):q(`v-if`,!0)],512),[[Nc,a.open]])],2)],2112)}var LR=Z(hR,[[`render`,IR],[`__scopeId`,`data-v-c80ddf1d`],[`__file`,`/Users/ynet/dsl-card/card-editor/components/ChatToolRow.vue`]]);function RR(e){return`${Jl()||``}/__ai/fs/raw?path=${encodeURIComponent(e)}`}async function zR(e){let t=await e.json().catch(()=>({}));if(!e.ok){let n=``;try{n=new URL(e.url).pathname}catch{}let r=(e.status===404||e.status===405)&&n.startsWith(`/__ai/`)?`本地开发服务仍在运行改造前的旧代码(缺少该接口),请重启 npm run dev(cardbuddy)后重试`:t.message||t.error||`HTTP ${e.status}`,i=Error(r);throw i.code=t.error,i.payload=t,i}return t}async function BR(e=!1){return zR(await Y(`/__ai/config${e?`?reveal=1`:``}`))}async function VR(e){return zR(await Y(`/__ai/config`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}))}async function HR(){return zR(await Y(`/__ai/models`))}async function UR(){return zR(await Y(`/__ai/cc-switch-providers`))}async function WR(e,t=!1){return zR(await Y(`/__ai/models/${encodeURIComponent(e)}${t?`?reveal=1`:``}`))}async function GR(e){return zR(await Y(`/__ai/models`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}))}async function KR(e,t){return zR(await Y(`/__ai/models/${encodeURIComponent(e)}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}))}async function qR(e){return zR(await Y(`/__ai/models/${encodeURIComponent(e)}`,{method:`DELETE`}))}async function JR(e){return zR(await Y(`/__ai/models/${encodeURIComponent(e)}/activate`,{method:`POST`}))}async function YR(e={}){let{baseUrl:t=``,apiKey:n=``,model:r=``}=e||{};return zR(await Y(`/__ai/probe-maxtokens`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({baseUrl:t,apiKey:n,model:r})}))}async function XR(e){return zR(await Y(`/__ai/ping`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}))}async function ZR(e=`image`){return zR(await Y(`/__ai/fs/pick`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,multiple:!0})}))}async function QR(e){return zR(await Y(`/__ai/fs/stat?path=${encodeURIComponent(e)}`))}async function $R({name:e,relPath:t,size:n,child:r=``}){return zR(await Y(`/__ai/fs/locate`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:e,relPath:t,size:n,child:r})}))}function ez(e,t,n=`request`){return new Promise((r,i)=>{let a=setTimeout(()=>{let e=Error(`${n}-timeout`);e.code=`timeout`,i(e)},t);e.then(e=>{clearTimeout(a),r(e)},e=>{clearTimeout(a),i(e)})})}async function tz(e){return zR(await Y(`/__ai/fs/stash`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({dataUrl:e})}))}async function nz({approvalId:e,ok:t,scope:n=`once`}){return zR(await Y(`/__ai/approve`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({approvalId:e,ok:t,scope:n})}))}async function rz(e){return e?zR(await Y(`/__ai/history?cardId=${encodeURIComponent(e)}`)):{cardId:``,messages:[],updatedAt:0}}async function iz(e,t,n={}){return e?zR(await Y(`/__ai/history`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cardId:e,messages:t}),keepalive:n.keepalive===!0})):{ok:!1,error:`missing-card-id`}}async function az(e){return e?zR(await Y(`/__ai/history?cardId=${encodeURIComponent(e)}`,{method:`DELETE`})):{ok:!1,error:`missing-card-id`}}async function oz(e,t){let n=e.body.getReader(),r=new TextDecoder,i=``,a=e=>{i+=e;let n=i.split(`
348
+ `);i=n.pop()||``;for(let e of n){let n=e.trim();if(!n.startsWith(`data:`))continue;let r=n.slice(5).trim();if(!r)continue;let i;try{i=JSON.parse(r)}catch{continue}if(t(i)===!0)return!0}return!1};try{for(;;){let{done:e,value:t}=await n.read();if(e||a(r.decode(t,{stream:!0})))break}a(r.decode())}finally{try{n.releaseLock?.()}catch{}}}async function sz({messages:e,cardContext:t,attachments:n=[],config:r={},signal:i,onEvent:a}){let o=await Y(`/__ai/chat`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({messages:e,cardContext:t,attachments:n,config:r}),signal:i});if(!o.ok||!o.body){let e=await o.json().catch(()=>({})),t=Error(e.message||e.error||`HTTP ${o.status}`);throw t.code=e.error||`http-${o.status}`,t.status=o.status,t.payload=e,t}await oz(o,e=>(a(e),e.type===`done`))}async function cz(e){return e?zR(await Y(`/__ai/turns?cardId=${encodeURIComponent(e)}`)):{cardId:``,active:null,recent:[]}}async function lz(e){return e?zR(await Y(`/__ai/stop`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cardId:e})})):{ok:!1,error:`missing-card-id`}}async function uz({cardId:e,afterSeq:t=0,turnId:n=``,signal:r,onEvent:i}){if(!e){let e=Error(`缺少 cardId,无法续订回合`);throw e.code=`missing-card-id`,e}let a=new URLSearchParams({cardId:e,afterSeq:String(Number(t)||0)});n&&a.set(`turnId`,String(n));let o=await Y(`/__ai/turn?${a}`,{signal:r});if(!o.ok||!o.body){let e=await o.json().catch(()=>({})),t=Error(e.message||e.error||`HTTP ${o.status}`);throw t.code=e.error||`http-${o.status}`,t.status=o.status,t}let s=Number(t)||0;return await oz(o,e=>{let t=Number(e.seq)||0;return t>s&&(s=t),i(e),!1}),s}function dz(e,t,n=300){let r=String(e??``),i=Math.max(0,Math.min(Number(t)||0,r.length));return i<Math.max(0,Number(n)||0)?{head:``,tail:r,folded:!1}:{head:r.slice(0,i),tail:r.slice(i),folded:!0}}var fz=3,pz={name:`ChatMessage`,components:{MarkdownBody:zL,ChatToolRow:LR},props:{msg:{type:Object,required:!0},streaming:{type:Boolean,default:!1},compact:{type:Boolean,default:!1},canRollback:{type:Boolean,default:!1},nowTs:{type:Number,default:0},canRegenerate:{type:Boolean,default:!1},pickOwner:{type:Object,default:null}},emits:[`regenerate`,`approval`,`continue`,`rollback`,`open-settings`,`show-all-steps`,`locate-node`,`pick-board`],data(){return{thinkOpen:!1,narrOpen:!1,eventsOpen:null,copied:!1,elapsed:0,openGroups:Object.create(null),errorCopied:!1,_tick:0}},computed:{budgetLabel(){return{loop:`死循环熔断`,timeout:`墙钟熔断`,steps:`步数硬顶`}[this.msg.budget?.reason]||`本轮收尾`},budgetHint(){return{loop:`连续多轮同工具同参数 = 拿不到新信息。回复「继续」前最好补一句新思路(换证据链 / 指定要改的字段),否则大概率原地再转一次。`,timeout:`本轮跑到墙钟上限(AI_TURN_TIMEOUT_MS 可调)。回复「继续」会带着完整上下文从中断处接着做。`,steps:`你在设置里配了「单轮步数上限」。留空即不限步数,失控由死循环 / 墙钟熔断兜住。`}[this.msg.budget?.reason]||`上下文已保留,回复「继续」可接着做。`},attachments(){return Array.isArray(this.msg.attachments)?this.msg.attachments:[]},toolCalls(){return Array.isArray(this.msg.toolCalls)?this.msg.toolCalls:[]},msgTs(){return Number(this.msg.ts)||0},turnClock(){let e=this.msgTs,t=Number(this.msg.elapsedMs)||0,n=e&&t>0?e+t:0;if(!n)for(let e of this.toolCalls)n=Math.max(n,qL(e,this.nowTs));return{stamp:GL(e),endStamp:n>e?GL(n):``,total:n>e?WL(n-e):``}},toolGroups(){let e=[],t=[],n=()=>{if(t.length>=fz)e.push({kind:`group`,key:`g-${t[0].toolCallId||e.length}`,toolName:t[0].toolName,rows:t.slice(),ms:t.reduce((e,t)=>e+(Number(t.ms)||0),0),failed:t.filter(e=>e.error).length,clock:this.groupClock(t)});else for(let n of t)e.push({kind:`row`,key:n.toolCallId||`r-${e.length}`,tc:n});t=[]};for(let e of this.toolCalls)(!this.compact||ZL(e))&&(t.length&&t[0].toolName===e.toolName?t.push(e):(n(),t=[e]));return n(),e},hiddenSteps(){return this.compact?this.toolCalls.filter(e=>!ZL(e)).length:0},summary(){return iR(this.toolCalls)},showSummary(){if(this.streaming)return!1;let e=this.summary;return!!(e.writes||e.writeFails||e.gate||e.validate||e.failed||this.cacheBadge)},cacheBadge(){let e=this.msg.usage;if(!e||!Number(e.promptTokens))return null;let t=Number(e.promptTokens)||0,n=Number(e.cachedTokens)||0,r=Number(e.steps)||0,i=e=>e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e);if(!e.reported)return{label:`缓存未提供`,ok:!1,title:`本回合累计输入 ${i(t)} token(${r} 步):该网关未回缓存命中字段,无法统计命中率`};let a=Number(e.hitRate)||0;return{label:`缓存命中 ${a}%`,ok:a>=50,title:`本回合累计输入 ${i(t)} token(${r} 步,命中 ${i(n)} / 未命中 ${i(t-n)}):命中量按网关的 64 token 块对齐,未命中部分多为本轮新增的工具结果与收尾提示`}},validateIssues(){let e=this.summary.validate;return e&&Array.isArray(e.issues)?e.issues:[]},validateMore(){let e=this.summary.validate;return e?Math.max(0,(e.errors||0)+(e.warnings||0)-this.validateIssues.length):0},advice(){return this.msg.error?oR(this.msg.errorCode||``):{hint:``,action:``}},errorHint(){return this.advice.hint},errorAction(){return this.advice.action},events(){return Array.isArray(this.msg.events)?this.msg.events:[]},hasErrorEvent(){return this.events.some(e=>e.level===`error`)},eventsExpanded(){return this.eventsOpen===null?this.hasErrorEvent:this.eventsOpen},eventsLabel(){let e=this.events.filter(e=>e.level!==`info`).length;return e?`过程事件 ${this.events.length} 条(${e} 条需留意)`:`过程事件 ${this.events.length} 条`},bodyText(){return TL(this.bodySplit.tail.replace(/\n*\[\s*(?:任务完成|需用户确认)\s*\]\s*$/,``).trimEnd(),RR)},bodySplit(){return dz(this.msg.content,this.msg.narrationChars)},narrationText(){return this.bodySplit.head?TL(this.bodySplit.head,RR):``},narrationSize(){return this.bodySplit.head.length.toLocaleString(`zh-CN`)},thinking(){return!(!this.streaming||this.msg.content||this.toolCalls.length)},streamingText(){return!!(this.streaming&&this.msg.content)},waiting(){return!(!this.streaming||this.msg.reasoning||this.msg.content||this.toolCalls.length||this.msg.error)},thinkLabel(){return this.thinking?`思考中… ${this.fmtClock(this.elapsedMs)}`:`已思考 ${this.fmtClock(this.msg.reasoningMs||this.elapsedMs)}`},elapsedMs(){return this.thinking?this.elapsed:this.msg.reasoningMs||this.elapsed},peek(){let e=String(this.msg.reasoning||``).split(`
349
+ `).map(e=>e.trim()).filter(Boolean),t=e[e.length-1]||``;return t.length>72?`${t.slice(0,72)}…`:t}},watch:{streaming:{immediate:!0,handler(e){e?this.startTick():this.stopTick()}},thinking(e){e||this.stopTick()}},beforeUnmount(){this.stopTick()},updated(){let e=this.$refs.thinkPre;e&&this.thinkOpen&&this.thinking&&(e.scrollTop=e.scrollHeight)},methods:{startTick(){this.stopTick(),this.elapsed=0,this._tick=setInterval(()=>{this.elapsed+=250},250)},stopTick(){this._tick&&clearInterval(this._tick),this._tick=0},fmtStamp:GL,fmtClock:WL,evOff(e){let t=Number(e&&e.ts)||0;return t>this.msgTs?KL(t-this.msgTs):``},groupClock(e){let t=qL(e[e.length-1],this.nowTs),n=t>this.msgTs?KL(t-this.msgTs):``;return[GL(e[0]&&e[0].startedAt),n].filter(Boolean).join(` · `)},fileUrl(e){return RR(e)},attSub(e){return e.exists===!1?`路径不可读`:e.isDir?`${e.entryCount??e.entries?.length??0} 项`:this.formatSize(e.size)},formatSize(e){let t=Number(e||0);return t?t<1024?`${t} B`:t<1048576?`${(t/1024).toFixed(1)} KB`:`${(t/1024/1024).toFixed(1)} MB`:`0 B`},toolLabel:VL,msText(e){let t=Number(e)||0;return t?t<1e3?`${t}ms`:`${(t/1e3).toFixed(1)}s`:``},groupOpen(e){let t=this.openGroups[e.key];if(t!==void 0)return t;if(e.failed)return!0;let n=e.rows[e.rows.length-1];return!(!n||n.result!==void 0||n.error)},toggleGroup(e){this.openGroups={...this.openGroups,[e.key]:!this.groupOpen(e)}},onApproval(e){this.$emit(`approval`,e)},async copyError(){await yp(`${this.msg.errorCode?`[${this.msg.errorCode}] `:``}${String(this.msg.error||``)}`)&&(this.errorCopied=!0,setTimeout(()=>{this.errorCopied=!1},1600))},async copyText(){await yp(String(this.msg.content||``))&&(this.copied=!0,setTimeout(()=>{this.copied=!1},1600))}}},mz={key:0,class:`aimsg__files`},hz=[`title`],gz=[`src`,`alt`],_z={key:1,class:`aifile__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},vz=[`href`],yz={class:`aifile__meta`},bz={class:`aifile__name`},xz={class:`aifile__sub`},Sz={key:1,class:`aimsg__bubble`},Cz=[`aria-expanded`],wz={key:0,class:`aithink__spin`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},Tz={key:1,class:`aithink__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},Ez={class:`aithink__label`},Dz={key:2,class:`aithink__peek`},Oz={class:`aithink__body`},kz={key:1,class:`aiwait`},Az=[`aria-expanded`,`onClick`],jz={class:`aitool__status`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},Mz=[`href`],Nz={class:`aitool__name`},Pz={class:`aitool__count`},Fz={class:`aitool__args`},Iz=[`title`],Lz=[`title`],Rz={class:`aitool__groupbody`},zz=[`aria-expanded`],Bz={class:`aiev__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},Vz=[`href`],Hz={class:`aiev__label`},Uz={class:`aiev__body`},Wz={class:`aiev__time`},Gz={key:0,class:`aiev__off`,title:`距本轮开始的累计耗时`},Kz={class:`aiev__msg`},qz=[`aria-expanded`,`title`],Jz={class:`ainarr__label`},Yz={class:`ainarr__hint`},Xz={class:`ainarr__body`},Zz={key:6,class:`aisum`},Qz={class:`aisum__head`},$z=[`title`],eB={class:`aisum__chips`},tB={key:0,class:`aisum__chip aisum__chip--ok`},nB={key:1,class:`aisum__chip aisum__chip--danger`},rB={key:2,class:`aisum__chip`},iB={key:4,class:`aisum__chip aisum__chip--warn`},aB=[`title`],oB={key:1,class:`aisum__issues`},sB={class:`aisum__issue-list`},cB={class:`aisum__issue-text`},lB=[`title`,`onClick`],uB={key:0,class:`aisum__issues-more`},dB={key:7,class:`aimsg__error`},fB={class:`aimsg__error-main`},pB={class:`aimsg__error-text`},mB={key:0,class:`aimsg__error-hint`},hB={key:1,class:`aimsg__error-time`},gB={key:2,class:`aimsg__error-acts`},_B={key:8,class:`aimsg__aborted`},vB={key:0,class:`aimsg__aborted-time`},yB=[`title`],bB={class:`aimsg__budget-text`},xB={key:10,class:`aimsg__acts`},SB=[`title`],CB={viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},wB=[`href`];function TB(e,t,n,r,i,a){let o=R(`ChatToolRow`),s=R(`MarkdownBody`);return V(),H(`article`,{class:j([`aimsg`,[`aimsg--${n.msg.role}`,{"aimsg--live":n.streaming}]])},[q(` ===== 用户消息:附件芯片 + 文本气泡 ===== `),n.msg.role===`user`?(V(),H(B,{key:0},[a.attachments.length?(V(),H(`div`,mz,[(V(!0),H(B,null,z(a.attachments,e=>(V(),H(`div`,{key:e.path,class:j([`aifile`,{"aifile--dir":e.isDir,"aifile--missing":e.exists===!1}]),title:e.path},[e.isImage?(V(),H(`img`,{key:0,class:`aifile__thumb`,src:a.fileUrl(e.path),alt:e.name,loading:`lazy`},null,8,gz)):(V(),H(`svg`,_z,[W(`use`,{href:e.isDir?`#icon-folder-plus`:`#icon-file-text`},null,8,vz)])),W(`span`,yz,[W(`span`,bz,M(e.name),1),W(`span`,xz,M(a.attSub(e)),1)])],10,hz))),128))])):q(`v-if`,!0),n.msg.content?(V(),H(`div`,Sz,M(n.msg.content),1)):q(`v-if`,!0)],64)):(V(),H(B,{key:1},[q(` ===== 助手消息:思考 → 工具 → 正文(与 Codex 同序) ===== `),q(` 思考过程:默认折叠成一行,进行中给「计时 + 最新一行」预览,结束收成「已思考 N 秒」 `),n.msg.reasoning?(V(),H(`div`,{key:0,class:j([`aithink`,{"is-open":i.thinkOpen,"is-live":a.thinking}])},[W(`button`,{type:`button`,class:`aithink__head`,"aria-expanded":i.thinkOpen?`true`:`false`,onClick:t[0]||=e=>i.thinkOpen=!i.thinkOpen},[t[17]||=W(`svg`,{class:`aithink__chev`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-chevron-right`})],-1),a.thinking?(V(),H(`svg`,wz,[...t[15]||=[W(`use`,{href:`#icon-loading`},null,-1)]])):(V(),H(`svg`,Tz,[...t[16]||=[W(`use`,{href:`#icon-sparkles`},null,-1)]])),W(`span`,Ez,M(a.thinkLabel),1),a.thinking&&!i.thinkOpen?(V(),H(`span`,Dz,M(a.peek),1)):q(`v-if`,!0)],8,Cz),L(W(`div`,Oz,[W(`pre`,{ref:`thinkPre`},M(n.msg.reasoning),513)],512),[[Nc,i.thinkOpen]])],2)):q(`v-if`,!0),q(` 首个 token 之前的等待态 `),a.waiting?(V(),H(`div`,kz,[...t[18]||=[W(`span`,{class:`aiwait__dot`},null,-1),W(`span`,{class:`aiwait__dot`},null,-1),W(`span`,{class:`aiwait__dot`},null,-1),W(`span`,{class:`aiwait__text`},`正在思考`,-1)]])):q(`v-if`,!0),q(` 工具调用:平铺单次调用;连续同名 ≥3 次折叠成分组行(长任务里几十次 card_read 不该刷屏)。
350
+ 行标记抽到 ChatToolRow:分组内成员与平铺行走同一份模板,两处不会漂移 `),(V(!0),H(B,null,z(a.toolGroups,r=>(V(),H(B,{key:r.key},[r.kind===`row`?(V(),U(o,{key:0,tc:r.tc,"turn-ts":a.msgTs,"now-ts":n.nowTs,"pick-owner":n.pickOwner,onApproval:a.onApproval,onPickBoard:t[1]||=t=>e.$emit(`pick-board`,t)},null,8,[`tc`,`turn-ts`,`now-ts`,`pick-owner`,`onApproval`])):(V(),H(`div`,{key:1,class:j([`aitool aitool--group`,[r.failed?`aitool--error`:`aitool--done`,{"is-open":a.groupOpen(r)}]])},[W(`button`,{type:`button`,class:`aitool__head`,"aria-expanded":a.groupOpen(r)?`true`:`false`,onClick:e=>a.toggleGroup(r)},[t[19]||=W(`svg`,{class:`aitool__chev`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-chevron-right`})],-1),(V(),H(`svg`,jz,[W(`use`,{href:r.failed?`#icon-alert-triangle`:`#icon-check`},null,8,Mz)])),W(`span`,Nz,M(a.toolLabel(r.toolName)),1),W(`span`,Pz,`×`+M(r.rows.length),1),W(`code`,Fz,M(r.failed?`${r.failed} 次失败,点开看原因`:`连续 ${r.rows.length} 次,点开逐条查看`),1),q(` 分组行同样给「首次调用时刻 · 累计到最后一次」:折叠不等于把时间线也折掉 `),r.clock?(V(),H(`span`,{key:0,class:`aitool__clock`,title:`首次调用 ${r.clock.split(` · `)[0]} · 距本轮开始的累计耗时(算到最后一次)`},M(r.clock),9,Iz)):q(`v-if`,!0),r.ms?(V(),H(`span`,{key:1,class:`aitool__ms`,title:`${r.rows.length} 次调用合计耗时`},M(a.msText(r.ms)),9,Lz)):q(`v-if`,!0)],8,Az),L(W(`div`,Rz,[(V(!0),H(B,null,z(r.rows,r=>(V(),U(o,{key:r.toolCallId,tc:r,"turn-ts":a.msgTs,"now-ts":n.nowTs,"pick-owner":n.pickOwner,onApproval:a.onApproval,onPickBoard:t[2]||=t=>e.$emit(`pick-board`,t)},null,8,[`tc`,`turn-ts`,`now-ts`,`pick-owner`,`onApproval`]))),128))],512),[[Nc,a.groupOpen(r)]])],2))],64))),128)),q(` 紧凑视图折叠掉的读取类调用:留一行出口,一键回到全量视图(不必去面板头部找开关) `),a.hiddenSteps?(V(),H(`button`,{key:2,type:`button`,class:`aitool__hidden`,onClick:t[3]||=t=>e.$emit(`show-all-steps`)},[t[20]||=W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-eye`})],-1),W(`span`,null,`紧凑视图已折叠 `+M(a.hiddenSteps)+` 次读取类调用,点这里显示全部步骤`,1)])):q(`v-if`,!0),q(` 过程事件时间线:后端 notice / round-retry 的持久落点。横幅只留最近一条且 6 秒即逝,
351
+ 「上下文折叠过几次 / 自动续跑过几次 / 网关重试过没有」这些线索全靠这里留存 `),a.events.length?(V(),H(`div`,{key:3,class:j([`aiev`,{"is-open":a.eventsExpanded}])},[W(`button`,{type:`button`,class:`aiev__head`,"aria-expanded":a.eventsExpanded?`true`:`false`,onClick:t[4]||=e=>i.eventsOpen=!a.eventsExpanded},[t[21]||=W(`svg`,{class:`aiev__chev`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-chevron-right`})],-1),(V(),H(`svg`,Bz,[W(`use`,{href:a.hasErrorEvent?`#icon-alert-triangle`:`#icon-activity`},null,8,Vz)])),W(`span`,Hz,M(a.eventsLabel),1)],8,zz),L(W(`ol`,Uz,[(V(!0),H(B,null,z(a.events,(e,t)=>(V(),H(`li`,{key:t,class:j([`aiev__row`,`aiev__row--${e.level}`])},[W(`span`,Wz,M(a.fmtStamp(e.ts)),1),a.evOff(e)?(V(),H(`span`,Gz,M(a.evOff(e)),1)):q(`v-if`,!0),W(`span`,Kz,M(e.message),1)],2))),128))],512),[[Nc,a.eventsExpanded]])],2)):q(`v-if`,!0),q(` 过程性正文:模型把推理过程当正文写出来时(实测单回合 46.7 万字),
352
+ 把「最后一次工具调用之前」那段折成一行——收尾结论照常展开,记录不再是一堵墙 `),a.narrationText?(V(),H(`div`,{key:4,class:j([`ainarr`,{"is-open":i.narrOpen}])},[W(`button`,{type:`button`,class:`ainarr__head`,"aria-expanded":i.narrOpen?`true`:`false`,title:i.narrOpen?`收起过程说明`:`展开过程说明(模型在本轮工具调用前的推理正文)`,onClick:t[5]||=e=>i.narrOpen=!i.narrOpen},[t[22]||=W(`svg`,{class:`ainarr__chev`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-chevron-right`})],-1),t[23]||=W(`svg`,{class:`ainarr__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-activity`})],-1),W(`span`,Jz,`过程说明 `+M(a.narrationSize)+` 字`,1),W(`span`,Yz,M(i.narrOpen?`收起`:`展开`),1)],8,qz),L(W(`div`,Xz,[G(s,{source:a.narrationText},null,8,[`source`])],512),[[Nc,i.narrOpen]])],2)):q(`v-if`,!0),q(` 正文:Markdown(流式重渲染 + 代码块高亮 / 复制) `),a.bodyText?(V(),U(s,{key:5,class:j([`aimsg__md`,{"is-streaming":a.streamingText}]),source:a.bodyText,streaming:a.streamingText},null,8,[`class`,`source`,`streaming`])):q(`v-if`,!0),q(` 本次改动摘要:写入次数 / 校验错误 / 门禁结论都从工具行就地算——落盘记录里同样算得出来,
353
+ 所以重开面板、刷新之后这条摘要依然在,而不是只在当轮可见 `),a.showSummary?(V(),H(`div`,Zz,[W(`span`,Qz,[t[25]||=W(`svg`,{class:`aisum__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-activity`})],-1),t[26]||=W(`span`,{class:`aisum__title`},`本次改动`,-1),q(` 本轮的时间坐标:几点开始、一共跑了多久。摘要条是回合的收尾锚点,这两个数在这里最有用 `),a.turnClock.stamp?(V(),H(`span`,{key:0,class:`aisum__clock`,title:`本轮 ${a.turnClock.stamp} 开始${a.turnClock.endStamp?`,${a.turnClock.endStamp} 收尾`:``}`},[K(M(a.turnClock.stamp)+` 开始`,1),a.turnClock.total?(V(),H(B,{key:0},[K(` · 累计 `+M(a.turnClock.total),1)],64)):q(`v-if`,!0)],8,$z)):q(`v-if`,!0),W(`span`,eB,[a.summary.writes?(V(),H(`span`,tB,`写入 `+M(a.summary.writes)+` 次`,1)):q(`v-if`,!0),a.summary.writeFails?(V(),H(`span`,nB,`写入失败 `+M(a.summary.writeFails)+` 次`,1)):q(`v-if`,!0),a.summary.shots?(V(),H(`span`,rB,`截图自检 `+M(a.summary.shots)+` 次`,1)):q(`v-if`,!0),a.summary.validate?(V(),H(`span`,{key:3,class:j([`aisum__chip`,a.summary.validate.ok?`aisum__chip--ok`:`aisum__chip--danger`])},`校验 `+M(a.summary.validate.errors)+` 错 / `+M(a.summary.validate.warnings)+` 警`,3)):q(`v-if`,!0),a.summary.failed?(V(),H(`span`,iB,M(a.summary.failed)+` 次调用报错`,1)):q(`v-if`,!0),a.cacheBadge?(V(),H(`span`,{key:5,class:j([`aisum__chip`,a.cacheBadge.ok?`aisum__chip--ok`:``]),title:a.cacheBadge.title},M(a.cacheBadge.label),11,aB)):q(`v-if`,!0)]),n.canRollback&&a.summary.writes?(V(),H(`button`,{key:1,type:`button`,class:`aisum__rollback`,title:`取本轮第一次写入前的历史快照,回到 AI 动手之前的版本;回滚本身可再撤销,确认后仍需点「保存到本地」才落盘`,onClick:t[6]||=t=>e.$emit(`rollback`,n.msg)},[...t[24]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-undo`})],-1),W(`span`,null,`回滚到本轮之前`,-1)]])):q(`v-if`,!0)]),q(` 门禁结论原样透出:这是唯一的机器判定,不能被模型自述的「已通过」覆盖 `),a.summary.gate?(V(),H(`p`,{key:0,class:j([`aisum__verdict`,a.summary.gate.passed?`is-pass`:`is-fail`])},[W(`strong`,null,`收尾门禁`+M(a.summary.gate.passed?`通过`:`未通过`),1),a.summary.gate.verdict?(V(),H(B,{key:0},[K(`:`+M(a.summary.gate.verdict),1)],64)):q(`v-if`,!0)],2)):q(`v-if`,!0),q(` 校验问题可点定位(P2-14):校验器在每条消息末尾挂了 #componentId,点「定位」就在画布与
354
+ 组件结构里选中那个节点——不用再照着一句 "at depth 1[0]" 自己去树里翻 `),a.validateIssues.length?(V(),H(`div`,oB,[t[28]||=W(`p`,{class:`aisum__issues-head`},[K(`校验问题`),W(`span`,{class:`aisum__issues-hint`},`点图标跳到该节点`)],-1),W(`ul`,sB,[(V(!0),H(B,null,z(a.validateIssues,(n,r)=>(V(),H(`li`,{key:r,class:j([`aisum__issue`,n.level===`error`?`is-error`:`is-warn`])},[W(`span`,cB,M(n.text),1),n.cid?(V(),H(`button`,{key:0,type:`button`,class:`aisum__issue-go`,title:`在画布与组件结构中定位 `+n.cid,"aria-label":`定位该节点`,onClick:t=>e.$emit(`locate-node`,n.cid)},[...t[27]||=[W(`svg`,{class:`aisum__issue-go-icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-locate`})],-1)]],8,lB)):q(`v-if`,!0)],2))),128))]),a.validateMore?(V(),H(`p`,uB,`另有 `+M(a.validateMore)+` 条:展开对应工具行看全部原文`,1)):q(`v-if`,!0)])):q(`v-if`,!0)])):q(`v-if`,!0),n.msg.error?(V(),H(`div`,dB,[t[29]||=W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-alert-triangle`})],-1),W(`span`,fB,[W(`span`,pB,M(n.msg.error),1),q(` 错误分级:后端给 code,这里给「怎么办」与对应的定向动作,不再只丢一句原文让人自己猜 `),a.errorHint?(V(),H(`span`,mB,M(a.errorHint),1)):q(`v-if`,!0),q(` 失败也要有时刻与累计:报网关工单 / 对后端日志时,「几点失败、跑了多久」是第一句要交代的话 `),a.turnClock.endStamp?(V(),H(`span`,hB,M(a.turnClock.endStamp)+` 失败 · 本轮已用 `+M(a.turnClock.total),1)):q(`v-if`,!0),n.streaming?q(`v-if`,!0):(V(),H(`span`,gB,[a.errorAction===`settings`?(V(),H(`button`,{key:0,type:`button`,class:`aimsg__budget-go`,onClick:t[7]||=t=>e.$emit(`open-settings`)},`打开设置`)):q(`v-if`,!0),n.canRegenerate?(V(),H(`button`,{key:1,type:`button`,class:`aimsg__budget-go`,onClick:t[8]||=t=>e.$emit(`regenerate`,n.msg)},`重试本轮`)):q(`v-if`,!0),n.canRegenerate?(V(),H(`button`,{key:2,type:`button`,class:`aimsg__budget-go aimsg__budget-go--ghost`,onClick:t[9]||=t=>e.$emit(`continue`)},`从中断处继续`)):q(`v-if`,!0),W(`button`,{type:`button`,class:`aimsg__budget-go aimsg__budget-go--ghost`,onClick:t[10]||=(...e)=>a.copyError&&a.copyError(...e)},M(i.errorCopied?`已复制`:`复制错误`),1)]))])])):q(`v-if`,!0),q(` 手动终止同样给续跑入口:已落盘产物与上下文都还在,点一下就能接着做。
355
+ 此前只有熔断收尾(budget)分支有按钮,手滑终止后用户只能自己打字 `),n.msg.status===`aborted`?(V(),H(`div`,_B,[t[30]||=W(`span`,{class:`aimsg__aborted-text`},`已终止生成`,-1),a.turnClock.endStamp?(V(),H(`span`,vB,M(a.turnClock.endStamp)+` 终止 · 已用 `+M(a.turnClock.total),1)):q(`v-if`,!0),n.canRegenerate&&!n.streaming?(V(),H(`button`,{key:1,type:`button`,class:`aimsg__budget-go`,onClick:t[11]||=t=>e.$emit(`continue`)},`从中断处继续`)):q(`v-if`,!0)])):n.msg.budget?.message?(V(),H(`div`,{key:9,class:`aimsg__budget`,title:a.budgetHint},[t[31]||=W(`svg`,{class:`aimsg__budget-icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-alert-triangle`})],-1),W(`span`,bB,[W(`strong`,null,M(a.budgetLabel),1),K(`:`+M(n.msg.budget.message)+`(上下文已保留)`,1)]),n.canRegenerate&&!n.streaming?(V(),H(`button`,{key:0,type:`button`,class:`aimsg__budget-go`,onClick:t[12]||=t=>e.$emit(`continue`)},`继续这轮`)):q(`v-if`,!0)],8,yB)):q(`v-if`,!0),q(` 悬停操作:复制 / 重新生成(仅最后一条助手消息可重发) `),n.msg.content||n.msg.error?(V(),H(`footer`,xB,[W(`button`,{type:`button`,class:`aimsg__act`,title:i.copied?`已复制`:`复制回答`,onClick:t[13]||=(...e)=>a.copyText&&a.copyText(...e)},[(V(),H(`svg`,CB,[W(`use`,{href:i.copied?`#icon-check`:`#icon-copy-sm`},null,8,wB)])),W(`span`,null,M(i.copied?`已复制`:`复制`),1)],8,SB),n.canRegenerate&&!n.streaming?(V(),H(`button`,{key:0,type:`button`,class:`aimsg__act`,title:`丢弃这次回答并重新生成`,onClick:t[14]||=t=>e.$emit(`regenerate`,n.msg)},[...t[32]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-reset`})],-1),W(`span`,null,`重新生成`,-1)]])):q(`v-if`,!0)])):q(`v-if`,!0)],64))],2)}var EB=Z(pz,[[`render`,TB],[`__file`,`/Users/ynet/dsl-card/card-editor/components/ChatMessage.vue`]]),DB=8;function OB(e){let t=e||null;if(!t)return null;let n=Number(t.total)>0?Number(t.total):Number(t.window)>0?Number(t.window):0,r=Math.max(0,Number(t.used)||0);if(!(n>0))return null;let i=Math.min(1,r/n),a=2*Math.PI*DB;return{pct:i,arc:(a*i).toFixed(2),circ:a.toFixed(2),pctLabel:`${Math.round(i*100)}%`,level:i>=.85?`danger`:i>=.6?`warn`:`ok`,used:r,total:n,measured:t.source===`measured`||t.source===`anchored`}}var kB=e=>e>=1e3?`${(e/1e3).toFixed(1)}k`:String(Math.round(e));function AB(e){let t=OB(e);if(!t)return``;let n=Number(e?.window)>0?`,网关窗口 ${kB(Number(e.window))}`:``,r=t.measured?`网关实测`:`估算`;return`上下文占用 ${kB(t.used)} / ${kB(t.total)} token(${t.pctLabel},${r})${n};分母是本轮上下文预算,接近上限时后端会自动折叠早期工具结果`}var jB=106,MB=.5,NB=`cardbuddy:ai-composer-height`,PB={name:`ChatComposer`,props:{busy:{type:Boolean,default:!1},model:{type:String,default:``},attachments:{type:Array,default:()=>[]},placeholder:{type:String,default:`描述你要改的卡片,Enter 发送 / Shift+Enter 换行`},context:{type:Object,default:null}},emits:[`send`,`stop`,`pick`,`add-path`,`remove-attachment`,`drop-files`,`paste-image`,`escape`],data(){return{text:``,attachOpen:!1,pathInputOpen:!1,pathText:``,dragOver:!1,heightPx:0,resizing:!1,_outside:null,_onWinResize:null}},computed:{canSend(){return!!(this.text.trim()||this.attachments.some(e=>!e.pending&&e.exists!==!1))},compStyle(){return this.heightPx>0?{height:`${this.heightPx}px`}:null},ctx(){return OB(this.context)},ctxTitle(){return AB(this.context)}},mounted(){this._outside=e=>{let t=this.$refs.attachEl;t&&!t.contains(e.target)&&(this.attachOpen=!1)},document.addEventListener(`mousedown`,this._outside),this.loadHeight(),this._onWinResize=()=>this.clampHeight(),window.addEventListener(`resize`,this._onWinResize),this.autoGrow()},beforeUnmount(){this._outside&&document.removeEventListener(`mousedown`,this._outside),this._onWinResize&&window.removeEventListener(`resize`,this._onWinResize)},methods:{focus(){this.$nextTick(()=>this.$refs.taEl?.focus())},setText(e){this.text=e,this.focus(),this.autoGrow()},fileUrl(e){return RR(e)},chipSub(e){if(e.exists===!1)return`不可读`;if(e.isDir)return`${e.entryCount??e.entries?.length??0} 项`;let t=Number(e.size||0);return t?t<1024?`${t} B`:t<1048576?`${(t/1024).toFixed(0)} KB`:`${(t/1024/1024).toFixed(1)} MB`:``},autoGrow(){let e=this.$refs.taEl;e&&(this.heightPx>0?e.style.height=``:(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,168)}px`))},heightLimits(){let e=this.$el?.closest(`.aichat`)?.clientHeight||window.innerHeight;return{min:jB,max:Math.max(jB,Math.floor(e*MB))}},clampHeight(){if(!this.heightPx)return;let{min:e,max:t}=this.heightLimits();this.heightPx=Math.max(e,Math.min(t,this.heightPx))},loadHeight(){try{let e=localStorage.getItem(NB),t=e==null?0:parseInt(e,10);!Number.isNaN(t)&&t>=jB&&(this.heightPx=t)}catch{}this.clampHeight()},saveHeight(){try{this.heightPx?localStorage.setItem(NB,String(Math.round(this.heightPx))):localStorage.removeItem(NB)}catch{}},startResize(e){let t=e&&e.currentTarget;if(!t)return;this.resizing=!0,document.body.style.cursor=`row-resize`,document.body.style.userSelect=`none`;let n=e.pointerId;try{t.setPointerCapture(n)}catch{}let r=this.$el.getBoundingClientRect().bottom,i=e=>{let{min:t,max:n}=this.heightLimits();this.heightPx=Math.max(t,Math.min(n,Math.round(r-e.clientY)))},a=()=>{t.removeEventListener(`pointermove`,i),t.removeEventListener(`pointerup`,a),t.removeEventListener(`pointercancel`,a),window.removeEventListener(`blur`,a);try{t.hasPointerCapture?.(n)&&t.releasePointerCapture(n)}catch{}this.resizing=!1,document.body.style.cursor=``,document.body.style.userSelect=``,this.saveHeight()};t.addEventListener(`pointermove`,i),t.addEventListener(`pointerup`,a),t.addEventListener(`pointercancel`,a),window.addEventListener(`blur`,a)},resetHeight(){this.heightPx=0,this.saveHeight(),this.$nextTick(this.autoGrow)},onKeydown(e){e.key===`Escape`?(e.preventDefault(),this.$emit(`escape`)):e.key===`Enter`&&(e.isComposing||e.keyCode===229||e.shiftKey||(e.preventDefault(),this.busy||this.submit()))},submit(){if(this.busy||!this.canSend)return;let e={text:this.text.trim(),attachments:this.attachments.filter(e=>!e.pending&&e.exists!==!1)};this.text=``,this.attachOpen=!1,this.$nextTick(this.autoGrow),this.$emit(`send`,e)},toggleAttach(){this.attachOpen=!this.attachOpen},pick(e){this.attachOpen=!1,this.$emit(`pick`,e)},openPathInput(){this.attachOpen=!1,this.pathInputOpen=!0,this.pathText=``,this.$nextTick(()=>this.$refs.pathEl?.focus())},closePathInput(){this.pathInputOpen=!1,this.pathText=``},confirmPath(){let e=this.pathText.trim();e&&(this.$emit(`add-path`,e),this.closePathInput())},onDragEnter(){this.dragOver=!0},onDragOver(){this.dragOver=!0},onDragLeave(){this.dragOver=!1},onDrop(e){this.dragOver=!1;let t=e.dataTransfer;t&&this.$emit(`drop-files`,t)},async onPaste(e){let t=e.clipboardData?.items;if(t){for(let n of t)if(n.type&&n.type.indexOf(`image/`)===0){let t=n.getAsFile();if(!t)continue;e.preventDefault();let r=await new Promise(e=>{let n=new FileReader;n.onload=()=>e(String(n.result||``)),n.onerror=()=>e(``),n.readAsDataURL(t)});r&&this.$emit(`paste-image`,r);return}}}}},FB={key:0,class:`aicomp__files`},IB=[`title`],LB=[`src`,`alt`],RB={key:1,class:`aichip__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},zB=[`href`],BB={class:`aichip__name`},VB={key:2,class:`aichip__sub`},HB=[`onClick`],UB={key:1,class:`aicomp__path`},WB=[`disabled`],GB=[`placeholder`],KB={class:`aicomp__bar`},qB={class:`aicomp__tools`},JB={class:`aicomp__attach`,ref:`attachEl`},YB={key:0,class:`aicomp__menu`,role:`menu`},XB={class:`aicomp__right`},ZB=[`title`],QB={class:`aicomp__ctx-ring`,viewBox:`0 0 20 20`,"aria-hidden":`true`},$B=[`stroke-dasharray`],eV={class:`aicomp__ctx-pct`},tV=[`title`],nV=[`disabled`,`title`];function rV(e,t,n,r,i,a){return V(),H(`div`,{class:j([`aicomp`,{"is-busy":n.busy,"is-drag":i.dragOver,"is-manual":i.heightPx>0,"is-resizing":i.resizing}]),style:A(a.compStyle)},[q(` 上缘拖拽把手:调输入区高度(106px ~ 面板高度 50%,双击恢复自适应),与面板宽度把手同一套交互 `),W(`div`,{class:j([`aicomp__grip`,{"is-dragging":i.resizing}]),title:`拖拽调整输入区高度(双击恢复自适应)`,onPointerdown:t[0]||=J((...e)=>a.startResize&&a.startResize(...e),[`prevent`]),onDblclick:t[1]||=J((...e)=>a.resetHeight&&a.resetHeight(...e),[`prevent`])},null,34),q(` 已挂载的本地文件:只预览 + 传路径,不上传 `),n.attachments.length?(V(),H(`div`,FB,[(V(!0),H(B,null,z(n.attachments,n=>(V(),H(`div`,{key:n.id||n.path,class:j([`aichip`,{"aichip--dir":n.isDir,"aichip--pending":n.pending,"aichip--missing":n.exists===!1}]),title:n.path},[n.isImage&&!n.pending?(V(),H(`img`,{key:0,class:`aichip__thumb`,src:a.fileUrl(n.path),alt:n.name,loading:`lazy`},null,8,LB)):(V(),H(`svg`,RB,[W(`use`,{href:n.pending?`#icon-loading`:n.isDir?`#icon-folder-plus`:n.isImage?`#icon-image`:`#icon-file-text`},null,8,zB)])),W(`span`,BB,M(n.pending?`解析路径中…`:n.name),1),n.pending?q(`v-if`,!0):(V(),H(`span`,VB,M(a.chipSub(n)),1)),W(`button`,{type:`button`,class:`aichip__rm`,title:`移除`,onClick:t=>e.$emit(`remove-attachment`,n.id||n.path)},[...t[22]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-x`})],-1)]],8,HB)],10,IB))),128))])):q(`v-if`,!0),q(` 粘贴绝对路径(非 macOS / 拖拽反查失败时的兜底入口) `),i.pathInputOpen?(V(),H(`div`,UB,[L(W(`input`,{ref:`pathEl`,"onUpdate:modelValue":t[2]||=e=>i.pathText=e,class:`aicomp__path-input`,type:`text`,placeholder:`粘贴本地图片或文件夹的绝对路径,回车确认`,spellcheck:`false`,onKeydown:[t[3]||=jl(J((...e)=>a.confirmPath&&a.confirmPath(...e),[`prevent`]),[`enter`]),t[4]||=jl(J((...e)=>a.closePathInput&&a.closePathInput(...e),[`stop`,`prevent`]),[`esc`])]},null,544),[[gl,i.pathText]]),W(`button`,{type:`button`,class:`aicomp__path-ok`,disabled:!i.pathText.trim(),onClick:t[5]||=(...e)=>a.confirmPath&&a.confirmPath(...e)},`添加`,8,WB),W(`button`,{type:`button`,class:`aicomp__path-no`,onClick:t[6]||=(...e)=>a.closePathInput&&a.closePathInput(...e)},`取消`)])):q(`v-if`,!0),W(`div`,{class:`aicomp__box`,onDragenter:t[18]||=J((...e)=>a.onDragEnter&&a.onDragEnter(...e),[`prevent`]),onDragover:t[19]||=J((...e)=>a.onDragOver&&a.onDragOver(...e),[`prevent`]),onDragleave:t[20]||=J((...e)=>a.onDragLeave&&a.onDragLeave(...e),[`prevent`]),onDrop:t[21]||=J((...e)=>a.onDrop&&a.onDrop(...e),[`prevent`])},[L(W(`textarea`,{ref:`taEl`,"onUpdate:modelValue":t[7]||=e=>i.text=e,class:`aicomp__ta`,placeholder:n.placeholder,rows:`1`,onInput:t[8]||=(...e)=>a.autoGrow&&a.autoGrow(...e),onKeydown:t[9]||=(...e)=>a.onKeydown&&a.onKeydown(...e),onPaste:t[10]||=(...e)=>a.onPaste&&a.onPaste(...e)},null,40,GB),[[gl,i.text]]),W(`div`,KB,[W(`div`,qB,[W(`div`,JB,[W(`button`,{type:`button`,class:j([`aicomp__iconbtn`,{"is-open":i.attachOpen}]),title:`挂载本地图片 / 文件 / 文件夹`,onClick:t[11]||=(...e)=>a.toggleAttach&&a.toggleAttach(...e)},[...t[23]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-paperclip`})],-1)]],2),i.attachOpen?(V(),H(`div`,YB,[W(`button`,{type:`button`,role:`menuitem`,onClick:t[12]||=e=>a.pick(`image`)},[...t[24]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-image`})],-1),K(` 本地图片… `,-1)]]),W(`button`,{type:`button`,role:`menuitem`,onClick:t[13]||=e=>a.pick(`file`)},[...t[25]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-file-text`})],-1),K(` 本地文件… `,-1)]]),W(`button`,{type:`button`,role:`menuitem`,onClick:t[14]||=e=>a.pick(`folder`)},[...t[26]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-folder-plus`})],-1),K(` 本地文件夹… `,-1)]]),t[28]||=W(`div`,{class:`aicomp__menu-sep`},null,-1),W(`button`,{type:`button`,role:`menuitem`,onClick:t[15]||=(...e)=>a.openPathInput&&a.openPathInput(...e)},[...t[27]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-link`})],-1),K(` 粘贴路径… `,-1)]])])):q(`v-if`,!0)],512),t[29]||=W(`span`,{class:`aicomp__hint`},`拖拽文件 / 文件夹到此,或直接 ⌘V 粘贴截图`,-1)]),W(`div`,XB,[a.ctx?(V(),H(`span`,{key:0,class:j([`aicomp__ctx`,[`is-${a.ctx.level}`,a.ctx.measured?``:`is-est`]]),title:a.ctxTitle},[(V(),H(`svg`,QB,[t[30]||=W(`circle`,{class:`aicomp__ctx-track`,cx:`10`,cy:`10`,r:`8`},null,-1),W(`circle`,{class:`aicomp__ctx-arc`,cx:`10`,cy:`10`,r:`8`,"stroke-dasharray":`${a.ctx.arc} ${a.ctx.circ}`,transform:`rotate(-90 10 10)`},null,8,$B)])),W(`span`,eV,M(a.ctx.pctLabel),1)],10,ZB)):q(`v-if`,!0),n.model?(V(),H(`span`,{key:1,class:`aicomp__model`,title:`当前模型:${n.model}`},M(n.model),9,tV)):q(`v-if`,!0),n.busy?(V(),H(`button`,{key:2,type:`button`,class:`aicomp__send aicomp__send--stop`,title:`终止生成(Esc)`,onClick:t[16]||=t=>e.$emit(`stop`)},[...t[31]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"aria-hidden":`true`},[W(`use`,{href:`#icon-stop`})],-1)]])):(V(),H(`button`,{key:3,type:`button`,class:`aicomp__send`,disabled:!a.canSend,title:a.canSend?`发送(Enter)`:`输入内容后发送`,onClick:t[17]||=(...e)=>a.submit&&a.submit(...e)},[...t[32]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-send`})],-1)]],8,nV))])])],32)],6)}var iV=Z(PB,[[`render`,rV],[`__file`,`/Users/ynet/dsl-card/card-editor/components/ChatComposer.vue`]]),aV={name:`AiSettings`,components:{NumberStepper:J_,Switch:SN},props:{config:{type:Object,default:()=>({baseUrl:``,model:``,hasKey:!1,apiKeyMasked:``})},modelId:{type:String,default:null},initialModel:{type:Object,default:null}},emits:[`close`,`saved`],data(){let e=this.modelId&&this.initialModel||{};return{form:{name:e.name||``,baseUrl:e.baseUrl||``,model:e.model||``,apiKey:``,thinking:e.thinking!==!1,vision:e.vision===!0,maxTokens:e.maxTokensAuto?0:Number(e.maxTokens)>0?Number(e.maxTokens):0},reveal:!1,saving:!1,testing:!1,probing:!1,ping:null,help:null,keyLoaded:!1,submitted:!1,touched:{}}},computed:{title(){return this.modelId?`编辑模型`:`添加模型`},errors(){let e={},t=this.form.baseUrl.trim(),n=this.form.model.trim();return t?/^https?:\/\/[^\s]+$/i.test(t)||(e.baseUrl=`Base URL 需以 http:// 或 https:// 开头`):e.baseUrl=`请填写 Base URL`,n||(e.model=`请填写模型名`),!this.keyLoaded&&!this.form.apiKey.trim()&&(e.apiKey=`请填写 API Key`),e},isValid(){return Object.keys(this.errors).length===0},knownCapLimit(){return(Number(this.config.maxTokensCap)>0?Number(this.config.maxTokensCap):0)||(Number(this.config.maxTokensWindow)>0?Number(this.config.maxTokensWindow):0)},maxTokensOver(){return this.knownCapLimit>0&&this.form.maxTokens>this.knownCapLimit},maxTokensPlaceholder(){let e=Number(this.config.maxTokens)>0?Number(this.config.maxTokens):0;return e>0?`留空 = 自动(当前按 ${e})`:`留空 = 自动`},keyPlaceholder(){return this.keyLoaded?this.form.apiKey?``:`已保存的密钥为空,请填写新密钥`:this.config.hasKey?`已保存(${this.config.apiKeyMasked||`••••`}),回显失败:留空沿用、填写覆盖`:`sk-…`}},created(){this.loadKey()},mounted(){document.addEventListener(`click`,this.onDocClick,!0),document.addEventListener(`keydown`,this.onKeydown)},beforeUnmount(){document.removeEventListener(`click`,this.onDocClick,!0),document.removeEventListener(`keydown`,this.onKeydown)},methods:{toggleHelp(e){this.help=this.help===e?null:e},showError(e){return!!this.errors[e]&&(this.submitted||this.touched[e])},markTouched(e){this.$set(this.touched,e,!0)},onDocClick(e){if(!this.help)return;let t=e.target;t instanceof Element&&t.closest(`.aiset__pop, .aiset__help`)||(this.help=null)},onKeydown(e){e.key===`Escape`&&this.help&&(e.stopPropagation(),this.help=null)},onMaxTokens(e){let t=Number(String(e).trim());this.form.maxTokens=Number.isFinite(t)&&t>=0?Math.round(t):0},async probe(){let e=[];if(this.form.baseUrl.trim()||e.push(`Base URL`),this.form.apiKey.trim()||e.push(`API Key`),this.form.model.trim()||e.push(`模型名`),e.length)this.ping={ok:!1,text:`探测前请先填写:${e.join(` / `)}`};else{this.probing=!0,this.ping=null;try{let e=await YR({baseUrl:this.form.baseUrl,apiKey:this.form.apiKey,model:this.form.model}),t=Number(e.window)>0?Number(e.window):0,n=Number(e.cap)>0?Number(e.cap):0;if(n>0){this.form.maxTokens=n;let r=e.source===`models-meta`?`模型元数据`:e.source===`probe`?`二分试探`:e.source===`halved`?`减半回写`:e.source||`探测`,i=[`接受单次输出上限 ${n}`];t>0&&i.push(`上下文窗口 ${t}`),this.ping={ok:!0,text:`网关${i.join(`、`)}(来源:${r})→ 已填入 ${n};留空则走自动(取 min(上限, ${Number(e.ceiling)>0?e.ceiling:32768}) = ${Number(e.autoMax)>0?e.autoMax:n})`}}else{let n=[];t>0&&n.push(`上下文窗口 ${t}`),e.source===`fallback`?n.push(`网关未接受任何档位(可能是地址 / 密钥 / 模型名有误,或该网关不暴露上限)`):n.push(`未探到网关接受的单次输出上限`),this.ping={ok:!1,text:`${n.join(`;`)}。建议留空走自动:后端按默认值开跑,被网关拒绝时自动减半并记下真实上限`}}}catch(e){this.ping={ok:!1,text:`探测失败:${e.message||e}`}}finally{this.probing=!1}}},async loadKey(){if(this.modelId)try{let e=await WR(this.modelId,!0),t=typeof e.apiKey==`string`?e.apiKey:``;t&&(this.form.apiKey=t,this.keyLoaded=!0),typeof e.name==`string`&&(this.form.name=e.name),typeof e.baseUrl==`string`&&(this.form.baseUrl=e.baseUrl),typeof e.model==`string`&&(this.form.model=e.model),this.form.maxTokens=e.maxTokensAuto||!(Number(e.maxTokens)>0)?0:Number(e.maxTokens),e.thinking!==void 0&&(this.form.thinking=e.thinking!==!1),e.vision!==void 0&&(this.form.vision=e.vision===!0)}catch{}},payload(){let e={name:this.form.name.trim(),baseUrl:this.form.baseUrl.trim(),model:this.form.model.trim(),thinking:!!this.form.thinking,vision:!!this.form.vision,maxTokens:Number(this.form.maxTokens)>0?Number(this.form.maxTokens):0};return(this.keyLoaded||this.form.apiKey.trim())&&(e.apiKey=this.form.apiKey.trim()),e},async test(){if(!this.isValid)this.submitted=!0,this.help=null,this.ping={ok:!1,text:`请先补全必填项(Base URL / 模型名 / API Key)再测试连接`};else{this.testing=!0,this.ping=null;try{let e=await XR(this.payload());this.ping=e.ok?{ok:!0,text:`连接正常 · ${e.model||this.form.model} · ${e.latencyMs}ms`}:{ok:!1,text:`连接失败${e.status?`(HTTP ${e.status})`:``}:${e.message||`未知错误`}`}}catch(e){this.ping={ok:!1,text:`测试失败:${e.message||e}`}}finally{this.testing=!1}}},async save(){if(this.submitted=!0,!this.isValid){this.help=null;let e={baseUrl:`aiset-baseurl`,model:`aiset-model`,apiKey:`aiset-key`},t=Object.keys(this.errors)[0],n=t?this.$el.querySelector(`#${e[t]}`):null;n&&typeof n.focus==`function`&&n.focus(),this.ping={ok:!1,text:`请先补全必填项(Base URL / 模型名 / API Key)`}}else{this.saving=!0;try{let e=this.modelId?await KR(this.modelId,this.payload()):await GR(this.payload());this.$emit(`saved`,e)}catch(e){this.ping={ok:!1,text:`保存失败:${e.message||e}`}}finally{this.saving=!1}}}}},oV={class:`aiset__mask`},sV={class:`aiset`,role:`dialog`,"aria-modal":`true`,"aria-label":`AI 模型设置`},cV={class:`aiset__head`},lV={class:`aiset__title`},uV={class:`aiset__body`},dV={class:`aiset__field`},fV={class:`aiset__field`},pV={class:`aiset__labelrow`},mV=[`aria-expanded`],hV=[`aria-invalid`],gV={key:0,class:`aiset__errline`},_V={key:1,class:`aiset__pop`},vV={class:`aiset__field`},yV={class:`aiset__labelrow`},bV=[`aria-expanded`],xV=[`aria-invalid`],SV={key:0,class:`aiset__errline`},CV={key:1,class:`aiset__pop`},wV={class:`aiset__field`},TV={class:`aiset__labelrow`},EV=[`aria-expanded`],DV={class:`aiset__keywrap`},OV=[`type`,`placeholder`,`aria-invalid`],kV=[`title`,`aria-pressed`],AV={viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},jV=[`href`],MV={key:0,class:`aiset__errline`},NV={key:1,class:`aiset__pop`},PV={class:`aiset__field`},FV={class:`aiset__labelrow`},IV=[`aria-expanded`],LV={class:`aiset__stepperrow`},RV=[`disabled`],zV={key:0,class:`aiset__warnline`},BV={key:1,class:`aiset__pop`},VV={class:`aiset__field`},HV={class:`aiset__labelrow`},UV=[`aria-expanded`],WV={key:0,class:`aiset__pop`},GV={class:`aiset__field`},KV={class:`aiset__labelrow`},qV=[`aria-expanded`],JV={key:0,class:`aiset__pop`},YV={viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},XV=[`href`],ZV={class:`aiset__foot`},QV=[`disabled`],$V={class:`aiset__btn-icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},eH=[`href`],tH=[`disabled`],nH=[`disabled`];function rH(e,t,n,r,i,a){let o=R(`NumberStepper`),s=R(`Switch`);return V(),H(`div`,oV,[W(`section`,sV,[W(`header`,cV,[t[22]||=W(`svg`,{class:`aiset__head-icon is-solid-icon`,viewBox:`0 0 1024 1024`,"aria-hidden":`true`},[W(`use`,{href:`#icon-model`})],-1),W(`span`,lV,M(a.title),1),W(`button`,{type:`button`,class:`aiset__x`,title:`关闭`,onClick:t[0]||=t=>e.$emit(`close`)},[...t[21]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-x`})],-1)]])]),q(` 字段说明一律收进「?」浮层:面板只留标签 + 控件,需要时点开看详情 `),W(`div`,uV,[W(`div`,dV,[t[23]||=W(`div`,{class:`aiset__labelrow`},[W(`label`,{class:`aiset__label`,for:`aiset-name`},`名称`)],-1),L(W(`input`,{id:`aiset-name`,"onUpdate:modelValue":t[1]||=e=>i.form.name=e,class:`aiset__input`,type:`text`,placeholder:`模型显示名(如 GPT-4o / 我的 GLM)`,spellcheck:`false`,autocomplete:`off`},null,512),[[gl,i.form.name]])]),W(`div`,fV,[W(`div`,pV,[t[25]||=W(`label`,{class:`aiset__label`,for:`aiset-baseurl`},[K(`Base URL`),W(`i`,{class:`aiset__req`,"aria-hidden":`true`},`*`)],-1),W(`button`,{type:`button`,class:j([`aiset__help`,{"is-on":i.help===`baseUrl`}]),"aria-expanded":i.help===`baseUrl`,title:`查看说明`,onClick:t[2]||=J(e=>a.toggleHelp(`baseUrl`),[`stop`])},[...t[24]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-help`})],-1)]],10,mV)]),L(W(`input`,{id:`aiset-baseurl`,"onUpdate:modelValue":t[3]||=e=>i.form.baseUrl=e,class:j([`aiset__input`,{"is-invalid":a.showError(`baseUrl`)}]),type:`text`,placeholder:`https://api.example.com/v1`,spellcheck:`false`,autocomplete:`off`,"aria-invalid":a.showError(`baseUrl`)?`true`:`false`,onBlur:t[4]||=e=>a.markTouched(`baseUrl`)},null,42,hV),[[gl,i.form.baseUrl]]),a.showError(`baseUrl`)?(V(),H(`p`,gV,M(a.errors.baseUrl),1)):q(`v-if`,!0),i.help===`baseUrl`?(V(),H(`p`,_V,[...t[26]||=[K(`OpenAI 兼容网关的基址,`,-1),W(`strong`,null,`不含`,-1),K(),W(`code`,null,`/chat/completions`,-1),K(` 后缀(后端会自己拼)。例:`,-1),W(`code`,null,`https://api.openai.com/v1`,-1),K(`。`,-1)]])):q(`v-if`,!0)]),W(`div`,vV,[W(`div`,yV,[t[28]||=W(`label`,{class:`aiset__label`,for:`aiset-model`},[K(`模型名`),W(`i`,{class:`aiset__req`,"aria-hidden":`true`},`*`)],-1),W(`button`,{type:`button`,class:j([`aiset__help`,{"is-on":i.help===`model`}]),"aria-expanded":i.help===`model`,title:`查看说明`,onClick:t[5]||=J(e=>a.toggleHelp(`model`),[`stop`])},[...t[27]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-help`})],-1)]],10,bV)]),L(W(`input`,{id:`aiset-model`,"onUpdate:modelValue":t[6]||=e=>i.form.model=e,class:j([`aiset__input`,{"is-invalid":a.showError(`model`)}]),type:`text`,placeholder:`gpt-4o / GLM-4.6 / deepseek-chat`,spellcheck:`false`,autocomplete:`off`,"aria-invalid":a.showError(`model`)?`true`:`false`,onBlur:t[7]||=e=>a.markTouched(`model`)},null,42,xV),[[gl,i.form.model]]),a.showError(`model`)?(V(),H(`p`,SV,M(a.errors.model),1)):q(`v-if`,!0),i.help===`model`?(V(),H(`p`,CV,`必须与网关侧的模型标识完全一致。建卡这类多步工具调用建议用支持 function calling 的模型。`)):q(`v-if`,!0)]),W(`div`,wV,[W(`div`,TV,[t[30]||=W(`label`,{class:`aiset__label`,for:`aiset-key`},[K(`API Key`),W(`i`,{class:`aiset__req`,"aria-hidden":`true`},`*`)],-1),W(`button`,{type:`button`,class:j([`aiset__help`,{"is-on":i.help===`apiKey`}]),"aria-expanded":i.help===`apiKey`,title:`查看说明`,onClick:t[8]||=J(e=>a.toggleHelp(`apiKey`),[`stop`])},[...t[29]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-help`})],-1)]],10,EV)]),W(`div`,DV,[L(W(`input`,{id:`aiset-key`,"onUpdate:modelValue":t[9]||=e=>i.form.apiKey=e,class:j([`aiset__input aiset__input--key`,{"is-invalid":a.showError(`apiKey`)}]),type:i.reveal?`text`:`password`,placeholder:a.keyPlaceholder,spellcheck:`false`,autocomplete:`off`,"aria-invalid":a.showError(`apiKey`)?`true`:`false`,onBlur:t[10]||=e=>a.markTouched(`apiKey`)},null,42,OV),[[Tl,i.form.apiKey]]),W(`button`,{type:`button`,class:`aiset__eye`,title:i.reveal?`掩码显示密钥`:`明文显示密钥`,"aria-pressed":i.reveal,onClick:t[11]||=e=>i.reveal=!i.reveal},[(V(),H(`svg`,AV,[W(`use`,{href:i.reveal?`#icon-eye-off`:`#icon-eye`},null,8,jV)]))],8,kV)]),a.showError(`apiKey`)?(V(),H(`p`,MV,M(a.errors.apiKey),1)):q(`v-if`,!0),i.help===`apiKey`?(V(),H(`p`,NV,[...t[31]||=[K(` 密钥保存在项目根 `,-1),W(`code`,null,`.env.cb.local`,-1),K(`(个人覆盖层,已被 .gitignore 忽略,不会进版本库)。 打开面板自动回填已保存的密钥(默认掩码),点输入框尾部小眼睛切换明文;`,-1),W(`strong`,null,`清空后保存即删除`,-1),K(`已保存的密钥。 `,-1)]])):q(`v-if`,!0)]),W(`div`,PV,[W(`div`,FV,[t[33]||=W(`label`,{class:`aiset__label`},`单次输出上限`,-1),t[34]||=W(`span`,{class:`aiset__unit`},`max_tokens`,-1),W(`button`,{type:`button`,class:j([`aiset__help`,{"is-on":i.help===`maxTokens`}]),"aria-expanded":i.help===`maxTokens`,title:`查看说明`,onClick:t[12]||=J(e=>a.toggleHelp(`maxTokens`),[`stop`])},[...t[32]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-help`})],-1)]],10,IV)]),W(`div`,LV,[G(o,{id:`aiset-maxtok`,class:`aiset__stepper`,value:i.form.maxTokens>0?String(i.form.maxTokens):``,step:1024,min:0,max:262144,placeholder:a.maxTokensPlaceholder,onInput:a.onMaxTokens},null,8,[`value`,`placeholder`,`onInput`]),W(`button`,{type:`button`,class:`aiset__btn`,disabled:i.probing||i.saving||i.testing,onClick:t[13]||=(...e)=>a.probe&&a.probe(...e)},M(i.probing?`探测中…`:`探测`),9,RV)]),a.maxTokensOver?(V(),H(`p`,zV,` 超过网关已知上限 `+M(a.knownCapLimit)+`:对话时会主动夹取到该值,建议留空走自动 `,1)):q(`v-if`,!0),i.help===`maxTokens`?(V(),H(`p`,BV,[t[35]||=W(`strong`,null,`普通用户不用管这一项:留空 = 自动`,-1),t[36]||=K(`。后端自己协商:先读网关 `,-1),t[37]||=W(`code`,null,`/v1/models`,-1),t[38]||=K(` 的上下文窗口(免费、毫秒级,最多等 2 秒,超时先用默认 24576 开跑), 拿到后取 `,-1),t[39]||=W(`code`,null,`min(窗口, 32768)`,-1),t[40]||=K(` 当作单次输出上限(输出预算 ≠ 上下文窗口,建卡一轮 32k 足够)。 读不到元数据也不会偷偷发试探请求;想知道窗口多大就点「探测」做一次二分试探(会产生一次真实补全,约十几秒)。 手填值超过网关接受上限时,对话开跑前会主动夹取并说明;真被 400 拒绝才会自动减半重试, 减半成功的值记为「接受上限」(**不是窗口**:窗口与输出上限是两回事,有网关窗口 262144 但 max_tokens 硬上限 131072)。 只有某轮明确报「被单次输出上限截断」才需要手填更大值。注意:推理模型的思考过程也算进这个上限。 `,-1),t[41]||=W(`br`,null,null,-1),t[42]||=W(`strong`,null,[K(`注意:`),W(`code`,null,`32768`),K(` 是自动模式的「封顶假设值」,不是网关能力上限。`)],-1),t[43]||=K(` 真实上限只能实测得到,请以「接受的单次输出上限」为准(如 qwen-max 实测仅 8192)。 `,-1),t[44]||=W(`br`,null,null,-1),t[45]||=K(`当前自动生效值:`,-1),W(`strong`,null,M(n.config.maxTokens>0?n.config.maxTokens:24576),1),K(`; 网关上下文窗口:`+M(n.config.maxTokensWindow>0?n.config.maxTokensWindow:`未拿到(网关可能不提供元数据)`)+`; 接受的单次输出上限:`+M(n.config.maxTokensCap>0?n.config.maxTokensCap:`未知(点「探测」,或撞过一次 400 后自动回写)`)+`。 `,1)])):q(`v-if`,!0)]),W(`div`,VV,[q(` 仅「勾选框 + 标题」包进 label:点说明 / 问号不应误触开关 `),W(`div`,HV,[t[47]||=W(`span`,{class:`aiset__label`},`深度思考`,-1),W(`button`,{type:`button`,class:j([`aiset__help`,{"is-on":i.help===`thinking`}]),"aria-expanded":i.help===`thinking`,title:`查看说明`,onClick:t[14]||=J(e=>a.toggleHelp(`thinking`),[`stop`])},[...t[46]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-help`})],-1)]],10,UV),G(s,{modelValue:i.form.thinking,"onUpdate:modelValue":t[15]||=e=>i.form.thinking=e,class:`aiset__switch`},null,8,[`modelValue`])]),i.help===`thinking`?(V(),H(`p`,WV,[...t[48]||=[K(` 开启:模型先长篇推理再动手,规划更稳但慢很多、更费 token。关闭:直接出结果,实测同一网关快数倍。 关闭依赖网关支持 `,-1),W(`code`,null,`chat_template_kwargs.enable_thinking`,-1),K(`(vLLM / SGLang 系);网关不认时后端会自动回退成带思考并在对话里提示一次。 另外,`,-1),W(`strong`,null,`某一轮思考超时`,-1),K(`时后端会自动只在那一轮关闭深度思考并重试,逼出结果。 `,-1)]])):q(`v-if`,!0)]),W(`div`,GV,[W(`div`,KV,[t[50]||=W(`span`,{class:`aiset__label`},`多模态视觉`,-1),W(`button`,{type:`button`,class:j([`aiset__help`,{"is-on":i.help===`vision`}]),"aria-expanded":i.help===`vision`,title:`查看说明`,onClick:t[16]||=J(e=>a.toggleHelp(`vision`),[`stop`])},[...t[49]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-help`})],-1)]],10,qV),G(s,{modelValue:i.form.vision,"onUpdate:modelValue":t[17]||=e=>i.form.vision=e,class:`aiset__switch`},null,8,[`modelValue`])]),i.help===`vision`?(V(),H(`p`,JV,[...t[51]||=[K(` 开启后首轮对话会`,-1),W(`strong`,null,`自动探测`,-1),K(`网关是否真支持图像(比较带图 / 不带图的 prompt_tokens):支持则把渲染截图、设计稿 vs 渲染并排对比图、你挂载的图片注入上下文,AI 可直接读图找差异; 不支持会自动降级为数值闭环(pixelDiff.match)并在对话里提示一次。注入前降采样到长边 ≤ 1024px / ≤ 900KB,每轮最多 2 张;对话记录落盘不含图像。 `,-1)]])):q(`v-if`,!0)]),i.ping?(V(),H(`div`,{key:0,class:j([`aiset__ping`,i.ping.ok?`is-ok`:`is-bad`])},[(V(),H(`svg`,YV,[W(`use`,{href:i.ping.ok?`#icon-check`:`#icon-alert-triangle`},null,8,XV)])),W(`span`,null,M(i.ping.text),1)],2)):q(`v-if`,!0)]),W(`footer`,ZV,[W(`button`,{type:`button`,class:`aiset__btn`,disabled:i.testing||i.saving,onClick:t[18]||=(...e)=>a.test&&a.test(...e)},[(V(),H(`svg`,$V,[W(`use`,{href:i.testing?`#icon-loading`:`#icon-activity`},null,8,eH)])),W(`span`,null,M(i.testing?`测试中…`:`测试连接`),1)],8,QV),t[52]||=W(`span`,{class:`aiset__foot-gap`},null,-1),W(`button`,{type:`button`,class:`aiset__btn`,disabled:i.saving,onClick:t[19]||=t=>e.$emit(`close`)},`取消`,8,tH),W(`button`,{type:`button`,class:`aiset__btn aiset__btn--primary`,disabled:i.saving||i.testing,onClick:t[20]||=(...e)=>a.save&&a.save(...e)},M(i.saving?`保存中…`:`保存`),9,nH)])])])}var iH=Z(aV,[[`render`,rH],[`__file`,`/Users/ynet/dsl-card/card-editor/components/AiSettings.vue`]]),aH={name:`ModelList`,props:{models:{type:Array,default:()=>[]},activeId:{type:String,default:null},turnRunning:{type:Boolean,default:!1}},emits:[`add`,`edit`,`delete`,`activate`,`close`,`open-common`,`import-ccswitch`],methods:{locked(e){return!!(this.turnRunning&&e&&e.id===this.activeId)},hostOf(e){let t=String(e||``).trim();if(!t)return`未填地址`;try{return new URL(t).host}catch{return t.replace(/^https?:\/\//,``).replace(/\/+$/,``)||t}}}},oH={class:`aiset__mask`},sH={class:`aiset modellist`,role:`dialog`,"aria-modal":`true`,"aria-label":`模型选择`},cH={class:`aiset__head`},lH={class:`aiset__body ml__body`},uH={class:`ml__toolbar`},dH={key:0,class:`ml__lock`,role:`status`},fH={key:1,class:`empty-state`},pH={class:`ml__list`},mH=[`aria-disabled`,`onClick`],hH={key:0,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`,"stroke-linecap":`round`,"stroke-linejoin":`round`},gH={class:`ml__info`},_H={class:`ml__name`},vH={class:`ml__meta`},yH={class:`ml__model`},bH={class:`ml__host`},xH={key:0,class:`ml__key`,title:`已配置密钥`},SH={key:1,class:`ml__key ml__key--off`,title:`未配置密钥`},CH={key:2,class:`ml__key ml__key--lock`,title:`对话进行中,正在使用的模型已锁定`},wH={class:`ml__actions`},TH=[`disabled`,`title`,`onClick`],EH=[`disabled`,`title`,`onClick`],DH={class:`ml__foot`},OH={class:`ml__hint`};function kH(e,t,n,r,i,a){return V(),H(`div`,oH,[W(`section`,sH,[W(`header`,cH,[t[5]||=W(`svg`,{class:`aiset__head-icon is-solid-icon`,viewBox:`0 0 1024 1024`,"aria-hidden":`true`},[W(`use`,{href:`#icon-model`})],-1),t[6]||=W(`span`,{class:`aiset__title`},`模型`,-1),W(`button`,{type:`button`,class:`aiset__x`,title:`关闭`,onClick:t[0]||=t=>e.$emit(`close`)},[...t[4]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-x`})],-1)]])]),W(`div`,lH,[q(` 操作工具条:添加模型 / 从 cc-switch 导入,靠右对齐 `),W(`div`,uH,[W(`button`,{type:`button`,class:`ml__import`,title:`从 cc-switch 导入`,onClick:t[1]||=t=>e.$emit(`import-ccswitch`)},[...t[7]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-download`})],-1),W(`span`,null,`导入`,-1)]]),W(`button`,{type:`button`,class:`ml__add`,title:`添加模型`,onClick:t[2]||=t=>e.$emit(`add`)},[...t[8]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-plus`})],-1),W(`span`,null,`添加模型`,-1)]])]),q(` 对话进行中:正在使用的模型被锁,说明原因与解除方式,避免用户反复点却没反应 `),n.turnRunning?(V(),H(`div`,dH,[...t[9]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-alert-triangle`})],-1),W(`span`,null,`有对话正在进行:正在使用的模型已锁定,本轮结束后可切换或修改。其他模型仍可编辑。`,-1)]])):q(`v-if`,!0),q(` 空状态:与其他面板占位(图标 + 文字)同一语言 `),n.models.length?(V(),H(B,{key:2},[q(` 模型列表:参考 cc-switch 的 provider 列表——每条可编辑 / 删除,当前生效项高亮 `),W(`ul`,pH,[(V(!0),H(B,null,z(n.models,r=>(V(),H(`li`,{key:r.id,class:j([`ml__item`,{"is-active":r.id===n.activeId,"is-locked":a.locked(r)}]),"aria-disabled":a.locked(r)?`true`:`false`,onClick:t=>e.$emit(`activate`,r)},[W(`span`,{class:j([`ml__check`,{"is-on":r.id===n.activeId}]),"aria-hidden":`true`},[r.id===n.activeId?(V(),H(`svg`,hH,[...t[11]||=[W(`use`,{href:`#icon-check`},null,-1)]])):q(`v-if`,!0)],2),W(`span`,gH,[W(`span`,_H,M(r.name||r.model||`未命名模型`),1),W(`span`,vH,[W(`span`,yH,M(r.model||`未填模型名`),1),t[12]||=W(`span`,{class:`ml__dot`},`·`,-1),W(`span`,bH,M(a.hostOf(r.baseUrl)),1),r.hasKey?(V(),H(`span`,xH,`已配密钥`)):(V(),H(`span`,SH,`无密钥`)),a.locked(r)?(V(),H(`span`,CH,`运行中 · 锁定`)):q(`v-if`,!0)])]),W(`span`,wH,[W(`button`,{type:`button`,class:`ml__btn`,disabled:a.locked(r),title:a.locked(r)?`对话进行中,正在使用的模型不可编辑`:`编辑`,onClick:J(t=>e.$emit(`edit`,r),[`stop`])},[...t[13]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-edit`})],-1)]],8,TH),W(`button`,{type:`button`,class:`ml__btn ml__btn--danger`,disabled:a.locked(r),title:a.locked(r)?`对话进行中,正在使用的模型不可删除`:`删除`,onClick:J(t=>e.$emit(`delete`,r),[`stop`])},[...t[14]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-trash`})],-1)]],8,EH)])],10,mH))),128))])],2112)):(V(),H(`div`,fH,[...t[10]||=[_s(`<span class="empty-state__badge" aria-hidden="true"><svg class="is-solid-icon" viewBox="0 0 1024 1024"><use href="#icon-model"></use></svg></span><p class="debug__empty">还没有模型</p><p class="empty-state__hint">点上方「添加模型」配置第一个 AI 模型(Base URL / API Key / 模型名),或「导入」从 cc-switch 拉取已有的 Codex 供应商。配置保存在项目根 .env.cb.local,不进版本库。</p>`,3)]]))]),W(`footer`,DH,[W(`span`,OH,M(n.turnRunning?`对话进行中:正在使用的模型已锁定,无法切换`:`点击任意模型即可切换为当前生效模型`),1),W(`button`,{type:`button`,class:`ml__common`,title:`通用设置(执行策略 / 环境参数,所有模型共享)`,onClick:t[3]||=t=>e.$emit(`open-common`)},[...t[15]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-settings`})],-1),W(`span`,null,`通用设置`,-1)]])])])])}var AH=Z(aH,[[`render`,kH],[`__file`,`/Users/ynet/dsl-card/card-editor/components/ModelList.vue`]]),jH=6e4,MH={name:`AiCommonSettings`,components:{NumberStepper:J_,Switch:SN},emits:[`close`,`saved`],data(){return{form:{allowShell:!0,autoApprove:`all`,maxSteps:0,turnTimeoutMin:60,stallTimeoutMin:120,stallRetries:-1,reasoningTimeoutMin:600,autoContinueMax:-1},saving:!1,ping:null,help:null,adv:!1,approveOptions:[{value:`none`,label:`逐次确认`},{value:`skill`,label:`免技能`},{value:`all`,label:`全免确认`}]}},created(){this.loadConfig()},mounted(){document.addEventListener(`click`,this.onDocClick,!0),document.addEventListener(`keydown`,this.onKeydown)},beforeUnmount(){document.removeEventListener(`click`,this.onDocClick,!0),document.removeEventListener(`keydown`,this.onKeydown)},methods:{toggleHelp(e){this.help=this.help===e?null:e},onDocClick(e){if(!this.help)return;let t=e.target;t instanceof Element&&t.closest(`.aiset__pop, .aiset__help`)||(this.help=null)},onKeydown(e){e.key===`Escape`&&this.help&&(e.stopPropagation(),this.help=null)},onInt(e,t){let n=String(t).trim();if(!n){this.form[e]=e===`stallRetries`||e===`autoContinueMax`?-1:0;return}let r=Number(n);this.form[e]=Number.isFinite(r)?Math.round(r):0},async loadConfig(){try{let e=await BR();e.shellEnabled!==void 0&&(this.form.allowShell=e.shellEnabled!==!1),e.autoApprove&&(this.form.autoApprove=e.autoApprove),Number(e.maxSteps)>0&&(this.form.maxSteps=Number(e.maxSteps)),Number(e.turnTimeoutMs)>0&&(this.form.turnTimeoutMin=Math.round(Number(e.turnTimeoutMs)/jH)),Number(e.stallTimeoutMs)>0&&(this.form.stallTimeoutMin=Math.round(Number(e.stallTimeoutMs)/jH)),e.stallRetries!==void 0&&e.stallRetries>=0&&(this.form.stallRetries=Number(e.stallRetries)),Number(e.reasoningTimeoutMs)>0&&(this.form.reasoningTimeoutMin=Math.round(Number(e.reasoningTimeoutMs)/jH)),e.autoContinueMax!==void 0&&e.autoContinueMax>=0&&(this.form.autoContinueMax=Number(e.autoContinueMax))}catch{}},async save(){this.saving=!0,this.ping=null;try{let e=await VR({allowShell:!!this.form.allowShell,autoApprove:this.form.autoApprove,maxSteps:Number(this.form.maxSteps)>0?Number(this.form.maxSteps):0,turnTimeoutMs:Number(this.form.turnTimeoutMin)>0?Number(this.form.turnTimeoutMin)*jH:0,stallTimeoutMs:Number(this.form.stallTimeoutMin)>0?Number(this.form.stallTimeoutMin)*jH:0,stallRetries:Number(this.form.stallRetries)>=0?Number(this.form.stallRetries):-1,reasoningTimeoutMs:Number(this.form.reasoningTimeoutMin)>0?Number(this.form.reasoningTimeoutMin)*jH:0,autoContinueMax:Number(this.form.autoContinueMax)>=0?Number(this.form.autoContinueMax):-1});this.$emit(`saved`,e)}catch(e){this.ping={ok:!1,text:`保存失败:${e.message||e}`}}finally{this.saving=!1}}}},NH={class:`aiset__mask`},PH={class:`aiset`,role:`dialog`,"aria-modal":`true`,"aria-label":`AI 通用设置`},FH={class:`aiset__head`},IH={class:`aiset__body`},LH={class:`aiset__field`},RH={class:`aiset__labelrow`},zH=[`aria-expanded`],BH={key:0,class:`aiset__pop`},VH={class:`aiset__field`},HH={class:`aiset__labelrow`},UH=[`aria-expanded`],WH={class:`aiset__seg`},GH=[`onClick`],KH={key:0,class:`aiset__pop`},qH={class:`aiset__adv`},JH=[`aria-expanded`],YH={class:`aiset__adv-hint`},XH={key:0,class:`aiset__adv-body`},ZH={class:`aiset__field`},QH={class:`aiset__labelrow`},$H=[`aria-expanded`],eU={class:`aiset__stepperrow`},tU={key:0,class:`aiset__pop`},nU={class:`aiset__field`},rU={class:`aiset__labelrow`},iU=[`aria-expanded`],aU={class:`aiset__stepperrow`},oU={key:0,class:`aiset__pop`},sU={class:`aiset__field`},cU={class:`aiset__labelrow`},lU=[`aria-expanded`],uU={class:`aiset__stepperrow`},dU={key:0,class:`aiset__pop`},fU={class:`aiset__field`},pU={class:`aiset__labelrow`},mU=[`aria-expanded`],hU={class:`aiset__stepperrow`},gU={key:0,class:`aiset__pop`},_U={class:`aiset__field`},vU={class:`aiset__labelrow`},yU=[`aria-expanded`],bU={class:`aiset__stepperrow`},xU={key:0,class:`aiset__pop`},SU={class:`aiset__field`},CU={class:`aiset__labelrow`},wU=[`aria-expanded`],TU={class:`aiset__stepperrow`},EU={key:0,class:`aiset__pop`},DU={viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},OU=[`href`],kU={class:`aiset__foot`},AU=[`disabled`],jU=[`disabled`];function MU(e,t,n,r,i,a){let o=R(`Switch`),s=R(`NumberStepper`);return V(),H(`div`,NH,[W(`section`,PH,[W(`header`,FH,[t[20]||=W(`svg`,{class:`aiset__head-icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-settings`})],-1),t[21]||=W(`span`,{class:`aiset__title`},`通用设置`,-1),W(`button`,{type:`button`,class:`aiset__x`,title:`关闭`,onClick:t[0]||=t=>e.$emit(`close`)},[...t[19]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-x`})],-1)]])]),W(`div`,IH,[t[51]||=W(`p`,{class:`aiset__note`},[K(`以下为`),W(`strong`,null,`所有模型共享`),K(`的执行策略 / 环境参数,与具体模型无关,故不放在每个模型条目里。`)],-1),W(`div`,LH,[W(`div`,RH,[t[23]||=W(`span`,{class:`aiset__label`},`本地命令执行`,-1),W(`button`,{type:`button`,class:j([`aiset__help`,{"is-on":i.help===`allowShell`}]),"aria-expanded":i.help===`allowShell`,title:`查看说明`,onClick:t[1]||=J(e=>a.toggleHelp(`allowShell`),[`stop`])},[...t[22]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-help`})],-1)]],10,zH),G(o,{modelValue:i.form.allowShell,"onUpdate:modelValue":t[2]||=e=>i.form.allowShell=e,class:`aiset__switch`},null,8,[`modelValue`])]),i.help===`allowShell`?(V(),H(`p`,BH,[...t[24]||=[K(` 是否注册 `,-1),W(`code`,null,`shell_exec`,-1),K(` 本地命令执行。默认开(工具只监听 127.0.0.1,命令过白名单 + 全量审计)。 关掉后 AI 不能跑本地命令,但仍可执行技能脚本(由 `,-1),W(`code`,null,`autoApprove`,-1),K(` 控制是否逐次确认)。 `,-1)]])):q(`v-if`,!0)]),W(`div`,VH,[W(`div`,HH,[t[26]||=W(`span`,{class:`aiset__label`},`免确认执行策略`,-1),W(`button`,{type:`button`,class:j([`aiset__help`,{"is-on":i.help===`autoApprove`}]),"aria-expanded":i.help===`autoApprove`,title:`查看说明`,onClick:t[3]||=J(e=>a.toggleHelp(`autoApprove`),[`stop`])},[...t[25]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-help`})],-1)]],10,UH)]),W(`div`,WH,[(V(!0),H(B,null,z(i.approveOptions,e=>(V(),H(`button`,{key:e.value,type:`button`,class:j([`aiset__seg-btn`,{"is-on":i.form.autoApprove===e.value}]),onClick:t=>i.form.autoApprove=e.value},M(e.label),11,GH))),128))]),i.help===`autoApprove`?(V(),H(`p`,KH,[...t[27]||=[W(`code`,null,`none`,-1),K(`=逐次弹审批;`,-1),W(`code`,null,`skill`,-1),K(`=只免技能脚本;`,-1),W(`code`,null,`all`,-1),K(`=技能脚本 + 本地命令都免确认(默认)。 建卡管线连跑十几次脚本 / 命令,`,-1),W(`code`,null,`all`,-1),K(` 避免每次等用户点「允许」。 `,-1)]])):q(`v-if`,!0)]),q(` 保活 / 预算阈值:实测调优出来的值,改只会变坏,故默认收起。
356
+ 全部有代码默认值,留空即走默认;折叠区保留可写入口,真要调时不用去翻 .env `),W(`div`,qH,[W(`button`,{type:`button`,class:`aiset__adv-head`,"aria-expanded":i.adv,onClick:t[4]||=e=>i.adv=!i.adv},[(V(),H(`svg`,{class:j([`aiset__adv-caret`,{"is-open":i.adv}]),viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[...t[28]||=[W(`use`,{href:`#icon-chevron-right`},null,-1)]],2)),t[29]||=W(`span`,{class:`aiset__adv-title`},`高级:保活与预算阈值`,-1),W(`span`,YH,M(i.adv?``:`默认值经实测调优,不建议修改`),1)],8,JH),i.adv?(V(),H(`div`,XH,[t[50]||=W(`p`,{class:`aiset__adv-note`},[K(` 这几项是长程任务的`),W(`strong`,null,`熔断与保活阈值`),K(`,数值由实测调优得出(如纯思考预算从 90s 放宽到 600s,因 240s 会误伤正常轮次)。 留空即走默认,`),W(`strong`,null,`没有明确理由不建议改动`),K(`。 `)],-1),W(`div`,ZH,[W(`div`,QH,[t[31]||=W(`span`,{class:`aiset__label`},`单轮步数上限`,-1),t[32]||=W(`span`,{class:`aiset__unit`},`0 / 留空 = 不限`,-1),W(`button`,{type:`button`,class:j([`aiset__help`,{"is-on":i.help===`maxSteps`}]),"aria-expanded":i.help===`maxSteps`,title:`查看说明`,onClick:t[5]||=J(e=>a.toggleHelp(`maxSteps`),[`stop`])},[...t[30]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-help`})],-1)]],10,$H)]),W(`div`,eU,[G(s,{id:`common-maxsteps`,class:`aiset__stepper`,value:i.form.maxSteps>0?String(i.form.maxSteps):``,step:8,min:0,max:1e3,placeholder:`留空 = 不限(推荐)`,onInput:t[6]||=e=>a.onInt(`maxSteps`,e)},null,8,[`value`])]),i.help===`maxSteps`?(V(),H(`p`,tU,[...t[33]||=[W(`strong`,null,`普通用户不用管:留空 = 不限`,-1),K(`。失控由三道精准熔断兜住(同参打转跳过 / 单轮墙钟到点收尾 / 每 24 步提醒)。 只有想硬性控成本时才填(>0 即恢复旧硬顶行为)。 `,-1)]])):q(`v-if`,!0)]),W(`div`,nU,[W(`div`,rU,[t[35]||=W(`span`,{class:`aiset__label`},`单轮墙钟上限`,-1),t[36]||=W(`span`,{class:`aiset__unit`},`分钟`,-1),W(`button`,{type:`button`,class:j([`aiset__help`,{"is-on":i.help===`turnTimeout`}]),"aria-expanded":i.help===`turnTimeout`,title:`查看说明`,onClick:t[7]||=J(e=>a.toggleHelp(`turnTimeout`),[`stop`])},[...t[34]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-help`})],-1)]],10,iU)]),W(`div`,aU,[G(s,{id:`common-turn`,class:`aiset__stepper`,value:i.form.turnTimeoutMin>0?String(i.form.turnTimeoutMin):``,step:5,min:0,max:240,placeholder:`留空 = 60`,onInput:t[8]||=e=>a.onInt(`turnTimeoutMin`,e)},null,8,[`value`])]),i.help===`turnTimeout`?(V(),H(`p`,oU,` 单轮允许跑的最长时间(分钟)。到点收尾汇报、上下文不丢,回复「继续」接着做。默认 60 分钟,不限步数后的唯一兜底闸门。 `)):q(`v-if`,!0)]),W(`div`,sU,[W(`div`,cU,[t[38]||=W(`span`,{class:`aiset__label`},`网关静默阈值`,-1),t[39]||=W(`span`,{class:`aiset__unit`},`分钟`,-1),W(`button`,{type:`button`,class:j([`aiset__help`,{"is-on":i.help===`stall`}]),"aria-expanded":i.help===`stall`,title:`查看说明`,onClick:t[9]||=J(e=>a.toggleHelp(`stall`),[`stop`])},[...t[37]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-help`})],-1)]],10,lU)]),W(`div`,uU,[G(s,{id:`common-stall`,class:`aiset__stepper`,value:i.form.stallTimeoutMin>0?String(i.form.stallTimeoutMin):``,step:1,min:0,max:120,placeholder:`留空 = 2`,onInput:t[10]||=e=>a.onInt(`stallTimeoutMin`,e)},null,8,[`value`])]),i.help===`stall`?(V(),H(`p`,dU,` 上游多少分钟不回任何字节算「网关静默」;静默自动重试本步而非整轮报废。默认 2 分钟(120 秒)。 `)):q(`v-if`,!0)]),W(`div`,fU,[W(`div`,pU,[t[41]||=W(`span`,{class:`aiset__label`},`静默重试次数`,-1),t[42]||=W(`span`,{class:`aiset__unit`},`-1 = 默认`,-1),W(`button`,{type:`button`,class:j([`aiset__help`,{"is-on":i.help===`stallRetries`}]),"aria-expanded":i.help===`stallRetries`,title:`查看说明`,onClick:t[11]||=J(e=>a.toggleHelp(`stallRetries`),[`stop`])},[...t[40]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-help`})],-1)]],10,mU)]),W(`div`,hU,[G(s,{id:`common-stallretries`,class:`aiset__stepper`,value:i.form.stallRetries>=0?String(i.form.stallRetries):``,step:1,min:-1,max:20,placeholder:`留空 / -1 = 3`,onInput:t[12]||=e=>a.onInt(`stallRetries`,e)},null,8,[`value`])]),i.help===`stallRetries`?(V(),H(`p`,gU,` 网关静默后的自动重试次数。0 = 回到「一次静默即报错」的旧行为;留空 / -1 = 用默认 3 次。 `)):q(`v-if`,!0)]),W(`div`,_U,[W(`div`,vU,[t[44]||=W(`span`,{class:`aiset__label`},`纯思考预算`,-1),t[45]||=W(`span`,{class:`aiset__unit`},`分钟`,-1),W(`button`,{type:`button`,class:j([`aiset__help`,{"is-on":i.help===`reasoning`}]),"aria-expanded":i.help===`reasoning`,title:`查看说明`,onClick:t[13]||=J(e=>a.toggleHelp(`reasoning`),[`stop`])},[...t[43]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-help`})],-1)]],10,yU)]),W(`div`,bU,[G(s,{id:`common-reasoning`,class:`aiset__stepper`,value:i.form.reasoningTimeoutMin>0?String(i.form.reasoningTimeoutMin):``,step:1,min:0,max:300,placeholder:`留空 = 10`,onInput:t[14]||=e=>a.onInt(`reasoningTimeoutMin`,e)},null,8,[`value`])]),i.help===`reasoning`?(V(),H(`p`,xU,` 单轮「纯思考」(不调工具)的预算(分钟)。到点催促 + 关深度思考重试;催 3 次仍无产出则停该熔断,改墙钟兜底。默认 10 分钟(600 秒)。 `)):q(`v-if`,!0)]),W(`div`,SU,[W(`div`,CU,[t[47]||=W(`span`,{class:`aiset__label`},`自动续跑上限`,-1),t[48]||=W(`span`,{class:`aiset__unit`},`-1 = 默认`,-1),W(`button`,{type:`button`,class:j([`aiset__help`,{"is-on":i.help===`autoContinue`}]),"aria-expanded":i.help===`autoContinue`,title:`查看说明`,onClick:t[15]||=J(e=>a.toggleHelp(`autoContinue`),[`stop`])},[...t[46]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-help`})],-1)]],10,wU)]),W(`div`,TU,[G(s,{id:`common-autocont`,class:`aiset__stepper`,value:i.form.autoContinueMax>=0?String(i.form.autoContinueMax):``,step:1,min:-1,max:200,placeholder:`留空 / -1 = 12`,onInput:t[16]||=e=>a.onInt(`autoContinueMax`,e)},null,8,[`value`])]),i.help===`autoContinue`?(V(),H(`p`,EU,[...t[49]||=[K(` 模型没给收尾标记(`,-1),W(`code`,null,`[任务完成]`,-1),K(` / `,-1),W(`code`,null,`[需用户确认]`,-1),K(`)就停手时的自动续跑次数上限。0 = 关闭(等你手打「继续」);留空 / -1 = 用默认 12。 `,-1)]])):q(`v-if`,!0)])])):q(`v-if`,!0)]),i.ping?(V(),H(`div`,{key:0,class:j([`aiset__ping`,i.ping.ok?`is-ok`:`is-bad`])},[(V(),H(`svg`,DU,[W(`use`,{href:i.ping.ok?`#icon-check`:`#icon-alert-triangle`},null,8,OU)])),W(`span`,null,M(i.ping.text),1)],2)):q(`v-if`,!0)]),W(`footer`,kU,[t[52]||=W(`span`,{class:`aiset__foot-gap`},null,-1),W(`button`,{type:`button`,class:`aiset__btn`,disabled:i.saving,onClick:t[17]||=t=>e.$emit(`close`)},`取消`,8,AU),W(`button`,{type:`button`,class:`aiset__btn aiset__btn--primary`,disabled:i.saving,onClick:t[18]||=(...e)=>a.save&&a.save(...e)},M(i.saving?`保存中…`:`保存`),9,jU)])])])}var NU=Z(MH,[[`render`,MU],[`__file`,`/Users/ynet/dsl-card/card-editor/components/AiCommonSettings.vue`]]),PU=2e3;function FU(e){try{let t=JSON.stringify(e);return t==null?0:t.length}catch{return 1/0}}function IU(e,t){let n=typeof e==`string`?e:e==null?``:JSON.stringify(e);return n.length<=t?e:`${n.slice(0,t)}\n…(历史归档已裁剪,完整内容以卡片与落盘产物为准)`}function LU(e,t){if(!e||typeof e!=`object`)return e;let n={};for(let[r,i]of Object.entries(e))n[r]=typeof i==`string`||typeof i==`object`&&i?IU(i,t):i;return n}function RU(e,t=!1){let n=Array.isArray(e)?e:[],r=t?400:PU;return n.map(e=>{if(!e||!Array.isArray(e.toolCalls)||!e.toolCalls.length)return e;let n=!1,i=e.toolCalls.map(e=>{if(!e||typeof e!=`object`)return e;let i=LU(e.args,r),a=t?e.result==null||e.result===``?e.result:`[历史归档已裁剪]`:IU(e.result,r);return(JSON.stringify(i)!==JSON.stringify(e.args)||String(a)!==String(e.result))&&(n=!0),{...e,args:i,result:a}});return n?{...e,toolCalls:i,trimmedArchive:!0}:e})}var zU={card_read:12e3,skill_read:1e4,card_grep:4e3,skill_exec:3e3,fs_read:4e3,fs_write:2e3,fs_list:2e3,fs_copy:1e3,ir_patch:2e3,card_patch:2e3,card_validate:4e3,card_render_status:6e3,card_node_models:4e3,card_screenshot:1e3},BU=6e3;function VU(e){return zU[e]||6e3}function HU(e,t){return(typeof t==`string`?t:String(t??``)).slice(0,VU(e))}Math.max(BU,...Object.values(zU));var UU={pick:{id:`pick`,label:`选一张已有的卡`,hint:`从顶栏下拉里挑`,icon:`#icon-search`,weight:`read`,text:`列出仓库里现有的卡片,按用途分组,帮我挑一张适合修改的。`},scaffold:{id:`scaffold`,label:`新建一张卡`,hint:`从空白骨架开始`,icon:`#icon-folder-plus`,weight:`write`,text:`帮我新建一张卡片:先用 card_scaffold 生成骨架,再按我的需求补齐结构与示例内容,最后自检。`},spec:{id:`spec`,label:`按设计稿标注建卡`,hint:`先拖入 MeaXure 目录`,icon:`#icon-image-upload`,weight:`write`,attach:!0,text:`我会挂载一份 Sketch MeaXure 标注导出目录,请按标注生成卡片 schema 并自检。`},fromimage:{id:`fromimage`,label:`从参考图建卡`,hint:`拖一张设计图进来`,icon:`#icon-image`,weight:`write`,attach:!0,text:`我会拖入一张参考设计图(本机路径),请按图生成卡片 schema 并截图自检还原度。`},learn:{id:`learn`,label:`看已有卡学写法`,hint:`只读,不改卡`,icon:`#icon-search`,weight:`read`,text:`列出仓库里结构最完整的几张卡片,读 1-2 张的关键片段,说明本仓库的建卡约定与常用范式。`},component:{id:`component`,label:`加一个常用组件`,hint:`列表 / 按钮 / 金额卡`,icon:`#icon-plus`,weight:`write`,text:`帮我给这张卡加一个常用组件(列表 / 按钮组 / 金额统计卡),按仓库范式写并自检。`},explain:{id:`explain`,label:`解释结构与数据来源`,hint:`只读,不改卡`,icon:`#icon-search`,weight:`read`,text:`读取当前卡片 schema,用中文解释它的结构、关键绑定与数据来源,指出可能的问题。`},bind:{id:`bind`,label:`把写死文案抽成变量`,hint:`绑定 data.json`,icon:`#icon-link`,weight:`write`,text:`把当前卡片里写死的动态值(金额 / 日期 / 名称等)抽成变量并绑定 data.json,保持展示文案与设计稿一致。`},fix:{id:`fix`,label:`校验并修复`,hint:`会改动卡片`,icon:`#icon-wrench`,weight:`write`,text:`对当前卡片执行校验,列出全部错误并按规则修复,修完再校验一次确认清零。`},shot:{id:`shot`,label:`截图自检还原度`,hint:`多尺寸预览比对`,icon:`#icon-images`,weight:`read`,text:`给当前卡片截图,检查布局、字号、间距与配色是否协调,指出需要调整的地方。`},interact:{id:`interact`,label:`加按钮点击行为`,hint:`customAction / 发消息`,icon:`#icon-send`,weight:`write`,text:`给当前卡片里的主按钮加点击行为(customAction 或发送一条消息),参照现有卡片的写法。`},diagnose:{id:`diagnose`,label:`定位并修复刚才的报错`,hint:`接上一轮`,icon:`#icon-alert-triangle`,weight:`write`,text:`上一轮失败了,请读取错误信息与上下文,定位原因并修复,修完再校验一次。`},resume:{id:`resume`,label:`从中断处继续`,hint:`不重做已完成部分`,icon:`#icon-redo`,weight:`write`,text:`上一轮被中断了,请按上下文里的中断标记从中断处继续,不要从零重做。`},rollback:{id:`rollback`,label:`回滚上一轮改动`,hint:`恢复到改动前`,icon:`#icon-undo`,weight:`write`,text:`把上一轮对卡片做的改动回滚到改动前,并说明回滚了什么。`}},WU={nocare:[`pick`,`scaffold`,`spec`,`learn`,`component`],empty:[`spec`,`fromimage`,`scaffold`,`component`,`learn`],card:[`explain`,`bind`,`fix`,`shot`,`interact`],error:[`diagnose`,`resume`,`rollback`,`explain`,`fix`]},GU={nocare:{title:`选择或新建一张卡`,desc:`先从顶栏选一张卡,或让 AI 新建一张;也可以把设计稿标注目录、参考图拖进来,只传本机路径不上传。`},empty:{title:`把这张空卡搭起来`,desc:`描述想要的效果,或拖入设计稿标注目录 / 参考图,AI 会按标注生成卡片并截图自检。`},error:{title:`接着上一轮往下做`,desc:`上一轮失败或被中断了:可以接着修、从中断处继续,或回滚到改动前。`},card:{title:`让 AI 直接改这张卡`,desc:`描述需求即可,AI 会调用卡片工具读改校验并截图自检;也可以把设计稿标注目录、参考图拖进来,只传本机路径不上传。`}};function KU(e){let t=Array.isArray(e)?e:[];for(let e=t.length-1;e>=0;--e){let n=t[e];if(n&&n.role===`assistant`)return n.status||`done`}return``}function qU({cardId:e,cardEmpty:t,messages:n}={}){if(!e)return`nocare`;if(t)return`empty`;let r=KU(n);return r===`error`||r===`aborted`?`error`:`card`}function JU(e){return(WU[e]||WU.card).map(e=>UU[e]).filter(Boolean)}function YU(e,t,n=4){let r=Array.isArray(e)?e:[];if(r.length<=n)return r.slice();let i=r.length,a=((Number(t)||0)%i+i)%i;return[...r.slice(a),...r.slice(0,a)].slice(0,n)}function XU(e,t=4){return(Array.isArray(e)?e:[]).slice(0,t)}var ZU=`cardbuddy:ai-panel-width`,QU=2e4,$U=`cardbuddy:ai-compact-steps`,eW=380,tW=.5,nW=.33,rW=0;function iW(e=`m`){return rW+=1,`${e}${Date.now().toString(36)}-${rW}`}var aW=`有对话正在进行,无法修改正在使用的模型:请先等这一轮结束,或在输入区点「停止」`,oW={name:`ChatPanel`,components:{ChatMessage:EB,ChatComposer:iV,AiSettings:iH,ModelList:AH,AiCommonSettings:NU,ConfirmDialog:Ap},props:{visible:{type:Boolean,default:!1},cardId:{type:String,default:``},cardName:{type:String,default:``},cardEmpty:{type:Boolean,default:!1}},emits:[`close`,`busy`,`turn-progress`,`turn-finished`,`rollback-turn`,`locate-node`],data(){return{messages:[],draftAttachments:[],busy:!1,loadingHistory:!1,modelListOpen:!1,models:[],activeId:null,turnRunning:!1,modelEditOpen:!1,editModelId:null,editInitialModel:null,confirmDeleteModel:null,ccSwitchOpen:!1,ccSwitchProviders:[],ccSwitchLoading:!1,ccSwitchReason:``,ccSwitchSelected:{},commonOpen:!1,confirmClear:!1,notice:null,config:{baseUrl:``,model:``,hasKey:!1,apiKeyMasked:``},widthPx:0,winW:typeof window<`u`?window.innerWidth:1280,resizing:!1,pinned:!0,contextUsage:null,compactSteps:!1,archiveTrimmed:!1,suggestOffset:0,suggestStats:{},confirmStop:!1,turnStep:0,turnStage:null,turnToolLabel:``,turnStartedAt:0,lastByteAt:0,turnId:``,lastSeq:0,_resumeProbe:!1,nowTs:0,_abort:null,_saveTimer:0,_loadedCard:``,_cardRenamedTo:``,_saving:!1,_liveTicker:0,_turnPersistTimer:0}},computed:{pickOwnerRow(){return pR(this.messages)},suggestBatchKey(){return qU({cardId:this.cardId,cardEmpty:this.cardEmpty,messages:this.messages})},suggestBatch(){return JU(this.suggestBatchKey)},suggestions(){return YU(this.suggestBatch,this.suggestOffset)},canShuffle(){return this.suggestBatch.length>4},quickChips(){return XU(this.suggestBatch)},emptyTitle(){return(GU[this.suggestBatchKey]||GU.card).title},emptyDesc(){return(GU[this.suggestBatchKey]||GU.card).desc},ccSwitchCheckedCount(){let e=this.ccSwitchSelected||{};return Object.keys(e).filter(t=>e[t]).length},ccSwitchDupCount(){return(this.ccSwitchProviders||[]).filter(e=>e.duplicate).length},configReady(){return!!(this.config.baseUrl&&this.config.model&&this.config.hasKey)},panelWidth(){let e=this.winW||1280,t=Math.max(eW,Math.floor(e*tW)),n=Math.round(e*nW),r=this.widthPx||n;return Math.max(eW,Math.min(t,r))},panelStyle(){return{width:`${this.panelWidth}px`}},stallLimitMs(){let e=Number(this.config.stallTimeoutMs)>0?Number(this.config.stallTimeoutMs):12e4;return Math.round(e*1.5)},idleMs(){return this.lastByteAt?Math.max(0,(this.nowTs||Date.now())-this.lastByteAt):0},stalled(){return!!(this.busy&&this.idleMs>this.stallLimitMs)},liveText(){if(!this.busy)return``;let e=[];return this.turnStartedAt&&e.push(`${GL(this.turnStartedAt)} 开始`),this.turnStep>0&&e.push(`第 ${this.turnStep} 步`),e.push(`已用 ${this.fmtClock(this.nowTs-this.turnStartedAt)}`),this.turnStage?e.push(`${this.turnStage.id} ${this.turnStage.label}`):this.turnToolLabel&&e.push(this.turnToolLabel),this.stalled?`${Math.round(this.idleMs/1e3)} 秒没收到任何数据,连接可能已中断(${e.join(` · `)})`:(e.push(`最近数据 ${Math.round(this.idleMs/1e3)} 秒前`),e.join(` · `))}},watch:{suggestBatchKey(){this.suggestOffset=0},visible(e){e?(this.refreshConfig(),this.ensureHistory().then(()=>this.checkResumableTurn()),this.$nextTick(()=>{this.scrollToBottom(!0),this.$refs.composerEl?.focus()})):this.busy&&this.flushHistory()},cardId(e,t){if(this._cardRenamedTo&&this._cardRenamedTo===e){this._cardRenamedTo=``,this._dirtyFor===t&&(this._dirtyFor=e),this._loadedCard===t?(this._loadedCard=e,this._dirtyFor===e&&this.flushHistory(e)):(this._loadedCard=``,this.ensureHistory());return}this._saveTimer&&=(clearTimeout(this._saveTimer),0);let n=this._dirtyFor===t?this.serialize():null;this._dirtyFor=null,this.draftAttachments=[],this.messages=[],n&&t&&this.flushHistory(t,n),this.ensureHistory()}},mounted(){this.loadWidth(),this.loadCompact(),window.addEventListener(`resize`,this.onWinResize),window.addEventListener(`pagehide`,this.onPagehide),this.refreshConfig(),this.ensureHistory()},beforeUnmount(){window.removeEventListener(`resize`,this.onWinResize),window.removeEventListener(`pagehide`,this.onPagehide),this.stopTurnTimers(),this.stopTickers(),this.flushHistory(),this._abort&&this._abort.abort()},methods:{onWinResize(){this.winW=window.innerWidth},onImageClick(e){let t=e.target&&e.target.closest?e.target.closest(`img`):null;if(!t||t.dataset.noZoom===`1`)return;let n=Array.from(this.$el.querySelectorAll(`img`)).filter(e=>e.dataset.noZoom!==`1`),r=n.indexOf(t);r<0||Bk(n.map(e=>({src:e.currentSrc||e.src,alt:e.alt||``,title:e.getAttribute(`title`)||e.closest(`[title]`)?.getAttribute(`title`)||``})),r)},loadWidth(){try{let e=localStorage.getItem(ZU);if(e!=null){let t=parseInt(e,10);!Number.isNaN(t)&&t>=eW&&(this.widthPx=t)}}catch{}},saveWidth(){try{this.widthPx?localStorage.setItem(ZU,String(Math.round(this.panelWidth))):localStorage.removeItem(ZU)}catch{}},startResize(e){let t=e&&e.currentTarget;if(!t)return;this.resizing=!0,document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`;let n=e.pointerId;try{t.setPointerCapture(n)}catch{}let r=e=>{let t=Math.max(eW,Math.floor(window.innerWidth*tW));this.widthPx=Math.max(eW,Math.min(t,Math.round(window.innerWidth-e.clientX)))},i=()=>{t.removeEventListener(`pointermove`,r),t.removeEventListener(`pointerup`,i),t.removeEventListener(`pointercancel`,i),window.removeEventListener(`blur`,i);try{t.hasPointerCapture?.(n)&&t.releasePointerCapture(n)}catch{}this.resizing=!1,document.body.style.cursor=``,document.body.style.userSelect=``,this.saveWidth()};t.addEventListener(`pointermove`,r),t.addEventListener(`pointerup`,i),t.addEventListener(`pointercancel`,i),window.addEventListener(`blur`,i)},resetWidth(){this.widthPx=0,this.saveWidth()},async refreshConfig(){try{let e=await BR();this.config={...e,hasKey:!!(e.hasKey||e.apiKey)},e.turnRunning!==void 0&&(this.turnRunning=e.turnRunning===!0)}catch{this.config={baseUrl:``,model:``,hasKey:!1,apiKeyMasked:``}}},async loadModels(){try{let e=await HR();this.models=Array.isArray(e.models)?e.models:[],this.activeId=e.activeId||null,this.turnRunning=e.turnRunning===!0}catch{this.models=[],this.activeId=null}},openModelList(){this.modelListOpen=!0,this.loadModels(),this.refreshConfig()},closeModelList(){this.modelListOpen=!1},onModelAdd(){this.modelListOpen=!1,this.editModelId=null,this.editInitialModel=null,this.modelEditOpen=!0},onModelEdit(e){if(this.turnRunning&&e&&e.id===this.activeId)return this.notify(`warn`,aW);this.modelListOpen=!1,this.editModelId=e&&e.id?e.id:null,this.editInitialModel=e||null,this.modelEditOpen=!0},onModelEditClose(){this.modelEditOpen=!1,this.modelListOpen=!0},async onModelSaved(){this.modelEditOpen=!1,this.modelListOpen=!0,await this.loadModels(),await this.refreshConfig()},async onModelActivate(e){if(e&&e.id){if(this.turnRunning&&e.id!==this.activeId)return this.notify(`warn`,aW);try{await JR(e.id)}catch(e){this.notify(`warn`,`切换模型失败:${e.message||e}`)}await this.loadModels(),await this.refreshConfig()}},onModelDelete(e){if(e&&e.id){if(this.turnRunning&&e.id===this.activeId)return this.notify(`warn`,aW);this.confirmDeleteModel=e}},async doDeleteModel(){let e=this.confirmDeleteModel;if(this.confirmDeleteModel=null,e&&e.id){try{await qR(e.id)}catch(e){this.notify(`warn`,`删除失败:${e.message||e}`);return}await this.loadModels(),await this.refreshConfig(),this.notify(`ok`,`已删除模型「${e.name||e.model||e.id}」`)}},get deleteModelMessage(){let e=this.confirmDeleteModel;return`确定删除模型「${e?e.name||e.model||e.id:``}」吗?此操作不可撤销,配置将从 .env.cb.local 移除${e&&e.id===this.activeId?`。该模型当前为生效模型,删除后会自动回落到剩余模型中的第一条(若已无模型则需重新添加)。`:`。`}`},async onImportCcSwitch(){this.ccSwitchOpen=!0,this.ccSwitchLoading=!0,this.ccSwitchProviders=[],this.ccSwitchReason=``,this.ccSwitchSelected={};try{let e=await UR(),t=Array.isArray(e.providers)?e.providers:[],n=this.models.map(e=>e.model).filter(Boolean);t.forEach(e=>{e.duplicate=n.includes(e.model)}),this.ccSwitchProviders=t,t.length||(this.ccSwitchReason=e.reason||`cc-switch 中没有可导入的 Codex 类供应商`)}catch(e){this.ccSwitchReason=`读取 cc-switch 失败:${e&&e.message||e}`}finally{this.ccSwitchLoading=!1}},toggleCcSwitchItem(e){if(!e||e.duplicate)return;let t={...this.ccSwitchSelected};t[e.id]?delete t[e.id]:t[e.id]=!0,this.ccSwitchSelected=t},async confirmImportCcSwitch(){let e=this.ccSwitchProviders.filter(e=>this.ccSwitchSelected[e.id]&&!e.duplicate);if(!e.length)return;let t=0,n=0;for(let r of e)try{await GR({name:r.name||r.model,baseUrl:r.baseUrl,apiKey:r.apiKey||``,model:r.model,maxTokens:0,thinking:!1,vision:!1}),t++}catch(e){n++,console.error(`[cc-switch 导入失败]`,r.name,e)}this.ccSwitchOpen=!1,await this.loadModels(),await this.refreshConfig(),n?this.notify(`warn`,`导入完成:成功 ${t} 个、失败 ${n} 个`):this.notify(`ok`,`已从 cc-switch 导入 ${t} 个模型`)},openCommon(){this.modelListOpen=!1,this.commonOpen=!0},async onCommonSaved(){this.commonOpen=!1,await this.refreshConfig(),this.notify(`ok`,`通用设置已保存`)},async ensureHistory(){let e=this.cardId;if(e&&this._loadedCard!==e){this._loadedCard=e,this.loadingHistory=!0;try{let t=await rz(e);if(this.cardId!==e)return;let n=this.busy?this.turnId:``,r=(t.messages||[]).map(e=>this.revive(e)).filter(e=>!(n&&e.role===`assistant`&&e.turnId===n));this.archiveTrimmed=r.some(e=>e.trimmedArchive===!0);let i=new Set(r.map(e=>e.id)),a=this.messages.filter(e=>!i.has(e.id));this.messages=[...r,...a],this.contextUsage=null,this._dirtyFor=null,this.checkResumableTurn(),this.$nextTick(()=>this.scrollToBottom(!0))}catch{this.cardId===e&&(this.messages=[]),this._dirtyFor=null}finally{this.cardId===e&&(this.loadingHistory=!1)}}},serialize(){return this.messages.map(e=>{let t={id:e.id,role:e.role,content:e.content||``,ts:e.ts};return e.role===`assistant`?(t.reasoning=e.reasoning||``,t.reasoningMs=e.reasoningMs||0,t.error=e.error||``,e.errorCode&&(t.errorCode=e.errorCode),e.events?.length&&(t.events=e.events.map(e=>({ts:e.ts||0,level:e.level||`warn`,code:e.code||``,message:e.message||``}))),t.elapsedMs=e.elapsedMs||0,t.status=e.status===`streaming`?`aborted`:e.status||`done`,e.turnId&&(t.turnId=e.turnId),e.serverAuthored&&(t.serverAuthored=!0),e.budget?.message&&(t.budget={reason:e.budget.reason||``,message:e.budget.message}),e.usage&&(t.usage=e.usage),e.toolCalls?.length&&(t.toolCalls=e.toolCalls.map(e=>({toolCallId:e.toolCallId,toolName:e.toolName,args:e.args||{},result:e.result,error:e.error||``,ms:e.ms||0,startedAt:e.startedAt||0,command:e.command||``,approvalNote:e.approvalNote||``,autoApproved:!!e.autoApproved,truncated:!!e.truncated})))):e.attachments?.length&&(t.attachments=e.attachments.map(e=>({path:e.path,name:e.name,isDir:!!e.isDir,isImage:!!e.isImage,size:e.size||0,entryCount:e.entryCount||0,exists:e.exists!==!1}))),t})},revive(e){return{id:e.id||iW(),role:e.role===`user`?`user`:`assistant`,content:e.content||``,narrationChars:Math.max(0,Number(e.narrationChars)||0),reasoning:e.reasoning||``,reasoningMs:e.reasoningMs||0,elapsedMs:Number(e.elapsedMs)||0,toolCalls:Array.isArray(e.toolCalls)?e.toolCalls.map(t=>(e.status===`aborted`||e.status===`streaming`)&&t&&!t.error&&t.result==null?{...t,error:`已终止:该调用未拿到结果(轮次被中断)`}:t):[],attachments:Array.isArray(e.attachments)?e.attachments:[],events:Array.isArray(e.events)?e.events:[],error:e.error||``,errorCode:e.errorCode||``,trimmedArchive:e.trimmedArchive===!0,status:e.status||`done`,turnId:e.turnId||``,serverAuthored:e.serverAuthored===!0,budget:e.budget?.message?{reason:e.budget.reason||``,message:e.budget.message}:void 0,usage:e.usage||void 0,ts:e.ts||0}},persist(){this.cardId&&(this._dirtyFor=this.cardId,this._saveTimer&&clearTimeout(this._saveTimer),this._saveTimer=setTimeout(()=>this.flushHistory(),500))},fitArchive(e){if(FU(e)<=4e6)return e;let t=RU(e,!1);return FU(t)>4e6&&(t=RU(t,!0)),this.archiveTrimmed=!0,t},async flushHistory(e=this.cardId,t=null){if(this._saveTimer&&=(clearTimeout(this._saveTimer),0),e){if(this._saving)this._saveTimer=setTimeout(()=>this.flushHistory(e,t),800);else{this._saving=!0;try{await iz(e,this.fitArchive(t||this.serialize())),this._dirtyFor===e&&(this._dirtyFor=null)}catch(e){this.notify(`warn`,`对话记录保存失败:${e.message||e}`)}finally{this._saving=!1}}}},migrateCard(e,t){e&&t&&e!==t&&this.cardId===e&&(this._saveTimer&&=(clearTimeout(this._saveTimer),0),this._cardRenamedTo=t,this._dirtyFor===e&&(this._dirtyFor=t))},discardCard(e){e&&(this._saveTimer&&=(clearTimeout(this._saveTimer),0),this._dirtyFor===e&&(this._dirtyFor=null),(this._loadedCard===e||this.cardId===e)&&(this.busy&&this._abort&&this._abort.abort(),this.messages=[],this.draftAttachments=[],this.contextUsage=null,this._loadedCard=``))},askClear(){this.messages.length&&(this.confirmClear=!0)},async doClear(){this.confirmClear=!1;let e=this.cardId;this.messages=[],this.contextUsage=null,this._loadedCard=e,this._dirtyFor=null,this._saveTimer&&=(clearTimeout(this._saveTimer),0);try{await az(e),this.notify(`ok`,`已清空本卡片的对话记录`)}catch(e){this.notify(`warn`,`清空失败:${e.message||e}`)}},async onPick(e){try{let t=await ZR(e);if(t.cancelled)return;for(let e of t.items||[])this.pushAttachment(e);t.items?.length||this.notify(`warn`,`未选到可用文件`)}catch(e){this.notify(`warn`,e.message||`无法调起系统选择器,可改用拖拽或粘贴路径`)}},async onAddPath(e){try{let t=await QR(e);this.pushAttachment(t)}catch(t){this.notify(`warn`,`路径不可用:${e}(${t.message||t})`)}},async onPasteImage(e){try{let t=await tz(e);this.pushAttachment(t,`粘贴的截图已存到本机 .cache/ai-attachments/`)}catch(e){this.notify(`warn`,`截图保存失败:${e.message||e}`)}},async onDropFiles(e){let t=Array.from(e.items||[]).map(e=>e.webkitGetAsEntry?e.webkitGetAsEntry():null).filter(Boolean),n=Array.from(e.files||[]),r=[];if(t.length)for(let e of t)r.push(this.resolveEntry(e));else for(let e of n)r.push(this.resolveFile(e));if(!r.length){this.notify(`warn`,`没有识别到可挂载的文件`);return}let i=(await Promise.all(r)).filter(e=>e!==`cancelled`&&!e).length;i&&this.notify(`warn`,`${i} 项未能定位本机路径,可改用「粘贴路径」添加`)},async resolveEntry(e){if(e.isDirectory){let t=await this.firstFileInDir(e);return this.resolveByName(e.name,e.fullPath||e.name,t?.size??-1,t?.name||``)}let t=await this.entryToFile(e);return t?this.resolveFile(t):this.resolveByName(e.name,e.fullPath||e.name,-1)},async resolveFile(e){return this.resolveByName(e.name,e.webkitRelativePath||e.name,e.size)},async resolveByName(e,t,n,r=``){let i={id:iW(`att`),path:``,name:e,isDir:!1,isImage:!1,pending:!0};this.draftAttachments=[...this.draftAttachments,i];try{let a=await ez($R({name:e,relPath:t,size:n,child:r}),QU,`locate`);return i.removed?`cancelled`:(this.pushAttachment(a),a)}catch{return i.removed?`cancelled`:null}finally{this.draftAttachments=this.draftAttachments.filter(e=>e.id!==i.id)}},entryToFile(e){return new Promise(t=>{try{e.file(e=>t(e),()=>t(null))}catch{t(null)}})},firstFileInDir(e){return new Promise(t=>{try{e.createReader().readEntries(async e=>{for(let n of e||[])if(!n.isDirectory){let e=await this.entryToFile(n);if(e)return t(e)}t(null)},()=>t(null))}catch{t(null)}})},pushAttachment(e,t){e?.path&&(this.draftAttachments.some(t=>t.path===e.path)||(this.draftAttachments=[...this.draftAttachments,{...e,note:t}],t&&this.notify(`ok`,t)))},removeAttachment(e){if(!e)return;let t=this.draftAttachments.find(t=>(t.id||t.path)===e);t&&t.pending&&(t.removed=!0),this.draftAttachments=this.draftAttachments.filter(t=>(t.id||t.path)!==e)},cancelPendingLocates(){for(let e of this.draftAttachments)e.pending&&(e.removed=!0)},useSuggestion(e){this.$refs.composerEl?.setText(e.text),this.trackSuggest(e)},shuffleSuggestions(){let e=this.suggestBatch.length;e&&(this.suggestOffset=(this.suggestOffset+4)%e)},trackSuggest(e){if(e&&e.id){this.suggestStats[e.id]=(this.suggestStats[e.id]||0)+1;try{window.dispatchEvent(new CustomEvent(`cardbuddy:suggest`,{detail:{id:e.id,label:e.label,weight:e.weight,batch:this.suggestBatchKey}}))}catch{}}},async onSend({text:e,attachments:t}){if(this.busy||!await this.ensureConfig())return;this.notice=null;let n={id:iW(`u`),role:`user`,content:e,attachments:t.map(e=>({...e})),ts:Date.now()};this.messages.push(n),this.cancelPendingLocates(),this.draftAttachments=[],this.pinned=!0,await this.runTurn({retractMsgId:n.id,draft:{text:e,attachments:n.attachments}})},async ensureConfig(){return await this.refreshConfig(),this.configReady?!0:(this.modelListOpen=!0,this.loadModels(),this.notify(`warn`,`请先在模型库中添加并配置模型(Base URL / API Key / 模型名)`),!1)},onPickBoard(e){if(this.busy)return;let t=mR(e,this.cardId);t&&this.onSend({text:t,attachments:[]})},onContinue(){this.busy||this.onSend({text:`继续`,attachments:[]})},async regenerate(e){if(this.busy)return;let t=this.messages.findIndex(t=>t.id===e.id);t>0&&(this.messages=this.messages.slice(0,t)),await this.runTurn()},async runTurn(e={}){this.messages.push({id:iW(`a`),role:`assistant`,content:``,narrationChars:0,reasoning:``,reasoningMs:0,toolCalls:[],events:[],error:``,status:`streaming`,ts:Date.now()});let t=this.messages[this.messages.length-1],n=t.id;this.busy=!0,this.pinned=!0,this.startTurn();let r=new AbortController;this._abort=r;let i=!1,a=Date.now(),o=()=>{t.reasoning&&!t.reasoningMs&&(t.reasoningMs=Date.now()-a)};try{await sz({messages:this.toWire(this.messages.filter(e=>e.id!==n)),cardContext:this.cardId?{id:this.cardId}:void 0,attachments:this.lastAttachments(),signal:r.signal,onEvent:e=>this.onEvent(e,t,o)}),t.status===`streaming`&&(t.status=`done`)}catch(a){let s=r.signal.aborted||/abort/i.test(String(a?.message||a));o(),a?.code===`turn-in-flight`?(i=!0,this.messages=this.messages.filter(t=>t.id!==n&&t.id!==e.retractMsgId),e.draft&&(this.draftAttachments=(e.draft.attachments||[]).map(e=>({...e})),this.$refs.composerEl?.setText(e.draft.text||``)),this.notify(`warn`,String(a?.message||`这张卡片已有一个回合在跑:请先终止或等它结束,再发新消息`)),this.$nextTick(()=>this.checkResumableTurn())):s?t.status=`aborted`:await this.reattachAfterDrop(t,o)?this.pushEvent(t,{level:`info`,code:`stream-resumed`,message:`已接回本回合,继续跟随进度`}):(t.error=String(a?.message||a),t.errorCode=String(a?.code||``),t.status=`error`)}finally{o(),this.endTurn(t,{rejected:i})}},endTurn(e,{rejected:t=!1}={}){e.status===`streaming`&&(e.status=`done`),t||(e.elapsedMs=Math.max(0,Date.now()-this.turnStartedAt)),this.busy=!1,this._abort=null,this.stopTurnTimers(),this.persist(),this.$emit(`busy`,!1),t||this.$emit(`turn-finished`,{status:e.status,error:e.error||``,steps:this.turnStep,ms:Date.now()-this.turnStartedAt,startedAt:this.turnStartedAt,finishedAt:Date.now(),turnId:this.turnId||e.turnId||``}),this.$nextTick(()=>this.scrollToBottom())},async checkResumableTurn(){let e=this.cardId;if(!(!e||this.busy||this._resumeProbe)){this._resumeProbe=!0;try{let t;try{t=await cz(e)}catch{return}let n=t&&t.active;if(!n||!n.turnId||this.cardId!==e||this.busy)return;await this.attachToTurn({cardId:e,turnId:String(n.turnId),startedAt:Number(n.startedAt)||0,afterSeq:0,note:n.detached?`接回一个仍在服务端运行的回合(上次连接已中断,进度与已落盘产物都在)`:`接回本回合的实时进度`})}finally{this._resumeProbe=!1}}},async attachToTurn({cardId:e,turnId:t,startedAt:n=0,afterSeq:r=0,note:i=``}){let a=this.messages.find(e=>e.role===`assistant`&&e.turnId===t);a||=(this.messages.push({id:iW(`a`),role:`assistant`,content:``,narrationChars:0,reasoning:``,reasoningMs:0,toolCalls:[],events:[],error:``,status:`streaming`,ts:n||Date.now(),turnId:t}),this.messages[this.messages.length-1]),a.content=``,a.reasoning=``,a.reasoningMs=0,a.toolCalls=[],a.events=[],a.error=``,a.errorCode=``,a.budget=void 0,a.status=`streaming`,a.turnId=t,this.busy=!0,this.pinned=!0,this.startTurn(),this.turnId=t,this.lastSeq=Number(r)||0,n&&(this.turnStartedAt=n,a.ts=n);let o=new AbortController;this._abort=o;let s=n||Date.now(),c=()=>{a.reasoning&&!a.reasoningMs&&(a.reasoningMs=Date.now()-s)};i&&this.notify(`warn`,i);try{this.lastSeq=await uz({cardId:e,turnId:t,afterSeq:this.lastSeq,signal:o.signal,onEvent:e=>this.onEvent(e,a,c)})}catch(e){o.signal.aborted||/abort/i.test(String(e?.message||e))||(a.error=String(e?.message||e),a.errorCode=String(e?.code||``),a.status=`error`)}finally{c(),this.endTurn(a)}},async reattachAfterDrop(e,t){let n=this.cardId,r=this.turnId||e.turnId,i=this._abort;if(!n||!r||!i||i.signal.aborted)return!1;try{return this.pushEvent(e,{level:`warn`,code:`stream-dropped`,message:`连接中断:正在按断点续订本回合(服务端仍在跑,已执行的写入不受影响)`}),this.lastSeq=await uz({cardId:n,turnId:r,afterSeq:this.lastSeq,signal:i.signal,onEvent:n=>this.onEvent(n,e,t)}),!0}catch{return!1}},onEvent(e,t,n){this.lastByteAt=Date.now();let r=Number(e.seq)||0;switch(r>this.lastSeq&&(this.lastSeq=r),e.type){case`turn-start`:e.turnId&&(this.turnId=String(e.turnId),t.turnId=String(e.turnId)),Number(e.startedAt)&&(this.turnStartedAt=Number(e.startedAt),t.ts=Number(e.startedAt));break;case`client-detached`:this.pushEvent(t,{level:`info`,code:`client-detached`,message:`连接曾中断,回合在服务端继续跑(事件已全部落日志)`});break;case`turn-end`:(e.status===`aborted`||e.status===`error`)&&(t.status=e.status),e.usage&&this.applyUsage(t,e.usage);break;case`usage`:this.applyUsage(t,e),Number(e.promptStep)>0&&(this.contextUsage={...this.contextUsage||{},used:Number(e.promptStep),total:Number(e.total)||this.contextUsage?.total||0,window:Number(e.window)||this.contextUsage?.window||0,source:`measured`});break;case`reasoning-delta`:t.reasoning+=e.text||``;break;case`text-delta`:n(),t.content+=e.text||``;break;case`tool-call-start`:n(),t.content&&(t.narrationChars=t.content.length),this.findToolRow(t,e)||t.toolCalls.push({toolCallId:e.toolCallId||iW(`tc`),toolName:e.toolName,args:{},pending:!0,result:void 0,error:``,startedAt:Date.now(),ms:0});break;case`tool-call`:{n(),t.content&&(t.narrationChars=t.content.length);let r=this.findToolRow(t,e);r?(e.toolCallId&&(r.toolCallId=e.toolCallId),e.toolName&&(r.toolName=e.toolName),r.args=e.args||{},r.pending=!1):t.toolCalls.push({toolCallId:e.toolCallId||iW(`tc`),toolName:e.toolName,args:e.args||{},result:void 0,error:``,startedAt:Date.now(),ms:0});break}case`tool-result`:{let n=t.toolCalls.find(t=>t.toolCallId===e.toolCallId||!e.toolCallId&&t.toolName===e.toolName&&t.result===void 0);n&&(n.result=e.result??``,n.truncated=!!e.truncated,e.error&&(n.error=String(e.error)),e.image&&(n.image=e.image),n.ms=Date.now()-(n.startedAt||Date.now())),this.persist();break}case`approval-request`:{let n=this.findToolRow(t,e)||t.toolCalls[t.toolCalls.length-1];n&&n.toolName===e.toolName&&n.result===void 0?(n.approvalId=e.approvalId,e.command&&(n.command=e.command),n.needsApproval=!0):t.toolCalls.push({toolCallId:e.toolCallId||iW(`tc`),toolName:e.toolName,args:e.args||{},command:e.command||``,approvalId:e.approvalId,needsApproval:!0,result:void 0,error:``,startedAt:Date.now(),ms:0});break}case`approval-decided`:{let n=(t.toolCalls||[]).find(t=>t.approvalId===e.approvalId);n&&(n.needsApproval=!1,n.approvalNote=e.ok?e.scope===`turn`?`已允许,本回合后续同类执行不再询问…`:`已允许,执行中…`:e.reason||`已拒绝执行`);break}case`approval-auto`:{let n=this.findToolRow(t,e)||[...t.toolCalls||[]].reverse().find(t=>t.toolName===e.toolName&&t.result===void 0);n&&(e.command&&(n.command=e.command),n.autoApproved=!0,n.approvalNote=`按设置免确认执行`);break}case`notice`:{let n=e.level===`info`||e.level===`error`?e.level:`warn`;this.pushEvent(t,{level:n,code:e.code||``,message:e.message||``}),n!==`info`&&this.notify(n===`error`?`danger`:`warn`,e.message||``);break}case`round-retry`:{let n=Number(e.dropReasoning)||0,r=Number(e.dropText)||0,i=Number(e.dropTools)||0;n>0&&(t.reasoning=t.reasoning.slice(0,Math.max(0,t.reasoning.length-n))),r>0&&(t.content=t.content.slice(0,Math.max(0,t.content.length-r))),i>0&&t.toolCalls.splice(Math.max(0,t.toolCalls.length-i),i),t.reasoning||(t.reasoningMs=0),this.pushEvent(t,{level:`warn`,code:`retry-${e.reason||`unknown`}`,message:e.message||``}),this.notify(`warn`,e.message||``);break}case`context-usage`:this.contextUsage={used:Number(e.used)||0,total:Number(e.total)||0,window:Number(e.window)||0,source:String(e.source||`estimated`)};break;case`turn-ended`:t.budget={reason:String(e.reason||``),message:String(e.message||``)};break;case`error`:t.error=t.error?`${t.error}\n${e.message}`:String(e.message||``),e.code&&(t.errorCode=String(e.code)),t.status=`error`;break;case`aborted`:t.status=`aborted`}let i=t.toolCalls||[];this.turnStep=i.length;let a=i[i.length-1];if(a){this.turnToolLabel=`正在${VL(a.toolName)}…`;let e=JL(a);e&&(!this.turnStage||e.order>this.turnStage.order)&&(this.turnStage=e)}this.$nextTick(()=>this.scrollToBottom())},async onApproval({tc:e,ok:t,scope:n=`once`}){if(e?.approvalId){e.needsApproval=!1,e.approvalNote=t?n===`turn`?`已允许,本回合后续同类执行不再询问…`:`已允许,执行中…`:`已拒绝执行`;try{await nz({approvalId:e.approvalId,ok:t,scope:n})}catch(e){this.notify(`warn`,`审批提交失败:${e.message}`)}}},findToolRow(e,t){let n=e.toolCalls||[];if(t.toolCallId){let e=n.find(e=>e.toolCallId===t.toolCallId);if(e)return e}return n.find(e=>e.pending&&e.toolName===t.toolName)||null},stop(){this.confirmStop=!1;let e=this._abort,t=this.cardId,n=this.turnId||``;t&&n&&lz(t).catch(e=>{e?.code!==`no-turn`&&this.notify(`warn`,`终止请求未送达:${e.message}`)}),e&&(e.abort(),this.notify(`ok`,`已终止本次生成`))},doStop(){this.stop()},onEscape(){this.confirmStop?this.confirmStop=!1:this.confirmDeleteModel?this.confirmDeleteModel=null:this.commonOpen?this.commonOpen=!1:this.modelListOpen||this.modelEditOpen?(this.modelListOpen=!1,this.modelEditOpen=!1):this.busy?this.confirmStop=!0:this.$emit(`close`)},lastAttachments(){for(let e=this.messages.length-1;e>=0;e--){let t=this.messages[e];if(t.role===`user`)return(t.attachments||[]).map(e=>({path:e.path,name:e.name,isDir:e.isDir,isImage:e.isImage}))}return[]},toWire(e){return e.map(e=>{if(e.role===`user`){let t=e.attachments||[],n=e.content||``;if(t.length){let e=t.map(e=>`- ${e.isDir?`文件夹`:e.isImage?`图片`:`文件`}:${e.path}`);n=`${n}${n?`
356
357
 
357
358
  `:``}[已挂载本地文件(仅本机路径,未上传;需要内容请用工具读取)]\n${e.join(`
358
- `)}`}return{role:`user`,content:n}}let t=(e.toolCalls||[]).filter(e=>e.result!==void 0||e.error).map(e=>({toolCallId:e.toolCallId,toolName:e.toolName,args:e.args||{},result:typeof e.result==`string`?MU(e.toolName,e.result):e.result,error:e.error||``})),n=e.content||``;return e.status===`aborted`&&(n=n?`${n}\n\n[本轮生成被用户手动中止,以上为已完成部分;未完成的步骤没有执行,请从中断处继续。]`:`[上一轮被用户手动中止于思考/工具阶段,没有产出可用内容;请重新规划并继续完成用户的目标。]`),{role:`assistant`,content:n,toolCalls:t}})},onScroll(){let e=this.$refs.listEl;e&&(this.pinned=e.scrollHeight-e.scrollTop-e.clientHeight<48)},scrollToBottom(e=!1){let t=this.$refs.listEl;t&&(e||this.pinned)&&(t.scrollTop=t.scrollHeight)},stopTickers(){this._saveTimer&&clearTimeout(this._saveTimer),this._saveTimer=0},startTurn(){let e=Date.now();this.turnId=``,this.lastSeq=0,this.turnStep=0,this.turnStage=null,this.turnToolLabel=``,this.turnStartedAt=e,this.lastByteAt=e,this.nowTs=e,this.stopTurnTimers(),this._liveTicker=setInterval(()=>{this.nowTs=Date.now(),this.$emit(`turn-progress`,{steps:this.turnStep,startedAt:this.turnStartedAt,ms:this.nowTs-this.turnStartedAt,stage:this.turnStage?`${this.turnStage.id} ${this.turnStage.label}`:this.turnToolLabel,stalled:this.stalled})},1e3),this._turnPersistTimer=setInterval(()=>this.persist(),8e3),this.persist(),this.$emit(`busy`,!0)},stopTurnTimers(){this._liveTicker&&clearInterval(this._liveTicker),this._liveTicker=0,this._turnPersistTimer&&clearInterval(this._turnPersistTimer),this._turnPersistTimer=0},onPagehide(){let e=this.cardId;if(!e||!this.messages.length)return;let t=this.fitArchive(this.serialize());this._dirtyFor=null,this._saveTimer&&=(clearTimeout(this._saveTimer),0),QR(e,t,{keepalive:!0}).catch(()=>{})},fmtClock:RL,pushEvent(e,t){let n=String(t&&t.message||``);n&&e&&(Array.isArray(e.events)||(e.events=[]),e.events.push({ts:Date.now(),level:t.level||`warn`,code:t.code||``,message:n}))},applyUsage(e,t){if(!e||!t)return;let n=e=>Number.isFinite(Number(e))?Number(e):0;e.usage={steps:n(t.steps),promptTokens:n(t.promptTokens),completionTokens:n(t.completionTokens),cachedTokens:n(t.cachedTokens),cacheMissTokens:n(t.cacheMissTokens),hitRate:n(t.hitRate),reported:t.reported!==!1}},loadCompact(){try{this.compactSteps=localStorage.getItem(UU)===`1`}catch{}},setCompact(e){let t=!!e;if(this.compactSteps!==t){this.compactSteps=t;try{t?localStorage.setItem(UU,`1`):localStorage.removeItem(UU)}catch{}this.$nextTick(()=>this.scrollToBottom())}},toggleCompact(){this.setCompact(!this.compactSteps)},onLocateNode(e){e&&this.$emit(`locate-node`,String(e))},onRollbackTurn(e){if(this.busy)return;let t=this.cardId;t&&e&&this.$emit(`rollback-turn`,{cardId:t,ts:Number(e.ts)||0,msgId:e.id})},notify(e,t){this.notice={type:e,text:t},this._noticeTimer&&clearTimeout(this._noticeTimer),this._noticeTimer=setTimeout(()=>{this.notice=null},6e3)}}},ZU={class:`aichat__head`},QU={class:`aichat__titles`},$U={class:`aichat__sub`},eW={class:`aichat__acts`},tW=[`title`,`aria-pressed`],nW={viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},rW=[`href`],iW=[`disabled`],aW={key:0,class:`aichat__banner`},oW={class:`aichat__scroll`},sW={key:0,class:`aichat__archnote`,title:`长对话记录超出落盘体积上限时,较早的工具参数与结果会被裁剪归档;正文、思考与过程事件都完整保留`},cW={key:1,class:`aichat__loading`},lW={key:2,class:`aichat__empty`},uW={class:`aichat__empty-title`},dW={class:`aichat__empty-desc`},fW={class:`aichat__suggests`},pW=[`title`,`data-suggest-id`,`onClick`],mW={viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},hW=[`href`],gW={class:`aichat__suggest-text`},_W={class:`aichat__suggest-label`},vW={class:`aichat__suggest-hint`},yW={key:0,class:`aichat__suggest-badge`,title:`该操作会改动卡片`},bW={class:`aichat__live-text`},xW={key:1,class:`aichat__quick`},SW=[`title`,`data-suggest-id`,`onClick`],CW={viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},wW=[`href`],TW={class:`ni-panel modal-card ccsw-dlg`,role:`dialog`,"aria-modal":`true`,"aria-label":`从 cc-switch 导入模型`},EW={class:`ni-head`},DW={class:`ni-body`},OW={class:`ni-scroll`},kW={key:0,class:`ccsw-dlg__msg`},AW={class:`ccsw-dlg__msg ccsw-dlg__msg--err`},jW={class:`ccsw-dlg__list`},MW=[`onClick`],NW={key:0,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`,"stroke-linecap":`round`,"stroke-linejoin":`round`},PW={class:`ccsw-dlg__info`},FW={class:`ccsw-dlg__name`},IW={key:0,class:`ccsw-dlg__badge ccsw-dlg__badge--cur`,title:`cc-switch 中当前生效`},LW={key:1,class:`ccsw-dlg__badge ccsw-dlg__badge--dup`,title:`模型库中已存在同名模型`},RW={class:`ccsw-dlg__meta`},zW={class:`ccsw-dlg__model`},BW={class:`ccsw-dlg__host`},VW={class:`ni-foot`},HW={class:`ni-tip`},UW={class:`ni-foot-btns`},WW=[`disabled`];function GW(e,t,n,r,i,a){let o=R(`ChatMessage`),s=R(`ChatComposer`),c=R(`ModelList`),l=R(`AiSettings`),u=R(`ConfirmDialog`),d=R(`AiCommonSettings`);return V(),H(`aside`,{class:j([`aichat`,{"is-open":n.visible}]),style:A(a.panelStyle),role:`complementary`,"aria-label":`AI 开发助手`,onKeydown:t[21]||=jl((...e)=>a.onEscape&&a.onEscape(...e),[`esc`]),onClick:t[22]||=(...e)=>a.onImageClick&&a.onImageClick(...e)},[q(` 左缘拖拽把手:调宽(双击恢复默认 33%) `),W(`div`,{class:j([`aichat__grip`,{"is-dragging":i.resizing}]),title:`拖拽调整宽度(双击恢复默认)`,onPointerdown:t[0]||=J((...e)=>a.startResize&&a.startResize(...e),[`prevent`]),onDblclick:t[1]||=J((...e)=>a.resetWidth&&a.resetWidth(...e),[`prevent`])},null,34),q(` 头部:标题 + 当前卡片 / 模型 + 清空 / 设置 / 关闭 `),W(`header`,ZU,[t[27]||=W(`span`,{class:`aichat__logo`},[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-sparkles`})])],-1),W(`span`,QU,[t[23]||=W(`span`,{class:`aichat__title`},`AI 开发助手`,-1),W(`span`,$U,[n.cardId?(V(),H(B,{key:0},[K(M(n.cardName||n.cardId),1)],64)):(V(),H(B,{key:1},[K(`未选择卡片`)],64)),i.config.model?(V(),H(B,{key:2},[K(` · `+M(i.config.model),1)],64)):q(`v-if`,!0)])]),W(`span`,eW,[q(` 紧凑视图(面板级):长任务里读取类调用能刷几十行,把写入与门禁挤到折叠线以下 `),W(`button`,{type:`button`,class:j([`aichat__iconbtn`,{"is-on":i.compactSteps}]),title:i.compactSteps?`紧凑视图已开启:已折叠读取类调用,点击显示全部步骤`:`只看关键步骤:折叠读取类调用(写入 / 跑脚本 / 报错始终显示)`,"aria-pressed":i.compactSteps?`true`:`false`,onClick:t[2]||=(...e)=>a.toggleCompact&&a.toggleCompact(...e)},[(V(),H(`svg`,nW,[W(`use`,{href:i.compactSteps?`#icon-eye-off`:`#icon-eye`},null,8,rW)]))],10,tW),W(`button`,{type:`button`,class:`aichat__iconbtn`,title:`清空本卡片对话记录`,disabled:!i.messages.length||i.busy,onClick:t[3]||=(...e)=>a.askClear&&a.askClear(...e)},[...t[24]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-trash`})],-1)]],8,iW),W(`button`,{type:`button`,class:`aichat__iconbtn`,title:`模型库`,onClick:t[4]||=(...e)=>a.openModelList&&a.openModelList(...e)},[...t[25]||=[W(`svg`,{class:`is-solid-icon`,viewBox:`0 0 1024 1024`,"aria-hidden":`true`},[W(`use`,{href:`#icon-model`})],-1)]]),W(`button`,{type:`button`,class:`aichat__iconbtn`,title:`关闭(Esc)`,onClick:t[5]||=t=>e.$emit(`close`)},[...t[26]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-x`})],-1)]])])]),q(` 未配置模型:常驻提示条,一键打开设置 `),a.configReady?q(`v-if`,!0):(V(),H(`div`,aW,[t[28]||=W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-alert-triangle`})],-1),t[29]||=W(`span`,null,`尚未配置模型,无法对话。`,-1),W(`button`,{type:`button`,class:`aichat__banner-btn`,onClick:t[6]||=(...e)=>a.openModelList&&a.openModelList(...e)},`去设置`)])),q(` 消息区:滚动容器与悬浮「回到底部」共处一个定位上下文,按钮只贴消息区底缘,
359
- 输入区拖高 / 反馈条出现都不会把它盖住或悬空 `),W(`div`,oW,[W(`div`,{ref:`listEl`,class:`aichat__list`,onScroll:t[10]||=(...e)=>a.onScroll&&a.onScroll(...e)},[q(` 体积治理痕迹:较早的工具结果被裁剪过就说清楚,别让人以为记录丢了 `),i.archiveTrimmed?(V(),H(`div`,sW,[...t[30]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-activity`})],-1),W(`span`,null,`较早的工具参数 / 结果已裁剪归档(对话正文与过程事件完整保留)`,-1)]])):q(`v-if`,!0),i.loadingHistory?(V(),H(`div`,cW,`正在加载对话记录…`)):i.messages.length?(V(),H(B,{key:3},[q(` compact = 面板级「只看关键步骤」;can-rollback 只对当前卡片、非流式中开放(切了卡再回滚会写错对象) `),(V(!0),H(B,null,z(i.messages,(e,r)=>(V(),U(o,{key:e.id,msg:e,streaming:i.busy&&r===i.messages.length-1,"can-regenerate":e.role===`assistant`&&r===i.messages.length-1,compact:i.compactSteps,"can-rollback":e.role===`assistant`&&!i.busy&&!!n.cardId,"now-ts":i.busy&&r===i.messages.length-1?i.nowTs:0,"pick-owner":a.pickOwnerRow,onRegenerate:a.regenerate,onApproval:a.onApproval,onContinue:a.onContinue,onRollback:a.onRollbackTurn,onOpenSettings:a.openModelList,onShowAllSteps:t[8]||=e=>a.setCompact(!1),onLocateNode:a.onLocateNode,onPickBoard:a.onPickBoard},null,8,[`msg`,`streaming`,`can-regenerate`,`compact`,`can-rollback`,`now-ts`,`pick-owner`,`onRegenerate`,`onApproval`,`onContinue`,`onRollback`,`onOpenSettings`,`onLocateNode`,`onPickBoard`]))),128)),q(` 面板级进度:步数 / 已用时长 / 建卡阶段 / 最近收到数据多久前。
360
- 长任务里「还活着吗」全靠这一行——旧版只有一句「生成中…」,网关静默与真在跑无从区分 `),i.busy?(V(),H(`div`,{key:0,class:j([`aichat__live`,{"is-stalled":a.stalled}]),role:`status`,"aria-live":`polite`},[t[33]||=W(`span`,{class:`aichat__live-dot`},null,-1),W(`span`,bW,M(a.liveText),1),a.stalled?(V(),H(`button`,{key:0,type:`button`,class:`aichat__live-act`,title:`连接可能已中断,终止本轮(已落盘的产物会保留)`,onClick:t[9]||=(...e)=>a.stop&&a.stop(...e)},` 终止 `)):q(`v-if`,!0)],2)):q(`v-if`,!0)],64)):(V(),H(`div`,lW,[t[32]||=W(`span`,{class:`aichat__empty-logo`},[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-sparkles`})])],-1),W(`p`,uW,M(a.emptyTitle),1),W(`p`,dW,M(a.emptyDesc),1),W(`div`,fW,[(V(!0),H(B,null,z(a.suggestions,e=>(V(),H(`button`,{key:e.id,type:`button`,class:j([`aichat__suggest`,`is-${e.weight}`]),title:e.text,"data-suggest-id":e.id,onClick:t=>a.useSuggestion(e)},[(V(),H(`svg`,mW,[W(`use`,{href:e.icon},null,8,hW)])),W(`span`,gW,[W(`span`,_W,M(e.label),1),W(`span`,vW,M(e.hint),1)]),e.weight===`write`?(V(),H(`span`,yW,`改卡`)):q(`v-if`,!0)],10,pW))),128)),a.canShuffle?(V(),H(`button`,{key:0,type:`button`,class:`aichat__suggest-shuffle`,onClick:t[7]||=(...e)=>a.shuffleSuggestions&&a.shuffleSuggestions(...e)},[...t[31]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-refresh`})],-1),W(`span`,null,`换一批`,-1)]])):q(`v-if`,!0)])]))],544),q(` 回到底部:脱离底部吸附时出现 `),L(W(`button`,{type:`button`,class:`aichat__jump`,title:`回到底部`,onClick:t[11]||=e=>a.scrollToBottom(!0)},[...t[34]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-arrow-down`})],-1)]],512),[[Nc,!i.pinned&&i.messages.length]])]),q(` 常驻「常用」指令:有对话后空态建议区不再出现,这里保留一排轻量入口,随上下文同源 `),a.quickChips.length&&i.messages.length&&!i.busy?(V(),H(`div`,xW,[(V(!0),H(B,null,z(a.quickChips,e=>(V(),H(`button`,{key:e.id,type:`button`,class:j([`aichat__chip`,`is-${e.weight}`]),title:e.text,"data-suggest-id":e.id,onClick:t=>a.useSuggestion(e)},[(V(),H(`svg`,CW,[W(`use`,{href:e.icon},null,8,wW)])),W(`span`,null,M(e.label),1)],10,SW))),128))])):q(`v-if`,!0),q(` 操作反馈(附件解析失败 / 历史保存失败等) `),i.notice?(V(),H(`div`,{key:2,class:j([`aichat__notice`,`aichat__notice--${i.notice.type}`])},[W(`span`,null,M(i.notice.text),1),W(`button`,{type:`button`,class:`aichat__notice-x`,title:`关闭`,onClick:t[12]||=e=>i.notice=null},[...t[35]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-x`})],-1)]])],2)):q(`v-if`,!0),G(s,{ref:`composerEl`,busy:i.busy,model:i.config.model,attachments:i.draftAttachments,placeholder:a.configReady?`描述你要改的卡片,Enter 发送 / Shift+Enter 换行`:`请先在设置中配置模型…`,context:i.contextUsage,onSend:a.onSend,onStop:a.stop,onPick:a.onPick,onAddPath:a.onAddPath,onRemoveAttachment:a.removeAttachment,onDropFiles:a.onDropFiles,onPasteImage:a.onPasteImage,onEscape:a.onEscape},null,8,[`busy`,`model`,`attachments`,`placeholder`,`context`,`onSend`,`onStop`,`onPick`,`onAddPath`,`onRemoveAttachment`,`onDropFiles`,`onPasteImage`,`onEscape`]),q(` 一级面板:模型库。从齿轮 / 横幅 / 消息内「去设置」进入 `),i.modelListOpen?(V(),U(c,{key:3,models:i.models,"active-id":i.activeId,"turn-running":i.turnRunning,onClose:a.closeModelList,onAdd:a.onModelAdd,onEdit:a.onModelEdit,onDelete:a.onModelDelete,onActivate:a.onModelActivate,onImportCcswitch:a.onImportCcSwitch,onOpenCommon:a.openCommon},null,8,[`models`,`active-id`,`turn-running`,`onClose`,`onAdd`,`onEdit`,`onDelete`,`onActivate`,`onImportCcswitch`,`onOpenCommon`])):q(`v-if`,!0),q(` 新增 / 编辑模型:复用 AiSettings(modelId 区分,initialModel 预填) `),i.modelEditOpen?(V(),U(l,{key:4,config:i.config,"model-id":i.editModelId,"initial-model":i.editInitialModel,onClose:a.onModelEditClose,onSaved:a.onModelSaved},null,8,[`config`,`model-id`,`initial-model`,`onClose`,`onSaved`])):q(`v-if`,!0),q(` 删除模型确认:二次确认后才真正落盘删除 `),G(u,{visible:!!i.confirmDeleteModel,"close-on-mask":!1,title:`删除模型`,message:a.deleteModelMessage,"confirm-text":`删除`,severity:`danger`,onConfirm:a.doDeleteModel,onCancel:t[13]||=e=>i.confirmDeleteModel=null},null,8,[`visible`,`message`,`onConfirm`]),q(` cc-switch 导入弹窗:列出 cc-switch 的 Codex 类供应商,勾选后批量导入模型库(按 model 去重) `),G(hc,{name:`modal`},{default:I(()=>[i.ccSwitchOpen?(V(),H(`div`,{key:0,class:`ni-overlay`,onClick:t[17]||=J(e=>i.ccSwitchOpen=!1,[`self`])},[W(`div`,TW,[W(`div`,EW,[t[36]||=W(`span`,{class:`ni-title`},`从 cc-switch 导入`,-1),W(`button`,{class:`ni-close`,type:`button`,title:`关闭`,onClick:t[14]||=e=>i.ccSwitchOpen=!1})]),W(`div`,DW,[W(`div`,OW,[q(` 加载中 `),i.ccSwitchLoading?(V(),H(`p`,kW,`正在读取 cc-switch 供应商…`)):i.ccSwitchReason?(V(),H(B,{key:1},[q(` 无可导入项 `),W(`p`,AW,M(i.ccSwitchReason),1)],2112)):(V(),H(B,{key:2},[q(` 供应商列表 `),W(`ul`,jW,[(V(!0),H(B,null,z(i.ccSwitchProviders,e=>(V(),H(`li`,{key:e.id,class:j([`ccsw-dlg__item`,{"is-active":i.ccSwitchSelected[e.id],"is-dup":e.duplicate}]),onClick:t=>a.toggleCcSwitchItem(e)},[W(`span`,{class:j([`ccsw-dlg__check`,{"is-on":i.ccSwitchSelected[e.id]}])},[i.ccSwitchSelected[e.id]?(V(),H(`svg`,NW,[...t[37]||=[W(`use`,{href:`#icon-check`},null,-1)]])):q(`v-if`,!0)],2),W(`span`,PW,[W(`span`,FW,[K(M(e.name||e.model)+` `,1),e.isCurrent?(V(),H(`span`,IW,`当前`)):q(`v-if`,!0),e.duplicate?(V(),H(`span`,LW,`已存在`)):q(`v-if`,!0)]),W(`span`,RW,[W(`span`,zW,M(e.model),1),t[38]||=W(`span`,{class:`ccsw-dlg__dot`},`·`,-1),W(`span`,BW,M(e.baseUrl),1)])])],10,MW))),128))])],2112))])]),W(`div`,VW,[W(`span`,HW,M(a.ccSwitchDupCount>0?`已有 ${a.ccSwitchDupCount} 个重复模型被自动跳过`:`勾选要导入的供应商,批量加入模型库`),1),W(`div`,UW,[W(`button`,{class:`ni-btn ni-btn--ghost`,type:`button`,onClick:t[15]||=e=>i.ccSwitchOpen=!1},`取消`),W(`button`,{class:`ni-btn`,type:`button`,disabled:i.ccSwitchLoading||!i.ccSwitchProviders.length||a.ccSwitchCheckedCount===0,onClick:t[16]||=(...e)=>a.confirmImportCcSwitch&&a.confirmImportCcSwitch(...e)},M(a.ccSwitchCheckedCount>0?`导入选中 ${a.ccSwitchCheckedCount} 项`:`导入`),9,WW)])])])])):q(`v-if`,!0)]),_:1}),q(` 通用设置:所有模型共享的执行策略 / 环境参数 `),i.commonOpen?(V(),U(d,{key:5,onClose:t[18]||=e=>i.commonOpen=!1,onSaved:a.onCommonSaved},null,8,[`onSaved`])):q(`v-if`,!0),G(u,{visible:i.confirmClear,"close-on-mask":!1,title:`清空对话记录`,message:`将删除卡片「${n.cardName||n.cardId||`当前卡片`}」的全部对话记录,此操作不可撤销。`,"confirm-text":`清空`,severity:`danger`,onConfirm:a.doClear,onCancel:t[19]||=e=>i.confirmClear=!1},null,8,[`visible`,`message`,`onConfirm`]),q(` 终止确认:生成中按 Esc 会走到这里。几十分钟的建卡被一次误按抹掉代价太大,故加一道确认 `),G(u,{visible:i.confirmStop,"close-on-mask":!1,title:`终止本次生成`,message:`已执行的写入与落盘产物都会保留,上下文也留在对话里,之后回复「继续」可从中断处接着做。确定现在终止?`,"confirm-text":`终止生成`,severity:`danger`,onConfirm:a.doStop,onCancel:t[20]||=e=>i.confirmStop=!1},null,8,[`visible`,`onConfirm`])],38)}var KW=Z(XU,[[`render`,GW],[`__file`,`/Users/ynet/dsl-card/card-editor/components/ChatPanel.vue`]]),qW=`/assets/site-icon-CFMif8z4.png`,JW={includeMocks:!0};function YW(e){return e?JSON.parse(JSON.stringify(e,(e,t)=>e===`_schemaNode`?void 0:t)):null}function XW(e){let t=YW(e);if(t&&t.dictionary&&Array.isArray(t.dictionary.inputParams)){let e=hv(t);for(let n of t.dictionary.inputParams)n&&typeof n==`object`&&!gv(e,n.key)&&(n.defaultValue=void 0)}return t}function ZW(e,t){return!e||!t?e===t:JSON.stringify(XW(e))===JSON.stringify(XW(t))}function QW(e,t){return JSON.stringify(e)===JSON.stringify(t)}function $W(e,t){return!t||!e?!1:!ZW(e,t)}function eG(e,t,n){return!t||!e?!1:!QW(e,n??mv(t,JW))}function tG(e,t,n,r){return!t||!e?!1:$W(e,t)||eG(n,t,r)}var nG={includeMocks:!0},rG=2500,iG=8e3,aG=`cardbuddy:remote-cards-cache:v1`,oG=3e5;function sG(){try{let e=JSON.parse(localStorage.getItem(aG)||`null`);if(e&&e.v===1&&Array.isArray(e.cards))return e}catch{}return null}function cG(e){try{localStorage.setItem(aG,JSON.stringify({v:1,at:Date.now(),cards:e}))}catch{}}var lG=new pu,uG=vu({},lG);typeof window<`u`&&(window.__rt=uG);var dG=188,fG=320,pG=200,mG=160,hG={name:`App`,components:{RenderTree:vp,DebugPanel:Gx,ApiCallPanel:pS,CardSelect:MS,AlertCardLayer:HS,DeviceOverlay:MD,PickerOverlay:HD,DatePickerOverlay:$D,KeyboardOverlay:aO,LoadingExOverlay:dO,SelectionOverlay:hO,HoverGuides:xO,RemotePreview:lk,AppToast:gk,ThemeSettings:Lk,ImageLightbox:rA,ConfirmDialog:Ap,CardGallery:jA,RemoteAllCards:fj,RemoteCardFormDialog:qj,SyncProgressModal:iM,ExportDirDialog:bM,ExportProgressModal:jM,NewCardDialog:ZM,ComponentPalette:fN,Switch:gN,ChatPanel:KW},provide(){return{adapter:lG,cardRuntime:uG,customComponents:{}}},data(){return{adapter:lG,rt:uG,logoUrl:qW,appVersion:`0.80.0`,cardList:[],cardCount:0,galleryOpen:!1,remoteAllOpen:!1,remoteCards:[],remoteCardsLoading:!1,remoteCardsRefreshing:!1,remoteCardsError:``,remoteCardFormOpen:!1,remoteCardFormMode:`create`,remoteCardFormCard:null,remoteCardDeletingId:``,syncJobId:``,syncProgressOpen:!1,syncProgress:{done:0,total:0,current:``},syncPollTimer:null,exportDirDialog:{visible:!1,ids:[]},exportJobId:``,exportProgressOpen:!1,exportProgress:{done:0,total:0,current:``},exportPollTimer:null,syncPendingCodes:void 0,cardDialog:{visible:!1,mode:`create`,cardId:``,cardDesc:``},selectedId:``,externalReloadNote:``,externalReloadTimer:null,selfSaveId:``,selfSaveAt:0,preview:null,chromeOff:!1,theme:`dark`,accent:yk,cardReady:!1,reloadToken:0,moveCollapseToken:0,refreshing:!1,loadingCard:!1,currentSchema:null,currentCard:null,loadedCardId:``,cardImportMeta:null,localSchema:null,localData:null,selectedNodeId:``,activeTab:`vars`,apiPanelOpen:!0,addNodePanelOpen:!1,addNodeTarget:null,validateBadge:{state:`idle`,errors:0,warnings:0,renderOk:null,ts:0},validateTimer:null,savedCard:!1,savingCard:!1,saveTimer:null,coverBusy:!1,savingRemote:!1,restoringHistory:!1,savedRemote:!1,verifiedRemote:null,saveRemoteTimer:null,syncingRemote:!1,syncedRemote:!1,remotePreviewOpen:!1,syncTarget:null,syncTimer:null,uploadingSlices:!1,publishing:!1,metaRefreshToken:0,historyRefreshToken:0,loginModal:!1,loginName:``,loginPassword:``,loginSubmitting:!1,loginError:``,credentialsReady:!1,loginPendingAction:``,remoteToggleFn:null,confirm:{show:!1,title:``,message:``,confirmText:`继续`,cancelText:`取消`,severity:`primary`,onConfirm:null},past:[],future:[],baseline:null,_commitTimer:null,viewportHeight:700,canvasBg:`gray`,refreshing:!1,bgOptions:[{key:`checker`,label:`棋盘`},{key:`white`,label:`白色`},{key:`gray`,label:`浅灰`},{key:`black`,label:`黑色`}],_previewWidthPx:372,_apiPanelWidthPx:360,presetSizes:[{key:375,value:`375`},{key:430,value:`430`},{key:188,value:`188`}],stageWidth:typeof window<`u`?window.innerWidth:1280,colsWidth:0,stageHeight:typeof window<`u`?window.innerHeight-52:748,dragging:!1,apiDragging:!1,_stageObserver:null,devServiceOpen:!1,aiChatOpen:(()=>{try{return sessionStorage.getItem(`cardbuddy:ai-chat-open`)===`1`}catch{return!1}})(),chatBusy:!1,chatProgress:null,fab:{x:null,y:null,dragging:!1},fabDrag:null,fabSuppressClick:!1,devServiceForm:Kl(),apiBaseResolved:Jl(),devSvcLive:`unknown`,devSvcDown:!1,_unsubCardsChanged:null}},computed:{fabTitle(){if(this.aiChatOpen)return`AI 开发助手(已打开)`;if(!this.chatBusy)return`AI 开发助手`;let e=this.chatProgress,t=e&&e.startedAt?`${zL(e.startedAt)} 开始 · `:``;return`AI 开发助手正在生成(${e?`${t}第 ${e.steps} 步 · 已用 ${RL(e.ms)}${e.stage?` · ${e.stage}`:``}${e.stalled?` · 疑似断流`:``}`:``}),点击展开查看`},fabStyle(){return this.fab.x==null||this.fab.y==null?{}:{right:this.fab.x+`px`,bottom:this.fab.y+`px`,left:`auto`,top:`auto`,transition:this.fab.dragging?`none`:``}},currentBg(){return this.bgOptions.find(e=>e.key===this.canvasBg)||this.bgOptions[0]},cardIds(){return this.cardList.map(e=>e&&e.id).filter(Boolean)},remoteImportedIds(){return this.cardList.filter(e=>e&&e.imported).map(e=>e.id)},canUndo(){return this.past.length>0},canRedo(){return this.future.length>0},devSvcBlockReason(){let e=this.devServiceForm||{};return String(e.baseUrl||``).trim()?e.enabled?null:`disabled`:`empty`},canPaste(){return!!td()},hasCardSource(){return!!(this.cardImportMeta&&this.cardImportMeta.source)},remoteBusy(){return!!(this.savingRemote||this.syncingRemote||this.uploadingSlices||this.publishing)},remoteBusyReason(){return this.savingRemote?`正在推送至远端…`:this.syncingRemote?`正在拉取远端卡片…`:this.uploadingSlices?`正在上传切图…`:this.publishing?`正在发布版本…`:``},historyDirty(){return tG(this.currentSchema,this.localSchema,this.rt&&this.rt.rootScope,this.localData)},devSvcConn(){return this.apiBaseResolved===null?`unconfigured`:this.devSvcLive===`open`?`open`:this.devSvcDown?`closed`:`connecting`},devSvcTitle(){if(this.apiBaseResolved===null)return this.devSvcBlockReason===`disabled`?`已填地址但未开启用本地服务`:`未配置本地开发服务(部署态必填)`;let e=this.apiBaseResolved===``?`同源开发服务`:`本地开发服务`;return this.devSvcLive===`open`?e+`已连接`:this.devSvcDown?e+`已断开(连接失败或服务已停止,重连中…)`:e+`连接中 / 重连中…`},devSvcClass(){return this.apiBaseResolved===null?`app__btn--warn`:this.devSvcLive===`open`?`app__btn--connected`:this.devSvcDown?`app__btn--disconnected`:`app__btn--reconnecting`},devSvcLabel(){return this.apiBaseResolved===null?`未配置本地服务`:this.devSvcLive===`open`?`本地服务已连接`:this.devSvcDown?`本地服务已断开`:`本地服务连接中…`},badgeText(){return{idle:`待校验`,pending:`校验中…`,ok:`校验通过`,error:`校验未通过`,nopython:`未配置校验`,fail:`校验服务异常`}[this.validateBadge.state]||`待校验`},badgeTitle(){let e=this.validateBadge;if(e.state===`ok`)return`结构合法 + 渲染不抛错(不保证画得对,视觉正确性见截图)`;if(e.state===`error`){let t=[];return e.errors&&t.push(`契约错误 ${e.errors} 个`),e.renderOk===!1&&t.push(`渲染抛出异常`),`校验未通过:`+(t.join(`;`)||`详见 /__validate 与 /__render-status`)}return e.state===`nopython`?`未找到 python3/python,无法跑契约校验(请安装 Python 或设置 DSL_PYTHON)`:e.state===`fail`?`校验服务异常(dev server 未启动或端点不可用)`:``},previewWidth(){if(this.chromeOff)return this.stageWidth;let{min:e,max:t}=this.previewBounds,n=this._previewWidthPx||dG;return Math.max(e,Math.min(t,n))},viewportWidth(){return this.stageWidth,typeof window<`u`?window.innerWidth:1280},debugSoftWidth(){return Math.max(pG,Math.floor(this.viewportWidth/3))},previewBounds(){let e=this.stageWidth||0,t=Math.floor(e/2),n=e-fG-this.debugSoftWidth;return{min:dG,max:Math.max(dG,Math.min(t,n))}},debugMinWidth(){let e=this.colsWidth||Math.max(0,(this.stageWidth||0)-this.previewWidth);return Math.max(pG,Math.min(this.debugSoftWidth,Math.floor(e)-fG))},apiPanelBounds(){let e=this.colsWidth||Math.max(0,(this.stageWidth||0)-this.previewWidth),t=Math.max(mG,Math.floor(e)-this.debugMinWidth);return{min:Math.min(fG,t),max:t}},canvasW(){return Math.round(this.previewWidth||375)},selectedCardName(){let e=this.cardList.find(e=>e.id===this.selectedId);return e&&e.name||this.selectedId||``},cardEmpty(){let e=this.currentSchema;if(!e||!e.view)return!0;let t=e.view.components;return!Array.isArray(t)||t.length===0},apiPanelWidth(){let{min:e,max:t}=this.apiPanelBounds,n=this._apiPanelWidthPx||360;return Math.max(e,Math.min(t,n))},frameStyle(){return{}}},watch:{activeTab(e){e!==`structure`&&(this.selectedNodeId=``,vO())},credentialsReady(e){!e&&this.activeTab===`history`&&(this.activeTab=`vars`)},aiChatOpen(e){try{sessionStorage.setItem(`cardbuddy:ai-chat-open`,e?`1`:`0`)}catch{}},theme(e){document.documentElement.dataset.theme=e;try{localStorage.setItem(`cardbuddy:theme`,e)}catch{}},accent(e){Sk(e),Ck(e)},apiPanelOpen(e){try{localStorage.setItem(`cardbuddy:api-panel-open`,e?`1`:`0`)}catch{}},remoteBusy(e){e&&(this.devServiceOpen=!1)},chatBusy(e,t){if(t&&!e&&this.selectedId){if(this.historyDirty){let e=this.currentSchema&&this.currentSchema.name||this.selectedId;this.showExternalReloadNote(`AI 已更新磁盘上的卡片「${e}」,当前有未保存编辑,未自动重载(点顶栏刷新可载入最新版)`)}else this.loadCard(this.selectedId)}}},beforeUnmount(){this.viewportObserver&&this.viewportObserver.disconnect(),this._stageObserver&&this._stageObserver.disconnect(),this.saveTimer&&clearTimeout(this.saveTimer),this.syncTimer&&clearTimeout(this.syncTimer),this.saveRemoteTimer&&clearTimeout(this.saveRemoteTimer),this.syncPollTimer&&clearTimeout(this.syncPollTimer),this.exportPollTimer&&clearTimeout(this.exportPollTimer),window.removeEventListener(`keydown`,this.onKeydown)},mounted(){this.viewportObserver=new ResizeObserver(e=>{for(let t of e)this.viewportHeight=Math.round(t.contentRect.height)}),this.$refs.phoneViewport&&this.viewportObserver.observe(this.$refs.phoneViewport),this.loadPreviewWidth(),this.loadCanvasBg(),this.loadApiPanelWidth(),this._stageObserver=new ResizeObserver(e=>{for(let t of e)t.target===this.$refs.colsEl?this.colsWidth=Math.round(t.contentRect.width):(this.stageWidth=Math.round(t.contentRect.width),this.stageHeight=Math.round(t.contentRect.height))}),this.$refs.stageEl&&this._stageObserver.observe(this.$refs.stageEl),this.$refs.colsEl&&this._stageObserver.observe(this.$refs.colsEl),window.addEventListener(`keydown`,this.onKeydown),this.fabInitPosition(),window.addEventListener(`resize`,this.onFabResize),this.checkCredentials()},beforeDestroy(){window.removeEventListener(`resize`,this.onFabResize)},async created(){CD(uG);let e=new URLSearchParams(location.search).get(`chrome`);this.chromeOff=e===`off`||e===``;try{let e=localStorage.getItem(`cardbuddy:theme`);(e===`light`||e===`dark`)&&(this.theme=e)}catch{}document.documentElement.dataset.theme=this.theme,this.accent=xk(),Sk(this.accent);try{localStorage.getItem(`cardbuddy:api-panel-open`)===`0`&&(this.apiPanelOpen=!1)}catch{}await this.fetchCardList();let t=new URLSearchParams(location.search).get(`card`),n=null;try{let e=localStorage.getItem(`cardbuddy:selected-card`);e&&this.cardList.some(t=>t.id===e)&&(n=e)}catch{}let r=t&&this.cardList.some(e=>e.id===t)?t:n||this.cardList[0]&&this.cardList[0].id;r&&(this.selectedId=r,await this.loadCard(this.selectedId)),this.$watch(()=>this.rt.rootScope,()=>{this.syncDataToSchema()},{deep:!0}),this.setupCardsChanged()},methods:{fabBounds(){let e=this.$refs.aiFab,t=e?e.offsetWidth:56,n=e?e.offsetHeight:56,r=document.documentElement.clientWidth,i=document.documentElement.clientHeight;return{minX:0,minY:0,maxX:Math.max(0,r-t),maxY:Math.max(0,i-n)}},clampFab(e,t){let n=this.fabBounds();return[Math.min(Math.max(e,n.minX),n.maxX),Math.min(Math.max(t,n.minY),n.maxY)]},fabInitPosition(){let e=this.$refs.aiFab;if(!e)return;let t=this.loadFabPos(),n=document.documentElement.clientWidth,r=document.documentElement.clientHeight,i,a;if(t)[i,a]=this.clampFab(t.x,t.y);else{let t=e.getBoundingClientRect();[i,a]=this.clampFab(n-t.right,r-t.bottom)}this.fab.x=i,this.fab.y=a},loadFabPos(){try{let e=localStorage.getItem(`cardbuddy:ai-fab-pos`);if(!e)return null;let t=JSON.parse(e);if(typeof t.x==`number`&&typeof t.y==`number`&&isFinite(t.x)&&isFinite(t.y))return t}catch{}return null},saveFabPos(){try{localStorage.setItem(`cardbuddy:ai-fab-pos`,JSON.stringify({x:this.fab.x,y:this.fab.y}))}catch{}},onFabPointerDown(e){if(!this.aiChatOpen){this.fabSuppressClick=!1,this.fab.x??this.fabInitPosition(),this.fabDrag={pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,originX:this.fab.x,originY:this.fab.y,moved:!1};try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}}},onFabPointerMove(e){let t=this.fabDrag;if(!t||t.pointerId!==e.pointerId)return;let n=e.clientX-t.startX,r=e.clientY-t.startY;if(!t.moved){if(Math.hypot(n,r)<4)return;t.moved=!0,this.fab.dragging=!0}let[i,a]=this.clampFab(t.originX-n,t.originY-r);this.fab.x=i,this.fab.y=a},onFabPointerUp(e){let t=this.fabDrag;if(!t||t.pointerId!==e.pointerId)this.fab.dragging=!1;else{try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}t.moved&&(this.fabSuppressClick=!0,this.saveFabPos()),this.fab.dragging=!1,this.fabDrag=null}},onFabClick(){this.fabSuppressClick?this.fabSuppressClick=!1:this.aiChatOpen=!this.aiChatOpen},onFabResize(){if(this.fab.x==null)return;let[e,t]=this.clampFab(this.fab.x,this.fab.y);this.fab.x=e,this.fab.y=t},setupCardsChanged(){if(this._unsubCardsChanged){try{this._unsubCardsChanged()}catch{}this._unsubCardsChanged=null}this.devSvcLive=`connecting`,this._unsubCardsChanged=eu(e=>this.onCardsChanged(e),e=>this.onDevServiceState(e))},onDevServiceState(e){let t=this.devSvcLive===`connecting`;this.devSvcLive=e,e===`open`?this.devSvcDown=!1:e===`closed`&&(this.devSvcDown=!0),e===`connecting`?!t&&!this._svcWatchdog&&(this._svcWatchdog=setTimeout(()=>{this.devSvcLive===`connecting`&&(this.devSvcLive=`closed`,this.devSvcDown=!0),this._svcWatchdog=null},8e3)):this._svcWatchdog&&=(clearTimeout(this._svcWatchdog),null)},saveDevService(){ql(this.devServiceForm),this.apiBaseResolved=Jl(),this.setupCardsChanged(),this.devServiceOpen=!1,Q(`本地开发服务配置已保存`,`ok`),this.fetchCardList()},beginColumnDrag(e,t,n){let r=e&&e.currentTarget;if(!r)return;let i=e.pointerId;try{r.setPointerCapture(i)}catch{}let a=()=>{r.removeEventListener(`pointermove`,t),r.removeEventListener(`pointerup`,a),r.removeEventListener(`pointercancel`,a),window.removeEventListener(`blur`,a);try{r.hasPointerCapture?.(i)&&r.releasePointerCapture(i)}catch{}document.body.style.cursor=``,document.body.style.userSelect=``,n()};document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,r.addEventListener(`pointermove`,t),r.addEventListener(`pointerup`,a),r.addEventListener(`pointercancel`,a),window.addEventListener(`blur`,a)},startDrag(e){if(this.chromeOff)return;let t=this.$refs.stageEl;if(!t)return;let n=t.getBoundingClientRect().left;this.dragging=!0,this.beginColumnDrag(e,e=>{let{min:t,max:r}=this.previewBounds;this._previewWidthPx=Math.max(t,Math.min(r,Math.round(e.clientX-n)))},()=>{this.dragging=!1,this.savePreviewWidth()})},startApiDrag(e){if(this.chromeOff||!this.apiPanelOpen)return;let t=this.$refs.colsEl;if(!t)return;let n=t.getBoundingClientRect().right;this.apiDragging=!0,this.beginColumnDrag(e,e=>{let{min:t,max:r}=this.apiPanelBounds;this._apiPanelWidthPx=Math.max(t,Math.min(r,Math.round(n-e.clientX)))},()=>{this.apiDragging=!1,this.saveApiPanelWidth()})},loadCanvasBg(){try{let e=localStorage.getItem(`cardbuddy:canvas-bg`);e!=null&&this.bgOptions.some(t=>t.key===e)&&(this.canvasBg=e)}catch{}},saveCanvasBg(){try{localStorage.setItem(`cardbuddy:canvas-bg`,this.canvasBg)}catch{}},loadPreviewWidth(){try{let e=localStorage.getItem(`cardbuddy:preview-width`);if(e!=null){let t=parseInt(e,10);!Number.isNaN(t)&&t>=188&&(this._previewWidthPx=t)}}catch{}},savePreviewWidth(){try{localStorage.setItem(`cardbuddy:preview-width`,String(Math.round(this._previewWidthPx)))}catch{}},setPresetWidth(e){if(this.chromeOff)return;let{min:t,max:n}=this.previewBounds;this._previewWidthPx=Math.max(t,Math.min(n,e)),this.savePreviewWidth()},loadApiPanelWidth(){try{let e=localStorage.getItem(`cardbuddy:api-panel-width`);if(e!=null){let t=parseInt(e,10);!Number.isNaN(t)&&t>=320&&(this._apiPanelWidthPx=t)}}catch{}},saveApiPanelWidth(){try{localStorage.setItem(`cardbuddy:api-panel-width`,String(Math.round(this.apiPanelWidth)))}catch{}},chooseBg(e){this.canvasBg=e,this.saveCanvasBg()},onSelect(e){e!==this.selectedId&&(this.remoteBusy?Q(`远端操作进行中(${this.remoteBusyReason}),完成前不能切换卡片`,`err`,3200):this.chatBusy?Q(`AI 正在生成「${this.selectedId}」:先点 ■ 停止,或等本轮结束后再切卡`,`err`,3600):(this.loadingCard=!0,this.selectedId=e,this.loadCard(e,{clearAll:!0})))},selectCard(e){this.selectedId=e;try{localStorage.setItem(`cardbuddy:selected-card`,e)}catch{}},openGallery(){this.cardList.length&&(this.galleryOpen=!0)},openNewCard(){this.cardDialog.mode=`create`,this.cardDialog.cardId=``,this.cardDialog.cardDesc=``,this.cardDialog.visible=!0,this.fetchCardList()},openRenameCard(){this.selectedId&&(this.cardDialog.mode=`rename`,this.cardDialog.cardId=this.selectedId,this.cardDialog.cardDesc=this.currentSchema&&this.currentSchema.desc||``,this.cardDialog.visible=!0,this.fetchCardList())},async onCardRenamed({oldId:e,id:t}){if(this.cardDialog.visible=!1,Q(t===e?`已更新卡片描述`:`已重命名卡片 ${e} → ${t}`,`ok`),t!==e)return this.applyCardRename(e,t);await this.fetchCardList(),await this.loadCard(t)},async applyCardRename(e,t){if(!e||!t||e===t)return;let n=`${e}->${t}`;if(this._renameAppliedKey===n)return;this._renameAppliedKey=n,setTimeout(()=>{this._renameAppliedKey===n&&(this._renameAppliedKey=``)},1e3);let r=this.selectedId===e;this.$refs.chatPanel?.migrateCard(e,t),r&&this.selectCard(t),this.selfSaveId=t,this.selfSaveAt=Date.now(),await this.fetchCardList(),r&&(this.historyDirty&&!this.confirm.show?this.requestConfirm({title:`卡片已重命名`,message:`卡片「${e}」已重命名为「${t}」,而编辑器内还有未保存的改动。\n重新载入会放弃这些未保存改动并显示磁盘版本;保留改动则继续用当前编辑器内容(后续保存会写到新目录 ${t})。`,confirmText:`重新载入`,cancelText:`保留我的改动`,onConfirm:()=>this.loadCard(t)}):await this.loadCard(t))},closeGallery(){this.galleryOpen=!1},onGalleryExport(e){!this.exportProgressOpen&&e&&e.length&&(this.exportDirDialog={visible:!0,ids:e})},async onExportDirConfirm(e){this.exportDirDialog.visible=!1;let t=this.exportDirDialog.ids;try{let n=await Y(`/__export-cards`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cardIds:t,targetDir:e})}),r=await n.json().catch(()=>({}));if(!n.ok||!r.ok)throw Error(r.message||r.error||`HTTP `+n.status);this.exportJobId=r.jobId,this.exportProgress={done:0,total:Number(r.total)||0,current:``},this.exportProgressOpen=!0,this.pollExportProgress()}catch(e){this.exportDirDialog.ids=[],Q(`启动导出失败:`+(e&&e.message),`err`)}},pollExportProgress(){this.exportPollTimer&&clearTimeout(this.exportPollTimer);let e=async()=>{if(this.exportJobId&&this.exportProgressOpen){try{let e=await Y(`/__export/progress?jobId=`+encodeURIComponent(this.exportJobId)),t=await e.json().catch(()=>({}));if(!e.ok||!t.ok)throw Error(t.message||`进度查询失败`);if(this.exportProgress={done:Number(t.done)||0,total:Number(t.total)||0,current:t.currentTitle||t.currentId||``},t.finished){this.onExportJobFinished(t.result||{});return}}catch(e){console.error(`[导出进度查询失败]`,e)}this.exportPollTimer=setTimeout(e,600)}};e()},stopExportPolling(){this.exportPollTimer&&=(clearTimeout(this.exportPollTimer),null)},onExportJobFinished(e){this.stopExportPolling(),this.exportProgressOpen=!1,this.exportJobId=``,this.exportDirDialog.ids=[];let t=e.failed||[],n=e.warnings||[];if(t.length&&console.warn(`[导出失败明细]`,t),n.length&&console.warn(`[导出告警明细]`,n),e.cancelled){let t=e.exported||0;Q(t?`导出已取消(已完成 ${t} 张,未生成 zip)`:`导出已取消`,`ok`)}else if(e.success){let r=e.exported||0,i=t.length,a=e.folderName?`${e.folderName}.zip`:`zip`,o=e.revealed?`,已打开所在目录`:``,s=i?`(${t[0].id||`?`}:${String(t[0].error||``).slice(0,60)})`:``,c=n.length?`,${n.length} 条告警见控制台`:``;Q(i?`导出完成:成功 ${r} 张,失败 ${i} 张${s} → ${a}${o}${c}`:`导出成功:${a}(${r} 张卡片)${o}${c}`,i?`warn`:`ok`)}else Q(`导出失败:`+(e.error||`未知错误`),`err`)},cancelExportJob(){this.exportJobId&&Y(`/__export/cancel`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({jobId:this.exportJobId})}).catch(()=>{})},async openCardFolder(){if(this.selectedId)try{let e=await Y(`/__open-folder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({id:this.selectedId})}),t=(e.headers.get(`content-type`)||``).includes(`application/json`)?await e.json().catch(()=>({})):{};!e.ok||!t.ok?Q(t.error||`打开文件夹失败`,`err`):Q(`已打开卡片文件夹`,`ok`)}catch{Q(`无法连接本地开发服务,请确认已启动`,`err`)}},async refreshCard(){if(this.selectedId&&!this.refreshing){this.refreshing=!0;try{await this.loadCard(this.selectedId)}finally{this.refreshing=!1}}},toggleApiPanel(){this.apiPanelOpen=!this.apiPanelOpen},async refreshValidateBadge(){let e=this.selectedId;if(e&&this.preview&&(this.validateTimer&&clearTimeout(this.validateTimer),this.validateBadge={...this.validateBadge,state:`pending`},await new Promise(e=>{this.validateTimer=setTimeout(e,120)}),this.selectedId===e))try{let[t,n]=await Promise.all([Y(`/__validate/${encodeURIComponent(e)}`),Y(`/__render-status/${encodeURIComponent(e)}`)]);if(!t.ok){this.validateBadge={...this.validateBadge,state:t.status===503?`nopython`:`fail`};return}let r=await t.json().catch(()=>null),i=n.ok?await n.json().catch(()=>null):null;if(!r){this.validateBadge={...this.validateBadge,state:`fail`};return}let a=!!r.ok,o=!i||!!i.renderOk,s=a&&o?`ok`:`error`,c=this.validateBadge.state!==s;this.validateBadge={state:s,errors:(r.errors||[]).length,warnings:(r.warnings||[]).length,renderOk:o,ts:Date.now()},c&&(s===`ok`||s===`error`)&&this.celebrateValidate(s)}catch{this.validateBadge={...this.validateBadge,state:`fail`}}},celebrateValidate(e=`ok`){let t=this.$refs.validateBadgeEl;if(!t||window.matchMedia&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;t.classList.remove(`is-celebrating`),t.offsetWidth,t.classList.add(`is-celebrating`),setTimeout(()=>t.classList.remove(`is-celebrating`),600);let n=t.getBoundingClientRect(),r={ok:`--ok`,error:`--danger`,pending:`--warn`,fail:`--text-faint`,nopython:`--text-faint`}[e]||`--ok`,i={ok:`#52c41a`,error:`#F5222D`,pending:`#FAAD14`,fail:`#8c8c8c`,nopython:`#8c8c8c`}[e]||`#52c41a`,a=getComputedStyle(t).getPropertyValue(r).trim()||i,o=document.createElement(`div`);o.className=`app__confetti`,o.style.left=n.left+n.width/2+`px`,o.style.top=n.top+n.height/2+`px`;let s=[`polygon(50% 0%, 0% 100%, 100% 100%)`,`polygon(62% 0%, 100% 40%, 45% 100%, 0% 52%)`,`polygon(0% 0%, 100% 18%, 82% 100%, 12% 70%)`,`polygon(22% 0%, 100% 8%, 88% 100%, 0% 76%)`,`polygon(0% 32%, 100% 0%, 76% 100%, 18% 86%)`,`polygon(8% 0%, 100% 22%, 70% 100%, 0% 64%)`,`polygon(0% 12%, 100% 0%, 100% 78%, 30% 100%, 12% 55%)`],c=n.width/2,l=n.height/2;for(let e=0;e<22;e++){let e=document.createElement(`span`);e.className=`app__confetti-bit`;let t=Math.random()*4|0,n,r;t===0?(n=(Math.random()*2-1)*c,r=-l):t===1?(n=c,r=(Math.random()*2-1)*l):t===2?(n=(Math.random()*2-1)*c,r=l):(n=-c,r=(Math.random()*2-1)*l);let i=Math.hypot(n,r)||1,u=Math.atan2(r/i,n/i)+(Math.random()-.5)*.5,d=16+Math.random()*26;e.style.setProperty(`--sx`,n.toFixed(1)+`px`),e.style.setProperty(`--sy`,r.toFixed(1)+`px`),e.style.setProperty(`--tx`,(Math.cos(u)*d).toFixed(1)+`px`),e.style.setProperty(`--ty`,(Math.sin(u)*d).toFixed(1)+`px`),e.style.setProperty(`--rot`,(Math.random()*720-360).toFixed(0)+`deg`),e.style.setProperty(`--clip`,s[Math.random()*s.length|0]),e.style.setProperty(`--c`,a),e.style.setProperty(`--o`,(.68+Math.random()*.27).toFixed(2));let f=Math.random(),p,m;f<.35?(p=1.5+Math.random()*2,m=10+Math.random()*10):f<.75?(p=4+Math.random()*5,m=p*(.6+Math.random()*.8)):(p=2+Math.random()*2.5,m=p),e.style.width=p.toFixed(0)+`px`,e.style.height=m.toFixed(0)+`px`,o.appendChild(e)}document.body.appendChild(o),setTimeout(()=>o.remove(),800)},async loadCard(e,t={}){if(e){this.loadingCard=!0;try{let n=await Y(`/__card/${encodeURIComponent(e)}`);if(!n.ok){this.rt.pushError(`loadCard`,`HTTP `+n.status);return}let r=await n.json();if(!r.schema){this.rt.pushError(`loadCard`,`schema 读取失败`);return}this.selectCard(e),e!==this.loadedCardId&&(this.activeTab=`vars`),this.loadedCardId=e,t.clearAll?this.rt.clearErrors():this.rt.clearBindingErrors(),this.rt.clearApiCalls(),t.keepScope||this.rt.setRootScope(mv(r.schema,nG)),this.currentCard={schema:r.schema},this.currentSchema=r.schema,this.cardImportMeta=null,this.fetchImportMeta(e),this.localSchema=this.cloneSchema(r.schema),this.localData=this.cloneData(mv(r.schema,nG)),this.preview=qu(r.schema),typeof window<`u`&&(window.__cardModel=$u(r.schema)),this.cardReady=!1,this.$nextTick(()=>{this.cardReady=!0}),this.syncDataToSchema(),this.selectedNodeId=``,this.baseline={schema:this.cloneSchema(this.currentSchema)},this.reloadToken+=1,RS(),wD(),this.refreshValidateBadge(),await this.loadHistory(e)}finally{this.loadingCard=!1}}},cloneSchema(e){return e?JSON.parse(JSON.stringify(e,(e,t)=>e===`_schemaNode`?void 0:t)):null},cloneData(e){return e==null?e:JSON.parse(JSON.stringify(e,(e,t)=>e===`_schemaNode`?void 0:t))},applySchemaSnapshot(e){if(!this.selectedId||!e)return;let t=e.schema||e,n=e.data==null?mv(t,nG):e.data;this.currentSchema=this.cloneSchema(t),this.rt.setRootScope(this.cloneData(n)),this.preview=qu(this.currentSchema),typeof window<`u`&&(window.__cardModel=$u(this.currentSchema)),this.syncDataToSchema(),this.selectedNodeId=``,this.reloadToken+=1,this.refreshValidateBadge()},commitHistory(){if(!this.currentSchema||!this.baseline||!tG(this.currentSchema,this.baseline.schema,this.rt.rootScope))return;let e={schema:this.baseline.schema};this.past.push(e),this.past.length>30&&this.past.shift(),this.future=[],this.baseline={schema:this.cloneSchema(this.currentSchema)},this.persistSnapshot(e)},scheduleCommit(){this._commitTimer&&clearTimeout(this._commitTimer),this._commitTimer=setTimeout(()=>{this._commitTimer=null,this.commitHistory()},500)},persistSnapshot(e){let t=this.selectedId;if(!t)return;let n=e.schema||e;Y(`/__history/${encodeURIComponent(t)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({schema:n},(e,t)=>e===`_schemaNode`?void 0:t,2)}).catch(e=>console.warn(`[历史快照落盘失败]`,e))},async loadHistory(e){this.past=[],this.future=[];try{let t=await Y(`/__history/${encodeURIComponent(e)}`);if(!t.ok)return;let n=await t.json().catch(()=>null),r=n&&n.snapshots||[];this.past=r.slice(-30).map(e=>({schema:e.schema,data:e.data==null?mv(e.schema,nG):e.data}))}catch(e){console.warn(`[加载编辑历史失败]`,e)}},undo(){if(!this.canUndo||this.remoteBusy)return;let e=this.past.pop();this.future.push(this.baseline),this.future.length>30&&this.future.shift(),this.baseline=e,this.applySchemaSnapshot(e)},redo(){if(!this.canRedo||this.remoteBusy)return;let e=this.future.pop();this.past.push(this.baseline),this.past.length>30&&this.past.shift(),this.baseline=e,this.applySchemaSnapshot(e)},async applyHistoryToLocal(){this.loadingCard||this.remoteBusy||this.historyDirty&&this.preview&&this.selectedId&&await this.saveCard()&&(this.credentialsReady&&this.hasCardSource?(Q(`已保存到本地,正在同步至远端…`,`ok`),Promise.resolve(this.saveToRemote({fromAutoSave:!0})).then(e=>{e&&(e.ok?e.verified===!1?Q(`已保存到本地,远端已提交但读回校验未通过`,`warn`,4200):Q(`已保存到本地并同步至远端`,`ok`):Q(`已保存到本地,但同步至远端失败`+(e.message?`:`+e.message:``),`warn`,4200))}).catch(()=>{})):Q(`已将该版本保存到本地`,`ok`))},async generateCardCover(){if(!this.preview||!this.selectedId||this.coverBusy||this.remoteBusy)return;if(this.historyDirty&&!await this.saveCard()){Q(`本地保存失败,已取消生成预览图`,`err`);return}let e=null;try{let t=await Y(`/__card-image/`+encodeURIComponent(this.selectedId)+`?probe=1`),n=await t.json().catch(()=>({}));t.ok&&n.exists&&(e=n.file)}catch{}e?this.requestConfirm({title:`重新生成截图`,message:`该卡片已有截图(${e}),继续将覆盖它。确定重新生成吗?`,confirmText:`重新生成`,severity:`warn`,onConfirm:()=>this.doGenerateCover()}):this.doGenerateCover()},async doGenerateCover(){this.coverBusy=!0;try{let e=await Y(`/__card-image/`+encodeURIComponent(this.selectedId),{method:`POST`}),t=await e.json().catch(()=>({}));if(!e.ok)throw Error(t.message||`HTTP `+e.status);Q(`截图已生成(${t.width}×${t.height})→ ${t.file}`,`ok`,3e3)}catch(e){Q(`生成截图失败:`+String(e&&e.message||e),`err`,3600)}finally{this.coverBusy=!1}},onSchemaChanged(){this.selectedId&&this.currentSchema&&(this.reloadToken+=1,this.preview=qu(this.currentSchema),typeof window<`u`&&(window.__cardModel=$u(this.currentSchema)),this.syncDataToSchema(),this.selectedNodeId=``)},onSchemaCommit(){this.selectedId&&this.currentSchema&&(this.reloadToken+=1,this.preview=qu(this.currentSchema),typeof window<`u`&&(window.__cardModel=$u(this.currentSchema)),this.syncDataToSchema(),this.selectedNodeId=``,this.commitHistory())},syncDataToSchema(){let e=this.currentSchema;if(!e||!e.dictionary||!Array.isArray(e.dictionary.inputParams))return;let t=this.rt&&this.rt.rootScope;if(!t||typeof t!=`object`)return;let n=e.dictionary.inputParams,r=hv(e);for(let e of Object.keys(t)){let i=n.find(t=>t&&(t.key===e||t.name===e));if(!i)continue;let a=JSON.parse(JSON.stringify(t[e],(e,t)=>e===`_schemaNode`?void 0:t));r&&Object.prototype.hasOwnProperty.call(r,e)?r[e]=a:i.defaultValue=a}},onSelectNode(e){this.selectedNodeId=e||``},findPreviewNodeById(e,t){if(!e||t==null)return null;let n=String(t),r=e=>{if(!e)return null;if(String(e.id)===n)return e;let t=[];if(e.components&&t.push(...e.components),e.slots)for(let n of e.slots)n.components&&t.push(...n.components);for(let e of t){let t=r(e);if(t)return t}return null};return r(e)},copySelectedNode(){let e=this.selectedNodeId;if(!e||e===`_root`||!this.currentSchema||!this.preview)return;let t=this.findPreviewNodeById(this.preview.view,e);if(!t)return;let n=this.findSchemaNodeByComponentId(this.currentSchema.view,t.componentId);n&&(rd(n.node,this.selectedId),Q(`已复制节点(含子节点)`,`ok`))},pasteNode(){let e=td();if(!e||!this.currentSchema)return;let t=id(e),n=[...new Set(t.filter(e=>!ju[e]))];if(n.length){Q(`粘贴失败:含未知组件类型 `+n.join(`、`),`err`);return}let r=JSON.parse(JSON.stringify(e,(e,t)=>e===`_schemaNode`?void 0:t));ad(r);let i=this.selectedNodeId&&this.selectedNodeId!==`_root`?this.findPreviewNodeById(this.preview.view,this.selectedNodeId):null,a=`root`;i&&(a=Wu(i.className)?`into`:`after`),this.insertClone(r,i,a);let o=nd();o&&o!==this.selectedId?Q(`已从卡片「${o}」跨卡片粘贴到「${this.selectedId}」`,`ok`):Q(`已粘贴节点(含子节点)`,`ok`)},duplicateNode(){let e=this.selectedNodeId;if(!e||e===`_root`||!this.currentSchema||!this.preview)return;let t=this.findPreviewNodeById(this.preview.view,e);if(!t)return;let n=this.findSchemaNodeByComponentId(this.currentSchema.view,t.componentId);if(!n)return;let r=JSON.parse(JSON.stringify(n.node,(e,t)=>e===`_schemaNode`?void 0:t));ad(r),n.parentArr.splice(n.index+1,0,r),this.afterStructuralEdit(r.componentId)},insertClone(e,t,n){let r=this.currentSchema;if(n===`root`)r.view.components||(r.view.components=[]),r.view.components.push(e);else if(n===`into`){let n=t&&t._schemaNode;if(!n){r.view.components||(r.view.components=[]),r.view.components.push(e),this.afterStructuralEdit(e.componentId);return}let i=Gu(t.className),a=(n.slots||[]).find(e=>e.slotKey===i);a||(n.slots||=[],a={slotKey:i,slotScope:!1,slotSwitch:`1`,components:[]},n.slots.push(a)),a.components||(a.components=[]),a.components.push(e)}else{let n=this.findSchemaNodeByComponentId(r.view,t.componentId);n?n.parentArr.splice(n.index+1,0,e):(r.view.components||(r.view.components=[]),r.view.components.push(e))}this.afterStructuralEdit(e.componentId)},afterStructuralEdit(e){let t=this.currentSchema;this.reloadToken+=1,this.preview=qu(t),typeof window<`u`&&(window.__cardModel=$u(t)),this.syncDataToSchema(),this.selectedNodeId=e&&this.findViewIdByComponentId(this.preview.view,e)||``,this.scheduleCommit()},deleteSelectedNode(){let e=this.selectedNodeId;if(!e||e===`_root`||!this.currentSchema||!this.preview)return;let t=this.findPreviewNodeById(this.preview.view,e);if(!t)return;let n=this.findSchemaNodeByComponentId(this.currentSchema.view,t.componentId);n&&(n.parentArr.splice(n.index,1),this.reloadToken+=1,this.preview=qu(this.currentSchema),typeof window<`u`&&(window.__cardModel=$u(this.currentSchema)),this.syncDataToSchema(),this.selectedNodeId=``,vO(),this.scheduleCommit())},hasTextSelection(){if(typeof window>`u`||!window.getSelection)return!1;let e=window.getSelection();return!!e&&!e.isCollapsed&&e.toString().trim()!==``},hasNodeSelection(){return!!this.selectedNodeId&&this.selectedNodeId!==`_root`},isEditableTarget(e){let t=e.target;if(!t)return!1;let n=t.tagName;return!!(n===`INPUT`||n===`TEXTAREA`||n===`SELECT`||t.isContentEditable)},onKeydown(e){if(this.chromeOff||!this.preview)return;let t=this.isEditableTarget(e),n=e.ctrlKey||e.metaKey,r=e.key;if(n&&(r===`c`||r===`C`)){if(t||this.hasTextSelection()||!this.hasNodeSelection())return;this.copySelectedNode(),e.preventDefault()}else if(n&&(r===`v`||r===`V`)){if(t||this.hasTextSelection()||!this.hasNodeSelection()||!td())return;this.pasteNode(),e.preventDefault()}else if(n&&(r===`d`||r===`D`)){if(t||this.hasTextSelection()||!this.hasNodeSelection())return;this.duplicateNode(),e.preventDefault()}else if(n&&(r===`z`||r===`Z`)){if(t)return;e.preventDefault(),e.shiftKey?this.redo():this.undo()}else if(n&&(r===`y`||r===`Y`)){if(t)return;e.preventDefault(),this.redo()}else if(r===`Delete`||r===`Backspace`){if(t||!this.selectedNodeId||this.selectedNodeId===`_root`)return;e.preventDefault(),this.deleteSelectedNode()}else r===`Escape`&&this.selectedNodeId&&(this.selectedNodeId=``,e.preventDefault())},onHoverNode(e){if(!e){vO();return}if(e.leave){vO(e.id);return}let t=typeof document<`u`?document.querySelector(`.phone__screen`):null;if(!t){vO(e.id);return}let n=e=>window.CSS&&CSS.escape?CSS.escape(String(e)):String(e).replace(/["\\\]]/g,`\\$&`),r=null;e.componentId!=null&&(r=t.querySelector(`[data-cid="`+n(e.componentId)+`"]`)),!r&&e.id!=null&&(r=t.querySelector(`[data-cid="`+n(e.id)+`"]`)),r?_O(r,e.id):vO(e.id)},onCanvasClick(e){if(!e.ctrlKey&&!e.metaKey||this.chromeOff)return;let t=e.target&&e.target.closest?e.target.closest(`[data-cid]`):null;if(!t)return;let n=t.getAttribute(`data-cid`);if(!n)return;let r=this.findPreviewNodeByCid(n);r&&(this.activeTab=`structure`,this.selectedNodeId=r.id)},onAiLocateNode(e){let t=e?this.findPreviewNodeByCid(e):null;t?(this.activeTab=`structure`,this.selectedNodeId=t.id):Q(`没找到组件 ${e||``}:卡片可能已被改动,重新校验一次即可`,`err`)},findPreviewNodeByCid(e){let t=this.preview&&this.preview.view;if(!t)return null;let n=String(e),r=e=>{if(!e)return null;if(String(e.componentId==null?e.id:e.componentId)===n)return e;let t=[];if(e.components&&t.push(...e.components),e.slots)for(let n of e.slots)n.components&&t.push(...n.components);for(let e of t){let t=r(e);if(t)return t}return null};return r(t)},onAddNode(e){this.currentSchema&&(this.addNodeTarget=e||null,this.addNodePanelOpen=!0)},cancelAddNode(){this.addNodePanelOpen=!1,this.addNodeTarget=null},findSchemaLocation(e,t){let n=e=>{for(let r=0;r<e.length;r++){let i=e[r];if(i===t)return{containerArr:e,index:r};let a=i.slots||[];for(let e of a){let t=n(e.components||[]);if(t)return t}}return null};return n(e&&e.components||[])},findViewIdByComponentId(e,t){if(!e)return null;if(e.componentId===t)return e.id;let n=[];if(e.components&&n.push(...e.components),e.slots)for(let t of e.slots)t.components&&n.push(...t.components);for(let e of n){let n=this.findViewIdByComponentId(e,t);if(n)return n}return null},findSchemaNodeByComponentId(e,t){let n=(e,r)=>{for(let i=0;i<e.length;i++){let a=e[i];if(a.componentId===t)return{node:a,parentArr:e,index:i,owner:r};let o=a.slots||[];for(let e of o){let t=n(e.components||[],a);if(t)return t}}return null};return n(e&&e.components||[],`root`)},isDescendantCompId(e,t){if(!t||!t.componentId)return!1;if(t.componentId===e)return!0;let n=[];if(t.components&&n.push(...t.components),t.slots)for(let e of t.slots)e.components&&n.push(...e.components);for(let t of n)if(this.isDescendantCompId(e,t))return!0;return!1},moveNode(e,t,n){let r=this.currentSchema;if(!r||!r.view||e===t)return!1;let i=this.findSchemaNodeByComponentId(r.view,e);if(!i)return!1;let a=i.node;if(this.isDescendantCompId(t,a))return!1;let o,s;if(t===`__root__`)r.view.components||(r.view.components=[]),o=r.view.components,s=o.length;else{let e=this.findSchemaNodeByComponentId(r.view,t);if(!e)return!1;let i=e.node;if(n===`inside`){if(!Wu(i.className))return!1;let e=Gu(i.className),t=(i.slots||[]).find(t=>t.slotKey===e);t||(i.slots||=[],t={slotKey:e,slotScope:!1,slotSwitch:`1`,components:[]},i.slots.push(t)),t.components||(t.components=[]),o=t.components,s=o.length}else o=e.parentArr,s=n===`before`?e.index:e.index+1}let c=o===i.parentArr&&i.index<s;return i.parentArr.splice(i.index,1),c&&--s,o.splice(s,0,a),a},onMoveNode({sourceCompId:e,targetCompId:t,position:n}){if(!this.currentSchema||!this.moveNode(e,t,n))return;this.reloadToken+=1,this.preview=qu(this.currentSchema),typeof window<`u`&&(window.__cardModel=$u(this.currentSchema)),this.syncDataToSchema();let r=this.findViewIdByComponentId(this.preview.view,e);this.selectedNodeId=r||``,r&&(this.moveCollapseToken+=1)},onPickComponent(e){let t=this.addNodeTarget||{},n=t.node||null,r=t.mode||`auto`,i=this.currentSchema;if(!i){this.cancelAddNode();return}let a;try{a=Ku(e)}catch(e){console.error(`[创建组件节点失败]`,e),this.rt.pushError(`addNode`,String(e&&e.message)),this.cancelAddNode();return}let o=!n||n.className===`Root`;if((r===`before`||r===`after`)&&!o){let e=n._schemaNode,t=e?this.findSchemaLocation(i.view,e):null;if(!t)i.view.components||(i.view.components=[]),i.view.components.push(a);else{let e=r===`before`?t.index:t.index+1;t.containerArr.splice(e,0,a)}}else if(o)i.view.components||(i.view.components=[]),i.view.components.push(a);else{let e=n._schemaNode;if(!e){this.cancelAddNode();return}if(Wu(n.className)){let t=Gu(n.className),r=(e.slots||[]).find(e=>e.slotKey===t);r||(e.slots||=[],r={slotKey:t,slotScope:!1,slotSwitch:`1`,components:[]},e.slots.push(r)),r.components||(r.components=[]),r.components.push(a)}else{let t=this.findSchemaLocation(i.view,e);t?t.containerArr.splice(t.index+1,0,a):(i.view.components||(i.view.components=[]),i.view.components.push(a))}}this.cancelAddNode(),this.reloadToken+=1,this.preview=qu(i),typeof window<`u`&&(window.__cardModel=$u(i)),this.syncDataToSchema();let s=this.findViewIdByComponentId(this.preview.view,a.componentId);this.selectedNodeId=s||``,this.scheduleCommit()},async runSync(e){if(this.syncingRemote||e&&!this.selectedId)return;this.syncingRemote=!0,this.syncedRemote=!1,this.syncTarget=e?`selected`:`full`;let t=null,n=()=>{t&&=(clearTimeout(t),null)};try{let n=await Y(`/__sync`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e?{cardCode:e}:{})});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.message||e.error||`HTTP `+n.status)}let r=await n.json().catch(()=>({}));if(!r.ok||!r.jobId)throw Error(r.message||r.error||`同步任务启动失败`);let i=await new Promise((e,n)=>{let i=0,a=async()=>{try{let t=await Y(`/__sync/progress?jobId=`+encodeURIComponent(r.jobId)),n=await t.json().catch(()=>({}));if(!t.ok||!n.ok)throw Error(n.message||`进度查询失败`);if(n.finished){e(n.result||{});return}}catch(e){console.error(`[同步进度查询失败]`,e)}++i>=200?n(Error(`同步超时(进度查询无响应)`)):t=setTimeout(a,600)};a()});if(i.needCredentials){this.openLoginModal(`sync`);return}if(i.cancelled){Q(`同步已取消`,`ok`);return}if(!i.success){let e=(i.failed||[]).map(e=>`${e.id}: ${e.error}`).join(`; `);throw Error(e||i.error||`同步失败`)}this.syncedRemote=!0,this.credentialsReady=!0,this.syncTimer&&clearTimeout(this.syncTimer),this.syncTimer=setTimeout(()=>{this.syncedRemote=!1,this.syncTarget=null},1800),await this.onRefresh(),Q(this.syncTarget===`selected`?`已拉取最新卡到本地`:`拉取全部卡完成`,`ok`),this.persistRemoteVersion(this.selectedId,null)}catch(e){console.error(`[同步远程数据失败]`,e),Q(`同步失败:`+(e&&e.message),`err`)}finally{n(),this.syncingRemote=!1}},syncSelected(){return this.runSync(this.selectedId)},async openRemoteAllCards(){if(this.syncProgressOpen||this.syncingRemote)return;this.remoteAllOpen=!0;let e=this.readRemoteCardsCache();if(e){if(this.remoteCards=e.cards,this.remoteCardsError=``,this.remoteCardsLoading=!1,Date.now()-e.at<oG)return;this.revalidateRemoteCards()}else await this.fetchRemoteCards()},async fetchRemoteCards(){this.remoteCardsLoading=!0,this.remoteCardsError=``;try{let e=await Y(`/__remote-cards`),t=await e.json().catch(()=>({}));if(t.needCredentials){this.remoteAllOpen=!1,this.openLoginModal(`remote-all`);return}if(!e.ok||!t.ok)throw Error(t.message||t.error||`HTTP `+e.status);let n=Array.isArray(t.cards)?t.cards:[];this.remoteCards=n,this.writeRemoteCardsCache(n)}catch(e){this.remoteCardsError=e&&e.message||`远端卡片列表加载失败`}finally{this.remoteCardsLoading=!1}},async revalidateRemoteCards(){if(!this.remoteCardsRefreshing){this.remoteCardsRefreshing=!0;try{let e=await Y(`/__remote-cards`),t=await e.json().catch(()=>({}));if(!e.ok||!t.ok||t.needCredentials)return;let n=Array.isArray(t.cards)?t.cards:[];this.remoteCards=n,this.remoteCardsError=``,this.writeRemoteCardsCache(n)}catch{}finally{this.remoteCardsRefreshing=!1}}},readRemoteCardsCache(){if(this._remoteCardsMem)return this._remoteCardsMem;let e=sG();return e&&(this._remoteCardsMem=e),e},writeRemoteCardsCache(e){let t={v:1,at:Date.now(),cards:e};this._remoteCardsMem=t,cG(e)},closeRemoteAllCards(){this.remoteAllOpen=!1,this.remoteCardFormOpen=!1},openRemoteCardCreate(){this.remoteCardFormMode=`create`,this.remoteCardFormCard=null,this.remoteCardFormOpen=!0},openRemoteCardEdit(e){e&&(this.remoteCardFormMode=`edit`,this.remoteCardFormCard=e,this.remoteCardFormOpen=!0)},requestDeleteRemoteCard(e){if(!e||this.remoteCardDeletingId)return;let t=e.title||e.id;this.requestConfirm({title:`删除远端卡片`,message:`即将从 FinMall 远端删除卡片「${t}」(${e.id})。删除后该卡片及其发布记录将从远端移除,且无法恢复——此操作不可撤销。本地 src/cards 下的同名目录不受影响。`,confirmText:`删除`,severity:`danger`,onConfirm:()=>this.deleteRemoteCardItem(e)})},async deleteRemoteCardItem(e){if(!e||!e.cardId)Q(`删除失败:该卡片缺少远端主键 cardId,请刷新列表后重试`,`err`,3600);else{this.remoteCardDeletingId=e.id;try{let t=await Y(`/__remote-card/delete`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cardId:e.cardId})}),n=await t.json().catch(()=>({}));if(n.needCredentials){this.openLoginModal(`remote-all`);return}if(!t.ok||!n.ok)throw Error(n.message||n.error||`HTTP `+t.status);Q(`已删除远端卡片 ${e.id}`,`ok`),this.revalidateRemoteCards()}catch(e){Q(`删除失败:`+(e&&e.message||e),`err`,3600)}finally{this.remoteCardDeletingId=``}}},onRemoteCardSubmitted({mode:e,code:t}){this.remoteCardFormOpen=!1,Q(e===`edit`?`已更新远端卡片 ${t} 的基本信息`:`已在远端新建卡片 ${t}`,`ok`),this.revalidateRemoteCards()},requestDownloadSelected(e){!this.syncProgressOpen&&e&&e.length&&this.requestConfirm({title:`下载选中卡片`,message:`即将从远端拉取 ${e.length} 张卡片并覆盖本地同名卡(已有内容将被替换,不可撤销)。是否继续?`,confirmText:`开始下载`,severity:`warn`,onConfirm:()=>this.startSyncJob(e)})},requestDownloadAll(){this.syncProgressOpen||this.requestConfirm({title:`下载全部卡片`,message:`即将从远端 FinMall 拉取完整卡片列表,并逐张覆盖本地同名卡片。本地独有卡片会保留,但被覆盖卡片的未保存改动将丢失,且无法撤销。是否继续?`,confirmText:`开始下载`,severity:`warn`,onConfirm:()=>this.startSyncJob(null)})},async startSyncJob(e){this.syncPendingCodes=e;try{let t=await Y(`/__sync`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e?{cardCodes:e}:{})}),n=await t.json().catch(()=>({}));if(n.needCredentials){this.openLoginModal(`remote-all`);return}if(!t.ok||!n.ok)throw Error(n.message||n.error||`HTTP `+t.status);this.syncJobId=n.jobId,this.syncProgress={done:0,total:Number(n.total)||0,current:``},this.syncProgressOpen=!0,this.pollSyncProgress()}catch(e){this.syncPendingCodes=void 0,Q(`启动下载失败:`+(e&&e.message),`err`)}},pollSyncProgress(){this.syncPollTimer&&clearTimeout(this.syncPollTimer);let e=async()=>{if(this.syncJobId&&this.syncProgressOpen){try{let e=await Y(`/__sync/progress?jobId=`+encodeURIComponent(this.syncJobId)),t=await e.json().catch(()=>({}));if(!e.ok||!t.ok)throw Error(t.message||`进度查询失败`);if(this.syncProgress={done:Number(t.done)||0,total:Number(t.total)||0,current:t.currentTitle||t.currentId||``},t.finished){this.onSyncJobFinished(t.result||{});return}}catch(e){console.error(`[同步进度查询失败]`,e)}this.syncPollTimer=setTimeout(e,600)}};e()},stopSyncPolling(){this.syncPollTimer&&=(clearTimeout(this.syncPollTimer),null)},async onSyncJobFinished(e){if(this.stopSyncPolling(),this.syncProgressOpen=!1,this.syncJobId=``,e.needCredentials){this.openLoginModal(`remote-all`);return}let t=this.syncPendingCodes;if(this.syncPendingCodes=void 0,e.cancelled){let t=(e.synced||[]).length;Q(t?`下载已取消(已完成 ${t} 张)`:`下载已取消`,`ok`)}else if(e.success){let t=(e.synced||[]).length,n=(e.failed||[]).length;Q(n?`下载完成:成功 ${t} 张,失败 ${n} 张`:`下载完成:共 ${t} 张`,n?`warn`:`ok`)}else Q(`下载失败:`+(e.error||`未知错误`),`err`);if((e.success||e.cancelled)&&(this.credentialsReady=!0),await this.fetchCardList(),this.selectedId)try{await this.onRefresh()}catch{}e.success&&t&&t.length&&(this.remoteAllOpen=!1)},cancelSyncJob(){this.syncJobId&&Y(`/__sync/cancel`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({jobId:this.syncJobId})}).catch(()=>{})},async checkCredentials(){try{let e=await Y(`/__login-credentials`),t=await e.json().catch(()=>({}));this.credentialsReady=!e.ok||!!t.hasCredentials}catch{this.credentialsReady=!0}},onRemoteTrigger(e){this.remoteToggleFn=e,!this.remoteBusy&&(this.credentialsReady?e():this.openLoginModal(`dropdown`))},openLoginModal(e){this.loginModal=!0,this.loginName=``,this.loginPassword=``,this.loginError=``,this.loginPendingAction=e||``},closeLoginModal(){this.loginSubmitting||(this.loginModal=!1,this.loginPassword=``,this.loginError=``,this.loginPendingAction=``,this.remoteToggleFn=null)},async submitLogin(){if(this.loginSubmitting)return;let e=this.loginName.trim(),t=this.loginPassword;if(!e||!t)this.loginError=`账号与密码均不能为空`;else{this.loginSubmitting=!0,this.loginError=``;try{let n=await Y(`/__login-credentials`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({loginName:e,loginPassword:t})}),r=await n.json().catch(()=>({}));if(!n.ok||!r.ok)throw Error(r.message||r.error||`HTTP `+n.status);this.credentialsReady=!0,this.loginModal=!1,this.loginPassword=``,Q(`登录验证成功,凭据已保存`,`ok`);let i=this.loginPendingAction;if(this.loginPendingAction=``,i===`sync`)await this.runSync(this.syncTarget===`selected`?this.selectedId:void 0);else if(i===`publish`)await this.doPublish();else if(i===`slices`)await this.uploadCardSlices();else if(i===`dropdown`){let e=this.remoteToggleFn;this.remoteToggleFn=null,e&&this.$nextTick(()=>e())}else if(i===`remote-all`){this.remoteAllOpen=!0;let e=this.syncPendingCodes;e===void 0?this.openRemoteAllCards():this.startSyncJob(e)}}catch(e){this.loginError=e&&e.message||`登录验证失败`,this.loginPassword=``}finally{this.loginSubmitting=!1}}},chooseSync(e){this.preview&&this.selectedId&&!this.syncingRemote&&this.requestConfirm({title:`拉取最新卡`,message:`即将从远端 FinMall 拉取当前卡片「${this.selectedId}」的最新版本并覆盖本地。本地未保存的改动将丢失,且无法撤销。是否继续?`,confirmText:`继续同步`,onConfirm:()=>this.syncSelected()})},chooseRsave(e){if(e===`save`){if(!this.preview||!this.selectedId||this.savingRemote||!this.hasCardSource)return;this.requestConfirm({title:`推送当前卡`,message:`即将把本地卡片「${this.selectedId}」的当前版本推送并覆盖到远端 FinMall。线上版本会被立即更新,且该操作不可撤销。推送成功后会为当前卡片截图并上传为远端列表预览图。是否继续?`,confirmText:`继续推送`,severity:`warn`,onConfirm:()=>this.saveToRemote()})}else if(e===`publish`){if(!this.preview||!this.selectedId||this.publishing||!this.hasCardSource)return;let e=this.historyDirty;this.requestConfirm({title:`卡片发布`,message:e?`当前卡片存在未保存到远端的改动,发布将使用远端「已保存」的版本(不含这些本地改动)。仍将以「最大版本号 +1」作为新版本号上线。确认继续?`:`即将取远端「${this.selectedId}」当前最大版本号并 +1,发布上线为新版本。发布的是远端已保存的卡片内容(建议先「推送当前卡」)。该操作不可撤销。确认继续?`,confirmText:`继续发布`,severity:e?`danger`:`warn`,onConfirm:()=>this.doPublish()})}else if(e===`slices`){if(!this.preview||!this.selectedId||this.uploadingSlices)return;this.requestConfirm({title:`当前卡切图上传`,message:`即将把当前卡片「${this.selectedId}」引用的本地切图(src/slices/)上传到 FinMall 图片库,并把卡片里的 /slices/ 引用替换为线上地址(@filestore/…)。本地切图文件保留不动;内容未变的切图会直接复用已有线上地址,不重复上传。`+(this.historyDirty?`
359
+ `)}`}return{role:`user`,content:n}}let t=(e.toolCalls||[]).filter(e=>e.result!==void 0||e.error).map(e=>({toolCallId:e.toolCallId,toolName:e.toolName,args:e.args||{},result:typeof e.result==`string`?HU(e.toolName,e.result):e.result,error:e.error||``})),n=e.content||``;return e.status===`aborted`&&(n=n?`${n}\n\n[本轮生成被用户手动中止,以上为已完成部分;未完成的步骤没有执行,请从中断处继续。]`:`[上一轮被用户手动中止于思考/工具阶段,没有产出可用内容;请重新规划并继续完成用户的目标。]`),{role:`assistant`,content:n,toolCalls:t}})},onScroll(){let e=this.$refs.listEl;e&&(this.pinned=e.scrollHeight-e.scrollTop-e.clientHeight<48)},scrollToBottom(e=!1){let t=this.$refs.listEl;t&&(e||this.pinned)&&(t.scrollTop=t.scrollHeight)},stopTickers(){this._saveTimer&&clearTimeout(this._saveTimer),this._saveTimer=0},startTurn(){let e=Date.now();this.turnId=``,this.lastSeq=0,this.turnStep=0,this.turnStage=null,this.turnToolLabel=``,this.turnStartedAt=e,this.lastByteAt=e,this.nowTs=e,this.stopTurnTimers(),this._liveTicker=setInterval(()=>{this.nowTs=Date.now(),this.$emit(`turn-progress`,{steps:this.turnStep,startedAt:this.turnStartedAt,ms:this.nowTs-this.turnStartedAt,stage:this.turnStage?`${this.turnStage.id} ${this.turnStage.label}`:this.turnToolLabel,stalled:this.stalled})},1e3),this._turnPersistTimer=setInterval(()=>this.persist(),8e3),this.persist(),this.$emit(`busy`,!0)},stopTurnTimers(){this._liveTicker&&clearInterval(this._liveTicker),this._liveTicker=0,this._turnPersistTimer&&clearInterval(this._turnPersistTimer),this._turnPersistTimer=0},onPagehide(){let e=this.cardId;if(!e||!this.messages.length)return;let t=this.fitArchive(this.serialize());this._dirtyFor=null,this._saveTimer&&=(clearTimeout(this._saveTimer),0),iz(e,t,{keepalive:!0}).catch(()=>{})},fmtClock:WL,pushEvent(e,t){let n=String(t&&t.message||``);n&&e&&(Array.isArray(e.events)||(e.events=[]),e.events.push({ts:Date.now(),level:t.level||`warn`,code:t.code||``,message:n}))},applyUsage(e,t){if(!e||!t)return;let n=e=>Number.isFinite(Number(e))?Number(e):0;e.usage={steps:n(t.steps),promptTokens:n(t.promptTokens),completionTokens:n(t.completionTokens),cachedTokens:n(t.cachedTokens),cacheMissTokens:n(t.cacheMissTokens),hitRate:n(t.hitRate),reported:t.reported!==!1}},loadCompact(){try{this.compactSteps=localStorage.getItem($U)===`1`}catch{}},setCompact(e){let t=!!e;if(this.compactSteps!==t){this.compactSteps=t;try{t?localStorage.setItem($U,`1`):localStorage.removeItem($U)}catch{}this.$nextTick(()=>this.scrollToBottom())}},toggleCompact(){this.setCompact(!this.compactSteps)},onLocateNode(e){e&&this.$emit(`locate-node`,String(e))},onRollbackTurn(e){if(this.busy)return;let t=this.cardId;t&&e&&this.$emit(`rollback-turn`,{cardId:t,ts:Number(e.ts)||0,msgId:e.id})},notify(e,t){this.notice={type:e,text:t},this._noticeTimer&&clearTimeout(this._noticeTimer),this._noticeTimer=setTimeout(()=>{this.notice=null},6e3)}}},sW={class:`aichat__head`},cW={class:`aichat__titles`},lW={class:`aichat__sub`},uW={class:`aichat__acts`},dW=[`title`,`aria-pressed`],fW={viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},pW=[`href`],mW=[`disabled`],hW={key:0,class:`aichat__banner`},gW={class:`aichat__scroll`},_W={key:0,class:`aichat__archnote`,title:`长对话记录超出落盘体积上限时,较早的工具参数与结果会被裁剪归档;正文、思考与过程事件都完整保留`},vW={key:1,class:`aichat__loading`},yW={key:2,class:`aichat__empty`},bW={class:`aichat__empty-title`},xW={class:`aichat__empty-desc`},SW={class:`aichat__suggests`},CW=[`title`,`data-suggest-id`,`onClick`],wW={viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},TW=[`href`],EW={class:`aichat__suggest-text`},DW={class:`aichat__suggest-label`},OW={class:`aichat__suggest-hint`},kW={key:0,class:`aichat__suggest-badge`,title:`该操作会改动卡片`},AW={class:`aichat__live-text`},jW={key:1,class:`aichat__quick`},MW=[`title`,`data-suggest-id`,`onClick`],NW={viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},PW=[`href`],FW={class:`ni-panel modal-card ccsw-dlg`,role:`dialog`,"aria-modal":`true`,"aria-label":`从 cc-switch 导入模型`},IW={class:`ni-head`},LW={class:`ni-body`},RW={class:`ni-scroll`},zW={key:0,class:`ccsw-dlg__msg`},BW={class:`ccsw-dlg__msg ccsw-dlg__msg--err`},VW={class:`ccsw-dlg__list`},HW=[`onClick`],UW={key:0,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`,"stroke-linecap":`round`,"stroke-linejoin":`round`},WW={class:`ccsw-dlg__info`},GW={class:`ccsw-dlg__name`},KW={key:0,class:`ccsw-dlg__badge ccsw-dlg__badge--cur`,title:`cc-switch 中当前生效`},qW={key:1,class:`ccsw-dlg__badge ccsw-dlg__badge--dup`,title:`模型库中已存在同名模型`},JW={class:`ccsw-dlg__meta`},YW={class:`ccsw-dlg__model`},XW={class:`ccsw-dlg__host`},ZW={class:`ni-foot`},QW={class:`ni-tip`},$W={class:`ni-foot-btns`},eG=[`disabled`];function tG(e,t,n,r,i,a){let o=R(`ChatMessage`),s=R(`ChatComposer`),c=R(`ModelList`),l=R(`AiSettings`),u=R(`ConfirmDialog`),d=R(`AiCommonSettings`);return V(),H(`aside`,{class:j([`aichat`,{"is-open":n.visible}]),style:A(a.panelStyle),role:`complementary`,"aria-label":`AI 开发助手`,onKeydown:t[21]||=jl((...e)=>a.onEscape&&a.onEscape(...e),[`esc`]),onClick:t[22]||=(...e)=>a.onImageClick&&a.onImageClick(...e)},[q(` 左缘拖拽把手:调宽(双击恢复默认 33%) `),W(`div`,{class:j([`aichat__grip`,{"is-dragging":i.resizing}]),title:`拖拽调整宽度(双击恢复默认)`,onPointerdown:t[0]||=J((...e)=>a.startResize&&a.startResize(...e),[`prevent`]),onDblclick:t[1]||=J((...e)=>a.resetWidth&&a.resetWidth(...e),[`prevent`])},null,34),q(` 头部:标题 + 当前卡片 / 模型 + 清空 / 设置 / 关闭 `),W(`header`,sW,[t[27]||=W(`span`,{class:`aichat__logo`},[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-sparkles`})])],-1),W(`span`,cW,[t[23]||=W(`span`,{class:`aichat__title`},`AI 开发助手`,-1),W(`span`,lW,[n.cardId?(V(),H(B,{key:0},[K(M(n.cardName||n.cardId),1)],64)):(V(),H(B,{key:1},[K(`未选择卡片`)],64)),i.config.model?(V(),H(B,{key:2},[K(` · `+M(i.config.model),1)],64)):q(`v-if`,!0)])]),W(`span`,uW,[q(` 紧凑视图(面板级):长任务里读取类调用能刷几十行,把写入与门禁挤到折叠线以下 `),W(`button`,{type:`button`,class:j([`aichat__iconbtn`,{"is-on":i.compactSteps}]),title:i.compactSteps?`紧凑视图已开启:已折叠读取类调用,点击显示全部步骤`:`只看关键步骤:折叠读取类调用(写入 / 跑脚本 / 报错始终显示)`,"aria-pressed":i.compactSteps?`true`:`false`,onClick:t[2]||=(...e)=>a.toggleCompact&&a.toggleCompact(...e)},[(V(),H(`svg`,fW,[W(`use`,{href:i.compactSteps?`#icon-eye-off`:`#icon-eye`},null,8,pW)]))],10,dW),W(`button`,{type:`button`,class:`aichat__iconbtn`,title:`清空本卡片对话记录`,disabled:!i.messages.length||i.busy,onClick:t[3]||=(...e)=>a.askClear&&a.askClear(...e)},[...t[24]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-trash`})],-1)]],8,mW),W(`button`,{type:`button`,class:`aichat__iconbtn`,title:`模型库`,onClick:t[4]||=(...e)=>a.openModelList&&a.openModelList(...e)},[...t[25]||=[W(`svg`,{class:`is-solid-icon`,viewBox:`0 0 1024 1024`,"aria-hidden":`true`},[W(`use`,{href:`#icon-model`})],-1)]]),W(`button`,{type:`button`,class:`aichat__iconbtn`,title:`关闭(Esc)`,onClick:t[5]||=t=>e.$emit(`close`)},[...t[26]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-x`})],-1)]])])]),q(` 未配置模型:常驻提示条,一键打开设置 `),a.configReady?q(`v-if`,!0):(V(),H(`div`,hW,[t[28]||=W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-alert-triangle`})],-1),t[29]||=W(`span`,null,`尚未配置模型,无法对话。`,-1),W(`button`,{type:`button`,class:`aichat__banner-btn`,onClick:t[6]||=(...e)=>a.openModelList&&a.openModelList(...e)},`去设置`)])),q(` 消息区:滚动容器与悬浮「回到底部」共处一个定位上下文,按钮只贴消息区底缘,
360
+ 输入区拖高 / 反馈条出现都不会把它盖住或悬空 `),W(`div`,gW,[W(`div`,{ref:`listEl`,class:`aichat__list`,onScroll:t[10]||=(...e)=>a.onScroll&&a.onScroll(...e)},[q(` 体积治理痕迹:较早的工具结果被裁剪过就说清楚,别让人以为记录丢了 `),i.archiveTrimmed?(V(),H(`div`,_W,[...t[30]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-activity`})],-1),W(`span`,null,`较早的工具参数 / 结果已裁剪归档(对话正文与过程事件完整保留)`,-1)]])):q(`v-if`,!0),i.loadingHistory?(V(),H(`div`,vW,`正在加载对话记录…`)):i.messages.length?(V(),H(B,{key:3},[q(` compact = 面板级「只看关键步骤」;can-rollback 只对当前卡片、非流式中开放(切了卡再回滚会写错对象) `),(V(!0),H(B,null,z(i.messages,(e,r)=>(V(),U(o,{key:e.id,msg:e,streaming:i.busy&&r===i.messages.length-1,"can-regenerate":e.role===`assistant`&&r===i.messages.length-1,compact:i.compactSteps,"can-rollback":e.role===`assistant`&&!i.busy&&!!n.cardId,"now-ts":i.busy&&r===i.messages.length-1?i.nowTs:0,"pick-owner":a.pickOwnerRow,onRegenerate:a.regenerate,onApproval:a.onApproval,onContinue:a.onContinue,onRollback:a.onRollbackTurn,onOpenSettings:a.openModelList,onShowAllSteps:t[8]||=e=>a.setCompact(!1),onLocateNode:a.onLocateNode,onPickBoard:a.onPickBoard},null,8,[`msg`,`streaming`,`can-regenerate`,`compact`,`can-rollback`,`now-ts`,`pick-owner`,`onRegenerate`,`onApproval`,`onContinue`,`onRollback`,`onOpenSettings`,`onLocateNode`,`onPickBoard`]))),128)),q(` 面板级进度:步数 / 已用时长 / 建卡阶段 / 最近收到数据多久前。
361
+ 长任务里「还活着吗」全靠这一行——旧版只有一句「生成中…」,网关静默与真在跑无从区分 `),i.busy?(V(),H(`div`,{key:0,class:j([`aichat__live`,{"is-stalled":a.stalled}]),role:`status`,"aria-live":`polite`},[t[33]||=W(`span`,{class:`aichat__live-dot`},null,-1),W(`span`,AW,M(a.liveText),1),a.stalled?(V(),H(`button`,{key:0,type:`button`,class:`aichat__live-act`,title:`连接可能已中断,终止本轮(已落盘的产物会保留)`,onClick:t[9]||=(...e)=>a.stop&&a.stop(...e)},` 终止 `)):q(`v-if`,!0)],2)):q(`v-if`,!0)],64)):(V(),H(`div`,yW,[t[32]||=W(`span`,{class:`aichat__empty-logo`},[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-sparkles`})])],-1),W(`p`,bW,M(a.emptyTitle),1),W(`p`,xW,M(a.emptyDesc),1),W(`div`,SW,[(V(!0),H(B,null,z(a.suggestions,e=>(V(),H(`button`,{key:e.id,type:`button`,class:j([`aichat__suggest`,`is-${e.weight}`]),title:e.text,"data-suggest-id":e.id,onClick:t=>a.useSuggestion(e)},[(V(),H(`svg`,wW,[W(`use`,{href:e.icon},null,8,TW)])),W(`span`,EW,[W(`span`,DW,M(e.label),1),W(`span`,OW,M(e.hint),1)]),e.weight===`write`?(V(),H(`span`,kW,`改卡`)):q(`v-if`,!0)],10,CW))),128)),a.canShuffle?(V(),H(`button`,{key:0,type:`button`,class:`aichat__suggest-shuffle`,onClick:t[7]||=(...e)=>a.shuffleSuggestions&&a.shuffleSuggestions(...e)},[...t[31]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-refresh`})],-1),W(`span`,null,`换一批`,-1)]])):q(`v-if`,!0)])]))],544),q(` 回到底部:脱离底部吸附时出现 `),L(W(`button`,{type:`button`,class:`aichat__jump`,title:`回到底部`,onClick:t[11]||=e=>a.scrollToBottom(!0)},[...t[34]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-arrow-down`})],-1)]],512),[[Nc,!i.pinned&&i.messages.length]])]),q(` 常驻「常用」指令:有对话后空态建议区不再出现,这里保留一排轻量入口,随上下文同源 `),a.quickChips.length&&i.messages.length&&!i.busy?(V(),H(`div`,jW,[(V(!0),H(B,null,z(a.quickChips,e=>(V(),H(`button`,{key:e.id,type:`button`,class:j([`aichat__chip`,`is-${e.weight}`]),title:e.text,"data-suggest-id":e.id,onClick:t=>a.useSuggestion(e)},[(V(),H(`svg`,NW,[W(`use`,{href:e.icon},null,8,PW)])),W(`span`,null,M(e.label),1)],10,MW))),128))])):q(`v-if`,!0),q(` 操作反馈(附件解析失败 / 历史保存失败等) `),i.notice?(V(),H(`div`,{key:2,class:j([`aichat__notice`,`aichat__notice--${i.notice.type}`])},[W(`span`,null,M(i.notice.text),1),W(`button`,{type:`button`,class:`aichat__notice-x`,title:`关闭`,onClick:t[12]||=e=>i.notice=null},[...t[35]||=[W(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-x`})],-1)]])],2)):q(`v-if`,!0),G(s,{ref:`composerEl`,busy:i.busy,model:i.config.model,attachments:i.draftAttachments,placeholder:a.configReady?`描述你要改的卡片,Enter 发送 / Shift+Enter 换行`:`请先在设置中配置模型…`,context:i.contextUsage,onSend:a.onSend,onStop:a.stop,onPick:a.onPick,onAddPath:a.onAddPath,onRemoveAttachment:a.removeAttachment,onDropFiles:a.onDropFiles,onPasteImage:a.onPasteImage,onEscape:a.onEscape},null,8,[`busy`,`model`,`attachments`,`placeholder`,`context`,`onSend`,`onStop`,`onPick`,`onAddPath`,`onRemoveAttachment`,`onDropFiles`,`onPasteImage`,`onEscape`]),q(` 一级面板:模型库。从齿轮 / 横幅 / 消息内「去设置」进入 `),i.modelListOpen?(V(),U(c,{key:3,models:i.models,"active-id":i.activeId,"turn-running":i.turnRunning,onClose:a.closeModelList,onAdd:a.onModelAdd,onEdit:a.onModelEdit,onDelete:a.onModelDelete,onActivate:a.onModelActivate,onImportCcswitch:a.onImportCcSwitch,onOpenCommon:a.openCommon},null,8,[`models`,`active-id`,`turn-running`,`onClose`,`onAdd`,`onEdit`,`onDelete`,`onActivate`,`onImportCcswitch`,`onOpenCommon`])):q(`v-if`,!0),q(` 新增 / 编辑模型:复用 AiSettings(modelId 区分,initialModel 预填) `),i.modelEditOpen?(V(),U(l,{key:4,config:i.config,"model-id":i.editModelId,"initial-model":i.editInitialModel,onClose:a.onModelEditClose,onSaved:a.onModelSaved},null,8,[`config`,`model-id`,`initial-model`,`onClose`,`onSaved`])):q(`v-if`,!0),q(` 删除模型确认:二次确认后才真正落盘删除 `),G(u,{visible:!!i.confirmDeleteModel,"close-on-mask":!1,title:`删除模型`,message:a.deleteModelMessage,"confirm-text":`删除`,severity:`danger`,onConfirm:a.doDeleteModel,onCancel:t[13]||=e=>i.confirmDeleteModel=null},null,8,[`visible`,`message`,`onConfirm`]),q(` cc-switch 导入弹窗:列出 cc-switch 的 Codex 类供应商,勾选后批量导入模型库(按 model 去重) `),G(hc,{name:`modal`},{default:I(()=>[i.ccSwitchOpen?(V(),H(`div`,{key:0,class:`ni-overlay`,onClick:t[17]||=J(e=>i.ccSwitchOpen=!1,[`self`])},[W(`div`,FW,[W(`div`,IW,[t[36]||=W(`span`,{class:`ni-title`},`从 cc-switch 导入`,-1),W(`button`,{class:`ni-close`,type:`button`,title:`关闭`,onClick:t[14]||=e=>i.ccSwitchOpen=!1})]),W(`div`,LW,[W(`div`,RW,[q(` 加载中 `),i.ccSwitchLoading?(V(),H(`p`,zW,`正在读取 cc-switch 供应商…`)):i.ccSwitchReason?(V(),H(B,{key:1},[q(` 无可导入项 `),W(`p`,BW,M(i.ccSwitchReason),1)],2112)):(V(),H(B,{key:2},[q(` 供应商列表 `),W(`ul`,VW,[(V(!0),H(B,null,z(i.ccSwitchProviders,e=>(V(),H(`li`,{key:e.id,class:j([`ccsw-dlg__item`,{"is-active":i.ccSwitchSelected[e.id],"is-dup":e.duplicate}]),onClick:t=>a.toggleCcSwitchItem(e)},[W(`span`,{class:j([`ccsw-dlg__check`,{"is-on":i.ccSwitchSelected[e.id]}])},[i.ccSwitchSelected[e.id]?(V(),H(`svg`,UW,[...t[37]||=[W(`use`,{href:`#icon-check`},null,-1)]])):q(`v-if`,!0)],2),W(`span`,WW,[W(`span`,GW,[K(M(e.name||e.model)+` `,1),e.isCurrent?(V(),H(`span`,KW,`当前`)):q(`v-if`,!0),e.duplicate?(V(),H(`span`,qW,`已存在`)):q(`v-if`,!0)]),W(`span`,JW,[W(`span`,YW,M(e.model),1),t[38]||=W(`span`,{class:`ccsw-dlg__dot`},`·`,-1),W(`span`,XW,M(e.baseUrl),1)])])],10,HW))),128))])],2112))])]),W(`div`,ZW,[W(`span`,QW,M(a.ccSwitchDupCount>0?`已有 ${a.ccSwitchDupCount} 个重复模型被自动跳过`:`勾选要导入的供应商,批量加入模型库`),1),W(`div`,$W,[W(`button`,{class:`ni-btn ni-btn--ghost`,type:`button`,onClick:t[15]||=e=>i.ccSwitchOpen=!1},`取消`),W(`button`,{class:`ni-btn`,type:`button`,disabled:i.ccSwitchLoading||!i.ccSwitchProviders.length||a.ccSwitchCheckedCount===0,onClick:t[16]||=(...e)=>a.confirmImportCcSwitch&&a.confirmImportCcSwitch(...e)},M(a.ccSwitchCheckedCount>0?`导入选中 ${a.ccSwitchCheckedCount} 项`:`导入`),9,eG)])])])])):q(`v-if`,!0)]),_:1}),q(` 通用设置:所有模型共享的执行策略 / 环境参数 `),i.commonOpen?(V(),U(d,{key:5,onClose:t[18]||=e=>i.commonOpen=!1,onSaved:a.onCommonSaved},null,8,[`onSaved`])):q(`v-if`,!0),G(u,{visible:i.confirmClear,"close-on-mask":!1,title:`清空对话记录`,message:`将删除卡片「${n.cardName||n.cardId||`当前卡片`}」的全部对话记录,此操作不可撤销。`,"confirm-text":`清空`,severity:`danger`,onConfirm:a.doClear,onCancel:t[19]||=e=>i.confirmClear=!1},null,8,[`visible`,`message`,`onConfirm`]),q(` 终止确认:生成中按 Esc 会走到这里。几十分钟的建卡被一次误按抹掉代价太大,故加一道确认 `),G(u,{visible:i.confirmStop,"close-on-mask":!1,title:`终止本次生成`,message:`已执行的写入与落盘产物都会保留,上下文也留在对话里,之后回复「继续」可从中断处接着做。确定现在终止?`,"confirm-text":`终止生成`,severity:`danger`,onConfirm:a.doStop,onCancel:t[20]||=e=>i.confirmStop=!1},null,8,[`visible`,`onConfirm`])],38)}var nG=Z(oW,[[`render`,tG],[`__file`,`/Users/ynet/dsl-card/card-editor/components/ChatPanel.vue`]]),rG=`/assets/site-icon-CFMif8z4.png`,iG={includeMocks:!0};function aG(e){return e?JSON.parse(JSON.stringify(e,(e,t)=>e===`_schemaNode`?void 0:t)):null}function oG(e){let t=aG(e);if(t&&t.dictionary&&Array.isArray(t.dictionary.inputParams)){let e=hv(t);for(let n of t.dictionary.inputParams)n&&typeof n==`object`&&!gv(e,n.key)&&(n.defaultValue=void 0)}return t}function sG(e,t){return!e||!t?e===t:JSON.stringify(oG(e))===JSON.stringify(oG(t))}function cG(e,t){return JSON.stringify(e)===JSON.stringify(t)}function lG(e,t){return!t||!e?!1:!sG(e,t)}function uG(e,t,n){return!t||!e?!1:!cG(e,n??mv(t,iG))}function dG(e,t,n,r){return!t||!e?!1:lG(e,t)||uG(n,t,r)}var fG={includeMocks:!0},pG=2500,mG=8e3,hG=`cardbuddy:remote-cards-cache:v1`,gG=3e5;function _G(){try{let e=JSON.parse(localStorage.getItem(hG)||`null`);if(e&&e.v===1&&Array.isArray(e.cards))return e}catch{}return null}function vG(e){try{localStorage.setItem(hG,JSON.stringify({v:1,at:Date.now(),cards:e}))}catch{}}var yG=new pu,bG=vu({},yG);typeof window<`u`&&(window.__rt=bG);var xG=188,SG=320,CG=200,wG=160,TG={name:`App`,components:{RenderTree:vp,DebugPanel:Gx,ApiCallPanel:pS,CardSelect:MS,AlertCardLayer:US,DeviceOverlay:ND,PickerOverlay:UD,DatePickerOverlay:eO,KeyboardOverlay:oO,LoadingExOverlay:fO,SelectionOverlay:gO,HoverGuides:SO,RemotePreview:uk,AppToast:_k,ThemeSettings:Rk,ImageLightbox:iA,ConfirmDialog:Ap,CardGallery:LA,RemoteAllCards:vj,RemoteCardFormDialog:$j,SyncProgressModal:uM,ExportDirDialog:EM,ExportProgressModal:LM,NewCardDialog:rN,ComponentPalette:vN,Switch:SN,ChatPanel:nG},provide(){return{adapter:yG,cardRuntime:bG,customComponents:{}}},data(){return{adapter:yG,rt:bG,logoUrl:rG,appVersion:`0.81.8`,cardList:[],cardCount:0,galleryOpen:!1,remoteAllOpen:!1,remoteCards:[],remoteCardsLoading:!1,remoteCardsRefreshing:!1,remoteCardsError:``,remoteCardFormOpen:!1,remoteCardFormMode:`create`,remoteCardFormCard:null,remoteCardDeletingId:``,syncJobId:``,syncProgressOpen:!1,syncProgress:{done:0,total:0,current:``},syncPollTimer:null,exportDirDialog:{visible:!1,ids:[]},compilingCards:!1,exportJobId:``,exportProgressOpen:!1,exportProgress:{done:0,total:0,current:``},exportPollTimer:null,syncPendingCodes:void 0,cardDialog:{visible:!1,mode:`create`,cardId:``,cardDesc:``},selectedId:``,externalReloadNote:``,externalReloadTimer:null,selfSaveId:``,selfSaveAt:0,preview:null,chromeOff:!1,theme:`dark`,accent:bk,cardReady:!1,reloadToken:0,moveCollapseToken:0,refreshing:!1,loadingCard:!1,currentSchema:null,currentCard:null,loadedCardId:``,cardImportMeta:null,localSchema:null,localData:null,selectedNodeId:``,activeTab:`vars`,apiPanelOpen:!0,addNodePanelOpen:!1,addNodeTarget:null,validateBadge:{state:`idle`,errors:0,warnings:0,renderOk:null,ts:0},validateTimer:null,savedCard:!1,savingCard:!1,saveTimer:null,coverBusy:!1,savingRemote:!1,restoringHistory:!1,savedRemote:!1,verifiedRemote:null,saveRemoteTimer:null,syncingRemote:!1,syncedRemote:!1,remotePreviewOpen:!1,syncTarget:null,syncTimer:null,uploadingSlices:!1,publishing:!1,metaRefreshToken:0,historyRefreshToken:0,loginModal:!1,loginName:``,loginPassword:``,loginSubmitting:!1,loginError:``,credentialsReady:!1,loginPendingAction:``,remoteToggleFn:null,confirm:{show:!1,title:``,message:``,confirmText:`继续`,cancelText:`取消`,severity:`primary`,onConfirm:null},past:[],future:[],baseline:null,_commitTimer:null,viewportHeight:700,canvasBg:`gray`,refreshing:!1,bgOptions:[{key:`checker`,label:`棋盘`},{key:`white`,label:`白色`},{key:`gray`,label:`浅灰`},{key:`black`,label:`黑色`}],_previewWidthPx:372,_apiPanelWidthPx:360,presetSizes:[{key:375,value:`375`},{key:430,value:`430`},{key:188,value:`188`}],stageWidth:typeof window<`u`?window.innerWidth:1280,colsWidth:0,stageHeight:typeof window<`u`?window.innerHeight-52:748,dragging:!1,apiDragging:!1,_stageObserver:null,devServiceOpen:!1,aiChatOpen:(()=>{try{return sessionStorage.getItem(`cardbuddy:ai-chat-open`)===`1`}catch{return!1}})(),chatBusy:!1,chatProgress:null,fab:{x:null,y:null,dragging:!1},fabDrag:null,fabSuppressClick:!1,devServiceForm:Kl(),apiBaseResolved:Jl(),devSvcLive:`unknown`,devSvcDown:!1,_unsubCardsChanged:null}},computed:{fabTitle(){if(this.aiChatOpen)return`AI 开发助手(已打开)`;if(!this.chatBusy)return`AI 开发助手`;let e=this.chatProgress,t=e&&e.startedAt?`${GL(e.startedAt)} 开始 · `:``;return`AI 开发助手正在生成(${e?`${t}第 ${e.steps} 步 · 已用 ${WL(e.ms)}${e.stage?` · ${e.stage}`:``}${e.stalled?` · 疑似断流`:``}`:``}),点击展开查看`},fabStyle(){return this.fab.x==null||this.fab.y==null?{}:{right:this.fab.x+`px`,bottom:this.fab.y+`px`,left:`auto`,top:`auto`,transition:this.fab.dragging?`none`:``}},currentBg(){return this.bgOptions.find(e=>e.key===this.canvasBg)||this.bgOptions[0]},cardIds(){return this.cardList.map(e=>e&&e.id).filter(Boolean)},remoteImportedIds(){return this.cardList.filter(e=>e&&e.imported).map(e=>e.id)},canUndo(){return this.past.length>0},canRedo(){return this.future.length>0},devSvcBlockReason(){let e=this.devServiceForm||{};return String(e.baseUrl||``).trim()?e.enabled?null:`disabled`:`empty`},canPaste(){return!!td()},hasCardSource(){return!!(this.cardImportMeta&&this.cardImportMeta.source)},remoteBusy(){return!!(this.savingRemote||this.syncingRemote||this.uploadingSlices||this.publishing)},remoteBusyReason(){return this.savingRemote?`正在推送至远端…`:this.syncingRemote?`正在拉取远端卡片…`:this.uploadingSlices?`正在上传切图…`:this.publishing?`正在发布版本…`:``},historyDirty(){return dG(this.currentSchema,this.localSchema,this.rt&&this.rt.rootScope,this.localData)},devSvcConn(){return this.apiBaseResolved===null?`unconfigured`:this.devSvcLive===`open`?`open`:this.devSvcDown?`closed`:`connecting`},devSvcTitle(){if(this.apiBaseResolved===null)return this.devSvcBlockReason===`disabled`?`已填地址但未开启用本地服务`:`未配置本地开发服务(部署态必填)`;let e=this.apiBaseResolved===``?`同源开发服务`:`本地开发服务`;return this.devSvcLive===`open`?e+`已连接`:this.devSvcDown?e+`已断开(连接失败或服务已停止,重连中…)`:e+`连接中 / 重连中…`},devSvcClass(){return this.apiBaseResolved===null?`app__btn--warn`:this.devSvcLive===`open`?`app__btn--connected`:this.devSvcDown?`app__btn--disconnected`:`app__btn--reconnecting`},devSvcLabel(){return this.apiBaseResolved===null?`未配置本地服务`:this.devSvcLive===`open`?`本地服务已连接`:this.devSvcDown?`本地服务已断开`:`本地服务连接中…`},badgeText(){return{idle:`待校验`,pending:`校验中…`,ok:`校验通过`,error:`校验未通过`,nopython:`未配置校验`,fail:`校验服务异常`}[this.validateBadge.state]||`待校验`},badgeTitle(){let e=this.validateBadge;if(e.state===`ok`)return`结构合法 + 渲染不抛错(不保证画得对,视觉正确性见截图)`;if(e.state===`error`){let t=[];return e.errors&&t.push(`契约错误 ${e.errors} 个`),e.renderOk===!1&&t.push(`渲染抛出异常`),`校验未通过:`+(t.join(`;`)||`详见 /__validate 与 /__render-status`)}return e.state===`nopython`?`未找到 python3/python,无法跑契约校验(请安装 Python 或设置 DSL_PYTHON)`:e.state===`fail`?`校验服务异常(dev server 未启动或端点不可用)`:``},previewWidth(){if(this.chromeOff)return this.stageWidth;let{min:e,max:t}=this.previewBounds,n=this._previewWidthPx||xG;return Math.max(e,Math.min(t,n))},viewportWidth(){return this.stageWidth,typeof window<`u`?window.innerWidth:1280},debugSoftWidth(){return Math.max(CG,Math.floor(this.viewportWidth/3))},previewBounds(){let e=this.stageWidth||0,t=Math.floor(e/2),n=e-SG-this.debugSoftWidth;return{min:xG,max:Math.max(xG,Math.min(t,n))}},debugMinWidth(){let e=this.colsWidth||Math.max(0,(this.stageWidth||0)-this.previewWidth);return Math.max(CG,Math.min(this.debugSoftWidth,Math.floor(e)-SG))},apiPanelBounds(){let e=this.colsWidth||Math.max(0,(this.stageWidth||0)-this.previewWidth),t=Math.max(wG,Math.floor(e)-this.debugMinWidth);return{min:Math.min(SG,t),max:t}},canvasW(){return Math.round(this.previewWidth||375)},selectedCardName(){let e=this.cardList.find(e=>e.id===this.selectedId);return e&&e.name||this.selectedId||``},cardEmpty(){let e=this.currentSchema;if(!e||!e.view)return!0;let t=e.view.components;return!Array.isArray(t)||t.length===0},apiPanelWidth(){let{min:e,max:t}=this.apiPanelBounds,n=this._apiPanelWidthPx||360;return Math.max(e,Math.min(t,n))},frameStyle(){return{}}},watch:{activeTab(e){e!==`structure`&&(this.selectedNodeId=``,yO())},credentialsReady(e){!e&&this.activeTab===`history`&&(this.activeTab=`vars`)},aiChatOpen(e){try{sessionStorage.setItem(`cardbuddy:ai-chat-open`,e?`1`:`0`)}catch{}},theme(e){document.documentElement.dataset.theme=e;try{localStorage.setItem(`cardbuddy:theme`,e)}catch{}},accent(e){Ck(e),wk(e)},apiPanelOpen(e){try{localStorage.setItem(`cardbuddy:api-panel-open`,e?`1`:`0`)}catch{}},remoteBusy(e){e&&(this.devServiceOpen=!1)},chatBusy(e,t){if(t&&!e&&this.selectedId){if(this.historyDirty){let e=this.currentSchema&&this.currentSchema.name||this.selectedId;this.showExternalReloadNote(`AI 已更新磁盘上的卡片「${e}」,当前有未保存编辑,未自动重载(点顶栏刷新可载入最新版)`)}else this.loadCard(this.selectedId)}}},beforeUnmount(){this.viewportObserver&&this.viewportObserver.disconnect(),this._stageObserver&&this._stageObserver.disconnect(),this.saveTimer&&clearTimeout(this.saveTimer),this.syncTimer&&clearTimeout(this.syncTimer),this.saveRemoteTimer&&clearTimeout(this.saveRemoteTimer),this.syncPollTimer&&clearTimeout(this.syncPollTimer),this.exportPollTimer&&clearTimeout(this.exportPollTimer),window.removeEventListener(`keydown`,this.onKeydown)},mounted(){this.viewportObserver=new ResizeObserver(e=>{for(let t of e)this.viewportHeight=Math.round(t.contentRect.height)}),this.$refs.phoneViewport&&this.viewportObserver.observe(this.$refs.phoneViewport),this.loadPreviewWidth(),this.loadCanvasBg(),this.loadApiPanelWidth(),this._stageObserver=new ResizeObserver(e=>{for(let t of e)t.target===this.$refs.colsEl?this.colsWidth=Math.round(t.contentRect.width):(this.stageWidth=Math.round(t.contentRect.width),this.stageHeight=Math.round(t.contentRect.height))}),this.$refs.stageEl&&this._stageObserver.observe(this.$refs.stageEl),this.$refs.colsEl&&this._stageObserver.observe(this.$refs.colsEl),window.addEventListener(`keydown`,this.onKeydown),this.fabInitPosition(),window.addEventListener(`resize`,this.onFabResize),this.checkCredentials()},beforeDestroy(){window.removeEventListener(`resize`,this.onFabResize)},async created(){wD(bG);let e=new URLSearchParams(location.search).get(`chrome`);this.chromeOff=e===`off`||e===``;try{let e=localStorage.getItem(`cardbuddy:theme`);(e===`light`||e===`dark`)&&(this.theme=e)}catch{}document.documentElement.dataset.theme=this.theme,this.accent=Sk(),Ck(this.accent);try{localStorage.getItem(`cardbuddy:api-panel-open`)===`0`&&(this.apiPanelOpen=!1)}catch{}await this.fetchCardList();let t=new URLSearchParams(location.search).get(`card`),n=null;try{let e=localStorage.getItem(`cardbuddy:selected-card`);e&&this.cardList.some(t=>t.id===e)&&(n=e)}catch{}let r=t&&this.cardList.some(e=>e.id===t)?t:n||this.cardList[0]&&this.cardList[0].id;r&&(this.selectedId=r,await this.loadCard(this.selectedId)),this.$watch(()=>this.rt.rootScope,()=>{this.syncDataToSchema()},{deep:!0}),this.setupCardsChanged()},methods:{fabBounds(){let e=this.$refs.aiFab,t=e?e.offsetWidth:56,n=e?e.offsetHeight:56,r=document.documentElement.clientWidth,i=document.documentElement.clientHeight;return{minX:0,minY:0,maxX:Math.max(0,r-t),maxY:Math.max(0,i-n)}},clampFab(e,t){let n=this.fabBounds();return[Math.min(Math.max(e,n.minX),n.maxX),Math.min(Math.max(t,n.minY),n.maxY)]},fabInitPosition(){let e=this.$refs.aiFab;if(!e)return;let t=this.loadFabPos(),n=document.documentElement.clientWidth,r=document.documentElement.clientHeight,i,a;if(t)[i,a]=this.clampFab(t.x,t.y);else{let t=e.getBoundingClientRect();[i,a]=this.clampFab(n-t.right,r-t.bottom)}this.fab.x=i,this.fab.y=a},loadFabPos(){try{let e=localStorage.getItem(`cardbuddy:ai-fab-pos`);if(!e)return null;let t=JSON.parse(e);if(typeof t.x==`number`&&typeof t.y==`number`&&isFinite(t.x)&&isFinite(t.y))return t}catch{}return null},saveFabPos(){try{localStorage.setItem(`cardbuddy:ai-fab-pos`,JSON.stringify({x:this.fab.x,y:this.fab.y}))}catch{}},onFabPointerDown(e){if(!this.aiChatOpen){this.fabSuppressClick=!1,this.fab.x??this.fabInitPosition(),this.fabDrag={pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,originX:this.fab.x,originY:this.fab.y,moved:!1};try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}}},onFabPointerMove(e){let t=this.fabDrag;if(!t||t.pointerId!==e.pointerId)return;let n=e.clientX-t.startX,r=e.clientY-t.startY;if(!t.moved){if(Math.hypot(n,r)<4)return;t.moved=!0,this.fab.dragging=!0}let[i,a]=this.clampFab(t.originX-n,t.originY-r);this.fab.x=i,this.fab.y=a},onFabPointerUp(e){let t=this.fabDrag;if(!t||t.pointerId!==e.pointerId)this.fab.dragging=!1;else{try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}t.moved&&(this.fabSuppressClick=!0,this.saveFabPos()),this.fab.dragging=!1,this.fabDrag=null}},onFabClick(){this.fabSuppressClick?this.fabSuppressClick=!1:this.aiChatOpen=!this.aiChatOpen},onFabResize(){if(this.fab.x==null)return;let[e,t]=this.clampFab(this.fab.x,this.fab.y);this.fab.x=e,this.fab.y=t},setupCardsChanged(){if(this._unsubCardsChanged){try{this._unsubCardsChanged()}catch{}this._unsubCardsChanged=null}this.devSvcLive=`connecting`,this._unsubCardsChanged=eu(e=>this.onCardsChanged(e),e=>this.onDevServiceState(e))},onDevServiceState(e){let t=this.devSvcLive===`connecting`;this.devSvcLive=e,e===`open`?this.devSvcDown=!1:e===`closed`&&(this.devSvcDown=!0),e===`connecting`?!t&&!this._svcWatchdog&&(this._svcWatchdog=setTimeout(()=>{this.devSvcLive===`connecting`&&(this.devSvcLive=`closed`,this.devSvcDown=!0),this._svcWatchdog=null},8e3)):this._svcWatchdog&&=(clearTimeout(this._svcWatchdog),null)},saveDevService(){ql(this.devServiceForm),this.apiBaseResolved=Jl(),this.setupCardsChanged(),this.devServiceOpen=!1,Q(`本地开发服务配置已保存`,`ok`),this.fetchCardList()},beginColumnDrag(e,t,n){let r=e&&e.currentTarget;if(!r)return;let i=e.pointerId;try{r.setPointerCapture(i)}catch{}let a=()=>{r.removeEventListener(`pointermove`,t),r.removeEventListener(`pointerup`,a),r.removeEventListener(`pointercancel`,a),window.removeEventListener(`blur`,a);try{r.hasPointerCapture?.(i)&&r.releasePointerCapture(i)}catch{}document.body.style.cursor=``,document.body.style.userSelect=``,n()};document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,r.addEventListener(`pointermove`,t),r.addEventListener(`pointerup`,a),r.addEventListener(`pointercancel`,a),window.addEventListener(`blur`,a)},startDrag(e){if(this.chromeOff)return;let t=this.$refs.stageEl;if(!t)return;let n=t.getBoundingClientRect().left;this.dragging=!0,this.beginColumnDrag(e,e=>{let{min:t,max:r}=this.previewBounds;this._previewWidthPx=Math.max(t,Math.min(r,Math.round(e.clientX-n)))},()=>{this.dragging=!1,this.savePreviewWidth()})},startApiDrag(e){if(this.chromeOff||!this.apiPanelOpen)return;let t=this.$refs.colsEl;if(!t)return;let n=t.getBoundingClientRect().right;this.apiDragging=!0,this.beginColumnDrag(e,e=>{let{min:t,max:r}=this.apiPanelBounds;this._apiPanelWidthPx=Math.max(t,Math.min(r,Math.round(n-e.clientX)))},()=>{this.apiDragging=!1,this.saveApiPanelWidth()})},loadCanvasBg(){try{let e=localStorage.getItem(`cardbuddy:canvas-bg`);e!=null&&this.bgOptions.some(t=>t.key===e)&&(this.canvasBg=e)}catch{}},saveCanvasBg(){try{localStorage.setItem(`cardbuddy:canvas-bg`,this.canvasBg)}catch{}},loadPreviewWidth(){try{let e=localStorage.getItem(`cardbuddy:preview-width`);if(e!=null){let t=parseInt(e,10);!Number.isNaN(t)&&t>=188&&(this._previewWidthPx=t)}}catch{}},savePreviewWidth(){try{localStorage.setItem(`cardbuddy:preview-width`,String(Math.round(this._previewWidthPx)))}catch{}},setPresetWidth(e){if(this.chromeOff)return;let{min:t,max:n}=this.previewBounds;this._previewWidthPx=Math.max(t,Math.min(n,e)),this.savePreviewWidth()},loadApiPanelWidth(){try{let e=localStorage.getItem(`cardbuddy:api-panel-width`);if(e!=null){let t=parseInt(e,10);!Number.isNaN(t)&&t>=320&&(this._apiPanelWidthPx=t)}}catch{}},saveApiPanelWidth(){try{localStorage.setItem(`cardbuddy:api-panel-width`,String(Math.round(this.apiPanelWidth)))}catch{}},chooseBg(e){this.canvasBg=e,this.saveCanvasBg()},onSelect(e){e!==this.selectedId&&(this.remoteBusy?Q(`远端操作进行中(${this.remoteBusyReason}),完成前不能切换卡片`,`err`,3200):this.chatBusy?Q(`AI 正在生成「${this.selectedId}」:先点 ■ 停止,或等本轮结束后再切卡`,`err`,3600):(this.loadingCard=!0,this.selectedId=e,this.loadCard(e,{clearAll:!0})))},selectCard(e){this.selectedId=e;try{localStorage.setItem(`cardbuddy:selected-card`,e)}catch{}},openGallery(){this.cardList.length&&(this.galleryOpen=!0)},openNewCard(){this.cardDialog.mode=`create`,this.cardDialog.cardId=``,this.cardDialog.cardDesc=``,this.cardDialog.visible=!0,this.fetchCardList()},openRenameCard(){this.selectedId&&(this.cardDialog.mode=`rename`,this.cardDialog.cardId=this.selectedId,this.cardDialog.cardDesc=this.currentSchema&&this.currentSchema.desc||``,this.cardDialog.visible=!0,this.fetchCardList())},async onCardRenamed({oldId:e,id:t}){if(this.cardDialog.visible=!1,Q(t===e?`已更新卡片描述`:`已重命名卡片 ${e} → ${t}`,`ok`),t!==e)return this.applyCardRename(e,t);await this.fetchCardList(),await this.loadCard(t)},async applyCardRename(e,t){if(!e||!t||e===t)return;let n=`${e}->${t}`;if(this._renameAppliedKey===n)return;this._renameAppliedKey=n,setTimeout(()=>{this._renameAppliedKey===n&&(this._renameAppliedKey=``)},1e3);let r=this.selectedId===e;this.$refs.chatPanel?.migrateCard(e,t),r&&this.selectCard(t),this.selfSaveId=t,this.selfSaveAt=Date.now(),await this.fetchCardList(),r&&(this.historyDirty&&!this.confirm.show?this.requestConfirm({title:`卡片已重命名`,message:`卡片「${e}」已重命名为「${t}」,而编辑器内还有未保存的改动。\n重新载入会放弃这些未保存改动并显示磁盘版本;保留改动则继续用当前编辑器内容(后续保存会写到新目录 ${t})。`,confirmText:`重新载入`,cancelText:`保留我的改动`,onConfirm:()=>this.loadCard(t)}):await this.loadCard(t))},closeGallery(){this.galleryOpen=!1},onGalleryExport(e){!this.exportProgressOpen&&e&&e.length&&(this.exportDirDialog={visible:!0,ids:e})},async onGalleryCompile(e){if(!this.compilingCards&&e&&e.length){this.compilingCards=!0;try{let t=await Y(`/__compile-cards`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cardIds:e})}),n=await t.json().catch(()=>({}));if(!t.ok||!n.ok)throw Error(n.message||n.error||`HTTP `+t.status);let r=(n.cards||[]).filter(e=>e.ok),i=(n.cards||[]).filter(e=>!e.ok),a=r.reduce((e,t)=>e+(t.warnings?t.warnings.length:0),0);console.info(`[compile] 产物目录`,n.outDir);for(let e of r){console.info(`[compile] ${e.id} 模板 ${e.templates} 个 / 节点 ${e.nodes} / 客户端 ${e.clientBytes}B / H5 ${e.h5Bytes}B`);for(let t of e.warnings||[])console.warn(`[compile] ${e.id} ${t}`)}for(let e of i)console.error(`[compile] ${e.id} 失败:${e.error}`);if(i.length)Q(`已编译 ${r.length} 张,${i.length} 张失败(原因见控制台)`,`err`,4200);else{let e=a?`(${a} 条告警见控制台)`:``;Q(`已编译 ${r.length} 张卡片,客户端模板与 H5 脚本已写入 flame-build 目录${e}`,`ok`,3600)}this.$refs.cardGallery?.setChecked(i.map(e=>e.id))}catch(e){Q(`编译失败:`+(e&&e.message?e.message:`无法连接本地开发服务`),`err`,4200)}finally{this.compilingCards=!1}}},async onExportDirConfirm(e){this.exportDirDialog.visible=!1;let t=this.exportDirDialog.ids;try{let n=await Y(`/__export-cards`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cardIds:t,targetDir:e})}),r=await n.json().catch(()=>({}));if(!n.ok||!r.ok)throw Error(r.message||r.error||`HTTP `+n.status);this.exportJobId=r.jobId,this.exportProgress={done:0,total:Number(r.total)||0,current:``},this.exportProgressOpen=!0,this.pollExportProgress()}catch(e){this.exportDirDialog.ids=[],Q(`启动导出失败:`+(e&&e.message),`err`)}},pollExportProgress(){this.exportPollTimer&&clearTimeout(this.exportPollTimer);let e=async()=>{if(this.exportJobId&&this.exportProgressOpen){try{let e=await Y(`/__export/progress?jobId=`+encodeURIComponent(this.exportJobId)),t=await e.json().catch(()=>({}));if(!e.ok||!t.ok)throw Error(t.message||`进度查询失败`);if(this.exportProgress={done:Number(t.done)||0,total:Number(t.total)||0,current:t.currentTitle||t.currentId||``},t.finished){this.onExportJobFinished(t.result||{});return}}catch(e){console.error(`[导出进度查询失败]`,e)}this.exportPollTimer=setTimeout(e,600)}};e()},stopExportPolling(){this.exportPollTimer&&=(clearTimeout(this.exportPollTimer),null)},onExportJobFinished(e){this.stopExportPolling(),this.exportProgressOpen=!1,this.exportJobId=``,this.exportDirDialog.ids=[];let t=e.failed||[],n=e.warnings||[];if(t.length&&console.warn(`[导出失败明细]`,t),n.length&&console.warn(`[导出告警明细]`,n),!e.cancelled&&e.success&&this.$refs.cardGallery?.setChecked(t.map(e=>e&&e.id).filter(Boolean)),e.cancelled){let t=e.exported||0;Q(t?`导出已取消(已完成 ${t} 张,未生成 zip)`:`导出已取消`,`ok`)}else if(e.success){let r=e.exported||0,i=t.length,a=e.folderName?`${e.folderName}.zip`:`zip`,o=e.revealed?`,已打开所在目录`:``,s=i?`(${t[0].id||`?`}:${String(t[0].error||``).slice(0,60)})`:``,c=n.length?`,${n.length} 条告警见控制台`:``;Q(i?`导出完成:成功 ${r} 张,失败 ${i} 张${s} → ${a}${o}${c}`:`导出成功:${a}(${r} 张卡片)${o}${c}`,i?`warn`:`ok`)}else Q(`导出失败:`+(e.error||`未知错误`),`err`)},cancelExportJob(){this.exportJobId&&Y(`/__export/cancel`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({jobId:this.exportJobId})}).catch(()=>{})},async openCardFolder(){if(this.selectedId)try{let e=await Y(`/__open-folder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({id:this.selectedId})}),t=(e.headers.get(`content-type`)||``).includes(`application/json`)?await e.json().catch(()=>({})):{};!e.ok||!t.ok?Q(t.error||`打开文件夹失败`,`err`):Q(`已打开卡片文件夹`,`ok`)}catch{Q(`无法连接本地开发服务,请确认已启动`,`err`)}},async refreshCard(){if(this.selectedId&&!this.refreshing){this.refreshing=!0;try{await this.loadCard(this.selectedId)}finally{this.refreshing=!1}}},toggleApiPanel(){this.apiPanelOpen=!this.apiPanelOpen},async refreshValidateBadge(){let e=this.selectedId;if(e&&this.preview&&(this.validateTimer&&clearTimeout(this.validateTimer),this.validateBadge={...this.validateBadge,state:`pending`},await new Promise(e=>{this.validateTimer=setTimeout(e,120)}),this.selectedId===e))try{let[t,n]=await Promise.all([Y(`/__validate/${encodeURIComponent(e)}`),Y(`/__render-status/${encodeURIComponent(e)}`)]);if(!t.ok){this.validateBadge={...this.validateBadge,state:t.status===503?`nopython`:`fail`};return}let r=await t.json().catch(()=>null),i=n.ok?await n.json().catch(()=>null):null;if(!r){this.validateBadge={...this.validateBadge,state:`fail`};return}let a=!!r.ok,o=!i||!!i.renderOk,s=a&&o?`ok`:`error`,c=this.validateBadge.state!==s;this.validateBadge={state:s,errors:(r.errors||[]).length,warnings:(r.warnings||[]).length,renderOk:o,ts:Date.now()},c&&(s===`ok`||s===`error`)&&this.celebrateValidate(s)}catch{this.validateBadge={...this.validateBadge,state:`fail`}}},celebrateValidate(e=`ok`){let t=this.$refs.validateBadgeEl;if(!t||window.matchMedia&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;t.classList.remove(`is-celebrating`),t.offsetWidth,t.classList.add(`is-celebrating`),setTimeout(()=>t.classList.remove(`is-celebrating`),600);let n=t.getBoundingClientRect(),r={ok:`--ok`,error:`--danger`,pending:`--warn`,fail:`--text-faint`,nopython:`--text-faint`}[e]||`--ok`,i={ok:`#52c41a`,error:`#F5222D`,pending:`#FAAD14`,fail:`#8c8c8c`,nopython:`#8c8c8c`}[e]||`#52c41a`,a=getComputedStyle(t).getPropertyValue(r).trim()||i,o=document.createElement(`div`);o.className=`app__confetti`,o.style.left=n.left+n.width/2+`px`,o.style.top=n.top+n.height/2+`px`;let s=[`polygon(50% 0%, 0% 100%, 100% 100%)`,`polygon(62% 0%, 100% 40%, 45% 100%, 0% 52%)`,`polygon(0% 0%, 100% 18%, 82% 100%, 12% 70%)`,`polygon(22% 0%, 100% 8%, 88% 100%, 0% 76%)`,`polygon(0% 32%, 100% 0%, 76% 100%, 18% 86%)`,`polygon(8% 0%, 100% 22%, 70% 100%, 0% 64%)`,`polygon(0% 12%, 100% 0%, 100% 78%, 30% 100%, 12% 55%)`],c=n.width/2,l=n.height/2;for(let e=0;e<22;e++){let e=document.createElement(`span`);e.className=`app__confetti-bit`;let t=Math.random()*4|0,n,r;t===0?(n=(Math.random()*2-1)*c,r=-l):t===1?(n=c,r=(Math.random()*2-1)*l):t===2?(n=(Math.random()*2-1)*c,r=l):(n=-c,r=(Math.random()*2-1)*l);let i=Math.hypot(n,r)||1,u=Math.atan2(r/i,n/i)+(Math.random()-.5)*.5,d=16+Math.random()*26;e.style.setProperty(`--sx`,n.toFixed(1)+`px`),e.style.setProperty(`--sy`,r.toFixed(1)+`px`),e.style.setProperty(`--tx`,(Math.cos(u)*d).toFixed(1)+`px`),e.style.setProperty(`--ty`,(Math.sin(u)*d).toFixed(1)+`px`),e.style.setProperty(`--rot`,(Math.random()*720-360).toFixed(0)+`deg`),e.style.setProperty(`--clip`,s[Math.random()*s.length|0]),e.style.setProperty(`--c`,a),e.style.setProperty(`--o`,(.68+Math.random()*.27).toFixed(2));let f=Math.random(),p,m;f<.35?(p=1.5+Math.random()*2,m=10+Math.random()*10):f<.75?(p=4+Math.random()*5,m=p*(.6+Math.random()*.8)):(p=2+Math.random()*2.5,m=p),e.style.width=p.toFixed(0)+`px`,e.style.height=m.toFixed(0)+`px`,o.appendChild(e)}document.body.appendChild(o),setTimeout(()=>o.remove(),800)},async loadCard(e,t={}){if(e){this.loadingCard=!0;try{let n=await Y(`/__card/${encodeURIComponent(e)}`);if(!n.ok){this.rt.pushError(`loadCard`,`HTTP `+n.status);return}let r=await n.json();if(!r.schema){this.rt.pushError(`loadCard`,`schema 读取失败`);return}this.selectCard(e),e!==this.loadedCardId&&(this.activeTab=`vars`),this.loadedCardId=e,t.clearAll?this.rt.clearErrors():this.rt.clearBindingErrors(),this.rt.clearApiCalls(),t.keepScope||this.rt.setRootScope(mv(r.schema,fG)),this.currentCard={schema:r.schema},this.currentSchema=r.schema,this.cardImportMeta=null,this.fetchImportMeta(e),this.localSchema=this.cloneSchema(r.schema),this.localData=this.cloneData(mv(r.schema,fG)),this.preview=qu(r.schema),typeof window<`u`&&(window.__cardModel=$u(r.schema)),this.cardReady=!1,this.$nextTick(()=>{this.cardReady=!0}),this.syncDataToSchema(),this.selectedNodeId=``,this.baseline={schema:this.cloneSchema(this.currentSchema)},this.reloadToken+=1,RS(),TD(),this.refreshValidateBadge(),await this.loadHistory(e)}finally{this.loadingCard=!1}}},cloneSchema(e){return e?JSON.parse(JSON.stringify(e,(e,t)=>e===`_schemaNode`?void 0:t)):null},cloneData(e){return e==null?e:JSON.parse(JSON.stringify(e,(e,t)=>e===`_schemaNode`?void 0:t))},applySchemaSnapshot(e){if(!this.selectedId||!e)return;let t=e.schema||e,n=e.data==null?mv(t,fG):e.data;this.currentSchema=this.cloneSchema(t),this.rt.setRootScope(this.cloneData(n)),this.preview=qu(this.currentSchema),typeof window<`u`&&(window.__cardModel=$u(this.currentSchema)),this.syncDataToSchema(),this.selectedNodeId=``,this.reloadToken+=1,this.refreshValidateBadge()},commitHistory(){if(!this.currentSchema||!this.baseline||!dG(this.currentSchema,this.baseline.schema,this.rt.rootScope))return;let e={schema:this.baseline.schema};this.past.push(e),this.past.length>30&&this.past.shift(),this.future=[],this.baseline={schema:this.cloneSchema(this.currentSchema)},this.persistSnapshot(e)},scheduleCommit(){this._commitTimer&&clearTimeout(this._commitTimer),this._commitTimer=setTimeout(()=>{this._commitTimer=null,this.commitHistory()},500)},persistSnapshot(e){let t=this.selectedId;if(!t)return;let n=e.schema||e;Y(`/__history/${encodeURIComponent(t)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({schema:n},(e,t)=>e===`_schemaNode`?void 0:t,2)}).catch(e=>console.warn(`[历史快照落盘失败]`,e))},async loadHistory(e){this.past=[],this.future=[];try{let t=await Y(`/__history/${encodeURIComponent(e)}`);if(!t.ok)return;let n=await t.json().catch(()=>null),r=n&&n.snapshots||[];this.past=r.slice(-30).map(e=>({schema:e.schema,data:e.data==null?mv(e.schema,fG):e.data}))}catch(e){console.warn(`[加载编辑历史失败]`,e)}},undo(){if(!this.canUndo||this.remoteBusy)return;let e=this.past.pop();this.future.push(this.baseline),this.future.length>30&&this.future.shift(),this.baseline=e,this.applySchemaSnapshot(e)},redo(){if(!this.canRedo||this.remoteBusy)return;let e=this.future.pop();this.past.push(this.baseline),this.past.length>30&&this.past.shift(),this.baseline=e,this.applySchemaSnapshot(e)},async applyHistoryToLocal(){this.loadingCard||this.remoteBusy||this.historyDirty&&this.preview&&this.selectedId&&await this.saveCard()&&(this.credentialsReady&&this.hasCardSource?(Q(`已保存到本地,正在同步至远端…`,`ok`),Promise.resolve(this.saveToRemote({fromAutoSave:!0})).then(e=>{e&&(e.ok?e.verified===!1?Q(`已保存到本地,远端已提交但读回校验未通过`,`warn`,4200):Q(`已保存到本地并同步至远端`,`ok`):Q(`已保存到本地,但同步至远端失败`+(e.message?`:`+e.message:``),`warn`,4200))}).catch(()=>{})):Q(`已将该版本保存到本地`,`ok`))},async generateCardCover(){if(!this.preview||!this.selectedId||this.coverBusy||this.remoteBusy)return;if(this.historyDirty&&!await this.saveCard()){Q(`本地保存失败,已取消生成预览图`,`err`);return}let e=null;try{let t=await Y(`/__card-image/`+encodeURIComponent(this.selectedId)+`?probe=1`),n=await t.json().catch(()=>({}));t.ok&&n.exists&&(e=n.file)}catch{}e?this.requestConfirm({title:`重新生成截图`,message:`该卡片已有截图(${e}),继续将覆盖它。确定重新生成吗?`,confirmText:`重新生成`,severity:`warn`,onConfirm:()=>this.doGenerateCover()}):this.doGenerateCover()},async doGenerateCover(){this.coverBusy=!0;try{let e=await Y(`/__card-image/`+encodeURIComponent(this.selectedId),{method:`POST`}),t=await e.json().catch(()=>({}));if(!e.ok)throw Error(t.message||`HTTP `+e.status);Q(`截图已生成(${t.width}×${t.height})→ ${t.file}`,`ok`,3e3)}catch(e){Q(`生成截图失败:`+String(e&&e.message||e),`err`,3600)}finally{this.coverBusy=!1}},onSchemaChanged(){this.selectedId&&this.currentSchema&&(this.reloadToken+=1,this.preview=qu(this.currentSchema),typeof window<`u`&&(window.__cardModel=$u(this.currentSchema)),this.syncDataToSchema(),this.selectedNodeId=``)},onSchemaCommit(){this.selectedId&&this.currentSchema&&(this.reloadToken+=1,this.preview=qu(this.currentSchema),typeof window<`u`&&(window.__cardModel=$u(this.currentSchema)),this.syncDataToSchema(),this.selectedNodeId=``,this.commitHistory())},syncDataToSchema(){let e=this.currentSchema;if(!e||!e.dictionary||!Array.isArray(e.dictionary.inputParams))return;let t=this.rt&&this.rt.rootScope;if(!t||typeof t!=`object`)return;let n=e.dictionary.inputParams,r=hv(e);for(let e of Object.keys(t)){let i=n.find(t=>t&&(t.key===e||t.name===e));if(!i)continue;let a=JSON.parse(JSON.stringify(t[e],(e,t)=>e===`_schemaNode`?void 0:t));r&&Object.prototype.hasOwnProperty.call(r,e)?r[e]=a:i.defaultValue=a}},onSelectNode(e){this.selectedNodeId=e||``},findPreviewNodeById(e,t){if(!e||t==null)return null;let n=String(t),r=e=>{if(!e)return null;if(String(e.id)===n)return e;let t=[];if(e.components&&t.push(...e.components),e.slots)for(let n of e.slots)n.components&&t.push(...n.components);for(let e of t){let t=r(e);if(t)return t}return null};return r(e)},copySelectedNode(){let e=this.selectedNodeId;if(!e||e===`_root`||!this.currentSchema||!this.preview)return;let t=this.findPreviewNodeById(this.preview.view,e);if(!t)return;let n=this.findSchemaNodeByComponentId(this.currentSchema.view,t.componentId);n&&(rd(n.node,this.selectedId),Q(`已复制节点(含子节点)`,`ok`))},pasteNode(){let e=td();if(!e||!this.currentSchema)return;let t=id(e),n=[...new Set(t.filter(e=>!ju[e]))];if(n.length){Q(`粘贴失败:含未知组件类型 `+n.join(`、`),`err`);return}let r=JSON.parse(JSON.stringify(e,(e,t)=>e===`_schemaNode`?void 0:t));ad(r);let i=this.selectedNodeId&&this.selectedNodeId!==`_root`?this.findPreviewNodeById(this.preview.view,this.selectedNodeId):null,a=`root`;i&&(a=Wu(i.className)?`into`:`after`),this.insertClone(r,i,a);let o=nd();o&&o!==this.selectedId?Q(`已从卡片「${o}」跨卡片粘贴到「${this.selectedId}」`,`ok`):Q(`已粘贴节点(含子节点)`,`ok`)},duplicateNode(){let e=this.selectedNodeId;if(!e||e===`_root`||!this.currentSchema||!this.preview)return;let t=this.findPreviewNodeById(this.preview.view,e);if(!t)return;let n=this.findSchemaNodeByComponentId(this.currentSchema.view,t.componentId);if(!n)return;let r=JSON.parse(JSON.stringify(n.node,(e,t)=>e===`_schemaNode`?void 0:t));ad(r),n.parentArr.splice(n.index+1,0,r),this.afterStructuralEdit(r.componentId)},insertClone(e,t,n){let r=this.currentSchema;if(n===`root`)r.view.components||(r.view.components=[]),r.view.components.push(e);else if(n===`into`){let n=t&&t._schemaNode;if(!n){r.view.components||(r.view.components=[]),r.view.components.push(e),this.afterStructuralEdit(e.componentId);return}let i=Gu(t.className),a=(n.slots||[]).find(e=>e.slotKey===i);a||(n.slots||=[],a={slotKey:i,slotScope:!1,slotSwitch:`1`,components:[]},n.slots.push(a)),a.components||(a.components=[]),a.components.push(e)}else{let n=this.findSchemaNodeByComponentId(r.view,t.componentId);n?n.parentArr.splice(n.index+1,0,e):(r.view.components||(r.view.components=[]),r.view.components.push(e))}this.afterStructuralEdit(e.componentId)},afterStructuralEdit(e){let t=this.currentSchema;this.reloadToken+=1,this.preview=qu(t),typeof window<`u`&&(window.__cardModel=$u(t)),this.syncDataToSchema(),this.selectedNodeId=e&&this.findViewIdByComponentId(this.preview.view,e)||``,this.scheduleCommit()},deleteSelectedNode(){let e=this.selectedNodeId;if(!e||e===`_root`||!this.currentSchema||!this.preview)return;let t=this.findPreviewNodeById(this.preview.view,e);if(!t)return;let n=this.findSchemaNodeByComponentId(this.currentSchema.view,t.componentId);n&&(n.parentArr.splice(n.index,1),this.reloadToken+=1,this.preview=qu(this.currentSchema),typeof window<`u`&&(window.__cardModel=$u(this.currentSchema)),this.syncDataToSchema(),this.selectedNodeId=``,yO(),this.scheduleCommit())},hasTextSelection(){if(typeof window>`u`||!window.getSelection)return!1;let e=window.getSelection();return!!e&&!e.isCollapsed&&e.toString().trim()!==``},hasNodeSelection(){return!!this.selectedNodeId&&this.selectedNodeId!==`_root`},isEditableTarget(e){let t=e.target;if(!t)return!1;let n=t.tagName;return!!(n===`INPUT`||n===`TEXTAREA`||n===`SELECT`||t.isContentEditable)},onKeydown(e){if(this.chromeOff||!this.preview)return;let t=this.isEditableTarget(e),n=e.ctrlKey||e.metaKey,r=e.key;if(n&&(r===`c`||r===`C`)){if(t||this.hasTextSelection()||!this.hasNodeSelection())return;this.copySelectedNode(),e.preventDefault()}else if(n&&(r===`v`||r===`V`)){if(t||this.hasTextSelection()||!this.hasNodeSelection()||!td())return;this.pasteNode(),e.preventDefault()}else if(n&&(r===`d`||r===`D`)){if(t||this.hasTextSelection()||!this.hasNodeSelection())return;this.duplicateNode(),e.preventDefault()}else if(n&&(r===`z`||r===`Z`)){if(t)return;e.preventDefault(),e.shiftKey?this.redo():this.undo()}else if(n&&(r===`y`||r===`Y`)){if(t)return;e.preventDefault(),this.redo()}else if(r===`Delete`||r===`Backspace`){if(t||!this.selectedNodeId||this.selectedNodeId===`_root`)return;e.preventDefault(),this.deleteSelectedNode()}else r===`Escape`&&this.selectedNodeId&&(this.selectedNodeId=``,e.preventDefault())},onHoverNode(e){if(!e){yO();return}if(e.leave){yO(e.id);return}let t=typeof document<`u`?document.querySelector(`.phone__screen`):null;if(!t){yO(e.id);return}let n=e=>window.CSS&&CSS.escape?CSS.escape(String(e)):String(e).replace(/["\\\]]/g,`\\$&`),r=null;e.componentId!=null&&(r=t.querySelector(`[data-cid="`+n(e.componentId)+`"]`)),!r&&e.id!=null&&(r=t.querySelector(`[data-cid="`+n(e.id)+`"]`)),r?vO(r,e.id):yO(e.id)},onCanvasClick(e){if(!e.ctrlKey&&!e.metaKey||this.chromeOff)return;let t=e.target&&e.target.closest?e.target.closest(`[data-cid]`):null;if(!t)return;let n=t.getAttribute(`data-cid`);if(!n)return;let r=this.findPreviewNodeByCid(n);r&&(this.activeTab=`structure`,this.selectedNodeId=r.id)},onAiLocateNode(e){let t=e?this.findPreviewNodeByCid(e):null;t?(this.activeTab=`structure`,this.selectedNodeId=t.id):Q(`没找到组件 ${e||``}:卡片可能已被改动,重新校验一次即可`,`err`)},findPreviewNodeByCid(e){let t=this.preview&&this.preview.view;if(!t)return null;let n=String(e),r=e=>{if(!e)return null;if(String(e.componentId==null?e.id:e.componentId)===n)return e;let t=[];if(e.components&&t.push(...e.components),e.slots)for(let n of e.slots)n.components&&t.push(...n.components);for(let e of t){let t=r(e);if(t)return t}return null};return r(t)},onAddNode(e){this.currentSchema&&(this.addNodeTarget=e||null,this.addNodePanelOpen=!0)},cancelAddNode(){this.addNodePanelOpen=!1,this.addNodeTarget=null},findSchemaLocation(e,t){let n=e=>{for(let r=0;r<e.length;r++){let i=e[r];if(i===t)return{containerArr:e,index:r};let a=i.slots||[];for(let e of a){let t=n(e.components||[]);if(t)return t}}return null};return n(e&&e.components||[])},findViewIdByComponentId(e,t){if(!e)return null;if(e.componentId===t)return e.id;let n=[];if(e.components&&n.push(...e.components),e.slots)for(let t of e.slots)t.components&&n.push(...t.components);for(let e of n){let n=this.findViewIdByComponentId(e,t);if(n)return n}return null},findSchemaNodeByComponentId(e,t){let n=(e,r)=>{for(let i=0;i<e.length;i++){let a=e[i];if(a.componentId===t)return{node:a,parentArr:e,index:i,owner:r};let o=a.slots||[];for(let e of o){let t=n(e.components||[],a);if(t)return t}}return null};return n(e&&e.components||[],`root`)},isDescendantCompId(e,t){if(!t||!t.componentId)return!1;if(t.componentId===e)return!0;let n=[];if(t.components&&n.push(...t.components),t.slots)for(let e of t.slots)e.components&&n.push(...e.components);for(let t of n)if(this.isDescendantCompId(e,t))return!0;return!1},moveNode(e,t,n){let r=this.currentSchema;if(!r||!r.view||e===t)return!1;let i=this.findSchemaNodeByComponentId(r.view,e);if(!i)return!1;let a=i.node;if(this.isDescendantCompId(t,a))return!1;let o,s;if(t===`__root__`)r.view.components||(r.view.components=[]),o=r.view.components,s=o.length;else{let e=this.findSchemaNodeByComponentId(r.view,t);if(!e)return!1;let i=e.node;if(n===`inside`){if(!Wu(i.className))return!1;let e=Gu(i.className),t=(i.slots||[]).find(t=>t.slotKey===e);t||(i.slots||=[],t={slotKey:e,slotScope:!1,slotSwitch:`1`,components:[]},i.slots.push(t)),t.components||(t.components=[]),o=t.components,s=o.length}else o=e.parentArr,s=n===`before`?e.index:e.index+1}let c=o===i.parentArr&&i.index<s;return i.parentArr.splice(i.index,1),c&&--s,o.splice(s,0,a),a},onMoveNode({sourceCompId:e,targetCompId:t,position:n}){if(!this.currentSchema||!this.moveNode(e,t,n))return;this.reloadToken+=1,this.preview=qu(this.currentSchema),typeof window<`u`&&(window.__cardModel=$u(this.currentSchema)),this.syncDataToSchema();let r=this.findViewIdByComponentId(this.preview.view,e);this.selectedNodeId=r||``,r&&(this.moveCollapseToken+=1)},onPickComponent(e){let t=this.addNodeTarget||{},n=t.node||null,r=t.mode||`auto`,i=this.currentSchema;if(!i){this.cancelAddNode();return}let a;try{a=Ku(e)}catch(e){console.error(`[创建组件节点失败]`,e),this.rt.pushError(`addNode`,String(e&&e.message)),this.cancelAddNode();return}let o=!n||n.className===`Root`;if((r===`before`||r===`after`)&&!o){let e=n._schemaNode,t=e?this.findSchemaLocation(i.view,e):null;if(!t)i.view.components||(i.view.components=[]),i.view.components.push(a);else{let e=r===`before`?t.index:t.index+1;t.containerArr.splice(e,0,a)}}else if(o)i.view.components||(i.view.components=[]),i.view.components.push(a);else{let e=n._schemaNode;if(!e){this.cancelAddNode();return}if(Wu(n.className)){let t=Gu(n.className),r=(e.slots||[]).find(e=>e.slotKey===t);r||(e.slots||=[],r={slotKey:t,slotScope:!1,slotSwitch:`1`,components:[]},e.slots.push(r)),r.components||(r.components=[]),r.components.push(a)}else{let t=this.findSchemaLocation(i.view,e);t?t.containerArr.splice(t.index+1,0,a):(i.view.components||(i.view.components=[]),i.view.components.push(a))}}this.cancelAddNode(),this.reloadToken+=1,this.preview=qu(i),typeof window<`u`&&(window.__cardModel=$u(i)),this.syncDataToSchema();let s=this.findViewIdByComponentId(this.preview.view,a.componentId);this.selectedNodeId=s||``,this.scheduleCommit()},async runSync(e){if(this.syncingRemote||e&&!this.selectedId)return;this.syncingRemote=!0,this.syncedRemote=!1,this.syncTarget=e?`selected`:`full`;let t=null,n=()=>{t&&=(clearTimeout(t),null)};try{let n=await Y(`/__sync`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e?{cardCode:e}:{})});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.message||e.error||`HTTP `+n.status)}let r=await n.json().catch(()=>({}));if(!r.ok||!r.jobId)throw Error(r.message||r.error||`同步任务启动失败`);let i=await new Promise((e,n)=>{let i=0,a=async()=>{try{let t=await Y(`/__sync/progress?jobId=`+encodeURIComponent(r.jobId)),n=await t.json().catch(()=>({}));if(!t.ok||!n.ok)throw Error(n.message||`进度查询失败`);if(n.finished){e(n.result||{});return}}catch(e){console.error(`[同步进度查询失败]`,e)}++i>=200?n(Error(`同步超时(进度查询无响应)`)):t=setTimeout(a,600)};a()});if(i.needCredentials){this.openLoginModal(`sync`);return}if(i.cancelled){Q(`同步已取消`,`ok`);return}if(!i.success){let e=(i.failed||[]).map(e=>`${e.id}: ${e.error}`).join(`; `);throw Error(e||i.error||`同步失败`)}this.syncedRemote=!0,this.credentialsReady=!0,this.syncTimer&&clearTimeout(this.syncTimer),this.syncTimer=setTimeout(()=>{this.syncedRemote=!1,this.syncTarget=null},1800),await this.onRefresh(),Q(this.syncTarget===`selected`?`已拉取最新卡到本地`:`拉取全部卡完成`,`ok`),this.persistRemoteVersion(this.selectedId,null)}catch(e){console.error(`[同步远程数据失败]`,e),Q(`同步失败:`+(e&&e.message),`err`)}finally{n(),this.syncingRemote=!1}},syncSelected(){return this.runSync(this.selectedId)},async openRemoteAllCards(){if(this.syncProgressOpen||this.syncingRemote)return;this.remoteAllOpen=!0;let e=this.readRemoteCardsCache();if(e){if(this.remoteCards=e.cards,this.remoteCardsError=``,this.remoteCardsLoading=!1,Date.now()-e.at<gG)return;this.revalidateRemoteCards()}else await this.fetchRemoteCards()},async fetchRemoteCards(){this.remoteCardsLoading=!0,this.remoteCardsError=``;try{let e=await Y(`/__remote-cards`),t=await e.json().catch(()=>({}));if(t.needCredentials){this.remoteAllOpen=!1,this.openLoginModal(`remote-all`);return}if(!e.ok||!t.ok)throw Error(t.message||t.error||`HTTP `+e.status);let n=Array.isArray(t.cards)?t.cards:[];this.remoteCards=n,this.writeRemoteCardsCache(n)}catch(e){this.remoteCardsError=e&&e.message||`远端卡片列表加载失败`}finally{this.remoteCardsLoading=!1}},async revalidateRemoteCards(){if(!this.remoteCardsRefreshing){this.remoteCardsRefreshing=!0;try{let e=await Y(`/__remote-cards`),t=await e.json().catch(()=>({}));if(!e.ok||!t.ok||t.needCredentials)return;let n=Array.isArray(t.cards)?t.cards:[];this.remoteCards=n,this.remoteCardsError=``,this.writeRemoteCardsCache(n)}catch{}finally{this.remoteCardsRefreshing=!1}}},readRemoteCardsCache(){if(this._remoteCardsMem)return this._remoteCardsMem;let e=_G();return e&&(this._remoteCardsMem=e),e},writeRemoteCardsCache(e){let t={v:1,at:Date.now(),cards:e};this._remoteCardsMem=t,vG(e)},closeRemoteAllCards(){this.remoteAllOpen=!1,this.remoteCardFormOpen=!1},openRemoteCardCreate(){this.remoteCardFormMode=`create`,this.remoteCardFormCard=null,this.remoteCardFormOpen=!0},openRemoteCardEdit(e){e&&(this.remoteCardFormMode=`edit`,this.remoteCardFormCard=e,this.remoteCardFormOpen=!0)},requestDeleteRemoteCard(e){if(!e||this.remoteCardDeletingId)return;let t=e.title||e.id;this.requestConfirm({title:`删除远端卡片`,message:`即将从远端删除卡片「${t}」(${e.id})。删除后该卡片及其发布记录将从远端移除,且无法恢复——此操作不可撤销。本地 src/cards 下的同名目录不受影响。`,confirmText:`删除`,severity:`danger`,onConfirm:()=>this.deleteRemoteCardItem(e)})},async deleteRemoteCardItem(e){if(!e||!e.cardId)Q(`删除失败:该卡片缺少远端主键 cardId,请刷新列表后重试`,`err`,3600);else{this.remoteCardDeletingId=e.id;try{let t=await Y(`/__remote-card/delete`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cardId:e.cardId})}),n=await t.json().catch(()=>({}));if(n.needCredentials){this.openLoginModal(`remote-all`);return}if(!t.ok||!n.ok)throw Error(n.message||n.error||`HTTP `+t.status);Q(`已删除远端卡片 ${e.id}`,`ok`),this.revalidateRemoteCards()}catch(e){Q(`删除失败:`+(e&&e.message||e),`err`,3600)}finally{this.remoteCardDeletingId=``}}},onRemoteCardSubmitted({mode:e,code:t}){this.remoteCardFormOpen=!1,Q(e===`edit`?`已更新远端卡片 ${t} 的基本信息`:`已在远端新建卡片 ${t}`,`ok`),this.revalidateRemoteCards()},requestDownloadSelected(e){!this.syncProgressOpen&&e&&e.length&&this.requestConfirm({title:`下载选中卡片`,message:`即将从远端拉取 ${e.length} 张卡片并覆盖本地同名卡(已有内容将被替换,不可撤销)。是否继续?`,confirmText:`开始下载`,severity:`warn`,onConfirm:()=>this.startSyncJob(e)})},requestDownloadAll(){this.syncProgressOpen||this.requestConfirm({title:`下载全部卡片`,message:`即将从远端拉取完整卡片列表,并逐张覆盖本地同名卡片。本地独有卡片会保留,但被覆盖卡片的未保存改动将丢失,且无法撤销。是否继续?`,confirmText:`开始下载`,severity:`warn`,onConfirm:()=>this.startSyncJob(null)})},async startSyncJob(e){this.syncPendingCodes=e;try{let t=await Y(`/__sync`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e?{cardCodes:e}:{})}),n=await t.json().catch(()=>({}));if(n.needCredentials){this.openLoginModal(`remote-all`);return}if(!t.ok||!n.ok)throw Error(n.message||n.error||`HTTP `+t.status);this.syncJobId=n.jobId,this.syncProgress={done:0,total:Number(n.total)||0,current:``},this.syncProgressOpen=!0,this.pollSyncProgress()}catch(e){this.syncPendingCodes=void 0,Q(`启动下载失败:`+(e&&e.message),`err`)}},pollSyncProgress(){this.syncPollTimer&&clearTimeout(this.syncPollTimer);let e=async()=>{if(this.syncJobId&&this.syncProgressOpen){try{let e=await Y(`/__sync/progress?jobId=`+encodeURIComponent(this.syncJobId)),t=await e.json().catch(()=>({}));if(!e.ok||!t.ok)throw Error(t.message||`进度查询失败`);if(this.syncProgress={done:Number(t.done)||0,total:Number(t.total)||0,current:t.currentTitle||t.currentId||``},t.finished){this.onSyncJobFinished(t.result||{});return}}catch(e){console.error(`[同步进度查询失败]`,e)}this.syncPollTimer=setTimeout(e,600)}};e()},stopSyncPolling(){this.syncPollTimer&&=(clearTimeout(this.syncPollTimer),null)},async onSyncJobFinished(e){if(this.stopSyncPolling(),this.syncProgressOpen=!1,this.syncJobId=``,e.needCredentials){this.openLoginModal(`remote-all`);return}let t=this.syncPendingCodes;if(this.syncPendingCodes=void 0,e.cancelled){let t=(e.synced||[]).length;Q(t?`下载已取消(已完成 ${t} 张)`:`下载已取消`,`ok`)}else if(e.success){let t=(e.synced||[]).length,n=(e.failed||[]).length;Q(n?`下载完成:成功 ${t} 张,失败 ${n} 张`:`下载完成:共 ${t} 张`,n?`warn`:`ok`)}else Q(`下载失败:`+(e.error||`未知错误`),`err`);if((e.success||e.cancelled)&&(this.credentialsReady=!0),await this.fetchCardList(),this.selectedId)try{await this.onRefresh()}catch{}e.success&&t&&t.length&&(this.remoteAllOpen=!1)},cancelSyncJob(){this.syncJobId&&Y(`/__sync/cancel`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({jobId:this.syncJobId})}).catch(()=>{})},async checkCredentials(){try{let e=await Y(`/__login-credentials`),t=await e.json().catch(()=>({}));this.credentialsReady=!e.ok||!!t.hasCredentials}catch{this.credentialsReady=!0}},onRemoteTrigger(e){this.remoteToggleFn=e,!this.remoteBusy&&(this.credentialsReady?e():this.openLoginModal(`dropdown`))},openLoginModal(e){this.loginModal=!0,this.loginName=``,this.loginPassword=``,this.loginError=``,this.loginPendingAction=e||``},closeLoginModal(){this.loginSubmitting||(this.loginModal=!1,this.loginPassword=``,this.loginError=``,this.loginPendingAction=``,this.remoteToggleFn=null)},async submitLogin(){if(this.loginSubmitting)return;let e=this.loginName.trim(),t=this.loginPassword;if(!e||!t)this.loginError=`账号与密码均不能为空`;else{this.loginSubmitting=!0,this.loginError=``;try{let n=await Y(`/__login-credentials`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({loginName:e,loginPassword:t})}),r=await n.json().catch(()=>({}));if(!n.ok||!r.ok)throw Error(r.message||r.error||`HTTP `+n.status);this.credentialsReady=!0,this.loginModal=!1,this.loginPassword=``,Q(`登录验证成功,凭据已保存`,`ok`);let i=this.loginPendingAction;if(this.loginPendingAction=``,i===`sync`)await this.runSync(this.syncTarget===`selected`?this.selectedId:void 0);else if(i===`publish`)await this.doPublish();else if(i===`slices`)await this.uploadCardSlices();else if(i===`dropdown`){let e=this.remoteToggleFn;this.remoteToggleFn=null,e&&this.$nextTick(()=>e())}else if(i===`remote-all`){this.remoteAllOpen=!0;let e=this.syncPendingCodes;e===void 0?this.openRemoteAllCards():this.startSyncJob(e)}}catch(e){this.loginError=e&&e.message||`登录验证失败`,this.loginPassword=``}finally{this.loginSubmitting=!1}}},chooseSync(e){this.preview&&this.selectedId&&!this.syncingRemote&&this.requestConfirm({title:`拉取最新卡`,message:`即将从远端拉取当前卡片「${this.selectedId}」的最新版本并覆盖本地。本地未保存的改动将丢失,且无法撤销。是否继续?`,confirmText:`继续同步`,onConfirm:()=>this.syncSelected()})},chooseRsave(e){if(e===`save`){if(!this.preview||!this.selectedId||this.savingRemote||!this.hasCardSource)return;this.requestConfirm({title:`推送当前卡`,message:`即将把本地卡片「${this.selectedId}」的当前版本推送并覆盖到远端。线上版本会被立即更新,且该操作不可撤销。推送成功后会为当前卡片截图并上传为远端列表预览图。是否继续?`,confirmText:`继续推送`,severity:`warn`,onConfirm:()=>this.saveToRemote()})}else if(e===`publish`){if(!this.preview||!this.selectedId||this.publishing||!this.hasCardSource)return;let e=this.historyDirty;this.requestConfirm({title:`卡片发布`,message:e?`当前卡片存在未保存到远端的改动,发布将使用远端「已保存」的版本(不含这些本地改动)。仍将以「最大版本号 +1」作为新版本号上线。确认继续?`:`即将取远端「${this.selectedId}」当前最大版本号并 +1,发布上线为新版本。发布的是远端已保存的卡片内容(建议先「推送当前卡」)。该操作不可撤销。确认继续?`,confirmText:`继续发布`,severity:e?`danger`:`warn`,onConfirm:()=>this.doPublish()})}else if(e===`slices`){if(!this.preview||!this.selectedId||this.uploadingSlices)return;this.requestConfirm({title:`当前卡切图上传`,message:`即将把当前卡片「${this.selectedId}」引用的本地切图(src/slices/)上传到远端图片库,并把卡片里的 /slices/ 引用替换为线上地址(@filestore/…)。本地切图文件保留不动;内容未变的切图会直接复用已有线上地址,不重复上传。`+(this.historyDirty?`
361
362
  当前卡片有未保存的改动,会先保存到本地再执行,避免被随后的重载丢弃。`:``)+`
362
- 是否继续?`,confirmText:`继续上传`,onConfirm:()=>this.uploadCardSlices()})}else this.preview&&this.selectedId&&this.hasCardSource&&(this.remotePreviewOpen=!0)},requestConfirm({title:e,message:t,confirmText:n,cancelText:r,severity:i,onConfirm:a}){this.confirm={show:!0,title:e,message:t,confirmText:n||`继续`,cancelText:r||`取消`,severity:[`primary`,`warn`,`danger`].includes(i)?i:`primary`,onConfirm:a}},onConfirmDialog(){let e=this.confirm.onConfirm;this.confirm.show=!1,this.confirm.onConfirm=null,typeof e==`function`&&e()},onCancelDialog(){this.confirm.show=!1,this.confirm.onConfirm=null},async doPublish(){if(this.preview&&this.selectedId&&!this.publishing&&this.hasCardSource){this.publishing=!0;try{let e=await Y(`/__publish`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({schema:this.currentSchema})});if(!e.ok){let t=await e.json().catch(()=>({}));if(t.needCredentials){this.openLoginModal(`publish`);return}throw Error(t.message||t.error||`HTTP `+e.status)}let t=await e.json();if(!t.ok)throw Error(t.message||`发布失败`);let n=t.commit,r=n&&n.committed?` · 已提交 ${n.hash||`本地变更`}`:``;Q(`已发布版本 ${t.nextVersion}${r}`,`ok`),n&&n.committed===!1&&n.reason===`failed`&&Q(`发布成功,但卡片本地变更提交失败:${n.message||`未知原因`}`,`warn`,4e3),await this.persistRemoteVersion(this.selectedId,t.nextVersion),this.metaRefreshToken++,this.historyRefreshToken++}catch(e){console.error(`[卡片发布失败]`,e),Q(`发布失败:`+(e&&e.message),`err`)}finally{this.publishing=!1}}},async persistRemoteVersion(e,t){if(e)try{let n=t==null?`{}`:JSON.stringify({version:t}),r=await Y(`/__card-version/${encodeURIComponent(e)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:n});if(!r.ok){let e=await r.json().catch(()=>({}));if(e.needCredentials)return;throw Error(e.message||`HTTP `+r.status)}}catch(e){console.warn(`[persistRemoteVersion 失败]`,e&&e.message)}},async saveCard(){if(!this.preview||!this.selectedId)return;this.savingCard=!0;let e=this.selectedId;this.selfSaveId=e,this.selfSaveAt=Date.now();try{try{let e=await this.fetchDiskCard(this.selectedId);if(e&&e.schema){let t=e.schema,n=this.currentSchema;n&&(t.pageId&&(n.pageId=t.pageId),t.name&&(n.name=t.name),t.desc!==void 0&&(n.desc=t.desc))}}catch{}this.syncDataToSchema();let e={schema:this.currentSchema},t=JSON.stringify(e,(e,t)=>e===`_schemaNode`?void 0:t,2),n=await Y(`/__card/${encodeURIComponent(this.selectedId)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:t});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.message||`HTTP `+n.status)}return this.currentCard={schema:e.schema},this.localSchema=this.cloneSchema(this.currentSchema),this.localData=this.cloneData(mv(this.currentSchema,nG)),this.savedCard=!0,this.refreshValidateBadge(),this.saveTimer&&clearTimeout(this.saveTimer),this.saveTimer=setTimeout(()=>{this.savedCard=!1},1800),!0}catch(e){return console.error(`[本地保存失败]`,e),this.rt.pushError(`saveCard`,String(e&&e.message)),this.selfSaveId=``,this.selfSaveAt=0,!1}finally{this.savingCard=!1}},async fetchDiskCard(e){let t=await Y(`/__card/${encodeURIComponent(e)}`);if(!t.ok)throw Error(`HTTP `+t.status);return t.json()},async fetchImportMeta(e){if(!e)this.setCardImportMeta(null);else try{let t=await Y(`/__import-meta/${encodeURIComponent(e)}`);if(!t.ok){this.setCardImportMeta(null);return}let n=await t.json().catch(()=>({}));this.setCardImportMeta(n&&n.meta||null)}catch{this.setCardImportMeta(null)}},setCardImportMeta(e){this.cardImportMeta=e,!(e&&e.source)&&this.activeTab===`history`&&(this.activeTab=`vars`)},async saveToRemote({fromAutoSave:e=!1}={}){if(!this.preview||!this.selectedId||this.savingRemote)return;this.savingRemote=!0,this.savedRemote=!1,this.verifiedRemote=null;let t=!1;try{if(this.historyDirty){let e=await this.saveCard();t=!!e,e||console.warn(`[推送] 本地落盘失败:预览图可能滞后于本次推送的内容`)}try{let e=await this.fetchDiskCard(this.selectedId);e&&e.schema&&e.schema.pageId&&this.currentSchema&&(this.currentSchema.pageId=e.schema.pageId)}catch{}this.syncDataToSchema(),this.selfSaveId=this.selectedId,this.selfSaveAt=Date.now();let n=await Y(`/__save`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({code:this.selectedId,schema:this.currentSchema},(e,t)=>e===`_schemaNode`?void 0:t,2)});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.message||e.error||`HTTP `+n.status)}let r=await n.json();if(!r.ok)throw Error(r.error||`远端保存失败`);this.verifiedRemote=r.verified?!!r.verified.ok:null,this.savedRemote=!0;let i=r.preview||null;if(this.verifiedRemote===!1){let t=r.verified||{},n=t.diff&&t.diff.length?`差异:`+t.diff.join(`;`):t.readBackError||`读回校验未通过`;return console.warn(`[保存校验不符]`,t),e||Q(`已保存至远端,但读回校验未通过`,`err`),{ok:!0,verified:!1,message:n,preview:i}}return e||(i&&i.ok===!1?Q(`已保存至远端,但预览图未更新:`+(i.message||i.error||`未知原因`),`warn`,3600):Q(i&&i.ok?`已保存至远端,预览图已更新`:`已保存至远端`,`ok`)),this.metaRefreshToken++,this.historyRefreshToken++,this.saveRemoteTimer&&clearTimeout(this.saveRemoteTimer),this.saveRemoteTimer=setTimeout(()=>{this.savedRemote=!1,this.verifiedRemote=null},2500),{ok:!0,verified:this.verifiedRemote,preview:i}}catch(n){return console.error(`[保存至远端失败]`,n),e||Q(`保存至远端失败:`+(n&&n.message),`err`),t||(this.selfSaveId=``,this.selfSaveAt=0),{ok:!1,verified:null,message:n&&n.message||String(n)}}finally{this.savingRemote=!1}},onRestoreHistory(e){if(!e||!this.selectedId||this.restoringHistory)return;let t=e.summary&&e.summary.componentCount!=null?`,${e.summary.componentCount} 个组件`:``;this.requestConfirm({title:`加载历史版本到编辑器`,message:`将把远端版本 #${e.id}(${e.createTime}${t})写入本地并重新载入编辑器。\n仅作加载,不会自动推送或保存到远端;当前未保存的本地编辑会被覆盖。`,confirmText:`加载此版本`,severity:`warn`,onConfirm:()=>this.restoreHistoryVersion(e)})},async restoreHistoryVersion(e){if(this.selectedId&&!this.restoringHistory){this.restoringHistory=!0;try{let t=await Y(`/__card-history/${encodeURIComponent(this.selectedId)}/restore`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({versionId:String(e.id)})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message||e.error||`HTTP `+t.status)}let n=await t.json();if(!n.ok)throw Error(n.error||`恢复历史版本失败`);if(n.needCredentials){this.openLoginModal(`history`);return}this._restoreSuppressUntil=Date.now()+iG,await this.loadCard(this.selectedId,{clearAll:!0}),Q(`已加载历史版本 #${e.id}(仅本地加载,未推送远端)`,`ok`)}catch(e){console.error(`[加载历史版本失败]`,e),Q(`加载历史版本失败:`+(e&&e.message||e),`err`)}finally{this.restoringHistory=!1}}},async uploadCardSlices(){if(!this.preview||!this.selectedId||this.uploadingSlices)return;let e=this.selectedId;this.uploadingSlices=!0;try{if(this.historyDirty&&!await this.saveCard())throw Error(`本地保存失败,已中止切图上传`);this.selfSaveId=e,this.selfSaveAt=Date.now();let t=await Y(`/__slice-upload`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cardId:e})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message||e.error||`HTTP `+t.status)}let n=await t.json();if(n.needCredentials){this.openLoginModal(`slices`);return}if(this.selfSaveAt=Date.now(),!n.success){let e=(n.failed||[]).map(e=>`${e.name}: ${e.error}`).join(`; `);throw Error(e||`切图上传失败`)}await this.onRefresh();let r=(n.rewritten||[]).reduce((e,t)=>e+t.count,0);n.referenced?Q(`当前卡切图上传完成:新上传 ${n.uploaded.length} 张、复用 ${n.skipped.length} 张,替换引用 ${r} 处`,`ok`):Q(`当前卡片没有引用本地切图,无需上传`,`ok`),n.dangling&&n.dangling.length&&Q(`有 ${n.dangling.length} 处引用的切图在 src/slices 下不存在:${n.dangling.join(`、`)}`,`err`)}catch(e){console.error(`[切图上传失败]`,e),Q(`当前卡切图上传失败:`+(e&&e.message),`err`),this.selfSaveId=``,this.selfSaveAt=0}finally{this.uploadingSlices=!1}},async syncCardMeta(e){let t=await this.fetchCardMeta(e);if(!t)return;let n=this.cardList.findIndex(t=>t.id===e);n>=0?this.cardList.splice(n,1,t):this.cardList.push(t),this.cardCount=this.cardList.length},async fetchCardMeta(e){try{let t=await Y(`/__card/`+encodeURIComponent(e)+`/meta`);return t.ok?await t.json():null}catch(e){return console.error(`[读取卡片列表项失败]`,e),null}},async fetchCardList(){try{let e=await Y(`/__cards`);if(!e.ok)return;let t=await e.json(),n=t&&t.cards||[];this.cardList=n,this.cardCount=n.length}catch(e){console.error(`[加载卡片列表失败]`,e)}},async onGalleryDelete(e){try{let t=await Y(`/__card/${encodeURIComponent(e)}`,{method:`DELETE`}),n=await t.json().catch(()=>null);if(!t.ok)throw Error(n&&(n.message||n.error)||`HTTP ${t.status}`);if(Q(`已删除本地卡片 ${e}`,`ok`),this.$refs.chatPanel?.discardCard(e),await this.fetchCardList(),this.selectedId===e){let e=this.cardList[0];e?await this.loadCard(e.id):(this.selectedId=``,this.currentSchema=null,this.preview=null)}}catch(e){Q(`删除卡片失败:${e.message}`,`err`)}},async onNewCardCreated(e){this.cardDialog.visible=!1,Q(`已创建空白卡片 ${e}`,`ok`),await this.fetchCardList(),this.chatBusy?Q(`AI 正在生成「${this.selectedId}」:新卡 ${e} 已建好,本轮结束后再切过去`,`err`,3600):await this.loadCard(e)},async onRefresh(){let e=this.selectedId;if(e&&!this.refreshing){this.refreshing=!0;try{await this.loadCard(e),await this.syncCardMeta(e);let t=this.cardList.find(t=>t.id===e);t&&this.currentSchema&&this.currentSchema.name&&(t.name=this.currentSchema.name)}catch(e){console.error(`[刷新卡片失败]`,e),this.rt.pushError(`refresh`,String(e&&e.message))}finally{this.refreshing=!1}}},onChatTurnFinished(e){if(this.chatProgress=null,this.aiChatOpen)return;let t=e&&e.steps||0,n=RL(e&&e.ms||0),r=zL(e&&e.finishedAt||Date.now());e&&e.status===`error`?Q(`AI 助手本轮报错(${r} · ${t} 步 / ${n}),展开面板查看原因`,`err`):e&&e.status===`aborted`?Q(`AI 助手本轮已终止(${r} · ${t} 步):展开面板可「从中断处继续」`,`ok`):Q(`AI 助手已完成本轮(${r} · ${t} 步 / ${n})`,`ok`)},async onChatRollbackTurn(e){let t=e&&e.cardId||this.selectedId;if(!t||this.loadingCard)return;if(t!==this.selectedId){Q(`请先切换到那张卡片再回滚`,`err`);return}let n=[];try{let e=await Y(`/__history/${encodeURIComponent(t)}`);if(!e.ok)throw Error(`HTTP ${e.status}`);let r=await e.json().catch(()=>null);n=r&&r.snapshots||[]}catch(e){Q(`读取历史快照失败:${e.message||e}`,`err`);return}let r=Number(e&&e.ts)||0,i=r?n.filter(e=>Number(e.ts)>=r-2e3):[],a=i.length?i[0]:n[n.length-1];if(!a||!a.schema){Q(`没找到本轮之前的历史快照(可能已被 30 张上限裁掉,或本轮没写入过卡片)`,`err`);return}let o=new Date(Number(a.ts)||Date.now()).toLocaleString(`zh-CN`,{hour12:!1});this.requestConfirm({title:`回滚到 AI 动手之前`,message:`将把卡片「${this.selectedCardName||t}」恢复到 ${o} 的版本,本轮及其后的 ${i.length||1} 张快照都会被撤销。回滚只改当前编辑态,可用 Ctrl+Z 撤回;确认无误后仍需点顶栏「保存到本地」才写盘。`,confirmText:`回滚`,severity:`warn`,onConfirm:()=>this.applyTurnRollback(a)})},applyTurnRollback(e){this.currentSchema&&e&&(this.past.push({schema:this.cloneSchema(this.currentSchema)}),this.past.length>30&&this.past.shift(),this.future=[],this.baseline={schema:this.cloneSchema(e.schema)},this.applySchemaSnapshot({schema:e.schema,data:e.data}),Q(`已回滚到本轮之前的版本(未落盘,可撤销;确认后点「保存到本地」)`,`ok`))},onCardsChanged(e){let t=e&&e.file||``,n=e&&e.type||`change`;if(n===`rename`&&e.oldId&&e.id&&e.oldId!==e.id)return this.applyCardRename(e.oldId,e.id);if(/\.history[\\/]/.test(t)||/data\.json$/i.test(t)||/\.import-meta\.json(\.tmp)?$/i.test(t))return;let r=t.match(/src[\\/]cards[\\/]([^\\/]+)[\\/]/),i=r?r[1]:null;this._ccIds||=new Set,this._ccTypes||={},i&&(this._ccIds.add(i),this._ccTypes[i]=n),!this._ccTimer&&(this._ccTimer=setTimeout(async()=>{this._ccTimer=null;let e=this._ccIds,t=this._ccTypes;if(this._ccIds=new Set,this._ccTypes={},!e.size)return;let n=Array.from(e),r=n[n.length-1];if(e.size===1&&r&&r===this.selectedId){if(this.selfSaveId===r&&Date.now()-this.selfSaveAt<rG){this.selfSaveId=``,this.selfSaveAt=0;return}if(this._restoreSuppressUntil&&Date.now()<this._restoreSuppressUntil){this._restoreSuppressUntil=0;return}if(this.historyDirty)this.promptExternalReload(r);else{let e=this.currentSchema&&this.currentSchema.name||r;this.showExternalReloadNote(this.chatBusy?`AI 助手已写入卡片「${e}」,预览已自动刷新`:`卡片「${e}」已在编辑器外被修改,已自动重新载入预览`),this.loadCard(this.selectedId)}return}if(e.size>1){await this.fetchCardList();let t=e.has(this.selectedId),n=this.selfSaveId===this.selectedId&&Date.now()-this.selfSaveAt<rG;if(t&&!n){if(this.historyDirty)this.promptExternalReload(this.selectedId);else{this.selfSaveId===this.selectedId&&(this.selfSaveId=``,this.selfSaveAt=0);let e=this.currentSchema&&this.currentSchema.name||this.selectedId;this.showExternalReloadNote(this.chatBusy?`AI 助手已写入卡片「${e}」,预览已自动刷新`:`卡片「${e}」已在编辑器外被修改,已自动重新载入预览`),this.loadCard(this.selectedId)}}return}if((t[r]||`change`)===`unlink`){let e=this.cardList.findIndex(e=>e.id===r);e>=0&&(this.cardList.splice(e,1),this.cardCount=this.cardList.length);return}let i=await this.fetchCardMeta(r);if(!i){await this.fetchCardList();return}let a=this.cardList.findIndex(e=>e.id===r);a>=0?this.cardList.splice(a,1,i):this.cardList.push(i),this.cardCount=this.cardList.length},120))},promptExternalReload(e){if(this.confirm.show)return;let t=this.currentSchema&&this.currentSchema.name||e;this.requestConfirm({title:`卡片已在编辑器外被修改`,message:`卡片「${t}」的 schema / data 在编辑器外发生了变更(例如 IDE 或其他工具覆盖了文件)。\n当前编辑器存在未保存的改动,是否放弃本地未保存改动并重新载入磁盘版本?`,confirmText:`重新载入`,cancelText:`保留我的改动`,onConfirm:()=>this.loadCard(e)})},showExternalReloadNote(e){this.externalReloadNote=e,this.externalReloadTimer&&clearTimeout(this.externalReloadTimer),this.externalReloadTimer=setTimeout(()=>{this.externalReloadNote=``,this.externalReloadTimer=null},3500)}}},gG=[`aria-busy`],_G={class:`app__logo`},vG=[`src`],yG={class:`app__logo-version`},bG={class:`csel-combo`},xG={class:`app__btn-group`},SG=[`disabled`],CG=[`disabled`],wG=[`disabled`],TG=[`title`],EG={class:`app__badge-text`},DG={class:`app__bar-actions`},OG={class:`app__op-group`,role:`group`,"aria-label":`编辑历史与本地操作`},kG=[`disabled`],AG=[`disabled`],jG=[`disabled`,`title`],MG=[`disabled`],NG=[`disabled`,`onClick`],PG={key:0,class:`app__icon app__icon--spin`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},FG={key:1,class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},IG={key:2,class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},LG={key:3,class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},RG={class:`app__remote-pop dd__menu`,role:`menu`},zG=[`title`,`onClick`],BG=[`title`,`onClick`],VG=[`onClick`],HG=[`title`,`onClick`],UG=[`title`,`onClick`],WG=[`onClick`],GG=[`disabled`,`title`,`aria-pressed`],KG={class:`app__dev-svc`},qG=[`disabled`,`title`],JG={class:`app__dev-svc-head`},YG={class:`app__dev-svc-body`},XG={class:`app__dev-svc-row`},ZG={class:`app__dev-svc-row app__dev-svc-row--col`},QG={class:`app__dev-svc-row app__dev-svc-row--col`},$G={key:0,class:`app__dev-svc-hint`},eK={class:`app__dev-svc-actions`},tK=[`title`],nK={style:{display:`none`}},rK=[`title`,`aria-expanded`],iK={key:0,class:`app__nosvc-banner`},aK={key:1,class:`app__nosvc-banner app__nosvc-banner--disconnected`},oK={key:2,class:`app__nosvc-banner app__extreload-banner`},sK={class:`app__stage`,ref:`stageEl`},cK={class:`phone__scaler`},lK=[`title`],uK={class:`canvas-bar__txt`},dK={class:`canvas-bar__chip`,title:`画布宽度预设(高度随列高自适应)`},fK={class:`canvas-bar__txt`},pK={class:`canvas-bar__size`,title:`画布实际尺寸(宽 × 高,高度随窗口自适应)`},mK=[`disabled`],hK=[`data-card-ready`],gK={class:`workside`},_K={class:`workside__cols`,ref:`colsEl`},vK={class:`login-modal modal-card`,role:`dialog`,"aria-modal":`true`},yK={class:`login-modal__row`},bK=[`disabled`],xK={class:`login-modal__row`},SK=[`disabled`],CK={key:0,class:`login-modal__error`},wK={class:`login-modal__actions`},TK=[`disabled`],EK=[`disabled`];function DK(e,t,n,r,i,a){let o=R(`CardSelect`),s=R(`Dropdown`),c=R(`ThemeSettings`),l=R(`Switch`),u=R(`ChatPanel`),d=R(`RenderTree`),f=R(`SelectionOverlay`),p=R(`HoverGuides`),m=R(`AlertCardLayer`),h=R(`DeviceOverlay`),g=R(`PickerOverlay`),_=R(`DatePickerOverlay`),v=R(`KeyboardOverlay`),y=R(`LoadingExOverlay`),b=R(`DebugPanel`),x=R(`ApiCallPanel`),S=R(`RemotePreview`),C=R(`ComponentPalette`),w=R(`CardGallery`),ee=R(`RemoteAllCards`),T=R(`RemoteCardFormDialog`),E=R(`SyncProgressModal`),D=R(`ExportDirDialog`),O=R(`ExportProgressModal`),te=R(`NewCardDialog`),ne=R(`ConfirmDialog`),re=R(`AppToast`),ie=R(`ImageLightbox`);return V(),H(`div`,{class:j([`app`,{"app--chrome-off":i.chromeOff}]),style:A({"--preview-width":a.previewWidth+`px`,"--api-panel-width":a.apiPanelWidth+`px`,"--debug-min":a.debugMinWidth+`px`})},[q(` 远端接口调用中(推送 / 拉取 / 切图上传 / 发布):顶栏整体冻结。
363
- 这些操作都会读写 FinMall,并与本地卡片状态(当前卡、撤销栈、磁盘版本、预览图)交叉;
363
+ 是否继续?`,confirmText:`继续上传`,onConfirm:()=>this.uploadCardSlices()})}else this.preview&&this.selectedId&&this.hasCardSource&&(this.remotePreviewOpen=!0)},requestConfirm({title:e,message:t,confirmText:n,cancelText:r,severity:i,onConfirm:a}){this.confirm={show:!0,title:e,message:t,confirmText:n||`继续`,cancelText:r||`取消`,severity:[`primary`,`warn`,`danger`].includes(i)?i:`primary`,onConfirm:a}},onConfirmDialog(){let e=this.confirm.onConfirm;this.confirm.show=!1,this.confirm.onConfirm=null,typeof e==`function`&&e()},onCancelDialog(){this.confirm.show=!1,this.confirm.onConfirm=null},async doPublish(){if(this.preview&&this.selectedId&&!this.publishing&&this.hasCardSource){this.publishing=!0;try{let e=await Y(`/__publish`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({schema:this.currentSchema})});if(!e.ok){let t=await e.json().catch(()=>({}));if(t.needCredentials){this.openLoginModal(`publish`);return}throw Error(t.message||t.error||`HTTP `+e.status)}let t=await e.json();if(!t.ok)throw Error(t.message||`发布失败`);let n=t.commit,r=n&&n.committed?` · 已提交 ${n.hash||`本地变更`}`:``;Q(`已发布版本 ${t.nextVersion}${r}`,`ok`),n&&n.committed===!1&&n.reason===`failed`&&Q(`发布成功,但卡片本地变更提交失败:${n.message||`未知原因`}`,`warn`,4e3),await this.persistRemoteVersion(this.selectedId,t.nextVersion),this.metaRefreshToken++,this.historyRefreshToken++}catch(e){console.error(`[卡片发布失败]`,e),Q(`发布失败:`+(e&&e.message),`err`)}finally{this.publishing=!1}}},async persistRemoteVersion(e,t){if(e)try{let n=t==null?`{}`:JSON.stringify({version:t}),r=await Y(`/__card-version/${encodeURIComponent(e)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:n});if(!r.ok){let e=await r.json().catch(()=>({}));if(e.needCredentials)return;throw Error(e.message||`HTTP `+r.status)}}catch(e){console.warn(`[persistRemoteVersion 失败]`,e&&e.message)}},async saveCard(){if(!this.preview||!this.selectedId)return;this.savingCard=!0;let e=this.selectedId;this.selfSaveId=e,this.selfSaveAt=Date.now();try{try{let e=await this.fetchDiskCard(this.selectedId);if(e&&e.schema){let t=e.schema,n=this.currentSchema;n&&(t.pageId&&(n.pageId=t.pageId),t.name&&(n.name=t.name),t.desc!==void 0&&(n.desc=t.desc))}}catch{}this.syncDataToSchema();let e={schema:this.currentSchema},t=JSON.stringify(e,(e,t)=>e===`_schemaNode`?void 0:t,2),n=await Y(`/__card/${encodeURIComponent(this.selectedId)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:t});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.message||`HTTP `+n.status)}return this.currentCard={schema:e.schema},this.localSchema=this.cloneSchema(this.currentSchema),this.localData=this.cloneData(mv(this.currentSchema,fG)),this.savedCard=!0,this.refreshValidateBadge(),this.saveTimer&&clearTimeout(this.saveTimer),this.saveTimer=setTimeout(()=>{this.savedCard=!1},1800),!0}catch(e){return console.error(`[本地保存失败]`,e),this.rt.pushError(`saveCard`,String(e&&e.message)),this.selfSaveId=``,this.selfSaveAt=0,!1}finally{this.savingCard=!1}},async fetchDiskCard(e){let t=await Y(`/__card/${encodeURIComponent(e)}`);if(!t.ok)throw Error(`HTTP `+t.status);return t.json()},async fetchImportMeta(e){if(!e)this.setCardImportMeta(null);else try{let t=await Y(`/__import-meta/${encodeURIComponent(e)}`);if(!t.ok){this.setCardImportMeta(null);return}let n=await t.json().catch(()=>({}));this.setCardImportMeta(n&&n.meta||null)}catch{this.setCardImportMeta(null)}},setCardImportMeta(e){this.cardImportMeta=e,!(e&&e.source)&&this.activeTab===`history`&&(this.activeTab=`vars`)},async saveToRemote({fromAutoSave:e=!1}={}){if(!this.preview||!this.selectedId||this.savingRemote)return;this.savingRemote=!0,this.savedRemote=!1,this.verifiedRemote=null;let t=!1;try{if(this.historyDirty){let e=await this.saveCard();t=!!e,e||console.warn(`[推送] 本地落盘失败:预览图可能滞后于本次推送的内容`)}try{let e=await this.fetchDiskCard(this.selectedId);e&&e.schema&&e.schema.pageId&&this.currentSchema&&(this.currentSchema.pageId=e.schema.pageId)}catch{}this.syncDataToSchema(),this.selfSaveId=this.selectedId,this.selfSaveAt=Date.now();let n=await Y(`/__save`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({code:this.selectedId,schema:this.currentSchema},(e,t)=>e===`_schemaNode`?void 0:t,2)});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.message||e.error||`HTTP `+n.status)}let r=await n.json();if(!r.ok)throw Error(r.error||`远端保存失败`);this.verifiedRemote=r.verified?!!r.verified.ok:null,this.savedRemote=!0;let i=r.preview||null;if(this.verifiedRemote===!1){let t=r.verified||{},n=t.diff&&t.diff.length?`差异:`+t.diff.join(`;`):t.readBackError||`读回校验未通过`;return console.warn(`[保存校验不符]`,t),e||Q(`已保存至远端,但读回校验未通过`,`err`),{ok:!0,verified:!1,message:n,preview:i}}return e||(i&&i.ok===!1?Q(`已保存至远端,但预览图未更新:`+(i.message||i.error||`未知原因`),`warn`,3600):Q(i&&i.ok?`已保存至远端,预览图已更新`:`已保存至远端`,`ok`)),this.metaRefreshToken++,this.historyRefreshToken++,this.saveRemoteTimer&&clearTimeout(this.saveRemoteTimer),this.saveRemoteTimer=setTimeout(()=>{this.savedRemote=!1,this.verifiedRemote=null},2500),{ok:!0,verified:this.verifiedRemote,preview:i}}catch(n){return console.error(`[保存至远端失败]`,n),e||Q(`保存至远端失败:`+(n&&n.message),`err`),t||(this.selfSaveId=``,this.selfSaveAt=0),{ok:!1,verified:null,message:n&&n.message||String(n)}}finally{this.savingRemote=!1}},onRestoreHistory(e){if(!e||!this.selectedId||this.restoringHistory)return;let t=e.summary&&e.summary.componentCount!=null?`,${e.summary.componentCount} 个组件`:``;this.requestConfirm({title:`加载历史版本到编辑器`,message:`将把远端版本 #${e.id}(${e.createTime}${t})写入本地并重新载入编辑器。\n仅作加载,不会自动推送或保存到远端;当前未保存的本地编辑会被覆盖。`,confirmText:`加载此版本`,severity:`warn`,onConfirm:()=>this.restoreHistoryVersion(e)})},async restoreHistoryVersion(e){if(this.selectedId&&!this.restoringHistory){this.restoringHistory=!0;try{let t=await Y(`/__card-history/${encodeURIComponent(this.selectedId)}/restore`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({versionId:String(e.id)})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message||e.error||`HTTP `+t.status)}let n=await t.json();if(!n.ok)throw Error(n.error||`恢复历史版本失败`);if(n.needCredentials){this.openLoginModal(`history`);return}this._restoreSuppressUntil=Date.now()+mG,await this.loadCard(this.selectedId,{clearAll:!0}),Q(`已加载历史版本 #${e.id}(仅本地加载,未推送远端)`,`ok`)}catch(e){console.error(`[加载历史版本失败]`,e),Q(`加载历史版本失败:`+(e&&e.message||e),`err`)}finally{this.restoringHistory=!1}}},async uploadCardSlices(){if(!this.preview||!this.selectedId||this.uploadingSlices)return;let e=this.selectedId;this.uploadingSlices=!0;try{if(this.historyDirty&&!await this.saveCard())throw Error(`本地保存失败,已中止切图上传`);this.selfSaveId=e,this.selfSaveAt=Date.now();let t=await Y(`/__slice-upload`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cardId:e})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message||e.error||`HTTP `+t.status)}let n=await t.json();if(n.needCredentials){this.openLoginModal(`slices`);return}if(this.selfSaveAt=Date.now(),!n.success){let e=(n.failed||[]).map(e=>`${e.name}: ${e.error}`).join(`; `);throw Error(e||`切图上传失败`)}await this.onRefresh();let r=(n.rewritten||[]).reduce((e,t)=>e+t.count,0);n.referenced?Q(`当前卡切图上传完成:新上传 ${n.uploaded.length} 张、复用 ${n.skipped.length} 张,替换引用 ${r} 处`,`ok`):Q(`当前卡片没有引用本地切图,无需上传`,`ok`),n.dangling&&n.dangling.length&&Q(`有 ${n.dangling.length} 处引用的切图在 src/slices 下不存在:${n.dangling.join(`、`)}`,`err`)}catch(e){console.error(`[切图上传失败]`,e),Q(`当前卡切图上传失败:`+(e&&e.message),`err`),this.selfSaveId=``,this.selfSaveAt=0}finally{this.uploadingSlices=!1}},async syncCardMeta(e){let t=await this.fetchCardMeta(e);if(!t)return;let n=this.cardList.findIndex(t=>t.id===e);n>=0?this.cardList.splice(n,1,t):this.cardList.push(t),this.cardCount=this.cardList.length},async fetchCardMeta(e){try{let t=await Y(`/__card/`+encodeURIComponent(e)+`/meta`);return t.ok?await t.json():null}catch(e){return console.error(`[读取卡片列表项失败]`,e),null}},async fetchCardList(){try{let e=await Y(`/__cards`);if(!e.ok)return;let t=await e.json(),n=t&&t.cards||[];this.cardList=n,this.cardCount=n.length}catch(e){console.error(`[加载卡片列表失败]`,e)}},async onGalleryDelete(e){try{let t=await Y(`/__card/${encodeURIComponent(e)}`,{method:`DELETE`}),n=await t.json().catch(()=>null);if(!t.ok)throw Error(n&&(n.message||n.error)||`HTTP ${t.status}`);if(Q(`已删除本地卡片 ${e}`,`ok`),this.$refs.chatPanel?.discardCard(e),await this.fetchCardList(),this.selectedId===e){let e=this.cardList[0];e?await this.loadCard(e.id):(this.selectedId=``,this.currentSchema=null,this.preview=null)}}catch(e){Q(`删除卡片失败:${e.message}`,`err`)}},async onNewCardCreated(e){this.cardDialog.visible=!1,Q(`已创建空白卡片 ${e}`,`ok`),await this.fetchCardList(),this.chatBusy?Q(`AI 正在生成「${this.selectedId}」:新卡 ${e} 已建好,本轮结束后再切过去`,`err`,3600):await this.loadCard(e)},async onRefresh(){let e=this.selectedId;if(e&&!this.refreshing){this.refreshing=!0;try{await this.loadCard(e),await this.syncCardMeta(e);let t=this.cardList.find(t=>t.id===e);t&&this.currentSchema&&this.currentSchema.name&&(t.name=this.currentSchema.name)}catch(e){console.error(`[刷新卡片失败]`,e),this.rt.pushError(`refresh`,String(e&&e.message))}finally{this.refreshing=!1}}},onChatTurnFinished(e){if(this.chatProgress=null,this.aiChatOpen)return;let t=e&&e.steps||0,n=WL(e&&e.ms||0),r=GL(e&&e.finishedAt||Date.now());e&&e.status===`error`?Q(`AI 助手本轮报错(${r} · ${t} 步 / ${n}),展开面板查看原因`,`err`):e&&e.status===`aborted`?Q(`AI 助手本轮已终止(${r} · ${t} 步):展开面板可「从中断处继续」`,`ok`):Q(`AI 助手已完成本轮(${r} · ${t} 步 / ${n})`,`ok`)},async onChatRollbackTurn(e){let t=e&&e.cardId||this.selectedId;if(!t||this.loadingCard)return;if(t!==this.selectedId){Q(`请先切换到那张卡片再回滚`,`err`);return}let n=[];try{let e=await Y(`/__history/${encodeURIComponent(t)}`);if(!e.ok)throw Error(`HTTP ${e.status}`);let r=await e.json().catch(()=>null);n=r&&r.snapshots||[]}catch(e){Q(`读取历史快照失败:${e.message||e}`,`err`);return}let r=Number(e&&e.ts)||0,i=r?n.filter(e=>Number(e.ts)>=r-2e3):[],a=i.length?i[0]:n[n.length-1];if(!a||!a.schema){Q(`没找到本轮之前的历史快照(可能已被 30 张上限裁掉,或本轮没写入过卡片)`,`err`);return}let o=new Date(Number(a.ts)||Date.now()).toLocaleString(`zh-CN`,{hour12:!1});this.requestConfirm({title:`回滚到 AI 动手之前`,message:`将把卡片「${this.selectedCardName||t}」恢复到 ${o} 的版本,本轮及其后的 ${i.length||1} 张快照都会被撤销。回滚只改当前编辑态,可用 Ctrl+Z 撤回;确认无误后仍需点顶栏「保存到本地」才写盘。`,confirmText:`回滚`,severity:`warn`,onConfirm:()=>this.applyTurnRollback(a)})},applyTurnRollback(e){this.currentSchema&&e&&(this.past.push({schema:this.cloneSchema(this.currentSchema)}),this.past.length>30&&this.past.shift(),this.future=[],this.baseline={schema:this.cloneSchema(e.schema)},this.applySchemaSnapshot({schema:e.schema,data:e.data}),Q(`已回滚到本轮之前的版本(未落盘,可撤销;确认后点「保存到本地」)`,`ok`))},onCardsChanged(e){let t=e&&e.file||``,n=e&&e.type||`change`;if(n===`rename`&&e.oldId&&e.id&&e.oldId!==e.id)return this.applyCardRename(e.oldId,e.id);if(/\.history[\\/]/.test(t)||/data\.json$/i.test(t)||/\.import-meta\.json(\.tmp)?$/i.test(t))return;let r=t.match(/src[\\/]cards[\\/]([^\\/]+)[\\/]/),i=r?r[1]:null;this._ccIds||=new Set,this._ccTypes||={},i&&(this._ccIds.add(i),this._ccTypes[i]=n),!this._ccTimer&&(this._ccTimer=setTimeout(async()=>{this._ccTimer=null;let e=this._ccIds,t=this._ccTypes;if(this._ccIds=new Set,this._ccTypes={},!e.size)return;let n=Array.from(e),r=n[n.length-1];if(e.size===1&&r&&r===this.selectedId){if(this.selfSaveId===r&&Date.now()-this.selfSaveAt<pG){this.selfSaveId=``,this.selfSaveAt=0;return}if(this._restoreSuppressUntil&&Date.now()<this._restoreSuppressUntil){this._restoreSuppressUntil=0;return}if(this.historyDirty)this.promptExternalReload(r);else{let e=this.currentSchema&&this.currentSchema.name||r;this.showExternalReloadNote(this.chatBusy?`AI 助手已写入卡片「${e}」,预览已自动刷新`:`卡片「${e}」已在编辑器外被修改,已自动重新载入预览`),this.loadCard(this.selectedId)}return}if(e.size>1){await this.fetchCardList();let t=e.has(this.selectedId),n=this.selfSaveId===this.selectedId&&Date.now()-this.selfSaveAt<pG;if(t&&!n){if(this.historyDirty)this.promptExternalReload(this.selectedId);else{this.selfSaveId===this.selectedId&&(this.selfSaveId=``,this.selfSaveAt=0);let e=this.currentSchema&&this.currentSchema.name||this.selectedId;this.showExternalReloadNote(this.chatBusy?`AI 助手已写入卡片「${e}」,预览已自动刷新`:`卡片「${e}」已在编辑器外被修改,已自动重新载入预览`),this.loadCard(this.selectedId)}}return}if((t[r]||`change`)===`unlink`){let e=this.cardList.findIndex(e=>e.id===r);e>=0&&(this.cardList.splice(e,1),this.cardCount=this.cardList.length);return}let i=await this.fetchCardMeta(r);if(!i){await this.fetchCardList();return}let a=this.cardList.findIndex(e=>e.id===r);a>=0?this.cardList.splice(a,1,i):this.cardList.push(i),this.cardCount=this.cardList.length},120))},promptExternalReload(e){if(this.confirm.show)return;let t=this.currentSchema&&this.currentSchema.name||e;this.requestConfirm({title:`卡片已在编辑器外被修改`,message:`卡片「${t}」的 schema / data 在编辑器外发生了变更(例如 IDE 或其他工具覆盖了文件)。\n当前编辑器存在未保存的改动,是否放弃本地未保存改动并重新载入磁盘版本?`,confirmText:`重新载入`,cancelText:`保留我的改动`,onConfirm:()=>this.loadCard(e)})},showExternalReloadNote(e){this.externalReloadNote=e,this.externalReloadTimer&&clearTimeout(this.externalReloadTimer),this.externalReloadTimer=setTimeout(()=>{this.externalReloadNote=``,this.externalReloadTimer=null},3500)}}},EG=[`aria-busy`],DG={class:`app__logo`},OG=[`src`],kG={class:`app__logo-version`},AG={class:`csel-combo`},jG={class:`app__btn-group`},MG=[`disabled`],NG=[`disabled`],PG=[`disabled`],FG=[`title`],IG={class:`app__badge-text`},LG={class:`app__bar-actions`},RG={class:`app__op-group`,role:`group`,"aria-label":`编辑历史与本地操作`},zG=[`disabled`],BG=[`disabled`],VG=[`disabled`,`title`],HG=[`disabled`],UG=[`disabled`,`onClick`],WG={key:0,class:`app__icon app__icon--spin`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},GG={key:1,class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},KG={key:2,class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},qG={key:3,class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},JG={class:`app__remote-pop dd__menu`,role:`menu`},YG=[`title`,`onClick`],XG=[`title`,`onClick`],ZG=[`onClick`],QG=[`title`,`onClick`],$G=[`title`,`onClick`],eK=[`onClick`],tK=[`disabled`,`title`,`aria-pressed`],nK={class:`app__dev-svc`},rK=[`disabled`,`title`],iK={class:`app__dev-svc-head`},aK={class:`app__dev-svc-body`},oK={class:`app__dev-svc-row`},sK={class:`app__dev-svc-row app__dev-svc-row--col`},cK={class:`app__dev-svc-row app__dev-svc-row--col`},lK={key:0,class:`app__dev-svc-hint`},uK={class:`app__dev-svc-actions`},dK=[`title`],fK={style:{display:`none`}},pK=[`title`,`aria-expanded`],mK={key:0,class:`app__nosvc-banner`},hK={key:1,class:`app__nosvc-banner app__nosvc-banner--disconnected`},gK={key:2,class:`app__nosvc-banner app__extreload-banner`},_K={class:`app__stage`,ref:`stageEl`},vK={class:`phone__scaler`},yK=[`title`],bK={class:`canvas-bar__txt`},xK={class:`canvas-bar__chip`,title:`画布宽度预设(高度随列高自适应)`},SK={class:`canvas-bar__txt`},CK={class:`canvas-bar__size`,title:`画布实际尺寸(宽 × 高,高度随窗口自适应)`},wK=[`disabled`],TK=[`data-card-ready`],EK={class:`workside`},DK={class:`workside__cols`,ref:`colsEl`},OK={class:`login-modal modal-card`,role:`dialog`,"aria-modal":`true`},kK={class:`login-modal__row`},AK=[`disabled`],jK={class:`login-modal__row`},MK=[`disabled`],NK={key:0,class:`login-modal__error`},PK={class:`login-modal__actions`},FK=[`disabled`],IK=[`disabled`];function LK(e,t,n,r,i,a){let o=R(`CardSelect`),s=R(`Dropdown`),c=R(`ThemeSettings`),l=R(`Switch`),u=R(`ChatPanel`),d=R(`RenderTree`),f=R(`SelectionOverlay`),p=R(`HoverGuides`),m=R(`AlertCardLayer`),h=R(`DeviceOverlay`),g=R(`PickerOverlay`),_=R(`DatePickerOverlay`),v=R(`KeyboardOverlay`),y=R(`LoadingExOverlay`),b=R(`DebugPanel`),x=R(`ApiCallPanel`),S=R(`RemotePreview`),C=R(`ComponentPalette`),w=R(`CardGallery`),ee=R(`RemoteAllCards`),T=R(`RemoteCardFormDialog`),E=R(`SyncProgressModal`),D=R(`ExportDirDialog`),O=R(`ExportProgressModal`),te=R(`NewCardDialog`),ne=R(`ConfirmDialog`),re=R(`AppToast`),ie=R(`ImageLightbox`);return V(),H(`div`,{class:j([`app`,{"app--chrome-off":i.chromeOff}]),style:A({"--preview-width":a.previewWidth+`px`,"--api-panel-width":a.apiPanelWidth+`px`,"--debug-min":a.debugMinWidth+`px`})},[q(` 远端接口调用中(推送 / 拉取 / 切图上传 / 发布):顶栏整体冻结。
364
+ 这些操作都会读写远端,并与本地卡片状态(当前卡、撤销栈、磁盘版本、预览图)交叉;
364
365
  执行期间允许切卡 / 撤销 / 本地保存,极易造成版本互相覆盖或状态错乱。
365
- 两道保险:① 控件自身 disabled(挡住键盘与焦点路径);② 顶层冻结层吃掉所有指针事件。 `),L(W(`header`,{class:j([`app__bar`,{"app__bar--locked":a.remoteBusy}]),"aria-busy":a.remoteBusy?`true`:`false`},[W(`strong`,_G,[W(`img`,{class:`app__logo-icon`,src:i.logoUrl,alt:``},null,8,vG),t[44]||=K(` CardBuddy `,-1),W(`span`,yG,`v`+M(i.appVersion),1)]),W(`div`,bG,[G(o,{class:`csel--combo`,value:i.selectedId,options:i.cardList,disabled:a.remoteBusy,onChange:a.onSelect},null,8,[`value`,`options`,`disabled`,`onChange`])]),q(` 卡片网格预览:图标按钮,打开本地全部卡片的缩略图墙,点击任一张载入工作台 `),W(`div`,xG,[W(`button`,{class:`app__btn app__btn--icon`,type:`button`,disabled:!i.cardList.length||a.remoteBusy,onClick:t[0]||=(...e)=>a.openGallery&&a.openGallery(...e),title:`卡片网格预览`},[...t[45]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-grid`})],-1)]],8,SG),q(` 新增空白卡片:紧邻网格预览的图标按钮;弹窗收 ID(必填、本地重名前置拦截)+ 描述(选填),创建成功切换到新卡 `),W(`button`,{class:`app__btn app__btn--icon`,type:`button`,disabled:a.remoteBusy,onClick:t[1]||=(...e)=>a.openNewCard&&a.openNewCard(...e),title:`新增空白卡片`},[...t[46]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-folder-plus`})],-1)]],8,CG),q(` 打开当前卡片所在文件夹:从卡片下拉里拆出,合并进本组作为第三位 `),W(`button`,{class:`app__btn app__btn--icon`,type:`button`,disabled:!i.selectedId||a.remoteBusy,onClick:t[2]||=(...e)=>a.openCardFolder&&a.openCardFolder(...e),title:`在文件管理器中打开当前卡片所在文件夹`},[...t[47]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-folder`})],-1)]],8,wG)]),L(W(`div`,{ref:`validateBadgeEl`,class:j([`app__badge`,`app__badge--`+i.validateBadge.state]),title:a.badgeTitle},[t[48]||=W(`span`,{class:`app__badge-dot`},null,-1),W(`span`,EG,M(a.badgeText),1)],10,TG),[[Nc,!i.chromeOff]]),W(`div`,DG,[W(`div`,OG,[q(` 撤销 / 重做:图标 + 文案;无可回退/重做版本时置灰 `),W(`button`,{class:`app__btn app__btn--hist`,type:`button`,disabled:!i.preview||!a.canUndo||a.remoteBusy,onClick:t[3]||=(...e)=>a.undo&&a.undo(...e),title:`后退一步(撤销)`},[...t[49]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-undo`})],-1),W(`span`,null,`撤销`,-1)]],8,kG),W(`button`,{class:`app__btn app__btn--hist`,type:`button`,disabled:!i.preview||!a.canRedo||a.remoteBusy,onClick:t[4]||=(...e)=>a.redo&&a.redo(...e),title:`前进一步(重做)`},[...t[50]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-redo`})],-1),W(`span`,null,`重做`,-1)]],8,AG),q(` 保存到本地:当前显示版本(撤销/重做导航到的历史版本,或编辑后未本地保存的版本)
366
+ 两道保险:① 控件自身 disabled(挡住键盘与焦点路径);② 顶层冻结层吃掉所有指针事件。 `),L(W(`header`,{class:j([`app__bar`,{"app__bar--locked":a.remoteBusy}]),"aria-busy":a.remoteBusy?`true`:`false`},[W(`strong`,DG,[W(`img`,{class:`app__logo-icon`,src:i.logoUrl,alt:``},null,8,OG),t[44]||=K(` CardBuddy `,-1),W(`span`,kG,`v`+M(i.appVersion),1)]),W(`div`,AG,[G(o,{class:`csel--combo`,value:i.selectedId,options:i.cardList,disabled:a.remoteBusy,onChange:a.onSelect},null,8,[`value`,`options`,`disabled`,`onChange`])]),q(` 卡片网格预览:图标按钮,打开本地全部卡片的缩略图墙,点击任一张载入工作台 `),W(`div`,jG,[W(`button`,{class:`app__btn app__btn--icon`,type:`button`,disabled:!i.cardList.length||a.remoteBusy,onClick:t[0]||=(...e)=>a.openGallery&&a.openGallery(...e),title:`卡片网格预览`},[...t[45]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-grid`})],-1)]],8,MG),q(` 新增空白卡片:紧邻网格预览的图标按钮;弹窗收 ID(必填、本地重名前置拦截)+ 描述(选填),创建成功切换到新卡 `),W(`button`,{class:`app__btn app__btn--icon`,type:`button`,disabled:a.remoteBusy,onClick:t[1]||=(...e)=>a.openNewCard&&a.openNewCard(...e),title:`新增空白卡片`},[...t[46]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-folder-plus`})],-1)]],8,NG),q(` 打开当前卡片所在文件夹:从卡片下拉里拆出,合并进本组作为第三位 `),W(`button`,{class:`app__btn app__btn--icon`,type:`button`,disabled:!i.selectedId||a.remoteBusy,onClick:t[2]||=(...e)=>a.openCardFolder&&a.openCardFolder(...e),title:`在文件管理器中打开当前卡片所在文件夹`},[...t[47]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-folder`})],-1)]],8,PG)]),L(W(`div`,{ref:`validateBadgeEl`,class:j([`app__badge`,`app__badge--`+i.validateBadge.state]),title:a.badgeTitle},[t[48]||=W(`span`,{class:`app__badge-dot`},null,-1),W(`span`,IG,M(a.badgeText),1)],10,FG),[[Nc,!i.chromeOff]]),W(`div`,LG,[W(`div`,RG,[q(` 撤销 / 重做:图标 + 文案;无可回退/重做版本时置灰 `),W(`button`,{class:`app__btn app__btn--hist`,type:`button`,disabled:!i.preview||!a.canUndo||a.remoteBusy,onClick:t[3]||=(...e)=>a.undo&&a.undo(...e),title:`后退一步(撤销)`},[...t[49]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-undo`})],-1),W(`span`,null,`撤销`,-1)]],8,zG),W(`button`,{class:`app__btn app__btn--hist`,type:`button`,disabled:!i.preview||!a.canRedo||a.remoteBusy,onClick:t[4]||=(...e)=>a.redo&&a.redo(...e),title:`前进一步(重做)`},[...t[50]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-redo`})],-1),W(`span`,null,`重做`,-1)]],8,BG),q(` 保存到本地:当前显示版本(撤销/重做导航到的历史版本,或编辑后未本地保存的版本)
366
367
  与本地磁盘版本不一致时高亮可用;一致时置灰。点击把当前版本真正写回磁盘,
367
368
  使下一次重新打开加载的是这个「真实版本」,而非任意历史记录。
368
369
  已登录远端且当前卡有导入来源时,本地写盘成功后自动续调保存接口(IDC10010)
369
- 同步为远端最新版本;未登录/无来源则仅保存到本地。 `),W(`button`,{class:j([`app__btn app__btn--history-save`,{"is-dirty":a.historyDirty}]),type:`button`,disabled:!i.preview||!a.historyDirty||i.savingCard||i.loadingCard||a.remoteBusy,onClick:t[5]||=(...e)=>a.applyHistoryToLocal&&a.applyHistoryToLocal(...e),title:a.historyDirty?i.credentialsReady&&a.hasCardSource?`当前版本与本地不一致,点击保存到本地并同步至远端`:`当前版本与本地不一致,点击将该版本保存到本地`:`当前版本已与本地一致`},[...t[51]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-save`})],-1),W(`span`,null,`保存`,-1)]],10,jG),q(` 生成预览图:无头渲染当前卡 → 透明底、与卡片实际尺寸 1:1 的 PNG → 覆盖写
370
+ 同步为远端最新版本;未登录/无来源则仅保存到本地。 `),W(`button`,{class:j([`app__btn app__btn--history-save`,{"is-dirty":a.historyDirty}]),type:`button`,disabled:!i.preview||!a.historyDirty||i.savingCard||i.loadingCard||a.remoteBusy,onClick:t[5]||=(...e)=>a.applyHistoryToLocal&&a.applyHistoryToLocal(...e),title:a.historyDirty?i.credentialsReady&&a.hasCardSource?`当前版本与本地不一致,点击保存到本地并同步至远端`:`当前版本与本地不一致,点击将该版本保存到本地`:`当前版本已与本地一致`},[...t[51]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-save`})],-1),W(`span`,null,`保存`,-1)]],10,VG),q(` 生成预览图:无头渲染当前卡 → 透明底、与卡片实际尺寸 1:1 的 PNG → 覆盖写
370
371
  src/cards/<id>/<id>.png(手动搭建 / 生成卡片后补齐封面用)。
371
- 未保存改动先落盘:服务端渲染的是磁盘态,不先保存会截到旧版。 `),W(`button`,{class:`app__btn app__btn--hist`,type:`button`,disabled:!i.preview||i.coverBusy||i.savingCard||i.loadingCard||a.remoteBusy,onClick:t[6]||=(...e)=>a.generateCardCover&&a.generateCardCover(...e),title:`生成预览图:透明底、与卡片实际尺寸一致,写入 src/cards/<id>/<id>.png(已存在则覆盖)`},[...t[52]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-image`})],-1),W(`span`,null,`截图`,-1)]],8,MG)]),q(` 远端:合并「远端保存 / 远端预览 / 切图上传 / 全量同步 / 选中卡片同步」为一个分组,组名「远端」,云图标 `),G(s,{class:`app__remote-menu`,size:`md`,placement:`bottom-end`,disabled:a.remoteBusy,title:a.remoteBusy?a.remoteBusyReason+`(顶栏已临时冻结)`:i.credentialsReady?`远端操作:推送 / 卡片发布 / 预览(真机)/ 拉取 / 查看全部 / 切图上传`:`未检测到 FinMall 登录凭据:点击先填写账号密码并验证,通过后才能使用远端功能`,"data-testid":`remote-group`},{trigger:I(({open:e,toggle:n})=>[W(`button`,{type:`button`,class:j([`app__btn app__btn--remote`,{"app__btn--warn":i.savedRemote&&i.verifiedRemote===!1,"app__remote-trigger--active":e,"is-processing":a.remoteBusy}]),disabled:a.remoteBusy,onClick:J(e=>a.onRemoteTrigger(n),[`stop`])},[a.remoteBusy?(V(),H(`svg`,PG,[...t[53]||=[W(`use`,{href:`#icon-loading`},null,-1)]])):i.savedRemote&&i.verifiedRemote!==!1?(V(),H(`svg`,FG,[...t[54]||=[W(`use`,{href:`#icon-cloud-check`},null,-1)]])):i.savedRemote&&i.verifiedRemote===!1?(V(),H(`svg`,IG,[...t[55]||=[W(`use`,{href:`#icon-cloud-alert`},null,-1)]])):(V(),H(`svg`,LG,[...t[56]||=[W(`use`,{href:`#icon-cloud`},null,-1)]])),t[58]||=W(`span`,null,`远端`,-1),(V(),H(`svg`,{class:j([`app__icon app__icon--chev`,{"app__icon--chev--open":e}]),viewBox:`0 0 16 16`,width:`12`,height:`12`,"aria-hidden":`true`},[...t[57]||=[W(`use`,{href:`#icon-chevron`},null,-1)]],2))],10,NG)]),default:I(({close:e})=>[W(`ul`,RG,[W(`li`,{class:j([`app__remote-item`,{"is-disabled":!i.preview||!i.selectedId||!a.hasCardSource}]),title:a.hasCardSource?`预览当前卡:生成真机预览二维码(FinMall App 扫码)`:`该卡未经「同步远程」导入,无远端来源信息,无法生成真机预览二维码`,"data-testid":`remote-preview`,role:`menuitem`,onClick:t=>{a.chooseRsave(`preview`),e()}},[...t[59]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-device-mobile`})],-1),W(`span`,null,`真机预览`,-1)]],10,zG),q(` 切图上传:仅点击时执行,把「当前卡片引用到的」src/slices 切图上传到 FinMall 图片库
372
+ 未保存改动先落盘:服务端渲染的是磁盘态,不先保存会截到旧版。 `),W(`button`,{class:`app__btn app__btn--hist`,type:`button`,disabled:!i.preview||i.coverBusy||i.savingCard||i.loadingCard||a.remoteBusy,onClick:t[6]||=(...e)=>a.generateCardCover&&a.generateCardCover(...e),title:`生成预览图:透明底、与卡片实际尺寸一致,写入 src/cards/<id>/<id>.png(已存在则覆盖)`},[...t[52]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-image`})],-1),W(`span`,null,`截图`,-1)]],8,HG)]),q(` 远端:合并「远端保存 / 远端预览 / 切图上传 / 全量同步 / 选中卡片同步」为一个分组,组名「远端」,云图标 `),G(s,{class:`app__remote-menu`,size:`md`,placement:`bottom-end`,disabled:a.remoteBusy,title:a.remoteBusy?a.remoteBusyReason+`(顶栏已临时冻结)`:i.credentialsReady?`远端操作:推送 / 卡片发布 / 预览(真机)/ 拉取 / 查看全部 / 切图上传`:`未检测到远端登录凭据:点击先填写账号密码并验证,通过后才能使用远端功能`,"data-testid":`remote-group`},{trigger:I(({open:e,toggle:n})=>[W(`button`,{type:`button`,class:j([`app__btn app__btn--remote`,{"app__btn--warn":i.savedRemote&&i.verifiedRemote===!1,"app__remote-trigger--active":e,"is-processing":a.remoteBusy}]),disabled:a.remoteBusy,onClick:J(e=>a.onRemoteTrigger(n),[`stop`])},[a.remoteBusy?(V(),H(`svg`,WG,[...t[53]||=[W(`use`,{href:`#icon-loading`},null,-1)]])):i.savedRemote&&i.verifiedRemote!==!1?(V(),H(`svg`,GG,[...t[54]||=[W(`use`,{href:`#icon-cloud-check`},null,-1)]])):i.savedRemote&&i.verifiedRemote===!1?(V(),H(`svg`,KG,[...t[55]||=[W(`use`,{href:`#icon-cloud-alert`},null,-1)]])):(V(),H(`svg`,qG,[...t[56]||=[W(`use`,{href:`#icon-cloud`},null,-1)]])),t[58]||=W(`span`,null,`远端`,-1),(V(),H(`svg`,{class:j([`app__icon app__icon--chev`,{"app__icon--chev--open":e}]),viewBox:`0 0 16 16`,width:`12`,height:`12`,"aria-hidden":`true`},[...t[57]||=[W(`use`,{href:`#icon-chevron`},null,-1)]],2))],10,UG)]),default:I(({close:e})=>[W(`ul`,JG,[W(`li`,{class:j([`app__remote-item`,{"is-disabled":!i.preview||!i.selectedId||!a.hasCardSource}]),title:a.hasCardSource?`预览当前卡:生成真机预览二维码(远端 App 扫码)`:`该卡未经「同步远程」导入,无远端来源信息,无法生成真机预览二维码`,"data-testid":`remote-preview`,role:`menuitem`,onClick:t=>{a.chooseRsave(`preview`),e()}},[...t[59]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-device-mobile`})],-1),W(`span`,null,`真机预览`,-1)]],10,YG),q(` 切图上传:仅点击时执行,把「当前卡片引用到的」src/slices 切图上传到远端图片库
372
373
  (CC0000.do),并把该卡 schema/data 里的 /slices/ 引用改写为返回的 @filestore/ 线上地址。
373
374
  没有任何自动上传路径;共享切图若已上传过(sha256 命中 src/slices/manifest.json)直接复用地址。
374
- 不要求 hasCardSource:本地自建卡同样需要先把切图传上去,才能推版本 / 出真机预览。 `),W(`li`,{class:j([`app__remote-item app__remote-item--upload`,{"is-disabled":!i.preview||!i.selectedId||i.uploadingSlices}]),title:i.uploadingSlices?`正在上传切图…`:`当前卡切图上传:把当前卡片引用的本地切图(src/slices)上传到 FinMall 图片库,并把卡片里的 /slices/ 引用替换为线上地址(@filestore/…);本地切图文件保留`,"data-testid":`slice-upload`,role:`menuitem`,onClick:t=>{a.chooseRsave(`slices`),e()}},[...t[60]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-image-upload`})],-1),W(`span`,null,`切图上传`,-1)]],10,BG),t[65]||=W(`li`,{class:`app__remote-sep`,role:`separator`},null,-1),W(`li`,{class:j([`app__remote-item app__remote-item--sync`,{"is-disabled":!i.preview||!i.selectedId||i.syncingRemote}]),"data-testid":`sync-selected`,role:`menuitem`,onClick:t=>{a.chooseSync(`selected`),e()}},[...t[61]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-git-pull`})],-1),W(`span`,null,`拉取`,-1)]],10,VG),W(`li`,{class:j([`app__remote-item app__remote-item--save`,{"is-disabled":!i.preview||!i.selectedId||i.savingRemote||!a.hasCardSource}]),title:a.hasCardSource?`推送当前卡:把本地卡片版本覆盖到远端 FinMall,成功后自动截图更新远端预览图`:`该卡未经「同步远程」导入,无远端来源信息,无法推送版本`,"data-testid":`save-remote`,role:`menuitem`,onClick:t=>{a.chooseRsave(`save`),e()}},[...t[62]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-git-push`})],-1),W(`span`,null,`推送`,-1)]],10,HG),q(` 卡片发布:取远端当前最大版本号 +1 后发布上线(IDC10004 → IDC10016);
375
+ 不要求 hasCardSource:本地自建卡同样需要先把切图传上去,才能推版本 / 出真机预览。 `),W(`li`,{class:j([`app__remote-item app__remote-item--upload`,{"is-disabled":!i.preview||!i.selectedId||i.uploadingSlices}]),title:i.uploadingSlices?`正在上传切图…`:`当前卡切图上传:把当前卡片引用的本地切图(src/slices)上传到远端图片库,并把卡片里的 /slices/ 引用替换为线上地址(@filestore/…);本地切图文件保留`,"data-testid":`slice-upload`,role:`menuitem`,onClick:t=>{a.chooseRsave(`slices`),e()}},[...t[60]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-image-upload`})],-1),W(`span`,null,`切图上传`,-1)]],10,XG),t[65]||=W(`li`,{class:`app__remote-sep`,role:`separator`},null,-1),W(`li`,{class:j([`app__remote-item app__remote-item--sync`,{"is-disabled":!i.preview||!i.selectedId||i.syncingRemote}]),"data-testid":`sync-selected`,role:`menuitem`,onClick:t=>{a.chooseSync(`selected`),e()}},[...t[61]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-git-pull`})],-1),W(`span`,null,`拉取`,-1)]],10,ZG),W(`li`,{class:j([`app__remote-item app__remote-item--save`,{"is-disabled":!i.preview||!i.selectedId||i.savingRemote||!a.hasCardSource}]),title:a.hasCardSource?`推送当前卡:把本地卡片版本覆盖到远端,成功后自动截图更新远端预览图`:`该卡未经「同步远程」导入,无远端来源信息,无法推送版本`,"data-testid":`save-remote`,role:`menuitem`,onClick:t=>{a.chooseRsave(`save`),e()}},[...t[62]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-git-push`})],-1),W(`span`,null,`推送`,-1)]],10,QG),q(` 卡片发布:取远端当前最大版本号 +1 后发布上线(IDC10004 → IDC10016);
375
376
  发布的是远端已保存的卡片内容,故应先「推送当前卡」把本地内容保存到远端。
376
- 要求 hasCardSource(远端卡):本地自建卡无远端来源,禁止发布。 `),W(`li`,{class:j([`app__remote-item app__remote-item--publish`,{"is-disabled":!i.preview||!i.selectedId||i.publishing||!a.hasCardSource}]),title:a.hasCardSource?`卡片发布:取远端最大版本号 +1 后发布上线当前卡片(发布的是远端已保存内容,建议先「推送当前卡」)`:`该卡未经「同步远程」导入,无远端来源信息,无法发布版本`,"data-testid":`card-publish`,role:`menuitem`,onClick:t=>{a.chooseRsave(`publish`),e()}},[...t[63]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-rocket`})],-1),W(`span`,null,`卡片发布`,-1)]],10,UG),t[66]||=W(`li`,{class:`app__remote-sep`,role:`separator`},null,-1),W(`li`,{class:j([`app__remote-item app__remote-item--sync`,{"is-disabled":i.syncingRemote}]),"data-testid":`view-all-cards`,role:`menuitem`,onClick:t=>{a.openRemoteAllCards(),e()}},[...t[64]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-grid`})],-1),W(`span`,null,`查看全部`,-1)]],10,WG)])]),_:1},8,[`disabled`,`title`]),q(` 接口调用面板开关:右侧常驻面板的展开/收起,状态持久化 `),W(`button`,{class:j([`app__btn app__btn--icon`,{"app__btn--active":i.apiPanelOpen}]),type:`button`,disabled:a.remoteBusy,title:i.apiPanelOpen?`收起接口调用面板`:`打开接口调用面板`,"aria-pressed":i.apiPanelOpen,onClick:t[7]||=(...e)=>a.toggleApiPanel&&a.toggleApiPanel(...e)},[...t[67]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-layout`})],-1)]],10,GG),q(` 主题设置:调色板图标 → 浮层里集中「外观(浅色/深色)」与「主题色(强调色)」两组设置,
377
- 原顶栏深浅开关已迁入面板,避免顶栏控件堆叠;状态持久化、写 <html> 属性均由 App 负责 `),G(c,{theme:i.theme,accent:i.accent,disabled:a.remoteBusy,"onUpdate:theme":t[8]||=e=>i.theme=e,"onUpdate:accent":t[9]||=e=>i.accent=e},null,8,[`theme`,`accent`,`disabled`]),q(` 本地开发服务设置入口 `),W(`div`,KG,[W(`button`,{class:j([`app__btn app__btn--icon`,a.devSvcClass]),type:`button`,disabled:a.remoteBusy,title:a.devSvcTitle,onClick:t[10]||=e=>i.devServiceOpen=!i.devServiceOpen},[...t[68]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-link`})],-1)]],10,qG),q(` 点遮罩关闭:与事件帮助气泡等轻量浮层同一交互 `),i.devServiceOpen?(V(),H(`div`,{key:0,class:`app__dev-svc-mask`,onClick:t[11]||=e=>i.devServiceOpen=!1})):q(`v-if`,!0),G(hc,{name:`pop`},{default:I(()=>[i.devServiceOpen?(V(),H(`div`,{key:0,class:`app__dev-svc-panel`,onClick:t[18]||=J(()=>{},[`stop`])},[W(`div`,JG,[t[69]||=W(`span`,{class:`app__dev-svc-title`},`本地开发服务`,-1),W(`button`,{class:`app__dev-svc-close`,type:`button`,title:`关闭`,onClick:t[12]||=e=>i.devServiceOpen=!1})]),W(`div`,YG,[W(`label`,XG,[t[70]||=W(`span`,null,`启用`,-1),G(l,{modelValue:i.devServiceForm.enabled,"onUpdate:modelValue":t[13]||=e=>i.devServiceForm.enabled=e},null,8,[`modelValue`])]),W(`label`,ZG,[t[71]||=W(`span`,null,`服务地址`,-1),L(W(`input`,{type:`text`,"onUpdate:modelValue":t[14]||=e=>i.devServiceForm.baseUrl=e,placeholder:`http://127.0.0.1:8787`},null,512),[[gl,i.devServiceForm.baseUrl]])]),W(`label`,QG,[t[72]||=W(`span`,null,`访问令牌(可选)`,-1),L(W(`input`,{type:`text`,"onUpdate:modelValue":t[15]||=e=>i.devServiceForm.token=e,placeholder:`留空则不校验`},null,512),[[gl,i.devServiceForm.token]])]),i.apiBaseResolved===null?(V(),H(`p`,$G,[a.devSvcBlockReason===`disabled`?(V(),H(B,{key:0},[K(`已填写服务地址,但「启用」开关未打开。请开启「启用」开关并点击保存,本地开发服务才会生效。`)],64)):(V(),H(B,{key:1},[K(`请填写本机 cardbuddy 服务地址(默认 http://127.0.0.1:8787),打开「启用」开关并保存后,编辑功能才会生效。`)],64))])):q(`v-if`,!0),W(`div`,eK,[W(`button`,{class:`ni-btn ni-btn--ghost`,type:`button`,onClick:t[16]||=e=>i.devServiceOpen=!1},`关闭`),W(`button`,{class:`ni-btn`,type:`button`,onClick:t[17]||=(...e)=>a.saveDevService&&a.saveDevService(...e)},`保存`)])])])):q(`v-if`,!0)]),_:1})])]),q(` 冻结层:铺满顶栏、吃掉全部指针事件(含已展开的下拉弹层 / 设置浮层),
377
+ 要求 hasCardSource(远端卡):本地自建卡无远端来源,禁止发布。 `),W(`li`,{class:j([`app__remote-item app__remote-item--publish`,{"is-disabled":!i.preview||!i.selectedId||i.publishing||!a.hasCardSource}]),title:a.hasCardSource?`卡片发布:取远端最大版本号 +1 后发布上线当前卡片(发布的是远端已保存内容,建议先「推送当前卡」)`:`该卡未经「同步远程」导入,无远端来源信息,无法发布版本`,"data-testid":`card-publish`,role:`menuitem`,onClick:t=>{a.chooseRsave(`publish`),e()}},[...t[63]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-rocket`})],-1),W(`span`,null,`卡片发布`,-1)]],10,$G),t[66]||=W(`li`,{class:`app__remote-sep`,role:`separator`},null,-1),W(`li`,{class:j([`app__remote-item app__remote-item--sync`,{"is-disabled":i.syncingRemote}]),"data-testid":`view-all-cards`,role:`menuitem`,onClick:t=>{a.openRemoteAllCards(),e()}},[...t[64]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-grid`})],-1),W(`span`,null,`查看全部`,-1)]],10,eK)])]),_:1},8,[`disabled`,`title`]),q(` 接口调用面板开关:右侧常驻面板的展开/收起,状态持久化 `),W(`button`,{class:j([`app__btn app__btn--icon`,{"app__btn--active":i.apiPanelOpen}]),type:`button`,disabled:a.remoteBusy,title:i.apiPanelOpen?`收起接口调用面板`:`打开接口调用面板`,"aria-pressed":i.apiPanelOpen,onClick:t[7]||=(...e)=>a.toggleApiPanel&&a.toggleApiPanel(...e)},[...t[67]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-layout`})],-1)]],10,tK),q(` 主题设置:调色板图标 → 浮层里集中「外观(浅色/深色)」与「主题色(强调色)」两组设置,
378
+ 原顶栏深浅开关已迁入面板,避免顶栏控件堆叠;状态持久化、写 <html> 属性均由 App 负责 `),G(c,{theme:i.theme,accent:i.accent,disabled:a.remoteBusy,"onUpdate:theme":t[8]||=e=>i.theme=e,"onUpdate:accent":t[9]||=e=>i.accent=e},null,8,[`theme`,`accent`,`disabled`]),q(` 本地开发服务设置入口 `),W(`div`,nK,[W(`button`,{class:j([`app__btn app__btn--icon`,a.devSvcClass]),type:`button`,disabled:a.remoteBusy,title:a.devSvcTitle,onClick:t[10]||=e=>i.devServiceOpen=!i.devServiceOpen},[...t[68]||=[W(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-link`})],-1)]],10,rK),q(` 点遮罩关闭:与事件帮助气泡等轻量浮层同一交互 `),i.devServiceOpen?(V(),H(`div`,{key:0,class:`app__dev-svc-mask`,onClick:t[11]||=e=>i.devServiceOpen=!1})):q(`v-if`,!0),G(hc,{name:`pop`},{default:I(()=>[i.devServiceOpen?(V(),H(`div`,{key:0,class:`app__dev-svc-panel`,onClick:t[18]||=J(()=>{},[`stop`])},[W(`div`,iK,[t[69]||=W(`span`,{class:`app__dev-svc-title`},`本地开发服务`,-1),W(`button`,{class:`app__dev-svc-close`,type:`button`,title:`关闭`,onClick:t[12]||=e=>i.devServiceOpen=!1})]),W(`div`,aK,[W(`label`,oK,[t[70]||=W(`span`,null,`启用`,-1),G(l,{modelValue:i.devServiceForm.enabled,"onUpdate:modelValue":t[13]||=e=>i.devServiceForm.enabled=e},null,8,[`modelValue`])]),W(`label`,sK,[t[71]||=W(`span`,null,`服务地址`,-1),L(W(`input`,{type:`text`,"onUpdate:modelValue":t[14]||=e=>i.devServiceForm.baseUrl=e,placeholder:`http://127.0.0.1:8787`},null,512),[[gl,i.devServiceForm.baseUrl]])]),W(`label`,cK,[t[72]||=W(`span`,null,`访问令牌(可选)`,-1),L(W(`input`,{type:`text`,"onUpdate:modelValue":t[15]||=e=>i.devServiceForm.token=e,placeholder:`留空则不校验`},null,512),[[gl,i.devServiceForm.token]])]),i.apiBaseResolved===null?(V(),H(`p`,lK,[a.devSvcBlockReason===`disabled`?(V(),H(B,{key:0},[K(`已填写服务地址,但「启用」开关未打开。请开启「启用」开关并点击保存,本地开发服务才会生效。`)],64)):(V(),H(B,{key:1},[K(`请填写本机 cardbuddy 服务地址(默认 http://127.0.0.1:8787),打开「启用」开关并保存后,编辑功能才会生效。`)],64))])):q(`v-if`,!0),W(`div`,uK,[W(`button`,{class:`ni-btn ni-btn--ghost`,type:`button`,onClick:t[16]||=e=>i.devServiceOpen=!1},`关闭`),W(`button`,{class:`ni-btn`,type:`button`,onClick:t[17]||=(...e)=>a.saveDevService&&a.saveDevService(...e)},`保存`)])])])):q(`v-if`,!0)]),_:1})])]),q(` 冻结层:铺满顶栏、吃掉全部指针事件(含已展开的下拉弹层 / 设置浮层),
378
379
  拦住任何可能漏掉 disabled 的控件;title 说明为什么点不动,cursor 用 progress 作反馈。
379
- 远端分组不参与置灰——它正显示 spinner,是用户唯一需要的进度反馈。 `),a.remoteBusy?(V(),H(`div`,{key:0,class:`app__bar-lock`,title:a.remoteBusyReason+`(顶栏已临时冻结,完成前不能切换卡片或执行本地操作)`,"data-testid":`app-bar-lock`},null,8,tK)):q(`v-if`,!0),W(`span`,nK,M(i.rt.revision),1)],10,gG),[[Nc,!i.chromeOff]]),q(` AI 开发助手悬浮入口:可拖拽圆形按钮(尺寸 / 配色走规范 Token,图标取自 sprite)。
380
- 拖动用 Pointer Events 统一鼠标 / 触摸;拖拽位移超阈值才判定为拖动,否则照常点击开合面板。 `),W(`button`,{ref:`aiFab`,class:j([`ai-fab`,{"ai-fab--active":i.aiChatOpen,"ai-fab--busy":i.chatBusy,"ai-fab--dragging":i.fab.dragging}]),type:`button`,title:a.fabTitle,"aria-expanded":i.aiChatOpen?`true`:`false`,"data-testid":`ai-fab`,style:A(a.fabStyle),onPointerdown:t[19]||=(...e)=>a.onFabPointerDown&&a.onFabPointerDown(...e),onPointermove:t[20]||=(...e)=>a.onFabPointerMove&&a.onFabPointerMove(...e),onPointerup:t[21]||=(...e)=>a.onFabPointerUp&&a.onFabPointerUp(...e),onPointercancel:t[22]||=(...e)=>a.onFabPointerUp&&a.onFabPointerUp(...e),onClick:t[23]||=(...e)=>a.onFabClick&&a.onFabClick(...e)},[...t[73]||=[W(`svg`,{class:`ai-fab__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-sparkles`})],-1)]],46,rK),q(` AI 开发助手对话面板:右侧抽屉,宽度可拖(320px ~ 视口 50%,默认 33%),对话记录按卡片落盘 `),G(u,{ref:`chatPanel`,visible:i.aiChatOpen,"card-id":i.selectedId,"card-name":a.selectedCardName,"card-empty":a.cardEmpty,onClose:t[24]||=e=>i.aiChatOpen=!1,onBusy:t[25]||=e=>i.chatBusy=e,onTurnProgress:t[26]||=e=>i.chatProgress=e,onTurnFinished:a.onChatTurnFinished,onRollbackTurn:a.onChatRollbackTurn,onLocateNode:a.onAiLocateNode},null,8,[`visible`,`card-id`,`card-name`,`card-empty`,`onTurnFinished`,`onRollbackTurn`,`onLocateNode`]),q(` 部署态但未配置本地开发服务:顶部提示条(chrome=off 截图模式不显示) `),i.apiBaseResolved===null&&!i.chromeOff?(V(),H(`div`,iK,[a.devSvcBlockReason===`disabled`?(V(),H(B,{key:0},[K(` ⚠ 本地开发服务未生效:已填写地址,但未打开「启用」开关。请点击右上角 「连接」图标打开「本地开发服务」设置,开启「启用」开关并保存后,编辑功能才会生效。 `)],64)):(V(),H(B,{key:1},[K(` ⚠ 未配置本地开发服务:当前为部署态,编辑功能不可用。请点击右上角 「连接」图标打开「本地开发服务」设置,填写本机 cardbuddy 地址、打开「启用」开关并保存后,才能编辑卡片。 `)],64))])):q(`v-if`,!0),q(` 已配置本地服务但实时连接已断开:顶部提示条(chrome=off 截图模式不显示) `),i.apiBaseResolved!==null&&i.devSvcDown&&!i.chromeOff?(V(),H(`div`,aK,` ⚠ 本地开发服务已断开:连接失败或服务已停止,编辑 / 同步功能暂不可用。请确认本地 cardbuddy 是否运行,或点击右上角「连接」图标重新保存配置。 `)):q(`v-if`,!0),q(` 外部改了当前卡、无未保存改动 → 自动重载后的非阻塞轻提示(chrome=off 截图模式不显示) `),i.externalReloadNote&&!i.chromeOff?(V(),H(`div`,oK,` ↻ `+M(i.externalReloadNote),1)):q(`v-if`,!0),W(`main`,sK,[W(`div`,{class:j([`phone`,{"phone--dragging":i.dragging}]),style:A({width:a.previewWidth+`px`})},[q(` 缩放外框:占满整列(宽高由 CSS flex 填满);画布不做 transform 缩放,直接按实际尺寸布局 `),W(`div`,{class:`phone__frame`,style:A(a.frameStyle)},[q(` 画布层:直接按实际列宽/列高布局(width/height 100%),不再使用 transform 缩放 `),W(`div`,cK,[q(` 画布工具条:原 device-bar(顶 28px)+ preview-statusbar(底 28px)合并为一条 32px,
380
+ 远端分组不参与置灰——它正显示 spinner,是用户唯一需要的进度反馈。 `),a.remoteBusy?(V(),H(`div`,{key:0,class:`app__bar-lock`,title:a.remoteBusyReason+`(顶栏已临时冻结,完成前不能切换卡片或执行本地操作)`,"data-testid":`app-bar-lock`},null,8,dK)):q(`v-if`,!0),W(`span`,fK,M(i.rt.revision),1)],10,EG),[[Nc,!i.chromeOff]]),q(` AI 开发助手悬浮入口:可拖拽圆形按钮(尺寸 / 配色走规范 Token,图标取自 sprite)。
381
+ 拖动用 Pointer Events 统一鼠标 / 触摸;拖拽位移超阈值才判定为拖动,否则照常点击开合面板。 `),W(`button`,{ref:`aiFab`,class:j([`ai-fab`,{"ai-fab--active":i.aiChatOpen,"ai-fab--busy":i.chatBusy,"ai-fab--dragging":i.fab.dragging}]),type:`button`,title:a.fabTitle,"aria-expanded":i.aiChatOpen?`true`:`false`,"data-testid":`ai-fab`,style:A(a.fabStyle),onPointerdown:t[19]||=(...e)=>a.onFabPointerDown&&a.onFabPointerDown(...e),onPointermove:t[20]||=(...e)=>a.onFabPointerMove&&a.onFabPointerMove(...e),onPointerup:t[21]||=(...e)=>a.onFabPointerUp&&a.onFabPointerUp(...e),onPointercancel:t[22]||=(...e)=>a.onFabPointerUp&&a.onFabPointerUp(...e),onClick:t[23]||=(...e)=>a.onFabClick&&a.onFabClick(...e)},[...t[73]||=[W(`svg`,{class:`ai-fab__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-sparkles`})],-1)]],46,pK),q(` AI 开发助手对话面板:右侧抽屉,宽度可拖(320px ~ 视口 50%,默认 33%),对话记录按卡片落盘 `),G(u,{ref:`chatPanel`,visible:i.aiChatOpen,"card-id":i.selectedId,"card-name":a.selectedCardName,"card-empty":a.cardEmpty,onClose:t[24]||=e=>i.aiChatOpen=!1,onBusy:t[25]||=e=>i.chatBusy=e,onTurnProgress:t[26]||=e=>i.chatProgress=e,onTurnFinished:a.onChatTurnFinished,onRollbackTurn:a.onChatRollbackTurn,onLocateNode:a.onAiLocateNode},null,8,[`visible`,`card-id`,`card-name`,`card-empty`,`onTurnFinished`,`onRollbackTurn`,`onLocateNode`]),q(` 部署态但未配置本地开发服务:顶部提示条(chrome=off 截图模式不显示) `),i.apiBaseResolved===null&&!i.chromeOff?(V(),H(`div`,mK,[a.devSvcBlockReason===`disabled`?(V(),H(B,{key:0},[K(` ⚠ 本地开发服务未生效:已填写地址,但未打开「启用」开关。请点击右上角 「连接」图标打开「本地开发服务」设置,开启「启用」开关并保存后,编辑功能才会生效。 `)],64)):(V(),H(B,{key:1},[K(` ⚠ 未配置本地开发服务:当前为部署态,编辑功能不可用。请点击右上角 「连接」图标打开「本地开发服务」设置,填写本机 cardbuddy 地址、打开「启用」开关并保存后,才能编辑卡片。 `)],64))])):q(`v-if`,!0),q(` 已配置本地服务但实时连接已断开:顶部提示条(chrome=off 截图模式不显示) `),i.apiBaseResolved!==null&&i.devSvcDown&&!i.chromeOff?(V(),H(`div`,hK,` ⚠ 本地开发服务已断开:连接失败或服务已停止,编辑 / 同步功能暂不可用。请确认本地 cardbuddy 是否运行,或点击右上角「连接」图标重新保存配置。 `)):q(`v-if`,!0),q(` 外部改了当前卡、无未保存改动 → 自动重载后的非阻塞轻提示(chrome=off 截图模式不显示) `),i.externalReloadNote&&!i.chromeOff?(V(),H(`div`,gK,` ↻ `+M(i.externalReloadNote),1)):q(`v-if`,!0),W(`main`,_K,[W(`div`,{class:j([`phone`,{"phone--dragging":i.dragging}]),style:A({width:a.previewWidth+`px`})},[q(` 缩放外框:占满整列(宽高由 CSS flex 填满);画布不做 transform 缩放,直接按实际尺寸布局 `),W(`div`,{class:`phone__frame`,style:A(a.frameStyle)},[q(` 画布层:直接按实际列宽/列高布局(width/height 100%),不再使用 transform 缩放 `),W(`div`,vK,[q(` 画布工具条:原 device-bar(顶 28px)+ preview-statusbar(底 28px)合并为一条 32px,
381
382
  竖向空间还给手机视口。左组=改变画布(背景 / 宽度预设),右组=画布现状与动作(尺寸读数 / 刷新);
382
- 预览列窄于 300px 时收起读数与文案只留图标(188 预设下仍单行可用)。 `),L(W(`div`,{class:j([`canvas-bar`,{"canvas-bar--tight":a.previewWidth<300}])},[q(` 画布背景:触发器带当前底色小样,不展开下拉也可见当前模式 `),G(s,{borderless:``,size:`xs`,placement:`bottom-start`,value:i.canvasBg,options:i.bgOptions.map(e=>({key:e.key,value:e.label+`背景`})),onChange:a.chooseBg},{trigger:I(()=>[W(`span`,{class:`canvas-bar__chip`,title:`画布背景:`+a.currentBg.label},[W(`i`,{class:j([`canvas-bar__swatch`,`canvas-bar__swatch--`+i.canvasBg])},null,2),W(`span`,uK,M(a.currentBg.label)+`背景`,1),t[74]||=W(`svg`,{class:`canvas-bar__chev`,viewBox:`0 0 16 16`,"aria-hidden":`true`},[W(`use`,{href:`#icon-chevron`})],-1)],8,lK)]),_:1},8,[`value`,`options`,`onChange`]),q(` 宽度预设:触发器直接显示当前宽度,省去独立的「宽度」标签 `),G(s,{borderless:``,size:`xs`,placement:`bottom-start`,value:a.canvasW,options:i.presetSizes,onChange:a.setPresetWidth},{trigger:I(()=>[W(`span`,dK,[t[75]||=W(`svg`,{class:`canvas-bar__icn`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-stretch`})],-1),W(`span`,fK,M(a.canvasW)+` px`,1),t[76]||=W(`svg`,{class:`canvas-bar__chev`,viewBox:`0 0 16 16`,"aria-hidden":`true`},[W(`use`,{href:`#icon-chevron`})],-1)])]),_:1},8,[`value`,`options`,`onChange`]),t[78]||=W(`span`,{class:`canvas-bar__spacer`},null,-1),W(`span`,pK,M(a.canvasW)+` × `+M(i.viewportHeight),1),W(`button`,{class:j([`canvas-bar__iconbtn`,{"is-loading":i.refreshing}]),type:`button`,disabled:!i.selectedId||i.refreshing,title:`刷新卡片,重新加载`,onClick:t[27]||=(...e)=>a.refreshCard&&a.refreshCard(...e)},[...t[77]||=[W(`svg`,{class:`canvas-bar__icn`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-rotate-cw`})],-1)]],10,mK)],2),[[Nc,!i.chromeOff]]),q(`
383
+ 预览列窄于 300px 时收起读数与文案只留图标(188 预设下仍单行可用)。 `),L(W(`div`,{class:j([`canvas-bar`,{"canvas-bar--tight":a.previewWidth<300}])},[q(` 画布背景:触发器带当前底色小样,不展开下拉也可见当前模式 `),G(s,{borderless:``,size:`xs`,placement:`bottom-start`,value:i.canvasBg,options:i.bgOptions.map(e=>({key:e.key,value:e.label+`背景`})),onChange:a.chooseBg},{trigger:I(()=>[W(`span`,{class:`canvas-bar__chip`,title:`画布背景:`+a.currentBg.label},[W(`i`,{class:j([`canvas-bar__swatch`,`canvas-bar__swatch--`+i.canvasBg])},null,2),W(`span`,bK,M(a.currentBg.label)+`背景`,1),t[74]||=W(`svg`,{class:`canvas-bar__chev`,viewBox:`0 0 16 16`,"aria-hidden":`true`},[W(`use`,{href:`#icon-chevron`})],-1)],8,yK)]),_:1},8,[`value`,`options`,`onChange`]),q(` 宽度预设:触发器直接显示当前宽度,省去独立的「宽度」标签 `),G(s,{borderless:``,size:`xs`,placement:`bottom-start`,value:a.canvasW,options:i.presetSizes,onChange:a.setPresetWidth},{trigger:I(()=>[W(`span`,xK,[t[75]||=W(`svg`,{class:`canvas-bar__icn`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-stretch`})],-1),W(`span`,SK,M(a.canvasW)+` px`,1),t[76]||=W(`svg`,{class:`canvas-bar__chev`,viewBox:`0 0 16 16`,"aria-hidden":`true`},[W(`use`,{href:`#icon-chevron`})],-1)])]),_:1},8,[`value`,`options`,`onChange`]),t[78]||=W(`span`,{class:`canvas-bar__spacer`},null,-1),W(`span`,CK,M(a.canvasW)+` × `+M(i.viewportHeight),1),W(`button`,{class:j([`canvas-bar__iconbtn`,{"is-loading":i.refreshing}]),type:`button`,disabled:!i.selectedId||i.refreshing,title:`刷新卡片,重新加载`,onClick:t[27]||=(...e)=>a.refreshCard&&a.refreshCard(...e)},[...t[77]||=[W(`svg`,{class:`canvas-bar__icn`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[W(`use`,{href:`#icon-rotate-cw`})],-1)]],10,wK)],2),[[Nc,!i.chromeOff]]),q(`
383
384
  固定视口:弹层(alertCard / alertDialog / toast)相对此容器 absolute inset:0 定位,
384
385
  不随内层 phone__screen 的卡片内容滚动,保证遮罩始终精确覆盖可视区域。
385
386
  `),W(`div`,{ref:`phoneViewport`,class:`phone-viewport`,onClick:t[28]||=(...e)=>a.onCanvasClick&&a.onCanvasClick(...e)},[W(`div`,{class:j([`phone__screen`,`phone__screen--bg-`+(i.chromeOff?`white`:i.canvasBg)]),style:A(i.chromeOff&&i.preview?{width:(i.preview.view.width||375)+`px`}:null),"data-card-ready":i.cardReady?`1`:null},[q(`
@@ -387,19 +388,19 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
387
388
  等场景时强制 RenderTree 重新挂载,从而保证新卡片/新数据的「初始化动作」
388
389
  (onReady 等生命周期事件,如 assetOverview 计算 ratio)一定在 created 阶段
389
390
  执行,不会出现重载后 init 不跑、依赖字段为 undefined 而渲染成 NaN% 的问题。
390
- `),i.preview?(V(),U(d,{key:i.selectedId+`:`+i.reloadToken,node:i.preview.view,scope:i.rt.state,"selected-node-id":i.selectedNodeId},null,8,[`node`,`scope`,`selected-node-id`])):q(`v-if`,!0),q(` 节点选中遮罩覆盖层:作为滚动容器子节点,随内容滚动并精确贴合选中元素 `),G(f),q(` 结构树 hover 参考线:贯穿画布的荧光绿辅助线(左/右竖线、上/下横线),仅 hover 时显示 `),G(p)],14,hK),q(` 弹窗卡片图层:alertCard / closeAlertCard 的展现层(在预览区域内弹出) `),G(m,{"main-rt":i.rt},null,8,[`main-rt`]),q(` 设备级模拟 UI:alertDialog 对话框 / showToast 弱提示 / showPicker 选择器 / showDatePicker 日期选择器 `),G(h),G(g),G(_),G(v),G(y)],512)])],4)],6),q(` 左分隔条:预览列 | 工作区 接缝。底面板 / 状态栏的左缘即此缝(随预览宽度联动),
391
+ `),i.preview?(V(),U(d,{key:i.selectedId+`:`+i.reloadToken,node:i.preview.view,scope:i.rt.state,"selected-node-id":i.selectedNodeId},null,8,[`node`,`scope`,`selected-node-id`])):q(`v-if`,!0),q(` 节点选中遮罩覆盖层:作为滚动容器子节点,随内容滚动并精确贴合选中元素 `),G(f),q(` 结构树 hover 参考线:贯穿画布的荧光绿辅助线(左/右竖线、上/下横线),仅 hover 时显示 `),G(p)],14,TK),q(` 弹窗卡片图层:alertCard / closeAlertCard 的展现层(在预览区域内弹出) `),G(m,{"main-rt":i.rt},null,8,[`main-rt`]),q(` 设备级模拟 UI:alertDialog 对话框 / showToast 弱提示 / showPicker 选择器 / showDatePicker 日期选择器 `),G(h),G(g),G(_),G(v),G(y)],512)])],4)],6),q(` 左分隔条:预览列 | 工作区 接缝。底面板 / 状态栏的左缘即此缝(随预览宽度联动),
391
392
  故定位在 .app__stage 通到底部,全程可拖;右分隔条才收进两栏容器内。 `),L(W(`div`,{class:j([`splitter`,{"is-dragging":i.dragging}]),onPointerdown:t[29]||=J((...e)=>a.startDrag&&a.startDrag(...e),[`prevent`]),title:`拖拽调整预览区域宽度`},null,34),[[Nc,!i.chromeOff]]),q(` 中右工作区:上为「调试面板 + 接口调用面板」两栏,下为贯穿两栏的共同状态栏。
392
393
  状态栏与底部弹出面板(运行态 / 事件 / 变量绑定)均由 DebugPanel 内 Teleport 注入
393
394
  #app-workside-bar / #app-workside-panels,宽度贯穿中右两栏;Teleport 目标须在 DOM 中
394
- 先于面板挂载,故两个空容器写在前面,以 flex order 视觉置底。 `),L(W(`div`,gK,[t[79]||=W(`div`,{id:`app-workside-bar`,class:`workside__bar`},null,-1),t[80]||=W(`div`,{id:`app-workside-panels`,class:`workside__panels`},null,-1),W(`div`,_K,[q(` 拖拽分隔条:置于两栏容器内(定位上下文),只贯穿列区高度,不穿过底部弹出面板与状态栏 `),q(` 中右分隔条:调试面板 | 接口调用面板 接缝,拖动调整右栏宽度。
395
+ 先于面板挂载,故两个空容器写在前面,以 flex order 视觉置底。 `),L(W(`div`,EK,[t[79]||=W(`div`,{id:`app-workside-bar`,class:`workside__bar`},null,-1),t[80]||=W(`div`,{id:`app-workside-panels`,class:`workside__panels`},null,-1),W(`div`,DK,[q(` 拖拽分隔条:置于两栏容器内(定位上下文),只贯穿列区高度,不穿过底部弹出面板与状态栏 `),q(` 中右分隔条:调试面板 | 接口调用面板 接缝,拖动调整右栏宽度。
395
396
  约束:中栏最小宽度 ≥ 屏宽 1/3,右栏最小宽度 ≥ 320px(见 startApiDrag) `),L(W(`div`,{class:j([`splitter splitter--api`,{"is-dragging":i.apiDragging}]),onPointerdown:t[30]||=J((...e)=>a.startApiDrag&&a.startApiDrag(...e),[`prevent`]),title:`拖拽调整接口调用面板宽度`},null,34),[[Nc,!i.chromeOff&&i.apiPanelOpen]]),G(b,{"chrome-off":i.chromeOff,rt:i.rt,preview:i.preview,schema:i.currentSchema,"card-id":i.selectedId,"reload-token":i.reloadToken,"meta-refresh-token":i.metaRefreshToken,"card-count":i.cardCount,"selected-node-id":i.selectedNodeId,"move-collapse-token":i.moveCollapseToken,"active-tab":i.activeTab,onSchemaChanged:a.onSchemaChanged,onSchemaCommit:a.onSchemaCommit,onSelectNode:a.onSelectNode,"onUpdate:activeTab":t[31]||=e=>i.activeTab=e,onAddNode:a.onAddNode,onMoveNode:a.onMoveNode,onHoverNode:a.onHoverNode,onCopySelected:a.copySelectedNode,onPaste:a.pasteNode,onDuplicate:a.duplicateNode,onDeleteSelected:a.deleteSelectedNode,onRenameCard:a.openRenameCard,onResetImport:a.onRefresh,onRestoreHistory:a.onRestoreHistory,"dev-svc-class":a.devSvcClass,"dev-svc-title":a.devSvcTitle,"dev-svc-label":a.devSvcLabel,"dev-svc-conn":a.devSvcConn,"remote-logged-in":i.credentialsReady,"has-card-source":a.hasCardSource,"history-restoring":i.restoringHistory,"history-refresh-token":i.historyRefreshToken},null,8,`chrome-off.rt.preview.schema.card-id.reload-token.meta-refresh-token.card-count.selected-node-id.move-collapse-token.active-tab.onSchemaChanged.onSchemaCommit.onSelectNode.onAddNode.onMoveNode.onHoverNode.onCopySelected.onPaste.onDuplicate.onDeleteSelected.onRenameCard.onResetImport.onRestoreHistory.dev-svc-class.dev-svc-title.dev-svc-label.dev-svc-conn.remote-logged-in.has-card-source.history-restoring.history-refresh-token`.split(`.`)),q(` 右侧常驻「接口调用」面板:与预览列 / 调试面板呈左中右布局,
396
- 展开/收起由顶栏按钮与面板内 ✕ 控制,初始状态持久化 `),i.apiPanelOpen?(V(),U(x,{key:0,rt:i.rt,onClose:t[32]||=e=>i.apiPanelOpen=!1},null,8,[`rt`])):q(`v-if`,!0)],512)],512),[[Nc,!i.chromeOff]])],512),q(` 远端预览二维码弹层:点击顶栏「远端预览」按钮打开,手机(FinMall App)扫码真机查看 `),G(S,{visible:i.remotePreviewOpen,"page-id":i.currentSchema?i.currentSchema.pageId:``,schema:i.currentSchema,onClose:t[33]||=e=>i.remotePreviewOpen=!1},null,8,[`visible`,`page-id`,`schema`]),q(` 登录凭据弹窗:点击「远端」检测到凭据未落盘时弹出(不展开下拉),填写账号密码,
397
- 保存时服务端先做一次真实登录验证,通过才落盘;验证失败保留弹窗让用户重填 `),G(hc,{name:`modal`},{default:I(()=>[i.loginModal?(V(),H(`div`,{key:0,class:`login-mask`,onClick:t[40]||=J((...e)=>a.closeLoginModal&&a.closeLoginModal(...e),[`self`])},[W(`div`,vK,[t[83]||=W(`div`,{class:`login-modal__title`},`FinMall 登录凭据`,-1),t[84]||=W(`div`,{class:`login-modal__desc`},` 本地登录凭据未落盘。请填写账号与密码,点击保存时将进行一次登录验证,验证通过后才落盘;密码仅做 MD5 后保存,不落明文。 `,-1),W(`label`,yK,[t[81]||=W(`span`,{class:`login-modal__label`},`账号`,-1),L(W(`input`,{class:`login-modal__input`,type:`text`,"onUpdate:modelValue":t[34]||=e=>i.loginName=e,placeholder:`FinMall 登录账号`,disabled:i.loginSubmitting,onKeyup:t[35]||=jl((...e)=>a.submitLogin&&a.submitLogin(...e),[`enter`])},null,40,bK),[[gl,i.loginName]])]),W(`label`,xK,[t[82]||=W(`span`,{class:`login-modal__label`},`密码`,-1),L(W(`input`,{class:`login-modal__input`,type:`password`,"onUpdate:modelValue":t[36]||=e=>i.loginPassword=e,placeholder:`FinMall 登录密码`,disabled:i.loginSubmitting,onKeyup:t[37]||=jl((...e)=>a.submitLogin&&a.submitLogin(...e),[`enter`])},null,40,SK),[[gl,i.loginPassword]])]),i.loginError?(V(),H(`div`,CK,M(i.loginError),1)):q(`v-if`,!0),W(`div`,wK,[W(`button`,{class:`login-modal__btn login-modal__btn--ghost`,type:`button`,disabled:i.loginSubmitting,onClick:t[38]||=(...e)=>a.closeLoginModal&&a.closeLoginModal(...e)},` 取消 `,8,TK),W(`button`,{class:`login-modal__btn login-modal__btn--primary`,type:`button`,disabled:i.loginSubmitting,onClick:t[39]||=(...e)=>a.submitLogin&&a.submitLogin(...e)},M(i.loginSubmitting?`验证中…`:`保存并验证`),9,EK)])])])):q(`v-if`,!0)]),_:1}),q(` 组件选择面板:点击结构树每行的「+」后弹出,选择类型即插入对应节点 `),G(hc,{name:`modal`},{default:I(()=>[i.addNodePanelOpen?(V(),U(C,{key:0,onPick:a.onPickComponent,onClose:a.cancelAddNode},null,8,[`onPick`,`onClose`])):q(`v-if`,!0)]),_:1}),q(` 卡片网格预览弹窗:点击顶栏「网格预览」图标按钮打开,选择卡片即载入工作台 `),G(w,{visible:i.galleryOpen,cards:i.cardList,"selected-id":i.selectedId,onSelect:a.onSelect,onClose:a.closeGallery,onDelete:a.onGalleryDelete,onExport:a.onGalleryExport},null,8,[`visible`,`cards`,`selected-id`,`onSelect`,`onClose`,`onDelete`,`onExport`]),q(` 远端全部卡片弹窗:顶栏「远端 → 查看全部」打开,网格浏览 + 勾选下载 / 全部下载。
397
+ 展开/收起由顶栏按钮与面板内 ✕ 控制,初始状态持久化 `),i.apiPanelOpen?(V(),U(x,{key:0,rt:i.rt,onClose:t[32]||=e=>i.apiPanelOpen=!1},null,8,[`rt`])):q(`v-if`,!0)],512)],512),[[Nc,!i.chromeOff]])],512),q(` 远端预览二维码弹层:点击顶栏「远端预览」按钮打开,手机(远端 App)扫码真机查看 `),G(S,{visible:i.remotePreviewOpen,"page-id":i.currentSchema?i.currentSchema.pageId:``,schema:i.currentSchema,onClose:t[33]||=e=>i.remotePreviewOpen=!1},null,8,[`visible`,`page-id`,`schema`]),q(` 登录凭据弹窗:点击「远端」检测到凭据未落盘时弹出(不展开下拉),填写账号密码,
398
+ 保存时服务端先做一次真实登录验证,通过才落盘;验证失败保留弹窗让用户重填 `),G(hc,{name:`modal`},{default:I(()=>[i.loginModal?(V(),H(`div`,{key:0,class:`login-mask`,onClick:t[40]||=J((...e)=>a.closeLoginModal&&a.closeLoginModal(...e),[`self`])},[W(`div`,OK,[t[83]||=W(`div`,{class:`login-modal__title`},`远端登录凭据`,-1),t[84]||=W(`div`,{class:`login-modal__desc`},` 本地登录凭据未落盘。请填写账号与密码,点击保存时将进行一次登录验证,验证通过后才落盘;密码仅做 MD5 后保存,不落明文。 `,-1),W(`label`,kK,[t[81]||=W(`span`,{class:`login-modal__label`},`账号`,-1),L(W(`input`,{class:`login-modal__input`,type:`text`,"onUpdate:modelValue":t[34]||=e=>i.loginName=e,placeholder:`远端登录账号`,disabled:i.loginSubmitting,onKeyup:t[35]||=jl((...e)=>a.submitLogin&&a.submitLogin(...e),[`enter`])},null,40,AK),[[gl,i.loginName]])]),W(`label`,jK,[t[82]||=W(`span`,{class:`login-modal__label`},`密码`,-1),L(W(`input`,{class:`login-modal__input`,type:`password`,"onUpdate:modelValue":t[36]||=e=>i.loginPassword=e,placeholder:`远端登录密码`,disabled:i.loginSubmitting,onKeyup:t[37]||=jl((...e)=>a.submitLogin&&a.submitLogin(...e),[`enter`])},null,40,MK),[[gl,i.loginPassword]])]),i.loginError?(V(),H(`div`,NK,M(i.loginError),1)):q(`v-if`,!0),W(`div`,PK,[W(`button`,{class:`login-modal__btn login-modal__btn--ghost`,type:`button`,disabled:i.loginSubmitting,onClick:t[38]||=(...e)=>a.closeLoginModal&&a.closeLoginModal(...e)},` 取消 `,8,FK),W(`button`,{class:`login-modal__btn login-modal__btn--primary`,type:`button`,disabled:i.loginSubmitting,onClick:t[39]||=(...e)=>a.submitLogin&&a.submitLogin(...e)},M(i.loginSubmitting?`验证中…`:`保存并验证`),9,IK)])])])):q(`v-if`,!0)]),_:1}),q(` 组件选择面板:点击结构树每行的「+」后弹出,选择类型即插入对应节点 `),G(hc,{name:`modal`},{default:I(()=>[i.addNodePanelOpen?(V(),U(C,{key:0,onPick:a.onPickComponent,onClose:a.cancelAddNode},null,8,[`onPick`,`onClose`])):q(`v-if`,!0)]),_:1}),q(` 卡片网格预览弹窗:点击顶栏「网格预览」图标按钮打开,选择卡片即载入工作台 `),G(w,{ref:`cardGallery`,visible:i.galleryOpen,cards:i.cardList,"selected-id":i.selectedId,compiling:i.compilingCards,onSelect:a.onSelect,onClose:a.closeGallery,onDelete:a.onGalleryDelete,onExport:a.onGalleryExport,onCompile:a.onGalleryCompile},null,8,[`visible`,`cards`,`selected-id`,`compiling`,`onSelect`,`onClose`,`onDelete`,`onExport`,`onCompile`]),q(` 远端全部卡片弹窗:顶栏「远端 → 查看全部」打开,网格浏览 + 勾选下载 / 全部下载。
398
399
  列表带双层缓存 stale-while-revalidate;@refresh 为头部刷新按钮触发的强制重验 `),G(ee,{visible:i.remoteAllOpen,cards:i.remoteCards,loading:i.remoteCardsLoading,error:i.remoteCardsError,"imported-ids":a.remoteImportedIds,downloading:i.syncProgressOpen,refreshing:i.remoteCardsRefreshing,"drawer-open":i.remoteCardFormOpen,"deleting-id":i.remoteCardDeletingId,onClose:a.closeRemoteAllCards,onRefresh:a.revalidateRemoteCards,onDownloadSelected:a.requestDownloadSelected,onDownloadAll:a.requestDownloadAll,onCreate:a.openRemoteCardCreate,onEdit:a.openRemoteCardEdit,onDelete:a.requestDeleteRemoteCard},null,8,[`visible`,`cards`,`loading`,`error`,`imported-ids`,`downloading`,`refreshing`,`drawer-open`,`deleting-id`,`onClose`,`onRefresh`,`onDownloadSelected`,`onDownloadAll`,`onCreate`,`onEdit`,`onDelete`]),q(` 远端卡片基本信息抽屉(新建 / 编辑共用):压在「远端全部卡片」弹窗之上。
399
400
  提交成功后静默重验列表,让新卡或改名结果立刻反映到网格 `),G(T,{visible:i.remoteCardFormOpen,mode:i.remoteCardFormMode,card:i.remoteCardFormCard,onClose:t[41]||=e=>i.remoteCardFormOpen=!1,onSubmitted:a.onRemoteCardSubmitted},null,8,[`visible`,`mode`,`card`,`onSubmitted`]),q(` 拉取进度卡:压在「远端全部卡片」弹窗之上,取消经 /__sync/cancel 中止后台任务 `),G(E,{visible:i.syncProgressOpen,done:i.syncProgress.done,total:i.syncProgress.total,current:i.syncProgress.current,onCancel:a.cancelSyncJob},null,8,[`visible`,`done`,`total`,`current`,`onCancel`]),q(` 导出目录选择弹框:「卡片网格预览 → 勾选 → 导出选中」后弹出,确认才起导出任务。
400
401
  必须排在所有 --z-appmodal 级弹窗之后:同 z-index(--z-appmodal-top)时后渲染才在上层,
401
402
  否则从网格弹窗内触发的目录选择会被网格本体盖住。 `),G(D,{visible:i.exportDirDialog.visible,count:i.exportDirDialog.ids.length,onConfirm:a.onExportDirConfirm,onCancel:t[42]||=e=>i.exportDirDialog.visible=!1},null,8,[`visible`,`count`,`onConfirm`]),q(` 导出进度卡:压在目录弹框与网格弹窗之上,取消经 /__export/cancel 中止后台任务 `),G(O,{visible:i.exportProgressOpen,done:i.exportProgress.done,total:i.exportProgress.total,current:i.exportProgress.current,onCancel:a.cancelExportJob},null,8,[`visible`,`done`,`total`,`current`,`onCancel`]),q(` 卡片表单弹窗(新增空白卡片 / 卡片重命名 共用一个弹窗):成功后关弹窗 + 刷列表 + 加载目标卡;existing-ids 供 ID 重名前置判定 `),G(te,{visible:i.cardDialog.visible,mode:i.cardDialog.mode,"card-id":i.cardDialog.cardId,"card-desc":i.cardDialog.cardDesc,"existing-ids":a.cardIds,onClose:t[43]||=e=>i.cardDialog.visible=!1,onCreated:a.onNewCardCreated,onRenamed:a.onCardRenamed},null,8,[`visible`,`mode`,`card-id`,`card-desc`,`existing-ids`,`onCreated`,`onRenamed`]),q(` 二次确认弹窗:版本推送 / 当前同步 / 下载选中 / 全部下载 等写/覆盖类操作前弹出,确认后才执行。
402
403
  必须排在所有 --z-appmodal 级弹窗之后:同 z-index 时后渲染的才在上层,
403
- 否则从「远端全部卡片」等弹窗内触发的确认会被弹窗本体盖住。 `),G(ne,{visible:i.confirm.show,title:i.confirm.title,message:i.confirm.message,"confirm-text":i.confirm.confirmText,"cancel-text":i.confirm.cancelText,severity:i.confirm.severity,onConfirm:a.onConfirmDialog,onCancel:a.onCancelDialog},null,8,[`visible`,`title`,`message`,`confirm-text`,`cancel-text`,`severity`,`onConfirm`,`onCancel`]),q(` App 级弱提示:顶栏异步操作(远端保存 / 同步)完成反馈,浮于 App 外壳顶部居中 `),G(re),q(` 对话图片大图查看器:AI 面板里点预览图后全屏缩放查看,Teleport 到 body `),G(ie)],6)}var OK=Z(hG,[[`render`,DK],[`__file`,`/Users/ynet/dsl-card/card-editor/App.vue`]]),kK={name:`SetText`,props:{...Y_,multiline:{type:Boolean,default:!1}},emits:X_,computed:{text(){return this.value===void 0||this.value===null?``:String(this.value)},rows(){let e=this.options.autosize;return e&&typeof e==`object`&&e.minRows?e.minRows:4}},methods:{onInput(e){this.$emit(`input`,e)}}},AK=[`rows`,`placeholder`,`disabled`,`value`],jK=[`placeholder`,`disabled`,`value`];function MK(e,t,n,r,i,a){return n.multiline?(V(),H(`textarea`,{key:0,class:`st-textarea`,rows:a.rows,placeholder:e.options.placeholder||``,disabled:e.disabled,value:a.text,onInput:t[0]||=e=>a.onInput(e.target.value),onChange:t[1]||=t=>e.$emit(`change`)},null,40,AK)):(V(),H(`input`,{key:1,class:`ni-input`,type:`text`,placeholder:e.options.placeholder||``,disabled:e.disabled,value:a.text,onInput:t[2]||=e=>a.onInput(e.target.value),onChange:t[3]||=t=>e.$emit(`change`)},null,40,jK))}var NK=Z(kK,[[`render`,MK],[`__file`,`/Users/ynet/dsl-card/card-editor/components/setters/SetText.vue`]]),PK={integer:/^-?(0|[1-9][0-9]*)?$/,"+integer":/^(0|[1-9][0-9]*)?$/,"-integer":/^(0|-[1-9]?[0-9]*)?$/,float:/^-?([0-9]*|(0|[1-9][0-9]*)\.[0-9]*)?$/,"+float":/^([0-9]*|(0|[1-9][0-9]*)\.[0-9]*)?$/,"-float":/^(0|-[0-9]*|-(0|[1-9][0-9]*)\.[0-9]*)?$/},FK={name:`SetNumber`,props:Y_,emits:X_,data(){return{inputValue:``,sugOpen:!1}},computed:{suggestions(){return this.options.iParamList||[]},pattern(){return PK[this.options.type]||PK.integer}},watch:{value:{immediate:!0,handler(e){this.inputValue=e==null?``:String(e)}}},methods:{onInput(e){this.pattern.test(e)?(this.inputValue=e,this.$emit(`input`,e)):this.$refs.field.value=this.inputValue},step(e){let t=parseFloat(this.inputValue),n=String((Number.isNaN(t)?0:t)+e);this.pattern.test(n)&&(this.inputValue=n,this.$emit(`input`,n),this.emitChange())},pick(e){this.sugOpen=!1,this.inputValue=String(e.key),this.$emit(`input`,this.inputValue),this.emitChange()},closeSug(){setTimeout(()=>this.sugOpen=!1,0)},emitChange(){this.$emit(`change`)}}},IK={class:`st-number-wrap`},LK={class:`st-number`},RK=[`placeholder`,`disabled`,`value`],zK={key:0,class:`st-number__symbol st-number__symbol--btn`},BK={key:1,class:`st-number__symbol`},VK={key:0,class:`st-pop st-pop--sug`},HK=[`onMousedown`];function UK(e,t,n,r,i,a){return V(),H(`div`,IK,[W(`div`,LK,[W(`input`,{ref:`field`,class:`st-number__field`,type:`text`,placeholder:e.options.placeholder||`请输入`,disabled:e.disabled,value:i.inputValue,onInput:t[0]||=e=>a.onInput(e.target.value),onChange:t[1]||=e=>a.emitChange(),onKeydown:[t[2]||=jl(J(e=>a.step(1),[`prevent`]),[`up`]),t[3]||=jl(J(e=>a.step(-1),[`prevent`]),[`down`])],onBlur:t[4]||=e=>a.closeSug()},null,40,RK),e.$slots.symbol?(V(),H(`span`,zK,[ca(e.$slots,`symbol`)])):e.options.symbol&&e.options.symbol!==!0?(V(),H(`span`,BK,M(e.options.symbol),1)):q(`v-if`,!0),a.suggestions.length?(V(),H(`span`,{key:2,class:`st-number__caret`,title:`预设值`,onMousedown:t[5]||=J(e=>i.sugOpen=!i.sugOpen,[`prevent`])},`▾`,32)):q(`v-if`,!0)]),q(` 预设值浮层:移出 .st-number,避免被 overflow:hidden 裁切 `),i.sugOpen&&a.suggestions.length?(V(),H(`div`,VK,[(V(!0),H(B,null,z(a.suggestions,e=>(V(),H(`div`,{key:e.key,class:j([`st-pop__item`,{"st-pop__item--on":String(e.key)===String(i.inputValue)}]),onMousedown:J(t=>a.pick(e),[`prevent`])},M(e.value),43,HK))),128))])):q(`v-if`,!0)])}var WK=Z(FK,[[`render`,UK],[`__file`,`/Users/ynet/dsl-card/card-editor/components/setters/SetNumber.vue`]]),GK={name:`SetSelect`,props:Y_,emits:X_,computed:{list(){return this.options.iParamList||this.options.iTypeList||[]},placeholder(){return this.options.placeholder||`请选择`},optionList(){return this.list.map(e=>({key:String(e.key),value:e.value}))},current(){return this.value===void 0||this.value===null?``:String(this.value)}},methods:{onChange(e){this.$emit(`input`,e),this.$emit(`change`)}}};function KK(e,t,n,r,i,a){let o=R(`Dropdown`);return V(),U(o,{value:a.current,options:a.optionList,placeholder:a.placeholder,clearable:``,size:`sm`,block:``,disabled:e.disabled,onInput:a.onChange},null,8,[`value`,`options`,`placeholder`,`disabled`,`onInput`])}var qK=Z(GK,[[`render`,KK],[`__file`,`/Users/ynet/dsl-card/card-editor/components/setters/SetSelect.vue`]]),JK={name:`SetSwitch`,props:{...Y_,boolean:{type:Boolean,default:!1}},emits:X_,computed:{activeValue(){return this.options.activeValue===void 0?this.boolean?!0:`1`:this.options.activeValue},inactiveValue(){return this.options.inactiveValue===void 0?!this.boolean&&`0`:this.options.inactiveValue},on(){return this.value===this.activeValue},activeText(){return this.options.activeText||`开`},inactiveText(){return this.options.inactiveText||`关`}},methods:{toggle(){this.disabled||(this.$emit(`input`,this.on?this.inactiveValue:this.activeValue),this.$emit(`change`))}}},YK={class:`st-switch__text`};function XK(e,t,n,r,i,a){return V(),H(`div`,{class:j([`st-switch`,{"st-switch--on":a.on}]),onClick:t[0]||=(...e)=>a.toggle&&a.toggle(...e)},[t[1]||=W(`span`,{class:`st-switch__track`},[W(`span`,{class:`st-switch__knob`})],-1),W(`span`,YK,M(a.on?a.activeText:a.inactiveText),1)],2)}var ZK=Z(JK,[[`render`,XK],[`__file`,`/Users/ynet/dsl-card/card-editor/components/setters/SetSwitch.vue`]]);function QK(e,t){t===void 0&&(t={});var n=t.insertAt;if(e&&typeof document<`u`){var r=document.head||document.getElementsByTagName(`head`)[0],i=document.createElement(`style`);i.type=`text/css`,n===`top`&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}var $K=function(e,t){let{componentPrefix:n=``}=t||{};e.component(`${n}${this.name}`,this)},eq={},tq={name:`Checkboard`,props:{size:{type:[Number,String],default:8},white:{type:String,default:`#fff`},grey:{type:String,default:`#e6e6e6`}},computed:{bgStyle(){return{"background-image":`url(${rq(this.white,this.grey,this.size)})`}}}};function nq(e,t,n){if(typeof document>`u`)return null;let r=document.createElement(`canvas`);r.width=r.height=n*2;let i=r.getContext(`2d`);return i?(i.fillStyle=e,i.fillRect(0,0,r.width,r.height),i.fillStyle=t,i.fillRect(0,0,n,n),i.translate(n,n),i.fillRect(0,0,n,n),r.toDataURL()):null}function rq(e,t,n){let r=`${e},${t},${n}`;if(eq[r])return eq[r];let i=nq(e,t,n);return eq[r]=i,i}function iq(e,t,n,r,i,a){return V(),H(`div`,{class:`vc-checkerboard`,style:A(a.bgStyle)},null,4)}QK(`.vc-checkerboard{background-size:contain;bottom:0;left:0;position:absolute;right:0;top:0}`),tq.render=iq,tq.__file=`src/components/checkboard/checkboard.vue`,tq.install=$K;var aq={name:`Alpha`,components:{Checkboard:tq},props:{value:Object,onChange:Function},computed:{colors(){return this.value},gradientColor(){let{rgba:e}=this.colors,t=[e.r,e.g,e.b].join(`,`);return`linear-gradient(to right, rgba(${t}, 0) 0%, rgba(${t}, 1) 100%)`}},methods:{handleChange(e,t){!t&&e.preventDefault();let{container:n}=this.$refs;if(!n)return;let r=n.clientWidth,i=n.getBoundingClientRect().left+window.pageXOffset,a=(e.pageX||(e.touches?e.touches[0].pageX:0))-i,o;o=a<0?0:a>r?1:Math.round(a*100/r)/100,this.colors.a!==o&&this.$emit(`change`,{h:this.colors.hsl.h,s:this.colors.hsl.s,l:this.colors.hsl.l,a:o,source:`rgba`})},handleMouseDown(e){this.handleChange(e,!0),window.addEventListener(`mousemove`,this.handleChange),window.addEventListener(`mouseup`,this.handleMouseUp)},handleMouseUp(){this.unbindEventListeners()},unbindEventListeners(){window.removeEventListener(`mousemove`,this.handleChange),window.removeEventListener(`mouseup`,this.handleMouseUp)}}},oq={class:`vc-alpha`},sq={class:`vc-alpha-checkboard-wrap`},cq=[W(`div`,{class:`vc-alpha-picker`},null,-1)];function lq(e,t,n,r,i,a){let o=R(`Checkboard`);return V(),H(`div`,oq,[W(`div`,sq,[G(o)]),W(`div`,{class:`vc-alpha-gradient`,style:A({background:a.gradientColor})},null,4),W(`div`,{ref:`container`,class:`vc-alpha-container`,onMousedown:t[0]||=(...e)=>a.handleMouseDown&&a.handleMouseDown(...e),onTouchmove:t[1]||=(...e)=>a.handleChange&&a.handleChange(...e),onTouchstart:t[2]||=(...e)=>a.handleChange&&a.handleChange(...e)},[W(`div`,{class:`vc-alpha-pointer`,style:A({left:`${a.colors.a*100}%`})},cq,4)],544)])}QK(`.vc-alpha,.vc-alpha-checkboard-wrap{bottom:0;left:0;position:absolute;right:0;top:0}.vc-alpha-checkboard-wrap{overflow:hidden}.vc-alpha-gradient{bottom:0;left:0;position:absolute;right:0;top:0}.vc-alpha-container{cursor:pointer;height:100%;margin:0 3px;position:relative;z-index:2}.vc-alpha-pointer{position:absolute;z-index:2}.vc-alpha-picker{background:#fff;border-radius:1px;box-shadow:0 0 2px rgba(0,0,0,.6);cursor:pointer;height:8px;margin-top:1px;transform:translateX(-2px);width:4px}`),aq.render=lq,aq.__file=`src/components/alpha/alpha.vue`,aq.install=$K;function uq(e,t){fq(e)&&(e=`100%`);var n=pq(e);return e=t===360?e:Math.min(t,Math.max(0,parseFloat(e))),n&&(e=parseInt(String(e*t),10)/100),Math.abs(e-t)<1e-6?1:(e=t===360?(e<0?e%t+t:e%t)/parseFloat(String(t)):e%t/parseFloat(String(t)),e)}function dq(e){return Math.min(1,Math.max(0,e))}function fq(e){return typeof e==`string`&&e.indexOf(`.`)!==-1&&parseFloat(e)===1}function pq(e){return typeof e==`string`&&e.indexOf(`%`)!==-1}function mq(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function hq(e){return e<=1?`${Number(e)*100}%`:e}function gq(e){return e.length===1?`0`+e:String(e)}function _q(e,t,n){return{r:uq(e,255)*255,g:uq(t,255)*255,b:uq(n,255)*255}}function vq(e,t,n){e=uq(e,255),t=uq(t,255),n=uq(n,255);var r=Math.max(e,t,n),i=Math.min(e,t,n),a=0,o=0,s=(r+i)/2;if(r===i)o=0,a=0;else{var c=r-i;switch(o=s>.5?c/(2-r-i):c/(r+i),r){case e:a=(t-n)/c+(t<n?6:0);break;case t:a=(n-e)/c+2;break;case n:a=(e-t)/c+4}a/=6}return{h:a,s:o,l:s}}function yq(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*(6*n):n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function bq(e,t,n){var r,i,a;if(e=uq(e,360),t=uq(t,100),n=uq(n,100),t===0)i=n,a=n,r=n;else{var o=n<.5?n*(1+t):n+t-n*t,s=2*n-o;r=yq(s,o,e+1/3),i=yq(s,o,e),a=yq(s,o,e-1/3)}return{r:r*255,g:i*255,b:a*255}}function xq(e,t,n){e=uq(e,255),t=uq(t,255),n=uq(n,255);var r=Math.max(e,t,n),i=Math.min(e,t,n),a=0,o=r,s=r-i,c=r===0?0:s/r;if(r===i)a=0;else{switch(r){case e:a=(t-n)/s+(t<n?6:0);break;case t:a=(n-e)/s+2;break;case n:a=(e-t)/s+4}a/=6}return{h:a,s:c,v:o}}function Sq(e,t,n){e=uq(e,360)*6,t=uq(t,100),n=uq(n,100);var r=Math.floor(e),i=e-r,a=n*(1-t),o=n*(1-i*t),s=n*(1-(1-i)*t),c=r%6,l=[n,o,a,a,s,n][c],u=[s,n,n,o,a,a][c],d=[a,a,s,n,n,o][c];return{r:l*255,g:u*255,b:d*255}}function Cq(e,t,n,r){var i=[gq(Math.round(e).toString(16)),gq(Math.round(t).toString(16)),gq(Math.round(n).toString(16))];return r&&i[0].startsWith(i[0].charAt(1))&&i[1].startsWith(i[1].charAt(1))&&i[2].startsWith(i[2].charAt(1))?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join(``)}function wq(e,t,n,r,i){var a=[gq(Math.round(e).toString(16)),gq(Math.round(t).toString(16)),gq(Math.round(n).toString(16)),gq(Tq(r))];return i&&a[0].startsWith(a[0].charAt(1))&&a[1].startsWith(a[1].charAt(1))&&a[2].startsWith(a[2].charAt(1))&&a[3].startsWith(a[3].charAt(1))?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):a.join(``)}function Tq(e){return Math.round(parseFloat(e)*255).toString(16)}function Eq(e){return Dq(e)/255}function Dq(e){return parseInt(e,16)}function Oq(e){return{r:e>>16,g:(e&65280)>>8,b:e&255}}var kq={aliceblue:`#f0f8ff`,antiquewhite:`#faebd7`,aqua:`#00ffff`,aquamarine:`#7fffd4`,azure:`#f0ffff`,beige:`#f5f5dc`,bisque:`#ffe4c4`,black:`#000000`,blanchedalmond:`#ffebcd`,blue:`#0000ff`,blueviolet:`#8a2be2`,brown:`#a52a2a`,burlywood:`#deb887`,cadetblue:`#5f9ea0`,chartreuse:`#7fff00`,chocolate:`#d2691e`,coral:`#ff7f50`,cornflowerblue:`#6495ed`,cornsilk:`#fff8dc`,crimson:`#dc143c`,cyan:`#00ffff`,darkblue:`#00008b`,darkcyan:`#008b8b`,darkgoldenrod:`#b8860b`,darkgray:`#a9a9a9`,darkgreen:`#006400`,darkgrey:`#a9a9a9`,darkkhaki:`#bdb76b`,darkmagenta:`#8b008b`,darkolivegreen:`#556b2f`,darkorange:`#ff8c00`,darkorchid:`#9932cc`,darkred:`#8b0000`,darksalmon:`#e9967a`,darkseagreen:`#8fbc8f`,darkslateblue:`#483d8b`,darkslategray:`#2f4f4f`,darkslategrey:`#2f4f4f`,darkturquoise:`#00ced1`,darkviolet:`#9400d3`,deeppink:`#ff1493`,deepskyblue:`#00bfff`,dimgray:`#696969`,dimgrey:`#696969`,dodgerblue:`#1e90ff`,firebrick:`#b22222`,floralwhite:`#fffaf0`,forestgreen:`#228b22`,fuchsia:`#ff00ff`,gainsboro:`#dcdcdc`,ghostwhite:`#f8f8ff`,goldenrod:`#daa520`,gold:`#ffd700`,gray:`#808080`,green:`#008000`,greenyellow:`#adff2f`,grey:`#808080`,honeydew:`#f0fff0`,hotpink:`#ff69b4`,indianred:`#cd5c5c`,indigo:`#4b0082`,ivory:`#fffff0`,khaki:`#f0e68c`,lavenderblush:`#fff0f5`,lavender:`#e6e6fa`,lawngreen:`#7cfc00`,lemonchiffon:`#fffacd`,lightblue:`#add8e6`,lightcoral:`#f08080`,lightcyan:`#e0ffff`,lightgoldenrodyellow:`#fafad2`,lightgray:`#d3d3d3`,lightgreen:`#90ee90`,lightgrey:`#d3d3d3`,lightpink:`#ffb6c1`,lightsalmon:`#ffa07a`,lightseagreen:`#20b2aa`,lightskyblue:`#87cefa`,lightslategray:`#778899`,lightslategrey:`#778899`,lightsteelblue:`#b0c4de`,lightyellow:`#ffffe0`,lime:`#00ff00`,limegreen:`#32cd32`,linen:`#faf0e6`,magenta:`#ff00ff`,maroon:`#800000`,mediumaquamarine:`#66cdaa`,mediumblue:`#0000cd`,mediumorchid:`#ba55d3`,mediumpurple:`#9370db`,mediumseagreen:`#3cb371`,mediumslateblue:`#7b68ee`,mediumspringgreen:`#00fa9a`,mediumturquoise:`#48d1cc`,mediumvioletred:`#c71585`,midnightblue:`#191970`,mintcream:`#f5fffa`,mistyrose:`#ffe4e1`,moccasin:`#ffe4b5`,navajowhite:`#ffdead`,navy:`#000080`,oldlace:`#fdf5e6`,olive:`#808000`,olivedrab:`#6b8e23`,orange:`#ffa500`,orangered:`#ff4500`,orchid:`#da70d6`,palegoldenrod:`#eee8aa`,palegreen:`#98fb98`,paleturquoise:`#afeeee`,palevioletred:`#db7093`,papayawhip:`#ffefd5`,peachpuff:`#ffdab9`,peru:`#cd853f`,pink:`#ffc0cb`,plum:`#dda0dd`,powderblue:`#b0e0e6`,purple:`#800080`,rebeccapurple:`#663399`,red:`#ff0000`,rosybrown:`#bc8f8f`,royalblue:`#4169e1`,saddlebrown:`#8b4513`,salmon:`#fa8072`,sandybrown:`#f4a460`,seagreen:`#2e8b57`,seashell:`#fff5ee`,sienna:`#a0522d`,silver:`#c0c0c0`,skyblue:`#87ceeb`,slateblue:`#6a5acd`,slategray:`#708090`,slategrey:`#708090`,snow:`#fffafa`,springgreen:`#00ff7f`,steelblue:`#4682b4`,tan:`#d2b48c`,teal:`#008080`,thistle:`#d8bfd8`,tomato:`#ff6347`,turquoise:`#40e0d0`,violet:`#ee82ee`,wheat:`#f5deb3`,white:`#ffffff`,whitesmoke:`#f5f5f5`,yellow:`#ffff00`,yellowgreen:`#9acd32`};function Aq(e){var t={r:0,g:0,b:0},n=1,r=null,i=null,a=null,o=!1,s=!1;return typeof e==`string`&&(e=Fq(e)),typeof e==`object`&&(Iq(e.r)&&Iq(e.g)&&Iq(e.b)?(t=_q(e.r,e.g,e.b),o=!0,s=String(e.r).substr(-1)===`%`?`prgb`:`rgb`):Iq(e.h)&&Iq(e.s)&&Iq(e.v)?(r=hq(e.s),i=hq(e.v),t=Sq(e.h,r,i),o=!0,s=`hsv`):Iq(e.h)&&Iq(e.s)&&Iq(e.l)&&(r=hq(e.s),a=hq(e.l),t=bq(e.h,r,a),o=!0,s=`hsl`),Object.prototype.hasOwnProperty.call(e,`a`)&&(n=e.a)),n=mq(n),{ok:o,format:e.format||s,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:n}}var jq=`(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)`,Mq=`[\\s|\\(]+(${jq})[,|\\s]+(${jq})[,|\\s]+(${jq})\\s*\\)?`,Nq=`[\\s|\\(]+(${jq})[,|\\s]+(${jq})[,|\\s]+(${jq})[,|\\s]+(${jq})\\s*\\)?`,Pq={CSS_UNIT:new RegExp(jq),rgb:RegExp(`rgb`+Mq),rgba:RegExp(`rgba`+Nq),hsl:RegExp(`hsl`+Mq),hsla:RegExp(`hsla`+Nq),hsv:RegExp(`hsv`+Mq),hsva:RegExp(`hsva`+Nq),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/};function Fq(e){if(e=e.trim().toLowerCase(),e.length===0)return!1;var t=!1;if(kq[e])e=kq[e],t=!0;else if(e===`transparent`)return{r:0,g:0,b:0,a:0,format:`name`};var n=Pq.rgb.exec(e);return n?{r:n[1],g:n[2],b:n[3]}:(n=Pq.rgba.exec(e),n?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=Pq.hsl.exec(e),n?{h:n[1],s:n[2],l:n[3]}:(n=Pq.hsla.exec(e),n?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=Pq.hsv.exec(e),n?{h:n[1],s:n[2],v:n[3]}:(n=Pq.hsva.exec(e),n?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=Pq.hex8.exec(e),n?{r:Dq(n[1]),g:Dq(n[2]),b:Dq(n[3]),a:Eq(n[4]),format:t?`name`:`hex8`}:(n=Pq.hex6.exec(e),n?{r:Dq(n[1]),g:Dq(n[2]),b:Dq(n[3]),format:t?`name`:`hex`}:(n=Pq.hex4.exec(e),n?{r:Dq(n[1]+n[1]),g:Dq(n[2]+n[2]),b:Dq(n[3]+n[3]),a:Eq(n[4]+n[4]),format:t?`name`:`hex8`}:(n=Pq.hex3.exec(e),n?{r:Dq(n[1]+n[1]),g:Dq(n[2]+n[2]),b:Dq(n[3]+n[3]),format:t?`name`:`hex`}:!1)))))))))}function Iq(e){return!!Pq.CSS_UNIT.exec(String(e))}var Lq=function(){function e(t,n){if(t===void 0&&(t=``),n===void 0&&(n={}),t instanceof e)return t;typeof t==`number`&&(t=Oq(t)),this.originalInput=t;var r=Aq(t);this.originalInput=t,this.r=r.r,this.g=r.g,this.b=r.b,this.a=r.a,this.roundA=Math.round(100*this.a)/100,this.format=n.format??r.format,this.gradientType=n.gradientType,this.r<1&&(this.r=Math.round(this.r)),this.g<1&&(this.g=Math.round(this.g)),this.b<1&&(this.b=Math.round(this.b)),this.isValid=r.ok}return e.prototype.isDark=function(){return this.getBrightness()<128},e.prototype.isLight=function(){return!this.isDark()},e.prototype.getBrightness=function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},e.prototype.getLuminance=function(){var e=this.toRgb(),t,n,r,i=e.r/255,a=e.g/255,o=e.b/255;return t=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,n=a<=.03928?a/12.92:((a+.055)/1.055)**2.4,r=o<=.03928?o/12.92:((o+.055)/1.055)**2.4,.2126*t+.7152*n+.0722*r},e.prototype.getAlpha=function(){return this.a},e.prototype.setAlpha=function(e){return this.a=mq(e),this.roundA=Math.round(100*this.a)/100,this},e.prototype.isMonochrome=function(){return this.toHsl().s===0},e.prototype.toHsv=function(){var e=xq(this.r,this.g,this.b);return{h:e.h*360,s:e.s,v:e.v,a:this.a}},e.prototype.toHsvString=function(){var e=xq(this.r,this.g,this.b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.v*100);return this.a===1?`hsv(${t}, ${n}%, ${r}%)`:`hsva(${t}, ${n}%, ${r}%, ${this.roundA})`},e.prototype.toHsl=function(){var e=vq(this.r,this.g,this.b);return{h:e.h*360,s:e.s,l:e.l,a:this.a}},e.prototype.toHslString=function(){var e=vq(this.r,this.g,this.b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.l*100);return this.a===1?`hsl(${t}, ${n}%, ${r}%)`:`hsla(${t}, ${n}%, ${r}%, ${this.roundA})`},e.prototype.toHex=function(e){return e===void 0&&(e=!1),Cq(this.r,this.g,this.b,e)},e.prototype.toHexString=function(e){return e===void 0&&(e=!1),`#`+this.toHex(e)},e.prototype.toHex8=function(e){return e===void 0&&(e=!1),wq(this.r,this.g,this.b,this.a,e)},e.prototype.toHex8String=function(e){return e===void 0&&(e=!1),`#`+this.toHex8(e)},e.prototype.toHexShortString=function(e){return e===void 0&&(e=!1),this.a===1?this.toHexString(e):this.toHex8String(e)},e.prototype.toRgb=function(){return{r:Math.round(this.r),g:Math.round(this.g),b:Math.round(this.b),a:this.a}},e.prototype.toRgbString=function(){var e=Math.round(this.r),t=Math.round(this.g),n=Math.round(this.b);return this.a===1?`rgb(${e}, ${t}, ${n})`:`rgba(${e}, ${t}, ${n}, ${this.roundA})`},e.prototype.toPercentageRgb=function(){var e=function(e){return`${Math.round(uq(e,255)*100)}%`};return{r:e(this.r),g:e(this.g),b:e(this.b),a:this.a}},e.prototype.toPercentageRgbString=function(){var e=function(e){return Math.round(uq(e,255)*100)};return this.a===1?`rgb(${e(this.r)}%, ${e(this.g)}%, ${e(this.b)}%)`:`rgba(${e(this.r)}%, ${e(this.g)}%, ${e(this.b)}%, ${this.roundA})`},e.prototype.toName=function(){if(this.a===0)return`transparent`;if(this.a<1)return!1;for(var e=`#`+Cq(this.r,this.g,this.b,!1),t=0,n=Object.entries(kq);t<n.length;t++){var r=n[t],i=r[0];if(e===r[1])return i}return!1},e.prototype.toString=function(e){var t=!!e;e??=this.format;var n=!1,r=this.a<1&&this.a>=0;return!t&&r&&(e.startsWith(`hex`)||e===`name`)?e===`name`&&this.a===0?this.toName():this.toRgbString():(e===`rgb`&&(n=this.toRgbString()),e===`prgb`&&(n=this.toPercentageRgbString()),(e===`hex`||e===`hex6`)&&(n=this.toHexString()),e===`hex3`&&(n=this.toHexString(!0)),e===`hex4`&&(n=this.toHex8String(!0)),e===`hex8`&&(n=this.toHex8String()),e===`name`&&(n=this.toName()),e===`hsl`&&(n=this.toHslString()),e===`hsv`&&(n=this.toHsvString()),n||this.toHexString())},e.prototype.toNumber=function(){return(Math.round(this.r)<<16)+(Math.round(this.g)<<8)+Math.round(this.b)},e.prototype.clone=function(){return new e(this.toString())},e.prototype.lighten=function(t){t===void 0&&(t=10);var n=this.toHsl();return n.l+=t/100,n.l=dq(n.l),new e(n)},e.prototype.brighten=function(t){t===void 0&&(t=10);var n=this.toRgb();return n.r=Math.max(0,Math.min(255,n.r-Math.round(255*-(t/100)))),n.g=Math.max(0,Math.min(255,n.g-Math.round(255*-(t/100)))),n.b=Math.max(0,Math.min(255,n.b-Math.round(255*-(t/100)))),new e(n)},e.prototype.darken=function(t){t===void 0&&(t=10);var n=this.toHsl();return n.l-=t/100,n.l=dq(n.l),new e(n)},e.prototype.tint=function(e){return e===void 0&&(e=10),this.mix(`white`,e)},e.prototype.shade=function(e){return e===void 0&&(e=10),this.mix(`black`,e)},e.prototype.desaturate=function(t){t===void 0&&(t=10);var n=this.toHsl();return n.s-=t/100,n.s=dq(n.s),new e(n)},e.prototype.saturate=function(t){t===void 0&&(t=10);var n=this.toHsl();return n.s+=t/100,n.s=dq(n.s),new e(n)},e.prototype.greyscale=function(){return this.desaturate(100)},e.prototype.spin=function(t){var n=this.toHsl(),r=(n.h+t)%360;return n.h=r<0?360+r:r,new e(n)},e.prototype.mix=function(t,n){n===void 0&&(n=50);var r=this.toRgb(),i=new e(t).toRgb(),a=n/100;return new e({r:(i.r-r.r)*a+r.r,g:(i.g-r.g)*a+r.g,b:(i.b-r.b)*a+r.b,a:(i.a-r.a)*a+r.a})},e.prototype.analogous=function(t,n){t===void 0&&(t=6),n===void 0&&(n=30);var r=this.toHsl(),i=360/n,a=[this];for(r.h=(r.h-(i*t>>1)+720)%360;--t;)r.h=(r.h+i)%360,a.push(new e(r));return a},e.prototype.complement=function(){var t=this.toHsl();return t.h=(t.h+180)%360,new e(t)},e.prototype.monochromatic=function(t){t===void 0&&(t=6);for(var n=this.toHsv(),r=n.h,i=n.s,a=n.v,o=[],s=1/t;t--;)o.push(new e({h:r,s:i,v:a})),a=(a+s)%1;return o},e.prototype.splitcomplement=function(){var t=this.toHsl(),n=t.h;return[this,new e({h:(n+72)%360,s:t.s,l:t.l}),new e({h:(n+216)%360,s:t.s,l:t.l})]},e.prototype.onBackground=function(t){var n=this.toRgb(),r=new e(t).toRgb(),i=n.a+r.a*(1-n.a);return new e({r:(n.r*n.a+r.r*r.a*(1-n.a))/i,g:(n.g*n.a+r.g*r.a*(1-n.a))/i,b:(n.b*n.a+r.b*r.a*(1-n.a))/i,a:i})},e.prototype.triad=function(){return this.polyad(3)},e.prototype.tetrad=function(){return this.polyad(4)},e.prototype.polyad=function(t){for(var n=this.toHsl(),r=n.h,i=[this],a=360/t,o=1;o<t;o++)i.push(new e({h:(r+o*a)%360,s:n.s,l:n.l}));return i},e.prototype.equals=function(t){return this.toRgbString()===new e(t).toRgbString()},e}();function Rq(...e){return new Lq(...e)}function zq(e,t){let n=e&&e.a,r;r=e&&e.hsl?Rq(e.hsl):e&&e.hex&&e.hex.length>0?Rq(e.hex):e&&e.hsv?Rq(e.hsv):e&&e.rgba?Rq(e.rgba):e&&e.rgb?Rq(e.rgb):Rq(e),r&&(r._a===void 0||r._a===null)&&r.setAlpha(n||r.getAlpha());let i=r.toHsl(),a=r.toHsv();return i.s===0&&(a.h=i.h=e.h||e.hsl&&e.hsl.h||t||0),a.v<.0164&&(a.h=e.h||e.hsv&&e.hsv.h||0,a.s=e.s||e.hsv&&e.hsv.s||0),i.l<.01&&(i.h=e.h||e.hsl&&e.hsl.h||0,i.s=e.s||e.hsl&&e.hsl.s||0),{hsl:i,hex:r.toHexString().toUpperCase(),hex8:r.toHex8String().toUpperCase(),rgba:r.toRgb(),hsv:a,oldHue:e.h||t||i.h,source:e.source,a:r.getAlpha()}}var Bq={model:{prop:`modelValue`,event:`update:modelValue`},props:[`modelValue`],data(){return{val:zq(this.modelValue)}},computed:{colors:{get(){return this.val},set(e){this.val=e,this.$emit(`update:modelValue`,e)}}},watch:{modelValue(e){this.val=zq(e)}},methods:{colorChange(e,t){this.oldHue=this.colors.hsl.h,this.colors=zq(e,t||this.oldHue)},isValidHex(e){return Rq(e).isValid},simpleCheckForValidColor(e){let t=[`r`,`g`,`b`,`a`,`h`,`s`,`l`,`v`],n=0,r=0;for(let i=0;i<t.length;i++){let a=t[i];e[a]&&(n++,isNaN(e[a])||r++)}if(n===r)return e},paletteUpperCase(e){return e.map(e=>e.toUpperCase())},isTransparent(e){return Rq(e).getAlpha()===0}}},Vq={name:`EditableInput`,props:{label:String,labelText:String,desc:String,value:[String,Number],max:Number,min:Number,arrowOffset:{type:Number,default:1}},computed:{val:{get(){return this.value},set(e){if(this.max!==void 0&&+e>this.max)this.$refs.input.value=this.max;else return e}},labelId(){return`input__label__${this.label}__${Math.random().toString().slice(2,5)}`},labelSpanText(){return this.labelText||this.label}},methods:{update(e){this.handleChange(e.target.value)},handleChange(e){let t={};t[this.label]=e,(t.hex===void 0&&t[`#`]===void 0||e.length>5)&&this.$emit(`change`,t)},handleKeyDown(e){let{val:t}=this,n=Number(t);if(n){let r=this.arrowOffset||1;e.keyCode===38&&(t=n+r,this.handleChange(t),e.preventDefault()),e.keyCode===40&&(t=n-r,this.handleChange(t),e.preventDefault())}}}},Hq={class:`vc-editable-input`},Uq=[`aria-labelledby`],Wq=[`id`,`for`],Gq={class:`vc-input__desc`};function Kq(e,t,n,r,i,a){return V(),H(`div`,Hq,[L(W(`input`,{ref:`input`,"onUpdate:modelValue":t[0]||=e=>a.val=e,"aria-labelledby":a.labelId,class:`vc-input__input`,onKeydown:t[1]||=(...e)=>a.handleKeyDown&&a.handleKeyDown(...e),onInput:t[2]||=(...e)=>a.update&&a.update(...e)},null,40,Uq),[[gl,a.val]]),W(`span`,{id:a.labelId,for:n.label,class:`vc-input__label`},M(a.labelSpanText),9,Wq),W(`span`,Gq,M(n.desc),1)])}QK(`.vc-editable-input{position:relative}.vc-input__input{border:0;outline:none;padding:0}.vc-input__label{text-transform:capitalize}`),Vq.render=Kq,Vq.__file=`src/components/editable-input/editable-input.vue`,Vq.install=$K;function qq(e,t,n){return t<n?e<t?t:e>n?n:e:e<n?n:e>t?t:e}var Jq={name:`Saturation`,props:{value:Object},computed:{colors(){return this.value},bgColor(){return`hsl(${this.colors.hsv.h}, 100%, 50%)`},pointerTop(){return`${-(this.colors.hsv.v*100)+1+100}%`},pointerLeft(){return`${this.colors.hsv.s*100}%`}},methods:{handleChange(e,t){!t&&e.preventDefault();let{container:n}=this.$refs;if(!n)return;let r=n.clientWidth,i=n.clientHeight,a=n.getBoundingClientRect().left+window.pageXOffset,o=n.getBoundingClientRect().top+window.pageYOffset,s=e.pageX||(e.touches?e.touches[0].pageX:0),c=e.pageY||(e.touches?e.touches[0].pageY:0),l=qq(s-a,0,r),u=qq(c-o,0,i),d=l/r,f=qq(-(u/i)+1,0,1);this.onChange({h:this.colors.hsv.h,s:d,v:f,a:this.colors.hsv.a,source:`hsva`})},onChange(e){this.$emit(`change`,e)},handleMouseDown(e){window.addEventListener(`mousemove`,this.handleChange),window.addEventListener(`mouseup`,this.handleChange),window.addEventListener(`mouseup`,this.handleMouseUp)},handleMouseUp(e){this.unbindEventListeners()},unbindEventListeners(){window.removeEventListener(`mousemove`,this.handleChange),window.removeEventListener(`mouseup`,this.handleChange),window.removeEventListener(`mouseup`,this.handleMouseUp)}}},Yq=W(`div`,{class:`vc-saturation--white`},null,-1),Xq=W(`div`,{class:`vc-saturation--black`},null,-1),Zq=[W(`div`,{class:`vc-saturation-circle`},null,-1)];function Qq(e,t,n,r,i,a){return V(),H(`div`,{ref:`container`,class:`vc-saturation`,style:A({background:a.bgColor}),onMousedown:t[0]||=(...e)=>a.handleMouseDown&&a.handleMouseDown(...e),onTouchmove:t[1]||=(...e)=>a.handleChange&&a.handleChange(...e),onTouchstart:t[2]||=(...e)=>a.handleChange&&a.handleChange(...e)},[Yq,Xq,W(`div`,{class:`vc-saturation-pointer`,style:A({top:a.pointerTop,left:a.pointerLeft})},Zq,4)],36)}QK(`.vc-saturation,.vc-saturation--black,.vc-saturation--white{bottom:0;cursor:pointer;left:0;position:absolute;right:0;top:0}.vc-saturation--white{background:linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.vc-saturation--black{background:linear-gradient(0deg,#000,transparent)}.vc-saturation-pointer{cursor:pointer;position:absolute}.vc-saturation-circle{border-radius:50%;box-shadow:0 0 0 1.5px #fff,inset 0 0 1px 1px rgba(0,0,0,.3),0 0 1px 2px rgba(0,0,0,.4);cursor:head;height:4px;transform:translate(-2px,-2px);width:4px}`),Jq.render=Qq,Jq.__file=`src/components/saturation/saturation.vue`,Jq.install=$K;var $q={name:`Hue`,props:{value:Object,direction:{type:String,default:`horizontal`}},data(){return{oldHue:0,pullDirection:``}},computed:{colors(){return this.value},directionClass(){return{"vc-hue--horizontal":this.direction===`horizontal`,"vc-hue--vertical":this.direction===`vertical`}},pointerTop(){return this.direction===`vertical`?this.colors.hsl.h===0&&this.pullDirection===`right`?0:`${-(this.colors.hsl.h*100/360)+100}%`:0},pointerLeft(){return this.direction===`vertical`?0:this.colors.hsl.h===0&&this.pullDirection===`right`?`100%`:`${this.colors.hsl.h*100/360}%`}},watch:{value:{handler(e,t){let{h:n}=e.hsl;n!==0&&n-this.oldHue>0&&(this.pullDirection=`right`),n!==0&&n-this.oldHue<0&&(this.pullDirection=`left`),this.oldHue=n},deep:!0,immediate:!0}},methods:{handleChange(e,t){!t&&e.preventDefault();let{container:n}=this.$refs;if(!n)return;let r=n.clientWidth,i=n.clientHeight,a=n.getBoundingClientRect().left+window.pageXOffset,o=n.getBoundingClientRect().top+window.pageYOffset,s=e.pageX||(e.touches?e.touches[0].pageX:0),c=e.pageY||(e.touches?e.touches[0].pageY:0),l=s-a,u=c-o,d,f;this.direction===`vertical`?(u<0?d=360:u>i?d=0:(f=-(u*100/i)+100,d=360*f/100),this.colors.hsl.h!==d&&this.$emit(`change`,{h:d,s:this.colors.hsl.s,l:this.colors.hsl.l,a:this.colors.hsl.a,source:`hsl`})):(l<0?d=0:l>r?d=360:(f=l*100/r,d=360*f/100),this.colors.hsl.h!==d&&this.$emit(`change`,{h:d,s:this.colors.hsl.s,l:this.colors.hsl.l,a:this.colors.hsl.a,source:`hsl`}))},handleMouseDown(e){this.handleChange(e,!0),window.addEventListener(`mousemove`,this.handleChange),window.addEventListener(`mouseup`,this.handleChange),window.addEventListener(`mouseup`,this.handleMouseUp)},handleMouseUp(e){this.unbindEventListeners()},unbindEventListeners(){window.removeEventListener(`mousemove`,this.handleChange),window.removeEventListener(`mouseup`,this.handleChange),window.removeEventListener(`mouseup`,this.handleMouseUp)}}},eJ=[`aria-valuenow`],tJ=[W(`div`,{class:`vc-hue-picker`},null,-1)];function nJ(e,t,n,r,i,a){return V(),H(`div`,{class:j([`vc-hue`,[a.directionClass]])},[W(`div`,{ref:`container`,class:`vc-hue-container`,role:`slider`,"aria-valuenow":a.colors.hsl.h,"aria-valuemin":`0`,"aria-valuemax":`360`,onMousedown:t[0]||=(...e)=>a.handleMouseDown&&a.handleMouseDown(...e),onTouchmove:t[1]||=(...e)=>a.handleChange&&a.handleChange(...e),onTouchstart:t[2]||=(...e)=>a.handleChange&&a.handleChange(...e)},[W(`div`,{class:`vc-hue-pointer`,style:A({top:a.pointerTop,left:a.pointerLeft}),role:`presentation`},tJ,4)],40,eJ)],2)}QK(`.vc-hue{border-radius:2px;bottom:0;left:0;position:absolute;right:0;top:0}.vc-hue--horizontal{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.vc-hue--vertical{background:linear-gradient(0deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.vc-hue-container{cursor:pointer;height:100%;margin:0 2px;position:relative}.vc-hue-pointer{position:absolute;z-index:2}.vc-hue-picker{background:#fff;border-radius:1px;box-shadow:0 0 2px rgba(0,0,0,.6);cursor:pointer;height:8px;margin-top:1px;transform:translateX(-2px);width:4px}`),$q.render=nJ,$q.__file=`src/components/hue/hue.vue`,$q.install=$K;var rJ=[`#D0021B`,`#F5A623`,`#F8E71C`,`#8B572A`,`#7ED321`,`#417505`,`#BD10E0`,`#9013FE`,`#4A90E2`,`#50E3C2`,`#B8E986`,`#000000`,`#4A4A4A`,`#9B9B9B`,`#FFFFFF`,`rgba(0,0,0,0)`],iJ={name:`Sketch`,components:{Saturation:Jq,Hue:$q,Alpha:aq,EdIn:Vq,Checkboard:tq},mixins:[Bq],props:{presetColors:{type:Array,default(){return rJ}},disableAlpha:{type:Boolean,default:!1},disableFields:{type:Boolean,default:!1}},computed:{hex(){let e;return e=this.colors.a<1?this.colors.hex8:this.colors.hex,e.replace(`#`,``)},activeColor(){let{rgba:e}=this.colors;return`rgba(${[e.r,e.g,e.b,e.a].join(`,`)})`}},methods:{handlePreset(e){this.colorChange(e)},childChange(e){this.colorChange(e)},inputChange(e){e&&(e.hex?this.isValidHex(e.hex)&&this.colorChange({hex:e.hex,source:`hex`}):(e.r||e.g||e.b||e.a)&&this.colorChange({r:e.r||this.colors.rgba.r,g:e.g||this.colors.rgba.g,b:e.b||this.colors.rgba.b,a:e.a||this.colors.rgba.a,source:`rgba`}))}}},aJ={class:`vc-sketch-saturation-wrap`},oJ={class:`vc-sketch-controls`},sJ={class:`vc-sketch-sliders`},cJ={class:`vc-sketch-hue-wrap`},lJ={key:0,class:`vc-sketch-alpha-wrap`},uJ={class:`vc-sketch-color-wrap`},dJ=[`aria-label`],fJ={key:0,class:`vc-sketch-field`},pJ={class:`vc-sketch-field--double`},mJ={class:`vc-sketch-field--single`},hJ={class:`vc-sketch-field--single`},gJ={class:`vc-sketch-field--single`},_J={key:0,class:`vc-sketch-field--single`},vJ={class:`vc-sketch-presets`,role:`group`,"aria-label":`A color preset, pick one to set as current color`},yJ=[`aria-label`,`onClick`],bJ=[`aria-label`,`onClick`];function xJ(e,t,n,r,i,a){let o=R(`Saturation`),s=R(`Hue`),c=R(`Alpha`),l=R(`Checkboard`),u=R(`EdIn`);return V(),H(`div`,{role:`application`,"aria-label":`Sketch color picker`,class:j([`vc-sketch`,[n.disableAlpha?`vc-sketch__disable-alpha`:``]])},[W(`div`,aJ,[G(o,{value:e.colors,onChange:a.childChange},null,8,[`value`,`onChange`])]),W(`div`,oJ,[W(`div`,sJ,[W(`div`,cJ,[G(s,{value:e.colors,onChange:a.childChange},null,8,[`value`,`onChange`])]),n.disableAlpha?q(`v-if`,!0):(V(),H(`div`,lJ,[G(c,{value:e.colors,onChange:a.childChange},null,8,[`value`,`onChange`])]))]),W(`div`,uJ,[W(`div`,{"aria-label":`Current color is ${a.activeColor}`,class:`vc-sketch-active-color`,style:A({background:a.activeColor})},null,12,dJ),G(l)])]),n.disableFields?q(`v-if`,!0):(V(),H(`div`,fJ,[q(` rgba `),W(`div`,pJ,[G(u,{label:`hex`,value:a.hex,onChange:a.inputChange},null,8,[`value`,`onChange`])]),W(`div`,mJ,[G(u,{label:`r`,value:e.colors.rgba.r,onChange:a.inputChange},null,8,[`value`,`onChange`])]),W(`div`,hJ,[G(u,{label:`g`,value:e.colors.rgba.g,onChange:a.inputChange},null,8,[`value`,`onChange`])]),W(`div`,gJ,[G(u,{label:`b`,value:e.colors.rgba.b,onChange:a.inputChange},null,8,[`value`,`onChange`])]),n.disableAlpha?q(`v-if`,!0):(V(),H(`div`,_J,[G(u,{label:`a`,value:e.colors.a,"arrow-offset":.01,max:1,onChange:a.inputChange},null,8,[`value`,`arrow-offset`,`onChange`])]))])),W(`div`,vJ,[(V(!0),H(B,null,z(n.presetColors,t=>(V(),H(B,null,[e.isTransparent(t)?(V(),H(`div`,{key:t,"aria-label":`Color:${t}`,class:`vc-sketch-presets-color`,onClick:e=>a.handlePreset(t)},[G(l)],8,bJ)):(V(),H(`div`,{key:`!${t}`,class:`vc-sketch-presets-color`,"aria-label":`Color:${t}`,style:A({background:t}),onClick:e=>a.handlePreset(t)},null,12,yJ))],64))),256))])],2)}QK(`.vc-sketch{background:#fff;border-radius:4px;box-shadow:0 0 0 1px rgba(0,0,0,.15),0 8px 16px rgba(0,0,0,.15);box-sizing:initial;padding:10px 10px 0;position:relative;width:200px}.vc-sketch-saturation-wrap{overflow:hidden;padding-bottom:75%;position:relative;width:100%}.vc-sketch-controls{display:flex}.vc-sketch-sliders{flex:1;padding:4px 0}.vc-sketch-sliders .vc-alpha-gradient,.vc-sketch-sliders .vc-hue{border-radius:2px}.vc-sketch-alpha-wrap,.vc-sketch-hue-wrap{height:10px;position:relative}.vc-sketch-alpha-wrap{margin-top:4px;overflow:hidden}.vc-sketch-color-wrap{border-radius:3px;height:24px;margin-left:4px;margin-top:4px;position:relative;width:24px}.vc-sketch-active-color{border-radius:2px;bottom:0;box-shadow:inset 0 0 0 1px rgba(0,0,0,.15),inset 0 0 4px rgba(0,0,0,.25);left:0;position:absolute;right:0;top:0;z-index:2}.vc-sketch-color-wrap .vc-checkerboard{background-size:auto}.vc-sketch-field{display:flex;padding-top:4px}.vc-sketch-field .vc-input__input{border:none;box-shadow:inset 0 0 0 1px #ccc;font-size:10px;padding:4px 0 3px 10%;width:90%}.vc-sketch-field .vc-input__label{color:#222;display:block;font-size:11px;padding-bottom:4px;padding-top:3px;text-align:center;text-transform:capitalize}.vc-sketch-field--single{flex:1;padding-left:6px}.vc-sketch-field--double{flex:2}.vc-sketch-presets{border-top:1px solid #eee;margin-left:-10px;margin-right:-10px;padding-left:10px;padding-top:10px}.vc-sketch-presets-color{cursor:pointer;display:inline-block;height:16px;margin:0 10px 10px 0;overflow:hidden;position:relative;vertical-align:top;width:16px}.vc-sketch-presets-color,.vc-sketch-presets-color .vc-checkerboard{border-radius:3px;box-shadow:inset 0 0 0 1px rgba(0,0,0,.15)}.vc-sketch__disable-alpha .vc-sketch-color-wrap{height:10px}`),iJ.render=xJ,iJ.__file=`src/components/sketch/sketch.vue`,iJ.install=$K;function SJ(e){let t=String(e||``).trim();if(!t)return null;let n=t.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i);if(n)return{r:parseInt(n[1],16),g:parseInt(n[2],16),b:parseInt(n[3],16),a:1};if(n=t.match(/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i),n){let e=e=>parseInt(e+e,16);return{r:e(n[1]),g:e(n[2]),b:e(n[3]),a:1}}if(n=t.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i),n)return{r:parseInt(n[1],16),g:parseInt(n[2],16),b:parseInt(n[3],16),a:parseInt(n[4],16)/255};if(n=t.match(/^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)(?:\s*,\s*([\d.]+))?\s*\)$/i),n){let e=n[4]===void 0?1:parseFloat(n[4]);return{r:Math.round(parseFloat(n[1])),g:Math.round(parseFloat(n[2])),b:Math.round(parseFloat(n[3])),a:e}}return null}function CJ(e){if(!e)return`#000000`;let t=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,`0`);return`#`+t(e.r)+t(e.g)+t(e.b)}function wJ(e){return e?e.a>=1?CJ(e):`rgba(${Math.round(e.r)}, ${Math.round(e.g)}, ${Math.round(e.b)}, ${+e.a.toFixed(2)})`:``}var TJ={name:`SetColor`,components:{Sketch:iJ},props:Y_,emits:X_,data(){return{_rgb:null,popOpen:!1,popW:240,popStyle:{position:`fixed`,left:`0px`,top:`0px`}}},computed:{text(){return this.value===void 0||this.value===null?``:String(this.value)},parsed(){return SJ(this.text)||{r:0,g:0,b:0,a:1}},pickerValue(){return this.text||`#000000`},alpha(){return this.parsed.a},displayColor(){return wJ(this.parsed)}},watch:{text(){this._rgb=SJ(this.text)}},beforeUnmount(){this.removeDocListener()},methods:{onTextInput(e){this._rgb=SJ(e),this.$emit(`input`,e)},onAlphaChange(e){let t=Math.max(0,Math.min(1,parseInt(e,10)/100)),n={...this._rgb||this.parsed,a:t};this._rgb=n,this.$emit(`input`,wJ(n)),this.$emit(`change`)},onPicker(e){let t=e&&e.rgba,n,r,i,a;if(Array.isArray(t))[n,r,i,a]=t;else if(t)n=t.r,r=t.g,i=t.b,a=t.a;else{let t=SJ(e.hex)||{r:0,g:0,b:0,a:1};n=t.r,r=t.g,i=t.b,a=t.a}a??=1;let o=e.hex||CJ({r:n,g:r,b:i,a:1});this._rgb={r:n,g:r,b:i,a},this.$emit(`input`,a>=1?o:`rgba(${Math.round(n)}, ${Math.round(r)}, ${Math.round(i)}, ${+a.toFixed(2)})`),this.$emit(`change`)},clear(){this.disabled||(this._rgb=null,this.closePop(),this.$emit(`input`,``),this.$emit(`change`))},togglePop(){this.disabled||(this.popOpen?this.closePop():this.openPop())},openPop(){let e=this.$refs.swatch;if(!e)return;let t=e.getBoundingClientRect(),n=this.$refs.top&&this.$refs.top.getBoundingClientRect()||t,r=Math.max(220,Math.min(Math.round(n.width),400)),i=window.innerWidth,a=window.innerHeight,o=n.left,s=t.bottom+6;o+r>i-8&&(o=Math.max(8,i-r-8)),s+320>a-8&&(s=Math.max(8,t.top-320-6)),this.popW=r,this.popStyle={position:`fixed`,left:o+`px`,top:s+`px`,width:r+`px`,zIndex:4e3},this.popOpen=!0,this.$nextTick(()=>{document.addEventListener(`mousedown`,this.onDocClick,!0)})},closePop(){this.popOpen&&(this.popOpen=!1,this.removeDocListener())},removeDocListener(){document.removeEventListener(`mousedown`,this.onDocClick,!0)},onDocClick(e){let t=this.$refs.pop,n=this.$refs.swatch;t&&t.contains(e.target)||n&&n.contains(e.target)||this.closePop()}}},EJ={class:`st-color`},DJ={class:`st-color__top`,ref:`top`},OJ=[`title`,`disabled`],kJ=[`disabled`,`value`],AJ=[`disabled`],jJ={key:0,class:`st-color__alpha-row`},MJ=[`disabled`,`value`],NJ={class:`st-color__alpha-val`};function PJ(e,t,n,r,i,a){let o=R(`Sketch`);return V(),H(`div`,EJ,[q(` 色块预览 + 文本输入 + 重置(顶行) `),W(`div`,DJ,[W(`button`,{ref:`swatch`,class:`st-color__swatch`,type:`button`,title:a.text||`未设置`,disabled:e.disabled,onClick:t[0]||=(...e)=>a.togglePop&&a.togglePop(...e)},[t[7]||=W(`span`,{class:`st-color__checker`},null,-1),W(`span`,{class:`st-color__fill`,style:A({background:a.displayColor||`transparent`})},null,4)],8,OJ),W(`input`,{class:`ni-input st-color__text`,type:`text`,placeholder:`如 #333333 / rgba(0,0,0,.5)`,disabled:e.disabled,value:a.text,onInput:t[1]||=e=>a.onTextInput(e.target.value),onChange:t[2]||=t=>e.$emit(`change`)},null,40,kJ),W(`button`,{class:`st-color__clear`,type:`button`,title:`重置(清空颜色)`,disabled:e.disabled,onClick:t[3]||=(...e)=>a.clear&&a.clear(...e)},[...t[8]||=[W(`svg`,{viewBox:`0 0 16 16`,class:`st-ic`,"aria-hidden":`true`},[W(`use`,{href:`#icon-reset`})],-1)]],8,AJ)],512),q(` 透明度滑块(仅当颜色值非空时显示),作为快捷调节 `),a.text?(V(),H(`div`,jJ,[t[9]||=W(`span`,{class:`st-color__alpha-label`},`透明度`,-1),W(`input`,{class:`st-color__alpha-slider`,type:`range`,min:`0`,max:`100`,disabled:e.disabled,value:Math.round(a.alpha*100),onInput:t[4]||=e=>a.onAlphaChange(e.target.value),onChange:t[5]||=t=>e.$emit(`change`)},null,40,MJ),W(`span`,NJ,M(Math.round(a.alpha*100))+`%`,1)])):q(`v-if`,!0),q(` 第三方颜色选择器弹层(挂载到 body,避免被滚动容器裁切) `),(V(),U(mi,{to:`body`},[i.popOpen?(V(),H(`div`,{key:0,ref:`pop`,class:`st-color__pop`,style:A(i.popStyle),onMousedown:t[6]||=J(()=>{},[`stop`])},[G(o,{"model-value":a.pickerValue,"disable-alpha":!1,"onUpdate:modelValue":a.onPicker},null,8,[`model-value`,`onUpdate:modelValue`])],36)):q(`v-if`,!0)]))])}var FJ=Z(TJ,[[`render`,PJ],[`__file`,`/Users/ynet/dsl-card/card-editor/components/setters/SetColor.vue`]]),IJ={name:`SetIconSelect`,components:{SvgSymbols:Pd},props:Y_,emits:X_,data(){return{open:!1}},computed:{list(){return this.options.iIconList||[]}},methods:{pick(e){this.disabled||(this.open=!1,this.$emit(`input`,e.key),this.$emit(`change`))}}},LJ={class:`st-iconsel-wrap`},RJ={class:`st-iconsel`},zJ={class:`st-iconsel__preview`},BJ={key:1,style:{"font-size":`11px`,color:`var(--text-faint)`}},VJ=[`disabled`,`value`],HJ={key:0,class:`st-iconsel__grid`},UJ=[`title`,`onClick`],WJ={key:0,class:`st-list__empty`};function GJ(e,t,n,r,i,a){let o=R(`SvgSymbols`);return V(),H(`div`,LJ,[W(`div`,RJ,[W(`span`,zJ,[e.value?(V(),U(o,{key:0,icon:String(e.value),color:`currentColor`},null,8,[`icon`])):(V(),H(`span`,BJ,`无`))]),W(`input`,{class:`ni-input`,type:`text`,placeholder:`图标 key`,disabled:e.disabled,value:e.value||``,onInput:t[0]||=t=>e.$emit(`input`,t.target.value),onChange:t[1]||=t=>e.$emit(`change`)},null,40,VJ),W(`button`,{class:`st-minibtn`,type:`button`,onClick:t[2]||=e=>i.open=!i.open},M(i.open?`收起`:`选择`),1)]),i.open?(V(),H(`div`,HJ,[(V(!0),H(B,null,z(a.list,t=>(V(),H(`span`,{key:t.key,class:j([`st-iconsel__cell`,{"st-iconsel__cell--on":t.key===e.value}]),title:t.name||t.value||t.key,onClick:e=>a.pick(t)},[G(o,{icon:t.key,color:`currentColor`},null,8,[`icon`])],10,UJ))),128)),a.list.length?q(`v-if`,!0):(V(),H(`p`,WJ,`该组件未提供图标列表`))])):q(`v-if`,!0)])}var KJ=Z(IJ,[[`render`,GJ],[`__file`,`/Users/ynet/dsl-card/card-editor/components/setters/SetIconSelect.vue`]]);Prism.languages.javascript=Prism.languages.extend(`clike`,{"class-name":[Prism.languages.clike[`class-name`],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(`(^|[^\\w$])(?:NaN|Infinity|0[bB][01]+(?:_[01]+)*n?|0[oO][0-7]+(?:_[0-7]+)*n?|0[xX][\\dA-Fa-f]+(?:_[\\dA-Fa-f]+)*n?|\\d+(?:_\\d+)*n|(?:\\d+(?:_\\d+)*(?:\\.(?:\\d+(?:_\\d+)*)?)?|\\.\\d+(?:_\\d+)*)(?:[Ee][+-]?\\d+(?:_\\d+)*)?)(?![\\w$])`),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),Prism.languages.javascript[`class-name`][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,Prism.languages.insertBefore(`javascript`,`keyword`,{regex:{pattern:RegExp(`((?:^|[^$\\w\\xA0-\\uFFFF."'\\])\\s]|\\b(?:return|yield))\\s*)\\/(?:(?:\\[(?:[^\\]\\\\\\r\\n]|\\\\.)*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}|(?:\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.)*\\])*\\])*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}v[dgimyus]{0,7})(?=(?:\\s|\\/\\*(?:[^*]|\\*(?!\\/))*\\*\\/)*(?:$|[\\r\\n,.;:})\\]]|\\/\\/))`),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:`language-regex`,inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:`function`},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.languages.insertBefore(`javascript`,`string`,{hashbang:{pattern:/^#!.*/,greedy:!0,alias:`comment`},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:`string`},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:`punctuation`},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:`property`}}),Prism.languages.insertBefore(`javascript`,`operator`,{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:`property`}}),Prism.languages.markup&&(Prism.languages.markup.tag.addInlined(`script`,`javascript`),Prism.languages.markup.tag.addAttribute(`on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)`,`javascript`)),Prism.languages.js=Prism.languages.javascript,pv.default.languages.javascript&&!pv.default.languages.javascript[`binding-var`]&&pv.default.languages.insertBefore(`javascript`,`keyword`,{"binding-var":/\$[A-Za-z_$][\w$]*/});var qJ={name:`SetExpr`,props:{...Y_,placeholder:{type:String,default:``}},emits:X_,data(){return{code:``}},computed:{lines(){return this.code?this.code.split(`
404
- `).length:0},chars(){return this.code.length}},watch:{value(e){this.syncFromValue(e)}},mounted(){this.code=this.readValue(this.value),this.$nextTick(()=>this.initJar())},beforeUnmount(){this._t&&clearTimeout(this._t),this._jar&&this._jar.destroy&&this._jar.destroy()},methods:{readValue(e){return e==null?``:typeof e==`string`?e:String(e)},syncFromValue(e){let t=this.readValue(e);if(t===this.code)return;let n=this.$refs.editor;n&&document.activeElement===n||(this.code=t,this._jar&&this._jar.updateCode(t))},initJar(){let e=this.$refs.editor;if(!e)return;let t=e=>{e.innerHTML=pv.default.highlight(e.textContent,pv.default.languages.javascript,`javascript`)};this._jar=fv(e,t,{tab:` `,indentOn:/[({[]$/,addClosing:!0,history:!0}),this._jar.updateCode(this.code),this._jar.onUpdate(e=>this.onCode(e))},onCode(e){this.disabled||(this.code=e,this.$emit(`input`,e),this._t&&clearTimeout(this._t),this._t=setTimeout(()=>this.$emit(`change`),400))}}},JJ={key:0,class:`st-expr__ph`},YJ={class:`st-expr__foot`},XJ={class:`st-expr__hint`};function ZJ(e,t,n,r,i,a){return V(),H(`div`,{class:j([`st-expr`,{"st-expr--disabled":e.disabled}])},[W(`div`,{ref:`editor`,class:j([`st-expr__editor`,{"is-disabled":e.disabled}])},null,2),n.placeholder&&!i.code?(V(),H(`span`,JJ,M(n.placeholder),1)):q(`v-if`,!0),W(`div`,YJ,[W(`span`,XJ,M(a.lines)+` 行 · `+M(a.chars)+` 字符`,1)])],2)}var QJ=Z(qJ,[[`render`,ZJ],[`__file`,`/Users/ynet/dsl-card/card-editor/components/setters/SetExpr.vue`]]),$J={name:`SetIfForm`,components:{SetExpr:QJ},props:Y_,emits:X_,computed:{obj(){return this.value&&typeof this.value==`object`?this.value:{}},expression(){return this.obj.expression||``},name(){return this.obj.name||``}},methods:{setExpression(e){let t=!this.name||this.name===this.expression;this.$emit(`input`,{name:t?e:this.name,expression:e})},setName(e){this.$emit(`input`,{name:e,expression:this.expression})}}},eY={class:`st-ifform`},tY=[`disabled`,`value`];function nY(e,t,n,r,i,a){let o=R(`SetExpr`);return V(),H(`div`,eY,[G(o,{value:a.expression,disabled:e.disabled,placeholder:`表达式,如 $singleMode 或 $data.count > 0`,onInput:a.setExpression,onChange:t[0]||=t=>e.$emit(`change`)},null,8,[`value`,`disabled`,`onInput`]),W(`input`,{class:`ni-input`,type:`text`,placeholder:`显示名(留空跟随表达式)`,disabled:e.disabled,value:a.name,onInput:t[1]||=e=>a.setName(e.target.value),onChange:t[2]||=t=>e.$emit(`change`)},null,40,tY)])}var rY=Z($J,[[`render`,nY],[`__file`,`/Users/ynet/dsl-card/card-editor/components/setters/SetIfForm.vue`]]),iY=[{key:`number`,value:`px`},{key:`percent`,value:`%`},{key:`auto`,value:`@`}],aY={name:`SetNumberStyle`,components:{SetNumber:WK},props:Y_,emits:X_,data(){return{unit:`number`,numValue:``,menuOpen:!1}},computed:{unitList(){return this.options.iTypeList||iY},unitLabel(){let e=this.unitList.filter(e=>e.key===this.unit)[0];return e?e.value:`px`},isAuto(){return this.unit===`auto`},numberOptions(){return{...this.options,type:this.unit===`percent`?`integer`:`float`,placeholder:this.options.placeholder||``,symbol:!0}}},watch:{value:{immediate:!0,handler(){this.parse()}}},methods:{parse(){let e=this.value;/%$/.test(String(e))?(this.unit=`percent`,this.numValue=String(e).replace(/%/g,``)):e===`auto`?(this.unit=`auto`,this.numValue=`auto`):(this.unit=`number`,this.numValue=e===0?`0`:e==null?``:String(e))},onNum(e){this.numValue=e,this.emit()},pickUnit(e){this.menuOpen=!1,this.unit=e,this.numValue=e===`percent`?`100`:e===`auto`?`auto`:``,this.emit(),this.$emit(`change`)},emit(){this.unit===`percent`&&this.numValue?this.$emit(`input`,this.numValue+`%`):this.$emit(`input`,this.numValue)}}},oY={class:`st-numberstyle`},sY={key:1,class:`st-pop st-pop--unit`},cY=[`onMousedown`];function lY(e,t,n,r,i,a){let o=R(`SetNumber`);return V(),H(`div`,oY,[G(o,{value:i.numValue,options:a.numberOptions,disabled:e.disabled||a.isAuto,onInput:a.onNum,onChange:t[1]||=t=>e.$emit(`change`)},{symbol:I(()=>[W(`span`,{class:`st-unit`,onMousedown:t[0]||=J(e=>i.menuOpen=!i.menuOpen,[`prevent`])},M(a.unitLabel),33)]),_:1},8,[`value`,`options`,`disabled`,`onInput`]),q(` 单位切换浮层:移到 .st-number 之外,避免被 overflow:hidden 裁切 `),i.menuOpen?(V(),H(`div`,{key:0,class:`st-pop-mask`,onMousedown:t[2]||=J(e=>i.menuOpen=!1,[`prevent`])},null,32)):q(`v-if`,!0),i.menuOpen?(V(),H(`div`,sY,[(V(!0),H(B,null,z(a.unitList,e=>(V(),H(`div`,{key:e.key,class:j([`st-pop__item`,{"st-pop__item--on":e.key===i.unit}]),onMousedown:J(t=>a.pickUnit(e.key),[`prevent`])},M(e.value),43,cY))),128))])):q(`v-if`,!0)])}var uY=Z(aY,[[`render`,lY],[`__file`,`/Users/ynet/dsl-card/card-editor/components/setters/SetNumberStyle.vue`]]),dY={name:`SetPadding`,components:{SetNumber:WK},props:Y_,emits:X_,data(){return{form:{top:``,right:``,bottom:``,left:``}}},computed:{brackets(){return this.options.brackets||[`{`,`}`]},seperator(){return this.options.seperator||`,`}},watch:{value:{immediate:!0,handler(){this.parse()}}},methods:{parse(){let e=String(this.value||``);this.brackets.length&&(e=e.replace(RegExp(`[${this.brackets.join(``)}]`,`g`),``));let t=e.split(this.seperator);this.form=this.options.normal?{top:t[0]||``,right:t[1]||``,bottom:t[2]||``,left:t[3]||``}:{top:t[0]||``,left:t[1]||``,bottom:t[2]||``,right:t[3]||``}},opt(e){return{type:`integer`,symbol:e,placeholder:`0`}},set(e,t){this.form[e]=t,this.emitValue()},emitValue(){let e=this.form,t=(this.options.normal?[e.top,e.right,e.bottom,e.left]:[e.top,e.left,e.bottom,e.right]).map(e=>e===``||e===void 0?`0`:e).join(this.seperator),[n,r]=this.brackets.length?this.brackets:[``,``];this.$emit(`input`,`${n||``}${t}${r||``}`)},emitOut(){this.$emit(`change`)}}},fY={class:`st-pad`};function pY(e,t,n,r,i,a){let o=R(`SetNumber`);return V(),H(`div`,fY,[G(o,{value:i.form.top,options:a.opt(`上`),disabled:e.disabled,onInput:t[0]||=e=>a.set(`top`,e),onChange:a.emitOut},null,8,[`value`,`options`,`disabled`,`onChange`]),G(o,{value:i.form.right,options:a.opt(`右`),disabled:e.disabled,onInput:t[1]||=e=>a.set(`right`,e),onChange:a.emitOut},null,8,[`value`,`options`,`disabled`,`onChange`]),G(o,{value:i.form.bottom,options:a.opt(`下`),disabled:e.disabled,onInput:t[2]||=e=>a.set(`bottom`,e),onChange:a.emitOut},null,8,[`value`,`options`,`disabled`,`onChange`]),G(o,{value:i.form.left,options:a.opt(`左`),disabled:e.disabled,onInput:t[3]||=e=>a.set(`left`,e),onChange:a.emitOut},null,8,[`value`,`options`,`disabled`,`onChange`])])}var mY=Z(dY,[[`render`,pY],[`__file`,`/Users/ynet/dsl-card/card-editor/components/setters/SetPadding.vue`]]),hY=[{key:`TopLeft`,value:`上左`},{key:`TopCenter`,value:`上中`},{key:`TopRight`,value:`上右`},{key:`CenterLeft`,value:`中左`},{key:`Center`,value:`中间`},{key:`CenterRight`,value:`中右`},{key:`BottomLeft`,value:`下左`},{key:`BottomCenter`,value:`下中`},{key:`BottomRight`,value:`下右`}],gY=[{key:`0% 0%`,value:`左上对齐`},{key:`50% 0%`,value:`中上对齐`},{key:`100% 0%`,value:`右上对齐`},{key:`0% 50%`,value:`左中对齐`},{key:`50% 50%`,value:`居中对齐`},{key:`100% 50%`,value:`右中对齐`},{key:`0% 100%`,value:`左下对齐`},{key:`50% 100%`,value:`中下对齐`},{key:`100% 100%`,value:`右下对齐`}],_Y={name:`SetGrid9`,props:{...Y_,kind:{type:String,default:`PositionStyle`}},emits:X_,computed:{cells(){return this.kind===`BackgroundPositionStyle`?gY:hY}},methods:{pick(e){this.disabled||(this.$emit(`input`,e.key),this.$emit(`change`))}}},vY={class:`st-grid9`},yY=[`title`,`onClick`];function bY(e,t,n,r,i,a){return V(),H(`div`,vY,[(V(!0),H(B,null,z(a.cells,n=>(V(),H(`div`,{key:n.key,class:j([`st-grid9__cell`,{"st-grid9__cell--on":String(n.key)===String(e.value)}]),title:n.value,onClick:e=>a.pick(n)},[...t[0]||=[W(`span`,{class:`st-grid9__dot`},null,-1)]],10,yY))),128))])}var xY=Z(_Y,[[`render`,bY],[`__file`,`/Users/ynet/dsl-card/card-editor/components/setters/SetGrid9.vue`]]),SY=[{key:`number`,value:`px`},{key:`percent`,value:`%`}],CY={name:`SetBgPosition`,components:{SetGrid9:xY,SetNumberStyle:uY},props:Y_,emits:X_,data(){return{x:``,y:``}},watch:{value:{immediate:!0,handler(){this.parse()}}},methods:{parse(){let e=String(this.value||``).split(/\s+/);this.x=e[0]||``,this.y=e[1]||``},numOptions(e){return{placeholder:e,iTypeList:SY}},pickGrid(e){this.$emit(`input`,e)},setX(e){this.x=e,this.emitValue()},setY(e){this.y=e,this.emitValue()},emitValue(){this.$emit(`input`,`${this.x||`0`} ${this.y||`0`}`)},emitOut(){this.$emit(`change`)}}},wY={class:`st-bgpos`},TY={class:`st-bgpos__xy`};function EY(e,t,n,r,i,a){let o=R(`SetGrid9`),s=R(`SetNumberStyle`);return V(),H(`div`,wY,[G(o,{kind:`BackgroundPositionStyle`,value:e.value,disabled:e.disabled,onInput:a.pickGrid,onChange:t[0]||=t=>e.$emit(`change`)},null,8,[`value`,`disabled`,`onInput`]),W(`div`,TY,[G(s,{value:i.x,options:a.numOptions(`X`),disabled:e.disabled,onInput:a.setX,onChange:a.emitOut},null,8,[`value`,`options`,`disabled`,`onInput`,`onChange`]),G(s,{value:i.y,options:a.numOptions(`Y`),disabled:e.disabled,onInput:a.setY,onChange:a.emitOut},null,8,[`value`,`options`,`disabled`,`onInput`,`onChange`])])])}var DY=Z(CY,[[`render`,EY],[`__file`,`/Users/ynet/dsl-card/card-editor/components/setters/SetBgPosition.vue`]]),OY=[{key:`cover`,desc:`cover:保持纵横比,缩放到完全覆盖背景定位区域的最小尺寸`},{key:`contain`,desc:`contain:保持纵横比,缩放到能放进背景定位区域的最大尺寸`}],kY={name:`SetBgSize`,components:{SetNumberStyle:uY,Dropdown:B_},computed:{bgOptions(){return[{key:``,value:`自定义`}].concat(this.TYPES.map(e=>({key:e.key,value:e.key})))}},props:Y_,emits:X_,data(){return{TYPES:OY,preset:``,x:``,y:``}},watch:{value:{immediate:!0,handler(){this.parse()}}},methods:{parse(){let e=String(this.value||``),t=OY.map(e=>e.key);this.preset=t.includes(e)?e:``;let n=e.split(/\s+/);n.length>=2?(this.x=n[0]||``,this.y=n[1]||``):(this.x=``,this.y=``)},pickPreset(e){this.preset=e,e||(this.x=`auto`,this.y=`auto`),this.emitValue(),this.$emit(`change`)},setX(e){this.x=e,this.emitValue()},setY(e){this.y=e,this.emitValue()},emitValue(){let e=this.preset?this.preset:`${this.x||`auto`} ${this.y||`auto`}`;this.$emit(`input`,e)},emitOut(){this.$emit(`change`)}}},AY={class:`st-bgsize`},jY={key:0,class:`st-bgsize__xy`};function MY(e,t,n,r,i,a){let o=R(`Dropdown`),s=R(`SetNumberStyle`);return V(),H(`div`,AY,[G(o,{value:i.preset,options:a.bgOptions,size:`sm`,block:``,disabled:e.disabled,onInput:t[0]||=e=>a.pickPreset(e)},null,8,[`value`,`options`,`disabled`]),i.preset?q(`v-if`,!0):(V(),H(`div`,jY,[G(s,{value:i.x,options:{placeholder:`宽`},disabled:e.disabled,onInput:a.setX,onChange:a.emitOut},null,8,[`value`,`disabled`,`onInput`,`onChange`]),G(s,{value:i.y,options:{placeholder:`高`},disabled:e.disabled,onInput:a.setY,onChange:a.emitOut},null,8,[`value`,`disabled`,`onInput`,`onChange`])]))])}var NY=Z(kY,[[`render`,MY],[`__file`,`/Users/ynet/dsl-card/card-editor/components/setters/SetBgSize.vue`]]),PY=[{key:`to bottom`,desc:`从上到下`},{key:`to top`,desc:`从下到上`},{key:`to left`,desc:`从右到左`},{key:`to right`,desc:`从左到右`},{key:`to bottom right`,desc:`从左上到右下`},{key:`to bottom left`,desc:`从右上到左下`},{key:`to top left`,desc:`从右下到左上`},{key:`to top right`,desc:`从左下到右上`}];function FY(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`(`?n++:a===`)`?n--:a===`,`&&n===0&&(t.push(e.slice(r,i).trim()),r=i+1)}return t.push(e.slice(r).trim()),t.filter(e=>e!==``)}var IY={name:`SetGradient`,components:{SetColor:FJ,Dropdown:B_},props:Y_,emits:X_,data(){return{DIRECTIONS:PY,direction:`to bottom`,stops:[]}},computed:{preview(){if(!this.stops.length)return`transparent`;let e=this.stops.map(e=>e.color).filter(Boolean);return e.length<2?e[0]||`transparent`:`linear-gradient(${this.direction}, ${e.join(`, `)})`}},watch:{value:{immediate:!0,handler(){this.parse()}}},methods:{parse(){let e=String(this.value||``).trim().match(/linear-gradient\((.+)\)$/);if(!e){this.direction=this.options.defaultDirection||PY[0].key,this.stops=[];return}let t=FY(e[1]);this.direction=(t[0]||``).toLowerCase()||PY[0].key,this.stops=t.slice(1).map(e=>({color:e}))},setDirection(e){this.direction=e,this.emitValue(),this.$emit(`change`)},setStop(e,t){this.stops[e].color=t,this.emitValue()},addStop(){this.disabled||(this.stops.push({color:`#ffffff`}),this.emitValue(),this.$emit(`change`))},removeStop(e){this.disabled||(this.stops.splice(e,1),this.emitValue(),this.$emit(`change`))},emitValue(){let e=this.stops.map(e=>e.color).filter(e=>e!==``&&e!==void 0);this.$emit(`input`,e.length?`linear-gradient(${this.direction}, ${e.join(`, `)})`:``)},emitOut(){this.$emit(`change`)}}},LY={class:`st-gradient`},RY=[`onClick`],zY=[`disabled`];function BY(e,t,n,r,i,a){let o=R(`Dropdown`),s=R(`SetColor`);return V(),H(`div`,LY,[W(`div`,{class:`st-gradient__preview`,style:A({background:a.preview})},null,4),G(o,{value:i.direction,options:i.DIRECTIONS.map(e=>({key:e.key,value:e.desc})),size:`sm`,block:``,disabled:e.disabled,onInput:t[0]||=e=>a.setDirection(e)},null,8,[`value`,`options`,`disabled`]),(V(!0),H(B,null,z(i.stops,(t,n)=>(V(),H(`div`,{key:`stop`+n,class:`st-gradient__stop`},[G(s,{value:t.color,disabled:e.disabled,onInput:e=>a.setStop(n,e),onChange:a.emitOut},null,8,[`value`,`disabled`,`onInput`,`onChange`]),W(`button`,{class:`st-gradient__del`,type:`button`,title:`删除该渐变色`,onClick:e=>a.removeStop(n)},`✕`,8,RY)]))),128)),W(`button`,{class:`st-minibtn`,type:`button`,disabled:e.disabled,onClick:t[1]||=(...e)=>a.addStop&&a.addStop(...e)},`+ 新增渐变色`,8,zY)])}var VY=Z(IY,[[`render`,BY],[`__file`,`/Users/ynet/dsl-card/card-editor/components/setters/SetGradient.vue`]]),HY=new Set([`width`,`height`,`lineHeight`,`marginRight`,`cursor`,`textAlign`]),UY={name:`SetCustomSelect`,props:Y_,emits:[...X_,`sync`],computed:{list(){return this.options.list||[]}},methods:{normalizeStyle(e){if(!e||typeof e!=`object`)return{};let t={};for(let n in e)HY.has(n)||(t[n]=e[n]);return t},apply(e){if(this.disabled)return;let t=e.sync||{};Object.keys(t).length&&this.$emit(`sync`,t)}}},WY={class:`st-customsel`},GY=[`title`,`onClick`],KY={key:0},qY={key:0,class:`st-list__empty`};function JY(e,t,n,r,i,a){return V(),H(`div`,WY,[(V(!0),H(B,null,z(a.list,(e,t)=>(V(),H(`div`,{key:t,class:`st-customsel__item`,style:A(a.normalizeStyle(e.style)),title:`应用:`+Object.keys(e.sync||{}).join(`、`),onClick:t=>a.apply(e)},[(V(!0),H(B,null,z(e.list||[],(e,t)=>(V(),H(`span`,{key:t,style:A(a.normalizeStyle(e.style))},M(e.innerText),5))),128)),(e.list||[]).length?q(`v-if`,!0):(V(),H(`span`,KY,M(e.innerText||`样式`+(t+1)),1))],12,GY))),128)),a.list.length?q(`v-if`,!0):(V(),H(`p`,qY,`未配置常用样式`))])}var YY=Z(UY,[[`render`,JY],[`__file`,`/Users/ynet/dsl-card/card-editor/components/setters/SetCustomSelect.vue`]]),XY={name:`SetList`,props:Y_,emits:X_,computed:{list(){let e=this.itemInfo;return e&&e.itemList||[]},addText(){return this.options&&this.options.btnText||`添加项`}},methods:{displayName(e){let t=e.itemName||e.itemKey||``;return{fontStyle:`字体风格`,textDecoration:`文字装饰`}[e.itemKey]||t},add(){if(this.disabled)return;let e=this.itemInfo,t=this.list[0],n;n=t?new wu(t.properties.map(e=>({itemId:e.itemId,itemKey:e.itemKey,itemName:e.itemName,itemType:e.itemType,itemOption:e.itemOption,itemParam:e.itemParam,itemDefaultValue:e.itemDefaultValue,itemDesc:e.itemDesc,itemTypeRange:e.itemTypeRange,itemValueFrom:`0`,itemValue:``})),{}):new wu((this.options&&this.options.iFieldList||[]).map(e=>({itemId:e.key,itemKey:e.key,itemName:e.value||e.key,itemType:`Input`,itemValueFrom:`0`,itemValue:``})),{}),e.itemList.push(n),this.$emit(`change`)},remove(e){this.disabled||(this.itemInfo.removeAt(e),this.$emit(`change`))},move(e,t){this.disabled||(this.itemInfo.moveItem(e,e+t),this.$emit(`change`))}}},ZY={class:`st-list`},QY={class:`st-list__head`},$Y={class:`st-list__idx`},eX=[`disabled`,`onClick`],tX=[`disabled`,`onClick`],nX=[`disabled`,`onClick`],rX={class:`st-list__body`},iX=[`title`],aX={class:`st-list__control`},oX={key:0,class:`st-list__empty`},sX={key:0,class:`st-list__empty`},cX=[`disabled`];function lX(e,t,n,r,i,a){let o=R(`prop-control`);return V(),H(`div`,ZY,[(V(!0),H(B,null,z(a.list,(n,r)=>(V(),H(`div`,{key:n.id,class:`st-list__item`},[W(`div`,QY,[W(`span`,$Y,`#`+M(r+1),1),t[4]||=W(`span`,{class:`st-list__head-spacer`},null,-1),W(`button`,{class:`st-list__op`,type:`button`,title:`上移`,disabled:e.disabled||r===0,onClick:e=>a.move(r,-1)},`↑`,8,eX),W(`button`,{class:`st-list__op`,type:`button`,title:`下移`,disabled:e.disabled||r===a.list.length-1,onClick:e=>a.move(r,1)},`↓`,8,tX),W(`button`,{class:`st-list__op st-list__op--del`,type:`button`,title:`删除`,disabled:e.disabled,onClick:e=>a.remove(r)},[...t[3]||=[W(`svg`,{viewBox:`0 0 16 16`,class:`st-ic`,"aria-hidden":`true`},[W(`use`,{href:`#icon-delete`})],-1)]],8,nX)]),W(`div`,rX,[(V(!0),H(B,null,z(n.properties,n=>L((V(),H(`div`,{key:n.itemId,class:`st-list__row`},[W(`label`,{class:`st-list__label`,title:n.itemDesc||a.displayName(n)},M(a.displayName(n)),9,iX),W(`div`,aX,[G(o,{property:n,disabled:e.disabled,onChange:t[0]||=t=>e.$emit(`change`),onSync:t[1]||=t=>e.$emit(`sync`,t)},null,8,[`property`,`disabled`])])])),[[Nc,n.itemVisible]])),128)),n.properties.length?q(`v-if`,!0):(V(),H(`p`,oX,`该项无字段`))])]))),128)),a.list.length?q(`v-if`,!0):(V(),H(`p`,sX,`暂无项`)),W(`button`,{class:`st-minibtn st-list__add`,type:`button`,disabled:e.disabled,onClick:t[2]||=(...e)=>a.add&&a.add(...e)},M(a.addText),9,cX)])}var uX=Z(XY,[[`render`,lX],[`__file`,`/Users/ynet/dsl-card/card-editor/components/setters/SetList.vue`]]),dX={name:`SetImage`,props:Y_,emits:X_,methods:{clear(){this.disabled||(this.$emit(`input`,``),this.$emit(`change`))}}},fX={class:`st-image`},pX={class:`st-image__row`},mX=[`disabled`,`value`],hX=[`disabled`];function gX(e,t,n,r,i,a){return V(),H(`div`,fX,[W(`div`,pX,[W(`input`,{class:`ni-input`,type:`text`,disabled:e.disabled,value:e.value||``,placeholder:`图片路径,如 @filestore/...png 或 https://...`,onInput:t[0]||=t=>e.$emit(`input`,t.target.value),onChange:t[1]||=t=>e.$emit(`change`)},null,40,mX),e.value?(V(),H(`button`,{key:0,class:`st-image__clear`,type:`button`,title:`清空`,disabled:e.disabled,onClick:t[2]||=(...e)=>a.clear&&a.clear(...e)},[...t[3]||=[W(`svg`,{viewBox:`0 0 16 16`,class:`st-ic`,"aria-hidden":`true`},[W(`use`,{href:`#icon-reset`})],-1)]],8,hX)):q(`v-if`,!0)])])}var _X=Z(dX,[[`render`,gX],[`__file`,`/Users/ynet/dsl-card/card-editor/components/setters/SetImage.vue`]]),vX={name:`SetCode`,props:Y_,emits:X_,data(){return{code:``,bridge:null}},computed:{codeKey(){return this.options.codeKey||`code`},lines(){return this.code?this.code.split(`
405
- `).length:0},chars(){return this.code.length}},mounted(){this.code=this.readCode(),this.$nextTick(()=>this.initJar())},beforeUnmount(){this._t&&clearTimeout(this._t),this.teardownBridge(!0),this._jar&&this._jar.destroy&&this._jar.destroy()},methods:{readCode(){let e=this.value;return e==null?``:typeof e==`string`?e:String(typeof e==`object`?e[this.codeKey]||``:e)},initJar(){let e=this.$refs.editor;if(!e)return;let t=e=>{e.innerHTML=pv.default.highlight(e.textContent,pv.default.languages.javascript,`javascript`)};this._jar=fv(e,t,{tab:` `,indentOn:/[({[]$/,addClosing:!0,history:!0}),this._jar.updateCode(this.code),this._jar.onUpdate(e=>this.onCode(e))},onCode(e){if(this.disabled||this.bridge)return;this.code=e;let t=this.value&&typeof this.value==`object`?Object.assign({},this.value):{};t[this.codeKey]=e,this.$emit(`input`,t),this._t&&clearTimeout(this._t),this._t=setTimeout(()=>this.$emit(`change`),400)},toggleBridge(){this.bridge?this.teardownBridge(!0):this.setupBridge()},async setupBridge(){if(this.disabled||this.bridge)return;let e=this.itemInfo&&this.itemInfo.itemKey?String(this.itemInfo.itemKey):``;try{let t=await iu(this.code,e);this.bridge={id:t.id,file:t.file}}catch(e){console.error(`[VSCode 桥接建立失败]`,e);return}this.setEditorEditable(!1);let t=Jl()||``,n=Yl()||``,r=(t||location.origin)+`/__code-bridge/${this.bridge.id}/heartbeat`,i=n?`${r}?token=${encodeURIComponent(n)}`:r;try{this._hb=new Worker(new URL(`/assets/codeBridgeHeartbeat.worker-Zb_A5RUd.js`,``+import.meta.url),{type:`module`}),this._hb.onmessage=()=>{},this._hb.postMessage({type:`start`,url:i,interval:5e3})}catch(e){console.warn(`[VSCode 桥接] Worker 心跳不可用,降级主线程心跳`,e),this._hb=setInterval(()=>{this.bridge&&ou(this.bridge.id).catch(()=>{})},5e3)}this._bridgeUnsub=tu(e=>{if(this.bridge&&e&&e.id===this.bridge.id){if(e.reason)return this.teardownBridge(!1);this.pullBridgeCode()}})},async pullBridgeCode(){if(!this.bridge)return;let e;try{e=await au(this.bridge.id)}catch{return}let t=String(e.code==null?``:e.code);t!==this.code&&this.applyExternalCode(t)},applyExternalCode(e){this.code=e,this._jar&&this._jar.updateCode(e,!1);let t=this.value&&typeof this.value==`object`?Object.assign({},this.value):{};t[this.codeKey]=e,this.$emit(`input`,t),this._t&&clearTimeout(this._t),this._t=setTimeout(()=>this.$emit(`change`),400)},teardownBridge(e){let t=this.bridge;if(this.bridge=null,this._hb){if(typeof this._hb.terminate==`function`){try{this._hb.postMessage({type:`stop`})}catch{}this._hb.terminate()}else clearInterval(this._hb);this._hb=null}this._bridgeUnsub&&=(this._bridgeUnsub(),null),this.setEditorEditable(!0),t&&e&&su(t.id).catch(()=>{})},setEditorEditable(e){let t=this.$refs.editor;t&&t.setAttribute(`contenteditable`,e?`true`:`false`)}}},yX={class:`st-code`},bX={class:`st-code__foot`},xX={class:`st-code__hint`},SX={class:`st-code__foot-actions`},CX=[`title`],wX=[`title`,`disabled`],TX={key:0,class:`st-code__vscode-label`};function EX(e,t,n,r,i,a){return V(),H(`div`,yX,[W(`div`,{ref:`editor`,class:j([`st-code__editor`,{"is-disabled":e.disabled,"is-bridged":!!i.bridge}])},null,2),q(` 右上角语言标签:弱化的只读标识,不参与交互 `),t[2]||=W(`span`,{class:`st-code__lang`,"aria-hidden":`true`},`JS`,-1),W(`div`,bX,[W(`span`,xX,M(a.lines)+` 行 · `+M(a.chars)+` 字符`,1),q(` VSCode 代码桥:生成临时 js 用外部编辑器编辑,保存实时回写;断开即删临时文件 `),W(`span`,SX,[i.bridge?(V(),H(`span`,{key:0,class:`st-code__bridge-tag`,title:i.bridge.file},`VSCode 同步中`,8,CX)):q(`v-if`,!0),W(`button`,{type:`button`,class:j([`st-code__vscode`,{"is-on":!!i.bridge}]),title:i.bridge?`断开 VSCode 桥接并删除临时文件`:`在 VSCode 中编辑:保存实时同步回编辑区,断开后清除临时文件`,disabled:e.disabled,onClick:t[0]||=(...e)=>a.toggleBridge&&a.toggleBridge(...e)},[q(` 图标左侧小字:未桥接时是动作说明;桥接后由状态徽标接替,避免两段文字挤一行 `),i.bridge?q(`v-if`,!0):(V(),H(`span`,TX,`在编辑器中打开`)),t[1]||=W(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,"aria-hidden":`true`},[W(`path`,{fill:`currentColor`,d:`M23.15 2.587 18.21.21a1.494 1.494 0 0 0-1.705.29l-9.46 8.63-4.12-3.128a.999.999 0 0 0-1.276.057L.327 7.261A1 1 0 0 0 .326 8.74L3.899 12 .326 15.26a1 1 0 0 0 .001 1.479L1.65 17.94a.999.999 0 0 0 1.276.057l4.12-3.128 9.46 8.63a1.492 1.492 0 0 0 1.704.29l4.942-2.377A1.5 1.5 0 0 0 24 20.06V3.939a1.5 1.5 0 0 0-.85-1.352zm-5.146 14.861L10.826 12l7.178-5.448v10.896z`})],-1)],10,wX)])])])}var DX=Z(vX,[[`render`,EX],[`__file`,`/Users/ynet/dsl-card/card-editor/components/setters/SetCode.vue`]]),OX={0:`常量`,1:`变量`,2:`图片`},kX={const:`0`,var:`1`,image:`2`};function AX(e){switch(e){case`InputNumber`:return{comp:WK};case`Color`:return{comp:FJ};case`Select`:return{comp:qK};case`TabSelect`:return{comp:uv,kind:`TabSelect`};case`Input`:return{comp:NK};case`Textarea`:return{comp:NK,multiline:!0};case`Switcher`:return{comp:ZK};case`BooleanForm`:return{comp:ZK,boolean:!0};case`PaddingStyle`:return{comp:mY};case`NumberStyle`:return{comp:uY};case`PositionStyle`:return{comp:xY,kind:`PositionStyle`};case`BackgroundPositionStyle`:return{comp:DY};case`BackgroundSizeStyle`:return{comp:NY};case`GradientStyle`:return{comp:VY};case`FontStyle`:return{comp:uv,kind:`FontStyle`};case`TextDecorationStyle`:return{comp:uv,kind:`TextDecorationStyle`};case`JustifyContentStyle`:return{comp:uv,kind:`JustifyContentStyle`};case`AlignItemsStyle`:return{comp:uv,kind:`AlignItemsStyle`};case`IconSelect`:return{comp:KJ};case`CustomSelect`:return{comp:YY};case`List`:return{comp:uX};case`IfForm`:return{comp:rY};case`Code`:return{comp:DX};default:return{comp:NK}}}var jX={name:`PropControl`,components:{SetText:NK,SetNumber:WK,SetSelect:qK,SetSegment:uv,SetSwitch:ZK,SetColor:FJ,SetIconSelect:KJ,SetIfForm:rY,SetNumberStyle:uY,SetPadding:mY,SetGrid9:xY,SetBgPosition:DY,SetBgSize:NY,SetGradient:VY,SetCustomSelect:YY,SetList:uX,SetImage:_X,SetCode:DX,SetExpr:QJ},props:{property:{type:Object,required:!0},watches:{type:Object,default:()=>({})},disabled:{type:Boolean,default:!1},bExchange:{type:Boolean,default:!0}},emits:[`change`,`sync`],computed:{itemType(){return this.property&&this.property.itemType||``},sources(){let e=this.property&&this.property.itemTypeRange||`const`,t=String(e).split(`,`).map(e=>e.trim()).filter(Boolean).map(e=>({key:kX[e],label:OX[kX[e]]})).filter(e=>e.key),n=String(this.property.itemValueFrom);return/^[012]$/.test(n)&&!t.some(e=>e.key===n)&&(t=t.concat([{key:n,label:OX[n]||`来源`+n}])),t},setterComp(){return AX(this.itemType)}},methods:{onInput(e){this.property.itemValue=e,this.$emit(`change`)},onChange(){this.$emit(`change`)},onSync(e){this.$emit(`sync`,e)},setSource(e){if(this.disabled)return;let t=this.property,n=String(e);t.itemValueFrom!==n&&(t._valuesByFrom||={0:void 0,1:void 0,2:void 0},t._valuesByFrom[t.itemValueFrom]=t.itemValue,t.itemValueFrom=n,t._valuesByFrom[n]===void 0?n===`0`?(t.itemValue=t.itemDefaultValue??this.defaultFor(),t._valuesByFrom[n]=t.itemValue):(t.itemValue=``,t._valuesByFrom[n]=``):t.itemValue=t._valuesByFrom[n],this.$emit(`change`))},defaultFor(){switch(this.itemType){case`Color`:return`#000000`;case`InputNumber`:return 0;case`Switcher`:return`0`;case`BooleanForm`:return!1;case`TabSelect`:case`Select`:{let e=this.property.itemOption||{},t=e.iParamList||e.iTypeList||[];return t.length?t[0].key:``}default:return``}}}},MX={key:0,class:`pc-srcs`},NX=[`disabled`,`onClick`],PX={class:`pc-body`};function FX(e,t,n,r,i,a){let o=R(`SetImage`),s=R(`SetExpr`);return V(),H(`div`,{class:j([`pc`,{"pc--readonly":n.disabled}])},[q(` 值来源切换(仅当 meta 声明了多于一种来源 且 允许切换时显示) `),a.sources.length>1&&n.bExchange?(V(),H(`div`,MX,[(V(!0),H(B,null,z(a.sources,e=>(V(),H(`button`,{key:e.key,type:`button`,class:j([`pc-src`,{"is-active":n.property.itemValueFrom===e.key}]),disabled:n.disabled,onClick:t=>a.setSource(e.key)},M(e.label),11,NX))),128))])):q(`v-if`,!0),W(`div`,PX,[q(` 图片素材来源 `),n.property.itemValueFrom===`2`?(V(),U(o,{key:0,value:n.property.itemValue,options:n.property.itemOption,"item-info":n.property,disabled:n.disabled,onInput:a.onInput,onChange:a.onChange},null,8,[`value`,`options`,`item-info`,`disabled`,`onInput`,`onChange`])):n.property.itemValueFrom===`1`?(V(),H(B,{key:1},[q(` 变量 / 表达式来源:带语法高亮、可拖拽调高度 `),G(s,{value:n.property.itemValue,disabled:n.disabled,"item-info":n.property,onInput:a.onInput,onChange:a.onChange},null,8,[`value`,`disabled`,`item-info`,`onInput`,`onChange`])],2112)):(V(),H(B,{key:2},[q(` 常量来源:按 itemType 分派 `),(V(),U(aa(a.setterComp.comp),{value:n.property.itemValue,options:n.property.itemOption,watches:n.watches,"item-info":n.property,disabled:n.disabled,kind:a.setterComp.kind,multiline:a.setterComp.multiline,boolean:a.setterComp.boolean,onInput:a.onInput,onChange:a.onChange,onSync:a.onSync},null,40,[`value`,`options`,`watches`,`item-info`,`disabled`,`kind`,`multiline`,`boolean`,`onInput`,`onChange`,`onSync`]))],2112))])],2)}var IX=Z(jX,[[`render`,FX],[`__scopeId`,`data-v-910daa70`],[`__file`,`/Users/ynet/dsl-card/card-editor/components/PropControl.vue`]]),LX={name:`PropTree`,props:{properties:{type:Array,default:()=>[]},mode:{type:String,default:`property`},depth:{type:Number,default:1},chain:{type:Array,default:()=>[]},watches:{type:Object,default:()=>({})},disabled:{type:Boolean,default:!1},bExchange:{type:Boolean,default:!0},plain:{type:Boolean,default:!1}},emits:[`leaf-change`,`leaf-sync`],data(){return{openMap:{}}},methods:{isGroup(e){if(!e)return!1;if(e.itemType===`group`)return!0;let t=e.itemChildren&&e.itemChildren.properties;return!!(t&&t.length)},childCount(e){let t=e.itemChildren&&e.itemChildren.properties;return t?t.length:0},isBlock(e){return e&&e.itemType===`Code`},groupVisible(e){if(e.itemVisible===!1)return!1;let t=e.itemChildren&&e.itemChildren.properties;return!t||!t.length||t.some(e=>e.itemVisible===!1?!1:!this.isGroup(e)||this.groupVisible(e))},isOpen(e){return this.openMap[e.itemId]!==!1},toggle(e){this.openMap[e.itemId]=this.openMap[e.itemId]===!1,this.openMap=Object.assign({},this.openMap)},onLeaf(e){this.$emit(`leaf-change`,this.chain.concat(e))},onSync(e){this.$emit(`leaf-sync`,e)}}},RX={key:0,class:`ptree__group`},zX=[`onClick`],BX={class:`ptree__group-name`},VX={class:`ptree__group-body`},HX=[`title`],UX={class:`ptree__control`};function WX(e,t,n,r,i,a){let o=R(`prop-tree`,!0),s=R(`prop-control`);return V(),H(`div`,{class:j([`ptree`,{"ptree--plain":n.plain}])},[(V(!0),H(B,null,z(n.properties,r=>(V(),H(B,{key:r.itemId},[q(` 分组(自身可见 且 存在可见后代才渲染,避免空分组) `),a.isGroup(r)&&a.groupVisible(r)?(V(),H(`div`,RX,[W(`div`,{class:`ptree__group-head`,type:`button`,onClick:e=>a.toggle(r)},[W(`span`,{class:j([`ptree__caret`,{"is-open":a.isOpen(r)}])},`▸`,2),W(`span`,BX,M(r.itemName||r.itemKey),1)],8,zX),L(W(`div`,VX,[r.itemChildren&&r.itemChildren.properties.length?(V(),U(o,{key:0,properties:r.itemChildren.properties,mode:n.mode,depth:n.depth+1,chain:n.chain.concat(r),watches:n.watches,disabled:n.disabled,"b-exchange":n.bExchange,plain:n.plain,onLeafChange:t[0]||=t=>e.$emit(`leaf-change`,t),onLeafSync:t[1]||=t=>e.$emit(`leaf-sync`,t)},null,8,[`properties`,`mode`,`depth`,`chain`,`watches`,`disabled`,`b-exchange`,`plain`])):q(`v-if`,!0)],512),[[Nc,a.isOpen(r)]])])):r.itemVisible===!1?q(`v-if`,!0):(V(),H(B,{key:1},[q(` 叶子(itemCondition 判定为不可见时不渲染,与线上编辑器一致) `),W(`div`,{class:j([`ptree__row`,{"ptree__row--disabled":n.disabled,"ptree__row--block":a.isBlock(r)}])},[W(`label`,{class:`ptree__label`,title:r.itemDesc||r.itemName||r.itemKey},M(r.itemName||r.itemKey||r.itemType||`字段`),9,HX),W(`div`,UX,[G(s,{property:r,watches:n.watches,disabled:n.disabled,"b-exchange":n.bExchange,onChange:e=>a.onLeaf(r),onSync:a.onSync},null,8,[`property`,`watches`,`disabled`,`b-exchange`,`onChange`,`onSync`])])],2)],2112))],64))),128))],2)}var GX=Z(LX,[[`render`,WX],[`__file`,`/Users/ynet/dsl-card/card-editor/components/PropTree.vue`]]),KX=Fl(OK);KX.component(`prop-control`,IX),KX.component(`prop-tree`,GX),KX.component(`Dropdown`,B_),KX.config.errorHandler=(e,t,n)=>{console.error(`[render error]`,n,e),window.__cardDebug&&window.__cardDebug.pushError(`render`,`${n}: ${e.message}`)},KX.mount(`#app`);
404
+ 否则从「远端全部卡片」等弹窗内触发的确认会被弹窗本体盖住。 `),G(ne,{visible:i.confirm.show,title:i.confirm.title,message:i.confirm.message,"confirm-text":i.confirm.confirmText,"cancel-text":i.confirm.cancelText,severity:i.confirm.severity,onConfirm:a.onConfirmDialog,onCancel:a.onCancelDialog},null,8,[`visible`,`title`,`message`,`confirm-text`,`cancel-text`,`severity`,`onConfirm`,`onCancel`]),q(` App 级弱提示:顶栏异步操作(远端保存 / 同步)完成反馈,浮于 App 外壳顶部居中 `),G(re),q(` 对话图片大图查看器:AI 面板里点预览图后全屏缩放查看,Teleport 到 body `),G(ie)],6)}var RK=Z(TG,[[`render`,LK],[`__file`,`/Users/ynet/dsl-card/card-editor/App.vue`]]),zK={name:`SetText`,props:{...Y_,multiline:{type:Boolean,default:!1}},emits:X_,computed:{text(){return this.value===void 0||this.value===null?``:String(this.value)},rows(){let e=this.options.autosize;return e&&typeof e==`object`&&e.minRows?e.minRows:4}},methods:{onInput(e){this.$emit(`input`,e)}}},BK=[`rows`,`placeholder`,`disabled`,`value`],VK=[`placeholder`,`disabled`,`value`];function HK(e,t,n,r,i,a){return n.multiline?(V(),H(`textarea`,{key:0,class:`st-textarea`,rows:a.rows,placeholder:e.options.placeholder||``,disabled:e.disabled,value:a.text,onInput:t[0]||=e=>a.onInput(e.target.value),onChange:t[1]||=t=>e.$emit(`change`)},null,40,BK)):(V(),H(`input`,{key:1,class:`ni-input`,type:`text`,placeholder:e.options.placeholder||``,disabled:e.disabled,value:a.text,onInput:t[2]||=e=>a.onInput(e.target.value),onChange:t[3]||=t=>e.$emit(`change`)},null,40,VK))}var UK=Z(zK,[[`render`,HK],[`__file`,`/Users/ynet/dsl-card/card-editor/components/setters/SetText.vue`]]),WK={integer:/^-?(0|[1-9][0-9]*)?$/,"+integer":/^(0|[1-9][0-9]*)?$/,"-integer":/^(0|-[1-9]?[0-9]*)?$/,float:/^-?([0-9]*|(0|[1-9][0-9]*)\.[0-9]*)?$/,"+float":/^([0-9]*|(0|[1-9][0-9]*)\.[0-9]*)?$/,"-float":/^(0|-[0-9]*|-(0|[1-9][0-9]*)\.[0-9]*)?$/},GK={name:`SetNumber`,props:Y_,emits:X_,data(){return{inputValue:``,sugOpen:!1}},computed:{suggestions(){return this.options.iParamList||[]},pattern(){return WK[this.options.type]||WK.integer}},watch:{value:{immediate:!0,handler(e){this.inputValue=e==null?``:String(e)}}},methods:{onInput(e){this.pattern.test(e)?(this.inputValue=e,this.$emit(`input`,e)):this.$refs.field.value=this.inputValue},step(e){let t=parseFloat(this.inputValue),n=String((Number.isNaN(t)?0:t)+e);this.pattern.test(n)&&(this.inputValue=n,this.$emit(`input`,n),this.emitChange())},pick(e){this.sugOpen=!1,this.inputValue=String(e.key),this.$emit(`input`,this.inputValue),this.emitChange()},closeSug(){setTimeout(()=>this.sugOpen=!1,0)},emitChange(){this.$emit(`change`)}}},KK={class:`st-number-wrap`},qK={class:`st-number`},JK=[`placeholder`,`disabled`,`value`],YK={key:0,class:`st-number__symbol st-number__symbol--btn`},XK={key:1,class:`st-number__symbol`},ZK={key:0,class:`st-pop st-pop--sug`},QK=[`onMousedown`];function $K(e,t,n,r,i,a){return V(),H(`div`,KK,[W(`div`,qK,[W(`input`,{ref:`field`,class:`st-number__field`,type:`text`,placeholder:e.options.placeholder||`请输入`,disabled:e.disabled,value:i.inputValue,onInput:t[0]||=e=>a.onInput(e.target.value),onChange:t[1]||=e=>a.emitChange(),onKeydown:[t[2]||=jl(J(e=>a.step(1),[`prevent`]),[`up`]),t[3]||=jl(J(e=>a.step(-1),[`prevent`]),[`down`])],onBlur:t[4]||=e=>a.closeSug()},null,40,JK),e.$slots.symbol?(V(),H(`span`,YK,[ca(e.$slots,`symbol`)])):e.options.symbol&&e.options.symbol!==!0?(V(),H(`span`,XK,M(e.options.symbol),1)):q(`v-if`,!0),a.suggestions.length?(V(),H(`span`,{key:2,class:`st-number__caret`,title:`预设值`,onMousedown:t[5]||=J(e=>i.sugOpen=!i.sugOpen,[`prevent`])},`▾`,32)):q(`v-if`,!0)]),q(` 预设值浮层:移出 .st-number,避免被 overflow:hidden 裁切 `),i.sugOpen&&a.suggestions.length?(V(),H(`div`,ZK,[(V(!0),H(B,null,z(a.suggestions,e=>(V(),H(`div`,{key:e.key,class:j([`st-pop__item`,{"st-pop__item--on":String(e.key)===String(i.inputValue)}]),onMousedown:J(t=>a.pick(e),[`prevent`])},M(e.value),43,QK))),128))])):q(`v-if`,!0)])}var eq=Z(GK,[[`render`,$K],[`__file`,`/Users/ynet/dsl-card/card-editor/components/setters/SetNumber.vue`]]),tq={name:`SetSelect`,props:Y_,emits:X_,computed:{list(){return this.options.iParamList||this.options.iTypeList||[]},placeholder(){return this.options.placeholder||`请选择`},optionList(){return this.list.map(e=>({key:String(e.key),value:e.value}))},current(){return this.value===void 0||this.value===null?``:String(this.value)}},methods:{onChange(e){this.$emit(`input`,e),this.$emit(`change`)}}};function nq(e,t,n,r,i,a){let o=R(`Dropdown`);return V(),U(o,{value:a.current,options:a.optionList,placeholder:a.placeholder,clearable:``,size:`sm`,block:``,disabled:e.disabled,onInput:a.onChange},null,8,[`value`,`options`,`placeholder`,`disabled`,`onInput`])}var rq=Z(tq,[[`render`,nq],[`__file`,`/Users/ynet/dsl-card/card-editor/components/setters/SetSelect.vue`]]),iq={name:`SetSwitch`,props:{...Y_,boolean:{type:Boolean,default:!1}},emits:X_,computed:{activeValue(){return this.options.activeValue===void 0?this.boolean?!0:`1`:this.options.activeValue},inactiveValue(){return this.options.inactiveValue===void 0?!this.boolean&&`0`:this.options.inactiveValue},on(){return this.value===this.activeValue},activeText(){return this.options.activeText||`开`},inactiveText(){return this.options.inactiveText||`关`}},methods:{toggle(){this.disabled||(this.$emit(`input`,this.on?this.inactiveValue:this.activeValue),this.$emit(`change`))}}},aq={class:`st-switch__text`};function oq(e,t,n,r,i,a){return V(),H(`div`,{class:j([`st-switch`,{"st-switch--on":a.on}]),onClick:t[0]||=(...e)=>a.toggle&&a.toggle(...e)},[t[1]||=W(`span`,{class:`st-switch__track`},[W(`span`,{class:`st-switch__knob`})],-1),W(`span`,aq,M(a.on?a.activeText:a.inactiveText),1)],2)}var sq=Z(iq,[[`render`,oq],[`__file`,`/Users/ynet/dsl-card/card-editor/components/setters/SetSwitch.vue`]]);function cq(e,t){t===void 0&&(t={});var n=t.insertAt;if(e&&typeof document<`u`){var r=document.head||document.getElementsByTagName(`head`)[0],i=document.createElement(`style`);i.type=`text/css`,n===`top`&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}var lq=function(e,t){let{componentPrefix:n=``}=t||{};e.component(`${n}${this.name}`,this)},uq={},dq={name:`Checkboard`,props:{size:{type:[Number,String],default:8},white:{type:String,default:`#fff`},grey:{type:String,default:`#e6e6e6`}},computed:{bgStyle(){return{"background-image":`url(${pq(this.white,this.grey,this.size)})`}}}};function fq(e,t,n){if(typeof document>`u`)return null;let r=document.createElement(`canvas`);r.width=r.height=n*2;let i=r.getContext(`2d`);return i?(i.fillStyle=e,i.fillRect(0,0,r.width,r.height),i.fillStyle=t,i.fillRect(0,0,n,n),i.translate(n,n),i.fillRect(0,0,n,n),r.toDataURL()):null}function pq(e,t,n){let r=`${e},${t},${n}`;if(uq[r])return uq[r];let i=fq(e,t,n);return uq[r]=i,i}function mq(e,t,n,r,i,a){return V(),H(`div`,{class:`vc-checkerboard`,style:A(a.bgStyle)},null,4)}cq(`.vc-checkerboard{background-size:contain;bottom:0;left:0;position:absolute;right:0;top:0}`),dq.render=mq,dq.__file=`src/components/checkboard/checkboard.vue`,dq.install=lq;var hq={name:`Alpha`,components:{Checkboard:dq},props:{value:Object,onChange:Function},computed:{colors(){return this.value},gradientColor(){let{rgba:e}=this.colors,t=[e.r,e.g,e.b].join(`,`);return`linear-gradient(to right, rgba(${t}, 0) 0%, rgba(${t}, 1) 100%)`}},methods:{handleChange(e,t){!t&&e.preventDefault();let{container:n}=this.$refs;if(!n)return;let r=n.clientWidth,i=n.getBoundingClientRect().left+window.pageXOffset,a=(e.pageX||(e.touches?e.touches[0].pageX:0))-i,o;o=a<0?0:a>r?1:Math.round(a*100/r)/100,this.colors.a!==o&&this.$emit(`change`,{h:this.colors.hsl.h,s:this.colors.hsl.s,l:this.colors.hsl.l,a:o,source:`rgba`})},handleMouseDown(e){this.handleChange(e,!0),window.addEventListener(`mousemove`,this.handleChange),window.addEventListener(`mouseup`,this.handleMouseUp)},handleMouseUp(){this.unbindEventListeners()},unbindEventListeners(){window.removeEventListener(`mousemove`,this.handleChange),window.removeEventListener(`mouseup`,this.handleMouseUp)}}},gq={class:`vc-alpha`},_q={class:`vc-alpha-checkboard-wrap`},vq=[W(`div`,{class:`vc-alpha-picker`},null,-1)];function yq(e,t,n,r,i,a){let o=R(`Checkboard`);return V(),H(`div`,gq,[W(`div`,_q,[G(o)]),W(`div`,{class:`vc-alpha-gradient`,style:A({background:a.gradientColor})},null,4),W(`div`,{ref:`container`,class:`vc-alpha-container`,onMousedown:t[0]||=(...e)=>a.handleMouseDown&&a.handleMouseDown(...e),onTouchmove:t[1]||=(...e)=>a.handleChange&&a.handleChange(...e),onTouchstart:t[2]||=(...e)=>a.handleChange&&a.handleChange(...e)},[W(`div`,{class:`vc-alpha-pointer`,style:A({left:`${a.colors.a*100}%`})},vq,4)],544)])}cq(`.vc-alpha,.vc-alpha-checkboard-wrap{bottom:0;left:0;position:absolute;right:0;top:0}.vc-alpha-checkboard-wrap{overflow:hidden}.vc-alpha-gradient{bottom:0;left:0;position:absolute;right:0;top:0}.vc-alpha-container{cursor:pointer;height:100%;margin:0 3px;position:relative;z-index:2}.vc-alpha-pointer{position:absolute;z-index:2}.vc-alpha-picker{background:#fff;border-radius:1px;box-shadow:0 0 2px rgba(0,0,0,.6);cursor:pointer;height:8px;margin-top:1px;transform:translateX(-2px);width:4px}`),hq.render=yq,hq.__file=`src/components/alpha/alpha.vue`,hq.install=lq;function bq(e,t){Sq(e)&&(e=`100%`);var n=Cq(e);return e=t===360?e:Math.min(t,Math.max(0,parseFloat(e))),n&&(e=parseInt(String(e*t),10)/100),Math.abs(e-t)<1e-6?1:(e=t===360?(e<0?e%t+t:e%t)/parseFloat(String(t)):e%t/parseFloat(String(t)),e)}function xq(e){return Math.min(1,Math.max(0,e))}function Sq(e){return typeof e==`string`&&e.indexOf(`.`)!==-1&&parseFloat(e)===1}function Cq(e){return typeof e==`string`&&e.indexOf(`%`)!==-1}function wq(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function Tq(e){return e<=1?`${Number(e)*100}%`:e}function Eq(e){return e.length===1?`0`+e:String(e)}function Dq(e,t,n){return{r:bq(e,255)*255,g:bq(t,255)*255,b:bq(n,255)*255}}function Oq(e,t,n){e=bq(e,255),t=bq(t,255),n=bq(n,255);var r=Math.max(e,t,n),i=Math.min(e,t,n),a=0,o=0,s=(r+i)/2;if(r===i)o=0,a=0;else{var c=r-i;switch(o=s>.5?c/(2-r-i):c/(r+i),r){case e:a=(t-n)/c+(t<n?6:0);break;case t:a=(n-e)/c+2;break;case n:a=(e-t)/c+4}a/=6}return{h:a,s:o,l:s}}function kq(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*(6*n):n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Aq(e,t,n){var r,i,a;if(e=bq(e,360),t=bq(t,100),n=bq(n,100),t===0)i=n,a=n,r=n;else{var o=n<.5?n*(1+t):n+t-n*t,s=2*n-o;r=kq(s,o,e+1/3),i=kq(s,o,e),a=kq(s,o,e-1/3)}return{r:r*255,g:i*255,b:a*255}}function jq(e,t,n){e=bq(e,255),t=bq(t,255),n=bq(n,255);var r=Math.max(e,t,n),i=Math.min(e,t,n),a=0,o=r,s=r-i,c=r===0?0:s/r;if(r===i)a=0;else{switch(r){case e:a=(t-n)/s+(t<n?6:0);break;case t:a=(n-e)/s+2;break;case n:a=(e-t)/s+4}a/=6}return{h:a,s:c,v:o}}function Mq(e,t,n){e=bq(e,360)*6,t=bq(t,100),n=bq(n,100);var r=Math.floor(e),i=e-r,a=n*(1-t),o=n*(1-i*t),s=n*(1-(1-i)*t),c=r%6,l=[n,o,a,a,s,n][c],u=[s,n,n,o,a,a][c],d=[a,a,s,n,n,o][c];return{r:l*255,g:u*255,b:d*255}}function Nq(e,t,n,r){var i=[Eq(Math.round(e).toString(16)),Eq(Math.round(t).toString(16)),Eq(Math.round(n).toString(16))];return r&&i[0].startsWith(i[0].charAt(1))&&i[1].startsWith(i[1].charAt(1))&&i[2].startsWith(i[2].charAt(1))?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join(``)}function Pq(e,t,n,r,i){var a=[Eq(Math.round(e).toString(16)),Eq(Math.round(t).toString(16)),Eq(Math.round(n).toString(16)),Eq(Fq(r))];return i&&a[0].startsWith(a[0].charAt(1))&&a[1].startsWith(a[1].charAt(1))&&a[2].startsWith(a[2].charAt(1))&&a[3].startsWith(a[3].charAt(1))?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):a.join(``)}function Fq(e){return Math.round(parseFloat(e)*255).toString(16)}function Iq(e){return Lq(e)/255}function Lq(e){return parseInt(e,16)}function Rq(e){return{r:e>>16,g:(e&65280)>>8,b:e&255}}var zq={aliceblue:`#f0f8ff`,antiquewhite:`#faebd7`,aqua:`#00ffff`,aquamarine:`#7fffd4`,azure:`#f0ffff`,beige:`#f5f5dc`,bisque:`#ffe4c4`,black:`#000000`,blanchedalmond:`#ffebcd`,blue:`#0000ff`,blueviolet:`#8a2be2`,brown:`#a52a2a`,burlywood:`#deb887`,cadetblue:`#5f9ea0`,chartreuse:`#7fff00`,chocolate:`#d2691e`,coral:`#ff7f50`,cornflowerblue:`#6495ed`,cornsilk:`#fff8dc`,crimson:`#dc143c`,cyan:`#00ffff`,darkblue:`#00008b`,darkcyan:`#008b8b`,darkgoldenrod:`#b8860b`,darkgray:`#a9a9a9`,darkgreen:`#006400`,darkgrey:`#a9a9a9`,darkkhaki:`#bdb76b`,darkmagenta:`#8b008b`,darkolivegreen:`#556b2f`,darkorange:`#ff8c00`,darkorchid:`#9932cc`,darkred:`#8b0000`,darksalmon:`#e9967a`,darkseagreen:`#8fbc8f`,darkslateblue:`#483d8b`,darkslategray:`#2f4f4f`,darkslategrey:`#2f4f4f`,darkturquoise:`#00ced1`,darkviolet:`#9400d3`,deeppink:`#ff1493`,deepskyblue:`#00bfff`,dimgray:`#696969`,dimgrey:`#696969`,dodgerblue:`#1e90ff`,firebrick:`#b22222`,floralwhite:`#fffaf0`,forestgreen:`#228b22`,fuchsia:`#ff00ff`,gainsboro:`#dcdcdc`,ghostwhite:`#f8f8ff`,goldenrod:`#daa520`,gold:`#ffd700`,gray:`#808080`,green:`#008000`,greenyellow:`#adff2f`,grey:`#808080`,honeydew:`#f0fff0`,hotpink:`#ff69b4`,indianred:`#cd5c5c`,indigo:`#4b0082`,ivory:`#fffff0`,khaki:`#f0e68c`,lavenderblush:`#fff0f5`,lavender:`#e6e6fa`,lawngreen:`#7cfc00`,lemonchiffon:`#fffacd`,lightblue:`#add8e6`,lightcoral:`#f08080`,lightcyan:`#e0ffff`,lightgoldenrodyellow:`#fafad2`,lightgray:`#d3d3d3`,lightgreen:`#90ee90`,lightgrey:`#d3d3d3`,lightpink:`#ffb6c1`,lightsalmon:`#ffa07a`,lightseagreen:`#20b2aa`,lightskyblue:`#87cefa`,lightslategray:`#778899`,lightslategrey:`#778899`,lightsteelblue:`#b0c4de`,lightyellow:`#ffffe0`,lime:`#00ff00`,limegreen:`#32cd32`,linen:`#faf0e6`,magenta:`#ff00ff`,maroon:`#800000`,mediumaquamarine:`#66cdaa`,mediumblue:`#0000cd`,mediumorchid:`#ba55d3`,mediumpurple:`#9370db`,mediumseagreen:`#3cb371`,mediumslateblue:`#7b68ee`,mediumspringgreen:`#00fa9a`,mediumturquoise:`#48d1cc`,mediumvioletred:`#c71585`,midnightblue:`#191970`,mintcream:`#f5fffa`,mistyrose:`#ffe4e1`,moccasin:`#ffe4b5`,navajowhite:`#ffdead`,navy:`#000080`,oldlace:`#fdf5e6`,olive:`#808000`,olivedrab:`#6b8e23`,orange:`#ffa500`,orangered:`#ff4500`,orchid:`#da70d6`,palegoldenrod:`#eee8aa`,palegreen:`#98fb98`,paleturquoise:`#afeeee`,palevioletred:`#db7093`,papayawhip:`#ffefd5`,peachpuff:`#ffdab9`,peru:`#cd853f`,pink:`#ffc0cb`,plum:`#dda0dd`,powderblue:`#b0e0e6`,purple:`#800080`,rebeccapurple:`#663399`,red:`#ff0000`,rosybrown:`#bc8f8f`,royalblue:`#4169e1`,saddlebrown:`#8b4513`,salmon:`#fa8072`,sandybrown:`#f4a460`,seagreen:`#2e8b57`,seashell:`#fff5ee`,sienna:`#a0522d`,silver:`#c0c0c0`,skyblue:`#87ceeb`,slateblue:`#6a5acd`,slategray:`#708090`,slategrey:`#708090`,snow:`#fffafa`,springgreen:`#00ff7f`,steelblue:`#4682b4`,tan:`#d2b48c`,teal:`#008080`,thistle:`#d8bfd8`,tomato:`#ff6347`,turquoise:`#40e0d0`,violet:`#ee82ee`,wheat:`#f5deb3`,white:`#ffffff`,whitesmoke:`#f5f5f5`,yellow:`#ffff00`,yellowgreen:`#9acd32`};function Bq(e){var t={r:0,g:0,b:0},n=1,r=null,i=null,a=null,o=!1,s=!1;return typeof e==`string`&&(e=Gq(e)),typeof e==`object`&&(Kq(e.r)&&Kq(e.g)&&Kq(e.b)?(t=Dq(e.r,e.g,e.b),o=!0,s=String(e.r).substr(-1)===`%`?`prgb`:`rgb`):Kq(e.h)&&Kq(e.s)&&Kq(e.v)?(r=Tq(e.s),i=Tq(e.v),t=Mq(e.h,r,i),o=!0,s=`hsv`):Kq(e.h)&&Kq(e.s)&&Kq(e.l)&&(r=Tq(e.s),a=Tq(e.l),t=Aq(e.h,r,a),o=!0,s=`hsl`),Object.prototype.hasOwnProperty.call(e,`a`)&&(n=e.a)),n=wq(n),{ok:o,format:e.format||s,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:n}}var Vq=`(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)`,Hq=`[\\s|\\(]+(${Vq})[,|\\s]+(${Vq})[,|\\s]+(${Vq})\\s*\\)?`,Uq=`[\\s|\\(]+(${Vq})[,|\\s]+(${Vq})[,|\\s]+(${Vq})[,|\\s]+(${Vq})\\s*\\)?`,Wq={CSS_UNIT:new RegExp(Vq),rgb:RegExp(`rgb`+Hq),rgba:RegExp(`rgba`+Uq),hsl:RegExp(`hsl`+Hq),hsla:RegExp(`hsla`+Uq),hsv:RegExp(`hsv`+Hq),hsva:RegExp(`hsva`+Uq),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/};function Gq(e){if(e=e.trim().toLowerCase(),e.length===0)return!1;var t=!1;if(zq[e])e=zq[e],t=!0;else if(e===`transparent`)return{r:0,g:0,b:0,a:0,format:`name`};var n=Wq.rgb.exec(e);return n?{r:n[1],g:n[2],b:n[3]}:(n=Wq.rgba.exec(e),n?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=Wq.hsl.exec(e),n?{h:n[1],s:n[2],l:n[3]}:(n=Wq.hsla.exec(e),n?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=Wq.hsv.exec(e),n?{h:n[1],s:n[2],v:n[3]}:(n=Wq.hsva.exec(e),n?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=Wq.hex8.exec(e),n?{r:Lq(n[1]),g:Lq(n[2]),b:Lq(n[3]),a:Iq(n[4]),format:t?`name`:`hex8`}:(n=Wq.hex6.exec(e),n?{r:Lq(n[1]),g:Lq(n[2]),b:Lq(n[3]),format:t?`name`:`hex`}:(n=Wq.hex4.exec(e),n?{r:Lq(n[1]+n[1]),g:Lq(n[2]+n[2]),b:Lq(n[3]+n[3]),a:Iq(n[4]+n[4]),format:t?`name`:`hex8`}:(n=Wq.hex3.exec(e),n?{r:Lq(n[1]+n[1]),g:Lq(n[2]+n[2]),b:Lq(n[3]+n[3]),format:t?`name`:`hex`}:!1)))))))))}function Kq(e){return!!Wq.CSS_UNIT.exec(String(e))}var qq=function(){function e(t,n){if(t===void 0&&(t=``),n===void 0&&(n={}),t instanceof e)return t;typeof t==`number`&&(t=Rq(t)),this.originalInput=t;var r=Bq(t);this.originalInput=t,this.r=r.r,this.g=r.g,this.b=r.b,this.a=r.a,this.roundA=Math.round(100*this.a)/100,this.format=n.format??r.format,this.gradientType=n.gradientType,this.r<1&&(this.r=Math.round(this.r)),this.g<1&&(this.g=Math.round(this.g)),this.b<1&&(this.b=Math.round(this.b)),this.isValid=r.ok}return e.prototype.isDark=function(){return this.getBrightness()<128},e.prototype.isLight=function(){return!this.isDark()},e.prototype.getBrightness=function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},e.prototype.getLuminance=function(){var e=this.toRgb(),t,n,r,i=e.r/255,a=e.g/255,o=e.b/255;return t=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,n=a<=.03928?a/12.92:((a+.055)/1.055)**2.4,r=o<=.03928?o/12.92:((o+.055)/1.055)**2.4,.2126*t+.7152*n+.0722*r},e.prototype.getAlpha=function(){return this.a},e.prototype.setAlpha=function(e){return this.a=wq(e),this.roundA=Math.round(100*this.a)/100,this},e.prototype.isMonochrome=function(){return this.toHsl().s===0},e.prototype.toHsv=function(){var e=jq(this.r,this.g,this.b);return{h:e.h*360,s:e.s,v:e.v,a:this.a}},e.prototype.toHsvString=function(){var e=jq(this.r,this.g,this.b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.v*100);return this.a===1?`hsv(${t}, ${n}%, ${r}%)`:`hsva(${t}, ${n}%, ${r}%, ${this.roundA})`},e.prototype.toHsl=function(){var e=Oq(this.r,this.g,this.b);return{h:e.h*360,s:e.s,l:e.l,a:this.a}},e.prototype.toHslString=function(){var e=Oq(this.r,this.g,this.b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.l*100);return this.a===1?`hsl(${t}, ${n}%, ${r}%)`:`hsla(${t}, ${n}%, ${r}%, ${this.roundA})`},e.prototype.toHex=function(e){return e===void 0&&(e=!1),Nq(this.r,this.g,this.b,e)},e.prototype.toHexString=function(e){return e===void 0&&(e=!1),`#`+this.toHex(e)},e.prototype.toHex8=function(e){return e===void 0&&(e=!1),Pq(this.r,this.g,this.b,this.a,e)},e.prototype.toHex8String=function(e){return e===void 0&&(e=!1),`#`+this.toHex8(e)},e.prototype.toHexShortString=function(e){return e===void 0&&(e=!1),this.a===1?this.toHexString(e):this.toHex8String(e)},e.prototype.toRgb=function(){return{r:Math.round(this.r),g:Math.round(this.g),b:Math.round(this.b),a:this.a}},e.prototype.toRgbString=function(){var e=Math.round(this.r),t=Math.round(this.g),n=Math.round(this.b);return this.a===1?`rgb(${e}, ${t}, ${n})`:`rgba(${e}, ${t}, ${n}, ${this.roundA})`},e.prototype.toPercentageRgb=function(){var e=function(e){return`${Math.round(bq(e,255)*100)}%`};return{r:e(this.r),g:e(this.g),b:e(this.b),a:this.a}},e.prototype.toPercentageRgbString=function(){var e=function(e){return Math.round(bq(e,255)*100)};return this.a===1?`rgb(${e(this.r)}%, ${e(this.g)}%, ${e(this.b)}%)`:`rgba(${e(this.r)}%, ${e(this.g)}%, ${e(this.b)}%, ${this.roundA})`},e.prototype.toName=function(){if(this.a===0)return`transparent`;if(this.a<1)return!1;for(var e=`#`+Nq(this.r,this.g,this.b,!1),t=0,n=Object.entries(zq);t<n.length;t++){var r=n[t],i=r[0];if(e===r[1])return i}return!1},e.prototype.toString=function(e){var t=!!e;e??=this.format;var n=!1,r=this.a<1&&this.a>=0;return!t&&r&&(e.startsWith(`hex`)||e===`name`)?e===`name`&&this.a===0?this.toName():this.toRgbString():(e===`rgb`&&(n=this.toRgbString()),e===`prgb`&&(n=this.toPercentageRgbString()),(e===`hex`||e===`hex6`)&&(n=this.toHexString()),e===`hex3`&&(n=this.toHexString(!0)),e===`hex4`&&(n=this.toHex8String(!0)),e===`hex8`&&(n=this.toHex8String()),e===`name`&&(n=this.toName()),e===`hsl`&&(n=this.toHslString()),e===`hsv`&&(n=this.toHsvString()),n||this.toHexString())},e.prototype.toNumber=function(){return(Math.round(this.r)<<16)+(Math.round(this.g)<<8)+Math.round(this.b)},e.prototype.clone=function(){return new e(this.toString())},e.prototype.lighten=function(t){t===void 0&&(t=10);var n=this.toHsl();return n.l+=t/100,n.l=xq(n.l),new e(n)},e.prototype.brighten=function(t){t===void 0&&(t=10);var n=this.toRgb();return n.r=Math.max(0,Math.min(255,n.r-Math.round(255*-(t/100)))),n.g=Math.max(0,Math.min(255,n.g-Math.round(255*-(t/100)))),n.b=Math.max(0,Math.min(255,n.b-Math.round(255*-(t/100)))),new e(n)},e.prototype.darken=function(t){t===void 0&&(t=10);var n=this.toHsl();return n.l-=t/100,n.l=xq(n.l),new e(n)},e.prototype.tint=function(e){return e===void 0&&(e=10),this.mix(`white`,e)},e.prototype.shade=function(e){return e===void 0&&(e=10),this.mix(`black`,e)},e.prototype.desaturate=function(t){t===void 0&&(t=10);var n=this.toHsl();return n.s-=t/100,n.s=xq(n.s),new e(n)},e.prototype.saturate=function(t){t===void 0&&(t=10);var n=this.toHsl();return n.s+=t/100,n.s=xq(n.s),new e(n)},e.prototype.greyscale=function(){return this.desaturate(100)},e.prototype.spin=function(t){var n=this.toHsl(),r=(n.h+t)%360;return n.h=r<0?360+r:r,new e(n)},e.prototype.mix=function(t,n){n===void 0&&(n=50);var r=this.toRgb(),i=new e(t).toRgb(),a=n/100;return new e({r:(i.r-r.r)*a+r.r,g:(i.g-r.g)*a+r.g,b:(i.b-r.b)*a+r.b,a:(i.a-r.a)*a+r.a})},e.prototype.analogous=function(t,n){t===void 0&&(t=6),n===void 0&&(n=30);var r=this.toHsl(),i=360/n,a=[this];for(r.h=(r.h-(i*t>>1)+720)%360;--t;)r.h=(r.h+i)%360,a.push(new e(r));return a},e.prototype.complement=function(){var t=this.toHsl();return t.h=(t.h+180)%360,new e(t)},e.prototype.monochromatic=function(t){t===void 0&&(t=6);for(var n=this.toHsv(),r=n.h,i=n.s,a=n.v,o=[],s=1/t;t--;)o.push(new e({h:r,s:i,v:a})),a=(a+s)%1;return o},e.prototype.splitcomplement=function(){var t=this.toHsl(),n=t.h;return[this,new e({h:(n+72)%360,s:t.s,l:t.l}),new e({h:(n+216)%360,s:t.s,l:t.l})]},e.prototype.onBackground=function(t){var n=this.toRgb(),r=new e(t).toRgb(),i=n.a+r.a*(1-n.a);return new e({r:(n.r*n.a+r.r*r.a*(1-n.a))/i,g:(n.g*n.a+r.g*r.a*(1-n.a))/i,b:(n.b*n.a+r.b*r.a*(1-n.a))/i,a:i})},e.prototype.triad=function(){return this.polyad(3)},e.prototype.tetrad=function(){return this.polyad(4)},e.prototype.polyad=function(t){for(var n=this.toHsl(),r=n.h,i=[this],a=360/t,o=1;o<t;o++)i.push(new e({h:(r+o*a)%360,s:n.s,l:n.l}));return i},e.prototype.equals=function(t){return this.toRgbString()===new e(t).toRgbString()},e}();function Jq(...e){return new qq(...e)}function Yq(e,t){let n=e&&e.a,r;r=e&&e.hsl?Jq(e.hsl):e&&e.hex&&e.hex.length>0?Jq(e.hex):e&&e.hsv?Jq(e.hsv):e&&e.rgba?Jq(e.rgba):e&&e.rgb?Jq(e.rgb):Jq(e),r&&(r._a===void 0||r._a===null)&&r.setAlpha(n||r.getAlpha());let i=r.toHsl(),a=r.toHsv();return i.s===0&&(a.h=i.h=e.h||e.hsl&&e.hsl.h||t||0),a.v<.0164&&(a.h=e.h||e.hsv&&e.hsv.h||0,a.s=e.s||e.hsv&&e.hsv.s||0),i.l<.01&&(i.h=e.h||e.hsl&&e.hsl.h||0,i.s=e.s||e.hsl&&e.hsl.s||0),{hsl:i,hex:r.toHexString().toUpperCase(),hex8:r.toHex8String().toUpperCase(),rgba:r.toRgb(),hsv:a,oldHue:e.h||t||i.h,source:e.source,a:r.getAlpha()}}var Xq={model:{prop:`modelValue`,event:`update:modelValue`},props:[`modelValue`],data(){return{val:Yq(this.modelValue)}},computed:{colors:{get(){return this.val},set(e){this.val=e,this.$emit(`update:modelValue`,e)}}},watch:{modelValue(e){this.val=Yq(e)}},methods:{colorChange(e,t){this.oldHue=this.colors.hsl.h,this.colors=Yq(e,t||this.oldHue)},isValidHex(e){return Jq(e).isValid},simpleCheckForValidColor(e){let t=[`r`,`g`,`b`,`a`,`h`,`s`,`l`,`v`],n=0,r=0;for(let i=0;i<t.length;i++){let a=t[i];e[a]&&(n++,isNaN(e[a])||r++)}if(n===r)return e},paletteUpperCase(e){return e.map(e=>e.toUpperCase())},isTransparent(e){return Jq(e).getAlpha()===0}}},Zq={name:`EditableInput`,props:{label:String,labelText:String,desc:String,value:[String,Number],max:Number,min:Number,arrowOffset:{type:Number,default:1}},computed:{val:{get(){return this.value},set(e){if(this.max!==void 0&&+e>this.max)this.$refs.input.value=this.max;else return e}},labelId(){return`input__label__${this.label}__${Math.random().toString().slice(2,5)}`},labelSpanText(){return this.labelText||this.label}},methods:{update(e){this.handleChange(e.target.value)},handleChange(e){let t={};t[this.label]=e,(t.hex===void 0&&t[`#`]===void 0||e.length>5)&&this.$emit(`change`,t)},handleKeyDown(e){let{val:t}=this,n=Number(t);if(n){let r=this.arrowOffset||1;e.keyCode===38&&(t=n+r,this.handleChange(t),e.preventDefault()),e.keyCode===40&&(t=n-r,this.handleChange(t),e.preventDefault())}}}},Qq={class:`vc-editable-input`},$q=[`aria-labelledby`],eJ=[`id`,`for`],tJ={class:`vc-input__desc`};function nJ(e,t,n,r,i,a){return V(),H(`div`,Qq,[L(W(`input`,{ref:`input`,"onUpdate:modelValue":t[0]||=e=>a.val=e,"aria-labelledby":a.labelId,class:`vc-input__input`,onKeydown:t[1]||=(...e)=>a.handleKeyDown&&a.handleKeyDown(...e),onInput:t[2]||=(...e)=>a.update&&a.update(...e)},null,40,$q),[[gl,a.val]]),W(`span`,{id:a.labelId,for:n.label,class:`vc-input__label`},M(a.labelSpanText),9,eJ),W(`span`,tJ,M(n.desc),1)])}cq(`.vc-editable-input{position:relative}.vc-input__input{border:0;outline:none;padding:0}.vc-input__label{text-transform:capitalize}`),Zq.render=nJ,Zq.__file=`src/components/editable-input/editable-input.vue`,Zq.install=lq;function rJ(e,t,n){return t<n?e<t?t:e>n?n:e:e<n?n:e>t?t:e}var iJ={name:`Saturation`,props:{value:Object},computed:{colors(){return this.value},bgColor(){return`hsl(${this.colors.hsv.h}, 100%, 50%)`},pointerTop(){return`${-(this.colors.hsv.v*100)+1+100}%`},pointerLeft(){return`${this.colors.hsv.s*100}%`}},methods:{handleChange(e,t){!t&&e.preventDefault();let{container:n}=this.$refs;if(!n)return;let r=n.clientWidth,i=n.clientHeight,a=n.getBoundingClientRect().left+window.pageXOffset,o=n.getBoundingClientRect().top+window.pageYOffset,s=e.pageX||(e.touches?e.touches[0].pageX:0),c=e.pageY||(e.touches?e.touches[0].pageY:0),l=rJ(s-a,0,r),u=rJ(c-o,0,i),d=l/r,f=rJ(-(u/i)+1,0,1);this.onChange({h:this.colors.hsv.h,s:d,v:f,a:this.colors.hsv.a,source:`hsva`})},onChange(e){this.$emit(`change`,e)},handleMouseDown(e){window.addEventListener(`mousemove`,this.handleChange),window.addEventListener(`mouseup`,this.handleChange),window.addEventListener(`mouseup`,this.handleMouseUp)},handleMouseUp(e){this.unbindEventListeners()},unbindEventListeners(){window.removeEventListener(`mousemove`,this.handleChange),window.removeEventListener(`mouseup`,this.handleChange),window.removeEventListener(`mouseup`,this.handleMouseUp)}}},aJ=W(`div`,{class:`vc-saturation--white`},null,-1),oJ=W(`div`,{class:`vc-saturation--black`},null,-1),sJ=[W(`div`,{class:`vc-saturation-circle`},null,-1)];function cJ(e,t,n,r,i,a){return V(),H(`div`,{ref:`container`,class:`vc-saturation`,style:A({background:a.bgColor}),onMousedown:t[0]||=(...e)=>a.handleMouseDown&&a.handleMouseDown(...e),onTouchmove:t[1]||=(...e)=>a.handleChange&&a.handleChange(...e),onTouchstart:t[2]||=(...e)=>a.handleChange&&a.handleChange(...e)},[aJ,oJ,W(`div`,{class:`vc-saturation-pointer`,style:A({top:a.pointerTop,left:a.pointerLeft})},sJ,4)],36)}cq(`.vc-saturation,.vc-saturation--black,.vc-saturation--white{bottom:0;cursor:pointer;left:0;position:absolute;right:0;top:0}.vc-saturation--white{background:linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.vc-saturation--black{background:linear-gradient(0deg,#000,transparent)}.vc-saturation-pointer{cursor:pointer;position:absolute}.vc-saturation-circle{border-radius:50%;box-shadow:0 0 0 1.5px #fff,inset 0 0 1px 1px rgba(0,0,0,.3),0 0 1px 2px rgba(0,0,0,.4);cursor:head;height:4px;transform:translate(-2px,-2px);width:4px}`),iJ.render=cJ,iJ.__file=`src/components/saturation/saturation.vue`,iJ.install=lq;var lJ={name:`Hue`,props:{value:Object,direction:{type:String,default:`horizontal`}},data(){return{oldHue:0,pullDirection:``}},computed:{colors(){return this.value},directionClass(){return{"vc-hue--horizontal":this.direction===`horizontal`,"vc-hue--vertical":this.direction===`vertical`}},pointerTop(){return this.direction===`vertical`?this.colors.hsl.h===0&&this.pullDirection===`right`?0:`${-(this.colors.hsl.h*100/360)+100}%`:0},pointerLeft(){return this.direction===`vertical`?0:this.colors.hsl.h===0&&this.pullDirection===`right`?`100%`:`${this.colors.hsl.h*100/360}%`}},watch:{value:{handler(e,t){let{h:n}=e.hsl;n!==0&&n-this.oldHue>0&&(this.pullDirection=`right`),n!==0&&n-this.oldHue<0&&(this.pullDirection=`left`),this.oldHue=n},deep:!0,immediate:!0}},methods:{handleChange(e,t){!t&&e.preventDefault();let{container:n}=this.$refs;if(!n)return;let r=n.clientWidth,i=n.clientHeight,a=n.getBoundingClientRect().left+window.pageXOffset,o=n.getBoundingClientRect().top+window.pageYOffset,s=e.pageX||(e.touches?e.touches[0].pageX:0),c=e.pageY||(e.touches?e.touches[0].pageY:0),l=s-a,u=c-o,d,f;this.direction===`vertical`?(u<0?d=360:u>i?d=0:(f=-(u*100/i)+100,d=360*f/100),this.colors.hsl.h!==d&&this.$emit(`change`,{h:d,s:this.colors.hsl.s,l:this.colors.hsl.l,a:this.colors.hsl.a,source:`hsl`})):(l<0?d=0:l>r?d=360:(f=l*100/r,d=360*f/100),this.colors.hsl.h!==d&&this.$emit(`change`,{h:d,s:this.colors.hsl.s,l:this.colors.hsl.l,a:this.colors.hsl.a,source:`hsl`}))},handleMouseDown(e){this.handleChange(e,!0),window.addEventListener(`mousemove`,this.handleChange),window.addEventListener(`mouseup`,this.handleChange),window.addEventListener(`mouseup`,this.handleMouseUp)},handleMouseUp(e){this.unbindEventListeners()},unbindEventListeners(){window.removeEventListener(`mousemove`,this.handleChange),window.removeEventListener(`mouseup`,this.handleChange),window.removeEventListener(`mouseup`,this.handleMouseUp)}}},uJ=[`aria-valuenow`],dJ=[W(`div`,{class:`vc-hue-picker`},null,-1)];function fJ(e,t,n,r,i,a){return V(),H(`div`,{class:j([`vc-hue`,[a.directionClass]])},[W(`div`,{ref:`container`,class:`vc-hue-container`,role:`slider`,"aria-valuenow":a.colors.hsl.h,"aria-valuemin":`0`,"aria-valuemax":`360`,onMousedown:t[0]||=(...e)=>a.handleMouseDown&&a.handleMouseDown(...e),onTouchmove:t[1]||=(...e)=>a.handleChange&&a.handleChange(...e),onTouchstart:t[2]||=(...e)=>a.handleChange&&a.handleChange(...e)},[W(`div`,{class:`vc-hue-pointer`,style:A({top:a.pointerTop,left:a.pointerLeft}),role:`presentation`},dJ,4)],40,uJ)],2)}cq(`.vc-hue{border-radius:2px;bottom:0;left:0;position:absolute;right:0;top:0}.vc-hue--horizontal{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.vc-hue--vertical{background:linear-gradient(0deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.vc-hue-container{cursor:pointer;height:100%;margin:0 2px;position:relative}.vc-hue-pointer{position:absolute;z-index:2}.vc-hue-picker{background:#fff;border-radius:1px;box-shadow:0 0 2px rgba(0,0,0,.6);cursor:pointer;height:8px;margin-top:1px;transform:translateX(-2px);width:4px}`),lJ.render=fJ,lJ.__file=`src/components/hue/hue.vue`,lJ.install=lq;var pJ=[`#D0021B`,`#F5A623`,`#F8E71C`,`#8B572A`,`#7ED321`,`#417505`,`#BD10E0`,`#9013FE`,`#4A90E2`,`#50E3C2`,`#B8E986`,`#000000`,`#4A4A4A`,`#9B9B9B`,`#FFFFFF`,`rgba(0,0,0,0)`],mJ={name:`Sketch`,components:{Saturation:iJ,Hue:lJ,Alpha:hq,EdIn:Zq,Checkboard:dq},mixins:[Xq],props:{presetColors:{type:Array,default(){return pJ}},disableAlpha:{type:Boolean,default:!1},disableFields:{type:Boolean,default:!1}},computed:{hex(){let e;return e=this.colors.a<1?this.colors.hex8:this.colors.hex,e.replace(`#`,``)},activeColor(){let{rgba:e}=this.colors;return`rgba(${[e.r,e.g,e.b,e.a].join(`,`)})`}},methods:{handlePreset(e){this.colorChange(e)},childChange(e){this.colorChange(e)},inputChange(e){e&&(e.hex?this.isValidHex(e.hex)&&this.colorChange({hex:e.hex,source:`hex`}):(e.r||e.g||e.b||e.a)&&this.colorChange({r:e.r||this.colors.rgba.r,g:e.g||this.colors.rgba.g,b:e.b||this.colors.rgba.b,a:e.a||this.colors.rgba.a,source:`rgba`}))}}},hJ={class:`vc-sketch-saturation-wrap`},gJ={class:`vc-sketch-controls`},_J={class:`vc-sketch-sliders`},vJ={class:`vc-sketch-hue-wrap`},yJ={key:0,class:`vc-sketch-alpha-wrap`},bJ={class:`vc-sketch-color-wrap`},xJ=[`aria-label`],SJ={key:0,class:`vc-sketch-field`},CJ={class:`vc-sketch-field--double`},wJ={class:`vc-sketch-field--single`},TJ={class:`vc-sketch-field--single`},EJ={class:`vc-sketch-field--single`},DJ={key:0,class:`vc-sketch-field--single`},OJ={class:`vc-sketch-presets`,role:`group`,"aria-label":`A color preset, pick one to set as current color`},kJ=[`aria-label`,`onClick`],AJ=[`aria-label`,`onClick`];function jJ(e,t,n,r,i,a){let o=R(`Saturation`),s=R(`Hue`),c=R(`Alpha`),l=R(`Checkboard`),u=R(`EdIn`);return V(),H(`div`,{role:`application`,"aria-label":`Sketch color picker`,class:j([`vc-sketch`,[n.disableAlpha?`vc-sketch__disable-alpha`:``]])},[W(`div`,hJ,[G(o,{value:e.colors,onChange:a.childChange},null,8,[`value`,`onChange`])]),W(`div`,gJ,[W(`div`,_J,[W(`div`,vJ,[G(s,{value:e.colors,onChange:a.childChange},null,8,[`value`,`onChange`])]),n.disableAlpha?q(`v-if`,!0):(V(),H(`div`,yJ,[G(c,{value:e.colors,onChange:a.childChange},null,8,[`value`,`onChange`])]))]),W(`div`,bJ,[W(`div`,{"aria-label":`Current color is ${a.activeColor}`,class:`vc-sketch-active-color`,style:A({background:a.activeColor})},null,12,xJ),G(l)])]),n.disableFields?q(`v-if`,!0):(V(),H(`div`,SJ,[q(` rgba `),W(`div`,CJ,[G(u,{label:`hex`,value:a.hex,onChange:a.inputChange},null,8,[`value`,`onChange`])]),W(`div`,wJ,[G(u,{label:`r`,value:e.colors.rgba.r,onChange:a.inputChange},null,8,[`value`,`onChange`])]),W(`div`,TJ,[G(u,{label:`g`,value:e.colors.rgba.g,onChange:a.inputChange},null,8,[`value`,`onChange`])]),W(`div`,EJ,[G(u,{label:`b`,value:e.colors.rgba.b,onChange:a.inputChange},null,8,[`value`,`onChange`])]),n.disableAlpha?q(`v-if`,!0):(V(),H(`div`,DJ,[G(u,{label:`a`,value:e.colors.a,"arrow-offset":.01,max:1,onChange:a.inputChange},null,8,[`value`,`arrow-offset`,`onChange`])]))])),W(`div`,OJ,[(V(!0),H(B,null,z(n.presetColors,t=>(V(),H(B,null,[e.isTransparent(t)?(V(),H(`div`,{key:t,"aria-label":`Color:${t}`,class:`vc-sketch-presets-color`,onClick:e=>a.handlePreset(t)},[G(l)],8,AJ)):(V(),H(`div`,{key:`!${t}`,class:`vc-sketch-presets-color`,"aria-label":`Color:${t}`,style:A({background:t}),onClick:e=>a.handlePreset(t)},null,12,kJ))],64))),256))])],2)}cq(`.vc-sketch{background:#fff;border-radius:4px;box-shadow:0 0 0 1px rgba(0,0,0,.15),0 8px 16px rgba(0,0,0,.15);box-sizing:initial;padding:10px 10px 0;position:relative;width:200px}.vc-sketch-saturation-wrap{overflow:hidden;padding-bottom:75%;position:relative;width:100%}.vc-sketch-controls{display:flex}.vc-sketch-sliders{flex:1;padding:4px 0}.vc-sketch-sliders .vc-alpha-gradient,.vc-sketch-sliders .vc-hue{border-radius:2px}.vc-sketch-alpha-wrap,.vc-sketch-hue-wrap{height:10px;position:relative}.vc-sketch-alpha-wrap{margin-top:4px;overflow:hidden}.vc-sketch-color-wrap{border-radius:3px;height:24px;margin-left:4px;margin-top:4px;position:relative;width:24px}.vc-sketch-active-color{border-radius:2px;bottom:0;box-shadow:inset 0 0 0 1px rgba(0,0,0,.15),inset 0 0 4px rgba(0,0,0,.25);left:0;position:absolute;right:0;top:0;z-index:2}.vc-sketch-color-wrap .vc-checkerboard{background-size:auto}.vc-sketch-field{display:flex;padding-top:4px}.vc-sketch-field .vc-input__input{border:none;box-shadow:inset 0 0 0 1px #ccc;font-size:10px;padding:4px 0 3px 10%;width:90%}.vc-sketch-field .vc-input__label{color:#222;display:block;font-size:11px;padding-bottom:4px;padding-top:3px;text-align:center;text-transform:capitalize}.vc-sketch-field--single{flex:1;padding-left:6px}.vc-sketch-field--double{flex:2}.vc-sketch-presets{border-top:1px solid #eee;margin-left:-10px;margin-right:-10px;padding-left:10px;padding-top:10px}.vc-sketch-presets-color{cursor:pointer;display:inline-block;height:16px;margin:0 10px 10px 0;overflow:hidden;position:relative;vertical-align:top;width:16px}.vc-sketch-presets-color,.vc-sketch-presets-color .vc-checkerboard{border-radius:3px;box-shadow:inset 0 0 0 1px rgba(0,0,0,.15)}.vc-sketch__disable-alpha .vc-sketch-color-wrap{height:10px}`),mJ.render=jJ,mJ.__file=`src/components/sketch/sketch.vue`,mJ.install=lq;function MJ(e){let t=String(e||``).trim();if(!t)return null;let n=t.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i);if(n)return{r:parseInt(n[1],16),g:parseInt(n[2],16),b:parseInt(n[3],16),a:1};if(n=t.match(/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i),n){let e=e=>parseInt(e+e,16);return{r:e(n[1]),g:e(n[2]),b:e(n[3]),a:1}}if(n=t.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i),n)return{r:parseInt(n[1],16),g:parseInt(n[2],16),b:parseInt(n[3],16),a:parseInt(n[4],16)/255};if(n=t.match(/^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)(?:\s*,\s*([\d.]+))?\s*\)$/i),n){let e=n[4]===void 0?1:parseFloat(n[4]);return{r:Math.round(parseFloat(n[1])),g:Math.round(parseFloat(n[2])),b:Math.round(parseFloat(n[3])),a:e}}return null}function NJ(e){if(!e)return`#000000`;let t=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,`0`);return`#`+t(e.r)+t(e.g)+t(e.b)}function PJ(e){return e?e.a>=1?NJ(e):`rgba(${Math.round(e.r)}, ${Math.round(e.g)}, ${Math.round(e.b)}, ${+e.a.toFixed(2)})`:``}var FJ={name:`SetColor`,components:{Sketch:mJ},props:Y_,emits:X_,data(){return{_rgb:null,popOpen:!1,popW:240,popStyle:{position:`fixed`,left:`0px`,top:`0px`}}},computed:{text(){return this.value===void 0||this.value===null?``:String(this.value)},parsed(){return MJ(this.text)||{r:0,g:0,b:0,a:1}},pickerValue(){return this.text||`#000000`},alpha(){return this.parsed.a},displayColor(){return PJ(this.parsed)}},watch:{text(){this._rgb=MJ(this.text)}},beforeUnmount(){this.removeDocListener()},methods:{onTextInput(e){this._rgb=MJ(e),this.$emit(`input`,e)},onAlphaChange(e){let t=Math.max(0,Math.min(1,parseInt(e,10)/100)),n={...this._rgb||this.parsed,a:t};this._rgb=n,this.$emit(`input`,PJ(n)),this.$emit(`change`)},onPicker(e){let t=e&&e.rgba,n,r,i,a;if(Array.isArray(t))[n,r,i,a]=t;else if(t)n=t.r,r=t.g,i=t.b,a=t.a;else{let t=MJ(e.hex)||{r:0,g:0,b:0,a:1};n=t.r,r=t.g,i=t.b,a=t.a}a??=1;let o=e.hex||NJ({r:n,g:r,b:i,a:1});this._rgb={r:n,g:r,b:i,a},this.$emit(`input`,a>=1?o:`rgba(${Math.round(n)}, ${Math.round(r)}, ${Math.round(i)}, ${+a.toFixed(2)})`),this.$emit(`change`)},clear(){this.disabled||(this._rgb=null,this.closePop(),this.$emit(`input`,``),this.$emit(`change`))},togglePop(){this.disabled||(this.popOpen?this.closePop():this.openPop())},openPop(){let e=this.$refs.swatch;if(!e)return;let t=e.getBoundingClientRect(),n=this.$refs.top&&this.$refs.top.getBoundingClientRect()||t,r=Math.max(220,Math.min(Math.round(n.width),400)),i=window.innerWidth,a=window.innerHeight,o=n.left,s=t.bottom+6;o+r>i-8&&(o=Math.max(8,i-r-8)),s+320>a-8&&(s=Math.max(8,t.top-320-6)),this.popW=r,this.popStyle={position:`fixed`,left:o+`px`,top:s+`px`,width:r+`px`,zIndex:4e3},this.popOpen=!0,this.$nextTick(()=>{document.addEventListener(`mousedown`,this.onDocClick,!0)})},closePop(){this.popOpen&&(this.popOpen=!1,this.removeDocListener())},removeDocListener(){document.removeEventListener(`mousedown`,this.onDocClick,!0)},onDocClick(e){let t=this.$refs.pop,n=this.$refs.swatch;t&&t.contains(e.target)||n&&n.contains(e.target)||this.closePop()}}},IJ={class:`st-color`},LJ={class:`st-color__top`,ref:`top`},RJ=[`title`,`disabled`],zJ=[`disabled`,`value`],BJ=[`disabled`],VJ={key:0,class:`st-color__alpha-row`},HJ=[`disabled`,`value`],UJ={class:`st-color__alpha-val`};function WJ(e,t,n,r,i,a){let o=R(`Sketch`);return V(),H(`div`,IJ,[q(` 色块预览 + 文本输入 + 重置(顶行) `),W(`div`,LJ,[W(`button`,{ref:`swatch`,class:`st-color__swatch`,type:`button`,title:a.text||`未设置`,disabled:e.disabled,onClick:t[0]||=(...e)=>a.togglePop&&a.togglePop(...e)},[t[7]||=W(`span`,{class:`st-color__checker`},null,-1),W(`span`,{class:`st-color__fill`,style:A({background:a.displayColor||`transparent`})},null,4)],8,RJ),W(`input`,{class:`ni-input st-color__text`,type:`text`,placeholder:`如 #333333 / rgba(0,0,0,.5)`,disabled:e.disabled,value:a.text,onInput:t[1]||=e=>a.onTextInput(e.target.value),onChange:t[2]||=t=>e.$emit(`change`)},null,40,zJ),W(`button`,{class:`st-color__clear`,type:`button`,title:`重置(清空颜色)`,disabled:e.disabled,onClick:t[3]||=(...e)=>a.clear&&a.clear(...e)},[...t[8]||=[W(`svg`,{viewBox:`0 0 16 16`,class:`st-ic`,"aria-hidden":`true`},[W(`use`,{href:`#icon-reset`})],-1)]],8,BJ)],512),q(` 透明度滑块(仅当颜色值非空时显示),作为快捷调节 `),a.text?(V(),H(`div`,VJ,[t[9]||=W(`span`,{class:`st-color__alpha-label`},`透明度`,-1),W(`input`,{class:`st-color__alpha-slider`,type:`range`,min:`0`,max:`100`,disabled:e.disabled,value:Math.round(a.alpha*100),onInput:t[4]||=e=>a.onAlphaChange(e.target.value),onChange:t[5]||=t=>e.$emit(`change`)},null,40,HJ),W(`span`,UJ,M(Math.round(a.alpha*100))+`%`,1)])):q(`v-if`,!0),q(` 第三方颜色选择器弹层(挂载到 body,避免被滚动容器裁切) `),(V(),U(mi,{to:`body`},[i.popOpen?(V(),H(`div`,{key:0,ref:`pop`,class:`st-color__pop`,style:A(i.popStyle),onMousedown:t[6]||=J(()=>{},[`stop`])},[G(o,{"model-value":a.pickerValue,"disable-alpha":!1,"onUpdate:modelValue":a.onPicker},null,8,[`model-value`,`onUpdate:modelValue`])],36)):q(`v-if`,!0)]))])}var GJ=Z(FJ,[[`render`,WJ],[`__file`,`/Users/ynet/dsl-card/card-editor/components/setters/SetColor.vue`]]),KJ={name:`SetIconSelect`,components:{SvgSymbols:Pd},props:Y_,emits:X_,data(){return{open:!1}},computed:{list(){return this.options.iIconList||[]}},methods:{pick(e){this.disabled||(this.open=!1,this.$emit(`input`,e.key),this.$emit(`change`))}}},qJ={class:`st-iconsel-wrap`},JJ={class:`st-iconsel`},YJ={class:`st-iconsel__preview`},XJ={key:1,style:{"font-size":`11px`,color:`var(--text-faint)`}},ZJ=[`disabled`,`value`],QJ={key:0,class:`st-iconsel__grid`},$J=[`title`,`onClick`],eY={key:0,class:`st-list__empty`};function tY(e,t,n,r,i,a){let o=R(`SvgSymbols`);return V(),H(`div`,qJ,[W(`div`,JJ,[W(`span`,YJ,[e.value?(V(),U(o,{key:0,icon:String(e.value),color:`currentColor`},null,8,[`icon`])):(V(),H(`span`,XJ,`无`))]),W(`input`,{class:`ni-input`,type:`text`,placeholder:`图标 key`,disabled:e.disabled,value:e.value||``,onInput:t[0]||=t=>e.$emit(`input`,t.target.value),onChange:t[1]||=t=>e.$emit(`change`)},null,40,ZJ),W(`button`,{class:`st-minibtn`,type:`button`,onClick:t[2]||=e=>i.open=!i.open},M(i.open?`收起`:`选择`),1)]),i.open?(V(),H(`div`,QJ,[(V(!0),H(B,null,z(a.list,t=>(V(),H(`span`,{key:t.key,class:j([`st-iconsel__cell`,{"st-iconsel__cell--on":t.key===e.value}]),title:t.name||t.value||t.key,onClick:e=>a.pick(t)},[G(o,{icon:t.key,color:`currentColor`},null,8,[`icon`])],10,$J))),128)),a.list.length?q(`v-if`,!0):(V(),H(`p`,eY,`该组件未提供图标列表`))])):q(`v-if`,!0)])}var nY=Z(KJ,[[`render`,tY],[`__file`,`/Users/ynet/dsl-card/card-editor/components/setters/SetIconSelect.vue`]]);Prism.languages.javascript=Prism.languages.extend(`clike`,{"class-name":[Prism.languages.clike[`class-name`],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(`(^|[^\\w$])(?:NaN|Infinity|0[bB][01]+(?:_[01]+)*n?|0[oO][0-7]+(?:_[0-7]+)*n?|0[xX][\\dA-Fa-f]+(?:_[\\dA-Fa-f]+)*n?|\\d+(?:_\\d+)*n|(?:\\d+(?:_\\d+)*(?:\\.(?:\\d+(?:_\\d+)*)?)?|\\.\\d+(?:_\\d+)*)(?:[Ee][+-]?\\d+(?:_\\d+)*)?)(?![\\w$])`),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),Prism.languages.javascript[`class-name`][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,Prism.languages.insertBefore(`javascript`,`keyword`,{regex:{pattern:RegExp(`((?:^|[^$\\w\\xA0-\\uFFFF."'\\])\\s]|\\b(?:return|yield))\\s*)\\/(?:(?:\\[(?:[^\\]\\\\\\r\\n]|\\\\.)*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}|(?:\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.)*\\])*\\])*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}v[dgimyus]{0,7})(?=(?:\\s|\\/\\*(?:[^*]|\\*(?!\\/))*\\*\\/)*(?:$|[\\r\\n,.;:})\\]]|\\/\\/))`),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:`language-regex`,inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:`function`},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.languages.insertBefore(`javascript`,`string`,{hashbang:{pattern:/^#!.*/,greedy:!0,alias:`comment`},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:`string`},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:`punctuation`},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:`property`}}),Prism.languages.insertBefore(`javascript`,`operator`,{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:`property`}}),Prism.languages.markup&&(Prism.languages.markup.tag.addInlined(`script`,`javascript`),Prism.languages.markup.tag.addAttribute(`on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)`,`javascript`)),Prism.languages.js=Prism.languages.javascript,pv.default.languages.javascript&&!pv.default.languages.javascript[`binding-var`]&&pv.default.languages.insertBefore(`javascript`,`keyword`,{"binding-var":/\$[A-Za-z_$][\w$]*/});var rY={name:`SetExpr`,props:{...Y_,placeholder:{type:String,default:``}},emits:X_,data(){return{code:``}},computed:{lines(){return this.code?this.code.split(`
405
+ `).length:0},chars(){return this.code.length}},watch:{value(e){this.syncFromValue(e)}},mounted(){this.code=this.readValue(this.value),this.$nextTick(()=>this.initJar())},beforeUnmount(){this._t&&clearTimeout(this._t),this._jar&&this._jar.destroy&&this._jar.destroy()},methods:{readValue(e){return e==null?``:typeof e==`string`?e:String(e)},syncFromValue(e){let t=this.readValue(e);if(t===this.code)return;let n=this.$refs.editor;n&&document.activeElement===n||(this.code=t,this._jar&&this._jar.updateCode(t))},initJar(){let e=this.$refs.editor;if(!e)return;let t=e=>{e.innerHTML=pv.default.highlight(e.textContent,pv.default.languages.javascript,`javascript`)};this._jar=fv(e,t,{tab:` `,indentOn:/[({[]$/,addClosing:!0,history:!0}),this._jar.updateCode(this.code),this._jar.onUpdate(e=>this.onCode(e))},onCode(e){this.disabled||(this.code=e,this.$emit(`input`,e),this._t&&clearTimeout(this._t),this._t=setTimeout(()=>this.$emit(`change`),400))}}},iY={key:0,class:`st-expr__ph`},aY={class:`st-expr__foot`},oY={class:`st-expr__hint`};function sY(e,t,n,r,i,a){return V(),H(`div`,{class:j([`st-expr`,{"st-expr--disabled":e.disabled}])},[W(`div`,{ref:`editor`,class:j([`st-expr__editor`,{"is-disabled":e.disabled}])},null,2),n.placeholder&&!i.code?(V(),H(`span`,iY,M(n.placeholder),1)):q(`v-if`,!0),W(`div`,aY,[W(`span`,oY,M(a.lines)+` 行 · `+M(a.chars)+` 字符`,1)])],2)}var cY=Z(rY,[[`render`,sY],[`__file`,`/Users/ynet/dsl-card/card-editor/components/setters/SetExpr.vue`]]),lY={name:`SetIfForm`,components:{SetExpr:cY},props:Y_,emits:X_,computed:{obj(){return this.value&&typeof this.value==`object`?this.value:{}},expression(){return this.obj.expression||``},name(){return this.obj.name||``}},methods:{setExpression(e){let t=!this.name||this.name===this.expression;this.$emit(`input`,{name:t?e:this.name,expression:e})},setName(e){this.$emit(`input`,{name:e,expression:this.expression})}}},uY={class:`st-ifform`},dY=[`disabled`,`value`];function fY(e,t,n,r,i,a){let o=R(`SetExpr`);return V(),H(`div`,uY,[G(o,{value:a.expression,disabled:e.disabled,placeholder:`表达式,如 $singleMode 或 $data.count > 0`,onInput:a.setExpression,onChange:t[0]||=t=>e.$emit(`change`)},null,8,[`value`,`disabled`,`onInput`]),W(`input`,{class:`ni-input`,type:`text`,placeholder:`显示名(留空跟随表达式)`,disabled:e.disabled,value:a.name,onInput:t[1]||=e=>a.setName(e.target.value),onChange:t[2]||=t=>e.$emit(`change`)},null,40,dY)])}var pY=Z(lY,[[`render`,fY],[`__file`,`/Users/ynet/dsl-card/card-editor/components/setters/SetIfForm.vue`]]),mY=[{key:`number`,value:`px`},{key:`percent`,value:`%`},{key:`auto`,value:`@`}],hY={name:`SetNumberStyle`,components:{SetNumber:eq},props:Y_,emits:X_,data(){return{unit:`number`,numValue:``,menuOpen:!1}},computed:{unitList(){return this.options.iTypeList||mY},unitLabel(){let e=this.unitList.filter(e=>e.key===this.unit)[0];return e?e.value:`px`},isAuto(){return this.unit===`auto`},numberOptions(){return{...this.options,type:this.unit===`percent`?`integer`:`float`,placeholder:this.options.placeholder||``,symbol:!0}}},watch:{value:{immediate:!0,handler(){this.parse()}}},methods:{parse(){let e=this.value;/%$/.test(String(e))?(this.unit=`percent`,this.numValue=String(e).replace(/%/g,``)):e===`auto`?(this.unit=`auto`,this.numValue=`auto`):(this.unit=`number`,this.numValue=e===0?`0`:e==null?``:String(e))},onNum(e){this.numValue=e,this.emit()},pickUnit(e){this.menuOpen=!1,this.unit=e,this.numValue=e===`percent`?`100`:e===`auto`?`auto`:``,this.emit(),this.$emit(`change`)},emit(){this.unit===`percent`&&this.numValue?this.$emit(`input`,this.numValue+`%`):this.$emit(`input`,this.numValue)}}},gY={class:`st-numberstyle`},_Y={key:1,class:`st-pop st-pop--unit`},vY=[`onMousedown`];function yY(e,t,n,r,i,a){let o=R(`SetNumber`);return V(),H(`div`,gY,[G(o,{value:i.numValue,options:a.numberOptions,disabled:e.disabled||a.isAuto,onInput:a.onNum,onChange:t[1]||=t=>e.$emit(`change`)},{symbol:I(()=>[W(`span`,{class:`st-unit`,onMousedown:t[0]||=J(e=>i.menuOpen=!i.menuOpen,[`prevent`])},M(a.unitLabel),33)]),_:1},8,[`value`,`options`,`disabled`,`onInput`]),q(` 单位切换浮层:移到 .st-number 之外,避免被 overflow:hidden 裁切 `),i.menuOpen?(V(),H(`div`,{key:0,class:`st-pop-mask`,onMousedown:t[2]||=J(e=>i.menuOpen=!1,[`prevent`])},null,32)):q(`v-if`,!0),i.menuOpen?(V(),H(`div`,_Y,[(V(!0),H(B,null,z(a.unitList,e=>(V(),H(`div`,{key:e.key,class:j([`st-pop__item`,{"st-pop__item--on":e.key===i.unit}]),onMousedown:J(t=>a.pickUnit(e.key),[`prevent`])},M(e.value),43,vY))),128))])):q(`v-if`,!0)])}var bY=Z(hY,[[`render`,yY],[`__file`,`/Users/ynet/dsl-card/card-editor/components/setters/SetNumberStyle.vue`]]),xY={name:`SetPadding`,components:{SetNumber:eq},props:Y_,emits:X_,data(){return{form:{top:``,right:``,bottom:``,left:``}}},computed:{brackets(){return this.options.brackets||[`{`,`}`]},seperator(){return this.options.seperator||`,`}},watch:{value:{immediate:!0,handler(){this.parse()}}},methods:{parse(){let e=String(this.value||``);this.brackets.length&&(e=e.replace(RegExp(`[${this.brackets.join(``)}]`,`g`),``));let t=e.split(this.seperator);this.form=this.options.normal?{top:t[0]||``,right:t[1]||``,bottom:t[2]||``,left:t[3]||``}:{top:t[0]||``,left:t[1]||``,bottom:t[2]||``,right:t[3]||``}},opt(e){return{type:`integer`,symbol:e,placeholder:`0`}},set(e,t){this.form[e]=t,this.emitValue()},emitValue(){let e=this.form,t=(this.options.normal?[e.top,e.right,e.bottom,e.left]:[e.top,e.left,e.bottom,e.right]).map(e=>e===``||e===void 0?`0`:e).join(this.seperator),[n,r]=this.brackets.length?this.brackets:[``,``];this.$emit(`input`,`${n||``}${t}${r||``}`)},emitOut(){this.$emit(`change`)}}},SY={class:`st-pad`};function CY(e,t,n,r,i,a){let o=R(`SetNumber`);return V(),H(`div`,SY,[G(o,{value:i.form.top,options:a.opt(`上`),disabled:e.disabled,onInput:t[0]||=e=>a.set(`top`,e),onChange:a.emitOut},null,8,[`value`,`options`,`disabled`,`onChange`]),G(o,{value:i.form.right,options:a.opt(`右`),disabled:e.disabled,onInput:t[1]||=e=>a.set(`right`,e),onChange:a.emitOut},null,8,[`value`,`options`,`disabled`,`onChange`]),G(o,{value:i.form.bottom,options:a.opt(`下`),disabled:e.disabled,onInput:t[2]||=e=>a.set(`bottom`,e),onChange:a.emitOut},null,8,[`value`,`options`,`disabled`,`onChange`]),G(o,{value:i.form.left,options:a.opt(`左`),disabled:e.disabled,onInput:t[3]||=e=>a.set(`left`,e),onChange:a.emitOut},null,8,[`value`,`options`,`disabled`,`onChange`])])}var wY=Z(xY,[[`render`,CY],[`__file`,`/Users/ynet/dsl-card/card-editor/components/setters/SetPadding.vue`]]),TY=[{key:`TopLeft`,value:`上左`},{key:`TopCenter`,value:`上中`},{key:`TopRight`,value:`上右`},{key:`CenterLeft`,value:`中左`},{key:`Center`,value:`中间`},{key:`CenterRight`,value:`中右`},{key:`BottomLeft`,value:`下左`},{key:`BottomCenter`,value:`下中`},{key:`BottomRight`,value:`下右`}],EY=[{key:`0% 0%`,value:`左上对齐`},{key:`50% 0%`,value:`中上对齐`},{key:`100% 0%`,value:`右上对齐`},{key:`0% 50%`,value:`左中对齐`},{key:`50% 50%`,value:`居中对齐`},{key:`100% 50%`,value:`右中对齐`},{key:`0% 100%`,value:`左下对齐`},{key:`50% 100%`,value:`中下对齐`},{key:`100% 100%`,value:`右下对齐`}],DY={name:`SetGrid9`,props:{...Y_,kind:{type:String,default:`PositionStyle`}},emits:X_,computed:{cells(){return this.kind===`BackgroundPositionStyle`?EY:TY}},methods:{pick(e){this.disabled||(this.$emit(`input`,e.key),this.$emit(`change`))}}},OY={class:`st-grid9`},kY=[`title`,`onClick`];function AY(e,t,n,r,i,a){return V(),H(`div`,OY,[(V(!0),H(B,null,z(a.cells,n=>(V(),H(`div`,{key:n.key,class:j([`st-grid9__cell`,{"st-grid9__cell--on":String(n.key)===String(e.value)}]),title:n.value,onClick:e=>a.pick(n)},[...t[0]||=[W(`span`,{class:`st-grid9__dot`},null,-1)]],10,kY))),128))])}var jY=Z(DY,[[`render`,AY],[`__file`,`/Users/ynet/dsl-card/card-editor/components/setters/SetGrid9.vue`]]),MY=[{key:`number`,value:`px`},{key:`percent`,value:`%`}],NY={name:`SetBgPosition`,components:{SetGrid9:jY,SetNumberStyle:bY},props:Y_,emits:X_,data(){return{x:``,y:``}},watch:{value:{immediate:!0,handler(){this.parse()}}},methods:{parse(){let e=String(this.value||``).split(/\s+/);this.x=e[0]||``,this.y=e[1]||``},numOptions(e){return{placeholder:e,iTypeList:MY}},pickGrid(e){this.$emit(`input`,e)},setX(e){this.x=e,this.emitValue()},setY(e){this.y=e,this.emitValue()},emitValue(){this.$emit(`input`,`${this.x||`0`} ${this.y||`0`}`)},emitOut(){this.$emit(`change`)}}},PY={class:`st-bgpos`},FY={class:`st-bgpos__xy`};function IY(e,t,n,r,i,a){let o=R(`SetGrid9`),s=R(`SetNumberStyle`);return V(),H(`div`,PY,[G(o,{kind:`BackgroundPositionStyle`,value:e.value,disabled:e.disabled,onInput:a.pickGrid,onChange:t[0]||=t=>e.$emit(`change`)},null,8,[`value`,`disabled`,`onInput`]),W(`div`,FY,[G(s,{value:i.x,options:a.numOptions(`X`),disabled:e.disabled,onInput:a.setX,onChange:a.emitOut},null,8,[`value`,`options`,`disabled`,`onInput`,`onChange`]),G(s,{value:i.y,options:a.numOptions(`Y`),disabled:e.disabled,onInput:a.setY,onChange:a.emitOut},null,8,[`value`,`options`,`disabled`,`onInput`,`onChange`])])])}var LY=Z(NY,[[`render`,IY],[`__file`,`/Users/ynet/dsl-card/card-editor/components/setters/SetBgPosition.vue`]]),RY=[{key:`cover`,desc:`cover:保持纵横比,缩放到完全覆盖背景定位区域的最小尺寸`},{key:`contain`,desc:`contain:保持纵横比,缩放到能放进背景定位区域的最大尺寸`}],zY={name:`SetBgSize`,components:{SetNumberStyle:bY,Dropdown:B_},computed:{bgOptions(){return[{key:``,value:`自定义`}].concat(this.TYPES.map(e=>({key:e.key,value:e.key})))}},props:Y_,emits:X_,data(){return{TYPES:RY,preset:``,x:``,y:``}},watch:{value:{immediate:!0,handler(){this.parse()}}},methods:{parse(){let e=String(this.value||``),t=RY.map(e=>e.key);this.preset=t.includes(e)?e:``;let n=e.split(/\s+/);n.length>=2?(this.x=n[0]||``,this.y=n[1]||``):(this.x=``,this.y=``)},pickPreset(e){this.preset=e,e||(this.x=`auto`,this.y=`auto`),this.emitValue(),this.$emit(`change`)},setX(e){this.x=e,this.emitValue()},setY(e){this.y=e,this.emitValue()},emitValue(){let e=this.preset?this.preset:`${this.x||`auto`} ${this.y||`auto`}`;this.$emit(`input`,e)},emitOut(){this.$emit(`change`)}}},BY={class:`st-bgsize`},VY={key:0,class:`st-bgsize__xy`};function HY(e,t,n,r,i,a){let o=R(`Dropdown`),s=R(`SetNumberStyle`);return V(),H(`div`,BY,[G(o,{value:i.preset,options:a.bgOptions,size:`sm`,block:``,disabled:e.disabled,onInput:t[0]||=e=>a.pickPreset(e)},null,8,[`value`,`options`,`disabled`]),i.preset?q(`v-if`,!0):(V(),H(`div`,VY,[G(s,{value:i.x,options:{placeholder:`宽`},disabled:e.disabled,onInput:a.setX,onChange:a.emitOut},null,8,[`value`,`disabled`,`onInput`,`onChange`]),G(s,{value:i.y,options:{placeholder:`高`},disabled:e.disabled,onInput:a.setY,onChange:a.emitOut},null,8,[`value`,`disabled`,`onInput`,`onChange`])]))])}var UY=Z(zY,[[`render`,HY],[`__file`,`/Users/ynet/dsl-card/card-editor/components/setters/SetBgSize.vue`]]),WY=[{key:`to bottom`,desc:`从上到下`},{key:`to top`,desc:`从下到上`},{key:`to left`,desc:`从右到左`},{key:`to right`,desc:`从左到右`},{key:`to bottom right`,desc:`从左上到右下`},{key:`to bottom left`,desc:`从右上到左下`},{key:`to top left`,desc:`从右下到左上`},{key:`to top right`,desc:`从左下到右上`}];function GY(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`(`?n++:a===`)`?n--:a===`,`&&n===0&&(t.push(e.slice(r,i).trim()),r=i+1)}return t.push(e.slice(r).trim()),t.filter(e=>e!==``)}var KY={name:`SetGradient`,components:{SetColor:GJ,Dropdown:B_},props:Y_,emits:X_,data(){return{DIRECTIONS:WY,direction:`to bottom`,stops:[]}},computed:{preview(){if(!this.stops.length)return`transparent`;let e=this.stops.map(e=>e.color).filter(Boolean);return e.length<2?e[0]||`transparent`:`linear-gradient(${this.direction}, ${e.join(`, `)})`}},watch:{value:{immediate:!0,handler(){this.parse()}}},methods:{parse(){let e=String(this.value||``).trim().match(/linear-gradient\((.+)\)$/);if(!e){this.direction=this.options.defaultDirection||WY[0].key,this.stops=[];return}let t=GY(e[1]);this.direction=(t[0]||``).toLowerCase()||WY[0].key,this.stops=t.slice(1).map(e=>({color:e}))},setDirection(e){this.direction=e,this.emitValue(),this.$emit(`change`)},setStop(e,t){this.stops[e].color=t,this.emitValue()},addStop(){this.disabled||(this.stops.push({color:`#ffffff`}),this.emitValue(),this.$emit(`change`))},removeStop(e){this.disabled||(this.stops.splice(e,1),this.emitValue(),this.$emit(`change`))},emitValue(){let e=this.stops.map(e=>e.color).filter(e=>e!==``&&e!==void 0);this.$emit(`input`,e.length?`linear-gradient(${this.direction}, ${e.join(`, `)})`:``)},emitOut(){this.$emit(`change`)}}},qY={class:`st-gradient`},JY=[`onClick`],YY=[`disabled`];function XY(e,t,n,r,i,a){let o=R(`Dropdown`),s=R(`SetColor`);return V(),H(`div`,qY,[W(`div`,{class:`st-gradient__preview`,style:A({background:a.preview})},null,4),G(o,{value:i.direction,options:i.DIRECTIONS.map(e=>({key:e.key,value:e.desc})),size:`sm`,block:``,disabled:e.disabled,onInput:t[0]||=e=>a.setDirection(e)},null,8,[`value`,`options`,`disabled`]),(V(!0),H(B,null,z(i.stops,(t,n)=>(V(),H(`div`,{key:`stop`+n,class:`st-gradient__stop`},[G(s,{value:t.color,disabled:e.disabled,onInput:e=>a.setStop(n,e),onChange:a.emitOut},null,8,[`value`,`disabled`,`onInput`,`onChange`]),W(`button`,{class:`st-gradient__del`,type:`button`,title:`删除该渐变色`,onClick:e=>a.removeStop(n)},`✕`,8,JY)]))),128)),W(`button`,{class:`st-minibtn`,type:`button`,disabled:e.disabled,onClick:t[1]||=(...e)=>a.addStop&&a.addStop(...e)},`+ 新增渐变色`,8,YY)])}var ZY=Z(KY,[[`render`,XY],[`__file`,`/Users/ynet/dsl-card/card-editor/components/setters/SetGradient.vue`]]),QY=new Set([`width`,`height`,`lineHeight`,`marginRight`,`cursor`,`textAlign`]),$Y={name:`SetCustomSelect`,props:Y_,emits:[...X_,`sync`],computed:{list(){return this.options.list||[]}},methods:{normalizeStyle(e){if(!e||typeof e!=`object`)return{};let t={};for(let n in e)QY.has(n)||(t[n]=e[n]);return t},apply(e){if(this.disabled)return;let t=e.sync||{};Object.keys(t).length&&this.$emit(`sync`,t)}}},eX={class:`st-customsel`},tX=[`title`,`onClick`],nX={key:0},rX={key:0,class:`st-list__empty`};function iX(e,t,n,r,i,a){return V(),H(`div`,eX,[(V(!0),H(B,null,z(a.list,(e,t)=>(V(),H(`div`,{key:t,class:`st-customsel__item`,style:A(a.normalizeStyle(e.style)),title:`应用:`+Object.keys(e.sync||{}).join(`、`),onClick:t=>a.apply(e)},[(V(!0),H(B,null,z(e.list||[],(e,t)=>(V(),H(`span`,{key:t,style:A(a.normalizeStyle(e.style))},M(e.innerText),5))),128)),(e.list||[]).length?q(`v-if`,!0):(V(),H(`span`,nX,M(e.innerText||`样式`+(t+1)),1))],12,tX))),128)),a.list.length?q(`v-if`,!0):(V(),H(`p`,rX,`未配置常用样式`))])}var aX=Z($Y,[[`render`,iX],[`__file`,`/Users/ynet/dsl-card/card-editor/components/setters/SetCustomSelect.vue`]]),oX={name:`SetList`,props:Y_,emits:X_,computed:{list(){let e=this.itemInfo;return e&&e.itemList||[]},addText(){return this.options&&this.options.btnText||`添加项`}},methods:{displayName(e){let t=e.itemName||e.itemKey||``;return{fontStyle:`字体风格`,textDecoration:`文字装饰`}[e.itemKey]||t},add(){if(this.disabled)return;let e=this.itemInfo,t=this.list[0],n;n=t?new wu(t.properties.map(e=>({itemId:e.itemId,itemKey:e.itemKey,itemName:e.itemName,itemType:e.itemType,itemOption:e.itemOption,itemParam:e.itemParam,itemDefaultValue:e.itemDefaultValue,itemDesc:e.itemDesc,itemTypeRange:e.itemTypeRange,itemValueFrom:`0`,itemValue:``})),{}):new wu((this.options&&this.options.iFieldList||[]).map(e=>({itemId:e.key,itemKey:e.key,itemName:e.value||e.key,itemType:`Input`,itemValueFrom:`0`,itemValue:``})),{}),e.itemList.push(n),this.$emit(`change`)},remove(e){this.disabled||(this.itemInfo.removeAt(e),this.$emit(`change`))},move(e,t){this.disabled||(this.itemInfo.moveItem(e,e+t),this.$emit(`change`))}}},sX={class:`st-list`},cX={class:`st-list__head`},lX={class:`st-list__idx`},uX=[`disabled`,`onClick`],dX=[`disabled`,`onClick`],fX=[`disabled`,`onClick`],pX={class:`st-list__body`},mX=[`title`],hX={class:`st-list__control`},gX={key:0,class:`st-list__empty`},_X={key:0,class:`st-list__empty`},vX=[`disabled`];function yX(e,t,n,r,i,a){let o=R(`prop-control`);return V(),H(`div`,sX,[(V(!0),H(B,null,z(a.list,(n,r)=>(V(),H(`div`,{key:n.id,class:`st-list__item`},[W(`div`,cX,[W(`span`,lX,`#`+M(r+1),1),t[4]||=W(`span`,{class:`st-list__head-spacer`},null,-1),W(`button`,{class:`st-list__op`,type:`button`,title:`上移`,disabled:e.disabled||r===0,onClick:e=>a.move(r,-1)},`↑`,8,uX),W(`button`,{class:`st-list__op`,type:`button`,title:`下移`,disabled:e.disabled||r===a.list.length-1,onClick:e=>a.move(r,1)},`↓`,8,dX),W(`button`,{class:`st-list__op st-list__op--del`,type:`button`,title:`删除`,disabled:e.disabled,onClick:e=>a.remove(r)},[...t[3]||=[W(`svg`,{viewBox:`0 0 16 16`,class:`st-ic`,"aria-hidden":`true`},[W(`use`,{href:`#icon-delete`})],-1)]],8,fX)]),W(`div`,pX,[(V(!0),H(B,null,z(n.properties,n=>L((V(),H(`div`,{key:n.itemId,class:`st-list__row`},[W(`label`,{class:`st-list__label`,title:n.itemDesc||a.displayName(n)},M(a.displayName(n)),9,mX),W(`div`,hX,[G(o,{property:n,disabled:e.disabled,onChange:t[0]||=t=>e.$emit(`change`),onSync:t[1]||=t=>e.$emit(`sync`,t)},null,8,[`property`,`disabled`])])])),[[Nc,n.itemVisible]])),128)),n.properties.length?q(`v-if`,!0):(V(),H(`p`,gX,`该项无字段`))])]))),128)),a.list.length?q(`v-if`,!0):(V(),H(`p`,_X,`暂无项`)),W(`button`,{class:`st-minibtn st-list__add`,type:`button`,disabled:e.disabled,onClick:t[2]||=(...e)=>a.add&&a.add(...e)},M(a.addText),9,vX)])}var bX=Z(oX,[[`render`,yX],[`__file`,`/Users/ynet/dsl-card/card-editor/components/setters/SetList.vue`]]),xX={name:`SetImage`,props:Y_,emits:X_,methods:{clear(){this.disabled||(this.$emit(`input`,``),this.$emit(`change`))}}},SX={class:`st-image`},CX={class:`st-image__row`},wX=[`disabled`,`value`],TX=[`disabled`];function EX(e,t,n,r,i,a){return V(),H(`div`,SX,[W(`div`,CX,[W(`input`,{class:`ni-input`,type:`text`,disabled:e.disabled,value:e.value||``,placeholder:`图片路径,如 @filestore/...png 或 https://...`,onInput:t[0]||=t=>e.$emit(`input`,t.target.value),onChange:t[1]||=t=>e.$emit(`change`)},null,40,wX),e.value?(V(),H(`button`,{key:0,class:`st-image__clear`,type:`button`,title:`清空`,disabled:e.disabled,onClick:t[2]||=(...e)=>a.clear&&a.clear(...e)},[...t[3]||=[W(`svg`,{viewBox:`0 0 16 16`,class:`st-ic`,"aria-hidden":`true`},[W(`use`,{href:`#icon-reset`})],-1)]],8,TX)):q(`v-if`,!0)])])}var DX=Z(xX,[[`render`,EX],[`__file`,`/Users/ynet/dsl-card/card-editor/components/setters/SetImage.vue`]]),OX={name:`SetCode`,props:Y_,emits:X_,data(){return{code:``,bridge:null}},computed:{codeKey(){return this.options.codeKey||`code`},lines(){return this.code?this.code.split(`
406
+ `).length:0},chars(){return this.code.length}},mounted(){this.code=this.readCode(),this.$nextTick(()=>this.initJar())},beforeUnmount(){this._t&&clearTimeout(this._t),this.teardownBridge(!0),this._jar&&this._jar.destroy&&this._jar.destroy()},methods:{readCode(){let e=this.value;return e==null?``:typeof e==`string`?e:String(typeof e==`object`?e[this.codeKey]||``:e)},initJar(){let e=this.$refs.editor;if(!e)return;let t=e=>{e.innerHTML=pv.default.highlight(e.textContent,pv.default.languages.javascript,`javascript`)};this._jar=fv(e,t,{tab:` `,indentOn:/[({[]$/,addClosing:!0,history:!0}),this._jar.updateCode(this.code),this._jar.onUpdate(e=>this.onCode(e))},onCode(e){if(this.disabled||this.bridge)return;this.code=e;let t=this.value&&typeof this.value==`object`?Object.assign({},this.value):{};t[this.codeKey]=e,this.$emit(`input`,t),this._t&&clearTimeout(this._t),this._t=setTimeout(()=>this.$emit(`change`),400)},toggleBridge(){this.bridge?this.teardownBridge(!0):this.setupBridge()},async setupBridge(){if(this.disabled||this.bridge)return;let e=this.itemInfo&&this.itemInfo.itemKey?String(this.itemInfo.itemKey):``;try{let t=await iu(this.code,e);this.bridge={id:t.id,file:t.file}}catch(e){console.error(`[VSCode 桥接建立失败]`,e);return}this.setEditorEditable(!1);let t=Jl()||``,n=Yl()||``,r=(t||location.origin)+`/__code-bridge/${this.bridge.id}/heartbeat`,i=n?`${r}?token=${encodeURIComponent(n)}`:r;try{this._hb=new Worker(new URL(`/assets/codeBridgeHeartbeat.worker-Zb_A5RUd.js`,``+import.meta.url),{type:`module`}),this._hb.onmessage=()=>{},this._hb.postMessage({type:`start`,url:i,interval:5e3})}catch(e){console.warn(`[VSCode 桥接] Worker 心跳不可用,降级主线程心跳`,e),this._hb=setInterval(()=>{this.bridge&&ou(this.bridge.id).catch(()=>{})},5e3)}this._bridgeUnsub=tu(e=>{if(this.bridge&&e&&e.id===this.bridge.id){if(e.reason)return this.teardownBridge(!1);this.pullBridgeCode()}})},async pullBridgeCode(){if(!this.bridge)return;let e;try{e=await au(this.bridge.id)}catch{return}let t=String(e.code==null?``:e.code);t!==this.code&&this.applyExternalCode(t)},applyExternalCode(e){this.code=e,this._jar&&this._jar.updateCode(e,!1);let t=this.value&&typeof this.value==`object`?Object.assign({},this.value):{};t[this.codeKey]=e,this.$emit(`input`,t),this._t&&clearTimeout(this._t),this._t=setTimeout(()=>this.$emit(`change`),400)},teardownBridge(e){let t=this.bridge;if(this.bridge=null,this._hb){if(typeof this._hb.terminate==`function`){try{this._hb.postMessage({type:`stop`})}catch{}this._hb.terminate()}else clearInterval(this._hb);this._hb=null}this._bridgeUnsub&&=(this._bridgeUnsub(),null),this.setEditorEditable(!0),t&&e&&su(t.id).catch(()=>{})},setEditorEditable(e){let t=this.$refs.editor;t&&t.setAttribute(`contenteditable`,e?`true`:`false`)}}},kX={class:`st-code`},AX={class:`st-code__foot`},jX={class:`st-code__hint`},MX={class:`st-code__foot-actions`},NX=[`title`],PX=[`title`,`disabled`],FX={key:0,class:`st-code__vscode-label`};function IX(e,t,n,r,i,a){return V(),H(`div`,kX,[W(`div`,{ref:`editor`,class:j([`st-code__editor`,{"is-disabled":e.disabled,"is-bridged":!!i.bridge}])},null,2),q(` 右上角语言标签:弱化的只读标识,不参与交互 `),t[2]||=W(`span`,{class:`st-code__lang`,"aria-hidden":`true`},`JS`,-1),W(`div`,AX,[W(`span`,jX,M(a.lines)+` 行 · `+M(a.chars)+` 字符`,1),q(` VSCode 代码桥:生成临时 js 用外部编辑器编辑,保存实时回写;断开即删临时文件 `),W(`span`,MX,[i.bridge?(V(),H(`span`,{key:0,class:`st-code__bridge-tag`,title:i.bridge.file},`VSCode 同步中`,8,NX)):q(`v-if`,!0),W(`button`,{type:`button`,class:j([`st-code__vscode`,{"is-on":!!i.bridge}]),title:i.bridge?`断开 VSCode 桥接并删除临时文件`:`在 VSCode 中编辑:保存实时同步回编辑区,断开后清除临时文件`,disabled:e.disabled,onClick:t[0]||=(...e)=>a.toggleBridge&&a.toggleBridge(...e)},[q(` 图标左侧小字:未桥接时是动作说明;桥接后由状态徽标接替,避免两段文字挤一行 `),i.bridge?q(`v-if`,!0):(V(),H(`span`,FX,`在编辑器中打开`)),t[1]||=W(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,"aria-hidden":`true`},[W(`path`,{fill:`currentColor`,d:`M23.15 2.587 18.21.21a1.494 1.494 0 0 0-1.705.29l-9.46 8.63-4.12-3.128a.999.999 0 0 0-1.276.057L.327 7.261A1 1 0 0 0 .326 8.74L3.899 12 .326 15.26a1 1 0 0 0 .001 1.479L1.65 17.94a.999.999 0 0 0 1.276.057l4.12-3.128 9.46 8.63a1.492 1.492 0 0 0 1.704.29l4.942-2.377A1.5 1.5 0 0 0 24 20.06V3.939a1.5 1.5 0 0 0-.85-1.352zm-5.146 14.861L10.826 12l7.178-5.448v10.896z`})],-1)],10,PX)])])])}var LX=Z(OX,[[`render`,IX],[`__file`,`/Users/ynet/dsl-card/card-editor/components/setters/SetCode.vue`]]),RX={0:`常量`,1:`变量`,2:`图片`},zX={const:`0`,var:`1`,image:`2`};function BX(e){switch(e){case`InputNumber`:return{comp:eq};case`Color`:return{comp:GJ};case`Select`:return{comp:rq};case`TabSelect`:return{comp:uv,kind:`TabSelect`};case`Input`:return{comp:UK};case`Textarea`:return{comp:UK,multiline:!0};case`Switcher`:return{comp:sq};case`BooleanForm`:return{comp:sq,boolean:!0};case`PaddingStyle`:return{comp:wY};case`NumberStyle`:return{comp:bY};case`PositionStyle`:return{comp:jY,kind:`PositionStyle`};case`BackgroundPositionStyle`:return{comp:LY};case`BackgroundSizeStyle`:return{comp:UY};case`GradientStyle`:return{comp:ZY};case`FontStyle`:return{comp:uv,kind:`FontStyle`};case`TextDecorationStyle`:return{comp:uv,kind:`TextDecorationStyle`};case`JustifyContentStyle`:return{comp:uv,kind:`JustifyContentStyle`};case`AlignItemsStyle`:return{comp:uv,kind:`AlignItemsStyle`};case`IconSelect`:return{comp:nY};case`CustomSelect`:return{comp:aX};case`List`:return{comp:bX};case`IfForm`:return{comp:pY};case`Code`:return{comp:LX};default:return{comp:UK}}}var VX={name:`PropControl`,components:{SetText:UK,SetNumber:eq,SetSelect:rq,SetSegment:uv,SetSwitch:sq,SetColor:GJ,SetIconSelect:nY,SetIfForm:pY,SetNumberStyle:bY,SetPadding:wY,SetGrid9:jY,SetBgPosition:LY,SetBgSize:UY,SetGradient:ZY,SetCustomSelect:aX,SetList:bX,SetImage:DX,SetCode:LX,SetExpr:cY},props:{property:{type:Object,required:!0},watches:{type:Object,default:()=>({})},disabled:{type:Boolean,default:!1},bExchange:{type:Boolean,default:!0}},emits:[`change`,`sync`],computed:{itemType(){return this.property&&this.property.itemType||``},sources(){let e=this.property&&this.property.itemTypeRange||`const`,t=String(e).split(`,`).map(e=>e.trim()).filter(Boolean).map(e=>({key:zX[e],label:RX[zX[e]]})).filter(e=>e.key),n=String(this.property.itemValueFrom);return/^[012]$/.test(n)&&!t.some(e=>e.key===n)&&(t=t.concat([{key:n,label:RX[n]||`来源`+n}])),t},setterComp(){return BX(this.itemType)}},methods:{onInput(e){this.property.itemValue=e,this.$emit(`change`)},onChange(){this.$emit(`change`)},onSync(e){this.$emit(`sync`,e)},setSource(e){if(this.disabled)return;let t=this.property,n=String(e);t.itemValueFrom!==n&&(t._valuesByFrom||={0:void 0,1:void 0,2:void 0},t._valuesByFrom[t.itemValueFrom]=t.itemValue,t.itemValueFrom=n,t._valuesByFrom[n]===void 0?n===`0`?(t.itemValue=t.itemDefaultValue??this.defaultFor(),t._valuesByFrom[n]=t.itemValue):(t.itemValue=``,t._valuesByFrom[n]=``):t.itemValue=t._valuesByFrom[n],this.$emit(`change`))},defaultFor(){switch(this.itemType){case`Color`:return`#000000`;case`InputNumber`:return 0;case`Switcher`:return`0`;case`BooleanForm`:return!1;case`TabSelect`:case`Select`:{let e=this.property.itemOption||{},t=e.iParamList||e.iTypeList||[];return t.length?t[0].key:``}default:return``}}}},HX={key:0,class:`pc-srcs`},UX=[`disabled`,`onClick`],WX={class:`pc-body`};function GX(e,t,n,r,i,a){let o=R(`SetImage`),s=R(`SetExpr`);return V(),H(`div`,{class:j([`pc`,{"pc--readonly":n.disabled}])},[q(` 值来源切换(仅当 meta 声明了多于一种来源 且 允许切换时显示) `),a.sources.length>1&&n.bExchange?(V(),H(`div`,HX,[(V(!0),H(B,null,z(a.sources,e=>(V(),H(`button`,{key:e.key,type:`button`,class:j([`pc-src`,{"is-active":n.property.itemValueFrom===e.key}]),disabled:n.disabled,onClick:t=>a.setSource(e.key)},M(e.label),11,UX))),128))])):q(`v-if`,!0),W(`div`,WX,[q(` 图片素材来源 `),n.property.itemValueFrom===`2`?(V(),U(o,{key:0,value:n.property.itemValue,options:n.property.itemOption,"item-info":n.property,disabled:n.disabled,onInput:a.onInput,onChange:a.onChange},null,8,[`value`,`options`,`item-info`,`disabled`,`onInput`,`onChange`])):n.property.itemValueFrom===`1`?(V(),H(B,{key:1},[q(` 变量 / 表达式来源:带语法高亮、可拖拽调高度 `),G(s,{value:n.property.itemValue,disabled:n.disabled,"item-info":n.property,onInput:a.onInput,onChange:a.onChange},null,8,[`value`,`disabled`,`item-info`,`onInput`,`onChange`])],2112)):(V(),H(B,{key:2},[q(` 常量来源:按 itemType 分派 `),(V(),U(aa(a.setterComp.comp),{value:n.property.itemValue,options:n.property.itemOption,watches:n.watches,"item-info":n.property,disabled:n.disabled,kind:a.setterComp.kind,multiline:a.setterComp.multiline,boolean:a.setterComp.boolean,onInput:a.onInput,onChange:a.onChange,onSync:a.onSync},null,40,[`value`,`options`,`watches`,`item-info`,`disabled`,`kind`,`multiline`,`boolean`,`onInput`,`onChange`,`onSync`]))],2112))])],2)}var KX=Z(VX,[[`render`,GX],[`__scopeId`,`data-v-910daa70`],[`__file`,`/Users/ynet/dsl-card/card-editor/components/PropControl.vue`]]),qX={name:`PropTree`,props:{properties:{type:Array,default:()=>[]},mode:{type:String,default:`property`},depth:{type:Number,default:1},chain:{type:Array,default:()=>[]},watches:{type:Object,default:()=>({})},disabled:{type:Boolean,default:!1},bExchange:{type:Boolean,default:!0},plain:{type:Boolean,default:!1}},emits:[`leaf-change`,`leaf-sync`],data(){return{openMap:{}}},methods:{isGroup(e){if(!e)return!1;if(e.itemType===`group`)return!0;let t=e.itemChildren&&e.itemChildren.properties;return!!(t&&t.length)},childCount(e){let t=e.itemChildren&&e.itemChildren.properties;return t?t.length:0},isBlock(e){return e&&e.itemType===`Code`},groupVisible(e){if(e.itemVisible===!1)return!1;let t=e.itemChildren&&e.itemChildren.properties;return!t||!t.length||t.some(e=>e.itemVisible===!1?!1:!this.isGroup(e)||this.groupVisible(e))},isOpen(e){return this.openMap[e.itemId]!==!1},toggle(e){this.openMap[e.itemId]=this.openMap[e.itemId]===!1,this.openMap=Object.assign({},this.openMap)},onLeaf(e){this.$emit(`leaf-change`,this.chain.concat(e))},onSync(e){this.$emit(`leaf-sync`,e)}}},JX={key:0,class:`ptree__group`},YX=[`onClick`],XX={class:`ptree__group-name`},ZX={class:`ptree__group-body`},QX=[`title`],$X={class:`ptree__control`};function eZ(e,t,n,r,i,a){let o=R(`prop-tree`,!0),s=R(`prop-control`);return V(),H(`div`,{class:j([`ptree`,{"ptree--plain":n.plain}])},[(V(!0),H(B,null,z(n.properties,r=>(V(),H(B,{key:r.itemId},[q(` 分组(自身可见 且 存在可见后代才渲染,避免空分组) `),a.isGroup(r)&&a.groupVisible(r)?(V(),H(`div`,JX,[W(`div`,{class:`ptree__group-head`,type:`button`,onClick:e=>a.toggle(r)},[W(`span`,{class:j([`ptree__caret`,{"is-open":a.isOpen(r)}])},`▸`,2),W(`span`,XX,M(r.itemName||r.itemKey),1)],8,YX),L(W(`div`,ZX,[r.itemChildren&&r.itemChildren.properties.length?(V(),U(o,{key:0,properties:r.itemChildren.properties,mode:n.mode,depth:n.depth+1,chain:n.chain.concat(r),watches:n.watches,disabled:n.disabled,"b-exchange":n.bExchange,plain:n.plain,onLeafChange:t[0]||=t=>e.$emit(`leaf-change`,t),onLeafSync:t[1]||=t=>e.$emit(`leaf-sync`,t)},null,8,[`properties`,`mode`,`depth`,`chain`,`watches`,`disabled`,`b-exchange`,`plain`])):q(`v-if`,!0)],512),[[Nc,a.isOpen(r)]])])):r.itemVisible===!1?q(`v-if`,!0):(V(),H(B,{key:1},[q(` 叶子(itemCondition 判定为不可见时不渲染,与线上编辑器一致) `),W(`div`,{class:j([`ptree__row`,{"ptree__row--disabled":n.disabled,"ptree__row--block":a.isBlock(r)}])},[W(`label`,{class:`ptree__label`,title:r.itemDesc||r.itemName||r.itemKey},M(r.itemName||r.itemKey||r.itemType||`字段`),9,QX),W(`div`,$X,[G(s,{property:r,watches:n.watches,disabled:n.disabled,"b-exchange":n.bExchange,onChange:e=>a.onLeaf(r),onSync:a.onSync},null,8,[`property`,`watches`,`disabled`,`b-exchange`,`onChange`,`onSync`])])],2)],2112))],64))),128))],2)}var tZ=Z(qX,[[`render`,eZ],[`__file`,`/Users/ynet/dsl-card/card-editor/components/PropTree.vue`]]),nZ=Fl(RK);nZ.component(`prop-control`,KX),nZ.component(`prop-tree`,tZ),nZ.component(`Dropdown`,B_),nZ.config.errorHandler=(e,t,n)=>{console.error(`[render error]`,n,e),window.__cardDebug&&window.__cardDebug.pushError(`render`,`${n}: ${e.message}`)},nZ.mount(`#app`);