ht-emr 0.7.65 → 0.7.67
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document!="undefined"){var e=document.createElement("style");e.id="canvas-editor-style",e.appendChild(document.createTextNode(`.ce-select-control-popup{max-width:160px;min-width:69px;max-height:225px;position:absolute;z-index:1;border:1px solid #e4e7ed;border-radius:4px;background-color:#fff;box-shadow:0 2px 12px #0000001a;box-sizing:border-box;margin:5px 0;display:flex;flex-direction:column;overflow:hidden}.ce-select-control-search{display:block;width:calc(100% - 16px);height:28px;margin:8px;padding:0 8px;border:1px solid #dcdfe6;border-radius:3px;outline:none;box-sizing:border-box;color:#606266;font-size:13px;line-height:28px}.ce-select-control-search:focus{border-color:var(--COLOR-HOVER, #5175f4)}.ce-select-control-popup ul{list-style:none;padding:3px 0;margin:0;min-height:0;overflow-y:auto;box-sizing:border-box}.ce-select-control-popup ul li{font-size:13px;padding:0 20px;position:relative;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#666;height:36px;line-height:36px;box-sizing:border-box;cursor:pointer}.ce-select-control-popup ul li:hover,.ce-select-control-popup ul li.keyboard-active{background-color:#eef2fd}.ce-select-control-popup ul li.active{color:var(--COLOR-HOVER, #5175f4);font-weight:700}.ce-select-control-popup ul li.ce-select-control-empty{color:#909399;cursor:default;text-align:center}.ce-select-control-popup ul li.ce-select-control-empty:hover{background-color:transparent}.ce-calculator{position:absolute;z-index:1;border:1px solid #e4e7ed;border-radius:4px;background-color:#fff;box-shadow:0 2px 12px #0000001a;box-sizing:border-box;margin:5px 0;padding:8px;width:200px}.ce-calculator-display{width:100%;height:40px;line-height:40px;text-align:right;padding:0 10px;margin-bottom:8px;border:1px solid #e4e7ed;border-radius:4px;background-color:#f5f7fa;font-size:16px;box-sizing:border-box;overflow:hidden;text-overflow:ellipsis}.ce-calculator-buttons{display:grid;grid-template-columns:repeat(4,1fr);gap:4px}.ce-calculator-button{width:100%;height:36px;border:1px solid #e4e7ed;border-radius:4px;background-color:#fff;font-size:14px;cursor:pointer;transition:all .2s;box-sizing:border-box}.ce-calculator-button:hover{background-color:#eef2fd;border-color:#c6d1ff}.ce-calculator-button:active{background-color:#e1e8ff}.ce-calculator-button.operator{background-color:#f5f7fa}.ce-calculator-button.operator:hover{background-color:#eef2fd}.ce-calculator-button.equal{background-color:var(--COLOR-HOVER, #5175f4);color:#fff;border-color:var(--COLOR-HOVER, #5175f4)}.ce-calculator-button.equal:hover{background-color:var(--COLOR-HOVER, #6a84ff);border-color:var(--COLOR-HOVER, #6a84ff)}.ce-calculator-button.utility{background-color:#f0f2f5}.ce-calculator-button.utility:hover{background-color:#e6e8eb}.ce-date-container{display:none;width:300px;overflow:hidden;left:0;right:0;position:absolute;z-index:1;color:#606266;background:#fff;border-radius:4px;padding:10px;-webkit-user-select:none;user-select:none;border:1px solid #e4e7ed;box-shadow:0 2px 12px #0000001a}.ce-date-container.active{display:block}.ce-date-wrap{display:none}.ce-date-wrap.active{display:block}.ce-date-title{display:flex;justify-content:center;align-items:center;text-align:center;color:#606266;font-size:16px}.ce-date-title>span{display:inline-block}.ce-date-title>span:not(.ce-date-title__now){font-family:cursive;cursor:pointer}.ce-date-title>span:not(.ce-date-title__now):hover{color:#5175f4}.ce-date-title .ce-date-title__pre-year,.ce-date-title .ce-date-title__pre-month{width:15%}.ce-date-title .ce-date-title__now{width:40%}.ce-date-title .ce-date-title__next-year,.ce-date-title .ce-date-title__next-month{width:15%}.ce-date-week{width:100%;display:flex;justify-content:center;margin-top:15px;padding-bottom:5px;border-bottom:1px solid #e4e7ed}.ce-date-week>span{list-style:none;width:calc(100%/7);text-align:center;color:#606266;font-size:14px}.ce-date-day{width:100%;display:flex;flex-wrap:wrap;align-items:center;margin-top:5px}.ce-date-day>div{width:calc(100%/7);height:40px;text-align:center;color:#606266;font-size:14px;cursor:pointer;line-height:40px;border-radius:4px}.ce-date-day>div:hover{color:#5175f4;opacity:.8}.ce-date-day>div.active{color:#5175f4;font-weight:700}.ce-date-day>div.disable{color:#c0c4cc}.ce-date-day>div.select{color:#fff;background-color:#5175f4}.ce-time-wrap{display:none;padding:10px;height:286px}.ce-time-wrap ::-webkit-scrollbar{width:0}.ce-time-wrap.active{display:flex}.ce-time-wrap li{list-style:none}.ce-time-wrap>li{width:33.3%;height:100%;text-align:center}.ce-time-wrap>li>span{transform:translateY(-5px);display:inline-block}.ce-time-wrap>li>ol{height:calc(100% - 20px);overflow-y:auto;border:1px solid #e2e2e2;position:relative}.ce-time-wrap>li:first-child>ol{border-right:0}.ce-time-wrap>li:last-child>ol{border-left:0}.ce-time-wrap>li>ol>li{line-height:30px;cursor:pointer;transition:all .3s}.ce-time-wrap>li>ol>li:hover{background-color:#eaeaea}.ce-time-wrap>li>ol>li.active{color:#fff;background:#5175f4}.ce-date-menu{width:100%;height:28px;display:flex;justify-content:flex-end;align-items:center;padding-top:10px;position:relative;border-top:1px solid #e4e7ed}.ce-date-menu button{display:inline-block;line-height:1;white-space:nowrap;cursor:pointer;background:#fff;border:1px solid #dcdfe6;color:#606266;appearance:none;text-align:center;box-sizing:border-box;outline:none;transition:.1s;font-weight:500;-webkit-user-select:none;user-select:none;padding:7px 15px;font-size:12px;border-radius:3px;margin:0 0 0 10px}.ce-date-menu button:hover{color:#5175f4;border-color:#5175f4}.ce-date-menu button.ce-date-menu__time{border:1px solid transparent;position:absolute;left:0;margin-left:0}.ce-date-menu button.ce-date-menu__time:hover{color:#5175f4}.ce-block-item{position:absolute;z-index:0;background-color:#fff;border:1px solid rgb(235 236 240)}.ce-block-item .ce-resizer-selection{width:100%;height:100%}.ce-block-item .ce-resizer-mask{position:absolute;inset:0;z-index:1;background-color:transparent}.ce-table-tool__row{position:absolute;width:12px;border-radius:6.5px;overflow:hidden;background-color:#e2e6ed}.ce-table-tool__row .ce-table-tool__row__item{width:100%;position:relative;cursor:pointer;transition:all .3s}.ce-table-tool__row .ce-table-tool__row__item:after{content:"";position:absolute;bottom:0;left:2px;width:8px;height:1px;background-color:#c0c6cf}.ce-table-tool__row .ce-table-tool__row__item:hover{background-color:#dadce0}.ce-table-tool__row .ce-table-tool__row__item:last-child:after{display:none}.ce-table-tool__quick__add{width:16px;height:16px;position:absolute;border-radius:50%;background-color:#e2e6ed;cursor:pointer}.ce-table-tool__quick__add:after{content:"+";color:#fff;position:absolute;top:50%;left:50%;transform:translate(-50%,-55%)}.ce-table-tool__select{width:16px;height:18px;position:absolute;border-radius:3px;cursor:pointer}.ce-table-tool__select:hover{background-color:#e2e6ed}.ce-table-tool__select:after{content:":::";color:#aaaaab;position:absolute;top:50%;left:50%;transform:translate(-75%,-50%) rotate(-90deg)}.ce-table-tool__col{position:absolute;height:12px;border-radius:6.5px;overflow:hidden;background-color:#e2e6ed;display:flex}.ce-table-tool__col .ce-table-tool__col__item{height:100%;position:relative;cursor:pointer;transition:all .3s}.ce-table-tool__col .ce-table-tool__col__item:after{content:"";position:absolute;top:2px;left:-1px;width:1px;height:8px;z-index:1;background-color:#c0c6cf}.ce-table-tool__col .ce-table-tool__col__item:hover{background-color:#dadce0}.ce-table-tool__col .ce-table-tool__col__item:first-child:after{display:none}.ce-table-tool__row .ce-table-tool__row__item.active,.ce-table-tool__col .ce-table-tool__col__item.active{background-color:#c4d7fa}.ce-table-tool__col .ce-table-tool__anchor{right:-5px;width:10px;height:12px;z-index:9;position:absolute;cursor:col-resize}.ce-table-tool__row .ce-table-tool__anchor{bottom:-5px;left:0;width:12px;height:10px;z-index:9;position:absolute;cursor:row-resize}.ce-table-anchor__line{z-index:9;position:absolute;border:1px dotted #000000}.ce-table-tool__border{position:absolute;z-index:1;background:transparent;pointer-events:none}.ce-table-tool__border__row{position:absolute;cursor:row-resize;pointer-events:auto}.ce-table-tool__border__col{position:absolute;cursor:col-resize;pointer-events:auto}.ce-resizer-selection{position:absolute;border:1px solid;pointer-events:none}.ce-resizer-selection .resizer-handle{position:absolute;z-index:9;width:10px;height:10px;box-shadow:0 1px 4px #0000004d;border-radius:5px;border:2px solid #ffffff;box-sizing:border-box;pointer-events:initial}.ce-resizer-selection .handle-0{cursor:nw-resize}.ce-resizer-selection .handle-1{cursor:n-resize}.ce-resizer-selection .handle-2{cursor:ne-resize}.ce-resizer-selection .handle-3{cursor:e-resize}.ce-resizer-selection .handle-4{cursor:se-resize}.ce-resizer-selection .handle-5{cursor:s-resize}.ce-resizer-selection .handle-6{cursor:sw-resize}.ce-resizer-selection .handle-7{cursor:w-resize}.ce-resizer-size-view{display:flex;align-items:center;height:20px;white-space:nowrap;position:absolute;z-index:9;top:-30px;left:0;opacity:.9;background-color:#000;padding:0 5px;border-radius:4px}.ce-resizer-size-view span{color:#fff;font-size:12px}.ce-resizer-image{position:absolute;opacity:.5}.ce-image-previewer{position:fixed;left:0;top:0;z-index:1000;width:100%;height:100%;overflow:hidden;background:#f2f4f7;display:flex;align-items:center;justify-content:center;animation:previewerAnimation .3s}@keyframes previewerAnimation{0%{opacity:.1}to{opacity:1}}.ce-image-previewer .image-close{width:24px;height:24px;display:inline-block;position:absolute;right:50px;top:30px;z-index:99;cursor:pointer;background:url("data:image/svg+xml,%3csvg%20width='32'%20height='32'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M23.97%207l1.415%201.414-7.779%207.778%207.779%207.779-1.414%201.414-7.779-7.779-7.778%207.779L7%2023.97l7.778-7.779L7%208.414%208.414%207l7.778%207.778L23.971%207z'%20fill='%233D4757'%20fill-rule='evenodd'/%3e%3c/svg%3e") no-repeat;background-size:100% 100%;transition:all .3s;border-radius:50%}.ce-image-previewer .image-close:hover{background-color:#e2e6ed}.ce-image-previewer .ce-image-container{position:relative}.ce-image-previewer .ce-image-container img{cursor:move;position:relative}.ce-image-previewer .ce-image-menu{height:50px;position:absolute;bottom:50px;z-index:99;display:flex;align-items:center;justify-content:center}.ce-image-previewer .ce-image-menu i{width:32px;height:32px;margin:0 8px;cursor:pointer;display:inline-block;background-repeat:no-repeat;background-size:100% 100%;transition:all .3s;border-radius:50%}.ce-image-previewer .ce-image-menu i:hover{background-color:#e2e6ed}.ce-image-previewer .ce-image-menu i.zoom-in{background-image:url("data:image/svg+xml,%3csvg%20width='32'%20height='32'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M14%2014v-4h2v4h4v2h-4v4h-2v-4h-4v-2h4zm8.749%2010.163A11.952%2011.952%200%200115%2027C8.373%2027%203%2021.627%203%2015S8.373%203%2015%203s12%205.373%2012%2012c0%202.954-1.067%205.658-2.837%207.749l4.908%204.908-1.414%201.414-4.908-4.908zM15%2025c5.523%200%2010-4.477%2010-10S20.523%205%2015%205%205%209.477%205%2015s4.477%2010%2010%2010z'%20fill='%233D4757'/%3e%3c/svg%3e")}.ce-image-previewer .ce-image-menu i.zoom-out{background-image:url("data:image/svg+xml,%3csvg%20width='32'%20height='32'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M22.749%2024.163A11.952%2011.952%200%200115%2027C8.373%2027%203%2021.627%203%2015S8.373%203%2015%203s12%205.373%2012%2012c0%202.954-1.067%205.658-2.837%207.749l4.908%204.908-1.414%201.414-4.908-4.908zM15%2025c5.523%200%2010-4.477%2010-10S20.523%205%2015%205%205%209.477%205%2015s4.477%2010%2010%2010zm-5-11h10v2H10v-2z'%20fill='%233D4757'/%3e%3c/svg%3e")}.ce-image-previewer .ce-image-menu i.rotate{background-image:url("data:image/svg+xml,%3csvg%20width='32'%20height='32'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='%233D4757'%20fill-rule='evenodd'%3e%3cpath%20d='M16%204c6.627%200%2012%205.373%2012%2012a11.97%2011.97%200%2001-4%208.944V23h-.86A9.968%209.968%200%200026%2016c0-5.523-4.477-10-10-10S6%2010.477%206%2016c0%205.185%203.947%209.449%209%209.95v2.009C8.84%2027.451%204%2022.291%204%2016%204%209.373%209.373%204%2016%204z'%20fill-rule='nonzero'/%3e%3cpath%20d='M19.879%2027.328l1.767-6.717%204.95%204.95z'/%3e%3c/g%3e%3c/svg%3e")}.ce-image-previewer .ce-image-menu i.original-size{background-image:url("data:image/svg+xml,%3csvg%20width='32'%20height='32'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M4%204h24v24H4V4zm2%202v20h20V6H6zm4%205h2v10h-2V11zm5%202h2v2h-2v-2zm0%204h2v2h-2v-2zm5-6h2v10h-2V11z'%20fill='%233D4757'/%3e%3c/svg%3e")}.ce-image-previewer .ce-image-menu i.image-download{background-image:url("data:image/svg+xml,%3csvg%20width='24'%20height='24'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M4.5%2015v3.5h15V15H21v5H3v-5h1.5zm8.232-11.226v9.196l4.05-4.05%201.06%201.06-5.834%205.834-5.833-5.833%201.06-1.06%203.998%203.996V3.774h1.5z'%20fill='%233D4757'/%3e%3c/svg%3e")}.ce-image-previewer .ce-image-menu .image-navigate{display:flex;align-items:center;justify-content:center}.ce-image-previewer .ce-image-menu i.image-pre{background-image:url("data:image/svg+xml,%3csvg%20width='20'%20height='20'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M12.5%204.063L6.875%2010l5.625%205.938'%20stroke='%233D4757'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e")}.ce-image-previewer .ce-image-menu i.image-next{background-image:url("data:image/svg+xml,%3csvg%20width='20'%20height='20'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M7.5%204.063L13.125%2010%207.5%2015.938'%20stroke='%233D4757'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e")}.ce-image-previewer .ce-image-menu .image-count{color:#000;font-size:20px}.ce-image-previewer .ce-image-menu i.disabled{cursor:not-allowed;opacity:.5}.ce-contextmenu-container{z-index:9;position:fixed;display:none;padding:4px;overflow-x:hidden;overflow-y:auto;background:#fff;box-shadow:0 2px 12px #38383833;border:1px solid #e2e6ed;border-radius:2px}.ce-contextmenu-content{display:flex;flex-direction:column}.ce-contextmenu-content .ce-contextmenu-sub-item:after{position:absolute;content:"";width:16px;height:16px;right:12px;background:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cpath%20d='M0%200h16v16H0z'/%3e%3cg%20fill='%23767C85'%3e%3cpath%20d='M7%2012.243l-.707-.707%204.243-4.243.707.707z'/%3e%3cpath%20d='M6.293%204.464L7%203.757%2011.243%208l-.707.707z'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e")}.ce-contextmenu-content .ce-contextmenu-item{min-width:140px;padding:0 32px 0 16px;height:30px;display:flex;align-items:center;white-space:nowrap;box-sizing:border-box;cursor:pointer}.ce-contextmenu-content .ce-contextmenu-item.hover{background:#1937580a}.ce-contextmenu-content .ce-contextmenu-item span{max-width:300px;font-size:12px;color:#3d4757;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.ce-contextmenu-content .ce-contextmenu-item span.ce-shortcut{color:#767c85;height:30px;flex:1;text-align:right;line-height:30px;margin-left:20px}.ce-contextmenu-content .ce-contextmenu-item i{width:16px;height:16px;vertical-align:middle;display:inline-block;background-repeat:no-repeat;background-size:100% 100%;flex-shrink:0;margin-right:8px}.ce-contextmenu-divider{background-color:#e2e6ed;margin:4px 16px;height:1px}.ce-contextmenu-print{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='%233D4757'%20fill-rule='evenodd'%3e%3cpath%20d='M12%204h-1V2H5v2H4V2a1%201%200%20011-1h6a1%201%200%20011%201v2zm0%205v4a1%201%200%2001-1%201H5a1%201%200%2001-1-1V9h1v4h6V9h1z'/%3e%3cpath%20d='M12%2012v-1h2V5H2v6h2v1H2a1%201%200%2001-1-1V5a1%201%200%20011-1h12a1%201%200%20011%201v6a1%201%200%2001-1%201h-2z'/%3e%3cpath%20d='M3%208h10v1H3zm8-2h2v1h-2z'/%3e%3c/g%3e%3c/svg%3e")}.ce-contextmenu-image{background-image:url("data:image/svg+xml,%3csvg%20version='1.1'%20id='图层_1'%20xmlns='http://www.w3.org/2000/svg'%20x='0'%20y='0'%20viewBox='0%200%2016%2016'%20xml:space='preserve'%3e%3cstyle%3e.st0{fill:%233d4757}%3c/style%3e%3cg%20id='_x30_0-公共_x2F_02工具栏_x2F_插入图片-16px-'%3e%3cg%20id='Group-19'%20transform='translate(1%201)'%3e%3cpath%20id='Combined-Shape'%20class='st0'%20d='M1%200h12c.6%200%201%20.4%201%201v11c0%20.6-.4%201-1%201H1c-.6%200-1-.4-1-1V1c0-.6.4-1%201-1zm0%201v11h12V1H1z'/%3e%3ccircle%20id='椭圆形'%20class='st0'%20cx='10'%20cy='4'%20r='1'/%3e%3cpath%20id='Path'%20class='st0'%20d='M8.5%2011.2l-4-4.1L1%2010.7V9.2c1.7-1.6%202.7-2.5%203-2.8.4-.5.7-.4%201%200L8.5%2010%2011%207.3c.4-.5.6-.5%201-.1l2%202.8v1.5l-2.5-3.4-3%203.1z'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e")}.ce-contextmenu-image-change{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20transform='translate(2%204)'%20fill='%233D4757'%3e%3ccircle%20fill-rule='nonzero'%20cx='3'%20cy='1'%20r='1'/%3e%3cpath%20d='M7.473%208.223L3.47%204.107%200%207.667v-1.5C1.715%204.6%202.707%203.664%202.975%203.358c.402-.457.651-.39%201.042%200L7.473%207%209.96%204.349c.414-.462.62-.462%201.011-.071L13%207.06v1.5l-2.51-3.41-3.017%203.072z'/%3e%3c/g%3e%3cpath%20d='M6%201.5H1.5v12h13v-4V13a.5.5%200%2001-.5.5H2a.5.5%200%2001-.5-.5V2a.5.5%200%2001.5-.5h4zm8.5%208V6l-.5.5h1l-.5-.5v3.5zM6%201.5h4L9.5%201v1l.5-.5H6z'%20stroke='%233D4757'/%3e%3cpath%20d='M13.085%201.316l-3.814%204a1%201%200%20001.458%201.368l3.815-4a1%201%200%2010-1.459-1.368z'%20fill='%233D4757'%20fill-rule='nonzero'/%3e%3c/g%3e%3c/svg%3e")}.ce-contextmenu-insert-row-col{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cpath%20stroke='%233D4757'%20d='M8.5%205.5h6v4h-6z'/%3e%3cpath%20fill='%233D4757'%20d='M4%207v1h2V7zm-3%20.5L4%205v5zM1%201h12v1H1zm0%2012h12v1H1z'/%3e%3c/g%3e%3c/svg%3e")}.ce-contextmenu-insert-top-row{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cpath%20fill='%233D4757'%20d='M8%205H7v3h1zm-.5-3L10%205H5z'/%3e%3crect%20stroke='%233D4757'%20x='1.5'%20y='10.5'%20width='12'%20height='3'%20rx='1'/%3e%3c/g%3e%3c/svg%3e")}.ce-contextmenu-insert-bottom-row{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cpath%20fill='%233D4757'%20d='M7%2011h1V8H7zm.5%203L5%2011h5z'/%3e%3crect%20stroke='%233D4757'%20x='1.5'%20y='2.5'%20width='12'%20height='3'%20rx='1'/%3e%3c/g%3e%3c/svg%3e")}.ce-contextmenu-insert-left-col{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cpath%20fill='%233D4757'%20d='M11%207v1h3V7zm-3%20.5L11%205v5z'/%3e%3crect%20stroke='%233D4757'%20transform='rotate(90%204%207.5)'%20x='-2'%20y='6'%20width='12'%20height='3'%20rx='1'/%3e%3c/g%3e%3c/svg%3e")}.ce-contextmenu-insert-right-col{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cpath%20fill='%233D4757'%20d='M5%208V7H2v1zm3-.5L5%2010V5z'/%3e%3crect%20stroke='%233D4757'%20transform='rotate(90%2012%207.5)'%20x='6'%20y='6'%20width='12'%20height='3'%20rx='1'/%3e%3c/g%3e%3c/svg%3e")}.ce-contextmenu-delete-row-col{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cpath%20stroke='%23929AA8'%20d='M8.5%206.5h6v2h-6z'/%3e%3cpath%20fill='%233D4757'%20d='M2%2012h11v1H2zM2%202h11v1H2zm.63%203L7%209.35l-.635.65L2%205.63z'/%3e%3cpath%20fill='%233D4757'%20d='M2%209.363L6.355%205%207%205.707%202.695%2010z'/%3e%3c/g%3e%3c/svg%3e")}.ce-contextmenu-delete-row{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cpath%20stroke='%23929AA8'%20d='M8.5%205.5h6v4h-6z'/%3e%3cpath%20fill='%233D4757'%20d='M1%2013h12v1H1zM1%201h12v1H1zm0%204h1v1H1zm1%201h1v1H2zm1%201h1v1H3zm1-1h1v1H4zm1-1h1v1H5zM4%208h1v1H4zM2%208h1v1H2zm3%201h1v1H5zM1%209h1v1H1z'/%3e%3c/g%3e%3c/svg%3e")}.ce-contextmenu-delete-col{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cpath%20stroke='%23929AA8'%20d='M5.5%207.5v-6h4v6z'/%3e%3cpath%20fill='%233D4757'%20d='M13%2015V3h1v12zM1%2015V3h1v12zm4%200v-1h1v1zm1-1v-1h1v1zm1-1v-1h1v1zm-1-1v-1h1v1zm-1-1v-1h1v1zm3%201v-1h1v1zm0%202v-1h1v1zm1-3v-1h1v1zm0%204v-1h1v1z'/%3e%3c/g%3e%3c/svg%3e")}.ce-contextmenu-delete-table{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='%233D4757'%20fill-rule='evenodd'%3e%3cpath%20d='M14%2013h-1v-3H2v3H1v-3a1%201%200%20011-1h11a1%201%200%20011%201v3z'%20fill-rule='nonzero'/%3e%3cpath%20d='M5.625%202L10%206.375%209.375%207%205%202.625z'/%3e%3cpath%20d='M5%206.375L9.375%202l.625.625L5.625%207z'/%3e%3c/g%3e%3c/svg%3e")}.ce-contextmenu-merge-cell{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='%233D4757'%20fill-rule='evenodd'%3e%3cpath%20d='M6%201v1H2v11h4v1H2a1%201%200%2001-1-1V2a1%201%200%20011-1h4zm3%200h4a1%201%200%20011%201v11a1%201%200%2001-1%201H9v-1h4V2H9V1z'/%3e%3cpath%20fill-rule='nonzero'%20d='M6%201h1v4H6zm2%200h1v4H8z'/%3e%3cpath%20d='M8%207.5L10%206v3zm-1%200L5%206v3z'/%3e%3cpath%20d='M9%207h3v1H9zM3%207h3v1H3z'/%3e%3cpath%20fill-rule='nonzero'%20d='M8%2010h1v4H8zm-2%200h1v4H6z'/%3e%3c/g%3e%3c/svg%3e")}.ce-contextmenu-merge-cancel-cell{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='%233D4757'%20fill-rule='evenodd'%3e%3cpath%20d='M6%201v1H2v11h4v1H2a1%201%200%2001-1-1V2a1%201%200%20011-1h4zm3%200h4a1%201%200%20011%201v11a1%201%200%2001-1%201H9v-1h4V2H9V1z'/%3e%3cpath%20fill-rule='nonzero'%20d='M6%201h1v4H6zm2%200h1v4H8z'/%3e%3cpath%20d='M3%207.5L5%206v3zm9%200L10%206v3z'/%3e%3cpath%20d='M4%207h3v1H4zm4%200h3v1H8z'/%3e%3cpath%20fill-rule='nonzero'%20d='M8%2010h1v4H8zm-2%200h1v4H6z'/%3e%3c/g%3e%3c/svg%3e")}.ce-contextmenu-vertical-align{background-image:url("data:image/svg+xml,%3csvg%20height='16'%20viewBox='0%200%2016%2016'%20width='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2%2013h12v1H2zm0-3h8v1H2zm0-3h12v1H2zm0-6h12v1H2zm0%203h8v1H2z'%20fill='%233d4757'%20fill-rule='evenodd'/%3e%3c/svg%3e")}.ce-contextmenu-vertical-align-top{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M8%208H7v6h1zm-.5-3L10%208H5zM2%203h11v1H2z'%20fill='%233D4757'%20fill-rule='evenodd'/%3e%3c/svg%3e")}.ce-contextmenu-vertical-align-middle{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M8%2012H7v3h1zm-.5-3l2.5%203H5zM7%203h1V0H7zm.5%203L5%203h5zM2%207h11v1H2z'%20fill='%233D4757'%20fill-rule='evenodd'/%3e%3c/svg%3e")}.ce-contextmenu-vertical-align-bottom{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M7%209h1V3H7zm.5%203L5%209h5zM2%2013h11v1H2z'%20fill='%233D4757'%20fill-rule='evenodd'/%3e%3c/svg%3e")}.ce-contextmenu-border-all{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2.5%203a.5.5%200%2001.5-.5h11a.5.5%200%2001.5.5v11a.5.5%200%2001-.5.5H3a.5.5%200%2001-.5-.5V3z'%20stroke='%233D4757'/%3e%3cpath%20fill='%233D4757'%20d='M3%208h11v1H3z'/%3e%3cpath%20fill='%233D4757'%20d='M9%203v11H8V3z'/%3e%3c/svg%3e")}.ce-contextmenu-border-empty{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M13%203h-1V2h1a1%201%200%20011%201v1h-1V3zm-3-1v1H8.5v2h-1V3H6V2h4zM4%202v1H3v1H2V3a1%201%200%20011-1h1zM2%206h1v1.5h2v1H3V10H2V6zm0%206h1v1h1v1H3a1%201%200%2001-1-1v-1zm4%202v-1h1.5v-2h1v2H10v1H6zm6%200v-1h1v-1h1v1a1%201%200%2001-1%201h-1zm2-4h-1V8.5h-2v-1h2V6h1v4zM8.5%207.5v-1h-1v1h-1v1h1v1h1v-1h1v-1h-1z'%20fill='%23AAACB0'/%3e%3c/svg%3e")}.ce-contextmenu-border-dash{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M13%203h-1V2h1a1%201%200%20011%201v1h-1V3zm-3-1v1H8.5v2h-1V3H6V2h4zM4%202v1H3v1H2V3a1%201%200%20011-1h1zM2%206h1v1.5h2v1H3V10H2V6zm0%206h1v1h1v1H3a1%201%200%2001-1-1v-1zm4%202v-1h1.5v-2h1v2H10v1H6zm6%200v-1h1v-1h1v1a1%201%200%2001-1%201h-1zm2-4h-1V8.5h-2v-1h2V6h1v4zM8.5%207.5v-1h-1v1h-1v1h1v1h1v-1h1v-1h-1z'%20fill='%23000000'/%3e%3c/svg%3e")}.ce-contextmenu-border-external{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2.5%203a.5.5%200%2001.5-.5h11a.5.5%200%2001.5.5v11a.5.5%200%2001-.5.5H3a.5.5%200%2001-.5-.5V3z'%20stroke='%233D4757'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M9%205V3H8v2h1zm0%209v-2H8v2h1zM5%208H3v1h2V8zm9%200h-2v1h2V8zM9%207v1h1v1H9v1H8V9H7V8h1V7h1z'%20fill='%23AAACB0'/%3e%3c/svg%3e")}.ce-contextmenu-border-internal{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2.5%203a.5.5%200%2001.5-.5h11a.5.5%200%2001.5.5v11a.5.5%200%2001-.5.5H3a.5.5%200%2001-.5-.5V3z'%20stroke='%23AAACB0'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M9%205V3H8v2h1zm0%209v-2H8v2h1zM5%208H3v1h2V8zm9%200h-2v1h2V8zM9%207v1h1v1H9v1H8V9H7V8h1V7h1z'%20fill='%233D4757'/%3e%3c/svg%3e")}.ce-contextmenu-border-td{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2.5%203a.5.5%200%2001.5-.5h11a.5.5%200%2001.5.5v11a.5.5%200%2001-.5.5H3a.5.5%200%2001-.5-.5V3z'%20stroke='%23AAACB0'/%3e%3cpath%20stroke='%233D4757'%20d='M8.5%202.5%20v6%20h-6'/%3e%3c/svg%3e")}.ce-contextmenu-border-td-top{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2.5%203a.5.5%200%2001.5-.5h11a.5.5%200%2001.5.5v11a.5.5%200%2001-.5.5H3a.5.5%200%2001-.5-.5V3z'%20stroke='%23AAACB0'/%3e%3cpath%20stroke='%233D4757'%20stroke-width='2'%20d='M2.5%203%20h12'/%3e%3c/svg%3e")}.ce-contextmenu-border-td-left{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2.5%203a.5.5%200%2001.5-.5h11a.5.5%200%2001.5.5v11a.5.5%200%2001-.5.5H3a.5.5%200%2001-.5-.5V3z'%20stroke='%23AAACB0'/%3e%3cpath%20stroke='%233D4757'%20stroke-width='2'%20d='M3%203%20v11'/%3e%3c/svg%3e")}.ce-contextmenu-border-td-bottom{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2.5%203a.5.5%200%2001.5-.5h11a.5.5%200%2001.5.5v11a.5.5%200%2001-.5.5H3a.5.5%200%2001-.5-.5V3z'%20stroke='%23AAACB0'/%3e%3cpath%20stroke='%233D4757'%20stroke-width='2'%20d='M2.5%2014%20h12'/%3e%3c/svg%3e")}.ce-contextmenu-border-td-right{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2.5%203a.5.5%200%2001.5-.5h11a.5.5%200%2001.5.5v11a.5.5%200%2001-.5.5H3a.5.5%200%2001-.5-.5V3z'%20stroke='%23AAACB0'/%3e%3cpath%20stroke='%233D4757'%20stroke-width='2'%20d='M14%203%20v11'/%3e%3c/svg%3e")}.ce-contextmenu-border-td-forward{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2.5%203a.5.5%200%2001.5-.5h11a.5.5%200%2001.5.5v11a.5.5%200%2001-.5.5H3a.5.5%200%2001-.5-.5V3z'%20stroke='%23AAACB0'%20/%3e%3cpath%20stroke='%233D4757'%20d='M14%203%20l-11%2011'%20/%3e%3c/svg%3e")}.ce-contextmenu-border-td-back{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2.5%203a.5.5%200%2001.5-.5h11a.5.5%200%2001.5.5v11a.5.5%200%2001-.5.5H3a.5.5%200%2001-.5-.5V3z'%20stroke='%23AAACB0'%20/%3e%3cpath%20stroke='%233D4757'%20d='M3%203%20l11%2011'%20/%3e%3c/svg%3e")}.ce-hyperlink-popup{background:#fff;box-shadow:0 2px 12px #626b8433;border-radius:2px;color:#3d4757;padding:12px 16px;position:absolute;z-index:1;text-align:center;display:none}.ce-hyperlink-popup a{min-width:100px;max-width:300px;font-size:12px;display:inline-block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer;text-decoration:none;border-bottom-width:1px;border-bottom-style:solid;color:#00f}.ce-zone-indicator>div{padding:3px 6px;color:#000;font-size:12px;background:#dae7fc;position:absolute;transform-origin:0 0}.ce-zone-indicator-border__top,.ce-zone-indicator-border__bottom,.ce-zone-indicator-border__left,.ce-zone-indicator-border__right{display:block;position:absolute;z-index:0}.ce-zone-indicator-border__top{border-top:2px dashed rgb(238,238,238)}.ce-zone-indicator-border__bottom{border-top:2px dashed rgb(238,238,238);width:100%}.ce-zone-indicator-border__left{border-left:2px dashed rgb(238,238,238)}.ce-zone-indicator-border__right{border-right:2px dashed rgb(238,238,238)}.ce-zone-tip{display:none;align-items:center;height:30px;white-space:nowrap;position:fixed;opacity:.9;background-color:#000;padding:0 5px;border-radius:4px;z-index:9;transition:all .3s;outline:none;-webkit-user-select:none;user-select:none;pointer-events:none;transform:translate(10px,10px)}.ce-zone-tip.show{display:flex}.ce-zone-tip span{color:#fff;font-size:12px}.ce-inputarea{min-width:60px!important;min-height:0;margin:0;padding:0;left:0;top:0;letter-spacing:0;font-size:12px;position:absolute;z-index:-1;outline:none;resize:none;border:none;overflow:hidden;color:transparent;-webkit-user-select:none;user-select:none;caret-color:transparent;background-color:transparent;white-space:pre}.ce-cursor{width:1px;height:20px;left:0;right:0;position:absolute;outline:none;background-color:#000;pointer-events:none}.ce-cursor.ce-cursor--animation{animation-duration:1s;animation-iteration-count:infinite;animation-name:cursorAnimation}@keyframes cursorAnimation{0%{opacity:1}13%{opacity:0}50%{opacity:0}63%{opacity:1}to{opacity:1}}.ce-float-image{position:absolute;opacity:.5;pointer-events:none}.ce-button-input-modal{position:fixed;top:0;left:0;width:100%;height:100%;background:transparent;display:flex;justify-content:center;align-items:center;z-index:2000}.ce-button-input-modal__content{background:#fff;border-radius:8px;padding:20px;min-width:320px;max-width:480px;box-shadow:0 4px 20px #00000026}.ce-button-input-modal__title{font-size:14px;font-weight:500;color:#333;margin-bottom:12px}.ce-button-input-modal__textarea{width:100%;min-height:100px;padding:10px 12px;border:1px solid #dcdfe6;border-radius:4px;font-size:13px;line-height:1.5;resize:vertical;outline:none;box-sizing:border-box;font-family:inherit}.ce-button-input-modal__textarea:focus{border-color:#5175f4}.ce-button-input-modal__textarea::placeholder{color:#c0c4cc}.ce-button-input-modal__buttons{display:flex;justify-content:flex-end;gap:10px;margin-top:16px}.ce-button-input-modal__cancel,.ce-button-input-modal__confirm{padding:8px 16px;font-size:13px;border-radius:4px;cursor:pointer;border:1px solid #dcdfe6;background:#fff;color:#606266;transition:all .2s}.ce-button-input-modal__cancel:hover{color:#5175f4;border-color:#5175f4}.ce-button-input-modal__confirm{background:#5175f4;border-color:#5175f4;color:#fff}.ce-button-input-modal__confirm:hover{background:#409eff;border-color:#409eff}.ce-button-edit-modal{position:fixed;top:0;left:0;width:100%;height:100%;background:transparent;display:flex;justify-content:center;align-items:center;z-index:1000}.ce-button-edit-modal__content{background:#fff;border-radius:8px;padding:20px;min-width:320px;max-width:480px;box-shadow:0 4px 20px #00000026}.ce-button-edit-modal__title{font-size:14px;font-weight:500;color:#333;margin-bottom:16px}.ce-button-edit-modal__form{display:flex;flex-direction:column;gap:12px}.ce-button-edit-modal__field{display:flex;align-items:center;gap:8px}.ce-button-edit-modal__field label{min-width:80px;font-size:13px;color:#606266}.ce-button-edit-modal__field input{flex:1;padding:8px 12px;border:1px solid #dcdfe6;border-radius:4px;font-size:13px;outline:none;box-sizing:border-box}.ce-button-edit-modal__field input:focus{border-color:#5175f4}.ce-button-edit-modal__field input::placeholder{color:#c0c4cc}.ce-button-edit-modal__buttons{display:flex;justify-content:flex-end;gap:10px;margin-top:16px}.ce-button-edit-modal__cancel,.ce-button-edit-modal__confirm{padding:8px 16px;font-size:13px;border-radius:4px;cursor:pointer;border:1px solid #dcdfe6;background:#fff;color:#606266;transition:all .2s}.ce-button-edit-modal__cancel:hover{color:#5175f4;border-color:#5175f4}.ce-button-edit-modal__confirm{background:#5175f4;border-color:#5175f4;color:#fff}.ce-button-edit-modal__confirm:hover{background:#409eff;border-color:#409eff}.ce-number-input-modal{position:fixed;top:0;left:0;width:100%;height:100%;background:transparent;display:flex;justify-content:center;align-items:center;z-index:2000}.ce-number-input-modal__content{background:#fff;border-radius:8px;padding:20px;min-width:300px;max-width:400px;box-shadow:0 4px 20px #00000026}.ce-number-input-modal__title{font-size:14px;font-weight:500;color:#333;margin-bottom:12px}.ce-number-input-modal__hint{font-size:12px;color:#909399;margin-bottom:12px}.ce-number-input-modal__input{width:100%;padding:10px 12px;border:1px solid #dcdfe6;border-radius:4px;font-size:13px;outline:none;box-sizing:border-box}.ce-number-input-modal__input:focus{border-color:#5175f4}.ce-number-input-modal__input::placeholder{color:#c0c4cc}.ce-number-input-modal__error{font-size:12px;color:#f56c6c;margin-top:8px}.ce-number-input-modal__buttons{display:flex;justify-content:flex-end;gap:10px;margin-top:16px}.ce-number-input-modal__cancel,.ce-number-input-modal__confirm{padding:8px 16px;font-size:13px;border-radius:4px;cursor:pointer;border:1px solid #dcdfe6;background:#fff;color:#606266;transition:all .2s}.ce-number-input-modal__cancel:hover{color:#5175f4;border-color:#5175f4}.ce-number-input-modal__confirm{background:#5175f4;border-color:#5175f4;color:#fff}.ce-number-input-modal__confirm:hover{background:#409eff;border-color:#409eff}.tooth-position-edit-modal,.tooth-position-create-modal{position:fixed;top:0;left:0;width:100%;height:100%;z-index:1000}.tooth-position-modal__container{position:relative;top:auto;left:auto;transform:none;background:#fff;border-radius:8px;box-shadow:0 4px 12px #00000026;min-width:400px;max-width:90vw;max-height:calc(100vh - 48px);display:flex;flex-direction:column;pointer-events:auto}.tooth-position-modal__header{display:flex;justify-content:space-between;align-items:center;padding:16px 20px;border-bottom:1px solid #e8e8e8}.tooth-position-modal__header span{font-size:16px;font-weight:500;color:#333}.tooth-position-modal__close{font-size:20px;cursor:pointer;color:#999;line-height:1}.tooth-position-modal__close:hover{color:#333}.tooth-position-modal__content{padding:20px;max-height:60vh;overflow-y:auto}.tooth-section{margin-bottom:20px}.tooth-section:last-child{margin-bottom:0}.tooth-section-title{font-size:14px;font-weight:500;color:#333;margin-bottom:12px;padding-left:8px;border-left:3px solid #1890ff}.tooth-row{display:flex;align-items:center;margin-bottom:8px}.tooth-row:last-child{margin-bottom:0}.tooth-row-label{width:30px;font-size:13px;color:#666}.tooth-buttons{display:flex;gap:8px;flex-wrap:wrap}.letter-buttons{margin-left:30px}.tooth-checkbox{display:flex;align-items:center;cursor:pointer}.tooth-checkbox input{display:none}.tooth-checkbox span{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border:1px solid #d9d9d9;border-radius:4px;background:#f5f5f5;font-size:14px;color:#333;transition:all .2s}.tooth-checkbox input:checked+span{background:#1890ff;border-color:#1890ff;color:#fff}.tooth-checkbox:hover span{border-color:#1890ff}.tooth-position-modal__footer{display:flex;justify-content:flex-end;gap:10px;padding:16px 20px;border-top:1px solid #e8e8e8}.tooth-position-modal__footer .btn-cancel,.tooth-position-modal__footer .btn-confirm{padding:8px 20px;font-size:14px;border-radius:4px;cursor:pointer;border:1px solid #dcdfe6;background:#fff;color:#606266;transition:all .2s}.tooth-position-modal__footer .btn-cancel:hover{color:#1890ff;border-color:#1890ff}.tooth-position-modal__footer .btn-confirm{background:#1890ff;border-color:#1890ff;color:#fff}.tooth-position-modal__footer .btn-confirm:hover{background:#40a9ff;border-color:#40a9ff}.tooth-grid-container{display:flex;flex-direction:column;align-items:center;padding:15px 20px;background:#fafafa;border-radius:8px;margin-bottom:15px;position:relative}.tooth-quick-buttons{display:flex;gap:6px;margin-bottom:16px}.tooth-quick-buttons-left{display:flex;flex-direction:column;gap:6px;flex:1}.tooth-quick-buttons-row{display:flex;gap:6px}.tooth-quick-btn{padding:6px 12px;font-size:12px;border:1px solid #d9d9d9;border-radius:4px;cursor:pointer;background:#fff;color:#333;transition:all .2s;white-space:nowrap}.tooth-quick-btn:hover{border-color:#1890ff;color:#1890ff}.tooth-quick-btn.selected{background:#0ff;border-color:#0ff;color:#fff}.tooth-quick-btn--clear{background:#ff6b6b;border-color:#ff6b6b;color:#fff}.tooth-quick-btn--clear:hover{background:#ff5252;border-color:#ff5252;color:#fff}.tooth-grid-container:before{content:"";position:absolute;left:50%;top:20px;bottom:20px;width:2px;background:#000;transform:translate(-50%);z-index:1}.tooth-grid-container:after{content:"";position:absolute;left:20px;right:20px;top:50%;height:2px;background:#000;transform:translateY(-50%);z-index:1}.tooth-grid-letter-row,.tooth-grid-number-row{display:flex;align-items:center;justify-content:center;position:relative;z-index:2}.tooth-grid-half{display:flex;align-items:center;justify-content:center;gap:4px}.tooth-grid-half.left{justify-content:flex-end;padding-right:15px}.tooth-grid-half.right{justify-content:flex-start;padding-left:15px}.tooth-grid-divider-v,.tooth-grid-divider-h{display:none}.tooth-grid-number-item{width:34px;height:32px;display:flex;align-items:center;justify-content:center;font-size:14px;font-weight:500;color:#333;cursor:pointer;background:#fff;transition:all .2s;box-sizing:border-box;border:1px solid #d9d9d9;border-radius:12px}.upper-number-row .tooth-grid-number-item{border-top:none;border-radius:0 0 12px 12px}.lower-number-row .tooth-grid-number-item{border-bottom:none;border-radius:12px 12px 0 0}.tooth-grid-number-item[data-value="1"],.tooth-grid-number-item[data-value="2"],.tooth-grid-number-item[data-value="3"]{border-radius:50px}.upper-number-row .tooth-grid-number-item[data-value="1"],.upper-number-row .tooth-grid-number-item[data-value="2"],.upper-number-row .tooth-grid-number-item[data-value="3"]{border-top:none!important;border-radius:0 0 50px 50px!important}.lower-number-row .tooth-grid-number-item[data-value="1"],.lower-number-row .tooth-grid-number-item[data-value="2"],.lower-number-row .tooth-grid-number-item[data-value="3"]{border-bottom:none!important;border-radius:50px 50px 0 0!important}.tooth-grid-number-item:hover{border-color:#1890ff;color:#1890ff}.tooth-grid-number-item.selected{background:#1890ff;border-color:#1890ff;color:#fff}.tooth-grid-letter-item{width:34px;height:32px;display:flex;align-items:center;justify-content:center;font-size:14px;font-weight:500;color:#333;cursor:pointer;background:#fff;border:1px solid #d9d9d9;transition:all .2s;box-sizing:border-box;border-radius:12px}.upper-letter-row .tooth-grid-letter-item{border-top:none;border-radius:0 0 12px 12px}.lower-letter-row .tooth-grid-letter-item{border-bottom:none;border-radius:12px 12px 0 0}.tooth-grid-letter-item[data-value=A],.tooth-grid-letter-item[data-value=B],.tooth-grid-letter-item[data-value=C]{border-radius:50px}.upper-letter-row .tooth-grid-letter-item[data-value=A],.upper-letter-row .tooth-grid-letter-item[data-value=B],.upper-letter-row .tooth-grid-letter-item[data-value=C]{border-top:none!important;border-radius:0 0 50px 50px!important}.lower-letter-row .tooth-grid-letter-item[data-value=A],.lower-letter-row .tooth-grid-letter-item[data-value=B],.lower-letter-row .tooth-grid-letter-item[data-value=C]{border-bottom:none!important;border-radius:50px 50px 0 0!important}.tooth-grid-letter-item:hover{border-color:#1890ff;color:#1890ff}.tooth-grid-letter-item.selected{background:#1890ff;border-color:#1890ff;color:#fff}.tooth-grid-letter-row.hidden,.tooth-grid-number-row.hidden{display:none}.tooth-grid-letter-row{margin-bottom:8px}.tooth-grid-number-row.upper-number-row{margin-bottom:15px}.tooth-grid-number-row.lower-number-row{margin-top:15px}.tooth-grid-letter-row.lower-letter-row{margin-top:8px}.tooth-preview-section{padding-top:10px;border-top:1px solid #e8e8e8}.tooth-preview-title{font-size:14px;font-weight:500;color:#333;margin-bottom:12px}.tooth-preview-wrapper{display:flex;gap:15px}.tooth-preview-container{display:flex;justify-content:center;align-items:center;padding:10px;background:#fafafa;border-radius:8px;flex:1;min-height:60px}.tooth-preview-grid{display:grid;grid-template-columns:1fr 1fr;grid-template-rows:1fr 1fr;gap:0;width:100%;min-height:70px;position:relative}.tooth-preview-grid:before{content:"";position:absolute;left:50%;top:0;bottom:0;width:1px;background:#000;transform:translate(-50%)}.tooth-preview-grid:after{content:"";position:absolute;top:50%;left:0;right:0;height:1px;background:#000;transform:translateY(-50%)}.tooth-preview-quadrant{display:flex;align-items:center;padding:5px 10px;font-size:12px;flex-wrap:wrap;gap:4px;justify-content:center}.tooth-preview-upper-left{justify-content:flex-end}.tooth-preview-upper-right{justify-content:flex-start}.tooth-preview-lower-left{justify-content:flex-end}.tooth-preview-lower-right{justify-content:flex-start}.tooth-preview-tooth{position:relative;display:inline;margin:0 4px}.tooth-preview-tooth-value{font-size:12px}.tooth-preview-tooth-value--deciduous{font-size:10px}.tooth-preview-tooth-bracket{font-size:12px}.tooth-preview-supernumerary{font-size:9px;vertical-align:super;margin:0 1px}.tooth-preview-surface{font-size:9px;vertical-align:super;margin-left:1px}.tooth-extra-panel{width:100px;display:flex;flex-direction:column;gap:10px}.tooth-surface-panel{background:#fafafa;border-radius:8px;padding:10px 20px}.tooth-surface-title{font-size:12px;font-weight:500;color:#333;margin-bottom:8px;text-align:center}.tooth-surface-grid{display:flex;flex-direction:column;gap:4px;align-items:center}.tooth-surface-row{display:flex;gap:4px;justify-content:center}.tooth-surface-item{width:30px;height:30px;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:500;color:#333;cursor:pointer;background:#fff;border:1px dashed #d9d9d9;border-radius:5px;transition:all .2s;box-sizing:border-box}.tooth-surface-item--indent{margin-left:17px}.tooth-surface-item:hover{border-color:#1890ff;color:#1890ff}.tooth-surface-item.selected{background:#1890ff;border-color:#1890ff;border-style:solid;color:#fff}.tooth-supernumerary-panel{background:#fafafa;border-radius:8px;padding:10px 20px}.tooth-supernumerary-title{font-size:12px;font-weight:500;color:#333;margin-bottom:4px;text-align:center}.tooth-supernumerary-hint{font-size:10px;color:#999;font-weight:400}.tooth-supernumerary-grid{display:flex;gap:8px;justify-content:center;margin-top:8px}.tooth-supernumerary-item{width:30px;height:35px;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:500;color:#333;cursor:pointer;background:#fff;border:1px solid #d9d9d9;border-bottom:none;border-radius:50px;transition:all .2s;box-sizing:border-box}.tooth-supernumerary-item:hover{border-color:#1890ff;color:#1890ff}.tooth-supernumerary-item.selected{background:#1890ff;border-color:#1890ff;color:#fff}.ce-button-input-modal,.ce-button-edit-modal,.ce-number-input-modal,.tooth-position-edit-modal,.tooth-position-create-modal{inset:0;display:flex;align-items:center;justify-content:center;padding:24px;box-sizing:border-box;overflow:auto;background:transparent;pointer-events:none}.ce-button-input-modal__content,.ce-button-edit-modal__content,.ce-number-input-modal__content,.tooth-position-modal__container{pointer-events:auto}.ce-button-input-modal__content,.ce-button-edit-modal__content,.ce-number-input-modal__content{max-height:calc(100vh - 48px);overflow:auto}.tooth-position-modal__mask{display:none}.tooth-position-modal__container{position:relative;top:auto;left:auto;transform:none;display:flex;flex-direction:column;max-height:calc(100vh - 48px)}.ant-modal-mask{display:none!important}.ant-modal-wrap{position:fixed!important;inset:0!important;display:flex!important;align-items:center!important;justify-content:center!important;padding:24px!important;box-sizing:border-box!important;overflow:auto!important;pointer-events:none!important}.ant-modal{top:auto!important;margin:0!important;padding-bottom:0!important;max-width:calc(100vw - 48px)!important;max-height:calc(100vh - 48px)!important;pointer-events:auto!important}.ant-modal-content{max-height:calc(100vh - 48px)!important;overflow:auto!important}.dialog-mask{display:none}.dialog-container{position:fixed;inset:0;overflow:auto;z-index:999;margin:0;padding:24px;box-sizing:border-box;display:flex;justify-content:center;align-items:center;pointer-events:none}.dialog{position:relative;padding:0 30px 30px;background:#fff;box-shadow:0 2px 12px #38383833;border:1px solid #e2e6ed;border-radius:2px;max-height:calc(100vh - 48px);overflow:auto;pointer-events:auto}.dialog-title{position:relative;border-bottom:1px solid #e2e6ed;margin-bottom:30px;height:60px;display:flex;align-items:center;justify-content:space-between}.dialog-title i{width:16px;height:16px;cursor:pointer;display:inline-block;background:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M8.9%208.192l4.242%204.243-.707.707L8.192%208.9%203.95%2013.142l-.707-.707%204.242-4.243L3.243%203.95l.707-.707%204.242%204.242%204.243-4.242.707.707L8.9%208.192z'%20fill='%236A6A6A'%20fill-rule='evenodd'/%3e%3c/svg%3e")}.dialog-option__item{margin-bottom:18px;display:flex;align-items:center;justify-content:space-between}.dialog-option__item span{margin-right:12px;font-size:14px;color:#3d4757;position:relative}.dialog-option__item input,.dialog-option__item textarea,.dialog-option__item select{width:276px;height:30px;border-radius:2px;border:1px solid #d3d3d3;min-height:30px;padding:5px;box-sizing:border-box;outline:none;appearance:none;-webkit-user-select:none;user-select:none;font-family:inherit}.dialog-option__item input:focus,.dialog-option__item textarea:focus{border-color:#4991f2}.dialog-option__item--require:before{content:"*";color:#f56c6c;margin-right:4px;position:absolute;left:-8px}.dialog-menu{display:flex;align-items:center;justify-content:flex-end}.dialog-menu button{position:relative;display:inline-block;border:1px solid #e2e6ed;border-radius:2px;background:#fff;line-height:22px;padding:0 16px;white-space:nowrap;cursor:pointer}.dialog-menu button:hover{background:#1937580a}.dialog-menu__cancel{margin-right:16px}.dialog-menu button[type=submit]{color:#fff;background:#4991f2;border-color:#4991f2}.dialog-menu button[type=submit]:hover{background:#5b9cf3;border-color:#5b9cf3}.dialog-radio-group{display:flex;flex-direction:column;gap:8px}.dialog-radio-group--horizontal{flex-direction:row;gap:16px}.dialog-radio-item{display:flex;align-items:center;cursor:pointer;font-size:14px;color:#3d4757}.dialog-radio-item input[type=radio]{width:16px;height:16px;margin:0 6px 0 0;cursor:pointer;appearance:auto}.dialog-radio-item span{margin:0}`)),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
|
|
2
|
-
(function(s,Cn){typeof exports=="object"&&typeof module<"u"?Cn(exports):typeof define=="function"&&define.amd?define(["exports"],Cn):(s=typeof globalThis<"u"?globalThis:s||self,Cn(s["canvas-editor"]={}))})(this,(function(s){"use strict";const Cn="0.7.
|
|
2
|
+
(function(s,Cn){typeof exports=="object"&&typeof module<"u"?Cn(exports):typeof define=="function"&&define.amd?define(["exports"],Cn):(s=typeof globalThis<"u"?globalThis:s||self,Cn(s["canvas-editor"]={}))})(this,(function(s){"use strict";const Cn="0.7.67";s.MaxHeightRatio=void 0,(function(o){o.HALF="half",o.ONE_THIRD="one-third",o.QUARTER="quarter"})(s.MaxHeightRatio||(s.MaxHeightRatio={})),s.NumberType=void 0,(function(o){o.ARABIC="arabic",o.CHINESE="chinese"})(s.NumberType||(s.NumberType={})),s.ImageDisplay=void 0,(function(o){o.INLINE="inline",o.BLOCK="block",o.SURROUND="surround",o.FLOAT_TOP="float-top",o.FLOAT_BOTTOM="float-bottom"})(s.ImageDisplay||(s.ImageDisplay={})),s.LocationPosition=void 0,(function(o){o.BEFORE="before",o.AFTER="after",o.OUTER_BEFORE="outer-before",o.OUTER_AFTER="outer-after"})(s.LocationPosition||(s.LocationPosition={})),s.FlexDirection=void 0,(function(o){o.ROW="row",o.COLUMN="column"})(s.FlexDirection||(s.FlexDirection={}));const B="",Zs=`
|
|
3
3
|
`,Ti=" ",Qs=" ",da=["·","、",":",":",",",",",".","。",";",";","?","?","!","!"],Hs={[s.MaxHeightRatio.HALF]:1/2,[s.MaxHeightRatio.ONE_THIRD]:1/3,[s.MaxHeightRatio.QUARTER]:1/4},fi={ENGLISH:"A-Za-z",NUMBER:"0-9.$¥",SPANISH:"A-Za-zÁÉÍÓÚáéíóúÑñÜü",FRENCH:"A-Za-zÀÂÇàâçÉéÈèÊêËëÎîÏïÔôÙùÛûŸÿ",GERMAN:"A-Za-zÄäÖöÜüß",RUSSIAN:"А-Яа-яЁё",PORTUGUESE:"A-Za-zÁÉÍÓÚáéíóúÃÕãõÇç",ITALIAN:"A-Za-zÀàÈèÉéÌìÍíÎîÓóÒòÙù",DUTCH:"A-Za-zÀàÁáÂâÄäÈèÉéÊêËëÌìÍíÎîÏïÓóÒòÔôÖöÙùÛûÜü",SWEDISH:"A-Za-zÅåÄäÖö",GREEK:"ΑαΒβΓγΔδΕεΖζΗηΘθΙιΚκΛλΜμΝνΞξΟοΠπΡρΣσςΤτΥυΦφΧχΨψΩω"},ua="中";s.RowFlex=void 0,(function(o){o.LEFT="left",o.CENTER="center",o.RIGHT="right",o.ALIGNMENT="alignment",o.JUSTIFY="justify"})(s.RowFlex||(s.RowFlex={}));const mi=/[0-9.]/,ha=/[\uD800-\uDBFF][\uDC00-\uDFFF]/,Ra=/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC2\uDECE-\uDEDB\uDEE0-\uDEE8]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g,ga=new RegExp(`${Ra.source}|${ha.source}`,"g"),Ta=/[、,。?!;:……「」“”‘’*()【】〔〕〖〗〘〙〚〛《》———﹝﹞–—\\/·.,!?;:`~<>()[\]{}'"|]/,Ci=new RegExp(`^[${B}
|
|
4
4
|
]`),fa=/\s/;function ma(o,t){let e;return function(...n){e&&window.clearTimeout(e),e=window.setTimeout(()=>{o.apply(this,n)},t)}}function Ca(o,t){let e=0,n;return function(...i){const l=Date.now();l-e>=t?(window.clearTimeout(n),o.apply(this,i),e=l):(window.clearTimeout(n),n=window.setTimeout(()=>{o.apply(this,i),e=l},t))}}function pi(o,t){if(!o||typeof o!="object")return o;let e={};return Array.isArray(o)?e=o.map(n=>pi(n,t)):Object.keys(o).forEach(n=>{t.includes(n)||(e[n]=pi(o[n],t))}),e}function lt(o){if(typeof structuredClone=="function")return structuredClone(o);if(!o||typeof o!="object")return o;let t={};return Array.isArray(o)?t=o.map(e=>lt(e)):Object.keys(o).forEach(e=>{t[e]=lt(o[e])}),t}function Ii(o){return o&&o.nodeType===1&&o.tagName.toLowerCase()==="body"}function Ks(o,t,e){if(o&&!Ii(o))for(o=o;o;){if(!t||t(o)||Ii(o))return t&&!t(o)&&Ii(o)?null:o;o=o.parentNode}return null}function gt(){function o(){return((1+Math.random())*65536|0).toString(16).substring(1)}return o()+o()+"-"+o()+"-"+o()+"-"+o()+"-"+o()+o()+o()}function bt(o){const t=[];if(Intl.Segmenter){const n=new Intl.Segmenter().segment(o);for(const{segment:i}of n)t.push(i)}else{const e=new Map;for(const i of o.matchAll(ga))e.set(i.index,i[0]);let n=0;for(;n<o.length;){const i=e.get(n);i?(t.push(i),n+=i.length):(t.push(o[n]),n++)}}return t}function As(o,t){const e=document.createElement("a");e.href=o,e.download=t,e.click()}function pa(o,t){Ia(3,o,t)}function Ia(o,t,e){let n=0,i=0,l=null,r=null;const a=function(c){const d=new Date().getTime(),u=l!==null&&r!==null&&Math.abs(c.clientX-l)<=5&&Math.abs(c.clientY-r)<=5;n=d-i<300&&u?n+1:0,i=d,l=c.clientX,r=c.clientY,n>=o-1&&(e(c),n=0)};t.addEventListener("click",a)}function So(o){return Object.prototype.toString.call(o)==="[object Object]"}function Ei(o){return Array.isArray(o)}function Li(o){return Object.prototype.toString.call(o)==="[object Number]"}function Ea(o){return Object.prototype.toString.call(o)==="[object String]"}function _s(o,t){if(So(o)&&So(t)){const e=t;for(const[n,i]of Object.entries(o))e[n]?e[n]=_s(i,e[n]):e[n]=i}else Ei(o)&&Ei(t)&&t.push(...o);return t}function Pi(o){if(typeof queueMicrotask=="function"){queueMicrotask(()=>{o()});return}if(typeof Promise<"u"){Promise.resolve().then(()=>{o()});return}setTimeout(()=>{o()},0)}function La(o){const t=["零","一","二","三","四","五","六","七","八","九"],e=["","十","百","千","万","十","百","千","亿","十","百","千","万","十","百","千","亿"];if(!o||isNaN(o))return"零";const n=o.toString().split("");let i="";for(let l=0;l<n.length;l++){const r=n.length-1-l;i=`${e[l]}${i}`,i=`${t[Number(n[r])]}${i}`}return i=i.replace(/零(千|百|十)/g,"零").replace(/十零/g,"十"),i=i.replace(/零+/g,"零"),i=i.replace(/零亿/g,"亿").replace(/零万/g,"万"),i=i.replace(/亿万/g,"亿"),i=i.replace(/零+$/,""),i=i.replace(/^一十/g,"十"),i}function dn(o,t,e){for(let n=0;n<o.length;n++){const i=o[n],l=t[i];l!==void 0?e[i]=l:delete e[i]}}function Bs(o,t){if(!(!t.length||!o.length))for(let e=o.length-1;e>=0;e--)t.includes(o[e])&&o.splice(e,1)}function Jt(o,t){const e={};for(const n in o)t.includes(n)&&(e[n]=o[n]);return e}function Ee(o,t){const e={};for(const n in o)t.includes(n)||(e[n]=o[n]);return e}function Pa(o){const e=new TextEncoder().encode(o),n=Array.from(e,l=>String.fromCharCode(l));return window.btoa(n.join(""))}function Ma(o){let t=o.parentElement;for(;t;){const n=window.getComputedStyle(t).getPropertyValue("overflow-y");if(t.scrollHeight>t.clientHeight&&(n==="auto"||n==="scroll"))return t;t=t.parentElement}return document.documentElement}function xs(o,t){return o.length!==t.length?!1:!o.some(e=>!t.includes(e))}function Oa(o,t){if(!So(o)||!So(t))return!1;const e=Object.keys(o),n=Object.keys(t);return e.length!==n.length?!1:!e.some(i=>t[i]!==o[i])}function Sa(o,t){const e=o.x,n=o.x+o.width,i=o.y,l=o.y+o.height,r=t.x,a=t.x+t.width,c=t.y,d=t.y+t.height;return!(e>a||n<r||i>d||l<c)}function ks(o){return o==null}function Do(o){return o.replace(/\r\n|\r/g,`
|
|
5
5
|
`)}function Gs(o,t,e=0){const n=Math.max(0,Math.floor(e));if(n>=o.length)return typeof t=="string"&&t===""?{index:o.length,length:0}:{index:-1,length:0};if(typeof t=="string"){if(t==="")return{index:n,length:0};const c=o.indexOf(t,n);return c===-1?{index:-1,length:0}:{index:c,length:t.length}}const i=t.flags,l=i.includes("g")?i:i+"g",r=new RegExp(t.source,l);r.lastIndex=n;const a=r.exec(o);return a?{index:a.index,length:a[0].length}:{index:-1,length:0}}function Mi(o,t){if(!t){o.scrollTop=0;return}const e=[];let n=t.offsetParent;for(;n&&o!==n&&o.contains(n);)e.push(n),n=n.offsetParent;const i=t.offsetTop+e.reduce((c,d)=>c+d.offsetTop,0),l=i+t.offsetHeight,r=o.scrollTop,a=r+o.clientHeight;i<r?o.scrollTop=i:l>a&&(o.scrollTop=l-o.clientHeight)}function le(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}function Da(o,t){return o.performance.enabled&&t>=o.performance.threshold}function Oi(o,t,e,n=[],i){if(!Da(o,e))return;const l={duration:Number(e.toFixed(2)),breakdown:n.map(r=>({label:r.label,duration:Number(r.duration.toFixed(2))})),...i};console.log(`[canvas-editor perf] ${t}`,l)}const Js=12,Fa={width:1,color:"#000000",dragWidth:2,dragColor:"#0000FF",dragFloatImageDisabled:!1},ve="editor-component",st="ce",so=`${st}-clipboard`,Fo={print:{imagePreviewerDisabled:!1,backgroundDisabled:!1},compare:{imagePreviewerDisabled:!1,backgroundDisabled:!1},readonly:{imagePreviewerDisabled:!1},form:{controlDeletableDisabled:!1,inputTraceEnabled:!0,deleteTraceEnabled:!0}};var qt;(function(o){o.UP="top",o.DOWN="down",o.LEFT="left",o.RIGHT="right"})(qt||(qt={}));const pn=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),Xa=typeof navigator<"u"&&/iPad|iPhone/.test(navigator.userAgent),ya=/Mobile|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),Na=typeof navigator<"u"&&/Firefox/.test(navigator.userAgent);s.ElementType=void 0,(function(o){o.TEXT="text",o.TEXTFIELD="TextField",o.BUTTON="button",o.IMAGE="image",o.TABLE="table",o.HYPERLINK="hyperlink",o.SUPERSCRIPT="superscript",o.SUBSCRIPT="subscript",o.SEPARATOR="separator",o.PAGE_BREAK="pageBreak",o.CONTROL="control",o.AREA="area",o.CHECKBOX="checkbox",o.RADIO="radio",o.LATEX="latex",o.TAB="tab",o.DATE="date",o.BLOCK="block",o.TITLE="title",o.LIST="list",o.SPLIT_TAG="splitTag",o.LABEL="label",o.MENSTRUAL_HISTORY="menstrualHistory",o.FETAL_HEART_POSITION="fetalHeartPosition",o.TOOTH_POSITION="toothPosition",o.SPECIAL_SYMBOLS="specialSymbols",o.MACRO="macro",o.CUSTOM_MACRO="customMacro",o.REUSABLE_ITEM="reusableItem",o.SUB_TEMPLATE="subTemplate"})(s.ElementType||(s.ElementType={}));const Ne=["bold","color","highlight","font","size","italic","underline","strikeout","textDecoration","deletePerson","newElEditPerson","deleteTime","newElEditTime"],de=["rowFlex","vertical","rowMargin"],ba=["type","font","size","bold","color","italic","highlight","underline","strikeout","rowFlex","vertical","url","areaId","hyperlinkId","dateId","dateFormat","groupIds","templateId","subTemplateContent","subTemplateRelation","subTemplateConditions","rowMargin","textDecoration","deletePerson","newElEditPerson","deleteTime","newElEditTime"],Va=["type","font","size","bold","color","italic","highlight","underline","strikeout","rowFlex","vertical","rowMargin","dashArray","trList","tdPadding","tableEditable","tableToolDisabled","borderType","borderColor","borderWidth","borderExternalWidth","translateX","width","height","url","colgroup","valueList","control","checkbox","radio","dateFormat","block","level","title","listType","listStyle","listWrap","groupIds","conceptId","imgDisplay","imgFloatPosition","imgToolDisabled","imgPreviewDisabled","imgCrop","imgCaption","textDecoration","extension","externalId","areaId","area","hide","label","labelId","lineWidth","deletePerson","newElEditPerson","deleteTime","newElEditTime","dictCode","macroConfig","menstrualData","menstrualHistoryId","fetalHeartData","fetalHeartPositionId","toothPositionData","toothPositionId","reusableItemConfig","templateId","subTemplateContent","subTemplateRelation","subTemplateConditions","subTemplateExpanded"],Wa=["conceptId","extension","externalId","verticalAlign","backgroundColor","borderTypes","slashTypes","disabled","deletable"],In=["tdId","trId","tableId"],Si=["level","titleId","title"],Un=["listId","listType","listStyle"],Di=["control","controlId","controlComponent"],he=["font","size","bold","highlight","italic","strikeout","deletePerson","newElEditPerson","deleteTime","color","newElEditTime"],un=["areaId","area"],Fi=[...In,...Si,...Un,...un],Le=[s.ElementType.TEXT,s.ElementType.HYPERLINK,s.ElementType.SUBSCRIPT,s.ElementType.SUPERSCRIPT,s.ElementType.CONTROL,s.ElementType.DATE],Ua=[s.ElementType.IMAGE,s.ElementType.LATEX],Ya=[s.ElementType.BLOCK,s.ElementType.PAGE_BREAK,s.ElementType.SEPARATOR,s.ElementType.TABLE],wa=["HR","TABLE","UL","OL"],va=[s.ElementType.TITLE,s.ElementType.LIST];class Yn{static sandbox=["allow-scripts","allow-same-origin"];static allow=["fullscreen"];element;constructor(t){this.element=t}_defineIframeProperties(t){Object.defineProperties(t,{parent:{get:()=>null},__POWERED_BY_CANVAS_EDITOR__:{get:()=>!0}})}render(t){const{iframeBlock:e}=this.element.block||{},n=document.createElement("iframe");n.setAttribute("data-id",this.element.id),n.sandbox.add(...e?.sandbox||Yn.sandbox),n.setAttribute("allow",[e?.allow||Yn.allow].join(" ")),n.style.border="none",n.style.width="100%",n.style.height="100%",e?.src?n.src=e.src:e?.srcdoc&&(n.srcdoc=e.srcdoc),t.append(n),this._defineIframeProperties(n.contentWindow)}}class $s{draw;options;imageCache;container;floatImageContainer;floatImage;constructor(t){this.draw=t,this.options=t.getOptions(),this.container=t.getContainer(),this.imageCache=new Map,this.floatImageContainer=null,this.floatImage=null}getOriginalMainImageList(){const t=[],e=n=>{for(const i of n)if(i.type===s.ElementType.TABLE){const l=i.trList;for(let r=0;r<l.length;r++){const a=l[r];for(let c=0;c<a.tdList.length;c++){const d=a.tdList[c];e(d.value)}}}else i.type===s.ElementType.IMAGE&&t.push(i)};return e(this.draw.getOriginalMainElementList()),t}_countImagesBeforeTarget(t,e){let n=0;for(const i of t){if(i===e)break;if(i.type===s.ElementType.TABLE){const l=i.trList;for(const r of l)for(const a of r.tdList)n+=this._countImagesBeforeTarget(a.value,e)}else i.type===s.ElementType.IMAGE&&n++}return n}createFloatImage(t){const{scale:e}=this.options;let n=this.floatImageContainer,i=this.floatImage;n||(n=document.createElement("div"),n.classList.add(`${st}-float-image`),this.container.append(n),this.floatImageContainer=n),i||(i=document.createElement("img"),n.append(i),this.floatImage=i),n.style.display="none",i.style.width=`${t.width*e}px`,i.style.height=`${t.height*e}px`;const l=this.draw.getHeight(),r=this.draw.getPageGap(),a=this.draw.getPageNo()*(l+r),c=t.imgFloatPosition;n.style.left=`${c.x*e}px`,n.style.top=`${a+c.y*e}px`,i.src=t.value}dragFloatImage(t,e){if(!this.floatImageContainer)return;this.floatImageContainer.style.display="block";const n=parseFloat(this.floatImageContainer.style.left)+t,i=parseFloat(this.floatImageContainer.style.top)+e;this.floatImageContainer.style.left=`${n}px`,this.floatImageContainer.style.top=`${i}px`}destroyFloatImage(){this.floatImageContainer&&(this.floatImageContainer.style.display="none")}addImageObserver(t){this.draw.getImageObserver().add(t)}getFallbackImage(t,e){const i=(t-Math.ceil(t/8)*8)/2,l=(e-Math.ceil(e/8)*8)/2,r=`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${e}" viewBox="0 0 ${t} ${e}">
|
|
@@ -121,7 +121,7 @@ ${R||`${T+1}.`}${i(h)}${g?`
|
|
|
121
121
|
`);else if(t.key==="Tab")this.clearInlineEditor();else if(t.key==="Escape")this.clearInlineEditor({isSubmitHistory:!1,isRestore:!0});else return!1;return t.preventDefault(),t.stopImmediatePropagation(),!0}clearInlineEditor(t={}){const e=this.activeInlineEditor;if(!e)return;this._cancelPendingInlineCursorSync(),this.activeInlineEditor=null;const{isSubmitHistory:n=!0,isRestore:i=!1}=t;document.removeEventListener("mousedown",e.outsideHandler,!0);const l=this._getInlineEditorElement(e);if(l&&i&&this._restoreInlineEditorValue(l,e),e.popup?.remove(),l){const r=this._getInlineEditorValue(l),a=l.macroConfig?.code,c=r!==e.initialValue||a!==e.initialCode;this.draw.render({curIndex:e.index,isSubmitHistory:c&&!i&&n})}}_renderPlainText(t,e,n,i,l){t.save(),t.font=e.style,t.fillStyle=e.color||"#000000",t.textBaseline="alphabetic";const r=this._getMacroLineHeight(e);l.split(Sn).forEach((a,c)=>{t.fillText(a,n,i+c*r)}),t.restore()}_renderEditMode(t,e,n,i,l){const{scale:r}=this.options,a=e.type==="customMacro",c=e.type==="reusableItem",d=e.type==="subTemplate";let u,R;d?(u="#722ed1",R="#f9f0ff"):c?(u="#52c41a",R="#f6ffed"):a?(u="#fa8c16",R="#fff7e6"):(u="#1677ff",R="#e6f4ff"),t.save(),t.font=e.style;const h=t.measureText(l),T=h.actualBoundingBoxAscent+h.actualBoundingBoxDescent,g=8*r,f=4*r,m=4*r,p=h.width+g*2,I=T+f*2,C=e.metrics,E=n,O=i-C.boundingBoxAscent+(C.boundingBoxAscent+C.boundingBoxDescent-I)/2;t.fillStyle=R,this._drawRoundedRect(t,E,O,p,I,m),t.fill(),t.fillStyle=u,t.textBaseline="middle",t.fillText(l,n+g,O+I/2),t.restore()}_renderTextControl(t,e,n,i,l){const{control:r}=this.options,{placeholderColor:a}=r;t.save(),t.font=e.style;const d=`请输入${e.label||""}`,R=(l||d).split(Sn),h=this._getMacroLineHeight(e),T=R.map(p=>t.measureText(p)),g=T[T.length-1];t.fillStyle=this._getControlColor(e),t.textBaseline="alphabetic",t.fillText("[",n,i);const f=n+t.measureText("[").width;this._renderTextSelection(t,e,f,i,l,h),t.fillStyle=l?this._getValueColor(e):a,R.forEach((p,I)=>{t.fillText(p,f,i+I*h)});const m=f+g.width;t.fillStyle=this._getControlColor(e),t.fillText("]",m,i+(R.length-1)*h),t.restore()}_renderSelectControl(t,e,n,i,l){const{scale:r,control:a}=this.options,{placeholderColor:c}=a;t.save(),t.font=e.style;const u=`请选择${e.label||""}`,R=l||u,h=t.measureText(R),T=h.actualBoundingBoxAscent+h.actualBoundingBoxDescent;t.fillStyle=this._getControlColor(e),t.textBaseline="alphabetic",t.fillText("[",n,i);const g=n+t.measureText("[").width;t.fillStyle=l?this._getValueColor(e):c,t.fillText(R,g,i);const f=g+h.width+2*r,m=i-T/2;t.beginPath(),t.moveTo(f,m-2*r),t.lineTo(f+5*r,m-2*r),t.lineTo(f+2.5*r,m+2*r),t.closePath(),t.fillStyle=this._getControlColor(e),t.fill();const p=f+6*r;t.fillStyle=this._getControlColor(e),t.fillText("]",p,i),t.restore()}_drawRoundedRect(t,e,n,i,l,r){t.beginPath(),t.moveTo(e+r,n),t.lineTo(e+i-r,n),t.quadraticCurveTo(e+i,n,e+i,n+r),t.lineTo(e+i,n+l-r),t.quadraticCurveTo(e+i,n+l,e+i-r,n+l),t.lineTo(e+r,n+l),t.quadraticCurveTo(e,n+l,e,n+l-r),t.lineTo(e,n+r),t.quadraticCurveTo(e,n,e+r,n),t.closePath()}_createSelectPopup(t){const e=this.activeInlineEditor;if(!e)return;const n=this._ensureMacroConfig(t);if(!n.items?.length)return;const i=this._getInlineEditorPosition(e);if(!i)return;const l=document.createElement("div");l.classList.add(`${st}-select-control-popup`,`${st}-macro-select-popup`),l.setAttribute(ve,s.EditorComponent.POPUP),l.style.setProperty("--COLOR-HOVER",this._getControlColor(t));const r=document.createElement("ul"),a=n.code||n.items?.find(R=>R.value===n.value)?.code||"";n.items.forEach(R=>{const h=document.createElement("li");h.textContent=R.value,h.dataset.code=R.code,R.code===a&&h.classList.add("active"),h.onclick=()=>{const T=R.code===a?"":R.code;this._setInlineEditorValue(t,"",T),this.clearInlineEditor()},r.append(h)}),l.append(r);const c=i.pageNo*(this.draw.getHeight()+this.draw.getPageGap()),[d,u]=i.coordinate.leftTop;l.style.left=`${d}px`,l.style.top=`${u+c+i.lineHeight}px`,this.draw.getContainer().append(l),e.popup=l}_getCursorOffset(t,e,n){const i=Array.from(this._getInlineEditorValue(t));if(n===void 0||!i.length)return i.length;const l=this.draw.getPosition().getPositionList()[e];if(!l)return i.length;const r=this.draw.getCtx();r.save(),r.font=this.draw.getElementFont(t);const a=l.coordinate.leftTop[0]+r.measureText("[").width;let c=0;for(let d=0;d<i.length;d++){const u=r.measureText(i[d]).width;if(n<a+c+u/2)return r.restore(),d;c+=u}return r.restore(),i.length}_focusInputAgent(){window.setTimeout(()=>{this.activeInlineEditor&&this.draw.getCursor().focus()})}_renderActiveEditor(){const t=this.activeInlineEditor;t&&(this.draw.requestRender({curIndex:t.index,layoutStartIndex:t.index,isSubmitHistory:!1}),this.pendingInlineCursorFrameId===null&&(this.pendingInlineCursorFrameId=window.requestAnimationFrame(()=>{this.pendingInlineCursorFrameId=null,this._syncInlineCursor()})))}_cancelPendingInlineCursorSync(){this.pendingInlineCursorFrameId!==null&&(window.cancelAnimationFrame(this.pendingInlineCursorFrameId),this.pendingInlineCursorFrameId=null)}_syncInlineCursor(){const t=this.activeInlineEditor;if(!t||t.type!=="text")return;const e=this._getInlineEditorElement(t),n=this._getInlineEditorPosition(t);if(!e||!n)return;const i=this.draw.getCtx();i.save(),i.font=this.draw.getElementFont(e);const l=Array.from(this._getInlineEditorValue(e)),r=this._getMacroLineStart(l,t.cursorOffset),a=l.slice(r,t.cursorOffset).join(""),c=l.slice(0,t.cursorOffset).filter(P=>Sn.test(P)).length,d=n.coordinate.leftTop[0]+i.measureText("[").width+i.measureText(a).width;i.restore();const u=this.draw.getCursor(),R=u.getCursorDom(),{scale:h}=this.options,T=this._getMacroLineHeight(e),g=Js*h,f=Math.min(T/4,g),m=T+f*2,p=l.filter(P=>Sn.test(P)).length+1,I=Math.max(n.metrics.boundingBoxDescent-T*(p-1),0),C=n.pageNo*(this.draw.getHeight()+this.draw.getPageGap()),E=n.coordinate.leftTop[1]+n.ascent+I-(m-f)+c*T+C,O=u.getAgentDom();R.style.left=`${d}px`,R.style.top=`${E}px`,R.style.height=`${m}px`,R.style.backgroundColor=this._getControlColor(e),R.style.display="block",O.style.left=`${d}px`,O.style.top=`${E+m-g}px`}_renderTextSelection(t,e,n,i,l,r){const a=this.activeInlineEditor;if(!a||a.type!=="text"||!l||!this._getIsActiveElement(e,a))return;const c=Math.min(a.cursorOffset,a.selectionOffset),d=Math.max(a.cursorOffset,a.selectionOffset);if(c===d)return;const u=Array.from(l);let h=this._getMacroLineStart(u,c);for(;h<=d;){const T=u.findIndex((p,I)=>I>=h&&Sn.test(p)),g=T===-1?u.length:T,f=Math.max(c,h),m=Math.min(d,g);if(f<m){const p=u.slice(h,f).join(""),I=u.slice(f,m).join(""),C=t.measureText(I||p);t.save(),t.globalAlpha=.2,t.fillStyle=this._getControlColor(e),t.fillRect(n+t.measureText(p).width,i+this._getMacroLineIndex(u,h)*r-C.actualBoundingBoxAscent,t.measureText(I).width,C.actualBoundingBoxAscent+C.actualBoundingBoxDescent),t.restore()}if(g>=d||g===u.length)break;h=g+1}}_getMacroLineHeight(t){const{scale:e,defaultSize:n}=this.options;return(t.size||n)*e}_getMacroLineStart(t,e){for(let n=Math.min(e-1,t.length-1);n>=0;n--)if(Sn.test(t[n]))return n+1;return 0}_getMacroLineIndex(t,e){return t.slice(0,e).filter(n=>Sn.test(n)).length}_getIsActiveElement(t,e){const n=this._getInlineEditorElement(e);return!!(n&&(n===t||n.id&&n.id===t.id))}_getControlColor(t){return t.type===s.ElementType.REUSABLE_ITEM?"#1677ff":"#fa8c16"}_getValueColor(t){return t.color||this.options.defaultColor}_getInlineEditorElement(t){const e=this.draw.getElementList()[t.index];return e?.id===t.elementId?e:t.elementId?this.draw.getElementList().find(n=>n.id===t.elementId)||null:e||null}_getInlineEditorPosition(t){return this.draw.getPosition().getPositionList()[t.index]||null}_ensureMacroConfig(t){return t.macroConfig||(t.macroConfig={type:"text"}),t.macroConfig}_getInlineEditorValue(t){return t.type===s.ElementType.REUSABLE_ITEM?t.reusableItemConfig?.value||"":t.macroConfig?.value||""}_setInlineEditorValue(t,e,n){if(t.type===s.ElementType.REUSABLE_ITEM){t.reusableItemConfig?t.reusableItemConfig.value=e:t.reusableItemConfig={value:e};return}const i=this._ensureMacroConfig(t);i.type==="select"?(i.code=n||void 0,i.value=this._getSelectLabelByCode(i,n)):i.value=e}_restoreInlineEditorValue(t,e){if(t.type===s.ElementType.REUSABLE_ITEM){this._setInlineEditorValue(t,e.initialValue),t.underline=e.initialUnderline,t.strikeout=e.initialStrikeout,t.textDecoration=e.initialTextDecoration;return}const n=this._ensureMacroConfig(t);n.value=e.initialValue,e.type==="select"&&(n.code=e.initialCode)}_getSelectLabelByCode(t,e){return e&&t.items?.find(n=>n.code===e)?.value||""}}class xd{draw;position;zone;options;elementList;rowList;positionList;constructor(t,e){this.draw=t,this.position=t.getPosition(),this.zone=t.getZone(),this.options=t.getOptions(),this.elementList=e||[],this.rowList=[],this.positionList=[]}getRowList(){return this.rowList}setElementList(t){this.elementList=t}getElementList(){return this.elementList}getPositionList(){return this.positionList}compute(){this.recovery(),this._computeRowList(),this._computePositionList()}recovery(){this.rowList=[],this.positionList=[]}_computeRowList(){const t=this.draw.getInnerWidth(),e=this.draw.getMargins(),n=Qi(this.elementList);this.rowList=this.draw.computeRowList({startX:e[3],startY:this.getHeaderTop(),innerWidth:t,elementList:this.elementList,surroundElementList:n})}_computePositionList(){const t=this.getHeaderTop(),e=this.draw.getInnerWidth(),i=this.draw.getMargins()[3],l=t;this.position.computePageRowPosition({positionList:this.positionList,rowList:this.rowList,pageNo:0,startRowIndex:0,startIndex:0,startX:i,startY:l,innerWidth:e,zone:s.EditorZone.HEADER})}getHeaderTop(){const{header:{top:t,disabled:e},scale:n}=this.options;return e?0:Math.floor(t*n)}getMaxHeight(){const{header:{maxHeightRadio:t}}=this.options,e=this.draw.getHeight();return Math.floor(e*Hs[t])}getHeight(){if(this.options.header.disabled)return 0;const t=this.getMaxHeight(),e=this.getRowHeight();return e>t?t:e}getRowHeight(){return this.rowList.reduce((t,e)=>t+e.height,0)}getExtraHeight(){const t=this.draw.getMargins(),e=this.getHeight(),i=this.getHeaderTop()+e-t[0];return i<=0?0:i}render(t,e){t.save(),t.globalAlpha=this.zone.isHeaderActive()?1:this.options.header.inactiveAlpha;const n=this.draw.getInnerWidth(),i=this.getMaxHeight(),l=[];let r=0;for(let a=0;a<this.rowList.length;a++){const c=this.rowList[a];if(r+c.height>i)break;l.push(c),r+=c.height}this.draw.drawRow(t,{elementList:this.elementList,positionList:this.positionList,rowList:l,pageNo:e,startIndex:0,innerWidth:n,zone:s.EditorZone.HEADER}),t.restore()}}class kd{getOffsetY(t){return-t.metrics.height/2}render(t,e,n,i){t.save(),t.font=e.style,e.color&&(t.fillStyle=e.color),t.fillText(e.value,n,i+this.getOffsetY(e)),t.restore()}}class Gd{getOffsetY(t){return t.metrics.height/2}render(t,e,n,i){t.save(),t.font=e.style,e.color&&(t.fillStyle=e.color),t.fillText(e.value,n,i+this.getOffsetY(e)),t.restore()}}class Jd{options;constructor(t){this.options=t.getOptions()}render(t,e,n,i){t.save();const{scale:l,separator:{lineWidth:r,strokeStyle:a}}=this.options;t.lineWidth=(e.lineWidth||r)*l,t.strokeStyle=e.color||a,e.dashArray?.length&&t.setLineDash(e.dashArray);const c=Math.round(i);t.translate(0,t.lineWidth/2),t.beginPath(),t.moveTo(n,c),t.lineTo(n+e.width*l,c),t.stroke(),t.restore()}}class $d{draw;options;i18n;constructor(t){this.draw=t,this.options=t.getOptions(),this.i18n=t.getI18n()}render(t,e,n,i){const{pageBreak:{font:l,fontSize:r,lineDash:a}}=this.options,c=this.i18n.t("pageBreak.displayName"),{scale:d,defaultRowMargin:u}=this.options,R=r*d,h=e.width*d,T=this.draw.getDefaultBasicRowMarginHeight()*u;t.save(),t.font=`${R}px ${l}`;const g=t.measureText(c),f=(h-g.width)/2;t.setLineDash(a),t.translate(0,.5+T),t.beginPath(),t.moveTo(n,i),t.lineTo(n+f,i),t.moveTo(n+f+g.width,i),t.lineTo(n+h,i),t.stroke(),t.fillText(c,n+f,i+g.actualBoundingBoxAscent-R/2),t.restore()}}class zd{draw;options;imageCache;constructor(t){this.draw=t,this.options=t.getOptions(),this.imageCache=new Map}renderText(t,e){const{watermark:{data:n,opacity:i,font:l,size:r,color:a,repeat:c,gap:d,numberType:u},scale:R}=this.options,h=this.draw.getWidth(),T=this.draw.getHeight();t.save(),t.globalAlpha=i,t.font=`${r*R}px ${l}`;let g=n;const f=new RegExp(ro.PAGE_NO);f.test(g)&&(g=kn.formatNumberPlaceholder(g,e+1,f,u));const m=new RegExp(ro.PAGE_COUNT);m.test(g)&&(g=kn.formatNumberPlaceholder(g,this.draw.getPageCount(),m,u));const p=t.measureText(g);if(c){const I=this.draw.getPagePixelRatio(),C=document.createElement("canvas"),E=C.getContext("2d"),O=p.width,P=p.actualBoundingBoxAscent+p.actualBoundingBoxDescent,S=Math.sqrt(Math.pow(O,2)+Math.pow(P,2)),X=S+2*d[0]*R,U=S+2*d[1]*R;C.width=X,C.height=U,C.style.width=`${X*I}px`,C.style.height=`${U*I}px`,E.translate(X/2,U/2),E.rotate(-45*Math.PI/180),E.translate(-X/2,-U/2),E.font=`${r*R}px ${l}`,E.fillStyle=a,E.fillText(g,(X-O)/2,(U-P)/2+p.actualBoundingBoxAscent);const b=t.createPattern(C,"repeat");b&&(t.fillStyle=b,t.fillRect(0,0,h,T))}else{const I=h/2,C=T/2;t.fillStyle=a,t.translate(I,C),t.rotate(-45*Math.PI/180),t.fillText(g,-p.width/2,p.actualBoundingBoxAscent-r*R/2)}t.restore()}renderImage(t){const{watermark:{width:e,height:n,data:i,opacity:l,repeat:r,gap:a},scale:c}=this.options;if(!this.imageCache.has(i)){const T=new Image;T.setAttribute("crossOrigin","Anonymous"),T.src=i,T.onload=()=>{this.imageCache.set(i,T),this.draw.render({isCompute:!1,isSubmitHistory:!1})};return}const d=this.draw.getWidth(),u=this.draw.getHeight(),R=e*c,h=n*c;if(t.save(),t.globalAlpha=l,r){const T=this.draw.getPagePixelRatio(),g=document.createElement("canvas"),f=g.getContext("2d"),m=Math.sqrt(Math.pow(R,2)+Math.pow(h,2)),p=m+2*a[0]*c,I=m+2*a[1]*c;g.width=p,g.height=I,g.style.width=`${p*T}px`,g.style.height=`${I*T}px`,f.translate(p/2,I/2),f.rotate(-45*Math.PI/180),f.translate(-p/2,-I/2),f.drawImage(this.imageCache.get(i),(p-R)/2,(I-h)/2,R,h);const C=t.createPattern(g,"repeat");C&&(t.fillStyle=C,t.fillRect(0,0,d,u))}else{const T=d/2,g=u/2;t.translate(T,g),t.rotate(-45*Math.PI/180),t.drawImage(this.imageCache.get(i),-R/2,-h/2,R,h)}t.restore()}render(t,e){this.options.watermark.type===s.WatermarkType.IMAGE?this.renderImage(t):this.renderText(t,e)}}class jd{draw;control;options;highlightList;highlightMatchResult;constructor(t){this.draw=t.getDraw(),this.control=t,this.options=this.draw.getOptions(),this.highlightList=[],this.highlightMatchResult=[]}getControlHighlight(t,e){const{control:{activeBackgroundColor:n,disabledBackgroundColor:i,existValueBackgroundColor:l,noValueBackgroundColor:r,inlineControlBackgroundColor:a}}=this.options,c=t[e],d=this.draw.isPrintLikeMode(),u=this.draw.getMode(),R=u===s.EditorMode.EDIT||u===s.EditorMode.FORM,h=this.control.getActiveControl()?.getElement(),T=this._getControlType(t,e);let g=!1,f=!1,m=!1,p=!1;c.highlight||(g=!d&&!!n&&!!h&&c.controlId===h.controlId&&!this.control.getIsRangeInPostfix()),g||(f=!d&&!!i&&!!c.control?.disabled),f||(m=!d&&!!l&&!!c.controlId&&this.control.getIsExistValueByElementListIndex(t,e)),m||(p=!d&&!!r&&!!c.controlId&&!this.control.getIsExistValueByElementListIndex(t,e));const I=R&&!!a&&(T===s.ControlType.SELECT||T===s.ControlType.DATE);return(g?n:"")||(f?i:"")||(m?l:"")||(p?r:"")||(I?a:"")}getIsInlineControlBackground(t,e){const n=this.draw.getMode(),i=this._getControlType(t,e);return!!((n===s.EditorMode.EDIT||n===s.EditorMode.FORM)&&this.options.control.inlineControlBackgroundColor&&(i===s.ControlType.SELECT||i===s.ControlType.DATE))}_getControlType(t,e){const n=t[e];if(n.control?.type)return n.control.type;if(n.controlId){for(let i=e-1;i>=0;i--){const l=t[i];if(l.controlId!==n.controlId)break;if(l.control?.type)return l.control.type}for(let i=e+1;i<t.length;i++){const l=t[i];if(l.controlId!==n.controlId)break;if(l.control?.type)return l.control.type}}}getHighlightMatchResult(){return this.highlightMatchResult}getHighlightList(){return this.highlightList}setHighlightList(t){this.highlightList=t}computeHighlightList(){const t=this.draw.getSearch(),e=(n,i)=>{let l=0;for(;l<n.length;){const r=n[l];if(l++,r.type===s.ElementType.TABLE){const g=r.trList;for(let f=0;f<g.length;f++){const m=g[f];for(let p=0;p<m.tdList.length;p++){const I=m.tdList[p],C={tableId:r.id,tableIndex:l-1,trIndex:f,tdIndex:p,tdId:I.id};e(I.value,C)}}}const a=r?.control;if(!a)continue;const c=this.highlightList.findIndex(g=>g.id===r.controlId||a.conceptId&&a.conceptId===g.conceptId);if(!~c)continue;const d=l;let u=l;for(;u<n.length&&n[u].controlId===r.controlId;)u++;l=u;const R=n.slice(d,u).map(g=>g.controlComponent===s.ControlComponent.VALUE?g:{value:B}),h=this.highlightList[c],{ruleList:T}=h;for(let g=0;g<T.length;g++){const f=T[g],m=t.getMatchList(f.keyword,R);this.highlightMatchResult.push(...m.map(p=>({...p,...f,...i,index:p.index+d})))}}};this.highlightMatchResult=[],e(this.draw.getOriginalMainElementList())}renderHighlightList(t,e){if(!this.highlightMatchResult?.length)return;const{searchMatchAlpha:n,searchMatchColor:i}=this.options,l=this.draw.getPosition().getOriginalPositionList(),r=this.draw.getOriginalElementList();t.save();for(let a=0;a<this.highlightMatchResult.length;a++){const c=this.highlightMatchResult[a];let d=null;if(c.tableId){const{tableIndex:I,trIndex:C,tdIndex:E,index:O}=c;d=r[I]?.trList[C].tdList[E]?.positionList[O]}else d=l[c.index];if(!d)continue;const{coordinate:{leftTop:u,leftBottom:R,rightTop:h},pageNo:T}=d;if(T!==e)continue;t.fillStyle=c.backgroundColor||i,t.globalAlpha=c.alpha||n;const g=u[0],f=u[1],m=h[0]-u[0],p=R[1]-u[1];t.fillRect(g,f,m,p)}t.restore()}}const Vr={error:{borderColor:"#ff4d4f",backgroundColor:"rgba(255,77,79,0.08)"},warning:{borderColor:"#faad14",backgroundColor:"rgba(250,173,20,0.08)"},warn:{borderColor:"#faad14",backgroundColor:"rgba(250,173,20,0.08)"},info:{borderColor:"#1677ff",backgroundColor:"rgba(22,119,255,0.08)"}},qd="#ff4d4f",tu=5e3,qi=4;class eu{draw;options;marks;underlineTimer;underlineVisible;constructor(t){this.draw=t,this.options=t.getOptions(),this.marks=[],this.underlineTimer=null,this.underlineVisible=!1}setMarks(t){this._clearUnderlineTimer(),this.marks=t.slice(),this.underlineVisible=this.marks.length>0,this.marks.length&&(this.underlineTimer=window.setTimeout(()=>{this.underlineVisible=!1,this.underlineTimer=null,this.draw.render({isSetCursor:!1,isSubmitHistory:!1})},tu))}getMarks(){return this.marks}render(t,e,n,i,l,r,a){if(!this.marks.length||this.draw.isPrintLikeMode())return;const c=this._getRegions(e,n,i,l,r,a);if(c.length){t.save();for(let d=0;d<c.length;d++){const u=c[d],R=this._getStyle(u.mark),h=Math.max(1,this.options.scale),T=u.x-h,g=u.y-h,f=Math.max(1,u.width+h*2),m=Math.max(1,u.height+h*2),p=Math.max(2,this.options.scale*2);if(this.underlineVisible&&R.borderColor&&u.hasUnderline&&(t.lineWidth=p,t.strokeStyle=R.borderColor,t.beginPath(),t.moveTo(u.underlineX,u.underlineY),t.lineTo(u.underlineRight,u.underlineY),t.stroke()),u.drawRequired){this._renderRequiredMark(t,u,T);continue}if(R.borderColor){t.lineWidth=p;const I=Math.min(Math.max(8*this.options.scale,m*.3),m/2),C=T+f,E=g+m;t.beginPath(),u.drawLeft&&(t.moveTo(T+I,g),t.lineTo(T,g),t.lineTo(T,E)),u.drawRight&&(t.moveTo(C-I,E),t.lineTo(C,E),t.lineTo(C,g)),t.stroke()}}t.restore()}}_getRegions(t,e,n,i,l,r){const a=this._getParentMap(t),c=this.marks.map(h=>this._getTargetControlIds(t,h)),d=c.map(h=>this._getTitleTargets(t,h)),u=[];for(let h=0;h<n.length;h++){const T=n[h],g=new Map,f=e[T.startIndex],m=f?Math.min(f.coordinate.leftTop[0],f.coordinate.leftBottom[0])-(T.offsetX||0):0,p=f?m+(r||this.draw.getInnerWidth()):0;for(let I=0;I<T.elementList.length;I++){const C=T.elementList[I],E=T.startIndex+I,O=e[E];if(!O||l===s.EditorZone.MAIN&&O.pageNo!==i)continue;const P=this._getTargetIdsForElement(this._getQualityTargetId(C),c,a);for(let W=0;W<d.length;W++){const H=d[W].get(E);H&&H.forEach(Q=>{P.some(A=>A.markIndex===W&&A.controlId===Q)||P.push({markIndex:W,controlId:Q})})}if(!P.length)continue;const S=O.coordinate.leftTop,X=O.coordinate.rightTop,U=O.coordinate.leftBottom,b=O.coordinate.rightBottom,M=Math.min(S[0],U[0]),V=Math.max(X[0],b[0]),N=Math.min(S[1],X[1]),y=Math.max(U[1],b[1]),L=O.metrics.boundingBoxAscent+O.metrics.boundingBoxDescent,F=N+O.ascent-O.metrics.boundingBoxAscent,D=L>0?F:N,Y=L>0?F+L:y,Z=this._isButtonElement(C),_=f?Math.max(M,Math.min(V,p)):V;for(let W=0;W<P.length;W++){const{markIndex:H,controlId:Q}=P[W],A=`${H}:${Q}:${T.startIndex}`,K=g.get(A),x={x:M,y:D,right:V,bottom:Y};if(K){const v=this._mergeBounds(K,x);K.x=v.x,K.y=v.y,K.width=Math.max(1,v.right-v.x),K.height=Math.max(1,v.bottom-v.y),Z||(K.hasUnderline?(K.underlineX=Math.min(K.underlineX,M),K.underlineY=Math.max(K.underlineY,Y+qi),K.underlineRight=Math.max(K.underlineRight,_)):(K.underlineX=M,K.underlineY=Y+qi,K.underlineRight=_),K.hasUnderline=!0)}else g.set(A,{mark:this.marks[H],targetKey:`${H}:${Q}`,x:M,y:D,width:Math.max(1,V-M),height:Math.max(1,Y-D),baseline:N+O.ascent,font:C.style||this.draw.getElementFont(C,this.options.scale),underlineX:M,underlineY:Y+qi,underlineRight:_,hasUnderline:!Z,drawLeft:!1,drawRight:!1,drawRequired:!1})}}u.push(...g.values())}const R=new Map;for(let h=0;h<u.length;h++){const T=u[h],g=R.get(T.targetKey)||[];g.push(T),R.set(T.targetKey,g)}return R.forEach(h=>{this._isRequiredMark(h[0].mark)?h[0].drawRequired=!0:(h[0].drawLeft=!0,h[h.length-1].drawRight=!0)}),u}_renderRequiredMark(t,e,n){t.save(),t.font=e.font,t.fillStyle=e.mark.style?.borderColor||qd,t.textBaseline="alphabetic";const i=t.measureText("*").width,l=Math.max(2,this.options.scale*2);t.fillText("*",n-i-l,e.baseline),t.restore()}_clearUnderlineTimer(){this.underlineTimer!==null&&(window.clearTimeout(this.underlineTimer),this.underlineTimer=null)}_mergeBounds(t,e){return{x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),right:Math.max(t.x+t.width,e.right),bottom:Math.max(t.y+t.height,e.bottom)}}_getParentMap(t){const e=new Map;for(let n=0;n<t.length;n++){const i=t[n],l=this._getQualityTargetId(i);l&&i.originControlId&&e.set(l,i.originControlId)}return e}_getTitleTargets(t,e){const n=new Map;return e.forEach(i=>{const l=t.findIndex(h=>this._getQualityTargetId(h)===i);if(l<0)return;const r=t[l],a=r.control,c=this._getTitleTextBefore(t,l);if(!c)return;const d=[a?.label,a?.placeholder].concat(this._isMacroElement(r)?[r.label]:[]).filter(Boolean).map(h=>this._normalizeTitleText(h)),u=this._normalizeTitleText(c);if(!d.some(h=>h===u||h.includes(u)||u.includes(h)))return;let R=l-1;for(;R>=0&&this._isTitleValueElement(t[R]);){let h=n.get(R);h||(h=new Set,n.set(R,h)),h.add(i),R--}}),n}_getTitleTextBefore(t,e){const n=t[e-1];if(n?.type===s.ElementType.TITLE)return n.valueList?.map(r=>r.value).join("")||"";if(!this._isTitleValueElement(n))return"";const i=n.titleId;let l=e-1;for(;l>=0&&this._isTitleValueElement(t[l])&&t[l].titleId===i;)l--;return t.slice(l+1,e).map(r=>r.value).join("")}_isTitleValueElement(t){return!!t?.titleId&&!!t.level}_normalizeTitleText(t){return t.replace(/\s/g,"").replace(/[::]+$/,"")}_getTargetControlIds(t,e){const n=new Set,i=e.id?"id":e.conceptId?"conceptId":e.code?"code":null;if(!i)return n;for(let l=0;l<t.length;l++){const r=t[l],a=this._getQualityTargetId(r);if(!a)continue;const c=r.control?.conceptId||r.conceptId,d=r.control?.code||r.macroConfig?.code||r.dictCode;(i==="id"&&a===e.id||i==="conceptId"&&c===e.conceptId||i==="code"&&d===e.code)&&n.add(a)}return n}_getQualityTargetId(t){if(t.controlId)return t.controlId;if(this._isMacroElement(t))return t.id}_isMacroElement(t){return[s.ElementType.MACRO,s.ElementType.CUSTOM_MACRO,s.ElementType.REUSABLE_ITEM].includes(t.type)}_getTargetIdsForElement(t,e,n){if(!t)return[];const i=[];for(let l=0;l<e.length;l++){const r=e[l];let a=t;const c=new Set;for(;a&&!c.has(a);){if(r.has(a)){i.push({markIndex:l,controlId:a});break}c.add(a),a=n.get(a)}}return i}_getStyle(t){return{...Vr[t.type?.toLowerCase()||"error"]||Vr.error,...t.style}}_isRequiredMark(t){return t.required===!0||["required","required-empty","required_empty"].includes(t.type?.toLowerCase()||"")}_isButtonElement(t){return t.type===s.ElementType.BUTTON||t.control?.type===s.ControlType.BUTTON&&!t.control.buttonText}}class nu{borderRect;options;constructor(t){this.borderRect=this.clearBorderInfo(),this.options=t.getOptions()}clearBorderInfo(){return this.borderRect={x:0,y:0,width:0,height:0},this.borderRect}recordBorderInfo(t,e,n,i){!this.borderRect.width&&(this.borderRect.x=t,this.borderRect.y=e,this.borderRect.height=i),this.borderRect.width+=n}render(t){if(!this.borderRect.width)return;const{scale:e,control:{borderWidth:n,borderColor:i}}=this.options,{x:l,y:r,width:a,height:c}=this.borderRect;t.save(),t.translate(0,1*e),t.lineWidth=n*e,t.strokeStyle=i,t.beginPath(),t.rect(l,r,a,c),t.stroke(),t.restore(),this.clearBorderInfo()}}class co{draw;element;control;isPopup;selectDom;options;VALUE_DELIMITER=",";DEFAULT_MULTI_SELECT_DELIMITER=",";constructor(t,e){const n=e.getDraw();this.draw=n,this.options=n.getOptions(),this.element=t,this.control=e,this.isPopup=!1,this.selectDom=null}setElement(t){this.element=t}getElement(){return this.element}getIsPopup(){return this.isPopup}getCodes(){return this.element?.control?.code?this.element.control.code.split(","):[]}getText(t){if(!this.element?.control)return null;const e=this.element.control;if(!e.valueSets?.length)return null;const n=e?.multiSelectDelimiter||this.DEFAULT_MULTI_SELECT_DELIMITER,i=e.valueSets,l=[];return t.forEach(r=>{const a=i.find(c=>c.code===r);a&&!ks(a.value)&&l.push(a.value)}),l.join(n)||null}getValue(t={}){const{elementList:e,range:n}=this.control.mergeControl(t),{startIndex:i}=n,l=e[i],r=[];let a=i;for(;a>=0;){const d=e[a];if(!d||d.controlId!==l.controlId||d.controlComponent===s.ControlComponent.PREFIX||d.controlComponent===s.ControlComponent.PRE_TEXT)break;d.controlComponent===s.ControlComponent.VALUE&&r.unshift(d),a--}let c=i+1;for(;c<e.length;){const d=e[c];if(d.controlId!==l.controlId||d.controlComponent===s.ControlComponent.POSTFIX||d.controlComponent===s.ControlComponent.POST_TEXT)break;d.controlComponent===s.ControlComponent.VALUE&&r.push(d),c++}return r}setValue(t,e={},n={}){if(!this.element.control?.selectExclusiveOptions?.inputAble||!n.isIgnoreDisabledRule&&this.control.getIsDisabledControl(e))return-1;const{elementList:i,range:l}=this.control.mergeControl(e);this.control.shrinkBoundary(e);const{startIndex:r,endIndex:a}=l,c=this.control.getDraw();r!==a?c.spliceElementList(i,r+1,a-r):this.control.removePlaceholder(r,{elementList:i});const d=i[r],u=d.type&&!Le.includes(d.type)||d.controlComponent===s.ControlComponent.PREFIX||d.controlComponent===s.ControlComponent.PRE_TEXT?Jt(d,["control","controlId",...he]):Ee(d,["type"]),R=l.startIndex+1;for(let h=0;h<t.length;h++){const T={...u,...t[h],controlComponent:s.ControlComponent.VALUE};ae(i,[T],r,{editorOptions:this.options}),c.spliceElementList(i,R+h,0,[T])}return R+t.length-1}keydown(t){if(this.control.getIsDisabledControl())return null;const e=this.control.getElementList(),n=this.control.getRange();this.control.shrinkBoundary();const{startIndex:i,endIndex:l}=n,r=e[i],a=e[l],c=this.element.control?.selectExclusiveOptions?.inputAble;if(t.key===s.KeyMap.Backspace)return i!==l?c?(this.draw.spliceElementList(e,i+1,l-i),this.getValue().length||this.control.addPlaceholder(i),i):this.clearSelect():r.controlComponent===s.ControlComponent.PREFIX||r.controlComponent===s.ControlComponent.PRE_TEXT||a.controlComponent===s.ControlComponent.POSTFIX||a.controlComponent===s.ControlComponent.POST_TEXT||r.controlComponent===s.ControlComponent.PLACEHOLDER?this.control.removeControl(i):c?(this.draw.spliceElementList(e,i,1),this.getValue().length||this.control.addPlaceholder(i-1),i-1):this.clearSelect();if(t.key===s.KeyMap.Delete){if(i!==l)return c?(this.draw.spliceElementList(e,i+1,l-i),this.getValue().length||this.control.addPlaceholder(i),i):this.clearSelect();{const d=e[l+1];return(r.controlComponent===s.ControlComponent.PREFIX||r.controlComponent===s.ControlComponent.PRE_TEXT)&&d.controlComponent===s.ControlComponent.PLACEHOLDER||d.controlComponent===s.ControlComponent.POSTFIX||d.controlComponent===s.ControlComponent.POST_TEXT||r.controlComponent===s.ControlComponent.PLACEHOLDER?this.control.removeControl(i):c?(this.draw.spliceElementList(e,i+1,1),this.getValue().length||this.control.addPlaceholder(i),i):this.clearSelect()}}return l}cut(){if(this.control.getIsDisabledControl())return-1;this.control.shrinkBoundary();const{startIndex:t,endIndex:e}=this.control.getRange();return t===e?t:this.clearSelect()}clearSelect(t={},e={}){const{isIgnoreDisabledRule:n=!1,isAddPlaceholder:i=!0}=e;if(!n&&this.control.getIsDisabledControl(t))return-1;const l=t.elementList||this.control.getElementList(),{startIndex:r}=t.range||this.control.getRange(),a=l[r];let c=-1,d=-1,u=r;for(;u>0;){const T=l[u];if(T.controlId!==a.controlId||T.controlComponent===s.ControlComponent.PREFIX||T.controlComponent===s.ControlComponent.PRE_TEXT){c=u;break}u--}let R=r+1;for(;R<l.length;){const T=l[R];if(T.controlId!==a.controlId||T.controlComponent===s.ControlComponent.POSTFIX||T.controlComponent===s.ControlComponent.POST_TEXT){d=R-1;break}R++}return!~c||!~d?-1:(this.control.getDraw().spliceElementList(l,c+1,d-c,[],{isIgnoreDeletedRule:e.isIgnoreDeletedRule}),i&&this.control.addPlaceholder(u,t),this.control.setControlProperties({code:void 0},{elementList:l,range:{startIndex:u,endIndex:u}}),u)}setSelect(t,e={},n={}){if(!n.isIgnoreDisabledRule&&this.control.getIsDisabledControl(e))return;const i=e.elementList||this.control.getElementList(),l=e.range||this.control.getRange(),r=this.element.control,a=t?.split(this.VALUE_DELIMITER)||[],c=r.code,d=r.code?.split(this.VALUE_DELIMITER)||[],u=r.isMultiSelect;if(!u&&t===c||u&&xs(d,a)){this.control.repaintControl({curIndex:l.startIndex,isCompute:!1,isSubmitHistory:!1}),this.destroy();return}const R=r.valueSets;if(!Array.isArray(R)||!R.length)return;const h=this.getText(a);if(!h){if(c){const E=this.clearSelect(e,{isIgnoreDeletedRule:n.isIgnoreDeletedRule});~E&&(this.control.repaintControl({curIndex:E}),this.control.emitControlContentChange({controlValue:[]}))}return}const T=this.getValue(e)[0],g=T?Jt(T,Ne):Jt(i[l.startIndex],he),f=this.clearSelect(e,{isAddPlaceholder:!1,isIgnoreDeletedRule:n.isIgnoreDeletedRule});if(!~f)return;c||this.control.removePlaceholder(f,e);const m=Ee(i[f],Ne),p=f+1,I=bt(h),C=this.control.getDraw();for(let E=0;E<I.length;E++){const O={...g,...m,type:s.ElementType.TEXT,value:I[E],controlComponent:s.ControlComponent.VALUE};(O.color===this.options.control.bracketColor||O.color===this.options.control.placeholderColor)&&(O.color=this.options.defaultColor),ae(i,[O],f,{editorOptions:this.options}),C.spliceElementList(i,p+E,0,[O])}if(this.control.setControlProperties({code:t},{elementList:i,range:{startIndex:f,endIndex:f}}),!e.range){const E=p+I.length-1;this.control.repaintControl({curIndex:E}),this.control.emitControlContentChange({context:e}),u||this.destroy()}}_createSelectPopupDom(){const t=this.element.control,e=t.valueSets;if(!Array.isArray(e)||!e.length)return;const n=this.control.getPosition();if(!n)return;const i=document.createElement("div");i.classList.add(`${st}-select-control-popup`),i.setAttribute(ve,s.EditorComponent.POPUP);const l=g=>{g.stopPropagation()};i.addEventListener("mousedown",l),i.addEventListener("mouseup",l),i.addEventListener("click",l),i.addEventListener("keydown",l),i.addEventListener("input",l);const r=document.createElement("input");r.type="search",r.classList.add(`${st}-select-control-search`),r.placeholder=this.draw.getI18n().t("select.search")||"搜索选项",r.setAttribute("aria-label",r.placeholder);const a=document.createElement("ul");a.setAttribute("role","listbox");const c=(g="")=>{for(;a.firstChild;)a.removeChild(a.firstChild);const f=g.trim().toLocaleLowerCase(),m=e.filter(O=>f?[O.value,O.code].some(P=>P.toLocaleLowerCase().includes(f)):!0),p=this.getCodes(),I=m.findIndex(O=>p.includes(O.code)),C=I>=0?I:0;let E=null;for(let O=0;O<m.length;O++){const P=m[O],S=document.createElement("li");S.setAttribute("role","option"),p.includes(P.code)&&(S.classList.add("active"),E=S),O===C&&(S.classList.add("keyboard-active"),S.setAttribute("aria-selected","true")),S.onclick=()=>{const X=this.getCodes(),U=X.findIndex(b=>b===P.code);t.isMultiSelect?~U?X.splice(U,1):X.push(P.code):~U?X.length=0:X.splice(0,X.length,P.code),this.setSelect(X.join(this.VALUE_DELIMITER)),t.isMultiSelect&&c(r.value)},S.append(document.createTextNode(P.value)),a.append(S)}if(!m.length){const O=document.createElement("li");O.classList.add(`${st}-select-control-empty`),O.textContent=this.draw.getI18n().t("select.empty")||"无匹配项",a.append(O)}E&&Mi(i,E)};r.addEventListener("input",()=>{c(r.value)}),r.addEventListener("keydown",g=>{if(g.key==="ArrowDown"||g.key==="ArrowUp"){g.preventDefault();const f=Array.from(a.querySelectorAll("li:not(.ce-select-control-empty)"));if(!f.length)return;const m=f.findIndex(C=>C.classList.contains("keyboard-active")),p=g.key==="ArrowDown"?1:-1,I=m<0?p>0?0:f.length-1:(m+p+f.length)%f.length;f.forEach((C,E)=>{const O=E===I;C.classList.toggle("keyboard-active",O),C.setAttribute("aria-selected",String(O))}),Mi(i,f[I]);return}if(g.key==="Enter"){g.preventDefault(),a.querySelector("li.keyboard-active")?.click();return}g.key==="Escape"&&this.destroy()}),i.append(r,a);const{coordinate:{leftTop:[d,u]},lineHeight:R}=n,h=this.control.getPreY();i.style.left=`${d}px`,i.style.top=`${u+h+R}px`,this.control.getContainer().append(i),this.selectDom=i,c(),Pi(()=>{window.setTimeout(()=>{this.selectDom===i&&i.isConnected&&r.focus()})})}awake(){if(this.isPopup||this.control.getIsDisabledControl())return;const{startIndex:t}=this.control.getRange(),n=this.control.getElementList()[t];!n||n.controlId!==this.element.controlId||n.controlComponent===s.ControlComponent.POSTFIX||n.controlComponent===s.ControlComponent.POSTTEXTFIX||n.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT||n.controlComponent===s.ControlComponent.POST_TEXT||(this._createSelectPopupDom(),this.isPopup=!0)}destroy(){this.isPopup&&(this.selectDom?.remove(),this.isPopup=!1)}}var Wr;function at(){return Wr.apply(null,arguments)}function ou(o){Wr=o}function Ve(o){return o instanceof Array||Object.prototype.toString.call(o)==="[object Array]"}function Dn(o){return o!=null&&Object.prototype.toString.call(o)==="[object Object]"}function _t(o,t){return Object.prototype.hasOwnProperty.call(o,t)}function ts(o){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(o).length===0;var t;for(t in o)if(_t(o,t))return!1;return!0}function pe(o){return o===void 0}function qe(o){return typeof o=="number"||Object.prototype.toString.call(o)==="[object Number]"}function uo(o){return o instanceof Date||Object.prototype.toString.call(o)==="[object Date]"}function Ur(o,t){var e=[],n,i=o.length;for(n=0;n<i;++n)e.push(t(o[n],n));return e}function gn(o,t){for(var e in t)_t(t,e)&&(o[e]=t[e]);return _t(t,"toString")&&(o.toString=t.toString),_t(t,"valueOf")&&(o.valueOf=t.valueOf),o}function Be(o,t,e,n){return al(o,t,e,n,!0).utc()}function iu(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}}function Nt(o){return o._pf==null&&(o._pf=iu()),o._pf}var es;Array.prototype.some?es=Array.prototype.some:es=function(o){var t=Object(this),e=t.length>>>0,n;for(n=0;n<e;n++)if(n in t&&o.call(this,t[n],n,t))return!0;return!1};function ns(o){var t=null,e=!1,n=o._d&&!isNaN(o._d.getTime());if(n&&(t=Nt(o),e=es.call(t.parsedDateParts,function(i){return i!=null}),n=t.overflow<0&&!t.empty&&!t.invalidEra&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&e),o._strict&&(n=n&&t.charsLeftOver===0&&t.unusedTokens.length===0&&t.bigHour===void 0)),Object.isFrozen==null||!Object.isFrozen(o))o._isValid=n;else return n;return o._isValid}function _o(o){var t=Be(NaN);return o!=null?gn(Nt(t),o):Nt(t).userInvalidated=!0,t}var Yr=at.momentProperties=[],os=!1;function is(o,t){var e,n,i,l=Yr.length;if(pe(t._isAMomentObject)||(o._isAMomentObject=t._isAMomentObject),pe(t._i)||(o._i=t._i),pe(t._f)||(o._f=t._f),pe(t._l)||(o._l=t._l),pe(t._strict)||(o._strict=t._strict),pe(t._tzm)||(o._tzm=t._tzm),pe(t._isUTC)||(o._isUTC=t._isUTC),pe(t._offset)||(o._offset=t._offset),pe(t._pf)||(o._pf=Nt(t)),pe(t._locale)||(o._locale=t._locale),l>0)for(e=0;e<l;e++)n=Yr[e],i=t[n],pe(i)||(o[n]=i);return o}function ho(o){is(this,o),this._d=new Date(o._d!=null?o._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),os===!1&&(os=!0,at.updateOffset(this),os=!1)}function We(o){return o instanceof ho||o!=null&&o._isAMomentObject!=null}function wr(o){at.suppressDeprecationWarnings===!1&&typeof console<"u"&&console.warn&&console.warn("Deprecation warning: "+o)}function Fe(o,t){var e=!0;return gn(function(){if(at.deprecationHandler!=null&&at.deprecationHandler(null,o),e){var n=[],i,l,r,a=arguments.length;for(l=0;l<a;l++){if(i="",typeof arguments[l]=="object"){i+=`
|
|
122
122
|
[`+l+"] ";for(r in arguments[0])_t(arguments[0],r)&&(i+=r+": "+arguments[0][r]+", ");i=i.slice(0,-2)}else i=arguments[l];n.push(i)}wr(o+`
|
|
123
123
|
Arguments: `+Array.prototype.slice.call(n).join("")+`
|
|
124
|
-
`+new Error().stack),e=!1}return t.apply(this,arguments)},t)}var vr={};function Zr(o,t){at.deprecationHandler!=null&&at.deprecationHandler(o,t),vr[o]||(wr(t),vr[o]=!0)}at.suppressDeprecationWarnings=!1,at.deprecationHandler=null;function xe(o){return typeof Function<"u"&&o instanceof Function||Object.prototype.toString.call(o)==="[object Function]"}function su(o){var t,e;for(e in o)_t(o,e)&&(t=o[e],xe(t)?this[e]=t:this["_"+e]=t);this._config=o,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function ss(o,t){var e=gn({},o),n;for(n in t)_t(t,n)&&(Dn(o[n])&&Dn(t[n])?(e[n]={},gn(e[n],o[n]),gn(e[n],t[n])):t[n]!=null?e[n]=t[n]:delete e[n]);for(n in o)_t(o,n)&&!_t(t,n)&&Dn(o[n])&&(e[n]=gn({},e[n]));return e}function rs(o){o!=null&&this.set(o)}var ls;Object.keys?ls=Object.keys:ls=function(o){var t,e=[];for(t in o)_t(o,t)&&e.push(t);return e};var ru={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function lu(o,t,e){var n=this._calendar[o]||this._calendar.sameElse;return xe(n)?n.call(t,e):n}function ke(o,t,e){var n=""+Math.abs(o),i=t-n.length,l=o>=0;return(l?e?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+n}var as=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,Bo=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,cs={},Gn={};function mt(o,t,e,n){var i=n;typeof n=="string"&&(i=function(){return this[n]()}),o&&(Gn[o]=i),t&&(Gn[t[0]]=function(){return ke(i.apply(this,arguments),t[1],t[2])}),e&&(Gn[e]=function(){return this.localeData().ordinal(i.apply(this,arguments),o)})}function au(o){return o.match(/\[[\s\S]/)?o.replace(/^\[|\]$/g,""):o.replace(/\\/g,"")}function cu(o){var t=o.match(as),e,n;for(e=0,n=t.length;e<n;e++)Gn[t[e]]?t[e]=Gn[t[e]]:t[e]=au(t[e]);return function(i){var l="",r;for(r=0;r<n;r++)l+=xe(t[r])?t[r].call(i,o):t[r];return l}}function xo(o,t){return o.isValid()?(t=Qr(t,o.localeData()),cs[t]=cs[t]||cu(t),cs[t](o)):o.localeData().invalidDate()}function Qr(o,t){var e=5;function n(i){return t.longDateFormat(i)||i}for(Bo.lastIndex=0;e>=0&&Bo.test(o);)o=o.replace(Bo,n),Bo.lastIndex=0,e-=1;return o}var du={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function uu(o){var t=this._longDateFormat[o],e=this._longDateFormat[o.toUpperCase()];return t||!e?t:(this._longDateFormat[o]=e.match(as).map(function(n){return n==="MMMM"||n==="MM"||n==="DD"||n==="dddd"?n.slice(1):n}).join(""),this._longDateFormat[o])}var hu="Invalid date";function Ru(){return this._invalidDate}var gu="%d",Tu=/\d{1,2}/;function fu(o){return this._ordinal.replace("%d",o)}var mu={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function Cu(o,t,e,n){var i=this._relativeTime[e];return xe(i)?i(o,t,e,n):i.replace(/%d/i,o)}function pu(o,t){var e=this._relativeTime[o>0?"future":"past"];return xe(e)?e(t):e.replace(/%s/i,t)}var Hr={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function Xe(o){return typeof o=="string"?Hr[o]||Hr[o.toLowerCase()]:void 0}function ds(o){var t={},e,n;for(n in o)_t(o,n)&&(e=Xe(n),e&&(t[e]=o[n]));return t}var Iu={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function Eu(o){var t=[],e;for(e in o)_t(o,e)&&t.push({unit:e,priority:Iu[e]});return t.sort(function(n,i){return n.priority-i.priority}),t}var Kr=/\d/,Pe=/\d\d/,Ar=/\d{3}/,us=/\d{4}/,ko=/[+-]?\d{6}/,oe=/\d\d?/,_r=/\d\d\d\d?/,Br=/\d\d\d\d\d\d?/,Go=/\d{1,3}/,hs=/\d{1,4}/,Jo=/[+-]?\d{1,6}/,Jn=/\d+/,$o=/[+-]?\d+/,Lu=/Z|[+-]\d\d:?\d\d/gi,zo=/Z|[+-]\d\d(?::?\d\d)?/gi,Pu=/[+-]?\d+(\.\d{1,3})?/,Ro=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,$n=/^[1-9]\d?/,Rs=/^([1-9]\d|\d)/,jo;jo={};function dt(o,t,e){jo[o]=xe(t)?t:function(n,i){return n&&e?e:t}}function Mu(o,t){return _t(jo,o)?jo[o](t._strict,t._locale):new RegExp(Ou(o))}function Ou(o){return tn(o.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(t,e,n,i,l){return e||n||i||l}))}function tn(o){return o.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function ye(o){return o<0?Math.ceil(o)||0:Math.floor(o)}function wt(o){var t=+o,e=0;return t!==0&&isFinite(t)&&(e=ye(t)),e}var gs={};function $t(o,t){var e,n=t,i;for(typeof o=="string"&&(o=[o]),qe(t)&&(n=function(l,r){r[t]=wt(l)}),i=o.length,e=0;e<i;e++)gs[o[e]]=n}function go(o,t){$t(o,function(e,n,i,l){i._w=i._w||{},t(e,i._w,i,l)})}function Su(o,t,e){t!=null&&_t(gs,o)&&gs[o](t,e._a,e,o)}function qo(o){return o%4===0&&o%100!==0||o%400===0}var fe=0,en=1,Ge=2,Re=3,Ue=4,nn=5,Fn=6,Du=7,Fu=8;mt("Y",0,0,function(){var o=this.year();return o<=9999?ke(o,4):"+"+o}),mt(0,["YY",2],0,function(){return this.year()%100}),mt(0,["YYYY",4],0,"year"),mt(0,["YYYYY",5],0,"year"),mt(0,["YYYYYY",6,!0],0,"year"),dt("Y",$o),dt("YY",oe,Pe),dt("YYYY",hs,us),dt("YYYYY",Jo,ko),dt("YYYYYY",Jo,ko),$t(["YYYYY","YYYYYY"],fe),$t("YYYY",function(o,t){t[fe]=o.length===2?at.parseTwoDigitYear(o):wt(o)}),$t("YY",function(o,t){t[fe]=at.parseTwoDigitYear(o)}),$t("Y",function(o,t){t[fe]=parseInt(o,10)});function To(o){return qo(o)?366:365}at.parseTwoDigitYear=function(o){return wt(o)+(wt(o)>68?1900:2e3)};var xr=zn("FullYear",!0);function Xu(){return qo(this.year())}function zn(o,t){return function(e){return e!=null?(kr(this,o,e),at.updateOffset(this,t),this):fo(this,o)}}function fo(o,t){if(!o.isValid())return NaN;var e=o._d,n=o._isUTC;switch(t){case"Milliseconds":return n?e.getUTCMilliseconds():e.getMilliseconds();case"Seconds":return n?e.getUTCSeconds():e.getSeconds();case"Minutes":return n?e.getUTCMinutes():e.getMinutes();case"Hours":return n?e.getUTCHours():e.getHours();case"Date":return n?e.getUTCDate():e.getDate();case"Day":return n?e.getUTCDay():e.getDay();case"Month":return n?e.getUTCMonth():e.getMonth();case"FullYear":return n?e.getUTCFullYear():e.getFullYear();default:return NaN}}function kr(o,t,e){var n,i,l,r,a;if(!(!o.isValid()||isNaN(e))){switch(n=o._d,i=o._isUTC,t){case"Milliseconds":return void(i?n.setUTCMilliseconds(e):n.setMilliseconds(e));case"Seconds":return void(i?n.setUTCSeconds(e):n.setSeconds(e));case"Minutes":return void(i?n.setUTCMinutes(e):n.setMinutes(e));case"Hours":return void(i?n.setUTCHours(e):n.setHours(e));case"Date":return void(i?n.setUTCDate(e):n.setDate(e));case"FullYear":break;default:return}l=e,r=o.month(),a=o.date(),a=a===29&&r===1&&!qo(l)?28:a,i?n.setUTCFullYear(l,r,a):n.setFullYear(l,r,a)}}function yu(o){return o=Xe(o),xe(this[o])?this[o]():this}function Nu(o,t){if(typeof o=="object"){o=ds(o);var e=Eu(o),n,i=e.length;for(n=0;n<i;n++)this[e[n].unit](o[e[n].unit])}else if(o=Xe(o),xe(this[o]))return this[o](t);return this}function bu(o,t){return(o%t+t)%t}var ue;Array.prototype.indexOf?ue=Array.prototype.indexOf:ue=function(o){var t;for(t=0;t<this.length;++t)if(this[t]===o)return t;return-1};function Ts(o,t){if(isNaN(o)||isNaN(t))return NaN;var e=bu(t,12);return o+=(t-e)/12,e===1?qo(o)?29:28:31-e%7%2}mt("M",["MM",2],"Mo",function(){return this.month()+1}),mt("MMM",0,0,function(o){return this.localeData().monthsShort(this,o)}),mt("MMMM",0,0,function(o){return this.localeData().months(this,o)}),dt("M",oe,$n),dt("MM",oe,Pe),dt("MMM",function(o,t){return t.monthsShortRegex(o)}),dt("MMMM",function(o,t){return t.monthsRegex(o)}),$t(["M","MM"],function(o,t){t[en]=wt(o)-1}),$t(["MMM","MMMM"],function(o,t,e,n){var i=e._locale.monthsParse(o,n,e._strict);i!=null?t[en]=i:Nt(e).invalidMonth=o});var Vu="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Gr="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Jr=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Wu=Ro,Uu=Ro;function Yu(o,t){return o?Ve(this._months)?this._months[o.month()]:this._months[(this._months.isFormat||Jr).test(t)?"format":"standalone"][o.month()]:Ve(this._months)?this._months:this._months.standalone}function wu(o,t){return o?Ve(this._monthsShort)?this._monthsShort[o.month()]:this._monthsShort[Jr.test(t)?"format":"standalone"][o.month()]:Ve(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function vu(o,t,e){var n,i,l,r=o.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],n=0;n<12;++n)l=Be([2e3,n]),this._shortMonthsParse[n]=this.monthsShort(l,"").toLocaleLowerCase(),this._longMonthsParse[n]=this.months(l,"").toLocaleLowerCase();return e?t==="MMM"?(i=ue.call(this._shortMonthsParse,r),i!==-1?i:null):(i=ue.call(this._longMonthsParse,r),i!==-1?i:null):t==="MMM"?(i=ue.call(this._shortMonthsParse,r),i!==-1?i:(i=ue.call(this._longMonthsParse,r),i!==-1?i:null)):(i=ue.call(this._longMonthsParse,r),i!==-1?i:(i=ue.call(this._shortMonthsParse,r),i!==-1?i:null))}function Zu(o,t,e){var n,i,l;if(this._monthsParseExact)return vu.call(this,o,t,e);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),n=0;n<12;n++){if(i=Be([2e3,n]),e&&!this._longMonthsParse[n]&&(this._longMonthsParse[n]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[n]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),!e&&!this._monthsParse[n]&&(l="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[n]=new RegExp(l.replace(".",""),"i")),e&&t==="MMMM"&&this._longMonthsParse[n].test(o))return n;if(e&&t==="MMM"&&this._shortMonthsParse[n].test(o))return n;if(!e&&this._monthsParse[n].test(o))return n}}function $r(o,t){if(!o.isValid())return o;if(typeof t=="string"){if(/^\d+$/.test(t))t=wt(t);else if(t=o.localeData().monthsParse(t),!qe(t))return o}var e=t,n=o.date();return n=n<29?n:Math.min(n,Ts(o.year(),e)),o._isUTC?o._d.setUTCMonth(e,n):o._d.setMonth(e,n),o}function zr(o){return o!=null?($r(this,o),at.updateOffset(this,!0),this):fo(this,"Month")}function Qu(){return Ts(this.year(),this.month())}function Hu(o){return this._monthsParseExact?(_t(this,"_monthsRegex")||jr.call(this),o?this._monthsShortStrictRegex:this._monthsShortRegex):(_t(this,"_monthsShortRegex")||(this._monthsShortRegex=Wu),this._monthsShortStrictRegex&&o?this._monthsShortStrictRegex:this._monthsShortRegex)}function Ku(o){return this._monthsParseExact?(_t(this,"_monthsRegex")||jr.call(this),o?this._monthsStrictRegex:this._monthsRegex):(_t(this,"_monthsRegex")||(this._monthsRegex=Uu),this._monthsStrictRegex&&o?this._monthsStrictRegex:this._monthsRegex)}function jr(){function o(c,d){return d.length-c.length}var t=[],e=[],n=[],i,l,r,a;for(i=0;i<12;i++)l=Be([2e3,i]),r=tn(this.monthsShort(l,"")),a=tn(this.months(l,"")),t.push(r),e.push(a),n.push(a),n.push(r);t.sort(o),e.sort(o),n.sort(o),this._monthsRegex=new RegExp("^("+n.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+e.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+t.join("|")+")","i")}function Au(o,t,e,n,i,l,r){var a;return o<100&&o>=0?(a=new Date(o+400,t,e,n,i,l,r),isFinite(a.getFullYear())&&a.setFullYear(o)):a=new Date(o,t,e,n,i,l,r),a}function mo(o){var t,e;return o<100&&o>=0?(e=Array.prototype.slice.call(arguments),e[0]=o+400,t=new Date(Date.UTC.apply(null,e)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(o)):t=new Date(Date.UTC.apply(null,arguments)),t}function ti(o,t,e){var n=7+t-e,i=(7+mo(o,0,n).getUTCDay()-t)%7;return-i+n-1}function qr(o,t,e,n,i){var l=(7+e-n)%7,r=ti(o,n,i),a=1+7*(t-1)+l+r,c,d;return a<=0?(c=o-1,d=To(c)+a):a>To(o)?(c=o+1,d=a-To(o)):(c=o,d=a),{year:c,dayOfYear:d}}function Co(o,t,e){var n=ti(o.year(),t,e),i=Math.floor((o.dayOfYear()-n-1)/7)+1,l,r;return i<1?(r=o.year()-1,l=i+on(r,t,e)):i>on(o.year(),t,e)?(l=i-on(o.year(),t,e),r=o.year()+1):(r=o.year(),l=i),{week:l,year:r}}function on(o,t,e){var n=ti(o,t,e),i=ti(o+1,t,e);return(To(o)-n+i)/7}mt("w",["ww",2],"wo","week"),mt("W",["WW",2],"Wo","isoWeek"),dt("w",oe,$n),dt("ww",oe,Pe),dt("W",oe,$n),dt("WW",oe,Pe),go(["w","ww","W","WW"],function(o,t,e,n){t[n.substr(0,1)]=wt(o)});function _u(o){return Co(o,this._week.dow,this._week.doy).week}var Bu={dow:0,doy:6};function xu(){return this._week.dow}function ku(){return this._week.doy}function Gu(o){var t=this.localeData().week(this);return o==null?t:this.add((o-t)*7,"d")}function Ju(o){var t=Co(this,1,4).week;return o==null?t:this.add((o-t)*7,"d")}mt("d",0,"do","day"),mt("dd",0,0,function(o){return this.localeData().weekdaysMin(this,o)}),mt("ddd",0,0,function(o){return this.localeData().weekdaysShort(this,o)}),mt("dddd",0,0,function(o){return this.localeData().weekdays(this,o)}),mt("e",0,0,"weekday"),mt("E",0,0,"isoWeekday"),dt("d",oe),dt("e",oe),dt("E",oe),dt("dd",function(o,t){return t.weekdaysMinRegex(o)}),dt("ddd",function(o,t){return t.weekdaysShortRegex(o)}),dt("dddd",function(o,t){return t.weekdaysRegex(o)}),go(["dd","ddd","dddd"],function(o,t,e,n){var i=e._locale.weekdaysParse(o,n,e._strict);i!=null?t.d=i:Nt(e).invalidWeekday=o}),go(["d","e","E"],function(o,t,e,n){t[n]=wt(o)});function $u(o,t){return typeof o!="string"?o:isNaN(o)?(o=t.weekdaysParse(o),typeof o=="number"?o:null):parseInt(o,10)}function zu(o,t){return typeof o=="string"?t.weekdaysParse(o)%7||7:isNaN(o)?null:o}function fs(o,t){return o.slice(t,7).concat(o.slice(0,t))}var ju="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),tl="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),qu="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),th=Ro,eh=Ro,nh=Ro;function oh(o,t){var e=Ve(this._weekdays)?this._weekdays:this._weekdays[o&&o!==!0&&this._weekdays.isFormat.test(t)?"format":"standalone"];return o===!0?fs(e,this._week.dow):o?e[o.day()]:e}function ih(o){return o===!0?fs(this._weekdaysShort,this._week.dow):o?this._weekdaysShort[o.day()]:this._weekdaysShort}function sh(o){return o===!0?fs(this._weekdaysMin,this._week.dow):o?this._weekdaysMin[o.day()]:this._weekdaysMin}function rh(o,t,e){var n,i,l,r=o.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],n=0;n<7;++n)l=Be([2e3,1]).day(n),this._minWeekdaysParse[n]=this.weekdaysMin(l,"").toLocaleLowerCase(),this._shortWeekdaysParse[n]=this.weekdaysShort(l,"").toLocaleLowerCase(),this._weekdaysParse[n]=this.weekdays(l,"").toLocaleLowerCase();return e?t==="dddd"?(i=ue.call(this._weekdaysParse,r),i!==-1?i:null):t==="ddd"?(i=ue.call(this._shortWeekdaysParse,r),i!==-1?i:null):(i=ue.call(this._minWeekdaysParse,r),i!==-1?i:null):t==="dddd"?(i=ue.call(this._weekdaysParse,r),i!==-1||(i=ue.call(this._shortWeekdaysParse,r),i!==-1)?i:(i=ue.call(this._minWeekdaysParse,r),i!==-1?i:null)):t==="ddd"?(i=ue.call(this._shortWeekdaysParse,r),i!==-1||(i=ue.call(this._weekdaysParse,r),i!==-1)?i:(i=ue.call(this._minWeekdaysParse,r),i!==-1?i:null)):(i=ue.call(this._minWeekdaysParse,r),i!==-1||(i=ue.call(this._weekdaysParse,r),i!==-1)?i:(i=ue.call(this._shortWeekdaysParse,r),i!==-1?i:null))}function lh(o,t,e){var n,i,l;if(this._weekdaysParseExact)return rh.call(this,o,t,e);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),n=0;n<7;n++){if(i=Be([2e3,1]).day(n),e&&!this._fullWeekdaysParse[n]&&(this._fullWeekdaysParse[n]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[n]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[n]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[n]||(l="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[n]=new RegExp(l.replace(".",""),"i")),e&&t==="dddd"&&this._fullWeekdaysParse[n].test(o))return n;if(e&&t==="ddd"&&this._shortWeekdaysParse[n].test(o))return n;if(e&&t==="dd"&&this._minWeekdaysParse[n].test(o))return n;if(!e&&this._weekdaysParse[n].test(o))return n}}function ah(o){if(!this.isValid())return o!=null?this:NaN;var t=fo(this,"Day");return o!=null?(o=$u(o,this.localeData()),this.add(o-t,"d")):t}function ch(o){if(!this.isValid())return o!=null?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return o==null?t:this.add(o-t,"d")}function dh(o){if(!this.isValid())return o!=null?this:NaN;if(o!=null){var t=zu(o,this.localeData());return this.day(this.day()%7?t:t-7)}else return this.day()||7}function uh(o){return this._weekdaysParseExact?(_t(this,"_weekdaysRegex")||ms.call(this),o?this._weekdaysStrictRegex:this._weekdaysRegex):(_t(this,"_weekdaysRegex")||(this._weekdaysRegex=th),this._weekdaysStrictRegex&&o?this._weekdaysStrictRegex:this._weekdaysRegex)}function hh(o){return this._weekdaysParseExact?(_t(this,"_weekdaysRegex")||ms.call(this),o?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(_t(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=eh),this._weekdaysShortStrictRegex&&o?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Rh(o){return this._weekdaysParseExact?(_t(this,"_weekdaysRegex")||ms.call(this),o?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(_t(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=nh),this._weekdaysMinStrictRegex&&o?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function ms(){function o(u,R){return R.length-u.length}var t=[],e=[],n=[],i=[],l,r,a,c,d;for(l=0;l<7;l++)r=Be([2e3,1]).day(l),a=tn(this.weekdaysMin(r,"")),c=tn(this.weekdaysShort(r,"")),d=tn(this.weekdays(r,"")),t.push(a),e.push(c),n.push(d),i.push(a),i.push(c),i.push(d);t.sort(o),e.sort(o),n.sort(o),i.sort(o),this._weekdaysRegex=new RegExp("^("+i.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+n.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+e.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+t.join("|")+")","i")}function Cs(){return this.hours()%12||12}function gh(){return this.hours()||24}mt("H",["HH",2],0,"hour"),mt("h",["hh",2],0,Cs),mt("k",["kk",2],0,gh),mt("hmm",0,0,function(){return""+Cs.apply(this)+ke(this.minutes(),2)}),mt("hmmss",0,0,function(){return""+Cs.apply(this)+ke(this.minutes(),2)+ke(this.seconds(),2)}),mt("Hmm",0,0,function(){return""+this.hours()+ke(this.minutes(),2)}),mt("Hmmss",0,0,function(){return""+this.hours()+ke(this.minutes(),2)+ke(this.seconds(),2)});function el(o,t){mt(o,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}el("a",!0),el("A",!1);function nl(o,t){return t._meridiemParse}dt("a",nl),dt("A",nl),dt("H",oe,Rs),dt("h",oe,$n),dt("k",oe,$n),dt("HH",oe,Pe),dt("hh",oe,Pe),dt("kk",oe,Pe),dt("hmm",_r),dt("hmmss",Br),dt("Hmm",_r),dt("Hmmss",Br),$t(["H","HH"],Re),$t(["k","kk"],function(o,t,e){var n=wt(o);t[Re]=n===24?0:n}),$t(["a","A"],function(o,t,e){e._isPm=e._locale.isPM(o),e._meridiem=o}),$t(["h","hh"],function(o,t,e){t[Re]=wt(o),Nt(e).bigHour=!0}),$t("hmm",function(o,t,e){var n=o.length-2;t[Re]=wt(o.substr(0,n)),t[Ue]=wt(o.substr(n)),Nt(e).bigHour=!0}),$t("hmmss",function(o,t,e){var n=o.length-4,i=o.length-2;t[Re]=wt(o.substr(0,n)),t[Ue]=wt(o.substr(n,2)),t[nn]=wt(o.substr(i)),Nt(e).bigHour=!0}),$t("Hmm",function(o,t,e){var n=o.length-2;t[Re]=wt(o.substr(0,n)),t[Ue]=wt(o.substr(n))}),$t("Hmmss",function(o,t,e){var n=o.length-4,i=o.length-2;t[Re]=wt(o.substr(0,n)),t[Ue]=wt(o.substr(n,2)),t[nn]=wt(o.substr(i))});function Th(o){return(o+"").toLowerCase().charAt(0)==="p"}var fh=/[ap]\.?m?\.?/i,mh=zn("Hours",!0);function Ch(o,t,e){return o>11?e?"pm":"PM":e?"am":"AM"}var ol={calendar:ru,longDateFormat:du,invalidDate:hu,ordinal:gu,dayOfMonthOrdinalParse:Tu,relativeTime:mu,months:Vu,monthsShort:Gr,week:Bu,weekdays:ju,weekdaysMin:qu,weekdaysShort:tl,meridiemParse:fh},se={},po={},Io;function ph(o,t){var e,n=Math.min(o.length,t.length);for(e=0;e<n;e+=1)if(o[e]!==t[e])return e;return n}function il(o){return o&&o.toLowerCase().replace("_","-")}function Ih(o){for(var t=0,e,n,i,l;t<o.length;){for(l=il(o[t]).split("-"),e=l.length,n=il(o[t+1]),n=n?n.split("-"):null;e>0;){if(i=ei(l.slice(0,e).join("-")),i)return i;if(n&&n.length>=e&&ph(l,n)>=e-1)break;e--}t++}return Io}function Eh(o){return!!(o&&o.match("^[^/\\\\]*$"))}function ei(o){var t=null,e;if(se[o]===void 0&&typeof module<"u"&&module&&module.exports&&Eh(o))try{t=Io._abbr,e=require,e("./locale/"+o),Tn(t)}catch{se[o]=null}return se[o]}function Tn(o,t){var e;return o&&(pe(t)?e=sn(o):e=ps(o,t),e?Io=e:typeof console<"u"&&console.warn&&console.warn("Locale "+o+" not found. Did you forget to load it?")),Io._abbr}function ps(o,t){if(t!==null){var e,n=ol;if(t.abbr=o,se[o]!=null)Zr("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),n=se[o]._config;else if(t.parentLocale!=null)if(se[t.parentLocale]!=null)n=se[t.parentLocale]._config;else if(e=ei(t.parentLocale),e!=null)n=e._config;else return po[t.parentLocale]||(po[t.parentLocale]=[]),po[t.parentLocale].push({name:o,config:t}),null;return se[o]=new rs(ss(n,t)),po[o]&&po[o].forEach(function(i){ps(i.name,i.config)}),Tn(o),se[o]}else return delete se[o],null}function Lh(o,t){if(t!=null){var e,n,i=ol;se[o]!=null&&se[o].parentLocale!=null?se[o].set(ss(se[o]._config,t)):(n=ei(o),n!=null&&(i=n._config),t=ss(i,t),n==null&&(t.abbr=o),e=new rs(t),e.parentLocale=se[o],se[o]=e),Tn(o)}else se[o]!=null&&(se[o].parentLocale!=null?(se[o]=se[o].parentLocale,o===Tn()&&Tn(o)):se[o]!=null&&delete se[o]);return se[o]}function sn(o){var t;if(o&&o._locale&&o._locale._abbr&&(o=o._locale._abbr),!o)return Io;if(!Ve(o)){if(t=ei(o),t)return t;o=[o]}return Ih(o)}function Ph(){return ls(se)}function Is(o){var t,e=o._a;return e&&Nt(o).overflow===-2&&(t=e[en]<0||e[en]>11?en:e[Ge]<1||e[Ge]>Ts(e[fe],e[en])?Ge:e[Re]<0||e[Re]>24||e[Re]===24&&(e[Ue]!==0||e[nn]!==0||e[Fn]!==0)?Re:e[Ue]<0||e[Ue]>59?Ue:e[nn]<0||e[nn]>59?nn:e[Fn]<0||e[Fn]>999?Fn:-1,Nt(o)._overflowDayOfYear&&(t<fe||t>Ge)&&(t=Ge),Nt(o)._overflowWeeks&&t===-1&&(t=Du),Nt(o)._overflowWeekday&&t===-1&&(t=Fu),Nt(o).overflow=t),o}var Mh=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Oh=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Sh=/Z|[+-]\d\d(?::?\d\d)?/,ni=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],Es=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Dh=/^\/?Date\((-?\d+)/i,Fh=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,Xh={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function sl(o){var t,e,n=o._i,i=Mh.exec(n)||Oh.exec(n),l,r,a,c,d=ni.length,u=Es.length;if(i){for(Nt(o).iso=!0,t=0,e=d;t<e;t++)if(ni[t][1].exec(i[1])){r=ni[t][0],l=ni[t][2]!==!1;break}if(r==null){o._isValid=!1;return}if(i[3]){for(t=0,e=u;t<e;t++)if(Es[t][1].exec(i[3])){a=(i[2]||" ")+Es[t][0];break}if(a==null){o._isValid=!1;return}}if(!l&&a!=null){o._isValid=!1;return}if(i[4])if(Sh.exec(i[4]))c="Z";else{o._isValid=!1;return}o._f=r+(a||"")+(c||""),Ps(o)}else o._isValid=!1}function yh(o,t,e,n,i,l){var r=[Nh(o),Gr.indexOf(t),parseInt(e,10),parseInt(n,10),parseInt(i,10)];return l&&r.push(parseInt(l,10)),r}function Nh(o){var t=parseInt(o,10);return t<=49?2e3+t:t<=999?1900+t:t}function bh(o){return o.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function Vh(o,t,e){if(o){var n=tl.indexOf(o),i=new Date(t[0],t[1],t[2]).getDay();if(n!==i)return Nt(e).weekdayMismatch=!0,e._isValid=!1,!1}return!0}function Wh(o,t,e){if(o)return Xh[o];if(t)return 0;var n=parseInt(e,10),i=n%100,l=(n-i)/100;return l*60+i}function rl(o){var t=Fh.exec(bh(o._i)),e;if(t){if(e=yh(t[4],t[3],t[2],t[5],t[6],t[7]),!Vh(t[1],e,o))return;o._a=e,o._tzm=Wh(t[8],t[9],t[10]),o._d=mo.apply(null,o._a),o._d.setUTCMinutes(o._d.getUTCMinutes()-o._tzm),Nt(o).rfc2822=!0}else o._isValid=!1}function Uh(o){var t=Dh.exec(o._i);if(t!==null){o._d=new Date(+t[1]);return}if(sl(o),o._isValid===!1)delete o._isValid;else return;if(rl(o),o._isValid===!1)delete o._isValid;else return;o._strict?o._isValid=!1:at.createFromInputFallback(o)}at.createFromInputFallback=Fe("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(o){o._d=new Date(o._i+(o._useUTC?" UTC":""))});function jn(o,t,e){return o??t??e}function Yh(o){var t=new Date(at.now());return o._useUTC?[t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()]:[t.getFullYear(),t.getMonth(),t.getDate()]}function Ls(o){var t,e,n=[],i,l,r;if(!o._d){for(i=Yh(o),o._w&&o._a[Ge]==null&&o._a[en]==null&&wh(o),o._dayOfYear!=null&&(r=jn(o._a[fe],i[fe]),(o._dayOfYear>To(r)||o._dayOfYear===0)&&(Nt(o)._overflowDayOfYear=!0),e=mo(r,0,o._dayOfYear),o._a[en]=e.getUTCMonth(),o._a[Ge]=e.getUTCDate()),t=0;t<3&&o._a[t]==null;++t)o._a[t]=n[t]=i[t];for(;t<7;t++)o._a[t]=n[t]=o._a[t]==null?t===2?1:0:o._a[t];o._a[Re]===24&&o._a[Ue]===0&&o._a[nn]===0&&o._a[Fn]===0&&(o._nextDay=!0,o._a[Re]=0),o._d=(o._useUTC?mo:Au).apply(null,n),l=o._useUTC?o._d.getUTCDay():o._d.getDay(),o._tzm!=null&&o._d.setUTCMinutes(o._d.getUTCMinutes()-o._tzm),o._nextDay&&(o._a[Re]=24),o._w&&typeof o._w.d<"u"&&o._w.d!==l&&(Nt(o).weekdayMismatch=!0)}}function wh(o){var t,e,n,i,l,r,a,c,d;t=o._w,t.GG!=null||t.W!=null||t.E!=null?(l=1,r=4,e=jn(t.GG,o._a[fe],Co(ie(),1,4).year),n=jn(t.W,1),i=jn(t.E,1),(i<1||i>7)&&(c=!0)):(l=o._locale._week.dow,r=o._locale._week.doy,d=Co(ie(),l,r),e=jn(t.gg,o._a[fe],d.year),n=jn(t.w,d.week),t.d!=null?(i=t.d,(i<0||i>6)&&(c=!0)):t.e!=null?(i=t.e+l,(t.e<0||t.e>6)&&(c=!0)):i=l),n<1||n>on(e,l,r)?Nt(o)._overflowWeeks=!0:c!=null?Nt(o)._overflowWeekday=!0:(a=qr(e,n,i,l,r),o._a[fe]=a.year,o._dayOfYear=a.dayOfYear)}at.ISO_8601=function(){},at.RFC_2822=function(){};function Ps(o){if(o._f===at.ISO_8601){sl(o);return}if(o._f===at.RFC_2822){rl(o);return}o._a=[],Nt(o).empty=!0;var t=""+o._i,e,n,i,l,r,a=t.length,c=0,d,u;for(i=Qr(o._f,o._locale).match(as)||[],u=i.length,e=0;e<u;e++)l=i[e],n=(t.match(Mu(l,o))||[])[0],n&&(r=t.substr(0,t.indexOf(n)),r.length>0&&Nt(o).unusedInput.push(r),t=t.slice(t.indexOf(n)+n.length),c+=n.length),Gn[l]?(n?Nt(o).empty=!1:Nt(o).unusedTokens.push(l),Su(l,n,o)):o._strict&&!n&&Nt(o).unusedTokens.push(l);Nt(o).charsLeftOver=a-c,t.length>0&&Nt(o).unusedInput.push(t),o._a[Re]<=12&&Nt(o).bigHour===!0&&o._a[Re]>0&&(Nt(o).bigHour=void 0),Nt(o).parsedDateParts=o._a.slice(0),Nt(o).meridiem=o._meridiem,o._a[Re]=vh(o._locale,o._a[Re],o._meridiem),d=Nt(o).era,d!==null&&(o._a[fe]=o._locale.erasConvertYear(d,o._a[fe])),Ls(o),Is(o)}function vh(o,t,e){var n;return e==null?t:o.meridiemHour!=null?o.meridiemHour(t,e):(o.isPM!=null&&(n=o.isPM(e),n&&t<12&&(t+=12),!n&&t===12&&(t=0)),t)}function Zh(o){var t,e,n,i,l,r,a=!1,c=o._f.length;if(c===0){Nt(o).invalidFormat=!0,o._d=new Date(NaN);return}for(i=0;i<c;i++)l=0,r=!1,t=is({},o),o._useUTC!=null&&(t._useUTC=o._useUTC),t._f=o._f[i],Ps(t),ns(t)&&(r=!0),l+=Nt(t).charsLeftOver,l+=Nt(t).unusedTokens.length*10,Nt(t).score=l,a?l<n&&(n=l,e=t):(n==null||l<n||r)&&(n=l,e=t,r&&(a=!0));gn(o,e||t)}function Qh(o){if(!o._d){var t=ds(o._i),e=t.day===void 0?t.date:t.day;o._a=Ur([t.year,t.month,e,t.hour,t.minute,t.second,t.millisecond],function(n){return n&&parseInt(n,10)}),Ls(o)}}function Hh(o){var t=new ho(Is(ll(o)));return t._nextDay&&(t.add(1,"d"),t._nextDay=void 0),t}function ll(o){var t=o._i,e=o._f;return o._locale=o._locale||sn(o._l),t===null||e===void 0&&t===""?_o({nullInput:!0}):(typeof t=="string"&&(o._i=t=o._locale.preparse(t)),We(t)?new ho(Is(t)):(uo(t)?o._d=t:Ve(e)?Zh(o):e?Ps(o):Kh(o),ns(o)||(o._d=null),o))}function Kh(o){var t=o._i;pe(t)?o._d=new Date(at.now()):uo(t)?o._d=new Date(t.valueOf()):typeof t=="string"?Uh(o):Ve(t)?(o._a=Ur(t.slice(0),function(e){return parseInt(e,10)}),Ls(o)):Dn(t)?Qh(o):qe(t)?o._d=new Date(t):at.createFromInputFallback(o)}function al(o,t,e,n,i){var l={};return(t===!0||t===!1)&&(n=t,t=void 0),(e===!0||e===!1)&&(n=e,e=void 0),(Dn(o)&&ts(o)||Ve(o)&&o.length===0)&&(o=void 0),l._isAMomentObject=!0,l._useUTC=l._isUTC=i,l._l=e,l._i=o,l._f=t,l._strict=n,Hh(l)}function ie(o,t,e,n){return al(o,t,e,n,!1)}var Ah=Fe("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var o=ie.apply(null,arguments);return this.isValid()&&o.isValid()?o<this?this:o:_o()}),_h=Fe("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var o=ie.apply(null,arguments);return this.isValid()&&o.isValid()?o>this?this:o:_o()});function cl(o,t){var e,n;if(t.length===1&&Ve(t[0])&&(t=t[0]),!t.length)return ie();for(e=t[0],n=1;n<t.length;++n)(!t[n].isValid()||t[n][o](e))&&(e=t[n]);return e}function Bh(){var o=[].slice.call(arguments,0);return cl("isBefore",o)}function xh(){var o=[].slice.call(arguments,0);return cl("isAfter",o)}var kh=function(){return Date.now?Date.now():+new Date},Eo=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Gh(o){var t,e=!1,n,i=Eo.length;for(t in o)if(_t(o,t)&&!(ue.call(Eo,t)!==-1&&(o[t]==null||!isNaN(o[t]))))return!1;for(n=0;n<i;++n)if(o[Eo[n]]){if(e)return!1;parseFloat(o[Eo[n]])!==wt(o[Eo[n]])&&(e=!0)}return!0}function Jh(){return this._isValid}function $h(){return Ye(NaN)}function oi(o){var t=ds(o),e=t.year||0,n=t.quarter||0,i=t.month||0,l=t.week||t.isoWeek||0,r=t.day||0,a=t.hour||0,c=t.minute||0,d=t.second||0,u=t.millisecond||0;this._isValid=Gh(t),this._milliseconds=+u+d*1e3+c*6e4+a*1e3*60*60,this._days=+r+l*7,this._months=+i+n*3+e*12,this._data={},this._locale=sn(),this._bubble()}function ii(o){return o instanceof oi}function Ms(o){return o<0?Math.round(-1*o)*-1:Math.round(o)}function zh(o,t,e){var n=Math.min(o.length,t.length),i=Math.abs(o.length-t.length),l=0,r;for(r=0;r<n;r++)wt(o[r])!==wt(t[r])&&l++;return l+i}function dl(o,t){mt(o,0,0,function(){var e=this.utcOffset(),n="+";return e<0&&(e=-e,n="-"),n+ke(~~(e/60),2)+t+ke(~~e%60,2)})}dl("Z",":"),dl("ZZ",""),dt("Z",zo),dt("ZZ",zo),$t(["Z","ZZ"],function(o,t,e){e._useUTC=!0,e._tzm=Os(zo,o)});var jh=/([\+\-]|\d\d)/gi;function Os(o,t){var e=(t||"").match(o),n,i,l;return e===null?null:(n=e[e.length-1]||[],i=(n+"").match(jh)||["-",0,0],l=+(i[1]*60)+wt(i[2]),l===0?0:i[0]==="+"?l:-l)}function Ss(o,t){var e,n;return t._isUTC?(e=t.clone(),n=(We(o)||uo(o)?o.valueOf():ie(o).valueOf())-e.valueOf(),e._d.setTime(e._d.valueOf()+n),at.updateOffset(e,!1),e):ie(o).local()}function Ds(o){return-Math.round(o._d.getTimezoneOffset())}at.updateOffset=function(){};function qh(o,t,e){var n=this._offset||0,i;if(!this.isValid())return o!=null?this:NaN;if(o!=null){if(typeof o=="string"){if(o=Os(zo,o),o===null)return this}else Math.abs(o)<16&&!e&&(o=o*60);return!this._isUTC&&t&&(i=Ds(this)),this._offset=o,this._isUTC=!0,i!=null&&this.add(i,"m"),n!==o&&(!t||this._changeInProgress?gl(this,Ye(o-n,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,at.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?n:Ds(this)}function tR(o,t){return o!=null?(typeof o!="string"&&(o=-o),this.utcOffset(o,t),this):-this.utcOffset()}function eR(o){return this.utcOffset(0,o)}function nR(o){return this._isUTC&&(this.utcOffset(0,o),this._isUTC=!1,o&&this.subtract(Ds(this),"m")),this}function oR(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var o=Os(Lu,this._i);o!=null?this.utcOffset(o):this.utcOffset(0,!0)}return this}function iR(o){return this.isValid()?(o=o?ie(o).utcOffset():0,(this.utcOffset()-o)%60===0):!1}function sR(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function rR(){if(!pe(this._isDSTShifted))return this._isDSTShifted;var o={},t;return is(o,this),o=ll(o),o._a?(t=o._isUTC?Be(o._a):ie(o._a),this._isDSTShifted=this.isValid()&&zh(o._a,t.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function lR(){return this.isValid()?!this._isUTC:!1}function aR(){return this.isValid()?this._isUTC:!1}function ul(){return this.isValid()?this._isUTC&&this._offset===0:!1}var cR=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,dR=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Ye(o,t){var e=o,n=null,i,l,r;return ii(o)?e={ms:o._milliseconds,d:o._days,M:o._months}:qe(o)||!isNaN(+o)?(e={},t?e[t]=+o:e.milliseconds=+o):(n=cR.exec(o))?(i=n[1]==="-"?-1:1,e={y:0,d:wt(n[Ge])*i,h:wt(n[Re])*i,m:wt(n[Ue])*i,s:wt(n[nn])*i,ms:wt(Ms(n[Fn]*1e3))*i}):(n=dR.exec(o))?(i=n[1]==="-"?-1:1,e={y:Xn(n[2],i),M:Xn(n[3],i),w:Xn(n[4],i),d:Xn(n[5],i),h:Xn(n[6],i),m:Xn(n[7],i),s:Xn(n[8],i)}):e==null?e={}:typeof e=="object"&&("from"in e||"to"in e)&&(r=uR(ie(e.from),ie(e.to)),e={},e.ms=r.milliseconds,e.M=r.months),l=new oi(e),ii(o)&&_t(o,"_locale")&&(l._locale=o._locale),ii(o)&&_t(o,"_isValid")&&(l._isValid=o._isValid),l}Ye.fn=oi.prototype,Ye.invalid=$h;function Xn(o,t){var e=o&&parseFloat(o.replace(",","."));return(isNaN(e)?0:e)*t}function hl(o,t){var e={};return e.months=t.month()-o.month()+(t.year()-o.year())*12,o.clone().add(e.months,"M").isAfter(t)&&--e.months,e.milliseconds=+t-+o.clone().add(e.months,"M"),e}function uR(o,t){var e;return o.isValid()&&t.isValid()?(t=Ss(t,o),o.isBefore(t)?e=hl(o,t):(e=hl(t,o),e.milliseconds=-e.milliseconds,e.months=-e.months),e):{milliseconds:0,months:0}}function Rl(o,t){return function(e,n){var i,l;return n!==null&&!isNaN(+n)&&(Zr(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),l=e,e=n,n=l),i=Ye(e,n),gl(this,i,o),this}}function gl(o,t,e,n){var i=t._milliseconds,l=Ms(t._days),r=Ms(t._months);o.isValid()&&(n=n??!0,r&&$r(o,fo(o,"Month")+r*e),l&&kr(o,"Date",fo(o,"Date")+l*e),i&&o._d.setTime(o._d.valueOf()+i*e),n&&at.updateOffset(o,l||r))}var hR=Rl(1,"add"),RR=Rl(-1,"subtract");function Tl(o){return typeof o=="string"||o instanceof String}function gR(o){return We(o)||uo(o)||Tl(o)||qe(o)||fR(o)||TR(o)||o===null||o===void 0}function TR(o){var t=Dn(o)&&!ts(o),e=!1,n=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],i,l,r=n.length;for(i=0;i<r;i+=1)l=n[i],e=e||_t(o,l);return t&&e}function fR(o){var t=Ve(o),e=!1;return t&&(e=o.filter(function(n){return!qe(n)&&Tl(o)}).length===0),t&&e}function mR(o){var t=Dn(o)&&!ts(o),e=!1,n=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],i,l;for(i=0;i<n.length;i+=1)l=n[i],e=e||_t(o,l);return t&&e}function CR(o,t){var e=o.diff(t,"days",!0);return e<-6?"sameElse":e<-1?"lastWeek":e<0?"lastDay":e<1?"sameDay":e<2?"nextDay":e<7?"nextWeek":"sameElse"}function pR(o,t){arguments.length===1&&(arguments[0]?gR(arguments[0])?(o=arguments[0],t=void 0):mR(arguments[0])&&(t=arguments[0],o=void 0):(o=void 0,t=void 0));var e=o||ie(),n=Ss(e,this).startOf("day"),i=at.calendarFormat(this,n)||"sameElse",l=t&&(xe(t[i])?t[i].call(this,e):t[i]);return this.format(l||this.localeData().calendar(i,this,ie(e)))}function IR(){return new ho(this)}function ER(o,t){var e=We(o)?o:ie(o);return this.isValid()&&e.isValid()?(t=Xe(t)||"millisecond",t==="millisecond"?this.valueOf()>e.valueOf():e.valueOf()<this.clone().startOf(t).valueOf()):!1}function LR(o,t){var e=We(o)?o:ie(o);return this.isValid()&&e.isValid()?(t=Xe(t)||"millisecond",t==="millisecond"?this.valueOf()<e.valueOf():this.clone().endOf(t).valueOf()<e.valueOf()):!1}function PR(o,t,e,n){var i=We(o)?o:ie(o),l=We(t)?t:ie(t);return this.isValid()&&i.isValid()&&l.isValid()?(n=n||"()",(n[0]==="("?this.isAfter(i,e):!this.isBefore(i,e))&&(n[1]===")"?this.isBefore(l,e):!this.isAfter(l,e))):!1}function MR(o,t){var e=We(o)?o:ie(o),n;return this.isValid()&&e.isValid()?(t=Xe(t)||"millisecond",t==="millisecond"?this.valueOf()===e.valueOf():(n=e.valueOf(),this.clone().startOf(t).valueOf()<=n&&n<=this.clone().endOf(t).valueOf())):!1}function OR(o,t){return this.isSame(o,t)||this.isAfter(o,t)}function SR(o,t){return this.isSame(o,t)||this.isBefore(o,t)}function DR(o,t,e){var n,i,l;if(!this.isValid())return NaN;if(n=Ss(o,this),!n.isValid())return NaN;switch(i=(n.utcOffset()-this.utcOffset())*6e4,t=Xe(t),t){case"year":l=si(this,n)/12;break;case"month":l=si(this,n);break;case"quarter":l=si(this,n)/3;break;case"second":l=(this-n)/1e3;break;case"minute":l=(this-n)/6e4;break;case"hour":l=(this-n)/36e5;break;case"day":l=(this-n-i)/864e5;break;case"week":l=(this-n-i)/6048e5;break;default:l=this-n}return e?l:ye(l)}function si(o,t){if(o.date()<t.date())return-si(t,o);var e=(t.year()-o.year())*12+(t.month()-o.month()),n=o.clone().add(e,"months"),i,l;return t-n<0?(i=o.clone().add(e-1,"months"),l=(t-n)/(n-i)):(i=o.clone().add(e+1,"months"),l=(t-n)/(i-n)),-(e+l)||0}at.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",at.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function FR(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function XR(o){if(!this.isValid())return null;var t=o!==!0,e=t?this.clone().utc():this;return e.year()<0||e.year()>9999?xo(e,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):xe(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",xo(e,"Z")):xo(e,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function yR(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var o="moment",t="",e,n,i,l;return this.isLocal()||(o=this.utcOffset()===0?"moment.utc":"moment.parseZone",t="Z"),e="["+o+'("]',n=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",i="-MM-DD[T]HH:mm:ss.SSS",l=t+'[")]',this.format(e+n+i+l)}function NR(o){o||(o=this.isUtc()?at.defaultFormatUtc:at.defaultFormat);var t=xo(this,o);return this.localeData().postformat(t)}function bR(o,t){return this.isValid()&&(We(o)&&o.isValid()||ie(o).isValid())?Ye({to:this,from:o}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function VR(o){return this.from(ie(),o)}function WR(o,t){return this.isValid()&&(We(o)&&o.isValid()||ie(o).isValid())?Ye({from:this,to:o}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function UR(o){return this.to(ie(),o)}function fl(o){var t;return o===void 0?this._locale._abbr:(t=sn(o),t!=null&&(this._locale=t),this)}var ml=Fe("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(o){return o===void 0?this.localeData():this.locale(o)});function Cl(){return this._locale}var ri=1e3,qn=60*ri,li=60*qn,pl=(365*400+97)*24*li;function to(o,t){return(o%t+t)%t}function Il(o,t,e){return o<100&&o>=0?new Date(o+400,t,e)-pl:new Date(o,t,e).valueOf()}function El(o,t,e){return o<100&&o>=0?Date.UTC(o+400,t,e)-pl:Date.UTC(o,t,e)}function YR(o){var t,e;if(o=Xe(o),o===void 0||o==="millisecond"||!this.isValid())return this;switch(e=this._isUTC?El:Il,o){case"year":t=e(this.year(),0,1);break;case"quarter":t=e(this.year(),this.month()-this.month()%3,1);break;case"month":t=e(this.year(),this.month(),1);break;case"week":t=e(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=e(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=e(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=to(t+(this._isUTC?0:this.utcOffset()*qn),li);break;case"minute":t=this._d.valueOf(),t-=to(t,qn);break;case"second":t=this._d.valueOf(),t-=to(t,ri);break}return this._d.setTime(t),at.updateOffset(this,!0),this}function wR(o){var t,e;if(o=Xe(o),o===void 0||o==="millisecond"||!this.isValid())return this;switch(e=this._isUTC?El:Il,o){case"year":t=e(this.year()+1,0,1)-1;break;case"quarter":t=e(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=e(this.year(),this.month()+1,1)-1;break;case"week":t=e(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=e(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=e(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=li-to(t+(this._isUTC?0:this.utcOffset()*qn),li)-1;break;case"minute":t=this._d.valueOf(),t+=qn-to(t,qn)-1;break;case"second":t=this._d.valueOf(),t+=ri-to(t,ri)-1;break}return this._d.setTime(t),at.updateOffset(this,!0),this}function vR(){return this._d.valueOf()-(this._offset||0)*6e4}function ZR(){return Math.floor(this.valueOf()/1e3)}function QR(){return new Date(this.valueOf())}function HR(){var o=this;return[o.year(),o.month(),o.date(),o.hour(),o.minute(),o.second(),o.millisecond()]}function KR(){var o=this;return{years:o.year(),months:o.month(),date:o.date(),hours:o.hours(),minutes:o.minutes(),seconds:o.seconds(),milliseconds:o.milliseconds()}}function AR(){return this.isValid()?this.toISOString():null}function _R(){return ns(this)}function BR(){return gn({},Nt(this))}function xR(){return Nt(this).overflow}function kR(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}mt("N",0,0,"eraAbbr"),mt("NN",0,0,"eraAbbr"),mt("NNN",0,0,"eraAbbr"),mt("NNNN",0,0,"eraName"),mt("NNNNN",0,0,"eraNarrow"),mt("y",["y",1],"yo","eraYear"),mt("y",["yy",2],0,"eraYear"),mt("y",["yyy",3],0,"eraYear"),mt("y",["yyyy",4],0,"eraYear"),dt("N",Fs),dt("NN",Fs),dt("NNN",Fs),dt("NNNN",ig),dt("NNNNN",sg),$t(["N","NN","NNN","NNNN","NNNNN"],function(o,t,e,n){var i=e._locale.erasParse(o,n,e._strict);i?Nt(e).era=i:Nt(e).invalidEra=o}),dt("y",Jn),dt("yy",Jn),dt("yyy",Jn),dt("yyyy",Jn),dt("yo",rg),$t(["y","yy","yyy","yyyy"],fe),$t(["yo"],function(o,t,e,n){var i;e._locale._eraYearOrdinalRegex&&(i=o.match(e._locale._eraYearOrdinalRegex)),e._locale.eraYearOrdinalParse?t[fe]=e._locale.eraYearOrdinalParse(o,i):t[fe]=parseInt(o,10)});function GR(o,t){var e,n,i,l=this._eras||sn("en")._eras;for(e=0,n=l.length;e<n;++e)switch(typeof l[e].since==="string"&&(i=at(l[e].since).startOf("day"),l[e].since=i.valueOf()),typeof l[e].until){case"undefined":l[e].until=1/0;break;case"string":i=at(l[e].until).startOf("day").valueOf(),l[e].until=i.valueOf();break}return l}function JR(o,t,e){var n,i,l=this.eras(),r,a,c;for(o=o.toUpperCase(),n=0,i=l.length;n<i;++n)if(r=l[n].name.toUpperCase(),a=l[n].abbr.toUpperCase(),c=l[n].narrow.toUpperCase(),e)switch(t){case"N":case"NN":case"NNN":if(a===o)return l[n];break;case"NNNN":if(r===o)return l[n];break;case"NNNNN":if(c===o)return l[n];break}else if([r,a,c].indexOf(o)>=0)return l[n]}function $R(o,t){var e=o.since<=o.until?1:-1;return t===void 0?at(o.since).year():at(o.since).year()+(t-o.offset)*e}function zR(){var o,t,e,n=this.localeData().eras();for(o=0,t=n.length;o<t;++o)if(e=this.clone().startOf("day").valueOf(),n[o].since<=e&&e<=n[o].until||n[o].until<=e&&e<=n[o].since)return n[o].name;return""}function jR(){var o,t,e,n=this.localeData().eras();for(o=0,t=n.length;o<t;++o)if(e=this.clone().startOf("day").valueOf(),n[o].since<=e&&e<=n[o].until||n[o].until<=e&&e<=n[o].since)return n[o].narrow;return""}function qR(){var o,t,e,n=this.localeData().eras();for(o=0,t=n.length;o<t;++o)if(e=this.clone().startOf("day").valueOf(),n[o].since<=e&&e<=n[o].until||n[o].until<=e&&e<=n[o].since)return n[o].abbr;return""}function tg(){var o,t,e,n,i=this.localeData().eras();for(o=0,t=i.length;o<t;++o)if(e=i[o].since<=i[o].until?1:-1,n=this.clone().startOf("day").valueOf(),i[o].since<=n&&n<=i[o].until||i[o].until<=n&&n<=i[o].since)return(this.year()-at(i[o].since).year())*e+i[o].offset;return this.year()}function eg(o){return _t(this,"_erasNameRegex")||Xs.call(this),o?this._erasNameRegex:this._erasRegex}function ng(o){return _t(this,"_erasAbbrRegex")||Xs.call(this),o?this._erasAbbrRegex:this._erasRegex}function og(o){return _t(this,"_erasNarrowRegex")||Xs.call(this),o?this._erasNarrowRegex:this._erasRegex}function Fs(o,t){return t.erasAbbrRegex(o)}function ig(o,t){return t.erasNameRegex(o)}function sg(o,t){return t.erasNarrowRegex(o)}function rg(o,t){return t._eraYearOrdinalRegex||Jn}function Xs(){var o=[],t=[],e=[],n=[],i,l,r,a,c,d=this.eras();for(i=0,l=d.length;i<l;++i)r=tn(d[i].name),a=tn(d[i].abbr),c=tn(d[i].narrow),t.push(r),o.push(a),e.push(c),n.push(r),n.push(a),n.push(c);this._erasRegex=new RegExp("^("+n.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+t.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+o.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+e.join("|")+")","i")}mt(0,["gg",2],0,function(){return this.weekYear()%100}),mt(0,["GG",2],0,function(){return this.isoWeekYear()%100});function ai(o,t){mt(0,[o,o.length],0,t)}ai("gggg","weekYear"),ai("ggggg","weekYear"),ai("GGGG","isoWeekYear"),ai("GGGGG","isoWeekYear"),dt("G",$o),dt("g",$o),dt("GG",oe,Pe),dt("gg",oe,Pe),dt("GGGG",hs,us),dt("gggg",hs,us),dt("GGGGG",Jo,ko),dt("ggggg",Jo,ko),go(["gggg","ggggg","GGGG","GGGGG"],function(o,t,e,n){t[n.substr(0,2)]=wt(o)}),go(["gg","GG"],function(o,t,e,n){t[n]=at.parseTwoDigitYear(o)});function lg(o){return Ll.call(this,o,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)}function ag(o){return Ll.call(this,o,this.isoWeek(),this.isoWeekday(),1,4)}function cg(){return on(this.year(),1,4)}function dg(){return on(this.isoWeekYear(),1,4)}function ug(){var o=this.localeData()._week;return on(this.year(),o.dow,o.doy)}function hg(){var o=this.localeData()._week;return on(this.weekYear(),o.dow,o.doy)}function Ll(o,t,e,n,i){var l;return o==null?Co(this,n,i).year:(l=on(o,n,i),t>l&&(t=l),Rg.call(this,o,t,e,n,i))}function Rg(o,t,e,n,i){var l=qr(o,t,e,n,i),r=mo(l.year,0,l.dayOfYear);return this.year(r.getUTCFullYear()),this.month(r.getUTCMonth()),this.date(r.getUTCDate()),this}mt("Q",0,"Qo","quarter"),dt("Q",Kr),$t("Q",function(o,t){t[en]=(wt(o)-1)*3});function gg(o){return o==null?Math.ceil((this.month()+1)/3):this.month((o-1)*3+this.month()%3)}mt("D",["DD",2],"Do","date"),dt("D",oe,$n),dt("DD",oe,Pe),dt("Do",function(o,t){return o?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),$t(["D","DD"],Ge),$t("Do",function(o,t){t[Ge]=wt(o.match(oe)[0])});var Pl=zn("Date",!0);mt("DDD",["DDDD",3],"DDDo","dayOfYear"),dt("DDD",Go),dt("DDDD",Ar),$t(["DDD","DDDD"],function(o,t,e){e._dayOfYear=wt(o)});function Tg(o){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return o==null?t:this.add(o-t,"d")}mt("m",["mm",2],0,"minute"),dt("m",oe,Rs),dt("mm",oe,Pe),$t(["m","mm"],Ue);var fg=zn("Minutes",!1);mt("s",["ss",2],0,"second"),dt("s",oe,Rs),dt("ss",oe,Pe),$t(["s","ss"],nn);var mg=zn("Seconds",!1);mt("S",0,0,function(){return~~(this.millisecond()/100)}),mt(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),mt(0,["SSS",3],0,"millisecond"),mt(0,["SSSS",4],0,function(){return this.millisecond()*10}),mt(0,["SSSSS",5],0,function(){return this.millisecond()*100}),mt(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),mt(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),mt(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),mt(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),dt("S",Go,Kr),dt("SS",Go,Pe),dt("SSS",Go,Ar);var fn,Ml;for(fn="SSSS";fn.length<=9;fn+="S")dt(fn,Jn);function Cg(o,t){t[Fn]=wt(("0."+o)*1e3)}for(fn="S";fn.length<=9;fn+="S")$t(fn,Cg);Ml=zn("Milliseconds",!1),mt("z",0,0,"zoneAbbr"),mt("zz",0,0,"zoneName");function pg(){return this._isUTC?"UTC":""}function Ig(){return this._isUTC?"Coordinated Universal Time":""}var q=ho.prototype;q.add=hR,q.calendar=pR,q.clone=IR,q.diff=DR,q.endOf=wR,q.format=NR,q.from=bR,q.fromNow=VR,q.to=WR,q.toNow=UR,q.get=yu,q.invalidAt=xR,q.isAfter=ER,q.isBefore=LR,q.isBetween=PR,q.isSame=MR,q.isSameOrAfter=OR,q.isSameOrBefore=SR,q.isValid=_R,q.lang=ml,q.locale=fl,q.localeData=Cl,q.max=_h,q.min=Ah,q.parsingFlags=BR,q.set=Nu,q.startOf=YR,q.subtract=RR,q.toArray=HR,q.toObject=KR,q.toDate=QR,q.toISOString=XR,q.inspect=yR,typeof Symbol<"u"&&Symbol.for!=null&&(q[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),q.toJSON=AR,q.toString=FR,q.unix=ZR,q.valueOf=vR,q.creationData=kR,q.eraName=zR,q.eraNarrow=jR,q.eraAbbr=qR,q.eraYear=tg,q.year=xr,q.isLeapYear=Xu,q.weekYear=lg,q.isoWeekYear=ag,q.quarter=q.quarters=gg,q.month=zr,q.daysInMonth=Qu,q.week=q.weeks=Gu,q.isoWeek=q.isoWeeks=Ju,q.weeksInYear=ug,q.weeksInWeekYear=hg,q.isoWeeksInYear=cg,q.isoWeeksInISOWeekYear=dg,q.date=Pl,q.day=q.days=ah,q.weekday=ch,q.isoWeekday=dh,q.dayOfYear=Tg,q.hour=q.hours=mh,q.minute=q.minutes=fg,q.second=q.seconds=mg,q.millisecond=q.milliseconds=Ml,q.utcOffset=qh,q.utc=eR,q.local=nR,q.parseZone=oR,q.hasAlignedHourOffset=iR,q.isDST=sR,q.isLocal=lR,q.isUtcOffset=aR,q.isUtc=ul,q.isUTC=ul,q.zoneAbbr=pg,q.zoneName=Ig,q.dates=Fe("dates accessor is deprecated. Use date instead.",Pl),q.months=Fe("months accessor is deprecated. Use month instead",zr),q.years=Fe("years accessor is deprecated. Use year instead",xr),q.zone=Fe("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",tR),q.isDSTShifted=Fe("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",rR);function Eg(o){return ie(o*1e3)}function Lg(){return ie.apply(null,arguments).parseZone()}function Ol(o){return o}var Bt=rs.prototype;Bt.calendar=lu,Bt.longDateFormat=uu,Bt.invalidDate=Ru,Bt.ordinal=fu,Bt.preparse=Ol,Bt.postformat=Ol,Bt.relativeTime=Cu,Bt.pastFuture=pu,Bt.set=su,Bt.eras=GR,Bt.erasParse=JR,Bt.erasConvertYear=$R,Bt.erasAbbrRegex=ng,Bt.erasNameRegex=eg,Bt.erasNarrowRegex=og,Bt.months=Yu,Bt.monthsShort=wu,Bt.monthsParse=Zu,Bt.monthsRegex=Ku,Bt.monthsShortRegex=Hu,Bt.week=_u,Bt.firstDayOfYear=ku,Bt.firstDayOfWeek=xu,Bt.weekdays=oh,Bt.weekdaysMin=sh,Bt.weekdaysShort=ih,Bt.weekdaysParse=lh,Bt.weekdaysRegex=uh,Bt.weekdaysShortRegex=hh,Bt.weekdaysMinRegex=Rh,Bt.isPM=Th,Bt.meridiem=Ch;function ci(o,t,e,n){var i=sn(),l=Be().set(n,t);return i[e](l,o)}function Sl(o,t,e){if(qe(o)&&(t=o,o=void 0),o=o||"",t!=null)return ci(o,t,e,"month");var n,i=[];for(n=0;n<12;n++)i[n]=ci(o,n,e,"month");return i}function ys(o,t,e,n){typeof o=="boolean"?(qe(t)&&(e=t,t=void 0),t=t||""):(t=o,e=t,o=!1,qe(t)&&(e=t,t=void 0),t=t||"");var i=sn(),l=o?i._week.dow:0,r,a=[];if(e!=null)return ci(t,(e+l)%7,n,"day");for(r=0;r<7;r++)a[r]=ci(t,(r+l)%7,n,"day");return a}function Pg(o,t){return Sl(o,t,"months")}function Mg(o,t){return Sl(o,t,"monthsShort")}function Og(o,t,e){return ys(o,t,e,"weekdays")}function Sg(o,t,e){return ys(o,t,e,"weekdaysShort")}function Dg(o,t,e){return ys(o,t,e,"weekdaysMin")}Tn("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(o){var t=o%10,e=wt(o%100/10)===1?"th":t===1?"st":t===2?"nd":t===3?"rd":"th";return o+e}}),at.lang=Fe("moment.lang is deprecated. Use moment.locale instead.",Tn),at.langData=Fe("moment.langData is deprecated. Use moment.localeData instead.",sn);var rn=Math.abs;function Fg(){var o=this._data;return this._milliseconds=rn(this._milliseconds),this._days=rn(this._days),this._months=rn(this._months),o.milliseconds=rn(o.milliseconds),o.seconds=rn(o.seconds),o.minutes=rn(o.minutes),o.hours=rn(o.hours),o.months=rn(o.months),o.years=rn(o.years),this}function Dl(o,t,e,n){var i=Ye(t,e);return o._milliseconds+=n*i._milliseconds,o._days+=n*i._days,o._months+=n*i._months,o._bubble()}function Xg(o,t){return Dl(this,o,t,1)}function yg(o,t){return Dl(this,o,t,-1)}function Fl(o){return o<0?Math.floor(o):Math.ceil(o)}function Ng(){var o=this._milliseconds,t=this._days,e=this._months,n=this._data,i,l,r,a,c;return o>=0&&t>=0&&e>=0||o<=0&&t<=0&&e<=0||(o+=Fl(Ns(e)+t)*864e5,t=0,e=0),n.milliseconds=o%1e3,i=ye(o/1e3),n.seconds=i%60,l=ye(i/60),n.minutes=l%60,r=ye(l/60),n.hours=r%24,t+=ye(r/24),c=ye(Xl(t)),e+=c,t-=Fl(Ns(c)),a=ye(e/12),e%=12,n.days=t,n.months=e,n.years=a,this}function Xl(o){return o*4800/146097}function Ns(o){return o*146097/4800}function bg(o){if(!this.isValid())return NaN;var t,e,n=this._milliseconds;if(o=Xe(o),o==="month"||o==="quarter"||o==="year")switch(t=this._days+n/864e5,e=this._months+Xl(t),o){case"month":return e;case"quarter":return e/3;case"year":return e/12}else switch(t=this._days+Math.round(Ns(this._months)),o){case"week":return t/7+n/6048e5;case"day":return t+n/864e5;case"hour":return t*24+n/36e5;case"minute":return t*1440+n/6e4;case"second":return t*86400+n/1e3;case"millisecond":return Math.floor(t*864e5)+n;default:throw new Error("Unknown unit "+o)}}function ln(o){return function(){return this.as(o)}}var yl=ln("ms"),Vg=ln("s"),Wg=ln("m"),Ug=ln("h"),Yg=ln("d"),wg=ln("w"),vg=ln("M"),Zg=ln("Q"),Qg=ln("y"),Hg=yl;function Kg(){return Ye(this)}function Ag(o){return o=Xe(o),this.isValid()?this[o+"s"]():NaN}function yn(o){return function(){return this.isValid()?this._data[o]:NaN}}var _g=yn("milliseconds"),Bg=yn("seconds"),xg=yn("minutes"),kg=yn("hours"),Gg=yn("days"),Jg=yn("months"),$g=yn("years");function zg(){return ye(this.days()/7)}var an=Math.round,eo={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function jg(o,t,e,n,i){return i.relativeTime(t||1,!!e,o,n)}function qg(o,t,e,n){var i=Ye(o).abs(),l=an(i.as("s")),r=an(i.as("m")),a=an(i.as("h")),c=an(i.as("d")),d=an(i.as("M")),u=an(i.as("w")),R=an(i.as("y")),h=l<=e.ss&&["s",l]||l<e.s&&["ss",l]||r<=1&&["m"]||r<e.m&&["mm",r]||a<=1&&["h"]||a<e.h&&["hh",a]||c<=1&&["d"]||c<e.d&&["dd",c];return e.w!=null&&(h=h||u<=1&&["w"]||u<e.w&&["ww",u]),h=h||d<=1&&["M"]||d<e.M&&["MM",d]||R<=1&&["y"]||["yy",R],h[2]=t,h[3]=+o>0,h[4]=n,jg.apply(null,h)}function tT(o){return o===void 0?an:typeof o=="function"?(an=o,!0):!1}function eT(o,t){return eo[o]===void 0?!1:t===void 0?eo[o]:(eo[o]=t,o==="s"&&(eo.ss=t-1),!0)}function nT(o,t){if(!this.isValid())return this.localeData().invalidDate();var e=!1,n=eo,i,l;return typeof o=="object"&&(t=o,o=!1),typeof o=="boolean"&&(e=o),typeof t=="object"&&(n=Object.assign({},eo,t),t.s!=null&&t.ss==null&&(n.ss=t.s-1)),i=this.localeData(),l=qg(this,!e,n,i),e&&(l=i.pastFuture(+this,l)),i.postformat(l)}var bs=Math.abs;function no(o){return(o>0)-(o<0)||+o}function di(){if(!this.isValid())return this.localeData().invalidDate();var o=bs(this._milliseconds)/1e3,t=bs(this._days),e=bs(this._months),n,i,l,r,a=this.asSeconds(),c,d,u,R;return a?(n=ye(o/60),i=ye(n/60),o%=60,n%=60,l=ye(e/12),e%=12,r=o?o.toFixed(3).replace(/\.?0+$/,""):"",c=a<0?"-":"",d=no(this._months)!==no(a)?"-":"",u=no(this._days)!==no(a)?"-":"",R=no(this._milliseconds)!==no(a)?"-":"",c+"P"+(l?d+l+"Y":"")+(e?d+e+"M":"")+(t?u+t+"D":"")+(i||n||o?"T":"")+(i?R+i+"H":"")+(n?R+n+"M":"")+(o?R+r+"S":"")):"P0D"}var Qt=oi.prototype;Qt.isValid=Jh,Qt.abs=Fg,Qt.add=Xg,Qt.subtract=yg,Qt.as=bg,Qt.asMilliseconds=yl,Qt.asSeconds=Vg,Qt.asMinutes=Wg,Qt.asHours=Ug,Qt.asDays=Yg,Qt.asWeeks=wg,Qt.asMonths=vg,Qt.asQuarters=Zg,Qt.asYears=Qg,Qt.valueOf=Hg,Qt._bubble=Ng,Qt.clone=Kg,Qt.get=Ag,Qt.milliseconds=_g,Qt.seconds=Bg,Qt.minutes=xg,Qt.hours=kg,Qt.days=Gg,Qt.weeks=zg,Qt.months=Jg,Qt.years=$g,Qt.humanize=nT,Qt.toISOString=di,Qt.toString=di,Qt.toJSON=di,Qt.locale=fl,Qt.localeData=Cl,Qt.toIsoString=Fe("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",di),Qt.lang=ml,mt("X",0,0,"unix"),mt("x",0,0,"valueOf"),dt("x",$o),dt("X",Pu),$t("X",function(o,t,e){e._d=new Date(parseFloat(o)*1e3)}),$t("x",function(o,t,e){e._d=new Date(wt(o))});at.version="2.30.1",ou(ie),at.fn=q,at.min=Bh,at.max=xh,at.now=kh,at.utc=Be,at.unix=Eg,at.months=Pg,at.isDate=uo,at.locale=Tn,at.invalid=_o,at.duration=Ye,at.isMoment=We,at.weekdays=Og,at.parseZone=Lg,at.localeData=sn,at.isDuration=ii,at.monthsShort=Mg,at.weekdaysMin=Dg,at.defineLocale=ps,at.updateLocale=Lh,at.locales=Ph,at.weekdaysShort=Sg,at.normalizeUnits=Xe,at.relativeTimeRounding=tT,at.relativeTimeThreshold=eT,at.calendarFormat=CR,at.prototype=q,at.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"};const oT=new Set([s.ElementType.IMAGE,s.ElementType.MACRO,s.ElementType.CUSTOM_MACRO,s.ElementType.MENSTRUAL_HISTORY,s.ElementType.FETAL_HEART_POSITION,s.ElementType.TOOTH_POSITION]);class Vs{draws;ranges;element;control;options;position;constructor(t,e){const n=e.getDraw();this.draws=n,this.position=n.getPosition(),this.ranges=n.getRange(),this.options=n.getOptions(),this.element=t,this.control=e}setElement(t){this.element=t}getElement(){return this.element}getValue(t={}){const e=t.elementList||this.control.getElementList();let{startIndex:n}=t.range||this.control.getRange();const i=this.control.getDraw(),l=t?null:i.getTd();n>=e.length&&(n=e.length-1);const r=e[n],a=[];let c=l,d=e,u=n;for(;;){if(u<0&&c?.linkTdPrevId){const f=i.getTdById(c.linkTdPrevId);if(f){d=f.value,u=d.length-1,c=f;continue}}if(u<0)break;const g=d[u];if(g.controlId!==r.controlId||g.controlComponent===s.ControlComponent.PREFIX||g.controlComponent===s.ControlComponent.PRE_TEXT)break;g.controlComponent===s.ControlComponent.VALUE&&a.unshift(g),u--}c=l;let R=e,h=n+1;for(;;){if(h>=R.length&&c?.linkTdNextId){const f=i.getTdById(c.linkTdNextId);if(f){R=f.value,h=0,c=f;continue}}const g=R[h];if(!g||g.controlId!==r.controlId||g.controlComponent===s.ControlComponent.POSTFIX||g.controlComponent===s.ControlComponent.POST_TEXT)break;g.controlComponent===s.ControlComponent.VALUE&&a.push(g),h++}return a.filter(g=>g.type!==s.ElementType.SPLIT_TAG)}removeNextControlElement(t,e){const n=this.control.getDraw();if(e=e??n.getTd()?.linkTdNextId,e){const i=n.getTdById(e);if(i){if(i.value.length){if(i.value[1].controlId===t)return n.spliceElementList(i.value,1,1),i.value[1]}else if(i.linkTdNextId)return this.removeNextControlElement(t,i.linkTdNextId)}}}setValue(t,e={},n={}){if(!n.isIgnoreDisabledRule&&this.control.getIsDisabledControl(e))return-1;const i=e.range||this.control.getRange(),l=e.elementList||this.control.getElementList(),r=l[i.startIndex],a=l[i.startIndex+1],c=M=>!!(M&&(M.controlComponent===s.ControlComponent.POSTFIX||M.controlComponent===s.ControlComponent.POST_TEXT||M.controlComponent===s.ControlComponent.POSTTEXTFIX||M.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT)),d=!!(r?.originControlId&&c(r)&&a?.controlId===r.originControlId&&!a.originControlId&&a.control?.type===s.ControlType.TEXTFIELD&&c(a));let u=this.element.controlId||r?.controlId,R=this.element.originControlId||(this.element.controlId===r?.controlId?r?.originControlId:void 0),h=this.element.control||r.control;const T=!!(r?.controlId&&r.controlId!==this.element.controlId&&!r.originControlId&&r.control?.type===s.ControlType.TEXTFIELD);d?(u=r.originControlId,R=void 0,h=a.control):T&&(u=r.controlId,R=void 0,h=r.control);const g=(()=>{if(!u||!r?.subTemplateParentId||!c(r)||!Gt(a,this.element)||a?.subTemplateParentId===r.subTemplateParentId)return!1;for(let M=i.startIndex-1;M>=0;M--){const V=l[M];if(V.type===s.ElementType.SUB_TEMPLATE&&V.id===r.subTemplateParentId)return V.controlId===u&&(V.originControlId||null)===(R||null)}return!1})(),f=!!u&&(g||r?.controlId!==u&&this._findNearestTextAncestorId(l,r?.originControlId)===u);!f&&!d&&!T&&(this.control.mergeControl(e),this.control.shrinkBoundary(e));const{startIndex:m,endIndex:p}=i,I=this.control.getDraw();m!==p?I.spliceElementList(l,m+1,p-m,[],{isIgnoreDeletedRule:n.isIgnoreDeletedRule}):f||d||T?this._removePlaceholdersByControl(l,u,R||null):this.control.removePlaceholder(m,{elementList:l});const C=l[m];f||d||T?this._removePlaceholdersByControl(l,u,R||null):this._removeControlPlaceholders(l,m);const E=C.type&&!Le.includes(C.type)||C.controlComponent===s.ControlComponent.PREFIX||C.controlComponent===s.ControlComponent.PRE_TEXT?Jt(C,["control","controlId","originControlId","subTemplateParentId","subTemplateInstanceId",...he]):Ee(C,["type"]);g&&(delete E.subTemplateParentId,delete E.subTemplateInstanceId);const O=f||d||T,P=M=>{he.forEach(V=>{delete M[V];const N=h?.[V];N!==void 0&&(M[V]=N)}),delete M.underline,delete M.textDecoration,h?.type===s.ControlType.TEXT&&M.color?.toLowerCase()==="#87d068"?M.color=this.options.defaultColor:M.color||(M.color=this.options.defaultColor)};O&&P(E),E.controlId=u,h&&(E.control=h),R?E.originControlId=R:delete E.originControlId;const S=this.options.mode===s.EditorMode.FORM&&this.options.modeRule.form.inputTraceEnabled,X=i.startIndex+1,U=[],b=M=>{const V=U.length?U:l,N=U.length?U.length-1:d||g?i.startIndex+1:i.startIndex;ae(V,[M],N,{editorOptions:this.options}),U.push(M)};for(let M=0;M<t.length;M++){const V=t[M];if(V.type===s.ElementType.CONTROL&&V.control){const N=V,y=N.controlId||gt(),L=N.control?.value||[],F=N.control?.type,D=F===s.ControlType.TEXTFIELD,Y=D?this.options.control.textFixColor:F===s.ControlType.TEXT||F===s.ControlType.NUMBER?"#87d068":this.options.control.bracketColor,_={...Ee(E,["underline","textDecoration"]),controlId:y,type:s.ElementType.CONTROL,control:N.control,originControlId:u},W=D?s.ControlComponent.PRETEXTFIX:s.ControlComponent.PREFIX,H=D?s.ControlComponent.POSTTEXTFIX:s.ControlComponent.POSTFIX,Q=D?N.control?.preTextFix||this.options.control.preTextFix:N.control?.prefix||this.options.control.prefix;for(let K=0;K<Q.length;K++){const x={..._,color:Y,value:Q[K],controlComponent:W};b(x)}for(let K=0;K<L.length;K++){const x=L[K],v={..._,...x,controlComponent:s.ControlComponent.VALUE};(v.color===this.options.control.bracketColor||v.color===this.options.control.placeholderColor)&&(v.color=this.options.defaultColor),b(v)}if(L.length===0){const K=N.control?.placeholder||"";for(let x=0;x<K.length;x++){const v={..._,value:K[x],controlComponent:s.ControlComponent.PLACEHOLDER,color:this.options.control.placeholderColor};b(v)}}const A=D?N.control?.postTextFix||this.options.control.postTextFix:N.control?.postfix||this.options.control.postfix;for(let K=0;K<A.length;K++){const x={..._,color:Y,value:A[K],controlComponent:H};b(x)}}else if(V.type||V.value){(C.controlComponent===s.ControlComponent.PRE_TEXT||C.controlComponent===s.ControlComponent.POST_TEXT||C.controlComponent===s.ControlComponent.PREFIX||C.controlComponent===s.ControlComponent.POSTFIX)&&(E.color=this.options.defaultColor);const y=Ee(V,["control","controlId","controlComponent","originControlId"]),L={...E,...y,controlComponent:s.ControlComponent.VALUE};g&&(delete L.subTemplateParentId,delete L.subTemplateInstanceId),O&&P(L),(L.color===this.options.control.bracketColor||L.color===this.options.control.placeholderColor||L.color===this.options.control.textFixColor)&&(L.color=this.options.defaultColor),L.strikeout&&delete L.strikeout,S&&(L.textDecoration={style:s.TextDecorationStyle.DOUBLE},L.underline=!0),b(L)}}return U.length&&I.spliceElementList(l,X,0,U),i.startIndex+U.length}_removeControlPlaceholders(t,e){const n=t[e];if(!n?.controlId)return;const i=a=>!!a&&a.controlId===n.controlId&&a.originControlId===n.originControlId;let l=e;for(;l>=0&&i(t[l]);)l--;let r=e+1;for(;r<t.length&&i(t[r]);)r++;for(let a=r-1;a>l;a--)t[a].controlComponent===s.ControlComponent.PLACEHOLDER&&t.splice(a,1)}_removePlaceholdersByControl(t,e,n){if(e)for(let i=t.length-1;i>=0;i--){const l=t[i];l.controlId===e&&(l.originControlId||null)===n&&l.controlComponent===s.ControlComponent.PLACEHOLDER&&t.splice(i,1)}}_findNearestTextAncestorId(t,e){if(!e)return null;const n=new Set;let i=e,l=null;for(;i&&!n.has(i);){n.add(i);let r;for(let a=0;a<t.length;a++){const c=t[a];if(c.controlId===i&&c.control?.type&&(r=c,c.controlComponent===s.ControlComponent.PREFIX||c.controlComponent===s.ControlComponent.PRE_TEXT||c.controlComponent===s.ControlComponent.PRETEXTFIX||c.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT))break}if(!r)break;(r.control?.type===s.ControlType.TEXT||this.options.mode===s.EditorMode.EDIT&&r.control?.type===s.ControlType.TEXTFIELD)&&(l=i),i=r.originControlId||null}return l}clearValue(t={},e={}){if(!e.isIgnoreDisabledRule&&this.control.getIsDisabledControl(t))return-1;const n=t.elementList||this.control.getElementList(),i=t.range||this.control.getValueRange()||this.control.getRange();this.control.shrinkBoundary(t);const{startIndex:l,endIndex:r}=i;return this.control.getDraw().spliceElementList(n,l+1,r-l,[],{isIgnoreDeletedRule:e.isIgnoreDeletedRule}),e.isAddPlaceholder!==!1&&(this.getValue(t).length||this.control.addPlaceholder(l,t)),l}keydown(t){if(this.control.getIsDisabledControl())return null;const e=this.control.getElementList(),n=this.control.getRange(),i=W=>!!(W?.type&&oT.has(W.type)&&W.controlId&&W.controlComponent===s.ControlComponent.VALUE),l=W=>{const H=e[W];if(!i(H))return null;const Q=H.controlId,A=H.originControlId||null,K=rt=>rt?.controlId===Q&&(rt?.originControlId||null)===A;this.draws.spliceElementList(e,W,1);const x=e.some(rt=>K(rt)&&rt.controlComponent===s.ControlComponent.VALUE);let v=null;if(!x){const rt=e.findIndex(It=>K(It)&&(It.controlComponent===s.ControlComponent.PREFIX||It.controlComponent===s.ControlComponent.PRE_TEXT));rt>=0&&(this.control.addPlaceholder(rt),v=rt)}if(v!==null)return v;for(let rt=Math.min(W-1,e.length-1);rt>=0;rt--){const It=e[rt];if(!K(It))break;if(It.controlComponent===s.ControlComponent.VALUE||It.controlComponent===s.ControlComponent.PLACEHOLDER)return rt}for(let rt=Math.max(0,W);rt<e.length;rt++){const It=e[rt];if(!K(It))break;if(It.controlComponent===s.ControlComponent.VALUE||It.controlComponent===s.ControlComponent.PLACEHOLDER)return rt}return Math.max(0,W-1)};this.control.shrinkBoundary();const{startIndex:r,endIndex:a}=n,c=e[r],d=e[a],u=this.control.getDraw(),R=e[a+1];if(r===a){if(t.key===s.KeyMap.Backspace){const W=i(c)?r:i(e[r-1])?r-1:-1;if(W>=0)return l(W)}if(t.key===s.KeyMap.Delete){const W=i(c)?r:i(R)?a+1:-1;if(W>=0)return l(W)}}const h=this.options.mode===s.EditorMode.FORM,T=this.element.controlId||c.controlId,g=this.element.originControlId||c.originControlId||null,f=[];for(let W=0;W<e.length;W++){const H=e[W];H.controlId===T&&(H.originControlId||null)===g&&H.controlComponent===s.ControlComponent.VALUE&&f.push(W)}const m=!!(r!==a&&f.length&&r<f[0]&&a>=f[f.length-1]),p=W=>{if(!W)return null;const H=new Set;let Q=W,A=null;for(;Q&&!H.has(Q);){H.add(Q);let K;for(let x=0;x<e.length;x++){const v=e[x];if(v.controlId===Q&&v.control?.type&&(K=v,v.controlComponent===s.ControlComponent.PREFIX||v.controlComponent===s.ControlComponent.PRE_TEXT||v.controlComponent===s.ControlComponent.PRETEXTFIX||v.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT))break}if(!K)break;(K.control?.type===s.ControlType.TEXT||this.options.mode===s.EditorMode.EDIT&&K.control?.type===s.ControlType.TEXTFIELD)&&(A=Q),Q=K.originControlId||null}return A},I=p(g),C=!!I,E=c.controlId===T&&(c.originControlId||null)===g,O=c.controlComponent===s.ControlComponent.VALUE,P=W=>{for(let H=r-1;H>=0;H--){const Q=e[H];if(Q.controlId===W&&!Q.originControlId){if(Q.controlComponent===s.ControlComponent.VALUE||Q.controlComponent===s.ControlComponent.PLACEHOLDER)return H;if(Q.controlComponent===s.ControlComponent.PREFIX||Q.controlComponent===s.ControlComponent.PRE_TEXT||Q.controlComponent===s.ControlComponent.PRETEXTFIX||Q.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT)break}if(Q.controlId&&Q.controlId!==W&&Q.originControlId!==W)break}return-1},S=(W,H,Q)=>{const A=x=>x?.controlId===H&&(x?.originControlId||null)===Q;let K=-1;for(let x=W;x>=0;x--){const v=e[x];if(A(v)){if(v.controlComponent===s.ControlComponent.VALUE)return x;if(v.controlComponent===s.ControlComponent.PREFIX||v.controlComponent===s.ControlComponent.PRE_TEXT||v.controlComponent===s.ControlComponent.PRETEXTFIX||v.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT){K=x;break}}if(v.controlId&&v.controlId!==H&&v.originControlId!==H)break}for(let x=W+1;x<e.length;x++){const v=e[x];if(A(v)){if(v.controlComponent===s.ControlComponent.VALUE)return x;if(v.controlComponent===s.ControlComponent.POSTFIX||v.controlComponent===s.ControlComponent.POST_TEXT||v.controlComponent===s.ControlComponent.POSTTEXTFIX||v.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT){K===-1&&(K=x);break}}if(v.controlId&&v.controlId!==H&&v.originControlId!==H)break}return K>=0?K:W},U=C&&E&&(c.controlComponent===s.ControlComponent.PREFIX||c.controlComponent===s.ControlComponent.PRE_TEXT||c.controlComponent===s.ControlComponent.PRETEXTFIX||c.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT||c.controlComponent===s.ControlComponent.POSTFIX||c.controlComponent===s.ControlComponent.POST_TEXT||c.controlComponent===s.ControlComponent.POSTTEXTFIX||c.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT||c.controlComponent===s.ControlComponent.PLACEHOLDER||c.controlComponent===s.ControlComponent.TEXTFIXLABEL),b=e[a+1],M=!!b?.originControlId&&!!b?.controlId&&b.originControlId!==b.controlId&&(b.controlComponent===s.ControlComponent.PREFIX||b.controlComponent===s.ControlComponent.PRE_TEXT||b.controlComponent===s.ControlComponent.PRETEXTFIX||b.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT||b.controlComponent===s.ControlComponent.PLACEHOLDER||b.controlComponent===s.ControlComponent.TEXTFIXLABEL),V=!!b?.originControlId&&!!b?.controlId&&b.originControlId!==b.controlId&&(b.controlComponent===s.ControlComponent.PREFIX||b.controlComponent===s.ControlComponent.PRE_TEXT||b.controlComponent===s.ControlComponent.PRETEXTFIX||b.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT||b.controlComponent===s.ControlComponent.POSTFIX||b.controlComponent===s.ControlComponent.POST_TEXT||b.controlComponent===s.ControlComponent.POSTTEXTFIX||b.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT||b.controlComponent===s.ControlComponent.PLACEHOLDER||b.controlComponent===s.ControlComponent.TEXTFIXLABEL),N=W=>this.options.mode===s.EditorMode.FORM?r:this.control.removeControl(W),y=c.controlComponent===s.ControlComponent.VALUE&&!c.originControlId&&!!b?.originControlId&&!!T&&p(b.originControlId)===T,L=W=>!!W&&W.controlId===c.controlId&&(W.originControlId||null)===(c.originControlId||null),F=W=>W?.controlComponent===s.ControlComponent.POSTFIX||W?.controlComponent===s.ControlComponent.POST_TEXT||W?.controlComponent===s.ControlComponent.POSTTEXTFIX||W?.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT,D=()=>{const W=c.controlId,H=c.originControlId||null;return u.spliceElementList(e,r,1),e.some(A=>A.controlId===W&&(A.originControlId||null)===H&&A.controlComponent===s.ControlComponent.VALUE)||this.control.addPlaceholder(r-1),Math.max(r-1,0)},Y=c.controlComponent===s.ControlComponent.VALUE&&!!c.originControlId&&L(b)&&F(b),Z=!!T&&!this.control.getIsExistValueByElementListIndex(e,r),_=()=>{if(c.controlComponent!==s.ControlComponent.VALUE)return null;let W=r;for(let A=r;A>=0;A--){const K=e[A];if(!(K.controlId===c.controlId&&(K.originControlId||null)===(c.originControlId||null))||K.controlComponent!==s.ControlComponent.VALUE)break;if(!K.strikeout){W=A;break}}const H=e[W];if(!H||H.strikeout)return null;H.strikeout=!0,H.deletePerson="SWJ",H.deleteTime=at(new Date).format("YYYY-MM-DD HH:mm:ss");let Q=Math.max(W-1,0);for(let A=W-1;A>=0;A--){const K=e[A];if(!(K.controlId===H.controlId&&(K.originControlId||null)===(H.originControlId||null))){Q=A;break}if(K.controlComponent!==s.ControlComponent.VALUE){Q=A;break}if(!K.strikeout){Q=A;break}Q=Math.max(A-1,0)}return this.draws.render({curIndex:Q,isSetCursor:!0,isCompute:!1,isSubmitHistory:!1}),this.ranges.setDefaultStyle({strikeout:!1}),queueMicrotask(()=>{this.ranges.setRange(Q,Q),this.draws.setCursor(Q)}),Q};if(t.key===s.KeyMap.Backspace){if(r===a&&Z&&(c.controlComponent===s.ControlComponent.PLACEHOLDER||c.controlComponent===s.ControlComponent.POSTFIX||c.controlComponent===s.ControlComponent.POST_TEXT||c.controlComponent===s.ControlComponent.POSTTEXTFIX||c.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT))return S(r,c.controlId,c.originControlId||null);if(h&&r===a&&I&&!E&&(c.controlComponent===s.ControlComponent.POSTFIX||c.controlComponent===s.ControlComponent.POST_TEXT||c.controlComponent===s.ControlComponent.POSTTEXTFIX||c.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT)){const H=P(I);return H>=0?H:r}if(r===a&&U&&!(h&&c.controlComponent===s.ControlComponent.VALUE&&!c.originControlId))return N(r);if(this.options.mode===s.EditorMode.FORM&&this.options.modeRule.form.deleteTraceEnabled&&!m&&(!C||O)){if(r===a&&c.controlComponent===s.ControlComponent.VALUE){const H=_();if(H!==null)return H}return r===a&&(c.controlComponent===s.ControlComponent.PREFIX||c.controlComponent===s.ControlComponent.PRE_TEXT||c.controlComponent===s.ControlComponent.PLACEHOLDER)?r:this.strikeout()}else{if(r===a&&(c.controlComponent===s.ControlComponent.PREFIX||c.controlComponent===s.ControlComponent.PRE_TEXT||c.controlComponent===s.ControlComponent.PLACEHOLDER))return r;if(r!==a){u.spliceElementList(e,r+1,a-r);const H=e[r+1];return(H?.controlComponent===s.ControlComponent.POSTFIX||H?.controlComponent===s.ControlComponent.POST_TEXT||H?.controlComponent===s.ControlComponent.POSTTEXTFIX||H?.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT)&&this.control.addPlaceholder(r),r===0&&e[0].type===s.ElementType.SPLIT_TAG?u.fixPosition(!0)??r:r}else{const H=e[r-1],Q=e[r+1];return!c.originControlId&&H?.controlId===c.controlId&&H?.originControlId===c.originControlId&&H?.controlComponent===s.ControlComponent.VALUE&&(c.controlComponent===s.ControlComponent.POSTFIX||c.controlComponent===s.ControlComponent.POST_TEXT||c.controlComponent===s.ControlComponent.POSTTEXTFIX||c.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT)&&this.options.mode!==s.EditorMode.FORM?(u.spliceElementList(e,r-1,1),this.getValue().length||this.control.addPlaceholder(r-2),r-2):F(Q)?Q.originControlId?Y?D():y?(u.spliceElementList(e,r,1),this.getValue().length||this.control.addPlaceholder(r-1),S(Math.max(r-1,0),c.controlId,c.originControlId||null)):N(r):(u.spliceElementList(e,r,1),this.control.addPlaceholder(r-1),S(Math.max(r-1,0),c.controlId,c.originControlId||null)):(u.spliceElementList(e,r,1),r===1&&e[0].type===s.ElementType.SPLIT_TAG||r===0?u.fixPosition(!0)??r-1:S(Math.max(r-1,0),c.controlId,c.originControlId||null))}}}else if(t.key===s.KeyMap.Delete){if(r===a&&Z&&(c.controlComponent===s.ControlComponent.PLACEHOLDER||c.controlComponent===s.ControlComponent.POSTFIX||c.controlComponent===s.ControlComponent.POST_TEXT||c.controlComponent===s.ControlComponent.POSTTEXTFIX||c.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT))return S(a,c.controlId,c.originControlId||null);if(r===a&&(M||V)){if(y){const A=e[a+1];if(A?.controlComponent===s.ControlComponent.VALUE&&A.controlId===c.controlId&&!A.originControlId)return u.spliceElementList(e,a+1,1),this.getValue().length||this.control.addPlaceholder(r),r}return N(a+1)}const W=e[a+1],H=!!c.originControlId;if(this.options.mode===s.EditorMode.FORM&&this.options.modeRule.form.deleteTraceEnabled&&!m&&(!H||c.controlComponent===s.ControlComponent.VALUE))return d.controlComponent===s.ControlComponent.POSTFIX||d.controlComponent===s.ControlComponent.POST_TEXT||d.controlComponent===s.ControlComponent.POSTTEXTFIX||d.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT||c.controlComponent===s.ControlComponent.PLACEHOLDER?a:r===a&&(W?.controlComponent===s.ControlComponent.POSTFIX||W?.controlComponent===s.ControlComponent.POST_TEXT||W?.controlComponent===s.ControlComponent.POSTTEXTFIX||W?.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT)?W.originControlId?y?(u.spliceElementList(e,r+1,1),this.getValue().length||this.control.addPlaceholder(r),r):N(r+1):(u.spliceElementList(e,r+1,1),this.control.addPlaceholder(r),r):this.strikeout();{const A=e[a+1];if(c.controlComponent===s.ControlComponent.PLACEHOLDER)return a;if(r===a&&(A?.controlComponent===s.ControlComponent.POSTFIX||A?.controlComponent===s.ControlComponent.POST_TEXT||A?.controlComponent===s.ControlComponent.POSTTEXTFIX||A?.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT))return A.originControlId?y?(u.spliceElementList(e,r+1,1),this.getValue().length||this.control.addPlaceholder(r),r):N(r+1):(u.spliceElementList(e,r+1,1),this.control.addPlaceholder(r),r);if(r!==a){u.spliceElementList(e,r+1,a-r);const K=e[r+1];return F(K)&&this.control.addPlaceholder(r),r===0&&e[0].type===s.ElementType.SPLIT_TAG?u.fixPosition(!0)??r:r}else return A?(u.spliceElementList(e,r+1,1),r===0&&e[0].type===s.ElementType.SPLIT_TAG?u.fixPosition(!0)??r:r):(u.getTd()?.linkTdNextId&&c.controlId&&this.removeNextControlElement(c.controlId),a)}}return a}cut(){if(this.control.getIsDisabledControl())return-1;this.control.shrinkBoundary();const{startIndex:t,endIndex:e}=this.control.getRange();if(t===e)return t;const n=this.control.getDraw(),i=this.control.getElementList();n.spliceElementList(i,t+1,e-t);const l=i[t+1];return(l?.controlComponent===s.ControlComponent.POSTFIX||l?.controlComponent===s.ControlComponent.POST_TEXT||l?.controlComponent===s.ControlComponent.POSTTEXTFIX||l?.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT)&&this.control.addPlaceholder(t),t}strikeout(t){const e=this.control.getRange(),{endIndex:n}=e,{isIgnoreDisabledRule:i=!1}=t||{};if(!i&&(this.draws.isReadonly()||this.draws.isDisabled()))return null;const r=this.ranges.getSelectionElementList(),a=this.position.getCursorPosition(),c=at(new Date).format("YYYY-MM-DD HH:mm:ss"),d=h=>{queueMicrotask(()=>{this.ranges.setRange(h,h),this.draws.setCursor(h)})},u=h=>{const T=this.control.getElementList(),g=T[h],f=g?.controlId,m=g?.originControlId||null;let p=-1;for(let I=h-1;I>=0;I--){const C=T[I];if(C.controlId===f&&(C.originControlId||null)===m&&C.controlComponent===s.ControlComponent.VALUE)return I;if(m){if(C.controlId&&C.controlId!==f&&C.originControlId!==m)break}else{if(C.controlId===f&&(C.controlComponent===s.ControlComponent.PREFIX||C.controlComponent===s.ControlComponent.PRE_TEXT||C.controlComponent===s.ControlComponent.PRETEXTFIX||C.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT)){p=I;break}if(C.controlId&&C.controlId!==f&&!C.originControlId)break;if(C.originControlId===f&&(C.controlComponent===s.ControlComponent.POSTFIX||C.controlComponent===s.ControlComponent.POST_TEXT||C.controlComponent===s.ControlComponent.POSTTEXTFIX||C.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT))return I}}if(p>=0){const I=p+1,C=T[I];return C?.controlId===f&&(C.controlComponent===s.ControlComponent.PLACEHOLDER||C.controlComponent===s.ControlComponent.VALUE)?I:p}return h},R=h=>{const T=this.control.getElementList(),g=T[h];if(!g?.controlId||g.controlComponent===s.ControlComponent.VALUE&&(g.metrics?.width??0)>0)return h;for(let f=h+1;f<T.length;f++){const m=T[f];if(m.controlId!==g.controlId||(m.originControlId||null)!==(g.originControlId||null))break;if(m.controlComponent===s.ControlComponent.VALUE&&(m.metrics?.width??0)>0)return f}for(let f=h-1;f>=0;f--){const m=T[f];if(m.controlId!==g.controlId||(m.originControlId||null)!==(g.originControlId||null))break;if(m.controlComponent===s.ControlComponent.VALUE&&(m.metrics?.width??0)>0)return f}return h};if(r?.length){if(!this.element.strikeout){const h=r.findIndex(T=>!T.strikeout);return r.forEach(T=>{T.deletePerson="SWJ",T.deleteTime=c,T.strikeout=!!~h}),this.draws.render({isSetCursor:!0,isCompute:!1,isDel:!0,isSubmitHistory:!1}),this.ranges.setDefaultStyle({strikeout:!1}),this.control.getRange().endIndex??null}}else{const h=R(a.index),T=this.control.getElementList()[h],g=this.control.getElementList();if(!this.control.getElementList()[h].strikeout&&T?.metrics.width>0){this.control.getElementList()[h].strikeout=!0,this.control.getElementList()[h].deletePerson="SWJ",this.control.getElementList()[h].deleteTime=c;const f=u(h);return this.ranges.setRange(f,f),this.draws.render({curIndex:f,isSetCursor:!0,isCompute:!1,isSubmitHistory:!1}),this.ranges.setDefaultStyle({strikeout:!1}),d(f),f??null}else if(n>=0&&n<g.length&&g[n]?.metrics?.width!==void 0&&g[n].metrics.width<=0&&!g[n]?.strikeout){g.splice(n,1);const f=n-1;return this.ranges.setRange(f,f),this.draws.render({curIndex:f,isSetCursor:!0,isCompute:!1,isSubmitHistory:!1}),this.ranges.setDefaultStyle({strikeout:!1}),d(f),f??null}}return n??null}strikeoute(t){const{isIgnoreDisabledRule:e=!1}=t||{};if(!e&&(this.draws.isReadonly()||this.draws.isDisabled()))return;if(!this.ranges.getSelectionElementList()?.length){const{endIndex:l}=this.ranges.getRange(),a=this.draws.getElementList()[l];this.ranges.setDefaultStyle({strikeout:a.strikeout?!1:!this.ranges.getDefaultStyle()?.strikeout})}}}class Nl{draw;options;now;dom;renderOptions;isDatePicker;pickDate;lang;constructor(t,e={}){this.draw=t,this.options=e,this.lang=this._getLang(),this.now=new Date,this.dom=this._createDom(),this.renderOptions=null,this.isDatePicker=!0,this.pickDate=null,this._bindEvent()}_createDom(){const t=document.createElement("div");t.classList.add(`${st}-date-container`),t.setAttribute(ve,s.EditorComponent.POPUP);const e=document.createElement("div");e.classList.add(`${st}-date-wrap`);const n=document.createElement("div");n.classList.add(`${st}-date-title`);const i=document.createElement("span");i.classList.add(`${st}-date-title__pre-year`),i.innerText="<<";const l=document.createElement("span");l.classList.add(`${st}-date-title__pre-month`),l.innerText="<";const r=document.createElement("span");r.classList.add(`${st}-date-title__now`);const a=document.createElement("span");a.classList.add(`${st}-date-title__next-month`),a.innerText=">";const c=document.createElement("span");c.classList.add(`${st}-date-title__next-year`),c.innerText=">>",n.append(i),n.append(l),n.append(r),n.append(a),n.append(c);const d=document.createElement("div");d.classList.add(`${st}-date-week`);const{weeks:{sun:u,mon:R,tue:h,wed:T,thu:g,fri:f,sat:m}}=this.lang;[u,R,h,T,g,f,m].forEach(V=>{const N=document.createElement("span");N.innerText=`${V}`,d.append(N)});const I=document.createElement("div");I.classList.add(`${st}-date-day`),e.append(n),e.append(d),e.append(I);const C=document.createElement("ul");C.classList.add(`${st}-time-wrap`);let E,O,P;[this.lang.hour,this.lang.minute,this.lang.second].forEach((V,N)=>{const y=document.createElement("li"),L=document.createElement("span");L.innerText=V,y.append(L);const F=document.createElement("ol"),D=N===0,Y=N===1,Z=D?24:60;for(let _=0;_<Z;_++){const W=document.createElement("li");W.innerText=`${String(_).padStart(2,"0")}`,W.setAttribute("data-id",`${_}`),F.append(W)}D?E=F:Y?O=F:P=F,y.append(F),C.append(y)});const X=document.createElement("div");X.classList.add(`${st}-date-menu`);const U=document.createElement("button");U.classList.add(`${st}-date-menu__time`),U.innerText=this.lang.timeSelect;const b=document.createElement("button");b.classList.add(`${st}-date-menu__now`),b.innerText=this.lang.now;const M=document.createElement("button");return M.classList.add(`${st}-date-menu__submit`),M.innerText=this.lang.confirm,X.append(U),X.append(b),X.append(M),t.append(e),t.append(C),t.append(X),this.draw.getContainer().append(t),{container:t,dateWrap:e,datePickerWeek:d,timeWrap:C,title:{preYear:i,preMonth:l,now:r,nextMonth:a,nextYear:c},day:I,time:{hour:E,minute:O,second:P},menu:{time:U,now:b,submit:M}}}_bindEvent(){this.dom.title.preYear.onclick=()=>{this._preYear()},this.dom.title.preMonth.onclick=()=>{this._preMonth()},this.dom.title.nextMonth.onclick=()=>{this._nextMonth()},this.dom.title.nextYear.onclick=()=>{this._nextYear()},this.dom.menu.time.onclick=()=>{this.isDatePicker=!this.isDatePicker,this._toggleDateTimePicker()},this.dom.menu.now.onclick=()=>{this._now(),this._submit()},this.dom.menu.submit.onclick=()=>{this.dispose(),this._submit()},this.dom.time.hour.onclick=t=>{if(!this.pickDate)return;const n=t.target.dataset.id;n&&(this.pickDate.setHours(Number(n)),this._setTimePick(!1))},this.dom.time.minute.onclick=t=>{if(!this.pickDate)return;const n=t.target.dataset.id;n&&(this.pickDate.setMinutes(Number(n)),this._setTimePick(!1))},this.dom.time.second.onclick=t=>{if(!this.pickDate)return;const n=t.target.dataset.id;n&&(this.pickDate.setSeconds(Number(n)),this._setTimePick(!1))}}_setPosition(){if(!this.renderOptions)return;const{position:{coordinate:{leftTop:[t,e]},lineHeight:n,pageNo:i}}=this.renderOptions,l=this.draw.getHeight(),r=this.draw.getPageGap(),c=(i??this.draw.getPageNo())*(l+r);this.dom.container.style.left=`${t}px`,this.dom.container.style.top=`${e+c+n}px`}isInvalidDate(t){return t.toDateString()==="Invalid Date"}_setValue(){const t=this.renderOptions?.value;if(t){const e=new Date(t);this.now=this.isInvalidDate(e)?new Date:e}else this.now=new Date;this.pickDate=new Date(this.now)}_getLang(){const t=this.draw.getI18n(),e=t.t.bind(t);return{now:e("datePicker.now"),confirm:e("datePicker.confirm"),return:e("datePicker.return"),timeSelect:e("datePicker.timeSelect"),weeks:{sun:e("datePicker.weeks.sun"),mon:e("datePicker.weeks.mon"),tue:e("datePicker.weeks.tue"),wed:e("datePicker.weeks.wed"),thu:e("datePicker.weeks.thu"),fri:e("datePicker.weeks.fri"),sat:e("datePicker.weeks.sat")},year:e("datePicker.year"),month:e("datePicker.month"),hour:e("datePicker.hour"),minute:e("datePicker.minute"),second:e("datePicker.second")}}_setLangChange(){this.dom.menu.time.innerText=this.lang.timeSelect,this.dom.menu.now.innerText=this.lang.now,this.dom.menu.submit.innerText=this.lang.confirm;const{weeks:{sun:t,mon:e,tue:n,wed:i,thu:l,fri:r,sat:a}}=this.lang,c=[t,e,n,i,l,r,a];this.dom.datePickerWeek.childNodes.forEach((h,T)=>{const g=h;g.innerText=c[T]});const d=this.dom.time.hour.previousElementSibling;d.innerText=this.lang.hour;const u=this.dom.time.minute.previousElementSibling;u.innerText=this.lang.minute;const R=this.dom.time.second.previousElementSibling;R.innerText=this.lang.second}_update(){const t=new Date,e=t.getFullYear(),n=t.getMonth()+1,i=t.getDate();let l=null,r=null,a=null;this.pickDate&&(l=this.pickDate.getFullYear(),r=this.pickDate.getMonth()+1,a=this.pickDate.getDate());const c=this.now.getFullYear(),d=this.now.getMonth()+1;this.dom.title.now.innerText=`${c}${this.lang.year} ${String(d).padStart(2,"0")}${this.lang.month}`;const R=new Date(c,d,0).getDate();let h=new Date(c,d-1,1).getDay();h===0&&(h=7);const T=new Date(c,d-1,0).getDate();this.dom.day.innerHTML="";const g=T-h+1;for(let m=g;m<=T;m++){const p=document.createElement("div");p.classList.add("disable"),p.innerText=`${m}`,p.onclick=()=>{const I=d-2;this.now=new Date(c,I,m),this._setDatePick(c,I,m)},this.dom.day.append(p)}for(let m=1;m<=R;m++){const p=document.createElement("div");e===c&&n===d&&i===m&&p.classList.add("active"),this.pickDate&&l===c&&r===d&&a===m&&p.classList.add("select"),p.innerText=`${m}`,p.onclick=I=>{const C=d-1;this.now=new Date(c,C,m),this._setDatePick(c,C,m),I.stopPropagation()},this.dom.day.append(p)}const f=42-h-R;for(let m=1;m<=f;m++){const p=document.createElement("div");p.classList.add("disable"),p.innerText=`${m}`,p.onclick=()=>{this.now=new Date(c,d,m),this._setDatePick(c,d,m)},this.dom.day.append(p)}}_toggleDateTimePicker(){this.isDatePicker?(this.dom.dateWrap.classList.add("active"),this.dom.timeWrap.classList.remove("active"),this.dom.menu.time.innerText=this.lang.timeSelect):(this.dom.dateWrap.classList.remove("active"),this.dom.timeWrap.classList.add("active"),this.dom.menu.time.innerText=this.lang.return,this._setTimePick())}_setDatePick(t,e,n){this.now=new Date(t,e,n),this.pickDate?.setFullYear(t),this.pickDate?.setMonth(e),this.pickDate?.setDate(n),this._update()}_setTimePick(t=!0){const e=this.pickDate?.getHours()||0,n=this.pickDate?.getMinutes()||0,i=this.pickDate?.getSeconds()||0,{hour:l,minute:r,second:a}=this.dom.time;[l,r,a].forEach(u=>{u.querySelectorAll("li").forEach(R=>R.classList.remove("active"))}),[[l,e],[r,n],[a,i]].forEach(([u,R])=>{const h=u.querySelector(`[data-id='${R}']`);h.classList.add("active"),t&&Mi(u,h)})}_preMonth(){this.now.setMonth(this.now.getMonth()-1),this._update()}_nextMonth(){this.now.setMonth(this.now.getMonth()+1),this._update()}_preYear(){this.now.setFullYear(this.now.getFullYear()-1),this._update()}_nextYear(){this.now.setFullYear(this.now.getFullYear()+1),this._update()}_now(){this.pickDate=new Date,this.dispose()}_toggleVisible(t){t?this.dom.container.classList.add("active"):this.dom.container.classList.remove("active")}_submit(){if(this.options.onSubmit&&this.pickDate){const t=this.renderOptions?.dateFormat,e=this.formatDate(this.pickDate,t);this.options.onSubmit(e)}}formatDate(t,e="YYYY-MM-DD HH:mm:ss"){let n=e;const i=t.getFullYear().toString(),l=(t.getMonth()+1).toString(),r=t.getDate().toString(),a=t.getHours(),c=a%12===0?12:a%12,d=t.getMinutes().toString(),u=t.getSeconds().toString(),R=t.getMilliseconds().toString(),h={"y+":i,"Y+":i,"M+":l,"d+":r,"D+":r,"h+":c.toString(),"H+":a.toString(),"m+":d,"s+":u,"S+":R};for(const T in h){const g=new RegExp("("+T+")").exec(e),f=T;g&&(n=n.replace(g[1],g[1].length===1?h[f]:h[f].padStart(g[1].length,"0")))}return n}render(t){this.renderOptions=t,this.lang=this._getLang(),this._setLangChange(),this._setValue(),this._update(),this._setPosition(),this.isDatePicker=!0,this._toggleDateTimePicker(),this._toggleVisible(!0)}dispose(){this._toggleVisible(!1)}destroy(){this.dom.container.remove()}}class Lo{draw;element;control;isPopup;datePicker;options;constructor(t,e){const n=e.getDraw();this.draw=n,this.options=n.getOptions(),this.element=t,this.control=e,this.isPopup=!1,this.datePicker=null}setElement(t){this.element=t}getElement(){return this.element}getIsPopup(){return this.isPopup}getValue(t={}){const e=t.elementList||this.control.getElementList(),n=this.control.getValueRange(t);if(!n)return[];const i=[],{startIndex:l,endIndex:r}=n;for(let a=l;a<=r;a++){const c=e[a];c.controlComponent===s.ControlComponent.VALUE&&i.push(c)}return i}setValue(t,e={},n={}){if(!n.isIgnoreDisabledRule&&this.control.getIsDisabledControl(e))return-1;const{elementList:i,range:l}=this.control.mergeControl(e);this.control.shrinkBoundary(e);const{startIndex:r,endIndex:a}=l,c=this.control.getDraw();r!==a?c.spliceElementList(i,r+1,a-r):this.control.removePlaceholder(r,{elementList:i});const d=i[r],u=d.type&&!Le.includes(d.type)||d.controlComponent===s.ControlComponent.PREFIX||d.controlComponent===s.ControlComponent.PRE_TEXT?Jt(d,["control","controlId",...he]):Ee(d,["type"]),R=l.startIndex+1;for(let h=0;h<t.length;h++){const T={...u,...t[h],controlComponent:s.ControlComponent.VALUE};ae(i,[T],r,{editorOptions:this.options}),c.spliceElementList(i,R+h,0,[T])}return R+t.length-1}clearSelect(t={},e={}){const{isIgnoreDisabledRule:n=!1,isAddPlaceholder:i=!0}=e;if(!n&&this.control.getIsDisabledControl(t))return-1;const l=this.control.getValueRange(t);if(!l)return-1;const{startIndex:r,endIndex:a}=l;if(!~r||!~a)return-1;const c=t.elementList||this.control.getElementList();return this.control.getDraw().spliceElementList(c,r+1,a-r,[],{isIgnoreDeletedRule:e.isIgnoreDeletedRule}),i&&this.control.addPlaceholder(r,t),r}setSelect(t,e={},n={}){if(!n.isIgnoreDisabledRule&&this.control.getIsDisabledControl(e))return;const i=e.elementList||this.control.getElementList(),l=e.range||this.control.getRange(),r=this.getValue(e)[0],a=r?Jt(r,Ne):Jt(i[l.startIndex],he),c=this.clearSelect(e,{isAddPlaceholder:!1,isIgnoreDeletedRule:n.isIgnoreDeletedRule});if(!~c)return;const d=Ee(i[c],Ne),u=c+1,R=this.control.getDraw();for(let h=0;h<t.length;h++){const T={...a,...d,type:s.ElementType.TEXT,value:t[h],controlComponent:s.ControlComponent.VALUE};(T.color===this.options.control.bracketColor||T.color===this.options.control.placeholderColor)&&(T.color=this.options.defaultColor),ae(i,[T],c,{editorOptions:this.options}),R.spliceElementList(i,u+h,0,[T])}if(!e.range){const h=u+t.length-1;this.control.repaintControl({curIndex:h}),this.control.emitControlContentChange({context:e}),this.destroy()}}keydown(t){if(this.control.getIsDisabledControl())return null;const e=this.control.getElementList(),n=this.control.getRange();this.control.shrinkBoundary();const{startIndex:i,endIndex:l}=n,r=e[i],a=e[l],c=this.control.getDraw();if(t.key===s.KeyMap.Backspace)return i!==l?(c.spliceElementList(e,i+1,l-i),this.getValue().length||this.control.addPlaceholder(i),i):r.controlComponent===s.ControlComponent.PREFIX||r.controlComponent===s.ControlComponent.PRE_TEXT||a.controlComponent===s.ControlComponent.POSTFIX||a.controlComponent===s.ControlComponent.POST_TEXT||r.controlComponent===s.ControlComponent.PLACEHOLDER?this.control.removeControl(i):(c.spliceElementList(e,i,1),this.getValue().length||this.control.addPlaceholder(i-1),i-1);if(t.key===s.KeyMap.Delete){if(i!==l)return c.spliceElementList(e,i+1,l-i),this.getValue().length||this.control.addPlaceholder(i),i;{const d=e[l+1];return(r.controlComponent===s.ControlComponent.PREFIX||r.controlComponent===s.ControlComponent.PRE_TEXT)&&d.controlComponent===s.ControlComponent.PLACEHOLDER||d.controlComponent===s.ControlComponent.POSTFIX||d.controlComponent===s.ControlComponent.POST_TEXT||r.controlComponent===s.ControlComponent.PLACEHOLDER?this.control.removeControl(i):(c.spliceElementList(e,i+1,1),this.getValue().length||this.control.addPlaceholder(i),i)}}return l}cut(){if(this.control.getIsDisabledControl())return-1;this.control.shrinkBoundary();const{startIndex:t,endIndex:e}=this.control.getRange();if(t===e)return t;const n=this.control.getDraw(),i=this.control.getElementList();return n.spliceElementList(i,t+1,e-t),this.getValue().length||this.control.addPlaceholder(t),t}awake(){if(this.isPopup||this.control.getIsDisabledControl()||!this.control.getIsRangeWithinControl())return;const t=this.control.getPosition();if(!t)return;const e=this.draw.getElementList(),{startIndex:n}=this.control.getRange();if(e[n+1]?.controlId!==this.element.controlId)return;this.datePicker=new Nl(this.draw,{onSubmit:this._setDate.bind(this)});const i=this.getValue().map(r=>r.value).join("")||"",l=this.element.control?.dateFormat;this.datePicker.render({value:i,position:t,dateFormat:l}),this.isPopup=!0}destroy(){this.isPopup&&(this.datePicker?.destroy(),this.isPopup=!1)}_setDate(t){t?this.setSelect(t):this.clearSelect(),this.destroy()}}class ui extends Vs{isPopup;inputPopup;constructor(t,e){super(t,e),this.isPopup=!1,this.inputPopup=null}getIsPopup(){return this.isPopup}setValue(t,e={},n={}){if(t.some(I=>!Fc(I)))return-1;const i=e.elementList||this.control.getElementList(),l=e.range||this.control.getRange();this.control.shrinkBoundary(e);const r=lt(t),{startIndex:a,endIndex:c}=l,d=i[a];let u=null;for(let I=a;I>=0;I--)if(i[I].controlComponent===s.ControlComponent.PREFIX){u=i[I];break}const R=u?.control||this.element.control;if(this.control.getIsExistValueByElementListIndex(i,a)){let I=a;for(;I>0;){const E=i[I];if(E.controlId!==d.controlId||E.controlComponent===s.ControlComponent.PREFIX||E.controlComponent===s.ControlComponent.PRE_TEXT)break;r.unshift(E),I--}let C=c+1;for(;C<i.length;){const E=i[C];if(E.controlId!==d.controlId||E.controlComponent===s.ControlComponent.POSTFIX||E.controlComponent===s.ControlComponent.POST_TEXT)break;r.push(E),C++}}const h=Rr(r);if(!/^[+-]?(?:\d+)?(?:\.\d*)?(?:[eE][+-]?\d*)?$/.test(h))return-1;const g=R?.numberExclusiveOptions,f=g?.maxLength??null,m=g?.decimalPlaces??null,p=h.replace(/[+\-.eE]/g,"").length;if(f!=null&&p>f||m!=null&&(h.split(/[eE]/)[0].split(".")[1]||"").length>m)return-1;if(e.range||e.elementList){const I=Number(h),C=g?.minValue,E=g?.maxValue;if(!Number.isFinite(I)||C!=null&&I<C||E!=null&&I>E)return-1}return super.setValue(t,e,n)}_setNumberValue(t){const e=this.control.getElementList(),n=this.control.getRange(),{startIndex:i}=n;let l=null;for(let S=i;S>=0;S--)if(e[S].controlComponent===s.ControlComponent.PREFIX){l=e[S];break}const a=(l?.control||this.element.control)?.numberExclusiveOptions,c=a?.minValue,d=a?.maxValue,u=a?.minLength,R=a?.maxLength,h=t.trim(),T=h.replace(/[+\-.eE]/g,"").length,g=Number(h);if(u!=null&&T<u||R!=null&&T>R||c!=null&&g<c||d!=null&&g>d)return!1;let f=i;for(let S=i;S>=0;S--)if(e[S].controlComponent===s.ControlComponent.PREFIX){f=S;break}let m=f+1;for(let S=f+1;S<e.length;S++)if(e[S].controlComponent===s.ControlComponent.POSTFIX){m=S;break}const p=this.options.mode===s.EditorMode.FORM,I=p&&this.options.modeRule.form.inputTraceEnabled,C=p&&this.options.modeRule.form.deleteTraceEnabled,E=at(new Date).format("YYYY-MM-DD HH:mm:ss");if(C)for(let S=f+1;S<m;S++){const X=e[S];X.controlComponent===s.ControlComponent.VALUE&&!X.strikeout&&X.value&&(X.strikeout=!0,X.deletePerson="SYSTEM",X.deleteTime=E),X.controlComponent===s.ControlComponent.PLACEHOLDER&&(this.control.getDraw().spliceElementList(e,S,1),m--,S--)}else{const S=f+1,X=m-S;X>0&&this.control.getDraw().spliceElementList(e,S,X),m=f+1}m=f+1;for(let S=f+1;S<e.length;S++)if(e[S].controlComponent===s.ControlComponent.POSTFIX){m=S;break}const O=[];for(let S=0;S<h.length;S++){const X={type:s.ElementType.TEXT,value:h[S],controlComponent:s.ControlComponent.VALUE,controlId:e[f].controlId,originControlId:e[f].originControlId,control:e[f].control};I&&(X.textDecoration={style:s.TextDecorationStyle.DOUBLE},X.underline=!0),O.push(X)}for(let S=0;S<O.length;S++)this.control.getDraw().spliceElementList(e,m+S,0,[O[S]]);const P=m+O.length-1;return this.control.getDraw().getRange().setRange(P,P),this.control.emitControlContentChange(),this.control.repaintControl({curIndex:P}),!0}awake(){if(this.isPopup||this.control.getIsDisabledControl()||!this.control.getIsRangeWithinControl())return;const t=this.control.getElementList(),e=this.control.getRange(),{startIndex:n}=e,i=t[n];if(!i||i.controlId!==this.element.controlId)return;let l=null;for(let g=n;g>=0;g--)if(t[g].controlComponent===s.ControlComponent.PREFIX){l=t[g];break}const r=l?.control||this.element.control,c=this.getValue().filter(g=>!g.strikeout),d=c.length>0?Rr(c):"",u=r?.numberExclusiveOptions,R=u?.minValue,h=u?.maxValue,T=u?.decimalPlaces;this.inputPopup=new iT({control:this.control,currentValue:d,minValue:R,maxValue:h,decimalPlaces:T,onConfirm:g=>{if(!g||g.trim()==="")return this._clearNumberValue(),!0;const f=Number(g);return Number.isNaN(f)||!Number.isFinite(f)?!1:this._setNumberValue(g)},onTab:g=>{this.destroy(),setTimeout(()=>{this.control.initNextControl({direction:g})})},onClose:()=>{this.destroy()}}),this.inputPopup.create(),this.isPopup=!0}_clearNumberValue(){const t=this.control.getElementList(),e=this.control.getRange(),{startIndex:n}=e;let i=n;for(let c=n;c>=0;c--)if(t[c].controlComponent===s.ControlComponent.PREFIX){i=c;break}let l=i+1;for(let c=i+1;c<t.length;c++)if(t[c].controlComponent===s.ControlComponent.POSTFIX){l=c;break}const r=i+1,a=l-r;a>0&&this.control.getDraw().spliceElementList(t,r,a),this.control.addPlaceholder(i),this.control.getDraw().getRange().setRange(i,i),this.control.emitControlContentChange(),this.control.repaintControl({curIndex:i})}keydown(t){if(this.control.getIsDisabledControl())return null;const e=this.control.getElementList(),n=this.control.getRange();this.control.shrinkBoundary();const{startIndex:i,endIndex:l}=n,r=e[i],a=e[l],c=this.control.getDraw(),d=c.getMode()===s.EditorMode.FORM;if(t.key==="Backspace")return r.controlComponent===s.ControlComponent.PREFIX||r.controlComponent===s.ControlComponent.PRE_TEXT||r.controlComponent===s.ControlComponent.PLACEHOLDER?d?i:this.control.removeControl(i):a.controlComponent===s.ControlComponent.POSTFIX||a.controlComponent===s.ControlComponent.POST_TEXT?i:i!==l?(c.spliceElementList(e,i+1,l-i),this.getValue().length||this.control.addPlaceholder(i),i):(c.spliceElementList(e,i,1),this.getValue().length||this.control.addPlaceholder(i-1),i-1);if(t.key==="Delete"){const u=e[l+1];return r.controlComponent===s.ControlComponent.PLACEHOLDER||a.controlComponent===s.ControlComponent.POSTFIX||a.controlComponent===s.ControlComponent.POST_TEXT?d?l:this.control.removeControl(i):r.controlComponent===s.ControlComponent.PREFIX||r.controlComponent===s.ControlComponent.PRE_TEXT||u?.controlComponent===s.ControlComponent.POSTFIX||u?.controlComponent===s.ControlComponent.POST_TEXT?l:i!==l?(c.spliceElementList(e,i+1,l-i),this.getValue().length||this.control.addPlaceholder(i),i):(c.spliceElementList(e,i+1,1),this.getValue().length||this.control.addPlaceholder(i),i)}return l}destroy(){this.inputPopup&&(this.inputPopup.destroy(),this.inputPopup=null),this.isPopup=!1}}class iT{options;popupDom;constructor(t){this.options=t,this.popupDom=null}create(){const{currentValue:t,minValue:e,maxValue:n,decimalPlaces:i,onConfirm:l,onTab:r,onClose:a}=this.options,c=document.createElement("div");c.classList.add(`${st}-number-input-modal`),c.setAttribute(ve,s.EditorComponent.POPUP);const d=C=>{if(C.type==="mouseup"){const E=this.options.control.getDraw().getCanvasEvent();E.setIsAllowDrag(!1),E.setIsAllowSelection(!1)}C.stopPropagation()};c.addEventListener("mousedown",d),c.addEventListener("mouseup",d),c.addEventListener("click",d),c.addEventListener("keydown",d),c.addEventListener("input",d);const u=document.createElement("div");u.classList.add(`${st}-number-input-modal__content`);const R=document.createElement("div");if(R.classList.add(`${st}-number-input-modal__title`),R.textContent="请输入数值",u.appendChild(R),e!==void 0||n!==void 0){const C=document.createElement("div");C.classList.add(`${st}-number-input-modal__hint`);let E="有效范围:";e!==void 0&&n!==void 0?E+=`${e} ~ ${n}`:e!==void 0?E+=`≥ ${e}`:E+=`≤ ${n}`,i!=null&&(E+=`,保留${i}位小数`),C.textContent=E,u.appendChild(C)}const h=document.createElement("input");h.classList.add(`${st}-number-input-modal__input`),h.type="number",h.value=t,h.placeholder="请输入数值",e!==void 0&&(h.min=String(e)),n!==void 0&&(h.max=String(n)),i!=null&&(h.step=(1/Math.pow(10,i)).toString()),setTimeout(()=>{h.focus(),h.select()},100),u.appendChild(h);const T=document.createElement("div");T.classList.add(`${st}-number-input-modal__error`),T.style.display="none",u.appendChild(T);const g=document.createElement("div");g.classList.add(`${st}-number-input-modal__buttons`);const f=document.createElement("button");f.classList.add(`${st}-number-input-modal__cancel`),f.textContent="取消",f.onclick=()=>{a()},g.appendChild(f);const m=document.createElement("button");m.classList.add(`${st}-number-input-modal__confirm`),m.textContent="确定";const p=()=>{const C=h.value.trim();if(!C)return l("");const E=parseFloat(C);return Number.isNaN(E)||!Number.isFinite(E)?(T.textContent="请输入有效的数值",T.style.display="block",!1):i!=null&&(C.split(".")[1]||"").length>i?(T.textContent=`小数位数不能超过${i}位`,T.style.display="block",!1):e!==void 0&&E<e?(T.textContent=`数值不能小于 ${e}`,T.style.display="block",!1):n!==void 0&&E>n?(T.textContent=`数值不能大于 ${n}`,T.style.display="block",!1):(T.style.display="none",l(C))};m.onclick=()=>{p()&&a()},g.appendChild(m),u.appendChild(g),c.appendChild(u),h.onkeydown=C=>{C.key==="Enter"?m.click():C.key==="Tab"?(C.preventDefault(),p()&&(a(),r(C.shiftKey?qt.UP:qt.DOWN))):C.key==="Escape"&&a()},this.options.control.getContainer().appendChild(c),this.popupDom=c}destroy(){this.popupDom&&(this.popupDom.remove(),this.popupDom=null)}}class sT{options;mask;container;inputList;optionItemContainers;data;constructor(t){this.options=t,this.mask=null,this.container=null,this.inputList=[],this.optionItemContainers=[],this.data=t.data,this._render()}_getFieldValue(t){const e=this.inputList.filter(n=>n.name===t);if(e.length!==0){for(const n of e)if(n instanceof HTMLInputElement&&n.type==="radio"&&n.checked)return n.value;return e[0].value}}_updateFieldVisibility(){this.data.forEach((t,e)=>{if(t.visibleWhen){const{field:n,value:i}=t.visibleWhen,l=this._getFieldValue(n),r=this.optionItemContainers[e];if(r){const a=l===i;r.style.display=a?"":"none"}}})}_render(){const{title:t,onClose:e,onCancel:n,onConfirm:i}=this.options,l=document.createElement("div");l.classList.add("dialog-mask"),l.setAttribute(ve,s.EditorComponent.COMPONENT),document.body.append(l);const r=document.createElement("div");r.classList.add("dialog-container"),r.setAttribute(ve,s.EditorComponent.COMPONENT);const a=document.createElement("div");a.classList.add("dialog"),r.append(a);const c=document.createElement("div");c.classList.add("dialog-title");const d=document.createElement("span");d.append(document.createTextNode(t));const u=document.createElement("i");u.onclick=()=>{e&&e(),this._dispose()},c.append(d),c.append(u),a.append(c);const R=document.createElement("div");R.classList.add("dialog-option");for(let f=0;f<this.data.length;f++){const m=this.data[f],p=document.createElement("div");if(p.classList.add("dialog-option__item"),m.visible===!1&&(p.style.display="none"),m.label){const I=document.createElement("span");I.append(document.createTextNode(m.label)),p.append(I),m.required&&I.classList.add("dialog-option__item--require")}if(m.type==="radio"){const I=document.createElement("div");I.classList.add("dialog-radio-group"),m.horizontal&&I.classList.add("dialog-radio-group--horizontal"),m.options?.forEach(C=>{const E=document.createElement("label");E.classList.add("dialog-radio-item");const O=document.createElement("input");O.type="radio",O.name=m.name,O.value=C.value,C.value===(m.value||"")&&(O.checked=!0);const P=document.createElement("span");P.textContent=C.label,E.append(O),E.append(P),I.append(E),O.addEventListener("change",()=>{this._updateFieldVisibility()}),this.inputList.push(O)}),p.append(I)}else if(m.type==="select"){const I=document.createElement("select"),C=m.value||"";m.options?.forEach(E=>{const O=document.createElement("option");O.value=E.value,O.label=E.label,E.value===C&&(O.selected=!0),I.append(O)}),I.name=m.name,I.value=C,I.addEventListener("change",()=>{this._updateFieldVisibility()}),m.width&&(I.style.width=`${m.width}px`),p.append(I),this.inputList.push(I)}else if(m.type==="textarea"){const I=document.createElement("textarea");I.name=m.name,I.value=m.value||"",I.placeholder=m.placeholder||"",m.width&&(I.style.width=`${m.width}px`),m.height&&(I.style.height=`${m.height}px`),p.append(I),this.inputList.push(I)}else{const I=document.createElement("input");I.type=m.type,I.name=m.name,I.value=m.value||"",I.placeholder=m.placeholder||"",m.width&&(I.style.width=`${m.width}px`),m.height&&(I.style.height=`${m.height}px`),p.append(I),this.inputList.push(I)}R.append(p),this.optionItemContainers.push(p)}a.append(R);const h=document.createElement("div");h.classList.add("dialog-menu");const T=document.createElement("button");T.classList.add("dialog-menu__cancel"),T.append(document.createTextNode("取消")),T.type="button",T.onclick=()=>{n&&n(),this._dispose()},h.append(T);const g=document.createElement("button");g.append(document.createTextNode("确定")),g.type="submit",g.onclick=()=>{if(i){const f=new Set,m=[];for(const p of this.inputList)if(!f.has(p.name))if(p instanceof HTMLInputElement&&p.type==="radio"){const I=this.inputList.find(C=>C.name===p.name&&C instanceof HTMLInputElement&&C.checked);I&&(m.push({name:p.name,value:I.value}),f.add(p.name))}else m.push({name:p.name,value:p.value}),f.add(p.name);i(m)}this._dispose()},h.append(g),a.append(h),document.body.append(r),this.container=r,this.mask=l,this._updateFieldVisibility()}_dispose(){this.mask?.remove(),this.container?.remove()}}function rT(o,t){const e=o.trim();if(!e)return;const n=t?.key===e;return{...n?t:{},key:e,label:n&&t?.label?t.label:e,writeTarget:t?.writeTarget||"self",writeMode:t?.writeMode||"replaceOnConfirm"}}class Nn{draw;element;control;isPopup;datePicker;options;range;static isDeleting=!1;inputModal=null;constructor(t,e){const n=e.getDraw();this.draw=n,this.range=n.getRange(),this.options=n.getOptions(),this.element=t,this.control=e,this.isPopup=!1,this.datePicker=null}setElement(t){this.element=t}getElement(){return this.element}getIsPopup(){return this.isPopup}getValue(t={}){const e=t.elementList||this.control.getElementList(),n=this.control.getValueRange(t);if(!n)return[];const i=[],{startIndex:l,endIndex:r}=n;for(let a=l;a<=r;a++){const c=e[a];c.controlComponent===s.ControlComponent.VALUE&&!me(c)&&i.push(c)}return i}setValue(t,e={},n={}){if(!n.isIgnoreDisabledRule&&(this.control.getIsDisabledControl(e)||this.element.control?.editable===!1))return-1;const i=e.elementList||this.control.getElementList(),l=e.range||this.control.getRange(),{startIndex:r,endIndex:a}=l,c=i[r],d=this.element.controlId||c.controlId,u=this.element.originControlId||c.originControlId||null;if(!d)return-1;const R=this.getButtonControlBounds(i,d,u);if(!R)return-1;const h=this.getButtonBusinessOffset(i,R,r),T=this.getButtonBusinessOffset(i,R,a),g=this.getButtonBusinessElements(i,R),f=this.splitButtonBusinessElements(t),m=[...g.slice(0,h),...f,...g.slice(T)];return this.replaceButtonBusinessElements(i,R,m,h+f.length)}isSameButtonElement(t,e,n){return!!(t&&t.controlId===e&&(t.originControlId||null)===n)}getButtonControlBounds(t,e,n){let i=-1,l=-1;for(let r=0;r<t.length;r++){const a=t[r];this.isSameButtonElement(a,e,n)&&(i===-1&&a.controlComponent===s.ControlComponent.PREFIX&&(i=r),a.controlComponent===s.ControlComponent.POSTFIX&&(l=r))}return i===-1||l===-1?null:{controlId:e,originControlId:n,prefixIndex:i,postfixIndex:l}}getButtonBusinessOffset(t,e,n){let i=0;const l=Math.min(n,e.postfixIndex-1);for(let r=e.prefixIndex+1;r<=l;r++){const a=t[r];this.isSameButtonElement(a,e.controlId,e.originControlId)&&a.controlComponent===s.ControlComponent.VALUE&&!me(a)&&i++}return i}toButtonBusinessElement(t){const e={value:t.value===`
|
|
124
|
+
`+new Error().stack),e=!1}return t.apply(this,arguments)},t)}var vr={};function Zr(o,t){at.deprecationHandler!=null&&at.deprecationHandler(o,t),vr[o]||(wr(t),vr[o]=!0)}at.suppressDeprecationWarnings=!1,at.deprecationHandler=null;function xe(o){return typeof Function<"u"&&o instanceof Function||Object.prototype.toString.call(o)==="[object Function]"}function su(o){var t,e;for(e in o)_t(o,e)&&(t=o[e],xe(t)?this[e]=t:this["_"+e]=t);this._config=o,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function ss(o,t){var e=gn({},o),n;for(n in t)_t(t,n)&&(Dn(o[n])&&Dn(t[n])?(e[n]={},gn(e[n],o[n]),gn(e[n],t[n])):t[n]!=null?e[n]=t[n]:delete e[n]);for(n in o)_t(o,n)&&!_t(t,n)&&Dn(o[n])&&(e[n]=gn({},e[n]));return e}function rs(o){o!=null&&this.set(o)}var ls;Object.keys?ls=Object.keys:ls=function(o){var t,e=[];for(t in o)_t(o,t)&&e.push(t);return e};var ru={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function lu(o,t,e){var n=this._calendar[o]||this._calendar.sameElse;return xe(n)?n.call(t,e):n}function ke(o,t,e){var n=""+Math.abs(o),i=t-n.length,l=o>=0;return(l?e?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+n}var as=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,Bo=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,cs={},Gn={};function mt(o,t,e,n){var i=n;typeof n=="string"&&(i=function(){return this[n]()}),o&&(Gn[o]=i),t&&(Gn[t[0]]=function(){return ke(i.apply(this,arguments),t[1],t[2])}),e&&(Gn[e]=function(){return this.localeData().ordinal(i.apply(this,arguments),o)})}function au(o){return o.match(/\[[\s\S]/)?o.replace(/^\[|\]$/g,""):o.replace(/\\/g,"")}function cu(o){var t=o.match(as),e,n;for(e=0,n=t.length;e<n;e++)Gn[t[e]]?t[e]=Gn[t[e]]:t[e]=au(t[e]);return function(i){var l="",r;for(r=0;r<n;r++)l+=xe(t[r])?t[r].call(i,o):t[r];return l}}function xo(o,t){return o.isValid()?(t=Qr(t,o.localeData()),cs[t]=cs[t]||cu(t),cs[t](o)):o.localeData().invalidDate()}function Qr(o,t){var e=5;function n(i){return t.longDateFormat(i)||i}for(Bo.lastIndex=0;e>=0&&Bo.test(o);)o=o.replace(Bo,n),Bo.lastIndex=0,e-=1;return o}var du={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function uu(o){var t=this._longDateFormat[o],e=this._longDateFormat[o.toUpperCase()];return t||!e?t:(this._longDateFormat[o]=e.match(as).map(function(n){return n==="MMMM"||n==="MM"||n==="DD"||n==="dddd"?n.slice(1):n}).join(""),this._longDateFormat[o])}var hu="Invalid date";function Ru(){return this._invalidDate}var gu="%d",Tu=/\d{1,2}/;function fu(o){return this._ordinal.replace("%d",o)}var mu={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function Cu(o,t,e,n){var i=this._relativeTime[e];return xe(i)?i(o,t,e,n):i.replace(/%d/i,o)}function pu(o,t){var e=this._relativeTime[o>0?"future":"past"];return xe(e)?e(t):e.replace(/%s/i,t)}var Hr={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function Xe(o){return typeof o=="string"?Hr[o]||Hr[o.toLowerCase()]:void 0}function ds(o){var t={},e,n;for(n in o)_t(o,n)&&(e=Xe(n),e&&(t[e]=o[n]));return t}var Iu={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function Eu(o){var t=[],e;for(e in o)_t(o,e)&&t.push({unit:e,priority:Iu[e]});return t.sort(function(n,i){return n.priority-i.priority}),t}var Kr=/\d/,Pe=/\d\d/,Ar=/\d{3}/,us=/\d{4}/,ko=/[+-]?\d{6}/,oe=/\d\d?/,_r=/\d\d\d\d?/,Br=/\d\d\d\d\d\d?/,Go=/\d{1,3}/,hs=/\d{1,4}/,Jo=/[+-]?\d{1,6}/,Jn=/\d+/,$o=/[+-]?\d+/,Lu=/Z|[+-]\d\d:?\d\d/gi,zo=/Z|[+-]\d\d(?::?\d\d)?/gi,Pu=/[+-]?\d+(\.\d{1,3})?/,Ro=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,$n=/^[1-9]\d?/,Rs=/^([1-9]\d|\d)/,jo;jo={};function dt(o,t,e){jo[o]=xe(t)?t:function(n,i){return n&&e?e:t}}function Mu(o,t){return _t(jo,o)?jo[o](t._strict,t._locale):new RegExp(Ou(o))}function Ou(o){return tn(o.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(t,e,n,i,l){return e||n||i||l}))}function tn(o){return o.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function ye(o){return o<0?Math.ceil(o)||0:Math.floor(o)}function wt(o){var t=+o,e=0;return t!==0&&isFinite(t)&&(e=ye(t)),e}var gs={};function $t(o,t){var e,n=t,i;for(typeof o=="string"&&(o=[o]),qe(t)&&(n=function(l,r){r[t]=wt(l)}),i=o.length,e=0;e<i;e++)gs[o[e]]=n}function go(o,t){$t(o,function(e,n,i,l){i._w=i._w||{},t(e,i._w,i,l)})}function Su(o,t,e){t!=null&&_t(gs,o)&&gs[o](t,e._a,e,o)}function qo(o){return o%4===0&&o%100!==0||o%400===0}var fe=0,en=1,Ge=2,Re=3,Ue=4,nn=5,Fn=6,Du=7,Fu=8;mt("Y",0,0,function(){var o=this.year();return o<=9999?ke(o,4):"+"+o}),mt(0,["YY",2],0,function(){return this.year()%100}),mt(0,["YYYY",4],0,"year"),mt(0,["YYYYY",5],0,"year"),mt(0,["YYYYYY",6,!0],0,"year"),dt("Y",$o),dt("YY",oe,Pe),dt("YYYY",hs,us),dt("YYYYY",Jo,ko),dt("YYYYYY",Jo,ko),$t(["YYYYY","YYYYYY"],fe),$t("YYYY",function(o,t){t[fe]=o.length===2?at.parseTwoDigitYear(o):wt(o)}),$t("YY",function(o,t){t[fe]=at.parseTwoDigitYear(o)}),$t("Y",function(o,t){t[fe]=parseInt(o,10)});function To(o){return qo(o)?366:365}at.parseTwoDigitYear=function(o){return wt(o)+(wt(o)>68?1900:2e3)};var xr=zn("FullYear",!0);function Xu(){return qo(this.year())}function zn(o,t){return function(e){return e!=null?(kr(this,o,e),at.updateOffset(this,t),this):fo(this,o)}}function fo(o,t){if(!o.isValid())return NaN;var e=o._d,n=o._isUTC;switch(t){case"Milliseconds":return n?e.getUTCMilliseconds():e.getMilliseconds();case"Seconds":return n?e.getUTCSeconds():e.getSeconds();case"Minutes":return n?e.getUTCMinutes():e.getMinutes();case"Hours":return n?e.getUTCHours():e.getHours();case"Date":return n?e.getUTCDate():e.getDate();case"Day":return n?e.getUTCDay():e.getDay();case"Month":return n?e.getUTCMonth():e.getMonth();case"FullYear":return n?e.getUTCFullYear():e.getFullYear();default:return NaN}}function kr(o,t,e){var n,i,l,r,a;if(!(!o.isValid()||isNaN(e))){switch(n=o._d,i=o._isUTC,t){case"Milliseconds":return void(i?n.setUTCMilliseconds(e):n.setMilliseconds(e));case"Seconds":return void(i?n.setUTCSeconds(e):n.setSeconds(e));case"Minutes":return void(i?n.setUTCMinutes(e):n.setMinutes(e));case"Hours":return void(i?n.setUTCHours(e):n.setHours(e));case"Date":return void(i?n.setUTCDate(e):n.setDate(e));case"FullYear":break;default:return}l=e,r=o.month(),a=o.date(),a=a===29&&r===1&&!qo(l)?28:a,i?n.setUTCFullYear(l,r,a):n.setFullYear(l,r,a)}}function yu(o){return o=Xe(o),xe(this[o])?this[o]():this}function Nu(o,t){if(typeof o=="object"){o=ds(o);var e=Eu(o),n,i=e.length;for(n=0;n<i;n++)this[e[n].unit](o[e[n].unit])}else if(o=Xe(o),xe(this[o]))return this[o](t);return this}function bu(o,t){return(o%t+t)%t}var ue;Array.prototype.indexOf?ue=Array.prototype.indexOf:ue=function(o){var t;for(t=0;t<this.length;++t)if(this[t]===o)return t;return-1};function Ts(o,t){if(isNaN(o)||isNaN(t))return NaN;var e=bu(t,12);return o+=(t-e)/12,e===1?qo(o)?29:28:31-e%7%2}mt("M",["MM",2],"Mo",function(){return this.month()+1}),mt("MMM",0,0,function(o){return this.localeData().monthsShort(this,o)}),mt("MMMM",0,0,function(o){return this.localeData().months(this,o)}),dt("M",oe,$n),dt("MM",oe,Pe),dt("MMM",function(o,t){return t.monthsShortRegex(o)}),dt("MMMM",function(o,t){return t.monthsRegex(o)}),$t(["M","MM"],function(o,t){t[en]=wt(o)-1}),$t(["MMM","MMMM"],function(o,t,e,n){var i=e._locale.monthsParse(o,n,e._strict);i!=null?t[en]=i:Nt(e).invalidMonth=o});var Vu="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Gr="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Jr=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Wu=Ro,Uu=Ro;function Yu(o,t){return o?Ve(this._months)?this._months[o.month()]:this._months[(this._months.isFormat||Jr).test(t)?"format":"standalone"][o.month()]:Ve(this._months)?this._months:this._months.standalone}function wu(o,t){return o?Ve(this._monthsShort)?this._monthsShort[o.month()]:this._monthsShort[Jr.test(t)?"format":"standalone"][o.month()]:Ve(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function vu(o,t,e){var n,i,l,r=o.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],n=0;n<12;++n)l=Be([2e3,n]),this._shortMonthsParse[n]=this.monthsShort(l,"").toLocaleLowerCase(),this._longMonthsParse[n]=this.months(l,"").toLocaleLowerCase();return e?t==="MMM"?(i=ue.call(this._shortMonthsParse,r),i!==-1?i:null):(i=ue.call(this._longMonthsParse,r),i!==-1?i:null):t==="MMM"?(i=ue.call(this._shortMonthsParse,r),i!==-1?i:(i=ue.call(this._longMonthsParse,r),i!==-1?i:null)):(i=ue.call(this._longMonthsParse,r),i!==-1?i:(i=ue.call(this._shortMonthsParse,r),i!==-1?i:null))}function Zu(o,t,e){var n,i,l;if(this._monthsParseExact)return vu.call(this,o,t,e);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),n=0;n<12;n++){if(i=Be([2e3,n]),e&&!this._longMonthsParse[n]&&(this._longMonthsParse[n]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[n]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),!e&&!this._monthsParse[n]&&(l="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[n]=new RegExp(l.replace(".",""),"i")),e&&t==="MMMM"&&this._longMonthsParse[n].test(o))return n;if(e&&t==="MMM"&&this._shortMonthsParse[n].test(o))return n;if(!e&&this._monthsParse[n].test(o))return n}}function $r(o,t){if(!o.isValid())return o;if(typeof t=="string"){if(/^\d+$/.test(t))t=wt(t);else if(t=o.localeData().monthsParse(t),!qe(t))return o}var e=t,n=o.date();return n=n<29?n:Math.min(n,Ts(o.year(),e)),o._isUTC?o._d.setUTCMonth(e,n):o._d.setMonth(e,n),o}function zr(o){return o!=null?($r(this,o),at.updateOffset(this,!0),this):fo(this,"Month")}function Qu(){return Ts(this.year(),this.month())}function Hu(o){return this._monthsParseExact?(_t(this,"_monthsRegex")||jr.call(this),o?this._monthsShortStrictRegex:this._monthsShortRegex):(_t(this,"_monthsShortRegex")||(this._monthsShortRegex=Wu),this._monthsShortStrictRegex&&o?this._monthsShortStrictRegex:this._monthsShortRegex)}function Ku(o){return this._monthsParseExact?(_t(this,"_monthsRegex")||jr.call(this),o?this._monthsStrictRegex:this._monthsRegex):(_t(this,"_monthsRegex")||(this._monthsRegex=Uu),this._monthsStrictRegex&&o?this._monthsStrictRegex:this._monthsRegex)}function jr(){function o(c,d){return d.length-c.length}var t=[],e=[],n=[],i,l,r,a;for(i=0;i<12;i++)l=Be([2e3,i]),r=tn(this.monthsShort(l,"")),a=tn(this.months(l,"")),t.push(r),e.push(a),n.push(a),n.push(r);t.sort(o),e.sort(o),n.sort(o),this._monthsRegex=new RegExp("^("+n.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+e.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+t.join("|")+")","i")}function Au(o,t,e,n,i,l,r){var a;return o<100&&o>=0?(a=new Date(o+400,t,e,n,i,l,r),isFinite(a.getFullYear())&&a.setFullYear(o)):a=new Date(o,t,e,n,i,l,r),a}function mo(o){var t,e;return o<100&&o>=0?(e=Array.prototype.slice.call(arguments),e[0]=o+400,t=new Date(Date.UTC.apply(null,e)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(o)):t=new Date(Date.UTC.apply(null,arguments)),t}function ti(o,t,e){var n=7+t-e,i=(7+mo(o,0,n).getUTCDay()-t)%7;return-i+n-1}function qr(o,t,e,n,i){var l=(7+e-n)%7,r=ti(o,n,i),a=1+7*(t-1)+l+r,c,d;return a<=0?(c=o-1,d=To(c)+a):a>To(o)?(c=o+1,d=a-To(o)):(c=o,d=a),{year:c,dayOfYear:d}}function Co(o,t,e){var n=ti(o.year(),t,e),i=Math.floor((o.dayOfYear()-n-1)/7)+1,l,r;return i<1?(r=o.year()-1,l=i+on(r,t,e)):i>on(o.year(),t,e)?(l=i-on(o.year(),t,e),r=o.year()+1):(r=o.year(),l=i),{week:l,year:r}}function on(o,t,e){var n=ti(o,t,e),i=ti(o+1,t,e);return(To(o)-n+i)/7}mt("w",["ww",2],"wo","week"),mt("W",["WW",2],"Wo","isoWeek"),dt("w",oe,$n),dt("ww",oe,Pe),dt("W",oe,$n),dt("WW",oe,Pe),go(["w","ww","W","WW"],function(o,t,e,n){t[n.substr(0,1)]=wt(o)});function _u(o){return Co(o,this._week.dow,this._week.doy).week}var Bu={dow:0,doy:6};function xu(){return this._week.dow}function ku(){return this._week.doy}function Gu(o){var t=this.localeData().week(this);return o==null?t:this.add((o-t)*7,"d")}function Ju(o){var t=Co(this,1,4).week;return o==null?t:this.add((o-t)*7,"d")}mt("d",0,"do","day"),mt("dd",0,0,function(o){return this.localeData().weekdaysMin(this,o)}),mt("ddd",0,0,function(o){return this.localeData().weekdaysShort(this,o)}),mt("dddd",0,0,function(o){return this.localeData().weekdays(this,o)}),mt("e",0,0,"weekday"),mt("E",0,0,"isoWeekday"),dt("d",oe),dt("e",oe),dt("E",oe),dt("dd",function(o,t){return t.weekdaysMinRegex(o)}),dt("ddd",function(o,t){return t.weekdaysShortRegex(o)}),dt("dddd",function(o,t){return t.weekdaysRegex(o)}),go(["dd","ddd","dddd"],function(o,t,e,n){var i=e._locale.weekdaysParse(o,n,e._strict);i!=null?t.d=i:Nt(e).invalidWeekday=o}),go(["d","e","E"],function(o,t,e,n){t[n]=wt(o)});function $u(o,t){return typeof o!="string"?o:isNaN(o)?(o=t.weekdaysParse(o),typeof o=="number"?o:null):parseInt(o,10)}function zu(o,t){return typeof o=="string"?t.weekdaysParse(o)%7||7:isNaN(o)?null:o}function fs(o,t){return o.slice(t,7).concat(o.slice(0,t))}var ju="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),tl="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),qu="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),th=Ro,eh=Ro,nh=Ro;function oh(o,t){var e=Ve(this._weekdays)?this._weekdays:this._weekdays[o&&o!==!0&&this._weekdays.isFormat.test(t)?"format":"standalone"];return o===!0?fs(e,this._week.dow):o?e[o.day()]:e}function ih(o){return o===!0?fs(this._weekdaysShort,this._week.dow):o?this._weekdaysShort[o.day()]:this._weekdaysShort}function sh(o){return o===!0?fs(this._weekdaysMin,this._week.dow):o?this._weekdaysMin[o.day()]:this._weekdaysMin}function rh(o,t,e){var n,i,l,r=o.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],n=0;n<7;++n)l=Be([2e3,1]).day(n),this._minWeekdaysParse[n]=this.weekdaysMin(l,"").toLocaleLowerCase(),this._shortWeekdaysParse[n]=this.weekdaysShort(l,"").toLocaleLowerCase(),this._weekdaysParse[n]=this.weekdays(l,"").toLocaleLowerCase();return e?t==="dddd"?(i=ue.call(this._weekdaysParse,r),i!==-1?i:null):t==="ddd"?(i=ue.call(this._shortWeekdaysParse,r),i!==-1?i:null):(i=ue.call(this._minWeekdaysParse,r),i!==-1?i:null):t==="dddd"?(i=ue.call(this._weekdaysParse,r),i!==-1||(i=ue.call(this._shortWeekdaysParse,r),i!==-1)?i:(i=ue.call(this._minWeekdaysParse,r),i!==-1?i:null)):t==="ddd"?(i=ue.call(this._shortWeekdaysParse,r),i!==-1||(i=ue.call(this._weekdaysParse,r),i!==-1)?i:(i=ue.call(this._minWeekdaysParse,r),i!==-1?i:null)):(i=ue.call(this._minWeekdaysParse,r),i!==-1||(i=ue.call(this._weekdaysParse,r),i!==-1)?i:(i=ue.call(this._shortWeekdaysParse,r),i!==-1?i:null))}function lh(o,t,e){var n,i,l;if(this._weekdaysParseExact)return rh.call(this,o,t,e);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),n=0;n<7;n++){if(i=Be([2e3,1]).day(n),e&&!this._fullWeekdaysParse[n]&&(this._fullWeekdaysParse[n]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[n]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[n]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[n]||(l="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[n]=new RegExp(l.replace(".",""),"i")),e&&t==="dddd"&&this._fullWeekdaysParse[n].test(o))return n;if(e&&t==="ddd"&&this._shortWeekdaysParse[n].test(o))return n;if(e&&t==="dd"&&this._minWeekdaysParse[n].test(o))return n;if(!e&&this._weekdaysParse[n].test(o))return n}}function ah(o){if(!this.isValid())return o!=null?this:NaN;var t=fo(this,"Day");return o!=null?(o=$u(o,this.localeData()),this.add(o-t,"d")):t}function ch(o){if(!this.isValid())return o!=null?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return o==null?t:this.add(o-t,"d")}function dh(o){if(!this.isValid())return o!=null?this:NaN;if(o!=null){var t=zu(o,this.localeData());return this.day(this.day()%7?t:t-7)}else return this.day()||7}function uh(o){return this._weekdaysParseExact?(_t(this,"_weekdaysRegex")||ms.call(this),o?this._weekdaysStrictRegex:this._weekdaysRegex):(_t(this,"_weekdaysRegex")||(this._weekdaysRegex=th),this._weekdaysStrictRegex&&o?this._weekdaysStrictRegex:this._weekdaysRegex)}function hh(o){return this._weekdaysParseExact?(_t(this,"_weekdaysRegex")||ms.call(this),o?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(_t(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=eh),this._weekdaysShortStrictRegex&&o?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Rh(o){return this._weekdaysParseExact?(_t(this,"_weekdaysRegex")||ms.call(this),o?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(_t(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=nh),this._weekdaysMinStrictRegex&&o?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function ms(){function o(u,R){return R.length-u.length}var t=[],e=[],n=[],i=[],l,r,a,c,d;for(l=0;l<7;l++)r=Be([2e3,1]).day(l),a=tn(this.weekdaysMin(r,"")),c=tn(this.weekdaysShort(r,"")),d=tn(this.weekdays(r,"")),t.push(a),e.push(c),n.push(d),i.push(a),i.push(c),i.push(d);t.sort(o),e.sort(o),n.sort(o),i.sort(o),this._weekdaysRegex=new RegExp("^("+i.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+n.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+e.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+t.join("|")+")","i")}function Cs(){return this.hours()%12||12}function gh(){return this.hours()||24}mt("H",["HH",2],0,"hour"),mt("h",["hh",2],0,Cs),mt("k",["kk",2],0,gh),mt("hmm",0,0,function(){return""+Cs.apply(this)+ke(this.minutes(),2)}),mt("hmmss",0,0,function(){return""+Cs.apply(this)+ke(this.minutes(),2)+ke(this.seconds(),2)}),mt("Hmm",0,0,function(){return""+this.hours()+ke(this.minutes(),2)}),mt("Hmmss",0,0,function(){return""+this.hours()+ke(this.minutes(),2)+ke(this.seconds(),2)});function el(o,t){mt(o,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}el("a",!0),el("A",!1);function nl(o,t){return t._meridiemParse}dt("a",nl),dt("A",nl),dt("H",oe,Rs),dt("h",oe,$n),dt("k",oe,$n),dt("HH",oe,Pe),dt("hh",oe,Pe),dt("kk",oe,Pe),dt("hmm",_r),dt("hmmss",Br),dt("Hmm",_r),dt("Hmmss",Br),$t(["H","HH"],Re),$t(["k","kk"],function(o,t,e){var n=wt(o);t[Re]=n===24?0:n}),$t(["a","A"],function(o,t,e){e._isPm=e._locale.isPM(o),e._meridiem=o}),$t(["h","hh"],function(o,t,e){t[Re]=wt(o),Nt(e).bigHour=!0}),$t("hmm",function(o,t,e){var n=o.length-2;t[Re]=wt(o.substr(0,n)),t[Ue]=wt(o.substr(n)),Nt(e).bigHour=!0}),$t("hmmss",function(o,t,e){var n=o.length-4,i=o.length-2;t[Re]=wt(o.substr(0,n)),t[Ue]=wt(o.substr(n,2)),t[nn]=wt(o.substr(i)),Nt(e).bigHour=!0}),$t("Hmm",function(o,t,e){var n=o.length-2;t[Re]=wt(o.substr(0,n)),t[Ue]=wt(o.substr(n))}),$t("Hmmss",function(o,t,e){var n=o.length-4,i=o.length-2;t[Re]=wt(o.substr(0,n)),t[Ue]=wt(o.substr(n,2)),t[nn]=wt(o.substr(i))});function Th(o){return(o+"").toLowerCase().charAt(0)==="p"}var fh=/[ap]\.?m?\.?/i,mh=zn("Hours",!0);function Ch(o,t,e){return o>11?e?"pm":"PM":e?"am":"AM"}var ol={calendar:ru,longDateFormat:du,invalidDate:hu,ordinal:gu,dayOfMonthOrdinalParse:Tu,relativeTime:mu,months:Vu,monthsShort:Gr,week:Bu,weekdays:ju,weekdaysMin:qu,weekdaysShort:tl,meridiemParse:fh},se={},po={},Io;function ph(o,t){var e,n=Math.min(o.length,t.length);for(e=0;e<n;e+=1)if(o[e]!==t[e])return e;return n}function il(o){return o&&o.toLowerCase().replace("_","-")}function Ih(o){for(var t=0,e,n,i,l;t<o.length;){for(l=il(o[t]).split("-"),e=l.length,n=il(o[t+1]),n=n?n.split("-"):null;e>0;){if(i=ei(l.slice(0,e).join("-")),i)return i;if(n&&n.length>=e&&ph(l,n)>=e-1)break;e--}t++}return Io}function Eh(o){return!!(o&&o.match("^[^/\\\\]*$"))}function ei(o){var t=null,e;if(se[o]===void 0&&typeof module<"u"&&module&&module.exports&&Eh(o))try{t=Io._abbr,e=require,e("./locale/"+o),Tn(t)}catch{se[o]=null}return se[o]}function Tn(o,t){var e;return o&&(pe(t)?e=sn(o):e=ps(o,t),e?Io=e:typeof console<"u"&&console.warn&&console.warn("Locale "+o+" not found. Did you forget to load it?")),Io._abbr}function ps(o,t){if(t!==null){var e,n=ol;if(t.abbr=o,se[o]!=null)Zr("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),n=se[o]._config;else if(t.parentLocale!=null)if(se[t.parentLocale]!=null)n=se[t.parentLocale]._config;else if(e=ei(t.parentLocale),e!=null)n=e._config;else return po[t.parentLocale]||(po[t.parentLocale]=[]),po[t.parentLocale].push({name:o,config:t}),null;return se[o]=new rs(ss(n,t)),po[o]&&po[o].forEach(function(i){ps(i.name,i.config)}),Tn(o),se[o]}else return delete se[o],null}function Lh(o,t){if(t!=null){var e,n,i=ol;se[o]!=null&&se[o].parentLocale!=null?se[o].set(ss(se[o]._config,t)):(n=ei(o),n!=null&&(i=n._config),t=ss(i,t),n==null&&(t.abbr=o),e=new rs(t),e.parentLocale=se[o],se[o]=e),Tn(o)}else se[o]!=null&&(se[o].parentLocale!=null?(se[o]=se[o].parentLocale,o===Tn()&&Tn(o)):se[o]!=null&&delete se[o]);return se[o]}function sn(o){var t;if(o&&o._locale&&o._locale._abbr&&(o=o._locale._abbr),!o)return Io;if(!Ve(o)){if(t=ei(o),t)return t;o=[o]}return Ih(o)}function Ph(){return ls(se)}function Is(o){var t,e=o._a;return e&&Nt(o).overflow===-2&&(t=e[en]<0||e[en]>11?en:e[Ge]<1||e[Ge]>Ts(e[fe],e[en])?Ge:e[Re]<0||e[Re]>24||e[Re]===24&&(e[Ue]!==0||e[nn]!==0||e[Fn]!==0)?Re:e[Ue]<0||e[Ue]>59?Ue:e[nn]<0||e[nn]>59?nn:e[Fn]<0||e[Fn]>999?Fn:-1,Nt(o)._overflowDayOfYear&&(t<fe||t>Ge)&&(t=Ge),Nt(o)._overflowWeeks&&t===-1&&(t=Du),Nt(o)._overflowWeekday&&t===-1&&(t=Fu),Nt(o).overflow=t),o}var Mh=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Oh=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Sh=/Z|[+-]\d\d(?::?\d\d)?/,ni=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],Es=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Dh=/^\/?Date\((-?\d+)/i,Fh=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,Xh={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function sl(o){var t,e,n=o._i,i=Mh.exec(n)||Oh.exec(n),l,r,a,c,d=ni.length,u=Es.length;if(i){for(Nt(o).iso=!0,t=0,e=d;t<e;t++)if(ni[t][1].exec(i[1])){r=ni[t][0],l=ni[t][2]!==!1;break}if(r==null){o._isValid=!1;return}if(i[3]){for(t=0,e=u;t<e;t++)if(Es[t][1].exec(i[3])){a=(i[2]||" ")+Es[t][0];break}if(a==null){o._isValid=!1;return}}if(!l&&a!=null){o._isValid=!1;return}if(i[4])if(Sh.exec(i[4]))c="Z";else{o._isValid=!1;return}o._f=r+(a||"")+(c||""),Ps(o)}else o._isValid=!1}function yh(o,t,e,n,i,l){var r=[Nh(o),Gr.indexOf(t),parseInt(e,10),parseInt(n,10),parseInt(i,10)];return l&&r.push(parseInt(l,10)),r}function Nh(o){var t=parseInt(o,10);return t<=49?2e3+t:t<=999?1900+t:t}function bh(o){return o.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function Vh(o,t,e){if(o){var n=tl.indexOf(o),i=new Date(t[0],t[1],t[2]).getDay();if(n!==i)return Nt(e).weekdayMismatch=!0,e._isValid=!1,!1}return!0}function Wh(o,t,e){if(o)return Xh[o];if(t)return 0;var n=parseInt(e,10),i=n%100,l=(n-i)/100;return l*60+i}function rl(o){var t=Fh.exec(bh(o._i)),e;if(t){if(e=yh(t[4],t[3],t[2],t[5],t[6],t[7]),!Vh(t[1],e,o))return;o._a=e,o._tzm=Wh(t[8],t[9],t[10]),o._d=mo.apply(null,o._a),o._d.setUTCMinutes(o._d.getUTCMinutes()-o._tzm),Nt(o).rfc2822=!0}else o._isValid=!1}function Uh(o){var t=Dh.exec(o._i);if(t!==null){o._d=new Date(+t[1]);return}if(sl(o),o._isValid===!1)delete o._isValid;else return;if(rl(o),o._isValid===!1)delete o._isValid;else return;o._strict?o._isValid=!1:at.createFromInputFallback(o)}at.createFromInputFallback=Fe("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(o){o._d=new Date(o._i+(o._useUTC?" UTC":""))});function jn(o,t,e){return o??t??e}function Yh(o){var t=new Date(at.now());return o._useUTC?[t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()]:[t.getFullYear(),t.getMonth(),t.getDate()]}function Ls(o){var t,e,n=[],i,l,r;if(!o._d){for(i=Yh(o),o._w&&o._a[Ge]==null&&o._a[en]==null&&wh(o),o._dayOfYear!=null&&(r=jn(o._a[fe],i[fe]),(o._dayOfYear>To(r)||o._dayOfYear===0)&&(Nt(o)._overflowDayOfYear=!0),e=mo(r,0,o._dayOfYear),o._a[en]=e.getUTCMonth(),o._a[Ge]=e.getUTCDate()),t=0;t<3&&o._a[t]==null;++t)o._a[t]=n[t]=i[t];for(;t<7;t++)o._a[t]=n[t]=o._a[t]==null?t===2?1:0:o._a[t];o._a[Re]===24&&o._a[Ue]===0&&o._a[nn]===0&&o._a[Fn]===0&&(o._nextDay=!0,o._a[Re]=0),o._d=(o._useUTC?mo:Au).apply(null,n),l=o._useUTC?o._d.getUTCDay():o._d.getDay(),o._tzm!=null&&o._d.setUTCMinutes(o._d.getUTCMinutes()-o._tzm),o._nextDay&&(o._a[Re]=24),o._w&&typeof o._w.d<"u"&&o._w.d!==l&&(Nt(o).weekdayMismatch=!0)}}function wh(o){var t,e,n,i,l,r,a,c,d;t=o._w,t.GG!=null||t.W!=null||t.E!=null?(l=1,r=4,e=jn(t.GG,o._a[fe],Co(ie(),1,4).year),n=jn(t.W,1),i=jn(t.E,1),(i<1||i>7)&&(c=!0)):(l=o._locale._week.dow,r=o._locale._week.doy,d=Co(ie(),l,r),e=jn(t.gg,o._a[fe],d.year),n=jn(t.w,d.week),t.d!=null?(i=t.d,(i<0||i>6)&&(c=!0)):t.e!=null?(i=t.e+l,(t.e<0||t.e>6)&&(c=!0)):i=l),n<1||n>on(e,l,r)?Nt(o)._overflowWeeks=!0:c!=null?Nt(o)._overflowWeekday=!0:(a=qr(e,n,i,l,r),o._a[fe]=a.year,o._dayOfYear=a.dayOfYear)}at.ISO_8601=function(){},at.RFC_2822=function(){};function Ps(o){if(o._f===at.ISO_8601){sl(o);return}if(o._f===at.RFC_2822){rl(o);return}o._a=[],Nt(o).empty=!0;var t=""+o._i,e,n,i,l,r,a=t.length,c=0,d,u;for(i=Qr(o._f,o._locale).match(as)||[],u=i.length,e=0;e<u;e++)l=i[e],n=(t.match(Mu(l,o))||[])[0],n&&(r=t.substr(0,t.indexOf(n)),r.length>0&&Nt(o).unusedInput.push(r),t=t.slice(t.indexOf(n)+n.length),c+=n.length),Gn[l]?(n?Nt(o).empty=!1:Nt(o).unusedTokens.push(l),Su(l,n,o)):o._strict&&!n&&Nt(o).unusedTokens.push(l);Nt(o).charsLeftOver=a-c,t.length>0&&Nt(o).unusedInput.push(t),o._a[Re]<=12&&Nt(o).bigHour===!0&&o._a[Re]>0&&(Nt(o).bigHour=void 0),Nt(o).parsedDateParts=o._a.slice(0),Nt(o).meridiem=o._meridiem,o._a[Re]=vh(o._locale,o._a[Re],o._meridiem),d=Nt(o).era,d!==null&&(o._a[fe]=o._locale.erasConvertYear(d,o._a[fe])),Ls(o),Is(o)}function vh(o,t,e){var n;return e==null?t:o.meridiemHour!=null?o.meridiemHour(t,e):(o.isPM!=null&&(n=o.isPM(e),n&&t<12&&(t+=12),!n&&t===12&&(t=0)),t)}function Zh(o){var t,e,n,i,l,r,a=!1,c=o._f.length;if(c===0){Nt(o).invalidFormat=!0,o._d=new Date(NaN);return}for(i=0;i<c;i++)l=0,r=!1,t=is({},o),o._useUTC!=null&&(t._useUTC=o._useUTC),t._f=o._f[i],Ps(t),ns(t)&&(r=!0),l+=Nt(t).charsLeftOver,l+=Nt(t).unusedTokens.length*10,Nt(t).score=l,a?l<n&&(n=l,e=t):(n==null||l<n||r)&&(n=l,e=t,r&&(a=!0));gn(o,e||t)}function Qh(o){if(!o._d){var t=ds(o._i),e=t.day===void 0?t.date:t.day;o._a=Ur([t.year,t.month,e,t.hour,t.minute,t.second,t.millisecond],function(n){return n&&parseInt(n,10)}),Ls(o)}}function Hh(o){var t=new ho(Is(ll(o)));return t._nextDay&&(t.add(1,"d"),t._nextDay=void 0),t}function ll(o){var t=o._i,e=o._f;return o._locale=o._locale||sn(o._l),t===null||e===void 0&&t===""?_o({nullInput:!0}):(typeof t=="string"&&(o._i=t=o._locale.preparse(t)),We(t)?new ho(Is(t)):(uo(t)?o._d=t:Ve(e)?Zh(o):e?Ps(o):Kh(o),ns(o)||(o._d=null),o))}function Kh(o){var t=o._i;pe(t)?o._d=new Date(at.now()):uo(t)?o._d=new Date(t.valueOf()):typeof t=="string"?Uh(o):Ve(t)?(o._a=Ur(t.slice(0),function(e){return parseInt(e,10)}),Ls(o)):Dn(t)?Qh(o):qe(t)?o._d=new Date(t):at.createFromInputFallback(o)}function al(o,t,e,n,i){var l={};return(t===!0||t===!1)&&(n=t,t=void 0),(e===!0||e===!1)&&(n=e,e=void 0),(Dn(o)&&ts(o)||Ve(o)&&o.length===0)&&(o=void 0),l._isAMomentObject=!0,l._useUTC=l._isUTC=i,l._l=e,l._i=o,l._f=t,l._strict=n,Hh(l)}function ie(o,t,e,n){return al(o,t,e,n,!1)}var Ah=Fe("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var o=ie.apply(null,arguments);return this.isValid()&&o.isValid()?o<this?this:o:_o()}),_h=Fe("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var o=ie.apply(null,arguments);return this.isValid()&&o.isValid()?o>this?this:o:_o()});function cl(o,t){var e,n;if(t.length===1&&Ve(t[0])&&(t=t[0]),!t.length)return ie();for(e=t[0],n=1;n<t.length;++n)(!t[n].isValid()||t[n][o](e))&&(e=t[n]);return e}function Bh(){var o=[].slice.call(arguments,0);return cl("isBefore",o)}function xh(){var o=[].slice.call(arguments,0);return cl("isAfter",o)}var kh=function(){return Date.now?Date.now():+new Date},Eo=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Gh(o){var t,e=!1,n,i=Eo.length;for(t in o)if(_t(o,t)&&!(ue.call(Eo,t)!==-1&&(o[t]==null||!isNaN(o[t]))))return!1;for(n=0;n<i;++n)if(o[Eo[n]]){if(e)return!1;parseFloat(o[Eo[n]])!==wt(o[Eo[n]])&&(e=!0)}return!0}function Jh(){return this._isValid}function $h(){return Ye(NaN)}function oi(o){var t=ds(o),e=t.year||0,n=t.quarter||0,i=t.month||0,l=t.week||t.isoWeek||0,r=t.day||0,a=t.hour||0,c=t.minute||0,d=t.second||0,u=t.millisecond||0;this._isValid=Gh(t),this._milliseconds=+u+d*1e3+c*6e4+a*1e3*60*60,this._days=+r+l*7,this._months=+i+n*3+e*12,this._data={},this._locale=sn(),this._bubble()}function ii(o){return o instanceof oi}function Ms(o){return o<0?Math.round(-1*o)*-1:Math.round(o)}function zh(o,t,e){var n=Math.min(o.length,t.length),i=Math.abs(o.length-t.length),l=0,r;for(r=0;r<n;r++)wt(o[r])!==wt(t[r])&&l++;return l+i}function dl(o,t){mt(o,0,0,function(){var e=this.utcOffset(),n="+";return e<0&&(e=-e,n="-"),n+ke(~~(e/60),2)+t+ke(~~e%60,2)})}dl("Z",":"),dl("ZZ",""),dt("Z",zo),dt("ZZ",zo),$t(["Z","ZZ"],function(o,t,e){e._useUTC=!0,e._tzm=Os(zo,o)});var jh=/([\+\-]|\d\d)/gi;function Os(o,t){var e=(t||"").match(o),n,i,l;return e===null?null:(n=e[e.length-1]||[],i=(n+"").match(jh)||["-",0,0],l=+(i[1]*60)+wt(i[2]),l===0?0:i[0]==="+"?l:-l)}function Ss(o,t){var e,n;return t._isUTC?(e=t.clone(),n=(We(o)||uo(o)?o.valueOf():ie(o).valueOf())-e.valueOf(),e._d.setTime(e._d.valueOf()+n),at.updateOffset(e,!1),e):ie(o).local()}function Ds(o){return-Math.round(o._d.getTimezoneOffset())}at.updateOffset=function(){};function qh(o,t,e){var n=this._offset||0,i;if(!this.isValid())return o!=null?this:NaN;if(o!=null){if(typeof o=="string"){if(o=Os(zo,o),o===null)return this}else Math.abs(o)<16&&!e&&(o=o*60);return!this._isUTC&&t&&(i=Ds(this)),this._offset=o,this._isUTC=!0,i!=null&&this.add(i,"m"),n!==o&&(!t||this._changeInProgress?gl(this,Ye(o-n,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,at.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?n:Ds(this)}function tR(o,t){return o!=null?(typeof o!="string"&&(o=-o),this.utcOffset(o,t),this):-this.utcOffset()}function eR(o){return this.utcOffset(0,o)}function nR(o){return this._isUTC&&(this.utcOffset(0,o),this._isUTC=!1,o&&this.subtract(Ds(this),"m")),this}function oR(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var o=Os(Lu,this._i);o!=null?this.utcOffset(o):this.utcOffset(0,!0)}return this}function iR(o){return this.isValid()?(o=o?ie(o).utcOffset():0,(this.utcOffset()-o)%60===0):!1}function sR(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function rR(){if(!pe(this._isDSTShifted))return this._isDSTShifted;var o={},t;return is(o,this),o=ll(o),o._a?(t=o._isUTC?Be(o._a):ie(o._a),this._isDSTShifted=this.isValid()&&zh(o._a,t.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function lR(){return this.isValid()?!this._isUTC:!1}function aR(){return this.isValid()?this._isUTC:!1}function ul(){return this.isValid()?this._isUTC&&this._offset===0:!1}var cR=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,dR=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Ye(o,t){var e=o,n=null,i,l,r;return ii(o)?e={ms:o._milliseconds,d:o._days,M:o._months}:qe(o)||!isNaN(+o)?(e={},t?e[t]=+o:e.milliseconds=+o):(n=cR.exec(o))?(i=n[1]==="-"?-1:1,e={y:0,d:wt(n[Ge])*i,h:wt(n[Re])*i,m:wt(n[Ue])*i,s:wt(n[nn])*i,ms:wt(Ms(n[Fn]*1e3))*i}):(n=dR.exec(o))?(i=n[1]==="-"?-1:1,e={y:Xn(n[2],i),M:Xn(n[3],i),w:Xn(n[4],i),d:Xn(n[5],i),h:Xn(n[6],i),m:Xn(n[7],i),s:Xn(n[8],i)}):e==null?e={}:typeof e=="object"&&("from"in e||"to"in e)&&(r=uR(ie(e.from),ie(e.to)),e={},e.ms=r.milliseconds,e.M=r.months),l=new oi(e),ii(o)&&_t(o,"_locale")&&(l._locale=o._locale),ii(o)&&_t(o,"_isValid")&&(l._isValid=o._isValid),l}Ye.fn=oi.prototype,Ye.invalid=$h;function Xn(o,t){var e=o&&parseFloat(o.replace(",","."));return(isNaN(e)?0:e)*t}function hl(o,t){var e={};return e.months=t.month()-o.month()+(t.year()-o.year())*12,o.clone().add(e.months,"M").isAfter(t)&&--e.months,e.milliseconds=+t-+o.clone().add(e.months,"M"),e}function uR(o,t){var e;return o.isValid()&&t.isValid()?(t=Ss(t,o),o.isBefore(t)?e=hl(o,t):(e=hl(t,o),e.milliseconds=-e.milliseconds,e.months=-e.months),e):{milliseconds:0,months:0}}function Rl(o,t){return function(e,n){var i,l;return n!==null&&!isNaN(+n)&&(Zr(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),l=e,e=n,n=l),i=Ye(e,n),gl(this,i,o),this}}function gl(o,t,e,n){var i=t._milliseconds,l=Ms(t._days),r=Ms(t._months);o.isValid()&&(n=n??!0,r&&$r(o,fo(o,"Month")+r*e),l&&kr(o,"Date",fo(o,"Date")+l*e),i&&o._d.setTime(o._d.valueOf()+i*e),n&&at.updateOffset(o,l||r))}var hR=Rl(1,"add"),RR=Rl(-1,"subtract");function Tl(o){return typeof o=="string"||o instanceof String}function gR(o){return We(o)||uo(o)||Tl(o)||qe(o)||fR(o)||TR(o)||o===null||o===void 0}function TR(o){var t=Dn(o)&&!ts(o),e=!1,n=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],i,l,r=n.length;for(i=0;i<r;i+=1)l=n[i],e=e||_t(o,l);return t&&e}function fR(o){var t=Ve(o),e=!1;return t&&(e=o.filter(function(n){return!qe(n)&&Tl(o)}).length===0),t&&e}function mR(o){var t=Dn(o)&&!ts(o),e=!1,n=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],i,l;for(i=0;i<n.length;i+=1)l=n[i],e=e||_t(o,l);return t&&e}function CR(o,t){var e=o.diff(t,"days",!0);return e<-6?"sameElse":e<-1?"lastWeek":e<0?"lastDay":e<1?"sameDay":e<2?"nextDay":e<7?"nextWeek":"sameElse"}function pR(o,t){arguments.length===1&&(arguments[0]?gR(arguments[0])?(o=arguments[0],t=void 0):mR(arguments[0])&&(t=arguments[0],o=void 0):(o=void 0,t=void 0));var e=o||ie(),n=Ss(e,this).startOf("day"),i=at.calendarFormat(this,n)||"sameElse",l=t&&(xe(t[i])?t[i].call(this,e):t[i]);return this.format(l||this.localeData().calendar(i,this,ie(e)))}function IR(){return new ho(this)}function ER(o,t){var e=We(o)?o:ie(o);return this.isValid()&&e.isValid()?(t=Xe(t)||"millisecond",t==="millisecond"?this.valueOf()>e.valueOf():e.valueOf()<this.clone().startOf(t).valueOf()):!1}function LR(o,t){var e=We(o)?o:ie(o);return this.isValid()&&e.isValid()?(t=Xe(t)||"millisecond",t==="millisecond"?this.valueOf()<e.valueOf():this.clone().endOf(t).valueOf()<e.valueOf()):!1}function PR(o,t,e,n){var i=We(o)?o:ie(o),l=We(t)?t:ie(t);return this.isValid()&&i.isValid()&&l.isValid()?(n=n||"()",(n[0]==="("?this.isAfter(i,e):!this.isBefore(i,e))&&(n[1]===")"?this.isBefore(l,e):!this.isAfter(l,e))):!1}function MR(o,t){var e=We(o)?o:ie(o),n;return this.isValid()&&e.isValid()?(t=Xe(t)||"millisecond",t==="millisecond"?this.valueOf()===e.valueOf():(n=e.valueOf(),this.clone().startOf(t).valueOf()<=n&&n<=this.clone().endOf(t).valueOf())):!1}function OR(o,t){return this.isSame(o,t)||this.isAfter(o,t)}function SR(o,t){return this.isSame(o,t)||this.isBefore(o,t)}function DR(o,t,e){var n,i,l;if(!this.isValid())return NaN;if(n=Ss(o,this),!n.isValid())return NaN;switch(i=(n.utcOffset()-this.utcOffset())*6e4,t=Xe(t),t){case"year":l=si(this,n)/12;break;case"month":l=si(this,n);break;case"quarter":l=si(this,n)/3;break;case"second":l=(this-n)/1e3;break;case"minute":l=(this-n)/6e4;break;case"hour":l=(this-n)/36e5;break;case"day":l=(this-n-i)/864e5;break;case"week":l=(this-n-i)/6048e5;break;default:l=this-n}return e?l:ye(l)}function si(o,t){if(o.date()<t.date())return-si(t,o);var e=(t.year()-o.year())*12+(t.month()-o.month()),n=o.clone().add(e,"months"),i,l;return t-n<0?(i=o.clone().add(e-1,"months"),l=(t-n)/(n-i)):(i=o.clone().add(e+1,"months"),l=(t-n)/(i-n)),-(e+l)||0}at.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",at.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function FR(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function XR(o){if(!this.isValid())return null;var t=o!==!0,e=t?this.clone().utc():this;return e.year()<0||e.year()>9999?xo(e,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):xe(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",xo(e,"Z")):xo(e,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function yR(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var o="moment",t="",e,n,i,l;return this.isLocal()||(o=this.utcOffset()===0?"moment.utc":"moment.parseZone",t="Z"),e="["+o+'("]',n=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",i="-MM-DD[T]HH:mm:ss.SSS",l=t+'[")]',this.format(e+n+i+l)}function NR(o){o||(o=this.isUtc()?at.defaultFormatUtc:at.defaultFormat);var t=xo(this,o);return this.localeData().postformat(t)}function bR(o,t){return this.isValid()&&(We(o)&&o.isValid()||ie(o).isValid())?Ye({to:this,from:o}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function VR(o){return this.from(ie(),o)}function WR(o,t){return this.isValid()&&(We(o)&&o.isValid()||ie(o).isValid())?Ye({from:this,to:o}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function UR(o){return this.to(ie(),o)}function fl(o){var t;return o===void 0?this._locale._abbr:(t=sn(o),t!=null&&(this._locale=t),this)}var ml=Fe("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(o){return o===void 0?this.localeData():this.locale(o)});function Cl(){return this._locale}var ri=1e3,qn=60*ri,li=60*qn,pl=(365*400+97)*24*li;function to(o,t){return(o%t+t)%t}function Il(o,t,e){return o<100&&o>=0?new Date(o+400,t,e)-pl:new Date(o,t,e).valueOf()}function El(o,t,e){return o<100&&o>=0?Date.UTC(o+400,t,e)-pl:Date.UTC(o,t,e)}function YR(o){var t,e;if(o=Xe(o),o===void 0||o==="millisecond"||!this.isValid())return this;switch(e=this._isUTC?El:Il,o){case"year":t=e(this.year(),0,1);break;case"quarter":t=e(this.year(),this.month()-this.month()%3,1);break;case"month":t=e(this.year(),this.month(),1);break;case"week":t=e(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=e(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=e(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=to(t+(this._isUTC?0:this.utcOffset()*qn),li);break;case"minute":t=this._d.valueOf(),t-=to(t,qn);break;case"second":t=this._d.valueOf(),t-=to(t,ri);break}return this._d.setTime(t),at.updateOffset(this,!0),this}function wR(o){var t,e;if(o=Xe(o),o===void 0||o==="millisecond"||!this.isValid())return this;switch(e=this._isUTC?El:Il,o){case"year":t=e(this.year()+1,0,1)-1;break;case"quarter":t=e(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=e(this.year(),this.month()+1,1)-1;break;case"week":t=e(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=e(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=e(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=li-to(t+(this._isUTC?0:this.utcOffset()*qn),li)-1;break;case"minute":t=this._d.valueOf(),t+=qn-to(t,qn)-1;break;case"second":t=this._d.valueOf(),t+=ri-to(t,ri)-1;break}return this._d.setTime(t),at.updateOffset(this,!0),this}function vR(){return this._d.valueOf()-(this._offset||0)*6e4}function ZR(){return Math.floor(this.valueOf()/1e3)}function QR(){return new Date(this.valueOf())}function HR(){var o=this;return[o.year(),o.month(),o.date(),o.hour(),o.minute(),o.second(),o.millisecond()]}function KR(){var o=this;return{years:o.year(),months:o.month(),date:o.date(),hours:o.hours(),minutes:o.minutes(),seconds:o.seconds(),milliseconds:o.milliseconds()}}function AR(){return this.isValid()?this.toISOString():null}function _R(){return ns(this)}function BR(){return gn({},Nt(this))}function xR(){return Nt(this).overflow}function kR(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}mt("N",0,0,"eraAbbr"),mt("NN",0,0,"eraAbbr"),mt("NNN",0,0,"eraAbbr"),mt("NNNN",0,0,"eraName"),mt("NNNNN",0,0,"eraNarrow"),mt("y",["y",1],"yo","eraYear"),mt("y",["yy",2],0,"eraYear"),mt("y",["yyy",3],0,"eraYear"),mt("y",["yyyy",4],0,"eraYear"),dt("N",Fs),dt("NN",Fs),dt("NNN",Fs),dt("NNNN",ig),dt("NNNNN",sg),$t(["N","NN","NNN","NNNN","NNNNN"],function(o,t,e,n){var i=e._locale.erasParse(o,n,e._strict);i?Nt(e).era=i:Nt(e).invalidEra=o}),dt("y",Jn),dt("yy",Jn),dt("yyy",Jn),dt("yyyy",Jn),dt("yo",rg),$t(["y","yy","yyy","yyyy"],fe),$t(["yo"],function(o,t,e,n){var i;e._locale._eraYearOrdinalRegex&&(i=o.match(e._locale._eraYearOrdinalRegex)),e._locale.eraYearOrdinalParse?t[fe]=e._locale.eraYearOrdinalParse(o,i):t[fe]=parseInt(o,10)});function GR(o,t){var e,n,i,l=this._eras||sn("en")._eras;for(e=0,n=l.length;e<n;++e)switch(typeof l[e].since==="string"&&(i=at(l[e].since).startOf("day"),l[e].since=i.valueOf()),typeof l[e].until){case"undefined":l[e].until=1/0;break;case"string":i=at(l[e].until).startOf("day").valueOf(),l[e].until=i.valueOf();break}return l}function JR(o,t,e){var n,i,l=this.eras(),r,a,c;for(o=o.toUpperCase(),n=0,i=l.length;n<i;++n)if(r=l[n].name.toUpperCase(),a=l[n].abbr.toUpperCase(),c=l[n].narrow.toUpperCase(),e)switch(t){case"N":case"NN":case"NNN":if(a===o)return l[n];break;case"NNNN":if(r===o)return l[n];break;case"NNNNN":if(c===o)return l[n];break}else if([r,a,c].indexOf(o)>=0)return l[n]}function $R(o,t){var e=o.since<=o.until?1:-1;return t===void 0?at(o.since).year():at(o.since).year()+(t-o.offset)*e}function zR(){var o,t,e,n=this.localeData().eras();for(o=0,t=n.length;o<t;++o)if(e=this.clone().startOf("day").valueOf(),n[o].since<=e&&e<=n[o].until||n[o].until<=e&&e<=n[o].since)return n[o].name;return""}function jR(){var o,t,e,n=this.localeData().eras();for(o=0,t=n.length;o<t;++o)if(e=this.clone().startOf("day").valueOf(),n[o].since<=e&&e<=n[o].until||n[o].until<=e&&e<=n[o].since)return n[o].narrow;return""}function qR(){var o,t,e,n=this.localeData().eras();for(o=0,t=n.length;o<t;++o)if(e=this.clone().startOf("day").valueOf(),n[o].since<=e&&e<=n[o].until||n[o].until<=e&&e<=n[o].since)return n[o].abbr;return""}function tg(){var o,t,e,n,i=this.localeData().eras();for(o=0,t=i.length;o<t;++o)if(e=i[o].since<=i[o].until?1:-1,n=this.clone().startOf("day").valueOf(),i[o].since<=n&&n<=i[o].until||i[o].until<=n&&n<=i[o].since)return(this.year()-at(i[o].since).year())*e+i[o].offset;return this.year()}function eg(o){return _t(this,"_erasNameRegex")||Xs.call(this),o?this._erasNameRegex:this._erasRegex}function ng(o){return _t(this,"_erasAbbrRegex")||Xs.call(this),o?this._erasAbbrRegex:this._erasRegex}function og(o){return _t(this,"_erasNarrowRegex")||Xs.call(this),o?this._erasNarrowRegex:this._erasRegex}function Fs(o,t){return t.erasAbbrRegex(o)}function ig(o,t){return t.erasNameRegex(o)}function sg(o,t){return t.erasNarrowRegex(o)}function rg(o,t){return t._eraYearOrdinalRegex||Jn}function Xs(){var o=[],t=[],e=[],n=[],i,l,r,a,c,d=this.eras();for(i=0,l=d.length;i<l;++i)r=tn(d[i].name),a=tn(d[i].abbr),c=tn(d[i].narrow),t.push(r),o.push(a),e.push(c),n.push(r),n.push(a),n.push(c);this._erasRegex=new RegExp("^("+n.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+t.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+o.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+e.join("|")+")","i")}mt(0,["gg",2],0,function(){return this.weekYear()%100}),mt(0,["GG",2],0,function(){return this.isoWeekYear()%100});function ai(o,t){mt(0,[o,o.length],0,t)}ai("gggg","weekYear"),ai("ggggg","weekYear"),ai("GGGG","isoWeekYear"),ai("GGGGG","isoWeekYear"),dt("G",$o),dt("g",$o),dt("GG",oe,Pe),dt("gg",oe,Pe),dt("GGGG",hs,us),dt("gggg",hs,us),dt("GGGGG",Jo,ko),dt("ggggg",Jo,ko),go(["gggg","ggggg","GGGG","GGGGG"],function(o,t,e,n){t[n.substr(0,2)]=wt(o)}),go(["gg","GG"],function(o,t,e,n){t[n]=at.parseTwoDigitYear(o)});function lg(o){return Ll.call(this,o,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)}function ag(o){return Ll.call(this,o,this.isoWeek(),this.isoWeekday(),1,4)}function cg(){return on(this.year(),1,4)}function dg(){return on(this.isoWeekYear(),1,4)}function ug(){var o=this.localeData()._week;return on(this.year(),o.dow,o.doy)}function hg(){var o=this.localeData()._week;return on(this.weekYear(),o.dow,o.doy)}function Ll(o,t,e,n,i){var l;return o==null?Co(this,n,i).year:(l=on(o,n,i),t>l&&(t=l),Rg.call(this,o,t,e,n,i))}function Rg(o,t,e,n,i){var l=qr(o,t,e,n,i),r=mo(l.year,0,l.dayOfYear);return this.year(r.getUTCFullYear()),this.month(r.getUTCMonth()),this.date(r.getUTCDate()),this}mt("Q",0,"Qo","quarter"),dt("Q",Kr),$t("Q",function(o,t){t[en]=(wt(o)-1)*3});function gg(o){return o==null?Math.ceil((this.month()+1)/3):this.month((o-1)*3+this.month()%3)}mt("D",["DD",2],"Do","date"),dt("D",oe,$n),dt("DD",oe,Pe),dt("Do",function(o,t){return o?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),$t(["D","DD"],Ge),$t("Do",function(o,t){t[Ge]=wt(o.match(oe)[0])});var Pl=zn("Date",!0);mt("DDD",["DDDD",3],"DDDo","dayOfYear"),dt("DDD",Go),dt("DDDD",Ar),$t(["DDD","DDDD"],function(o,t,e){e._dayOfYear=wt(o)});function Tg(o){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return o==null?t:this.add(o-t,"d")}mt("m",["mm",2],0,"minute"),dt("m",oe,Rs),dt("mm",oe,Pe),$t(["m","mm"],Ue);var fg=zn("Minutes",!1);mt("s",["ss",2],0,"second"),dt("s",oe,Rs),dt("ss",oe,Pe),$t(["s","ss"],nn);var mg=zn("Seconds",!1);mt("S",0,0,function(){return~~(this.millisecond()/100)}),mt(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),mt(0,["SSS",3],0,"millisecond"),mt(0,["SSSS",4],0,function(){return this.millisecond()*10}),mt(0,["SSSSS",5],0,function(){return this.millisecond()*100}),mt(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),mt(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),mt(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),mt(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),dt("S",Go,Kr),dt("SS",Go,Pe),dt("SSS",Go,Ar);var fn,Ml;for(fn="SSSS";fn.length<=9;fn+="S")dt(fn,Jn);function Cg(o,t){t[Fn]=wt(("0."+o)*1e3)}for(fn="S";fn.length<=9;fn+="S")$t(fn,Cg);Ml=zn("Milliseconds",!1),mt("z",0,0,"zoneAbbr"),mt("zz",0,0,"zoneName");function pg(){return this._isUTC?"UTC":""}function Ig(){return this._isUTC?"Coordinated Universal Time":""}var q=ho.prototype;q.add=hR,q.calendar=pR,q.clone=IR,q.diff=DR,q.endOf=wR,q.format=NR,q.from=bR,q.fromNow=VR,q.to=WR,q.toNow=UR,q.get=yu,q.invalidAt=xR,q.isAfter=ER,q.isBefore=LR,q.isBetween=PR,q.isSame=MR,q.isSameOrAfter=OR,q.isSameOrBefore=SR,q.isValid=_R,q.lang=ml,q.locale=fl,q.localeData=Cl,q.max=_h,q.min=Ah,q.parsingFlags=BR,q.set=Nu,q.startOf=YR,q.subtract=RR,q.toArray=HR,q.toObject=KR,q.toDate=QR,q.toISOString=XR,q.inspect=yR,typeof Symbol<"u"&&Symbol.for!=null&&(q[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),q.toJSON=AR,q.toString=FR,q.unix=ZR,q.valueOf=vR,q.creationData=kR,q.eraName=zR,q.eraNarrow=jR,q.eraAbbr=qR,q.eraYear=tg,q.year=xr,q.isLeapYear=Xu,q.weekYear=lg,q.isoWeekYear=ag,q.quarter=q.quarters=gg,q.month=zr,q.daysInMonth=Qu,q.week=q.weeks=Gu,q.isoWeek=q.isoWeeks=Ju,q.weeksInYear=ug,q.weeksInWeekYear=hg,q.isoWeeksInYear=cg,q.isoWeeksInISOWeekYear=dg,q.date=Pl,q.day=q.days=ah,q.weekday=ch,q.isoWeekday=dh,q.dayOfYear=Tg,q.hour=q.hours=mh,q.minute=q.minutes=fg,q.second=q.seconds=mg,q.millisecond=q.milliseconds=Ml,q.utcOffset=qh,q.utc=eR,q.local=nR,q.parseZone=oR,q.hasAlignedHourOffset=iR,q.isDST=sR,q.isLocal=lR,q.isUtcOffset=aR,q.isUtc=ul,q.isUTC=ul,q.zoneAbbr=pg,q.zoneName=Ig,q.dates=Fe("dates accessor is deprecated. Use date instead.",Pl),q.months=Fe("months accessor is deprecated. Use month instead",zr),q.years=Fe("years accessor is deprecated. Use year instead",xr),q.zone=Fe("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",tR),q.isDSTShifted=Fe("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",rR);function Eg(o){return ie(o*1e3)}function Lg(){return ie.apply(null,arguments).parseZone()}function Ol(o){return o}var Bt=rs.prototype;Bt.calendar=lu,Bt.longDateFormat=uu,Bt.invalidDate=Ru,Bt.ordinal=fu,Bt.preparse=Ol,Bt.postformat=Ol,Bt.relativeTime=Cu,Bt.pastFuture=pu,Bt.set=su,Bt.eras=GR,Bt.erasParse=JR,Bt.erasConvertYear=$R,Bt.erasAbbrRegex=ng,Bt.erasNameRegex=eg,Bt.erasNarrowRegex=og,Bt.months=Yu,Bt.monthsShort=wu,Bt.monthsParse=Zu,Bt.monthsRegex=Ku,Bt.monthsShortRegex=Hu,Bt.week=_u,Bt.firstDayOfYear=ku,Bt.firstDayOfWeek=xu,Bt.weekdays=oh,Bt.weekdaysMin=sh,Bt.weekdaysShort=ih,Bt.weekdaysParse=lh,Bt.weekdaysRegex=uh,Bt.weekdaysShortRegex=hh,Bt.weekdaysMinRegex=Rh,Bt.isPM=Th,Bt.meridiem=Ch;function ci(o,t,e,n){var i=sn(),l=Be().set(n,t);return i[e](l,o)}function Sl(o,t,e){if(qe(o)&&(t=o,o=void 0),o=o||"",t!=null)return ci(o,t,e,"month");var n,i=[];for(n=0;n<12;n++)i[n]=ci(o,n,e,"month");return i}function ys(o,t,e,n){typeof o=="boolean"?(qe(t)&&(e=t,t=void 0),t=t||""):(t=o,e=t,o=!1,qe(t)&&(e=t,t=void 0),t=t||"");var i=sn(),l=o?i._week.dow:0,r,a=[];if(e!=null)return ci(t,(e+l)%7,n,"day");for(r=0;r<7;r++)a[r]=ci(t,(r+l)%7,n,"day");return a}function Pg(o,t){return Sl(o,t,"months")}function Mg(o,t){return Sl(o,t,"monthsShort")}function Og(o,t,e){return ys(o,t,e,"weekdays")}function Sg(o,t,e){return ys(o,t,e,"weekdaysShort")}function Dg(o,t,e){return ys(o,t,e,"weekdaysMin")}Tn("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(o){var t=o%10,e=wt(o%100/10)===1?"th":t===1?"st":t===2?"nd":t===3?"rd":"th";return o+e}}),at.lang=Fe("moment.lang is deprecated. Use moment.locale instead.",Tn),at.langData=Fe("moment.langData is deprecated. Use moment.localeData instead.",sn);var rn=Math.abs;function Fg(){var o=this._data;return this._milliseconds=rn(this._milliseconds),this._days=rn(this._days),this._months=rn(this._months),o.milliseconds=rn(o.milliseconds),o.seconds=rn(o.seconds),o.minutes=rn(o.minutes),o.hours=rn(o.hours),o.months=rn(o.months),o.years=rn(o.years),this}function Dl(o,t,e,n){var i=Ye(t,e);return o._milliseconds+=n*i._milliseconds,o._days+=n*i._days,o._months+=n*i._months,o._bubble()}function Xg(o,t){return Dl(this,o,t,1)}function yg(o,t){return Dl(this,o,t,-1)}function Fl(o){return o<0?Math.floor(o):Math.ceil(o)}function Ng(){var o=this._milliseconds,t=this._days,e=this._months,n=this._data,i,l,r,a,c;return o>=0&&t>=0&&e>=0||o<=0&&t<=0&&e<=0||(o+=Fl(Ns(e)+t)*864e5,t=0,e=0),n.milliseconds=o%1e3,i=ye(o/1e3),n.seconds=i%60,l=ye(i/60),n.minutes=l%60,r=ye(l/60),n.hours=r%24,t+=ye(r/24),c=ye(Xl(t)),e+=c,t-=Fl(Ns(c)),a=ye(e/12),e%=12,n.days=t,n.months=e,n.years=a,this}function Xl(o){return o*4800/146097}function Ns(o){return o*146097/4800}function bg(o){if(!this.isValid())return NaN;var t,e,n=this._milliseconds;if(o=Xe(o),o==="month"||o==="quarter"||o==="year")switch(t=this._days+n/864e5,e=this._months+Xl(t),o){case"month":return e;case"quarter":return e/3;case"year":return e/12}else switch(t=this._days+Math.round(Ns(this._months)),o){case"week":return t/7+n/6048e5;case"day":return t+n/864e5;case"hour":return t*24+n/36e5;case"minute":return t*1440+n/6e4;case"second":return t*86400+n/1e3;case"millisecond":return Math.floor(t*864e5)+n;default:throw new Error("Unknown unit "+o)}}function ln(o){return function(){return this.as(o)}}var yl=ln("ms"),Vg=ln("s"),Wg=ln("m"),Ug=ln("h"),Yg=ln("d"),wg=ln("w"),vg=ln("M"),Zg=ln("Q"),Qg=ln("y"),Hg=yl;function Kg(){return Ye(this)}function Ag(o){return o=Xe(o),this.isValid()?this[o+"s"]():NaN}function yn(o){return function(){return this.isValid()?this._data[o]:NaN}}var _g=yn("milliseconds"),Bg=yn("seconds"),xg=yn("minutes"),kg=yn("hours"),Gg=yn("days"),Jg=yn("months"),$g=yn("years");function zg(){return ye(this.days()/7)}var an=Math.round,eo={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function jg(o,t,e,n,i){return i.relativeTime(t||1,!!e,o,n)}function qg(o,t,e,n){var i=Ye(o).abs(),l=an(i.as("s")),r=an(i.as("m")),a=an(i.as("h")),c=an(i.as("d")),d=an(i.as("M")),u=an(i.as("w")),R=an(i.as("y")),h=l<=e.ss&&["s",l]||l<e.s&&["ss",l]||r<=1&&["m"]||r<e.m&&["mm",r]||a<=1&&["h"]||a<e.h&&["hh",a]||c<=1&&["d"]||c<e.d&&["dd",c];return e.w!=null&&(h=h||u<=1&&["w"]||u<e.w&&["ww",u]),h=h||d<=1&&["M"]||d<e.M&&["MM",d]||R<=1&&["y"]||["yy",R],h[2]=t,h[3]=+o>0,h[4]=n,jg.apply(null,h)}function tT(o){return o===void 0?an:typeof o=="function"?(an=o,!0):!1}function eT(o,t){return eo[o]===void 0?!1:t===void 0?eo[o]:(eo[o]=t,o==="s"&&(eo.ss=t-1),!0)}function nT(o,t){if(!this.isValid())return this.localeData().invalidDate();var e=!1,n=eo,i,l;return typeof o=="object"&&(t=o,o=!1),typeof o=="boolean"&&(e=o),typeof t=="object"&&(n=Object.assign({},eo,t),t.s!=null&&t.ss==null&&(n.ss=t.s-1)),i=this.localeData(),l=qg(this,!e,n,i),e&&(l=i.pastFuture(+this,l)),i.postformat(l)}var bs=Math.abs;function no(o){return(o>0)-(o<0)||+o}function di(){if(!this.isValid())return this.localeData().invalidDate();var o=bs(this._milliseconds)/1e3,t=bs(this._days),e=bs(this._months),n,i,l,r,a=this.asSeconds(),c,d,u,R;return a?(n=ye(o/60),i=ye(n/60),o%=60,n%=60,l=ye(e/12),e%=12,r=o?o.toFixed(3).replace(/\.?0+$/,""):"",c=a<0?"-":"",d=no(this._months)!==no(a)?"-":"",u=no(this._days)!==no(a)?"-":"",R=no(this._milliseconds)!==no(a)?"-":"",c+"P"+(l?d+l+"Y":"")+(e?d+e+"M":"")+(t?u+t+"D":"")+(i||n||o?"T":"")+(i?R+i+"H":"")+(n?R+n+"M":"")+(o?R+r+"S":"")):"P0D"}var Qt=oi.prototype;Qt.isValid=Jh,Qt.abs=Fg,Qt.add=Xg,Qt.subtract=yg,Qt.as=bg,Qt.asMilliseconds=yl,Qt.asSeconds=Vg,Qt.asMinutes=Wg,Qt.asHours=Ug,Qt.asDays=Yg,Qt.asWeeks=wg,Qt.asMonths=vg,Qt.asQuarters=Zg,Qt.asYears=Qg,Qt.valueOf=Hg,Qt._bubble=Ng,Qt.clone=Kg,Qt.get=Ag,Qt.milliseconds=_g,Qt.seconds=Bg,Qt.minutes=xg,Qt.hours=kg,Qt.days=Gg,Qt.weeks=zg,Qt.months=Jg,Qt.years=$g,Qt.humanize=nT,Qt.toISOString=di,Qt.toString=di,Qt.toJSON=di,Qt.locale=fl,Qt.localeData=Cl,Qt.toIsoString=Fe("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",di),Qt.lang=ml,mt("X",0,0,"unix"),mt("x",0,0,"valueOf"),dt("x",$o),dt("X",Pu),$t("X",function(o,t,e){e._d=new Date(parseFloat(o)*1e3)}),$t("x",function(o,t,e){e._d=new Date(wt(o))});at.version="2.30.1",ou(ie),at.fn=q,at.min=Bh,at.max=xh,at.now=kh,at.utc=Be,at.unix=Eg,at.months=Pg,at.isDate=uo,at.locale=Tn,at.invalid=_o,at.duration=Ye,at.isMoment=We,at.weekdays=Og,at.parseZone=Lg,at.localeData=sn,at.isDuration=ii,at.monthsShort=Mg,at.weekdaysMin=Dg,at.defineLocale=ps,at.updateLocale=Lh,at.locales=Ph,at.weekdaysShort=Sg,at.normalizeUnits=Xe,at.relativeTimeRounding=tT,at.relativeTimeThreshold=eT,at.calendarFormat=CR,at.prototype=q,at.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"};const oT=new Set([s.ElementType.IMAGE,s.ElementType.MACRO,s.ElementType.CUSTOM_MACRO,s.ElementType.MENSTRUAL_HISTORY,s.ElementType.FETAL_HEART_POSITION,s.ElementType.TOOTH_POSITION]);class Vs{draws;ranges;element;control;options;position;constructor(t,e){const n=e.getDraw();this.draws=n,this.position=n.getPosition(),this.ranges=n.getRange(),this.options=n.getOptions(),this.element=t,this.control=e}setElement(t){this.element=t}getElement(){return this.element}getValue(t={}){const e=t.elementList||this.control.getElementList();let{startIndex:n}=t.range||this.control.getRange();const i=this.control.getDraw(),l=t?null:i.getTd();n>=e.length&&(n=e.length-1);const r=e[n],a=[];let c=l,d=e,u=n;for(;;){if(u<0&&c?.linkTdPrevId){const f=i.getTdById(c.linkTdPrevId);if(f){d=f.value,u=d.length-1,c=f;continue}}if(u<0)break;const g=d[u];if(g.controlId!==r.controlId||g.controlComponent===s.ControlComponent.PREFIX||g.controlComponent===s.ControlComponent.PRE_TEXT)break;g.controlComponent===s.ControlComponent.VALUE&&a.unshift(g),u--}c=l;let R=e,h=n+1;for(;;){if(h>=R.length&&c?.linkTdNextId){const f=i.getTdById(c.linkTdNextId);if(f){R=f.value,h=0,c=f;continue}}const g=R[h];if(!g||g.controlId!==r.controlId||g.controlComponent===s.ControlComponent.POSTFIX||g.controlComponent===s.ControlComponent.POST_TEXT)break;g.controlComponent===s.ControlComponent.VALUE&&a.push(g),h++}return a.filter(g=>g.type!==s.ElementType.SPLIT_TAG)}removeNextControlElement(t,e){const n=this.control.getDraw();if(e=e??n.getTd()?.linkTdNextId,e){const i=n.getTdById(e);if(i){if(i.value.length){if(i.value[1].controlId===t)return n.spliceElementList(i.value,1,1),i.value[1]}else if(i.linkTdNextId)return this.removeNextControlElement(t,i.linkTdNextId)}}}setValue(t,e={},n={}){if(!n.isIgnoreDisabledRule&&this.control.getIsDisabledControl(e))return-1;const i=e.range||this.control.getRange(),l=e.elementList||this.control.getElementList(),r=l[i.startIndex],a=l[i.startIndex+1],c=M=>!!(M&&(M.controlComponent===s.ControlComponent.POSTFIX||M.controlComponent===s.ControlComponent.POST_TEXT||M.controlComponent===s.ControlComponent.POSTTEXTFIX||M.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT)),d=!!(r?.originControlId&&c(r)&&a?.controlId===r.originControlId&&!a.originControlId&&a.control?.type===s.ControlType.TEXTFIELD&&c(a));let u=this.element.controlId||r?.controlId,R=this.element.originControlId||(this.element.controlId===r?.controlId?r?.originControlId:void 0),h=this.element.control||r.control;const T=!!(r?.controlId&&r.controlId!==this.element.controlId&&!r.originControlId&&r.control?.type===s.ControlType.TEXTFIELD);d?(u=r.originControlId,R=void 0,h=a.control):T&&(u=r.controlId,R=void 0,h=r.control);const g=(()=>{if(!u||!r?.subTemplateParentId||!c(r)||!Gt(a,this.element)||a?.subTemplateParentId===r.subTemplateParentId)return!1;for(let M=i.startIndex-1;M>=0;M--){const V=l[M];if(V.type===s.ElementType.SUB_TEMPLATE&&V.id===r.subTemplateParentId)return V.controlId===u&&(V.originControlId||null)===(R||null)}return!1})(),f=!!u&&(g||r?.controlId!==u&&this._findNearestTextAncestorId(l,r?.originControlId)===u);!f&&!d&&!T&&(this.control.mergeControl(e),this.control.shrinkBoundary(e));const{startIndex:m,endIndex:p}=i,I=this.control.getDraw();m!==p?I.spliceElementList(l,m+1,p-m,[],{isIgnoreDeletedRule:n.isIgnoreDeletedRule}):f||d||T?this._removePlaceholdersByControl(l,u,R||null):this.control.removePlaceholder(m,{elementList:l});const C=l[m];f||d||T?this._removePlaceholdersByControl(l,u,R||null):this._removeControlPlaceholders(l,m);const E=C.type&&!Le.includes(C.type)||C.controlComponent===s.ControlComponent.PREFIX||C.controlComponent===s.ControlComponent.PRE_TEXT?Jt(C,["control","controlId","originControlId","subTemplateParentId","subTemplateInstanceId",...he]):Ee(C,["type"]);g&&(delete E.subTemplateParentId,delete E.subTemplateInstanceId);const O=f||d||T,P=M=>{he.forEach(V=>{delete M[V];const N=h?.[V];N!==void 0&&(M[V]=N)}),delete M.underline,delete M.textDecoration,h?.type===s.ControlType.TEXT&&M.color?.toLowerCase()==="#87d068"?M.color=this.options.defaultColor:M.color||(M.color=this.options.defaultColor)};O&&P(E),E.controlId=u,h&&(E.control=h),R?E.originControlId=R:delete E.originControlId;const S=this.options.mode===s.EditorMode.FORM&&this.options.modeRule.form.inputTraceEnabled,X=i.startIndex+1,U=[],b=M=>{const V=U.length?U:l,N=U.length?U.length-1:d||g?i.startIndex+1:i.startIndex;ae(V,[M],N,{editorOptions:this.options}),U.push(M)};for(let M=0;M<t.length;M++){const V=t[M];if(V.type===s.ElementType.CONTROL&&V.control){const N=V,y=N.controlId||gt(),L=N.control?.value||[],F=N.control?.type,D=F===s.ControlType.TEXTFIELD,Y=D?this.options.control.textFixColor:F===s.ControlType.TEXT||F===s.ControlType.NUMBER?"#87d068":this.options.control.bracketColor,_={...Ee(E,["underline","textDecoration"]),controlId:y,type:s.ElementType.CONTROL,control:N.control,originControlId:u},W=D?s.ControlComponent.PRETEXTFIX:s.ControlComponent.PREFIX,H=D?s.ControlComponent.POSTTEXTFIX:s.ControlComponent.POSTFIX,Q=D?N.control?.preTextFix||this.options.control.preTextFix:N.control?.prefix||this.options.control.prefix;for(let K=0;K<Q.length;K++){const x={..._,color:Y,value:Q[K],controlComponent:W};b(x)}for(let K=0;K<L.length;K++){const x=L[K],v={..._,...x,controlComponent:s.ControlComponent.VALUE};(v.color===this.options.control.bracketColor||v.color===this.options.control.placeholderColor)&&(v.color=this.options.defaultColor),b(v)}if(L.length===0){const K=N.control?.placeholder||"";for(let x=0;x<K.length;x++){const v={..._,value:K[x],controlComponent:s.ControlComponent.PLACEHOLDER,color:this.options.control.placeholderColor};b(v)}}const A=D?N.control?.postTextFix||this.options.control.postTextFix:N.control?.postfix||this.options.control.postfix;for(let K=0;K<A.length;K++){const x={..._,color:Y,value:A[K],controlComponent:H};b(x)}}else if(V.type||V.value){(C.controlComponent===s.ControlComponent.PRE_TEXT||C.controlComponent===s.ControlComponent.POST_TEXT||C.controlComponent===s.ControlComponent.PREFIX||C.controlComponent===s.ControlComponent.POSTFIX)&&(E.color=this.options.defaultColor);const y=Ee(V,["control","controlId","controlComponent","originControlId"]),L={...E,...y,controlComponent:s.ControlComponent.VALUE};g&&(delete L.subTemplateParentId,delete L.subTemplateInstanceId),O&&P(L),(L.color===this.options.control.bracketColor||L.color===this.options.control.placeholderColor||L.color===this.options.control.textFixColor)&&(L.color=this.options.defaultColor),L.strikeout&&delete L.strikeout,S&&(L.textDecoration={style:s.TextDecorationStyle.DOUBLE},L.underline=!0),b(L)}}return U.length&&I.spliceElementList(l,X,0,U),i.startIndex+U.length}_removeControlPlaceholders(t,e){const n=t[e];if(!n?.controlId)return;const i=a=>!!a&&a.controlId===n.controlId&&a.originControlId===n.originControlId;let l=e;for(;l>=0&&i(t[l]);)l--;let r=e+1;for(;r<t.length&&i(t[r]);)r++;for(let a=r-1;a>l;a--)t[a].controlComponent===s.ControlComponent.PLACEHOLDER&&t.splice(a,1)}_removePlaceholdersByControl(t,e,n){if(e)for(let i=t.length-1;i>=0;i--){const l=t[i];l.controlId===e&&(l.originControlId||null)===n&&l.controlComponent===s.ControlComponent.PLACEHOLDER&&t.splice(i,1)}}_findNearestTextAncestorId(t,e){if(!e)return null;const n=new Set;let i=e,l=null;for(;i&&!n.has(i);){n.add(i);let r;for(let a=0;a<t.length;a++){const c=t[a];if(c.controlId===i&&c.control?.type&&(r=c,c.controlComponent===s.ControlComponent.PREFIX||c.controlComponent===s.ControlComponent.PRE_TEXT||c.controlComponent===s.ControlComponent.PRETEXTFIX||c.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT))break}if(!r)break;(r.control?.type===s.ControlType.TEXT||this.options.mode===s.EditorMode.EDIT&&r.control?.type===s.ControlType.TEXTFIELD)&&(l=i),i=r.originControlId||null}return l}clearValue(t={},e={}){if(!e.isIgnoreDisabledRule&&this.control.getIsDisabledControl(t))return-1;const n=t.elementList||this.control.getElementList(),i=t.range||this.control.getValueRange()||this.control.getRange();this.control.shrinkBoundary(t);const{startIndex:l,endIndex:r}=i;return this.control.getDraw().spliceElementList(n,l+1,r-l,[],{isIgnoreDeletedRule:e.isIgnoreDeletedRule}),e.isAddPlaceholder!==!1&&(this.getValue(t).length||this.control.addPlaceholder(l,t)),l}keydown(t){if(this.control.getIsDisabledControl())return null;const e=this.control.getElementList(),n=this.control.getRange(),i=W=>!!(W?.type&&oT.has(W.type)&&W.controlId&&W.controlComponent===s.ControlComponent.VALUE),l=W=>{const H=e[W];if(!i(H))return null;const Q=H.controlId,A=H.originControlId||null,K=rt=>rt?.controlId===Q&&(rt?.originControlId||null)===A;this.draws.spliceElementList(e,W,1);const x=e.some(rt=>K(rt)&&rt.controlComponent===s.ControlComponent.VALUE);let v=null;if(!x){const rt=e.findIndex(It=>K(It)&&(It.controlComponent===s.ControlComponent.PREFIX||It.controlComponent===s.ControlComponent.PRE_TEXT));rt>=0&&(this.control.addPlaceholder(rt),v=rt)}if(v!==null)return v;for(let rt=Math.min(W-1,e.length-1);rt>=0;rt--){const It=e[rt];if(!K(It))break;if(It.controlComponent===s.ControlComponent.VALUE||It.controlComponent===s.ControlComponent.PLACEHOLDER)return rt}for(let rt=Math.max(0,W);rt<e.length;rt++){const It=e[rt];if(!K(It))break;if(It.controlComponent===s.ControlComponent.VALUE||It.controlComponent===s.ControlComponent.PLACEHOLDER)return rt}return Math.max(0,W-1)};this.control.shrinkBoundary();const{startIndex:r,endIndex:a}=n,c=e[r],d=e[a],u=this.control.getDraw(),R=e[a+1];if(r===a){if(t.key===s.KeyMap.Backspace){const W=i(c)?r:i(e[r-1])?r-1:-1;if(W>=0)return l(W)}if(t.key===s.KeyMap.Delete){const W=i(c)?r:i(R)?a+1:-1;if(W>=0)return l(W)}}const h=this.options.mode===s.EditorMode.FORM,T=this.element.controlId||c.controlId,g=this.element.originControlId||c.originControlId||null,f=[];for(let W=0;W<e.length;W++){const H=e[W];H.controlId===T&&(H.originControlId||null)===g&&H.controlComponent===s.ControlComponent.VALUE&&f.push(W)}const m=!!(r!==a&&f.length&&r<f[0]&&a>=f[f.length-1]),p=W=>{if(!W)return null;const H=new Set;let Q=W,A=null;for(;Q&&!H.has(Q);){H.add(Q);let K;for(let x=0;x<e.length;x++){const v=e[x];if(v.controlId===Q&&v.control?.type&&(K=v,v.controlComponent===s.ControlComponent.PREFIX||v.controlComponent===s.ControlComponent.PRE_TEXT||v.controlComponent===s.ControlComponent.PRETEXTFIX||v.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT))break}if(!K)break;(K.control?.type===s.ControlType.TEXT||this.options.mode===s.EditorMode.EDIT&&K.control?.type===s.ControlType.TEXTFIELD)&&(A=Q),Q=K.originControlId||null}return A},I=p(g),C=!!I,E=c.controlId===T&&(c.originControlId||null)===g,O=c.controlComponent===s.ControlComponent.VALUE,P=W=>{for(let H=r-1;H>=0;H--){const Q=e[H];if(Q.controlId===W&&!Q.originControlId){if(Q.controlComponent===s.ControlComponent.VALUE||Q.controlComponent===s.ControlComponent.PLACEHOLDER)return H;if(Q.controlComponent===s.ControlComponent.PREFIX||Q.controlComponent===s.ControlComponent.PRE_TEXT||Q.controlComponent===s.ControlComponent.PRETEXTFIX||Q.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT)break}if(Q.controlId&&Q.controlId!==W&&Q.originControlId!==W)break}return-1},S=(W,H,Q)=>{const A=x=>x?.controlId===H&&(x?.originControlId||null)===Q;let K=-1;for(let x=W;x>=0;x--){const v=e[x];if(A(v)){if(v.controlComponent===s.ControlComponent.VALUE)return x;if(v.controlComponent===s.ControlComponent.PREFIX||v.controlComponent===s.ControlComponent.PRE_TEXT||v.controlComponent===s.ControlComponent.PRETEXTFIX||v.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT){K=x;break}}if(v.controlId&&v.controlId!==H&&v.originControlId!==H)break}if(K>=0)return K;for(let x=W+1;x<e.length;x++){const v=e[x];if(A(v)){if(v.controlComponent===s.ControlComponent.VALUE)return x;if(v.controlComponent===s.ControlComponent.POSTFIX||v.controlComponent===s.ControlComponent.POST_TEXT||v.controlComponent===s.ControlComponent.POSTTEXTFIX||v.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT){K===-1&&(K=x);break}}if(v.controlId&&v.controlId!==H&&v.originControlId!==H)break}return K>=0?K:W},U=C&&E&&(c.controlComponent===s.ControlComponent.PREFIX||c.controlComponent===s.ControlComponent.PRE_TEXT||c.controlComponent===s.ControlComponent.PRETEXTFIX||c.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT||c.controlComponent===s.ControlComponent.POSTFIX||c.controlComponent===s.ControlComponent.POST_TEXT||c.controlComponent===s.ControlComponent.POSTTEXTFIX||c.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT||c.controlComponent===s.ControlComponent.PLACEHOLDER||c.controlComponent===s.ControlComponent.TEXTFIXLABEL),b=e[a+1],M=!!b?.originControlId&&!!b?.controlId&&b.originControlId!==b.controlId&&(b.controlComponent===s.ControlComponent.PREFIX||b.controlComponent===s.ControlComponent.PRE_TEXT||b.controlComponent===s.ControlComponent.PRETEXTFIX||b.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT||b.controlComponent===s.ControlComponent.PLACEHOLDER||b.controlComponent===s.ControlComponent.TEXTFIXLABEL),V=!!b?.originControlId&&!!b?.controlId&&b.originControlId!==b.controlId&&(b.controlComponent===s.ControlComponent.PREFIX||b.controlComponent===s.ControlComponent.PRE_TEXT||b.controlComponent===s.ControlComponent.PRETEXTFIX||b.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT||b.controlComponent===s.ControlComponent.POSTFIX||b.controlComponent===s.ControlComponent.POST_TEXT||b.controlComponent===s.ControlComponent.POSTTEXTFIX||b.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT||b.controlComponent===s.ControlComponent.PLACEHOLDER||b.controlComponent===s.ControlComponent.TEXTFIXLABEL),N=W=>this.options.mode===s.EditorMode.FORM?r:this.control.removeControl(W),y=c.controlComponent===s.ControlComponent.VALUE&&!c.originControlId&&!!b?.originControlId&&!!T&&p(b.originControlId)===T,L=W=>!!W&&W.controlId===c.controlId&&(W.originControlId||null)===(c.originControlId||null),F=W=>W?.controlComponent===s.ControlComponent.POSTFIX||W?.controlComponent===s.ControlComponent.POST_TEXT||W?.controlComponent===s.ControlComponent.POSTTEXTFIX||W?.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT,D=()=>{const W=c.controlId,H=c.originControlId||null;return u.spliceElementList(e,r,1),e.some(A=>A.controlId===W&&(A.originControlId||null)===H&&A.controlComponent===s.ControlComponent.VALUE)||this.control.addPlaceholder(r-1),Math.max(r-1,0)},Y=c.controlComponent===s.ControlComponent.VALUE&&!!c.originControlId&&L(b)&&F(b),Z=!!T&&!this.control.getIsExistValueByElementListIndex(e,r),_=()=>{if(c.controlComponent!==s.ControlComponent.VALUE)return null;let W=r;for(let A=r;A>=0;A--){const K=e[A];if(!(K.controlId===c.controlId&&(K.originControlId||null)===(c.originControlId||null))||K.controlComponent!==s.ControlComponent.VALUE)break;if(!K.strikeout){W=A;break}}const H=e[W];if(!H||H.strikeout)return null;H.strikeout=!0,H.deletePerson="SWJ",H.deleteTime=at(new Date).format("YYYY-MM-DD HH:mm:ss");let Q=Math.max(W-1,0);for(let A=W-1;A>=0;A--){const K=e[A];if(!(K.controlId===H.controlId&&(K.originControlId||null)===(H.originControlId||null))){Q=A;break}if(K.controlComponent!==s.ControlComponent.VALUE){Q=A;break}if(!K.strikeout){Q=A;break}Q=Math.max(A-1,0)}return this.draws.render({curIndex:Q,isSetCursor:!0,isCompute:!1,isSubmitHistory:!1}),this.ranges.setDefaultStyle({strikeout:!1}),queueMicrotask(()=>{this.ranges.setRange(Q,Q),this.draws.setCursor(Q)}),Q};if(t.key===s.KeyMap.Backspace){if(r===a&&Z&&(c.controlComponent===s.ControlComponent.PLACEHOLDER||c.controlComponent===s.ControlComponent.POSTFIX||c.controlComponent===s.ControlComponent.POST_TEXT||c.controlComponent===s.ControlComponent.POSTTEXTFIX||c.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT))return S(r,c.controlId,c.originControlId||null);if(h&&r===a&&I&&!E&&(c.controlComponent===s.ControlComponent.POSTFIX||c.controlComponent===s.ControlComponent.POST_TEXT||c.controlComponent===s.ControlComponent.POSTTEXTFIX||c.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT)){const H=P(I);return H>=0?H:r}if(r===a&&U&&!(h&&c.controlComponent===s.ControlComponent.VALUE&&!c.originControlId))return N(r);if(this.options.mode===s.EditorMode.FORM&&this.options.modeRule.form.deleteTraceEnabled&&!m&&(!C||O)){if(r===a&&c.controlComponent===s.ControlComponent.VALUE){const H=_();if(H!==null)return H}return r===a&&(c.controlComponent===s.ControlComponent.PREFIX||c.controlComponent===s.ControlComponent.PRE_TEXT||c.controlComponent===s.ControlComponent.PLACEHOLDER)?r:this.strikeout()}else{if(r===a&&(c.controlComponent===s.ControlComponent.PREFIX||c.controlComponent===s.ControlComponent.PRE_TEXT||c.controlComponent===s.ControlComponent.PLACEHOLDER))return r;if(r!==a){u.spliceElementList(e,r+1,a-r);const H=e[r+1];return(H?.controlComponent===s.ControlComponent.POSTFIX||H?.controlComponent===s.ControlComponent.POST_TEXT||H?.controlComponent===s.ControlComponent.POSTTEXTFIX||H?.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT)&&this.control.addPlaceholder(r),r===0&&e[0].type===s.ElementType.SPLIT_TAG?u.fixPosition(!0)??r:r}else{const H=e[r-1],Q=e[r+1];return!c.originControlId&&H?.controlId===c.controlId&&H?.originControlId===c.originControlId&&H?.controlComponent===s.ControlComponent.VALUE&&(c.controlComponent===s.ControlComponent.POSTFIX||c.controlComponent===s.ControlComponent.POST_TEXT||c.controlComponent===s.ControlComponent.POSTTEXTFIX||c.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT)&&this.options.mode!==s.EditorMode.FORM?(u.spliceElementList(e,r-1,1),this.getValue().length||this.control.addPlaceholder(r-2),r-2):F(Q)?Q.originControlId?Y?D():y?(u.spliceElementList(e,r,1),this.getValue().length||this.control.addPlaceholder(r-1),S(Math.max(r-1,0),c.controlId,c.originControlId||null)):N(r):(u.spliceElementList(e,r,1),this.control.addPlaceholder(r-1),S(Math.max(r-1,0),c.controlId,c.originControlId||null)):(u.spliceElementList(e,r,1),r===1&&e[0].type===s.ElementType.SPLIT_TAG||r===0?u.fixPosition(!0)??r-1:S(Math.max(r-1,0),c.controlId,c.originControlId||null))}}}else if(t.key===s.KeyMap.Delete){if(r===a&&Z&&(c.controlComponent===s.ControlComponent.PLACEHOLDER||c.controlComponent===s.ControlComponent.POSTFIX||c.controlComponent===s.ControlComponent.POST_TEXT||c.controlComponent===s.ControlComponent.POSTTEXTFIX||c.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT))return S(a,c.controlId,c.originControlId||null);if(r===a&&(M||V)){if(y){const A=e[a+1];if(A?.controlComponent===s.ControlComponent.VALUE&&A.controlId===c.controlId&&!A.originControlId)return u.spliceElementList(e,a+1,1),this.getValue().length||this.control.addPlaceholder(r),r}return N(a+1)}const W=e[a+1],H=!!c.originControlId;if(this.options.mode===s.EditorMode.FORM&&this.options.modeRule.form.deleteTraceEnabled&&!m&&(!H||c.controlComponent===s.ControlComponent.VALUE))return d.controlComponent===s.ControlComponent.POSTFIX||d.controlComponent===s.ControlComponent.POST_TEXT||d.controlComponent===s.ControlComponent.POSTTEXTFIX||d.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT||c.controlComponent===s.ControlComponent.PLACEHOLDER?a:r===a&&(W?.controlComponent===s.ControlComponent.POSTFIX||W?.controlComponent===s.ControlComponent.POST_TEXT||W?.controlComponent===s.ControlComponent.POSTTEXTFIX||W?.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT)?W.originControlId?y?(u.spliceElementList(e,r+1,1),this.getValue().length||this.control.addPlaceholder(r),r):N(r+1):(u.spliceElementList(e,r+1,1),this.control.addPlaceholder(r),r):this.strikeout();{const A=e[a+1];if(c.controlComponent===s.ControlComponent.PLACEHOLDER)return a;if(r===a&&(A?.controlComponent===s.ControlComponent.POSTFIX||A?.controlComponent===s.ControlComponent.POST_TEXT||A?.controlComponent===s.ControlComponent.POSTTEXTFIX||A?.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT))return A.originControlId?y?(u.spliceElementList(e,r+1,1),this.getValue().length||this.control.addPlaceholder(r),r):N(r+1):(u.spliceElementList(e,r+1,1),this.control.addPlaceholder(r),r);if(r!==a){u.spliceElementList(e,r+1,a-r);const K=e[r+1];return F(K)&&this.control.addPlaceholder(r),r===0&&e[0].type===s.ElementType.SPLIT_TAG?u.fixPosition(!0)??r:r}else return A?(u.spliceElementList(e,r+1,1),r===0&&e[0].type===s.ElementType.SPLIT_TAG?u.fixPosition(!0)??r:r):(u.getTd()?.linkTdNextId&&c.controlId&&this.removeNextControlElement(c.controlId),a)}}return a}cut(){if(this.control.getIsDisabledControl())return-1;this.control.shrinkBoundary();const{startIndex:t,endIndex:e}=this.control.getRange();if(t===e)return t;const n=this.control.getDraw(),i=this.control.getElementList();n.spliceElementList(i,t+1,e-t);const l=i[t+1];return(l?.controlComponent===s.ControlComponent.POSTFIX||l?.controlComponent===s.ControlComponent.POST_TEXT||l?.controlComponent===s.ControlComponent.POSTTEXTFIX||l?.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT)&&this.control.addPlaceholder(t),t}strikeout(t){const e=this.control.getRange(),{endIndex:n}=e,{isIgnoreDisabledRule:i=!1}=t||{};if(!i&&(this.draws.isReadonly()||this.draws.isDisabled()))return null;const r=this.ranges.getSelectionElementList(),a=this.position.getCursorPosition(),c=at(new Date).format("YYYY-MM-DD HH:mm:ss"),d=h=>{queueMicrotask(()=>{this.ranges.setRange(h,h),this.draws.setCursor(h)})},u=h=>{const T=this.control.getElementList(),g=T[h],f=g?.controlId,m=g?.originControlId||null;let p=-1;for(let I=h-1;I>=0;I--){const C=T[I];if(C.controlId===f&&(C.originControlId||null)===m&&C.controlComponent===s.ControlComponent.VALUE)return I;if(m){if(C.controlId&&C.controlId!==f&&C.originControlId!==m)break}else{if(C.controlId===f&&(C.controlComponent===s.ControlComponent.PREFIX||C.controlComponent===s.ControlComponent.PRE_TEXT||C.controlComponent===s.ControlComponent.PRETEXTFIX||C.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT)){p=I;break}if(C.controlId&&C.controlId!==f&&!C.originControlId)break;if(C.originControlId===f&&(C.controlComponent===s.ControlComponent.POSTFIX||C.controlComponent===s.ControlComponent.POST_TEXT||C.controlComponent===s.ControlComponent.POSTTEXTFIX||C.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT))return I}}if(p>=0){const I=p+1,C=T[I];return C?.controlId===f&&(C.controlComponent===s.ControlComponent.PLACEHOLDER||C.controlComponent===s.ControlComponent.VALUE)?I:p}return h},R=h=>{const T=this.control.getElementList(),g=T[h];if(!g?.controlId||g.controlComponent===s.ControlComponent.VALUE&&(g.metrics?.width??0)>0)return h;for(let f=h+1;f<T.length;f++){const m=T[f];if(m.controlId!==g.controlId||(m.originControlId||null)!==(g.originControlId||null))break;if(m.controlComponent===s.ControlComponent.VALUE&&(m.metrics?.width??0)>0)return f}for(let f=h-1;f>=0;f--){const m=T[f];if(m.controlId!==g.controlId||(m.originControlId||null)!==(g.originControlId||null))break;if(m.controlComponent===s.ControlComponent.VALUE&&(m.metrics?.width??0)>0)return f}return h};if(r?.length){if(!this.element.strikeout){const h=r.findIndex(T=>!T.strikeout);return r.forEach(T=>{T.deletePerson="SWJ",T.deleteTime=c,T.strikeout=!!~h}),this.draws.render({isSetCursor:!0,isCompute:!1,isDel:!0,isSubmitHistory:!1}),this.ranges.setDefaultStyle({strikeout:!1}),this.control.getRange().endIndex??null}}else{const h=R(a.index),T=this.control.getElementList()[h],g=this.control.getElementList();if(!this.control.getElementList()[h].strikeout&&T?.metrics.width>0){this.control.getElementList()[h].strikeout=!0,this.control.getElementList()[h].deletePerson="SWJ",this.control.getElementList()[h].deleteTime=c;const f=u(h);return this.ranges.setRange(f,f),this.draws.render({curIndex:f,isSetCursor:!0,isCompute:!1,isSubmitHistory:!1}),this.ranges.setDefaultStyle({strikeout:!1}),d(f),f??null}else if(n>=0&&n<g.length&&g[n]?.metrics?.width!==void 0&&g[n].metrics.width<=0&&!g[n]?.strikeout){g.splice(n,1);const f=n-1;return this.ranges.setRange(f,f),this.draws.render({curIndex:f,isSetCursor:!0,isCompute:!1,isSubmitHistory:!1}),this.ranges.setDefaultStyle({strikeout:!1}),d(f),f??null}}return n??null}strikeoute(t){const{isIgnoreDisabledRule:e=!1}=t||{};if(!e&&(this.draws.isReadonly()||this.draws.isDisabled()))return;if(!this.ranges.getSelectionElementList()?.length){const{endIndex:l}=this.ranges.getRange(),a=this.draws.getElementList()[l];this.ranges.setDefaultStyle({strikeout:a.strikeout?!1:!this.ranges.getDefaultStyle()?.strikeout})}}}class Nl{draw;options;now;dom;renderOptions;isDatePicker;pickDate;lang;constructor(t,e={}){this.draw=t,this.options=e,this.lang=this._getLang(),this.now=new Date,this.dom=this._createDom(),this.renderOptions=null,this.isDatePicker=!0,this.pickDate=null,this._bindEvent()}_createDom(){const t=document.createElement("div");t.classList.add(`${st}-date-container`),t.setAttribute(ve,s.EditorComponent.POPUP);const e=document.createElement("div");e.classList.add(`${st}-date-wrap`);const n=document.createElement("div");n.classList.add(`${st}-date-title`);const i=document.createElement("span");i.classList.add(`${st}-date-title__pre-year`),i.innerText="<<";const l=document.createElement("span");l.classList.add(`${st}-date-title__pre-month`),l.innerText="<";const r=document.createElement("span");r.classList.add(`${st}-date-title__now`);const a=document.createElement("span");a.classList.add(`${st}-date-title__next-month`),a.innerText=">";const c=document.createElement("span");c.classList.add(`${st}-date-title__next-year`),c.innerText=">>",n.append(i),n.append(l),n.append(r),n.append(a),n.append(c);const d=document.createElement("div");d.classList.add(`${st}-date-week`);const{weeks:{sun:u,mon:R,tue:h,wed:T,thu:g,fri:f,sat:m}}=this.lang;[u,R,h,T,g,f,m].forEach(V=>{const N=document.createElement("span");N.innerText=`${V}`,d.append(N)});const I=document.createElement("div");I.classList.add(`${st}-date-day`),e.append(n),e.append(d),e.append(I);const C=document.createElement("ul");C.classList.add(`${st}-time-wrap`);let E,O,P;[this.lang.hour,this.lang.minute,this.lang.second].forEach((V,N)=>{const y=document.createElement("li"),L=document.createElement("span");L.innerText=V,y.append(L);const F=document.createElement("ol"),D=N===0,Y=N===1,Z=D?24:60;for(let _=0;_<Z;_++){const W=document.createElement("li");W.innerText=`${String(_).padStart(2,"0")}`,W.setAttribute("data-id",`${_}`),F.append(W)}D?E=F:Y?O=F:P=F,y.append(F),C.append(y)});const X=document.createElement("div");X.classList.add(`${st}-date-menu`);const U=document.createElement("button");U.classList.add(`${st}-date-menu__time`),U.innerText=this.lang.timeSelect;const b=document.createElement("button");b.classList.add(`${st}-date-menu__now`),b.innerText=this.lang.now;const M=document.createElement("button");return M.classList.add(`${st}-date-menu__submit`),M.innerText=this.lang.confirm,X.append(U),X.append(b),X.append(M),t.append(e),t.append(C),t.append(X),this.draw.getContainer().append(t),{container:t,dateWrap:e,datePickerWeek:d,timeWrap:C,title:{preYear:i,preMonth:l,now:r,nextMonth:a,nextYear:c},day:I,time:{hour:E,minute:O,second:P},menu:{time:U,now:b,submit:M}}}_bindEvent(){this.dom.title.preYear.onclick=()=>{this._preYear()},this.dom.title.preMonth.onclick=()=>{this._preMonth()},this.dom.title.nextMonth.onclick=()=>{this._nextMonth()},this.dom.title.nextYear.onclick=()=>{this._nextYear()},this.dom.menu.time.onclick=()=>{this.isDatePicker=!this.isDatePicker,this._toggleDateTimePicker()},this.dom.menu.now.onclick=()=>{this._now(),this._submit()},this.dom.menu.submit.onclick=()=>{this.dispose(),this._submit()},this.dom.time.hour.onclick=t=>{if(!this.pickDate)return;const n=t.target.dataset.id;n&&(this.pickDate.setHours(Number(n)),this._setTimePick(!1))},this.dom.time.minute.onclick=t=>{if(!this.pickDate)return;const n=t.target.dataset.id;n&&(this.pickDate.setMinutes(Number(n)),this._setTimePick(!1))},this.dom.time.second.onclick=t=>{if(!this.pickDate)return;const n=t.target.dataset.id;n&&(this.pickDate.setSeconds(Number(n)),this._setTimePick(!1))}}_setPosition(){if(!this.renderOptions)return;const{position:{coordinate:{leftTop:[t,e]},lineHeight:n,pageNo:i}}=this.renderOptions,l=this.draw.getHeight(),r=this.draw.getPageGap(),c=(i??this.draw.getPageNo())*(l+r);this.dom.container.style.left=`${t}px`,this.dom.container.style.top=`${e+c+n}px`}isInvalidDate(t){return t.toDateString()==="Invalid Date"}_setValue(){const t=this.renderOptions?.value;if(t){const e=new Date(t);this.now=this.isInvalidDate(e)?new Date:e}else this.now=new Date;this.pickDate=new Date(this.now)}_getLang(){const t=this.draw.getI18n(),e=t.t.bind(t);return{now:e("datePicker.now"),confirm:e("datePicker.confirm"),return:e("datePicker.return"),timeSelect:e("datePicker.timeSelect"),weeks:{sun:e("datePicker.weeks.sun"),mon:e("datePicker.weeks.mon"),tue:e("datePicker.weeks.tue"),wed:e("datePicker.weeks.wed"),thu:e("datePicker.weeks.thu"),fri:e("datePicker.weeks.fri"),sat:e("datePicker.weeks.sat")},year:e("datePicker.year"),month:e("datePicker.month"),hour:e("datePicker.hour"),minute:e("datePicker.minute"),second:e("datePicker.second")}}_setLangChange(){this.dom.menu.time.innerText=this.lang.timeSelect,this.dom.menu.now.innerText=this.lang.now,this.dom.menu.submit.innerText=this.lang.confirm;const{weeks:{sun:t,mon:e,tue:n,wed:i,thu:l,fri:r,sat:a}}=this.lang,c=[t,e,n,i,l,r,a];this.dom.datePickerWeek.childNodes.forEach((h,T)=>{const g=h;g.innerText=c[T]});const d=this.dom.time.hour.previousElementSibling;d.innerText=this.lang.hour;const u=this.dom.time.minute.previousElementSibling;u.innerText=this.lang.minute;const R=this.dom.time.second.previousElementSibling;R.innerText=this.lang.second}_update(){const t=new Date,e=t.getFullYear(),n=t.getMonth()+1,i=t.getDate();let l=null,r=null,a=null;this.pickDate&&(l=this.pickDate.getFullYear(),r=this.pickDate.getMonth()+1,a=this.pickDate.getDate());const c=this.now.getFullYear(),d=this.now.getMonth()+1;this.dom.title.now.innerText=`${c}${this.lang.year} ${String(d).padStart(2,"0")}${this.lang.month}`;const R=new Date(c,d,0).getDate();let h=new Date(c,d-1,1).getDay();h===0&&(h=7);const T=new Date(c,d-1,0).getDate();this.dom.day.innerHTML="";const g=T-h+1;for(let m=g;m<=T;m++){const p=document.createElement("div");p.classList.add("disable"),p.innerText=`${m}`,p.onclick=()=>{const I=d-2;this.now=new Date(c,I,m),this._setDatePick(c,I,m)},this.dom.day.append(p)}for(let m=1;m<=R;m++){const p=document.createElement("div");e===c&&n===d&&i===m&&p.classList.add("active"),this.pickDate&&l===c&&r===d&&a===m&&p.classList.add("select"),p.innerText=`${m}`,p.onclick=I=>{const C=d-1;this.now=new Date(c,C,m),this._setDatePick(c,C,m),I.stopPropagation()},this.dom.day.append(p)}const f=42-h-R;for(let m=1;m<=f;m++){const p=document.createElement("div");p.classList.add("disable"),p.innerText=`${m}`,p.onclick=()=>{this.now=new Date(c,d,m),this._setDatePick(c,d,m)},this.dom.day.append(p)}}_toggleDateTimePicker(){this.isDatePicker?(this.dom.dateWrap.classList.add("active"),this.dom.timeWrap.classList.remove("active"),this.dom.menu.time.innerText=this.lang.timeSelect):(this.dom.dateWrap.classList.remove("active"),this.dom.timeWrap.classList.add("active"),this.dom.menu.time.innerText=this.lang.return,this._setTimePick())}_setDatePick(t,e,n){this.now=new Date(t,e,n),this.pickDate?.setFullYear(t),this.pickDate?.setMonth(e),this.pickDate?.setDate(n),this._update()}_setTimePick(t=!0){const e=this.pickDate?.getHours()||0,n=this.pickDate?.getMinutes()||0,i=this.pickDate?.getSeconds()||0,{hour:l,minute:r,second:a}=this.dom.time;[l,r,a].forEach(u=>{u.querySelectorAll("li").forEach(R=>R.classList.remove("active"))}),[[l,e],[r,n],[a,i]].forEach(([u,R])=>{const h=u.querySelector(`[data-id='${R}']`);h.classList.add("active"),t&&Mi(u,h)})}_preMonth(){this.now.setMonth(this.now.getMonth()-1),this._update()}_nextMonth(){this.now.setMonth(this.now.getMonth()+1),this._update()}_preYear(){this.now.setFullYear(this.now.getFullYear()-1),this._update()}_nextYear(){this.now.setFullYear(this.now.getFullYear()+1),this._update()}_now(){this.pickDate=new Date,this.dispose()}_toggleVisible(t){t?this.dom.container.classList.add("active"):this.dom.container.classList.remove("active")}_submit(){if(this.options.onSubmit&&this.pickDate){const t=this.renderOptions?.dateFormat,e=this.formatDate(this.pickDate,t);this.options.onSubmit(e)}}formatDate(t,e="YYYY-MM-DD HH:mm:ss"){let n=e;const i=t.getFullYear().toString(),l=(t.getMonth()+1).toString(),r=t.getDate().toString(),a=t.getHours(),c=a%12===0?12:a%12,d=t.getMinutes().toString(),u=t.getSeconds().toString(),R=t.getMilliseconds().toString(),h={"y+":i,"Y+":i,"M+":l,"d+":r,"D+":r,"h+":c.toString(),"H+":a.toString(),"m+":d,"s+":u,"S+":R};for(const T in h){const g=new RegExp("("+T+")").exec(e),f=T;g&&(n=n.replace(g[1],g[1].length===1?h[f]:h[f].padStart(g[1].length,"0")))}return n}render(t){this.renderOptions=t,this.lang=this._getLang(),this._setLangChange(),this._setValue(),this._update(),this._setPosition(),this.isDatePicker=!0,this._toggleDateTimePicker(),this._toggleVisible(!0)}dispose(){this._toggleVisible(!1)}destroy(){this.dom.container.remove()}}class Lo{draw;element;control;isPopup;datePicker;options;constructor(t,e){const n=e.getDraw();this.draw=n,this.options=n.getOptions(),this.element=t,this.control=e,this.isPopup=!1,this.datePicker=null}setElement(t){this.element=t}getElement(){return this.element}getIsPopup(){return this.isPopup}getValue(t={}){const e=t.elementList||this.control.getElementList(),n=this.control.getValueRange(t);if(!n)return[];const i=[],{startIndex:l,endIndex:r}=n;for(let a=l;a<=r;a++){const c=e[a];c.controlComponent===s.ControlComponent.VALUE&&i.push(c)}return i}setValue(t,e={},n={}){if(!n.isIgnoreDisabledRule&&this.control.getIsDisabledControl(e))return-1;const{elementList:i,range:l}=this.control.mergeControl(e);this.control.shrinkBoundary(e);const{startIndex:r,endIndex:a}=l,c=this.control.getDraw();r!==a?c.spliceElementList(i,r+1,a-r):this.control.removePlaceholder(r,{elementList:i});const d=i[r],u=d.type&&!Le.includes(d.type)||d.controlComponent===s.ControlComponent.PREFIX||d.controlComponent===s.ControlComponent.PRE_TEXT?Jt(d,["control","controlId",...he]):Ee(d,["type"]),R=l.startIndex+1;for(let h=0;h<t.length;h++){const T={...u,...t[h],controlComponent:s.ControlComponent.VALUE};ae(i,[T],r,{editorOptions:this.options}),c.spliceElementList(i,R+h,0,[T])}return R+t.length-1}clearSelect(t={},e={}){const{isIgnoreDisabledRule:n=!1,isAddPlaceholder:i=!0}=e;if(!n&&this.control.getIsDisabledControl(t))return-1;const l=this.control.getValueRange(t);if(!l)return-1;const{startIndex:r,endIndex:a}=l;if(!~r||!~a)return-1;const c=t.elementList||this.control.getElementList();return this.control.getDraw().spliceElementList(c,r+1,a-r,[],{isIgnoreDeletedRule:e.isIgnoreDeletedRule}),i&&this.control.addPlaceholder(r,t),r}setSelect(t,e={},n={}){if(!n.isIgnoreDisabledRule&&this.control.getIsDisabledControl(e))return;const i=e.elementList||this.control.getElementList(),l=e.range||this.control.getRange(),r=this.getValue(e)[0],a=r?Jt(r,Ne):Jt(i[l.startIndex],he),c=this.clearSelect(e,{isAddPlaceholder:!1,isIgnoreDeletedRule:n.isIgnoreDeletedRule});if(!~c)return;const d=Ee(i[c],Ne),u=c+1,R=this.control.getDraw();for(let h=0;h<t.length;h++){const T={...a,...d,type:s.ElementType.TEXT,value:t[h],controlComponent:s.ControlComponent.VALUE};(T.color===this.options.control.bracketColor||T.color===this.options.control.placeholderColor)&&(T.color=this.options.defaultColor),ae(i,[T],c,{editorOptions:this.options}),R.spliceElementList(i,u+h,0,[T])}if(!e.range){const h=u+t.length-1;this.control.repaintControl({curIndex:h}),this.control.emitControlContentChange({context:e}),this.destroy()}}keydown(t){if(this.control.getIsDisabledControl())return null;const e=this.control.getElementList(),n=this.control.getRange();this.control.shrinkBoundary();const{startIndex:i,endIndex:l}=n,r=e[i],a=e[l],c=this.control.getDraw();if(t.key===s.KeyMap.Backspace)return i!==l?(c.spliceElementList(e,i+1,l-i),this.getValue().length||this.control.addPlaceholder(i),i):r.controlComponent===s.ControlComponent.PREFIX||r.controlComponent===s.ControlComponent.PRE_TEXT||a.controlComponent===s.ControlComponent.POSTFIX||a.controlComponent===s.ControlComponent.POST_TEXT||r.controlComponent===s.ControlComponent.PLACEHOLDER?this.control.removeControl(i):(c.spliceElementList(e,i,1),this.getValue().length||this.control.addPlaceholder(i-1),i-1);if(t.key===s.KeyMap.Delete){if(i!==l)return c.spliceElementList(e,i+1,l-i),this.getValue().length||this.control.addPlaceholder(i),i;{const d=e[l+1];return(r.controlComponent===s.ControlComponent.PREFIX||r.controlComponent===s.ControlComponent.PRE_TEXT)&&d.controlComponent===s.ControlComponent.PLACEHOLDER||d.controlComponent===s.ControlComponent.POSTFIX||d.controlComponent===s.ControlComponent.POST_TEXT||r.controlComponent===s.ControlComponent.PLACEHOLDER?this.control.removeControl(i):(c.spliceElementList(e,i+1,1),this.getValue().length||this.control.addPlaceholder(i),i)}}return l}cut(){if(this.control.getIsDisabledControl())return-1;this.control.shrinkBoundary();const{startIndex:t,endIndex:e}=this.control.getRange();if(t===e)return t;const n=this.control.getDraw(),i=this.control.getElementList();return n.spliceElementList(i,t+1,e-t),this.getValue().length||this.control.addPlaceholder(t),t}awake(){if(this.isPopup||this.control.getIsDisabledControl()||!this.control.getIsRangeWithinControl())return;const t=this.control.getPosition();if(!t)return;const e=this.draw.getElementList(),{startIndex:n}=this.control.getRange();if(e[n+1]?.controlId!==this.element.controlId)return;this.datePicker=new Nl(this.draw,{onSubmit:this._setDate.bind(this)});const i=this.getValue().map(r=>r.value).join("")||"",l=this.element.control?.dateFormat;this.datePicker.render({value:i,position:t,dateFormat:l}),this.isPopup=!0}destroy(){this.isPopup&&(this.datePicker?.destroy(),this.isPopup=!1)}_setDate(t){t?this.setSelect(t):this.clearSelect(),this.destroy()}}class ui extends Vs{isPopup;inputPopup;constructor(t,e){super(t,e),this.isPopup=!1,this.inputPopup=null}getIsPopup(){return this.isPopup}setValue(t,e={},n={}){if(t.some(I=>!Fc(I)))return-1;const i=e.elementList||this.control.getElementList(),l=e.range||this.control.getRange();this.control.shrinkBoundary(e);const r=lt(t),{startIndex:a,endIndex:c}=l,d=i[a];let u=null;for(let I=a;I>=0;I--)if(i[I].controlComponent===s.ControlComponent.PREFIX){u=i[I];break}const R=u?.control||this.element.control;if(this.control.getIsExistValueByElementListIndex(i,a)){let I=a;for(;I>0;){const E=i[I];if(E.controlId!==d.controlId||E.controlComponent===s.ControlComponent.PREFIX||E.controlComponent===s.ControlComponent.PRE_TEXT)break;r.unshift(E),I--}let C=c+1;for(;C<i.length;){const E=i[C];if(E.controlId!==d.controlId||E.controlComponent===s.ControlComponent.POSTFIX||E.controlComponent===s.ControlComponent.POST_TEXT)break;r.push(E),C++}}const h=Rr(r);if(!/^[+-]?(?:\d+)?(?:\.\d*)?(?:[eE][+-]?\d*)?$/.test(h))return-1;const g=R?.numberExclusiveOptions,f=g?.maxLength??null,m=g?.decimalPlaces??null,p=h.replace(/[+\-.eE]/g,"").length;if(f!=null&&p>f||m!=null&&(h.split(/[eE]/)[0].split(".")[1]||"").length>m)return-1;if(e.range||e.elementList){const I=Number(h),C=g?.minValue,E=g?.maxValue;if(!Number.isFinite(I)||C!=null&&I<C||E!=null&&I>E)return-1}return super.setValue(t,e,n)}_setNumberValue(t){const e=this.control.getElementList(),n=this.control.getRange(),{startIndex:i}=n;let l=null;for(let S=i;S>=0;S--)if(e[S].controlComponent===s.ControlComponent.PREFIX){l=e[S];break}const a=(l?.control||this.element.control)?.numberExclusiveOptions,c=a?.minValue,d=a?.maxValue,u=a?.minLength,R=a?.maxLength,h=t.trim(),T=h.replace(/[+\-.eE]/g,"").length,g=Number(h);if(u!=null&&T<u||R!=null&&T>R||c!=null&&g<c||d!=null&&g>d)return!1;let f=i;for(let S=i;S>=0;S--)if(e[S].controlComponent===s.ControlComponent.PREFIX){f=S;break}let m=f+1;for(let S=f+1;S<e.length;S++)if(e[S].controlComponent===s.ControlComponent.POSTFIX){m=S;break}const p=this.options.mode===s.EditorMode.FORM,I=p&&this.options.modeRule.form.inputTraceEnabled,C=p&&this.options.modeRule.form.deleteTraceEnabled,E=at(new Date).format("YYYY-MM-DD HH:mm:ss");if(C)for(let S=f+1;S<m;S++){const X=e[S];X.controlComponent===s.ControlComponent.VALUE&&!X.strikeout&&X.value&&(X.strikeout=!0,X.deletePerson="SYSTEM",X.deleteTime=E),X.controlComponent===s.ControlComponent.PLACEHOLDER&&(this.control.getDraw().spliceElementList(e,S,1),m--,S--)}else{const S=f+1,X=m-S;X>0&&this.control.getDraw().spliceElementList(e,S,X),m=f+1}m=f+1;for(let S=f+1;S<e.length;S++)if(e[S].controlComponent===s.ControlComponent.POSTFIX){m=S;break}const O=[];for(let S=0;S<h.length;S++){const X={type:s.ElementType.TEXT,value:h[S],controlComponent:s.ControlComponent.VALUE,controlId:e[f].controlId,originControlId:e[f].originControlId,control:e[f].control};I&&(X.textDecoration={style:s.TextDecorationStyle.DOUBLE},X.underline=!0),O.push(X)}for(let S=0;S<O.length;S++)this.control.getDraw().spliceElementList(e,m+S,0,[O[S]]);const P=m+O.length-1;return this.control.getDraw().getRange().setRange(P,P),this.control.emitControlContentChange(),this.control.repaintControl({curIndex:P}),!0}awake(){if(this.isPopup||this.control.getIsDisabledControl()||!this.control.getIsRangeWithinControl())return;const t=this.control.getElementList(),e=this.control.getRange(),{startIndex:n}=e,i=t[n];if(!i||i.controlId!==this.element.controlId)return;let l=null;for(let g=n;g>=0;g--)if(t[g].controlComponent===s.ControlComponent.PREFIX){l=t[g];break}const r=l?.control||this.element.control,c=this.getValue().filter(g=>!g.strikeout),d=c.length>0?Rr(c):"",u=r?.numberExclusiveOptions,R=u?.minValue,h=u?.maxValue,T=u?.decimalPlaces;this.inputPopup=new iT({control:this.control,currentValue:d,minValue:R,maxValue:h,decimalPlaces:T,onConfirm:g=>{if(!g||g.trim()==="")return this._clearNumberValue(),!0;const f=Number(g);return Number.isNaN(f)||!Number.isFinite(f)?!1:this._setNumberValue(g)},onTab:g=>{this.destroy(),setTimeout(()=>{this.control.initNextControl({direction:g})})},onClose:()=>{this.destroy()}}),this.inputPopup.create(),this.isPopup=!0}_clearNumberValue(){const t=this.control.getElementList(),e=this.control.getRange(),{startIndex:n}=e;let i=n;for(let c=n;c>=0;c--)if(t[c].controlComponent===s.ControlComponent.PREFIX){i=c;break}let l=i+1;for(let c=i+1;c<t.length;c++)if(t[c].controlComponent===s.ControlComponent.POSTFIX){l=c;break}const r=i+1,a=l-r;a>0&&this.control.getDraw().spliceElementList(t,r,a),this.control.addPlaceholder(i),this.control.getDraw().getRange().setRange(i,i),this.control.emitControlContentChange(),this.control.repaintControl({curIndex:i})}keydown(t){if(this.control.getIsDisabledControl())return null;const e=this.control.getElementList(),n=this.control.getRange();this.control.shrinkBoundary();const{startIndex:i,endIndex:l}=n,r=e[i],a=e[l],c=this.control.getDraw(),d=c.getMode()===s.EditorMode.FORM;if(t.key==="Backspace")return r.controlComponent===s.ControlComponent.PREFIX||r.controlComponent===s.ControlComponent.PRE_TEXT||r.controlComponent===s.ControlComponent.PLACEHOLDER?d?i:this.control.removeControl(i):a.controlComponent===s.ControlComponent.POSTFIX||a.controlComponent===s.ControlComponent.POST_TEXT?i:i!==l?(c.spliceElementList(e,i+1,l-i),this.getValue().length||this.control.addPlaceholder(i),i):(c.spliceElementList(e,i,1),this.getValue().length||this.control.addPlaceholder(i-1),i-1);if(t.key==="Delete"){const u=e[l+1];return r.controlComponent===s.ControlComponent.PLACEHOLDER||a.controlComponent===s.ControlComponent.POSTFIX||a.controlComponent===s.ControlComponent.POST_TEXT?d?l:this.control.removeControl(i):r.controlComponent===s.ControlComponent.PREFIX||r.controlComponent===s.ControlComponent.PRE_TEXT||u?.controlComponent===s.ControlComponent.POSTFIX||u?.controlComponent===s.ControlComponent.POST_TEXT?l:i!==l?(c.spliceElementList(e,i+1,l-i),this.getValue().length||this.control.addPlaceholder(i),i):(c.spliceElementList(e,i+1,1),this.getValue().length||this.control.addPlaceholder(i),i)}return l}destroy(){this.inputPopup&&(this.inputPopup.destroy(),this.inputPopup=null),this.isPopup=!1}}class iT{options;popupDom;constructor(t){this.options=t,this.popupDom=null}create(){const{currentValue:t,minValue:e,maxValue:n,decimalPlaces:i,onConfirm:l,onTab:r,onClose:a}=this.options,c=document.createElement("div");c.classList.add(`${st}-number-input-modal`),c.setAttribute(ve,s.EditorComponent.POPUP);const d=C=>{if(C.type==="mouseup"){const E=this.options.control.getDraw().getCanvasEvent();E.setIsAllowDrag(!1),E.setIsAllowSelection(!1)}C.stopPropagation()};c.addEventListener("mousedown",d),c.addEventListener("mouseup",d),c.addEventListener("click",d),c.addEventListener("keydown",d),c.addEventListener("input",d);const u=document.createElement("div");u.classList.add(`${st}-number-input-modal__content`);const R=document.createElement("div");if(R.classList.add(`${st}-number-input-modal__title`),R.textContent="请输入数值",u.appendChild(R),e!==void 0||n!==void 0){const C=document.createElement("div");C.classList.add(`${st}-number-input-modal__hint`);let E="有效范围:";e!==void 0&&n!==void 0?E+=`${e} ~ ${n}`:e!==void 0?E+=`≥ ${e}`:E+=`≤ ${n}`,i!=null&&(E+=`,保留${i}位小数`),C.textContent=E,u.appendChild(C)}const h=document.createElement("input");h.classList.add(`${st}-number-input-modal__input`),h.type="number",h.value=t,h.placeholder="请输入数值",e!==void 0&&(h.min=String(e)),n!==void 0&&(h.max=String(n)),i!=null&&(h.step=(1/Math.pow(10,i)).toString()),setTimeout(()=>{h.focus(),h.select()},100),u.appendChild(h);const T=document.createElement("div");T.classList.add(`${st}-number-input-modal__error`),T.style.display="none",u.appendChild(T);const g=document.createElement("div");g.classList.add(`${st}-number-input-modal__buttons`);const f=document.createElement("button");f.classList.add(`${st}-number-input-modal__cancel`),f.textContent="取消",f.onclick=()=>{a()},g.appendChild(f);const m=document.createElement("button");m.classList.add(`${st}-number-input-modal__confirm`),m.textContent="确定";const p=()=>{const C=h.value.trim();if(!C)return l("");const E=parseFloat(C);return Number.isNaN(E)||!Number.isFinite(E)?(T.textContent="请输入有效的数值",T.style.display="block",!1):i!=null&&(C.split(".")[1]||"").length>i?(T.textContent=`小数位数不能超过${i}位`,T.style.display="block",!1):e!==void 0&&E<e?(T.textContent=`数值不能小于 ${e}`,T.style.display="block",!1):n!==void 0&&E>n?(T.textContent=`数值不能大于 ${n}`,T.style.display="block",!1):(T.style.display="none",l(C))};m.onclick=()=>{p()&&a()},g.appendChild(m),u.appendChild(g),c.appendChild(u),h.onkeydown=C=>{C.key==="Enter"?m.click():C.key==="Tab"?(C.preventDefault(),p()&&(a(),r(C.shiftKey?qt.UP:qt.DOWN))):C.key==="Escape"&&a()},this.options.control.getContainer().appendChild(c),this.popupDom=c}destroy(){this.popupDom&&(this.popupDom.remove(),this.popupDom=null)}}class sT{options;mask;container;inputList;optionItemContainers;data;constructor(t){this.options=t,this.mask=null,this.container=null,this.inputList=[],this.optionItemContainers=[],this.data=t.data,this._render()}_getFieldValue(t){const e=this.inputList.filter(n=>n.name===t);if(e.length!==0){for(const n of e)if(n instanceof HTMLInputElement&&n.type==="radio"&&n.checked)return n.value;return e[0].value}}_updateFieldVisibility(){this.data.forEach((t,e)=>{if(t.visibleWhen){const{field:n,value:i}=t.visibleWhen,l=this._getFieldValue(n),r=this.optionItemContainers[e];if(r){const a=l===i;r.style.display=a?"":"none"}}})}_render(){const{title:t,onClose:e,onCancel:n,onConfirm:i}=this.options,l=document.createElement("div");l.classList.add("dialog-mask"),l.setAttribute(ve,s.EditorComponent.COMPONENT),document.body.append(l);const r=document.createElement("div");r.classList.add("dialog-container"),r.setAttribute(ve,s.EditorComponent.COMPONENT);const a=document.createElement("div");a.classList.add("dialog"),r.append(a);const c=document.createElement("div");c.classList.add("dialog-title");const d=document.createElement("span");d.append(document.createTextNode(t));const u=document.createElement("i");u.onclick=()=>{e&&e(),this._dispose()},c.append(d),c.append(u),a.append(c);const R=document.createElement("div");R.classList.add("dialog-option");for(let f=0;f<this.data.length;f++){const m=this.data[f],p=document.createElement("div");if(p.classList.add("dialog-option__item"),m.visible===!1&&(p.style.display="none"),m.label){const I=document.createElement("span");I.append(document.createTextNode(m.label)),p.append(I),m.required&&I.classList.add("dialog-option__item--require")}if(m.type==="radio"){const I=document.createElement("div");I.classList.add("dialog-radio-group"),m.horizontal&&I.classList.add("dialog-radio-group--horizontal"),m.options?.forEach(C=>{const E=document.createElement("label");E.classList.add("dialog-radio-item");const O=document.createElement("input");O.type="radio",O.name=m.name,O.value=C.value,C.value===(m.value||"")&&(O.checked=!0);const P=document.createElement("span");P.textContent=C.label,E.append(O),E.append(P),I.append(E),O.addEventListener("change",()=>{this._updateFieldVisibility()}),this.inputList.push(O)}),p.append(I)}else if(m.type==="select"){const I=document.createElement("select"),C=m.value||"";m.options?.forEach(E=>{const O=document.createElement("option");O.value=E.value,O.label=E.label,E.value===C&&(O.selected=!0),I.append(O)}),I.name=m.name,I.value=C,I.addEventListener("change",()=>{this._updateFieldVisibility()}),m.width&&(I.style.width=`${m.width}px`),p.append(I),this.inputList.push(I)}else if(m.type==="textarea"){const I=document.createElement("textarea");I.name=m.name,I.value=m.value||"",I.placeholder=m.placeholder||"",m.width&&(I.style.width=`${m.width}px`),m.height&&(I.style.height=`${m.height}px`),p.append(I),this.inputList.push(I)}else{const I=document.createElement("input");I.type=m.type,I.name=m.name,I.value=m.value||"",I.placeholder=m.placeholder||"",m.width&&(I.style.width=`${m.width}px`),m.height&&(I.style.height=`${m.height}px`),p.append(I),this.inputList.push(I)}R.append(p),this.optionItemContainers.push(p)}a.append(R);const h=document.createElement("div");h.classList.add("dialog-menu");const T=document.createElement("button");T.classList.add("dialog-menu__cancel"),T.append(document.createTextNode("取消")),T.type="button",T.onclick=()=>{n&&n(),this._dispose()},h.append(T);const g=document.createElement("button");g.append(document.createTextNode("确定")),g.type="submit",g.onclick=()=>{if(i){const f=new Set,m=[];for(const p of this.inputList)if(!f.has(p.name))if(p instanceof HTMLInputElement&&p.type==="radio"){const I=this.inputList.find(C=>C.name===p.name&&C instanceof HTMLInputElement&&C.checked);I&&(m.push({name:p.name,value:I.value}),f.add(p.name))}else m.push({name:p.name,value:p.value}),f.add(p.name);i(m)}this._dispose()},h.append(g),a.append(h),document.body.append(r),this.container=r,this.mask=l,this._updateFieldVisibility()}_dispose(){this.mask?.remove(),this.container?.remove()}}function rT(o,t){const e=o.trim();if(!e)return;const n=t?.key===e;return{...n?t:{},key:e,label:n&&t?.label?t.label:e,writeTarget:t?.writeTarget||"self",writeMode:t?.writeMode||"replaceOnConfirm"}}class Nn{draw;element;control;isPopup;datePicker;options;range;static isDeleting=!1;inputModal=null;constructor(t,e){const n=e.getDraw();this.draw=n,this.range=n.getRange(),this.options=n.getOptions(),this.element=t,this.control=e,this.isPopup=!1,this.datePicker=null}setElement(t){this.element=t}getElement(){return this.element}getIsPopup(){return this.isPopup}getValue(t={}){const e=t.elementList||this.control.getElementList(),n=this.control.getValueRange(t);if(!n)return[];const i=[],{startIndex:l,endIndex:r}=n;for(let a=l;a<=r;a++){const c=e[a];c.controlComponent===s.ControlComponent.VALUE&&!me(c)&&i.push(c)}return i}setValue(t,e={},n={}){if(!n.isIgnoreDisabledRule&&(this.control.getIsDisabledControl(e)||this.element.control?.editable===!1))return-1;const i=e.elementList||this.control.getElementList(),l=e.range||this.control.getRange(),{startIndex:r,endIndex:a}=l,c=i[r],d=this.element.controlId||c.controlId,u=this.element.originControlId||c.originControlId||null;if(!d)return-1;const R=this.getButtonControlBounds(i,d,u);if(!R)return-1;const h=this.getButtonBusinessOffset(i,R,r),T=this.getButtonBusinessOffset(i,R,a),g=this.getButtonBusinessElements(i,R),f=this.splitButtonBusinessElements(t),m=[...g.slice(0,h),...f,...g.slice(T)];return this.replaceButtonBusinessElements(i,R,m,h+f.length)}isSameButtonElement(t,e,n){return!!(t&&t.controlId===e&&(t.originControlId||null)===n)}getButtonControlBounds(t,e,n){let i=-1,l=-1;for(let r=0;r<t.length;r++){const a=t[r];this.isSameButtonElement(a,e,n)&&(i===-1&&a.controlComponent===s.ControlComponent.PREFIX&&(i=r),a.controlComponent===s.ControlComponent.POSTFIX&&(l=r))}return i===-1||l===-1?null:{controlId:e,originControlId:n,prefixIndex:i,postfixIndex:l}}getButtonBusinessOffset(t,e,n){let i=0;const l=Math.min(n,e.postfixIndex-1);for(let r=e.prefixIndex+1;r<=l;r++){const a=t[r];this.isSameButtonElement(a,e.controlId,e.originControlId)&&a.controlComponent===s.ControlComponent.VALUE&&!me(a)&&i++}return i}toButtonBusinessElement(t){const e={value:t.value===`
|
|
125
125
|
`?B:t.value||""};return[...de,"color","bold","italic","underline","strikeout","size","font","highlight","textDecoration"].forEach(i=>{const l=t[i];l!==void 0&&(e[i]=l)}),e}splitButtonBusinessElements(t){const e=[];return t.forEach(n=>{me(n)||bt(n.value===B?`
|
|
126
126
|
`:n.value||"").forEach(i=>{e.push(this.toButtonBusinessElement({...n,value:i===`
|
|
127
127
|
`?B:i}))})}),e}getButtonBusinessElements(t,e){const n=[];for(let i=e.prefixIndex+1;i<e.postfixIndex;i++){const l=t[i];this.isSameButtonElement(l,e.controlId,e.originControlId)&&l.controlComponent===s.ControlComponent.VALUE&&!me(l)&&n.push(this.toButtonBusinessElement(l))}return n}getButtonBusinessText(t){return t.map(e=>e.value===B?`
|
|
@@ -209,7 +209,7 @@ ${R} `}textToElements(t){const e=[],n=t.split(`
|
|
|
209
209
|
<button class="btn-confirm">确认</button>
|
|
210
210
|
</div>
|
|
211
211
|
</div>
|
|
212
|
-
`,document.body.appendChild(this.inputModal);const e=this.inputModal.querySelector(".menstrual-history-modal__mask"),n=this.inputModal.querySelector(".menstrual-history-modal__container"),i=this.inputModal.querySelector(".menstrual-history-modal__close"),l=this.inputModal.querySelector(".btn-cancel"),r=this.inputModal.querySelector(".btn-confirm"),a=this.inputModal.querySelector("#mh-edit-notMenopause"),c=this.inputModal.querySelector("#mh-edit-isMenopauseForm"),d=this.inputModal.querySelectorAll('input[name="mh-edit-isMenopause"]'),u=()=>{this.closeModal()};n.addEventListener("click",R=>{R.stopPropagation()}),e.addEventListener("click",u),i.addEventListener("click",u),l.addEventListener("click",u),d.forEach(R=>{R.addEventListener("change",()=>{const h=R.value==="true";a.style.display=h?"none":"block",c.style.display=h?"block":"none"})}),r.addEventListener("click",R=>{R.preventDefault(),R.stopPropagation();const h=this.inputModal;if(!h)return;const T=h.querySelector('input[name="mh-edit-isMenopause"]:checked')?.value==="true";let g;T?g={isMenopause:!0,periodMin:h.querySelector("#mh-edit-periodMin2")?.value||"_",periodMax:h.querySelector("#mh-edit-periodMax2")?.value||"_",menarcheAge:h.querySelector("#mh-edit-menarcheAge2")?.value||"_",menopauseAge:h.querySelector("#mh-edit-menopauseAge")?.value||"_",cycleMin:h.querySelector("#mh-edit-cycleMin2")?.value||"_",cycleMax:h.querySelector("#mh-edit-cycleMax2")?.value||"_"}:g={isMenopause:!1,periodMin:h.querySelector("#mh-edit-periodMin")?.value||"_",periodMax:h.querySelector("#mh-edit-periodMax")?.value||"_",menarcheAge:h.querySelector("#mh-edit-menarcheAge1")?.value||"_",lastPeriod:h.querySelector("#mh-edit-lastPeriod")?.value||"____-__-__",cycleMin:h.querySelector("#mh-edit-cycleMin")?.value||"_",cycleMax:h.querySelector("#mh-edit-cycleMax")?.value||"_"};const f=this.control.getElementList(),m=this.element.controlId;for(let E=0;E<f.length;E++){const O=f[E];O.controlId===m&&O.control&&(O.control.menstrualData=g)}const p=this.generateDisplayText(g),I=this.textToElements(p);this.closeModal();const C=this.setValue(I);C!==-1&&(this.control.repaintControl({curIndex:C}),this.control.emitControlContentChange({}))})}closeModal(){this.inputModal&&(this.inputModal.remove(),this.inputModal=null),this.isPopup=!1}destroy(){this.closeModal()}}class aT{controlBorder;textFieldUnderline;draw;range;listener;eventBus;controlSearch;controlQuality;options;controlOptions;activeControl;activeControlValue;preElement;isPopupAwakeDisabled;constructor(t){this.controlBorder=new nu(t),this.textFieldUnderline=new cT(t),this.draw=t,this.range=t.getRange(),this.listener=t.getListener(),this.eventBus=t.getEventBus(),this.controlSearch=new jd(this),this.controlQuality=new eu(t),this.options=t.getOptions(),this.controlOptions=this.options.control,this.activeControl=null,this.activeControlValue=[],this.preElement=null,this.isPopupAwakeDisabled=!1}setPopupAwakeDisabled(t){this.isPopupAwakeDisabled=t}setHighlightList(t){this.controlSearch.setHighlightList(t)}computeHighlightList(){this.controlSearch.getHighlightList().length&&this.controlSearch.computeHighlightList()}renderHighlightList(t,e){this.controlSearch.getHighlightMatchResult().length&&this.controlSearch.renderHighlightList(t,e)}setQualityMarks(t){this.controlQuality.setMarks(t)}getQualityMarks(){return this.controlQuality.getMarks()}renderQualityMarks(t,e,n,i,l,r,a){this.controlQuality.render(t,e,n,i,l,r,a)}getDraw(){return this.draw}filterAssistElement(t){const e=this.options.mode===s.EditorMode.PRINT||this.options.mode===s.EditorMode.COMPARE;return t.filter((n,i)=>{if(n.type===s.ElementType.TABLE){const l=n.trList;for(let r=0;r<l.length;r++){const a=l[r];for(let c=0;c<a.tdList.length;c++){const d=a.tdList[c];d.value=this.filterAssistElement(d.value)}}}if(!n.controlId)return!0;if(n.control?.type===s.ControlType.MENSTRUAL_HISTORY&&e&&(n.controlComponent===s.ControlComponent.PREFIX||n.controlComponent===s.ControlComponent.POSTFIX)||n.control?.type===s.ControlType.SELECT&&e&&(n.controlComponent===s.ControlComponent.PREFIX||n.controlComponent===s.ControlComponent.POSTFIX)||n.control?.type===s.ControlType.NUMBER&&e&&(n.controlComponent===s.ControlComponent.PREFIX||n.controlComponent===s.ControlComponent.POSTFIX)||n.control?.type===s.ControlType.TEXT&&e&&n.strikeout&&n.deletePerson)return!1;if(n.control?.minWidth){if(n.controlComponent===s.ControlComponent.PREFIX||n.controlComponent===s.ControlComponent.POSTFIX)return n.value="",!0}else{const l=this.options.mode===s.EditorMode.FORM;if(n.control?.preText&&n.controlComponent===s.ControlComponent.PRE_TEXT){if(l)return!0;let r=!1,a=i+1;for(;a<t.length;){const c=t[a];if(n.controlId!==c.controlId)break;if(c.controlComponent===s.ControlComponent.VALUE){r=!0;break}a++}return r}if(n.control?.postText&&n.controlComponent===s.ControlComponent.POST_TEXT){if(l)return!0;let r=!1,a=i-1;for(;a<t.length;){const c=t[a];if(n.controlId!==c.controlId)break;if(c.controlComponent===s.ControlComponent.VALUE){r=!0;break}a--}return r}}if(n.control?.preTextFix&&n.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT){let l=!1,r=i+1;for(;r<t.length;){const a=t[r];if(n.controlId!==a.controlId)break;if(a.controlComponent===s.ControlComponent.VALUE){l=!0;break}r++}return l}if(n.control?.postTextFix&&n.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT){let l=!1,r=i-1;for(;r<t.length;){const a=t[r];if(n.controlId!==a.controlId)break;if(a.controlComponent===s.ControlComponent.VALUE){l=!0;break}r--}return l}return n.controlComponent!==s.ControlComponent.PREFIX&&n.controlComponent!==s.ControlComponent.POSTFIX&&n.controlComponent!==s.ControlComponent.PLACEHOLDER&&n.controlComponent!==s.ControlComponent.PRETEXTFIX&&n.controlComponent!==s.ControlComponent.POSTTEXTFIX&&n.controlComponent!==s.ControlComponent.TEXTFIXLABEL})}getIsRangeCanCaptureEvent(){if(!this.activeControl)return!1;const{startIndex:t,endIndex:e}=this.getRange();if(!~t&&!~e)return!1;const n=this.getElementList(),i=n[t];if(i.controlComponent===s.ControlComponent.PLACEHOLDER)return!1;if(t===e&&t>0){const r=n[t-1],a=r?.controlComponent===s.ControlComponent.POSTFIX||r?.controlComponent===s.ControlComponent.POSTTEXTFIX,c=r?.controlComponent===s.ControlComponent.PLACEHOLDER,d=!!r?.controlId,u=!!r?.originControlId;let R=!1;if(u){const p=r.originControlId;for(let I=t;I<n.length;I++){const C=n[I];if(C.controlId===p&&!C.originControlId){R=!0;break}if(C.controlId&&C.controlId!==p&&C.originControlId!==p)break}}const T=this.draw.getPosition().getPositionList(),g=T[t],f=T[t-1],m=g&&f&&g.rowIndex===f.rowIndex;if((a||c)&&d&&m&&!R)return!1}if(t===e&&(i.controlComponent===s.ControlComponent.POSTFIX||i.controlComponent===s.ControlComponent.POSTTEXTFIX))return!0;const l=n[e];return!!(i.controlId&&i.controlId===l.controlId&&l.controlComponent!==s.ControlComponent.POSTFIX&&l.controlComponent!==s.ControlComponent.POSTTEXTFIX)}getIsRangeInPostfix(){if(!this.activeControl)return!1;const{startIndex:t,endIndex:e}=this.getRange();if(t!==e)return!1;const i=this.getElementList()[t];return i.controlComponent===s.ControlComponent.POSTFIX||i.controlComponent===s.ControlComponent.POSTTEXTFIX}getIsRangeWithinControl(){const{range:{startIndex:t,endIndex:e},elementList:n}=this.range.getRangeElement();if(!~t&&!~e)return!1;const i=n[t],l=n[e];if(i?.controlId&&i.controlId===l.controlId&&l.controlComponent!==s.ControlComponent.POSTFIX&&l.controlComponent!==s.ControlComponent.POSTTEXTFIX&&l.controlComponent!==s.ControlComponent.POSTTEXTFIX_TEXT&&l.controlComponent!==s.ControlComponent.POST_TEXT||(l?.control?.type===s.ControlType.TEXT||this.draw.getMode()===s.EditorMode.EDIT&&l?.control?.type===s.ControlType.TEXTFIELD)&&l.controlId&&!l.originControlId&&(l.controlComponent===s.ControlComponent.POSTFIX||l.controlComponent===s.ControlComponent.POSTTEXTFIX||l.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT||l.controlComponent===s.ControlComponent.POST_TEXT)&&n[e-1]?.originControlId===l.controlId)return!0;if(l?.originControlId&&(l.controlComponent===s.ControlComponent.POSTFIX||l.controlComponent===s.ControlComponent.POSTTEXTFIX)){const r=l.originControlId;for(let a=e+1;a<n.length;a++){const c=n[a];if(c.controlId===r)return!0;if(c.controlId&&c.controlId!==r&&c.originControlId!==r)break}}if(!l?.originControlId&&l?.controlId&&(l.controlComponent===s.ControlComponent.POSTFIX||l.controlComponent===s.ControlComponent.POSTTEXTFIX)){const r=n[e+1];if(r?.controlId&&r.controlId!==l.controlId&&(r.controlComponent===s.ControlComponent.PREFIX||r.controlComponent===s.ControlComponent.PRETEXTFIX)&&r.originControlId||r?.controlId&&r.controlId!==l.controlId&&(r.controlComponent===s.ControlComponent.POSTFIX||r.controlComponent===s.ControlComponent.POSTTEXTFIX)&&r.originControlId)return!0;for(let a=e;a>=0;a--){const c=n[a];if(c.controlId===l.controlId&&(c.controlComponent===s.ControlComponent.PREFIX||c.controlComponent===s.ControlComponent.PRETEXTFIX)){for(let d=a-1;d>=0;d--){const u=n[d];if(u.controlId&&u.controlId!==l.controlId&&(u.controlComponent===s.ControlComponent.PRETEXTFIX||u.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT||u.controlComponent===s.ControlComponent.PREFIX||u.controlComponent===s.ControlComponent.PRE_TEXT))return!0;if(u.controlId&&u.controlId!==l.controlId&&(u.controlComponent===s.ControlComponent.POSTFIX||u.controlComponent===s.ControlComponent.POSTTEXTFIX))break}break}}}if(l?.originControlId){const r=l.originControlId;for(let a=e+1;a<n.length;a++){const c=n[a];if(c.controlId===r)return!0;if(c.controlId&&c.controlId!==r&&c.originControlId!==r)break}}if(!i?.controlId&&this.activeControl){const a=this.activeControl.getElement()?.controlId;if(a)for(let c=t;c>=0;c--){const d=n[c];if(d.controlId===a&&!d.originControlId){if(d.controlComponent===s.ControlComponent.PRETEXTFIX||d.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT||d.controlComponent===s.ControlComponent.PREFIX||d.controlComponent===s.ControlComponent.PRE_TEXT)for(let u=e;u<n.length;u++){const R=n[u];if(R.controlId===a&&!R.originControlId){if(R.controlComponent===s.ControlComponent.POSTTEXTFIX||R.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT||R.controlComponent===s.ControlComponent.POSTFIX||R.controlComponent===s.ControlComponent.POST_TEXT)return!0;break}}break}}}return!1}getIsElementListContainFullControl(t){if(!t.some(i=>i.controlId))return!1;let e=0,n=0;for(let i=0;i<t.length;i++){const l=t[i];l.controlComponent===s.ControlComponent.PREFIX||l.controlComponent===s.ControlComponent.PRETEXTFIX?e++:(l.controlComponent===s.ControlComponent.POSTFIX||l.controlComponent===s.ControlComponent.POSTTEXTFIX)&&n++}return!e||!n?!1:e===n}getIsDisabledControl(t={}){if(this.draw.isDesignMode()||!this.activeControl)return!1;const{startIndex:e,endIndex:n}=t.range||this.range.getRange();if(e===n&&~e&&~n){const l=(t.elementList||this.getElementList())[e];if(l.controlComponent===s.ControlComponent.POSTFIX||l.controlComponent===s.ControlComponent.POSTTEXTFIX)return!1}return!!this.activeControl.getElement()?.control?.disabled}getIsDisabledPasteControl(t={}){if(this.draw.isDesignMode()||!this.activeControl)return!1;const{startIndex:e,endIndex:n}=t.range||this.range.getRange();return e===n&&~e&&~n&&(t.elementList||this.getElementList())[e].controlComponent===s.ControlComponent.POSTFIX?!1:!!this.activeControl.getElement()?.control?.pasteDisabled}getIsExistValueByElementListIndex(t,e){const n=t[e];if(!n.controlId)return!1;if(n.control?.type===s.ControlType.CHECKBOX||n.control?.type===s.ControlType.RADIO)return!!n.control?.code;if(n.controlComponent===s.ControlComponent.VALUE)return!0;if(n.controlComponent===s.ControlComponent.PLACEHOLDER)return!1;if(n.controlComponent===s.ControlComponent.PREFIX||n.controlComponent===s.ControlComponent.PRE_TEXT){let i=e+1;for(;i<t.length;){const l=t[i];if(l.controlId!==n.controlId)return!1;if(l.controlComponent===s.ControlComponent.VALUE)return!0;if(l.controlComponent===s.ControlComponent.PLACEHOLDER)return!1;i++}}if(n.controlComponent===s.ControlComponent.PRETEXTFIX||n.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT){let i=e+1;for(;i<t.length;){const l=t[i];if(l.controlId!==n.controlId)return!1;if(l.controlComponent===s.ControlComponent.VALUE)return!0;if(l.controlComponent===s.ControlComponent.PLACEHOLDER||l.controlComponent===s.ControlComponent.TEXTFIXLABEL)return!1;i++}}if(n.controlComponent===s.ControlComponent.POSTFIX||n.controlComponent===s.ControlComponent.POSTTEXTFIX){let i=e-1;for(;i>=0;){const l=t[i];if(l.controlId!==n.controlId)return!1;if(l.controlComponent===s.ControlComponent.VALUE)return!0;if(l.controlComponent===s.ControlComponent.PLACEHOLDER)return!1;i--}}return!1}getControlHighlight(t,e){return this.controlSearch.getControlHighlight(t,e)}getIsInlineControlBackground(t,e){return this.controlSearch.getIsInlineControlBackground(t,e)}getContainer(){return this.draw.getContainer()}getElementList(){return this.draw.getElementList()}getPosition(){const t=this.draw.getPosition().getPositionList(),{endIndex:e}=this.range.getRange();return t[e]||null}getPreY(){const t=this.draw.getHeight(),e=this.draw.getPageGap();return(this.getPosition()?.pageNo??this.draw.getPageNo())*(t+e)}getRange(){return this.range.getRange()}getValueRange(t={}){const e=t.elementList||this.getElementList(),{startIndex:n}=t.range||this.getRange(),i=e[n];if(!lo(i))return null;let l=n;for(;l>0;){const a=e[l];if(!Gt(a,i)||a.controlComponent===s.ControlComponent.PREFIX||a.controlComponent===s.ControlComponent.PRE_TEXT||a.controlComponent===s.ControlComponent.PRETEXTFIX||a.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT)break;l--}let r=n+1;for(;r<e.length;){const a=e[r];if(!Gt(a,i)||a.controlComponent===s.ControlComponent.POSTFIX||a.controlComponent===s.ControlComponent.POST_TEXT||a.controlComponent===s.ControlComponent.POSTTEXTFIX||a.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT)break;r++}return l===r?null:{startIndex:l,endIndex:r-1}}shrinkBoundary(t={}){this.range.shrinkBoundary(t)}getActiveControl(){return this.activeControl}getActiveTextControlLimit(){if(!this.activeControl)return null;const t=this.activeControl.getElement(),e=t?.controlId,n=t?.originControlId||null,i=t?.subTemplateInstanceId||t?.subTemplateParentId||null;if(!e||t.control?.type!==s.ControlType.TEXT&&t.control?.type!==s.ControlType.NUMBER)return null;const l=this.getElementList(),r=n||null;let a=-1,c=-1,d=-1,u=-1;for(let T=0;T<l.length;T++){const g=l[T];g.controlId!==e||(g.subTemplateInstanceId||g.subTemplateParentId||null)!==i||(n?g.originControlId!==n:g.originControlId)||(a===-1&&(a=T),c=T,(g.controlComponent===s.ControlComponent.PREFIX||g.controlComponent===s.ControlComponent.PRE_TEXT||g.controlComponent===s.ControlComponent.PRETEXTFIX||g.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT)&&(d=T),u===-1&&(g.controlComponent===s.ControlComponent.POSTFIX||g.controlComponent===s.ControlComponent.POST_TEXT||g.controlComponent===s.ControlComponent.POSTTEXTFIX||g.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT)&&(u=T))}if(a===-1)return null;const R=d!==-1?d:a,h=u!==-1?u-1:c;return e?{controlId:e,originControlId:n,subTemplateInstanceId:i,parentControlId:r,startIndex:R,endIndex:h<R?R:h}:null}getActiveNestedTextLimit(){const t=this.getActiveTextControlLimit();return!t?.parentControlId||!this.getElementList().some(n=>n.controlId===t.parentControlId&&!n.originControlId&&n.control?.type===s.ControlType.TEXTFIELD)?null:{controlId:t.controlId,parentControlId:t.parentControlId,startIndex:t.startIndex,endIndex:t.endIndex}}getControlElementList(t={}){const e=t.elementList||this.getElementList(),{startIndex:n}=t.range||this.getRange(),i=e[n];if(!lo(i))return[];const l=[];let r=n;for(;r>0;){const c=e[r];if(!Gt(c,i))break;l.unshift(c),r--}let a=n+1;for(;a<e.length;){const c=e[a];if(!Gt(c,i))break;l.push(c),a++}return l}updateActiveControlValue(){this.activeControl&&(this.activeControlValue=this.getControlElementList())}emitControlChange(t){if(!this.activeControl)return;const e=this.eventBus.isSubscribe("controlChange");if(!this.listener.controlChange&&!e)return;let n;const i=this.activeControlValue,l=this.activeControl.getElement();i?.length?n=i[0].control:(n=hn(lt(l)).control,n.value=[]);const r={state:t,control:n,controlId:l.controlId};this.listener.controlChange?.(r),e&&this.eventBus.emit("controlChange",r)}initControl(){if(this.draw.isContentReadonly())return;const t=this.getElementList(),e=this.getRange(),n=t[e.startIndex],i=t[e.startIndex+1],l=this.draw.getMode()===s.EditorMode.FORM&&(n.controlComponent===s.ControlComponent.POSTFIX||n.controlComponent===s.ControlComponent.POST_TEXT||n.controlComponent===s.ControlComponent.POSTTEXTFIX||n.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT);let r=null;if(l&&n.originControlId&&i?.controlId===n.originControlId&&!Gt(n,i))r=i;else if(l&&n.subTemplateParentId&&i&&i.subTemplateParentId!==n.subTemplateParentId)for(let g=e.startIndex-1;g>=0;g--){const f=t[g];if(f.type===s.ElementType.SUB_TEMPLATE&&f.id===n.subTemplateParentId){f.controlId===i.controlId&&(f.originControlId||null)===(i.originControlId||null)&&(r=i);break}}let a=null;if(r)for(let g=e.startIndex+1;g>=0;g--){const f=t[g];if(Gt(r,f)&&f.control?.type===s.ControlType.TEXT){a=f;break}}if(this.activeControl&&a&&this.destroyControl(),this.activeControl){if(this.activeControl instanceof co||this.activeControl instanceof Lo||this.activeControl instanceof Nn){const g=this.activeControl.getElement();Gt(n,g)?n.controlComponent===s.ControlComponent.POSTFIX?this.activeControl.destroy():this.isPopupAwakeDisabled||this.activeControl.awake():this.destroyControl()}if(this.activeControl){const g=this.activeControl.getElement(),f=n.controlId,m=n.originControlId||null,p=g.controlId,I=g.originControlId||null;if(f&&Gt(n,g)){this.updateActiveControlValue(),this.preElement=n;return}if(n.originControlId&&n.originControlId===p&&m===I){const C=this.activeControl.getElement();if(!((C?.control?.type===s.ControlType.TEXTFIELD||C?.control?.type===s.ControlType.TEXT)&&n.controlId!==p)){this.updateActiveControlValue(),this.preElement=n;return}}if(n.originControlId&&n.controlId&&n.controlId,!n.originControlId&&n.controlId&&n.controlId!==p&&(this.activeControl.getElement()?.originControlId,n.controlId),n.controlId&&n.originControlId&&Gt(n,g)){this.updateActiveControlValue(),this.preElement=n;return}if(!f){const C=this.getElementList(),E=this.getRange(),{startIndex:O}=E;let P=null;for(let S=O;S>=0;S--){const X=C[S];if(X.controlComponent===s.ControlComponent.PRETEXTFIX||X.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT||X.controlComponent===s.ControlComponent.PREFIX||X.controlComponent===s.ControlComponent.PRE_TEXT){P=X.controlId||null;break}if(X.controlId&&X.controlId!==p||X.controlComponent===s.ControlComponent.POSTTEXTFIX||X.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT||X.controlComponent===s.ControlComponent.POSTFIX||X.controlComponent===s.ControlComponent.POST_TEXT)break}if(P===p){this.updateActiveControlValue(),this.preElement=n;return}}}}if(this.destroyControl(),this.draw.isReadonly())return;let d=a?.control||n.control,u=a||n;if(!a&&n.originControlId&&!d){let g;for(let I=this.range.getRange().startIndex;I>=0;I--){const C=t[I];if(Gt(C,n)&&C.control&&(g=C.control,u=C,C.controlComponent===s.ControlComponent.PREFIX||C.controlComponent===s.ControlComponent.PRETEXTFIX||C.controlComponent===s.ControlComponent.PRE_TEXT||C.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT)||C.controlId&&!Gt(C,n)&&C.controlId!==n.originControlId&&C.originControlId!==n.originControlId)break}const f=n.originControlId;let m,p;for(let I=this.range.getRange().startIndex;I>=0;I--){const C=t[I];if(C.controlId===f&&C.control){m=C.control,p=C;break}if(C.controlId===f&&(C.controlComponent===s.ControlComponent.PRETEXTFIX||C.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT||C.controlComponent===s.ControlComponent.PREFIX||C.controlComponent===s.ControlComponent.PRE_TEXT)){C.control&&(m=C.control,p=C);break}}this.draw.getMode()===s.EditorMode.FORM&&m?.type===s.ControlType.TEXTFIELD&&g&&g.type!==s.ControlType.TEXTFIELD||this.draw.getMode()===s.EditorMode.FORM&&m?.type===s.ControlType.TEXT&&g?d=g:m?(d=m,p&&(u=p)):g&&(d=g)}else if(!d&&n.controlId){const g=this.getElementList();for(let f=this.range.getRange().startIndex;f>=0;f--){const m=g[f];if(!Gt(m,n))break;if(m.control){d=m.control,u=m;break}if(m.controlComponent===s.ControlComponent.PRETEXTFIX||m.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT||m.controlComponent===s.ControlComponent.PREFIX||m.controlComponent===s.ControlComponent.PRE_TEXT)break}}if(!d)return;if(d?.type===s.ControlType.TEXTFIELD&&this.draw.getMode()!==s.EditorMode.EDIT&&this.draw.getMode()!==s.EditorMode.FORM)if(n.originControlId){const g=n.controlId;for(let f=this.range.getRange().startIndex;f>=0;f--){const m=t[f];if(m.controlId===g&&Gt(m,n)&&m.control&&m.control.type!==s.ControlType.TEXTFIELD){d=m.control,u=m;break}if(m.controlComponent===s.ControlComponent.PREFIX||m.controlComponent===s.ControlComponent.PRETEXTFIX)break}if(d?.type===s.ControlType.TEXTFIELD)return}else return;const R=this.draw.getPosition().getPositionContext(),h=this.range.getRange().startIndex,T=!!(R.isDirectHit&&R.index===h&&t[R.index]?.controlId===u.controlId);if(d?.type===s.ControlType.TEXTFIELD)this.activeControl=new bl(u,this);else if(d.type===s.ControlType.TEXT)this.activeControl=new Vs(u,this);else if(d.type===s.ControlType.SELECT){const g=new co(u,this);this.activeControl=g,!this.isPopupAwakeDisabled&&(T||this.draw.getMode()===s.EditorMode.FORM)&&g.awake()}else if(d.type===s.ControlType.CHECKBOX)this.activeControl=new vo(u,this);else if(d.type===s.ControlType.RADIO)this.activeControl=new Ai(u,this);else if(d.type===s.ControlType.DATE){const g=new Lo(u,this);this.activeControl=g,!this.isPopupAwakeDisabled&&(T||this.draw.getMode()===s.EditorMode.FORM)&&g.awake()}else if(d.type===s.ControlType.NUMBER)this.activeControl=new ui(u,this);else if(d.type===s.ControlType.BUTTON){const g=new Nn(u,this);if(this.activeControl=g,!this.isPopupAwakeDisabled&&T&&(g.awake(),this.draw.getMode()!==s.EditorMode.FORM||u.control?.editable===!1))return}else if(d.type===s.ControlType.MENSTRUAL_HISTORY){const g=new Vl(u,this);this.activeControl=g,this.isPopupAwakeDisabled||g.awake()}this.updateActiveControlValue(),this.preElement=u,u.controlComponent!==s.ControlComponent.POSTFIX&&u.controlComponent!==s.ControlComponent.POSTTEXTFIX&&this.emitControlChange(s.ControlState.ACTIVE)}destroyControl(t={}){if(!this.activeControl)return;const{isEmitEvent:e=!0}=t;(this.activeControl instanceof co||this.activeControl instanceof Lo||this.activeControl instanceof ui||this.activeControl instanceof Vl)&&this.activeControl.destroy(),e&&this.preElement?.controlComponent!==s.ControlComponent.POSTFIX&&this.preElement?.controlComponent!==s.ControlComponent.POSTTEXTFIX&&this.emitControlChange(s.ControlState.INACTIVE),this.preElement=null,this.activeControl=null,this.activeControlValue=[]}repaintControl(t={}){const{curIndex:e,isCompute:n=!0,isSubmitHistory:i=!0,isSetCursor:l=!0}=t;e===void 0?(this.range.clearRange(),this.draw.requestRender({isCompute:n,isSubmitHistory:i,isSetCursor:!1})):(this.range.setRange(e,e),this.draw.requestRender({curIndex:e,layoutStartIndex:e,isCompute:n,isSetCursor:l,isSubmitHistory:i}))}emitControlContentChange(t){const e=this.eventBus.isSubscribe("controlContentChange");if(!e&&!this.listener.controlContentChange)return;const n=t?.controlElement||this.activeControl?.getElement();if(!n)return;const i=t?.context?.elementList||this.getElementList(),{startIndex:l}=t?.context?.range||this.getRange();if(!i[l]?.controlId)return;const r=t?.controlValue||this.getControlElementList(t?.context);let a;if(r?.length?a=Yt(r)[0].control:(a=n.control,a.value=[]),!a)return;const c={control:a,controlId:n.controlId};this.listener.controlContentChange?.(c),e&&this.eventBus.emit("controlContentChange",c)}reAwakeControl(){if(!this.activeControl)return;const t=this.getElementList(),e=this.getRange(),n=t[e.startIndex];this.activeControl.setElement(n),(this.activeControl instanceof Lo||this.activeControl instanceof co)&&this.activeControl.getIsPopup()&&(this.activeControl.destroy(),this.activeControl.awake())}selectValue(){const t=this.getElementList(),{startIndex:e}=this.getRange(),n=t[e];if(!n?.controlId||n.controlComponent!==s.ControlComponent.VALUE&&t[e+1]?.controlComponent===s.ControlComponent.VALUE)return!1;let i=e;for(;i>0&&t[i].controlComponent===s.ControlComponent.VALUE;)i--;let l=e+1;for(;l<t.length;){if(t[l].controlComponent!==s.ControlComponent.VALUE){l--;break}l++}if(i!==l){const r=this.range.getRange();return this.range.replaceRange({...r,startIndex:i,endIndex:l}),this.draw.render({isCompute:!1,isSetCursor:!1,isSubmitHistory:!1}),!0}return!1}moveCursor(t){const{index:e,trIndex:n,tdIndex:i,tdValueIndex:l}=t;let r=this.draw.getOriginalElementList(),a;const c=t.isTable?l:e;if(t.isTable?(r=r[e].trList[n].tdList[i].value,a=r[l]):a=r[e],a.control?.hide||a.area?.hide){const d=Bn(r,c);return{newIndex:d,newElement:r[d]}}if(a.controlComponent===s.ControlComponent.VALUE)return{newIndex:c,newElement:a};if(a.controlComponent===s.ControlComponent.POSTFIX){let d=c+1;for(;d<r.length;){const u=r[d];if(!Gt(u,a))return{newIndex:d-1,newElement:r[d-1]};if(d===r.length-1)return{newIndex:d,newElement:r[d]};d++}}else if(a.controlComponent===s.ControlComponent.PREFIX||a.controlComponent===s.ControlComponent.PRE_TEXT){let d=c+1;for(;d<r.length;){const u=r[d];if(!Gt(u,a)||u.controlComponent!==s.ControlComponent.PREFIX&&u.controlComponent!==s.ControlComponent.PRE_TEXT)return{newIndex:d-1,newElement:r[d-1]};d++}}else if(a.controlComponent===s.ControlComponent.PLACEHOLDER){let d=c-1;for(;d>0;){const u=r[d];if(!Gt(u,a)||u.controlComponent===s.ControlComponent.VALUE||u.controlComponent===s.ControlComponent.PREFIX||u.controlComponent===s.ControlComponent.PRE_TEXT||u.controlComponent===s.ControlComponent.PRETEXTFIX||u.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT)return{newIndex:d,newElement:r[d]};d--}}else if(a.controlComponent===s.ControlComponent.POST_TEXT||a.controlComponent===s.ControlComponent.TEXTFIXLABEL||a.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT){let d=c-1;for(;d>0;){const u=r[d];if(!Gt(u,a)||u.controlComponent===s.ControlComponent.VALUE||u.controlComponent===s.ControlComponent.PREFIX||u.controlComponent===s.ControlComponent.PRE_TEXT||u.controlComponent===s.ControlComponent.PRETEXTFIX||u.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT)return{newIndex:d,newElement:r[d]};d--}}else if(a.controlComponent===s.ControlComponent.POSTTEXTFIX){let d=c+1;for(;d<r.length;){const u=r[d];if(!Gt(u,a))return{newIndex:d-1,newElement:r[d-1]};if(d===r.length-1)return{newIndex:d,newElement:r[d]};d++}}else if(a.controlComponent===s.ControlComponent.PRETEXTFIX||a.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT){let d=c+1;for(;d<r.length;){const u=r[d];if(!Gt(u,a)||u.controlComponent!==s.ControlComponent.PRETEXTFIX&&u.controlComponent!==s.ControlComponent.PRETEXTFIX_TEXT)return{newIndex:d-1,newElement:r[d-1]};d++}}return{newIndex:c,newElement:a}}removeControl(t,e={}){const n=e.elementList||this.getElementList(),i=n[t];if(!this.draw.isDesignMode()&&!i?.control?.hide&&!i?.area?.hide){const{deletable:C=!0}=i.control;if(!C)return null;const E=this.draw.getMode();if(E===s.EditorMode.FORM&&this.options.modeRule[E].controlDeletableDisabled)return null}let l=-1,r=-1;const a=!!i.originControlId,c=i.controlId,d=i.originControlId,u=i.control?.type===s.ControlType.BUTTON&&!i.control?.buttonText?`${c}_text`:"";let R=t;for(;R>=0;){const C=n[R];let E=!1;if(a?E=C.controlId===c&&C.originControlId===d:E=C.controlId===c&&!C.originControlId,!E){l=R;break}R--}let h=t;for(;h<n.length;){const C=n[h];let E=!1;if(a?E=C.controlId===c&&C.originControlId===d:E=C.controlId===c&&!C.originControlId,!E){r=h-1;break}h++}if(h===n.length&&(r=h-1),!~l&&!~r)return t;l=~l?l:0;const T=n[l+1],g=T.control,f=g?.type&&[s.ControlType.TEXT,s.ControlType.TEXTFIELD,s.ControlType.DATE,s.ControlType.NUMBER,s.ControlType.SELECT,s.ControlType.BUTTON].includes(g.type);let m=n[0]?.type===s.ElementType.SPLIT_TAG;if(!e.removeNext&&f&&!a&&T.controlComponent!==s.ControlComponent.PREFIX&&T.type!==s.ElementType.SPLIT_TAG)if(e.removePrev)e.removePrev();else{const C=this.draw.getTd();C&&this.createRemoveControlHandler(C,i.controlId,!0)}if(!e.removeNext&&f&&!a&&T.controlComponent!==s.ControlComponent.PRETEXTFIX&&T.type!==s.ElementType.SPLIT_TAG)if(e.removePrev)e.removePrev();else{const C=this.draw.getTd();C&&this.createRemoveControlHandler(C,i.controlId,!0)}if(!e.removePrev&&f&&!a&&n[r].controlComponent!==s.ControlComponent.POSTFIX)if(e.removeNext)e.removeNext();else{const C=this.draw.getTd();m=!!C?.linkTdNextId,C&&this.createRemoveControlHandler(C,i.controlId,!1)}if(!e.removePrev&&f&&!a&&n[r].controlComponent!==s.ControlComponent.POSTTEXTFIX)if(e.removeNext)e.removeNext();else{const C=this.draw.getTd();m=!!C?.linkTdNextId,C&&this.createRemoveControlHandler(C,i.controlId,!1)}this.draw.spliceElementList(n,l+1,r-l);let p=0;if(u)for(let C=n.length-1;C>=0;C--)n[C].controlId===u&&(C<=l&&p++,n.splice(C,1));const I=l-p;return!e.elementList&&m&&l===0?this.draw.fixPosition(!0)??I:I}createRemoveControlHandler(t,e,n){if(n){const i=this.draw.getTdById(t.linkTdPrevId);i&&i.value.splice(-1)[0]?.controlId===e&&this.removeControl(i.value.length-1,{elementList:i.value,removePrev:()=>{this.createRemoveControlHandler(i,e,n)}})}else{const i=this.draw.getTdById(t.linkTdNextId);i&&i.value[1]?.controlId===e&&this.removeControl(1,{elementList:i.value,removeNext:()=>{this.createRemoveControlHandler(i,e,n)}})}}removePlaceholder(t,e={}){const n=e.elementList||this.getElementList(),i=n[t],l=n[t+1];if(i.controlComponent===s.ControlComponent.PLACEHOLDER||i.controlComponent===s.ControlComponent.TEXTFIXLABEL||l?.controlComponent===s.ControlComponent.PLACEHOLDER||l?.controlComponent===s.ControlComponent.TEXTFIXLABEL){let r=!1,a=t;for(;a<n.length;){const c=n[a];if(c.controlId!==i.controlId)break;c.controlComponent===s.ControlComponent.PLACEHOLDER||c.controlComponent===s.ControlComponent.TEXTFIXLABEL?(r||(r=!0,this.draw.getHistoryManager().popUndo(),this.draw.submitHistory(t)),n.splice(a,1)):a++}}}addPlaceholder(t,e={}){const n=e.elementList||this.getElementList(),i=n[t],l=i.control,r=l.placeholder;if(!r)return;l.placeholder=r;let a=t;for(;a>=0;){const f=n[a];if(f.controlId!==i.controlId){a++;break}if(f.controlComponent===s.ControlComponent.PREFIX||f.controlComponent===s.ControlComponent.PRE_TEXT||f.controlComponent===s.ControlComponent.PRETEXTFIX||f.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT)break;a--}a<0&&(a=0);const c=a+1;if(c<n.length){const f=n[c];if(f.controlId===i.controlId&&(f.controlComponent===s.ControlComponent.PLACEHOLDER||f.controlComponent===s.ControlComponent.VALUE&&!me(f)))return}let d=!1,u=a+1;for(;u<n.length;){const f=n[u];if(f.controlId===i.controlId){if(f.controlComponent===s.ControlComponent.POSTFIX||f.controlComponent===s.ControlComponent.POST_TEXT||f.controlComponent===s.ControlComponent.POSTTEXTFIX||f.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT)break}else if(f.controlId!==i.controlId&&(f.controlComponent===s.ControlComponent.VALUE||f.controlComponent===s.ControlComponent.PREFIX||f.controlComponent===s.ControlComponent.PRE_TEXT)){d=!0;break}u++}if(d)return;const R=bt(r),h=Jt(i,he),T=Jt(i,["originControlId","subTemplateParentId","subTemplateInstanceId"]),g=a+1;for(let f=0;f<R.length;f++){const m=R[f],p={...h,...T,value:m===`
|
|
212
|
+
`,document.body.appendChild(this.inputModal);const e=this.inputModal.querySelector(".menstrual-history-modal__mask"),n=this.inputModal.querySelector(".menstrual-history-modal__container"),i=this.inputModal.querySelector(".menstrual-history-modal__close"),l=this.inputModal.querySelector(".btn-cancel"),r=this.inputModal.querySelector(".btn-confirm"),a=this.inputModal.querySelector("#mh-edit-notMenopause"),c=this.inputModal.querySelector("#mh-edit-isMenopauseForm"),d=this.inputModal.querySelectorAll('input[name="mh-edit-isMenopause"]'),u=()=>{this.closeModal()};n.addEventListener("click",R=>{R.stopPropagation()}),e.addEventListener("click",u),i.addEventListener("click",u),l.addEventListener("click",u),d.forEach(R=>{R.addEventListener("change",()=>{const h=R.value==="true";a.style.display=h?"none":"block",c.style.display=h?"block":"none"})}),r.addEventListener("click",R=>{R.preventDefault(),R.stopPropagation();const h=this.inputModal;if(!h)return;const T=h.querySelector('input[name="mh-edit-isMenopause"]:checked')?.value==="true";let g;T?g={isMenopause:!0,periodMin:h.querySelector("#mh-edit-periodMin2")?.value||"_",periodMax:h.querySelector("#mh-edit-periodMax2")?.value||"_",menarcheAge:h.querySelector("#mh-edit-menarcheAge2")?.value||"_",menopauseAge:h.querySelector("#mh-edit-menopauseAge")?.value||"_",cycleMin:h.querySelector("#mh-edit-cycleMin2")?.value||"_",cycleMax:h.querySelector("#mh-edit-cycleMax2")?.value||"_"}:g={isMenopause:!1,periodMin:h.querySelector("#mh-edit-periodMin")?.value||"_",periodMax:h.querySelector("#mh-edit-periodMax")?.value||"_",menarcheAge:h.querySelector("#mh-edit-menarcheAge1")?.value||"_",lastPeriod:h.querySelector("#mh-edit-lastPeriod")?.value||"____-__-__",cycleMin:h.querySelector("#mh-edit-cycleMin")?.value||"_",cycleMax:h.querySelector("#mh-edit-cycleMax")?.value||"_"};const f=this.control.getElementList(),m=this.element.controlId;for(let E=0;E<f.length;E++){const O=f[E];O.controlId===m&&O.control&&(O.control.menstrualData=g)}const p=this.generateDisplayText(g),I=this.textToElements(p);this.closeModal();const C=this.setValue(I);C!==-1&&(this.control.repaintControl({curIndex:C}),this.control.emitControlContentChange({}))})}closeModal(){this.inputModal&&(this.inputModal.remove(),this.inputModal=null),this.isPopup=!1}destroy(){this.closeModal()}}class aT{controlBorder;textFieldUnderline;draw;range;listener;eventBus;controlSearch;controlQuality;options;controlOptions;activeControl;activeControlValue;preElement;isPopupAwakeDisabled;constructor(t){this.controlBorder=new nu(t),this.textFieldUnderline=new cT(t),this.draw=t,this.range=t.getRange(),this.listener=t.getListener(),this.eventBus=t.getEventBus(),this.controlSearch=new jd(this),this.controlQuality=new eu(t),this.options=t.getOptions(),this.controlOptions=this.options.control,this.activeControl=null,this.activeControlValue=[],this.preElement=null,this.isPopupAwakeDisabled=!1}setPopupAwakeDisabled(t){this.isPopupAwakeDisabled=t}setHighlightList(t){this.controlSearch.setHighlightList(t)}computeHighlightList(){this.controlSearch.getHighlightList().length&&this.controlSearch.computeHighlightList()}renderHighlightList(t,e){this.controlSearch.getHighlightMatchResult().length&&this.controlSearch.renderHighlightList(t,e)}setQualityMarks(t){this.controlQuality.setMarks(t)}getQualityMarks(){return this.controlQuality.getMarks()}renderQualityMarks(t,e,n,i,l,r,a){this.controlQuality.render(t,e,n,i,l,r,a)}getDraw(){return this.draw}filterAssistElement(t){const e=this.options.mode===s.EditorMode.PRINT||this.options.mode===s.EditorMode.COMPARE;return t.filter((n,i)=>{if(n.type===s.ElementType.TABLE){const l=n.trList;for(let r=0;r<l.length;r++){const a=l[r];for(let c=0;c<a.tdList.length;c++){const d=a.tdList[c];d.value=this.filterAssistElement(d.value)}}}if(!n.controlId)return!0;if(n.control?.type===s.ControlType.MENSTRUAL_HISTORY&&e&&(n.controlComponent===s.ControlComponent.PREFIX||n.controlComponent===s.ControlComponent.POSTFIX)||n.control?.type===s.ControlType.SELECT&&e&&(n.controlComponent===s.ControlComponent.PREFIX||n.controlComponent===s.ControlComponent.POSTFIX)||n.control?.type===s.ControlType.NUMBER&&e&&(n.controlComponent===s.ControlComponent.PREFIX||n.controlComponent===s.ControlComponent.POSTFIX)||n.control?.type===s.ControlType.TEXT&&e&&n.strikeout&&n.deletePerson)return!1;if(n.control?.minWidth){if(n.controlComponent===s.ControlComponent.PREFIX||n.controlComponent===s.ControlComponent.POSTFIX)return n.value="",!0}else{const l=this.options.mode===s.EditorMode.FORM;if(n.control?.preText&&n.controlComponent===s.ControlComponent.PRE_TEXT){if(l)return!0;let r=!1,a=i+1;for(;a<t.length;){const c=t[a];if(n.controlId!==c.controlId)break;if(c.controlComponent===s.ControlComponent.VALUE){r=!0;break}a++}return r}if(n.control?.postText&&n.controlComponent===s.ControlComponent.POST_TEXT){if(l)return!0;let r=!1,a=i-1;for(;a<t.length;){const c=t[a];if(n.controlId!==c.controlId)break;if(c.controlComponent===s.ControlComponent.VALUE){r=!0;break}a--}return r}}if(n.control?.preTextFix&&n.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT){let l=!1,r=i+1;for(;r<t.length;){const a=t[r];if(n.controlId!==a.controlId)break;if(a.controlComponent===s.ControlComponent.VALUE){l=!0;break}r++}return l}if(n.control?.postTextFix&&n.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT){let l=!1,r=i-1;for(;r<t.length;){const a=t[r];if(n.controlId!==a.controlId)break;if(a.controlComponent===s.ControlComponent.VALUE){l=!0;break}r--}return l}return n.controlComponent!==s.ControlComponent.PREFIX&&n.controlComponent!==s.ControlComponent.POSTFIX&&n.controlComponent!==s.ControlComponent.PLACEHOLDER&&n.controlComponent!==s.ControlComponent.PRETEXTFIX&&n.controlComponent!==s.ControlComponent.POSTTEXTFIX&&n.controlComponent!==s.ControlComponent.TEXTFIXLABEL})}getIsRangeCanCaptureEvent(){if(!this.activeControl)return!1;const{startIndex:t,endIndex:e}=this.getRange();if(!~t&&!~e)return!1;const n=this.getElementList(),i=n[t];if(i.controlComponent===s.ControlComponent.PLACEHOLDER)return!1;if(t===e&&t>0){const r=n[t-1],a=r?.controlComponent===s.ControlComponent.POSTFIX||r?.controlComponent===s.ControlComponent.POSTTEXTFIX,c=r?.controlComponent===s.ControlComponent.PLACEHOLDER,d=!!r?.controlId,u=!!r?.originControlId;let R=!1;if(u){const p=r.originControlId;for(let I=t;I<n.length;I++){const C=n[I];if(C.controlId===p&&!C.originControlId){R=!0;break}if(C.controlId&&C.controlId!==p&&C.originControlId!==p)break}}const T=this.draw.getPosition().getPositionList(),g=T[t],f=T[t-1],m=g&&f&&g.rowIndex===f.rowIndex;if((a||c)&&d&&m&&!R)return!1}if(t===e&&(i.controlComponent===s.ControlComponent.POSTFIX||i.controlComponent===s.ControlComponent.POSTTEXTFIX))return!0;const l=n[e];return!!(i.controlId&&i.controlId===l.controlId&&l.controlComponent!==s.ControlComponent.POSTFIX&&l.controlComponent!==s.ControlComponent.POSTTEXTFIX)}getIsRangeInPostfix(){if(!this.activeControl)return!1;const{startIndex:t,endIndex:e}=this.getRange();if(t!==e)return!1;const i=this.getElementList()[t];return i.controlComponent===s.ControlComponent.POSTFIX||i.controlComponent===s.ControlComponent.POSTTEXTFIX}getIsRangeWithinControl(){const{range:{startIndex:t,endIndex:e},elementList:n}=this.range.getRangeElement();if(!Number.isInteger(t)||!Number.isInteger(e)||t<0||e<0||t>=n.length||e>=n.length)return!1;const i=n[t],l=n[e];if(!i||!l)return!1;if(i?.controlId&&i.controlId===l.controlId&&l.controlComponent!==s.ControlComponent.POSTFIX&&l.controlComponent!==s.ControlComponent.POSTTEXTFIX&&l.controlComponent!==s.ControlComponent.POSTTEXTFIX_TEXT&&l.controlComponent!==s.ControlComponent.POST_TEXT||(l?.control?.type===s.ControlType.TEXT||this.draw.getMode()===s.EditorMode.EDIT&&l?.control?.type===s.ControlType.TEXTFIELD)&&l.controlId&&!l.originControlId&&(l.controlComponent===s.ControlComponent.POSTFIX||l.controlComponent===s.ControlComponent.POSTTEXTFIX||l.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT||l.controlComponent===s.ControlComponent.POST_TEXT)&&n[e-1]?.originControlId===l.controlId)return!0;if(l?.originControlId&&(l.controlComponent===s.ControlComponent.POSTFIX||l.controlComponent===s.ControlComponent.POSTTEXTFIX)){const r=l.originControlId;for(let a=e+1;a<n.length;a++){const c=n[a];if(c.controlId===r)return!0;if(c.controlId&&c.controlId!==r&&c.originControlId!==r)break}}if(!l?.originControlId&&l?.controlId&&(l.controlComponent===s.ControlComponent.POSTFIX||l.controlComponent===s.ControlComponent.POSTTEXTFIX)){const r=n[e+1];if(r?.controlId&&r.controlId!==l.controlId&&(r.controlComponent===s.ControlComponent.PREFIX||r.controlComponent===s.ControlComponent.PRETEXTFIX)&&r.originControlId||r?.controlId&&r.controlId!==l.controlId&&(r.controlComponent===s.ControlComponent.POSTFIX||r.controlComponent===s.ControlComponent.POSTTEXTFIX)&&r.originControlId)return!0;for(let a=e;a>=0;a--){const c=n[a];if(c.controlId===l.controlId&&(c.controlComponent===s.ControlComponent.PREFIX||c.controlComponent===s.ControlComponent.PRETEXTFIX)){for(let d=a-1;d>=0;d--){const u=n[d];if(u.controlId&&u.controlId!==l.controlId&&(u.controlComponent===s.ControlComponent.PRETEXTFIX||u.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT||u.controlComponent===s.ControlComponent.PREFIX||u.controlComponent===s.ControlComponent.PRE_TEXT))return!0;if(u.controlId&&u.controlId!==l.controlId&&(u.controlComponent===s.ControlComponent.POSTFIX||u.controlComponent===s.ControlComponent.POSTTEXTFIX))break}break}}}if(l?.originControlId){const r=l.originControlId;for(let a=e+1;a<n.length;a++){const c=n[a];if(c.controlId===r)return!0;if(c.controlId&&c.controlId!==r&&c.originControlId!==r)break}}if(!i?.controlId&&this.activeControl){const a=this.activeControl.getElement()?.controlId;if(a)for(let c=t;c>=0;c--){const d=n[c];if(d.controlId===a&&!d.originControlId){if(d.controlComponent===s.ControlComponent.PRETEXTFIX||d.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT||d.controlComponent===s.ControlComponent.PREFIX||d.controlComponent===s.ControlComponent.PRE_TEXT)for(let u=e;u<n.length;u++){const R=n[u];if(R.controlId===a&&!R.originControlId){if(R.controlComponent===s.ControlComponent.POSTTEXTFIX||R.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT||R.controlComponent===s.ControlComponent.POSTFIX||R.controlComponent===s.ControlComponent.POST_TEXT)return!0;break}}break}}}return!1}getIsElementListContainFullControl(t){if(!t.some(i=>i.controlId))return!1;let e=0,n=0;for(let i=0;i<t.length;i++){const l=t[i];l.controlComponent===s.ControlComponent.PREFIX||l.controlComponent===s.ControlComponent.PRETEXTFIX?e++:(l.controlComponent===s.ControlComponent.POSTFIX||l.controlComponent===s.ControlComponent.POSTTEXTFIX)&&n++}return!e||!n?!1:e===n}getIsDisabledControl(t={}){if(this.draw.isDesignMode()||!this.activeControl)return!1;const{startIndex:e,endIndex:n}=t.range||this.range.getRange();if(e===n&&~e&&~n){const l=(t.elementList||this.getElementList())[e];if(l.controlComponent===s.ControlComponent.POSTFIX||l.controlComponent===s.ControlComponent.POSTTEXTFIX)return!1}return!!this.activeControl.getElement()?.control?.disabled}getIsDisabledPasteControl(t={}){if(this.draw.isDesignMode()||!this.activeControl)return!1;const{startIndex:e,endIndex:n}=t.range||this.range.getRange();return e===n&&~e&&~n&&(t.elementList||this.getElementList())[e].controlComponent===s.ControlComponent.POSTFIX?!1:!!this.activeControl.getElement()?.control?.pasteDisabled}getIsExistValueByElementListIndex(t,e){const n=t[e];if(!n.controlId)return!1;if(n.control?.type===s.ControlType.CHECKBOX||n.control?.type===s.ControlType.RADIO)return!!n.control?.code;if(n.controlComponent===s.ControlComponent.VALUE)return!0;if(n.controlComponent===s.ControlComponent.PLACEHOLDER)return!1;if(n.controlComponent===s.ControlComponent.PREFIX||n.controlComponent===s.ControlComponent.PRE_TEXT){let i=e+1;for(;i<t.length;){const l=t[i];if(l.controlId!==n.controlId)return!1;if(l.controlComponent===s.ControlComponent.VALUE)return!0;if(l.controlComponent===s.ControlComponent.PLACEHOLDER)return!1;i++}}if(n.controlComponent===s.ControlComponent.PRETEXTFIX||n.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT){let i=e+1;for(;i<t.length;){const l=t[i];if(l.controlId!==n.controlId)return!1;if(l.controlComponent===s.ControlComponent.VALUE)return!0;if(l.controlComponent===s.ControlComponent.PLACEHOLDER||l.controlComponent===s.ControlComponent.TEXTFIXLABEL)return!1;i++}}if(n.controlComponent===s.ControlComponent.POSTFIX||n.controlComponent===s.ControlComponent.POSTTEXTFIX){let i=e-1;for(;i>=0;){const l=t[i];if(l.controlId!==n.controlId)return!1;if(l.controlComponent===s.ControlComponent.VALUE)return!0;if(l.controlComponent===s.ControlComponent.PLACEHOLDER)return!1;i--}}return!1}getControlHighlight(t,e){return this.controlSearch.getControlHighlight(t,e)}getIsInlineControlBackground(t,e){return this.controlSearch.getIsInlineControlBackground(t,e)}getContainer(){return this.draw.getContainer()}getElementList(){return this.draw.getElementList()}getPosition(){const t=this.draw.getPosition().getPositionList(),{endIndex:e}=this.range.getRange();return t[e]||null}getPreY(){const t=this.draw.getHeight(),e=this.draw.getPageGap();return(this.getPosition()?.pageNo??this.draw.getPageNo())*(t+e)}getRange(){return this.range.getRange()}getValueRange(t={}){const e=t.elementList||this.getElementList(),{startIndex:n}=t.range||this.getRange(),i=e[n];if(!lo(i))return null;let l=n;for(;l>0;){const a=e[l];if(!Gt(a,i)||a.controlComponent===s.ControlComponent.PREFIX||a.controlComponent===s.ControlComponent.PRE_TEXT||a.controlComponent===s.ControlComponent.PRETEXTFIX||a.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT)break;l--}let r=n+1;for(;r<e.length;){const a=e[r];if(!Gt(a,i)||a.controlComponent===s.ControlComponent.POSTFIX||a.controlComponent===s.ControlComponent.POST_TEXT||a.controlComponent===s.ControlComponent.POSTTEXTFIX||a.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT)break;r++}return l===r?null:{startIndex:l,endIndex:r-1}}shrinkBoundary(t={}){this.range.shrinkBoundary(t)}getActiveControl(){return this.activeControl}getActiveTextControlLimit(){if(!this.activeControl)return null;const t=this.activeControl.getElement(),e=t?.controlId,n=t?.originControlId||null,i=t?.subTemplateInstanceId||t?.subTemplateParentId||null;if(!e||t.control?.type!==s.ControlType.TEXT&&t.control?.type!==s.ControlType.NUMBER)return null;const l=this.getElementList(),r=n||null;let a=-1,c=-1,d=-1,u=-1;for(let T=0;T<l.length;T++){const g=l[T];g.controlId!==e||(g.subTemplateInstanceId||g.subTemplateParentId||null)!==i||(n?g.originControlId!==n:g.originControlId)||(a===-1&&(a=T),c=T,(g.controlComponent===s.ControlComponent.PREFIX||g.controlComponent===s.ControlComponent.PRE_TEXT||g.controlComponent===s.ControlComponent.PRETEXTFIX||g.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT)&&(d=T),u===-1&&(g.controlComponent===s.ControlComponent.POSTFIX||g.controlComponent===s.ControlComponent.POST_TEXT||g.controlComponent===s.ControlComponent.POSTTEXTFIX||g.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT)&&(u=T))}if(a===-1)return null;const R=d!==-1?d:a,h=u!==-1?u-1:c;return e?{controlId:e,originControlId:n,subTemplateInstanceId:i,parentControlId:r,startIndex:R,endIndex:h<R?R:h}:null}getActiveNestedTextLimit(){const t=this.getActiveTextControlLimit();return!t?.parentControlId||!this.getElementList().some(n=>n.controlId===t.parentControlId&&!n.originControlId&&n.control?.type===s.ControlType.TEXTFIELD)?null:{controlId:t.controlId,parentControlId:t.parentControlId,startIndex:t.startIndex,endIndex:t.endIndex}}getControlElementList(t={}){const e=t.elementList||this.getElementList(),{startIndex:n}=t.range||this.getRange(),i=e[n];if(!lo(i))return[];const l=[];let r=n;for(;r>0;){const c=e[r];if(!Gt(c,i))break;l.unshift(c),r--}let a=n+1;for(;a<e.length;){const c=e[a];if(!Gt(c,i))break;l.push(c),a++}return l}updateActiveControlValue(){this.activeControl&&(this.activeControlValue=this.getControlElementList())}emitControlChange(t){if(!this.activeControl)return;const e=this.eventBus.isSubscribe("controlChange");if(!this.listener.controlChange&&!e)return;let n;const i=this.activeControlValue,l=this.activeControl.getElement();i?.length?n=i[0].control:(n=hn(lt(l)).control,n.value=[]);const r={state:t,control:n,controlId:l.controlId};this.listener.controlChange?.(r),e&&this.eventBus.emit("controlChange",r)}initControl(){if(this.draw.isContentReadonly())return;const t=this.getElementList(),e=this.getRange(),n=t[e.startIndex],i=t[e.startIndex+1],l=this.draw.getMode()===s.EditorMode.FORM&&(n.controlComponent===s.ControlComponent.POSTFIX||n.controlComponent===s.ControlComponent.POST_TEXT||n.controlComponent===s.ControlComponent.POSTTEXTFIX||n.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT);let r=null;if(l&&n.originControlId&&i?.controlId===n.originControlId&&!Gt(n,i))r=i;else if(l&&n.subTemplateParentId&&i&&i.subTemplateParentId!==n.subTemplateParentId)for(let g=e.startIndex-1;g>=0;g--){const f=t[g];if(f.type===s.ElementType.SUB_TEMPLATE&&f.id===n.subTemplateParentId){f.controlId===i.controlId&&(f.originControlId||null)===(i.originControlId||null)&&(r=i);break}}let a=null;if(r)for(let g=e.startIndex+1;g>=0;g--){const f=t[g];if(Gt(r,f)&&f.control?.type===s.ControlType.TEXT){a=f;break}}if(this.activeControl&&a&&this.destroyControl(),this.activeControl){if(this.activeControl instanceof co||this.activeControl instanceof Lo||this.activeControl instanceof Nn){const g=this.activeControl.getElement();Gt(n,g)?n.controlComponent===s.ControlComponent.POSTFIX?this.activeControl.destroy():this.isPopupAwakeDisabled||this.activeControl.awake():this.destroyControl()}if(this.activeControl){const g=this.activeControl.getElement(),f=n.controlId,m=n.originControlId||null,p=g.controlId,I=g.originControlId||null;if(f&&Gt(n,g)){this.updateActiveControlValue(),this.preElement=n;return}if(n.originControlId&&n.originControlId===p&&m===I){const C=this.activeControl.getElement();if(!((C?.control?.type===s.ControlType.TEXTFIELD||C?.control?.type===s.ControlType.TEXT)&&n.controlId!==p)){this.updateActiveControlValue(),this.preElement=n;return}}if(n.originControlId&&n.controlId&&n.controlId,!n.originControlId&&n.controlId&&n.controlId!==p&&(this.activeControl.getElement()?.originControlId,n.controlId),n.controlId&&n.originControlId&&Gt(n,g)){this.updateActiveControlValue(),this.preElement=n;return}if(!f){const C=this.getElementList(),E=this.getRange(),{startIndex:O}=E;let P=null;for(let S=O;S>=0;S--){const X=C[S];if(X.controlComponent===s.ControlComponent.PRETEXTFIX||X.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT||X.controlComponent===s.ControlComponent.PREFIX||X.controlComponent===s.ControlComponent.PRE_TEXT){P=X.controlId||null;break}if(X.controlId&&X.controlId!==p||X.controlComponent===s.ControlComponent.POSTTEXTFIX||X.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT||X.controlComponent===s.ControlComponent.POSTFIX||X.controlComponent===s.ControlComponent.POST_TEXT)break}if(P===p){this.updateActiveControlValue(),this.preElement=n;return}}}}if(this.destroyControl(),this.draw.isReadonly())return;let d=a?.control||n.control,u=a||n;if(!a&&n.originControlId&&!d){let g;for(let I=this.range.getRange().startIndex;I>=0;I--){const C=t[I];if(Gt(C,n)&&C.control&&(g=C.control,u=C,C.controlComponent===s.ControlComponent.PREFIX||C.controlComponent===s.ControlComponent.PRETEXTFIX||C.controlComponent===s.ControlComponent.PRE_TEXT||C.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT)||C.controlId&&!Gt(C,n)&&C.controlId!==n.originControlId&&C.originControlId!==n.originControlId)break}const f=n.originControlId;let m,p;for(let I=this.range.getRange().startIndex;I>=0;I--){const C=t[I];if(C.controlId===f&&C.control){m=C.control,p=C;break}if(C.controlId===f&&(C.controlComponent===s.ControlComponent.PRETEXTFIX||C.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT||C.controlComponent===s.ControlComponent.PREFIX||C.controlComponent===s.ControlComponent.PRE_TEXT)){C.control&&(m=C.control,p=C);break}}this.draw.getMode()===s.EditorMode.FORM&&m?.type===s.ControlType.TEXTFIELD&&g&&g.type!==s.ControlType.TEXTFIELD||this.draw.getMode()===s.EditorMode.FORM&&m?.type===s.ControlType.TEXT&&g?d=g:m?(d=m,p&&(u=p)):g&&(d=g)}else if(!d&&n.controlId){const g=this.getElementList();for(let f=this.range.getRange().startIndex;f>=0;f--){const m=g[f];if(!Gt(m,n))break;if(m.control){d=m.control,u=m;break}if(m.controlComponent===s.ControlComponent.PRETEXTFIX||m.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT||m.controlComponent===s.ControlComponent.PREFIX||m.controlComponent===s.ControlComponent.PRE_TEXT)break}}if(!d)return;if(d?.type===s.ControlType.TEXTFIELD&&this.draw.getMode()!==s.EditorMode.EDIT&&this.draw.getMode()!==s.EditorMode.FORM)if(n.originControlId){const g=n.controlId;for(let f=this.range.getRange().startIndex;f>=0;f--){const m=t[f];if(m.controlId===g&&Gt(m,n)&&m.control&&m.control.type!==s.ControlType.TEXTFIELD){d=m.control,u=m;break}if(m.controlComponent===s.ControlComponent.PREFIX||m.controlComponent===s.ControlComponent.PRETEXTFIX)break}if(d?.type===s.ControlType.TEXTFIELD)return}else return;const R=this.draw.getPosition().getPositionContext(),h=this.range.getRange().startIndex,T=!!(R.isDirectHit&&R.index===h&&t[R.index]?.controlId===u.controlId);if(d?.type===s.ControlType.TEXTFIELD)this.activeControl=new bl(u,this);else if(d.type===s.ControlType.TEXT)this.activeControl=new Vs(u,this);else if(d.type===s.ControlType.SELECT){const g=new co(u,this);this.activeControl=g,!this.isPopupAwakeDisabled&&(T||this.draw.getMode()===s.EditorMode.FORM)&&g.awake()}else if(d.type===s.ControlType.CHECKBOX)this.activeControl=new vo(u,this);else if(d.type===s.ControlType.RADIO)this.activeControl=new Ai(u,this);else if(d.type===s.ControlType.DATE){const g=new Lo(u,this);this.activeControl=g,!this.isPopupAwakeDisabled&&(T||this.draw.getMode()===s.EditorMode.FORM)&&g.awake()}else if(d.type===s.ControlType.NUMBER)this.activeControl=new ui(u,this);else if(d.type===s.ControlType.BUTTON){const g=new Nn(u,this);if(this.activeControl=g,!this.isPopupAwakeDisabled&&T&&(g.awake(),this.draw.getMode()!==s.EditorMode.FORM||u.control?.editable===!1))return}else if(d.type===s.ControlType.MENSTRUAL_HISTORY){const g=new Vl(u,this);this.activeControl=g,this.isPopupAwakeDisabled||g.awake()}this.updateActiveControlValue(),this.preElement=u,u.controlComponent!==s.ControlComponent.POSTFIX&&u.controlComponent!==s.ControlComponent.POSTTEXTFIX&&this.emitControlChange(s.ControlState.ACTIVE)}destroyControl(t={}){if(!this.activeControl)return;const{isEmitEvent:e=!0}=t;(this.activeControl instanceof co||this.activeControl instanceof Lo||this.activeControl instanceof ui||this.activeControl instanceof Vl)&&this.activeControl.destroy(),e&&this.preElement?.controlComponent!==s.ControlComponent.POSTFIX&&this.preElement?.controlComponent!==s.ControlComponent.POSTTEXTFIX&&this.emitControlChange(s.ControlState.INACTIVE),this.preElement=null,this.activeControl=null,this.activeControlValue=[]}repaintControl(t={}){const{curIndex:e,isCompute:n=!0,isSubmitHistory:i=!0,isSetCursor:l=!0}=t;e===void 0?(this.range.clearRange(),this.draw.requestRender({isCompute:n,isSubmitHistory:i,isSetCursor:!1})):(this.range.setRange(e,e),this.draw.requestRender({curIndex:e,layoutStartIndex:e,isCompute:n,isSetCursor:l,isSubmitHistory:i}))}emitControlContentChange(t){const e=this.eventBus.isSubscribe("controlContentChange");if(!e&&!this.listener.controlContentChange)return;const n=t?.controlElement||this.activeControl?.getElement();if(!n)return;const i=t?.context?.elementList||this.getElementList(),{startIndex:l}=t?.context?.range||this.getRange();if(!i[l]?.controlId)return;const r=t?.controlValue||this.getControlElementList(t?.context);let a;if(r?.length?a=Yt(r)[0].control:(a=n.control,a.value=[]),!a)return;const c={control:a,controlId:n.controlId};this.listener.controlContentChange?.(c),e&&this.eventBus.emit("controlContentChange",c)}reAwakeControl(){if(!this.activeControl)return;const t=this.getElementList(),e=this.getRange(),n=t[e.startIndex];this.activeControl.setElement(n),(this.activeControl instanceof Lo||this.activeControl instanceof co)&&this.activeControl.getIsPopup()&&(this.activeControl.destroy(),this.activeControl.awake())}selectValue(){const t=this.getElementList(),{startIndex:e}=this.getRange(),n=t[e];if(!n?.controlId||n.controlComponent!==s.ControlComponent.VALUE&&t[e+1]?.controlComponent===s.ControlComponent.VALUE)return!1;let i=e;for(;i>0&&t[i].controlComponent===s.ControlComponent.VALUE;)i--;let l=e+1;for(;l<t.length;){if(t[l].controlComponent!==s.ControlComponent.VALUE){l--;break}l++}if(i!==l){const r=this.range.getRange();return this.range.replaceRange({...r,startIndex:i,endIndex:l}),this.draw.render({isCompute:!1,isSetCursor:!1,isSubmitHistory:!1}),!0}return!1}moveCursor(t){const{index:e,trIndex:n,tdIndex:i,tdValueIndex:l}=t;let r=this.draw.getOriginalElementList(),a;const c=t.isTable?l:e;if(t.isTable?(r=r[e].trList[n].tdList[i].value,a=r[l]):a=r[e],a.control?.hide||a.area?.hide){const d=Bn(r,c);return{newIndex:d,newElement:r[d]}}if(a.controlComponent===s.ControlComponent.VALUE)return{newIndex:c,newElement:a};if(a.controlComponent===s.ControlComponent.POSTFIX){let d=c+1;for(;d<r.length;){const u=r[d];if(!Gt(u,a))return{newIndex:d-1,newElement:r[d-1]};if(d===r.length-1)return{newIndex:d,newElement:r[d]};d++}}else if(a.controlComponent===s.ControlComponent.PREFIX||a.controlComponent===s.ControlComponent.PRE_TEXT){let d=c+1;for(;d<r.length;){const u=r[d];if(!Gt(u,a)||u.controlComponent!==s.ControlComponent.PREFIX&&u.controlComponent!==s.ControlComponent.PRE_TEXT)return{newIndex:d-1,newElement:r[d-1]};d++}}else if(a.controlComponent===s.ControlComponent.PLACEHOLDER){let d=c-1;for(;d>0;){const u=r[d];if(!Gt(u,a)||u.controlComponent===s.ControlComponent.VALUE||u.controlComponent===s.ControlComponent.PREFIX||u.controlComponent===s.ControlComponent.PRE_TEXT||u.controlComponent===s.ControlComponent.PRETEXTFIX||u.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT)return{newIndex:d,newElement:r[d]};d--}}else if(a.controlComponent===s.ControlComponent.POST_TEXT||a.controlComponent===s.ControlComponent.TEXTFIXLABEL||a.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT){let d=c-1;for(;d>0;){const u=r[d];if(!Gt(u,a)||u.controlComponent===s.ControlComponent.VALUE||u.controlComponent===s.ControlComponent.PREFIX||u.controlComponent===s.ControlComponent.PRE_TEXT||u.controlComponent===s.ControlComponent.PRETEXTFIX||u.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT)return{newIndex:d,newElement:r[d]};d--}}else if(a.controlComponent===s.ControlComponent.POSTTEXTFIX){let d=c+1;for(;d<r.length;){const u=r[d];if(!Gt(u,a))return{newIndex:d-1,newElement:r[d-1]};if(d===r.length-1)return{newIndex:d,newElement:r[d]};d++}}else if(a.controlComponent===s.ControlComponent.PRETEXTFIX||a.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT){let d=c+1;for(;d<r.length;){const u=r[d];if(!Gt(u,a)||u.controlComponent!==s.ControlComponent.PRETEXTFIX&&u.controlComponent!==s.ControlComponent.PRETEXTFIX_TEXT)return{newIndex:d-1,newElement:r[d-1]};d++}}return{newIndex:c,newElement:a}}removeControl(t,e={}){const n=e.elementList||this.getElementList(),i=n[t];if(!this.draw.isDesignMode()&&!i?.control?.hide&&!i?.area?.hide){const{deletable:C=!0}=i.control;if(!C)return null;const E=this.draw.getMode();if(E===s.EditorMode.FORM&&this.options.modeRule[E].controlDeletableDisabled)return null}let l=-1,r=-1;const a=!!i.originControlId,c=i.controlId,d=i.originControlId,u=i.control?.type===s.ControlType.BUTTON&&!i.control?.buttonText?`${c}_text`:"";let R=t;for(;R>=0;){const C=n[R];let E=!1;if(a?E=C.controlId===c&&C.originControlId===d:E=C.controlId===c&&!C.originControlId,!E){l=R;break}R--}let h=t;for(;h<n.length;){const C=n[h];let E=!1;if(a?E=C.controlId===c&&C.originControlId===d:E=C.controlId===c&&!C.originControlId,!E){r=h-1;break}h++}if(h===n.length&&(r=h-1),!~l&&!~r)return t;l=~l?l:0;const T=n[l+1],g=T.control,f=g?.type&&[s.ControlType.TEXT,s.ControlType.TEXTFIELD,s.ControlType.DATE,s.ControlType.NUMBER,s.ControlType.SELECT,s.ControlType.BUTTON].includes(g.type);let m=n[0]?.type===s.ElementType.SPLIT_TAG;if(!e.removeNext&&f&&!a&&T.controlComponent!==s.ControlComponent.PREFIX&&T.type!==s.ElementType.SPLIT_TAG)if(e.removePrev)e.removePrev();else{const C=this.draw.getTd();C&&this.createRemoveControlHandler(C,i.controlId,!0)}if(!e.removeNext&&f&&!a&&T.controlComponent!==s.ControlComponent.PRETEXTFIX&&T.type!==s.ElementType.SPLIT_TAG)if(e.removePrev)e.removePrev();else{const C=this.draw.getTd();C&&this.createRemoveControlHandler(C,i.controlId,!0)}if(!e.removePrev&&f&&!a&&n[r].controlComponent!==s.ControlComponent.POSTFIX)if(e.removeNext)e.removeNext();else{const C=this.draw.getTd();m=!!C?.linkTdNextId,C&&this.createRemoveControlHandler(C,i.controlId,!1)}if(!e.removePrev&&f&&!a&&n[r].controlComponent!==s.ControlComponent.POSTTEXTFIX)if(e.removeNext)e.removeNext();else{const C=this.draw.getTd();m=!!C?.linkTdNextId,C&&this.createRemoveControlHandler(C,i.controlId,!1)}this.draw.spliceElementList(n,l+1,r-l);let p=0;if(u)for(let C=n.length-1;C>=0;C--)n[C].controlId===u&&(C<=l&&p++,n.splice(C,1));const I=l-p;return!e.elementList&&m&&l===0?this.draw.fixPosition(!0)??I:I}createRemoveControlHandler(t,e,n){if(n){const i=this.draw.getTdById(t.linkTdPrevId);i&&i.value.splice(-1)[0]?.controlId===e&&this.removeControl(i.value.length-1,{elementList:i.value,removePrev:()=>{this.createRemoveControlHandler(i,e,n)}})}else{const i=this.draw.getTdById(t.linkTdNextId);i&&i.value[1]?.controlId===e&&this.removeControl(1,{elementList:i.value,removeNext:()=>{this.createRemoveControlHandler(i,e,n)}})}}removePlaceholder(t,e={}){const n=e.elementList||this.getElementList(),i=n[t],l=n[t+1];if(i.controlComponent===s.ControlComponent.PLACEHOLDER||i.controlComponent===s.ControlComponent.TEXTFIXLABEL||l?.controlComponent===s.ControlComponent.PLACEHOLDER||l?.controlComponent===s.ControlComponent.TEXTFIXLABEL){let r=!1,a=t;for(;a<n.length;){const c=n[a];if(c.controlId!==i.controlId)break;c.controlComponent===s.ControlComponent.PLACEHOLDER||c.controlComponent===s.ControlComponent.TEXTFIXLABEL?(r||(r=!0,this.draw.getHistoryManager().popUndo(),this.draw.submitHistory(t)),n.splice(a,1)):a++}}}addPlaceholder(t,e={}){const n=e.elementList||this.getElementList(),i=n[t],l=i.control,r=l.placeholder;if(!r)return;l.placeholder=r;let a=t;for(;a>=0;){const f=n[a];if(f.controlId!==i.controlId){a++;break}if(f.controlComponent===s.ControlComponent.PREFIX||f.controlComponent===s.ControlComponent.PRE_TEXT||f.controlComponent===s.ControlComponent.PRETEXTFIX||f.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT)break;a--}a<0&&(a=0);const c=a+1;if(c<n.length){const f=n[c];if(f.controlId===i.controlId&&(f.controlComponent===s.ControlComponent.PLACEHOLDER||f.controlComponent===s.ControlComponent.VALUE&&!me(f)))return}let d=!1,u=a+1;for(;u<n.length;){const f=n[u];if(f.controlId===i.controlId){if(f.controlComponent===s.ControlComponent.POSTFIX||f.controlComponent===s.ControlComponent.POST_TEXT||f.controlComponent===s.ControlComponent.POSTTEXTFIX||f.controlComponent===s.ControlComponent.POSTTEXTFIX_TEXT)break}else if(f.controlId!==i.controlId&&(f.controlComponent===s.ControlComponent.VALUE||f.controlComponent===s.ControlComponent.PREFIX||f.controlComponent===s.ControlComponent.PRE_TEXT)){d=!0;break}u++}if(d)return;const R=bt(r),h=Jt(i,he),T=Jt(i,["originControlId","subTemplateParentId","subTemplateInstanceId"]),g=a+1;for(let f=0;f<R.length;f++){const m=R[f],p={...h,...T,value:m===`
|
|
213
213
|
`?B:m,controlId:i.controlId,type:s.ElementType.CONTROL,control:i.control,controlComponent:s.ControlComponent.PLACEHOLDER,color:this.controlOptions.placeholderColor};ae(n,[p],a,{editorOptions:this.options}),this.draw.spliceElementList(n,g+f,0,[p])}}setValue(t){if(!this.activeControl)throw new Error("active control is null");return this.activeControl.setValue(t)}setControlProperties(t,e={}){const n=e.elementList||this.getElementList(),{startIndex:i}=e.range||this.getRange(),l=n[i];let r=i;for(;r>0;){const c=n[r];if(c.controlId!==l.controlId)break;c.control={...c.control,...t},r--}let a=i+1;for(;a<n.length;){const c=n[a];if(c.controlId!==l.controlId)break;c.control={...c.control,...t},a++}}keydown(t){if(!this.activeControl)throw new Error("active control is null");return this.activeControl.keydown(t)}cut(){if(!this.activeControl)throw new Error("active control is null");return this.activeControl.cut()}getValueById(t){const{id:e,groupId:n,conceptId:i,areaId:l}=t,r=[];if(!e&&!i&&!n)return r;const a=new Set,c=(u,R)=>{let h=0;for(;h<u.length;){const T=u[h];if(h++,T.type===s.ElementType.TABLE){const E=T.trList;for(let O=0;O<E.length;O++){const P=E[O];for(let S=0;S<P.tdList.length;S++){const X=P.tdList[S],U=X.originalId??X.id;a.has(U)||(a.add(U),X.linkTdNextId?c(this.draw.getSplitTdValues(U),R):c(X.value,R))}}}if(!T.control||n&&T.control.groupId!==n||e&&T.controlId!==e||i&&T.control.conceptId!==i||l&&T.areaId!==l)continue;const{type:g,code:f,valueSets:m}=T.control;let p=h,I="";const C=[];for(;p<u.length;){const E=u[p];if(E.controlId!==T.controlId)break;(g===s.ControlType.TEXT||g===s.ControlType.TEXTFIELD||g===s.ControlType.DATE||g===s.ControlType.NUMBER)&&E.controlComponent===s.ControlComponent.VALUE&&(I+=E.value,C.push(Ee(E,Di))),p++}if(g===s.ControlType.TEXT||g===s.ControlType.TEXTFIELD||g===s.ControlType.DATE||g===s.ControlType.NUMBER)r.push({...T.control,zone:R,value:I||null,innerText:I||null,elementList:Yt(C)});else if(g===s.ControlType.SELECT||g===s.ControlType.CHECKBOX||g===s.ControlType.RADIO){const E=f?.split(",").map(O=>m?.find(P=>P.code===O)?.value).filter(Boolean).join("");r.push({...T.control,zone:R,value:f||null,innerText:E||null})}h=p}},d=[{zone:s.EditorZone.HEADER,elementList:this.draw.getHeaderElementList()},{zone:s.EditorZone.MAIN,elementList:this.draw.getOriginalMainElementList()},{zone:s.EditorZone.FOOTER,elementList:this.draw.getFooterElementList()}];for(const{zone:u,elementList:R}of d)c(R,u);return r}setValueListById(t){if(!t.length)return;let e=!1,n=!1;const i=(r,a)=>{let c=0;for(;c<r.length;){const d=r[c];if(c++,d.type===s.ElementType.TABLE){const C=d.trList;for(let E=0;E<C.length;E++){const O=C[E];for(let P=0;P<O.tdList.length;P++){const S=O.tdList[P];i(S.value,S.id)}}}if(!d.control||d.type===s.ElementType.SPLIT_TAG)continue;const u=t.find(C=>(!C.groupId||C.groupId===d.control?.groupId)&&(C.id&&d.controlId===C.id||C.conceptId&&d.control.conceptId===C.conceptId||C.areaId&&d.areaId===C.areaId));if(!u)continue;const{value:R,isSubmitHistory:h=!0}=u;e=!0,h&&(n=!0);const{type:T}=d.control,{range:g,fullRange:f}=this.mergeControl({elementList:r,range:{startIndex:c,endIndex:c},tdId:a}),m={range:f??g,elementList:r,tdId:a},p={isIgnoreDisabledRule:!0,isIgnoreDeletedRule:!0};if(T===s.ControlType.TEXTFIELD){const C=Array.isArray(R)?R:R?[{value:R}]:[];C.length&&ee(C,{isHandleFirstElement:!1,editorOptions:this.options});const E=new bl(d,this);this.activeControl=E,C.length?E.setValue(C,m,p):E.clearValue(m,p)}else if(T===s.ControlType.TEXT){const C=Array.isArray(R)?R:R?[{value:R}]:[];C.length&&ee(C,{isHandleFirstElement:!1,editorOptions:this.options});const E=new Vs(d,this);this.activeControl=E,C.length?E.setValue(C,m,p):E.clearValue(m,p)}else if(T===s.ControlType.SELECT){if(Array.isArray(R))continue;const C=new co(d,this);this.activeControl=C,R?C.setSelect(R,m,p):C.clearSelect(m,p)}else if(T===s.ControlType.CHECKBOX){if(Array.isArray(R))continue;const C=new vo(d,this);this.activeControl=C;const E=R?R.split(","):[];C.setSelect(E,m,p)}else if(T===s.ControlType.RADIO){if(Array.isArray(R))continue;const C=new Ai(d,this);this.activeControl=C;const E=R?[R]:[];C.setSelect(E,m,p)}else if(T===s.ControlType.DATE){const C=new Lo(d,this);this.activeControl=C,Ei(R)?(R.length&&ee(R,{isHandleFirstElement:!1,editorOptions:this.options}),C.setValue(R,m,p)):Ea(R)?C.setSelect(R,m,p):C.clearSelect(m,p)}else if(T===s.ControlType.NUMBER){const C=Array.isArray(R)?R:R?[{value:R}]:[];C.length&&ee(C,{isHandleFirstElement:!1,editorOptions:this.options});const E=new ui(d,this);this.activeControl=E,C.length?E.setValue(C,m,p):E.clearValue(m,p)}else if(T===s.ControlType.BUTTON){const C=Array.isArray(R)?R:R?[{value:R}]:[];C.length&&ee(C,{isHandleFirstElement:!1,editorOptions:this.options});const E=new Nn(d,this);this.activeControl=E,C.length?E.setValue(C,m,p):E.clearSelect(m,p)}this.emitControlContentChange({context:m}),this.activeControl=null;let I=c;for(;I<r.length&&r[I].controlId===d.controlId;)I++;c=I}};this.destroyControl({isEmitEvent:!1});const l=[this.draw.getHeaderElementList(),this.draw.getOriginalMainElementList(),this.draw.getFooterElementList()];for(const r of l)i(r);e&&(n||this.draw.getHistoryManager().recovery(),this.draw.render({isSubmitHistory:n,isSetCursor:!1}))}setExtensionListById(t){if(!t.length)return;const e=i=>{let l=0;for(;l<i.length;){const r=i[l];if(l++,r.type===s.ElementType.TABLE){const u=r.trList;for(let R=0;R<u.length;R++){const h=u[R];for(let T=0;T<h.tdList.length;T++){const g=h.tdList[T];e(g.value)}}}if(!r.control)continue;const a=t.find(u=>u.id&&r.controlId===u.id||u.conceptId&&r.control.conceptId===u.conceptId||u.areaId&&r.areaId===u.areaId);if(!a)continue;const{extension:c}=a;this.setControlProperties({extension:c},{elementList:i,range:{startIndex:l,endIndex:l}});let d=l;for(;d<i.length&&i[d].controlId===r.controlId;)d++;l=d}},n=[this.draw.getHeaderElementList(),this.draw.getOriginalMainElementList(),this.draw.getFooterElementList()];for(const i of n)e(i)}setPropertiesListById(t){if(!t.length)return;let e=!1,n=!1;const i=r=>{let a=0;for(;a<r.length;){const c=r[a];if(a++,c.type===s.ElementType.TABLE){const T=c.trList;for(let g=0;g<T.length;g++){const f=T[g];for(let m=0;m<f.tdList.length;m++){const p=f.tdList[m];i(p.value)}}}if(!c.control)continue;const d=t.find(T=>T.id&&c.controlId===T.id||T.conceptId&&c.control.conceptId===T.conceptId||T.areaId&&c.areaId===T.areaId);if(!d)continue;const{properties:u,isSubmitHistory:R=!0}=d;if(e=!0,R&&(n=!0),this.setControlProperties({...c.control,...u,value:c.control.value},{elementList:r,range:{startIndex:a-1,endIndex:a-1}}),he.forEach(T=>{const g=u[T];g&&Reflect.set(c,T,g)}),c.control?.type===s.ControlType.NUMBER&&u.numberExclusiveOptions){const T={...c.control.numberExclusiveOptions,...u.numberExclusiveOptions},g=T?.minValue,f=T?.maxValue,m=new ui(c,this),p=m.getValue({elementList:r,range:{startIndex:a-1,endIndex:a-1}});if(p.length>0){const I=p.map(E=>E.value).join(""),C=Number(I);!Number.isNaN(C)&&Number.isFinite(C)&&(g!=null&&C<g||f!=null&&C>f)&&m.clearValue({elementList:r,range:{startIndex:a-1,endIndex:a-1}},{isAddPlaceholder:!0})}}let h=a;for(;h<r.length&&r[h].controlId===c.controlId;)h++;a=h}},l={header:this.draw.getHeaderElementList(),main:this.draw.getOriginalMainElementList(),footer:this.draw.getFooterElementList()};for(const r in l){const a=l[r];i(a)}if(e){for(const r in l){const a=r,c=Yt(l[a],{isClassifyArea:!0,extraPickAttrs:["id","controlId"]});l[a]=c,ee(c,{editorOptions:this.options,isForceCompensation:!0})}this.draw.setEditorData(l),n||this.draw.getHistoryManager().recovery(),this.draw.render({isSubmitHistory:n,isSetCursor:!1})}}getList(){const t=[];function e(i){for(let l=0;l<i.length;l++){const r=i[l];if(r.type===s.ElementType.TABLE){const a=r.trList;for(let c=0;c<a.length;c++){const d=a[c];for(let u=0;u<d.tdList.length;u++){const h=d.tdList[u].value;e(h)}}}if(r.controlId){const a=Ee(r,[...Si,...Un]);t.push(a)}}}const n=[this.draw.getHeader().getElementList(),this.draw.getOriginalMainElementList(),this.draw.getFooter().getElementList()];for(const i of n)e(i);return Yt(t,{extraPickAttrs:["controlId"]})}recordBorderInfo(t,e,n,i){this.controlBorder.recordBorderInfo(t,e,n,i)}drawBorder(t){this.controlBorder.render(t)}startTextFieldUnderline(t,e,n){this.textFieldUnderline.startTextFieldValue(t,e,n)}recordTextFieldUnderlineWidth(t){this.textFieldUnderline.recordValueWidth(t)}drawTextFieldUnderline(t){this.textFieldUnderline.endTextFieldValue(t)}_getControlIdentity(t){return lo(t)}_isSameControlIdentity(t,e){return!!(e&&t.controlId===e.controlId&&(t.originControlId||null)===e.originControlId&&(t.subTemplateInstanceId||t.subTemplateParentId||null)===e.subTemplateInstanceId)}_isNestedParentControlElement(t,e){return!!(e?.originControlId&&t.controlId===e.originControlId&&!t.originControlId)}_isNestedTextContainerElement(t,e){if(!e.controlId||e.originControlId)return!1;let n=!1,i=!1;for(let l=0;l<t.length;l++){const r=t[l];if(r.controlId===e.controlId&&!r.originControlId?(r.control?.type===s.ControlType.TEXT||r.control?.type===s.ControlType.TEXTFIELD)&&(n=!0):r.originControlId===e.controlId&&(i=!0),n&&i)return!0}return!1}_getCurrentControlIdentity(t){const e=this.getElementList()[t],n=this._getControlIdentity(this.activeControl?.getElement()),i=this._getControlIdentity(e);return i&&(!n||this._isSameControlIdentity(e,n)||i.originControlId===n.controlId)?i:n}_getControlNavigationIndex(t,e,n){const i=this._getControlIdentity(t[e]);if(!i)return e;let l=e;for(;l>0&&this._isSameControlIdentity(t[l-1],i);)l--;let r=e;for(;r+1<t.length&&this._isSameControlIdentity(t[r+1],i);)r++;if(n===qt.DOWN){let a=-1;for(let c=l;c<=r;c++){const d=t[c];if(d.controlComponent===s.ControlComponent.CHECKBOX||d.controlComponent===s.ControlComponent.RADIO||d.controlComponent===s.ControlComponent.VALUE)return c;a===-1&&(d.controlComponent===s.ControlComponent.PREFIX||d.controlComponent===s.ControlComponent.PRE_TEXT||d.controlComponent===s.ControlComponent.PRETEXTFIX||d.controlComponent===s.ControlComponent.PRETEXTFIX_TEXT)&&(a=c)}return~a?a:l}for(let a=r;a>=l;a--)if(t[a].controlComponent===s.ControlComponent.VALUE)return a;return l}_isTrailingNestedControlBoundary(t,e,n){const i=t[e];return!n||!i?.originControlId||i.originControlId!==n.controlId||i.controlComponent!==s.ControlComponent.POSTFIX&&i.controlComponent!==s.ControlComponent.POST_TEXT&&i.controlComponent!==s.ControlComponent.POSTTEXTFIX&&i.controlComponent!==s.ControlComponent.POSTTEXTFIX_TEXT?!1:this._isSameControlIdentity(t[e-1],this._getControlIdentity(i))||this._isSameControlIdentity(t[e-1],n)}getPreControlContext(){const e=this.draw.getPosition().getPositionContext();if(!e)return null;const{startIndex:n}=this.range.getRange(),i=this.getElementList(),l=this.activeControl?.getElement()||i[n],r=this._getCurrentControlIdentity(n),a=(d,u)=>{for(let R=u;R>0;R--){const h=d[R];if(h.type===s.ElementType.TABLE){const T=h.trList||[];for(let g=T.length-1;g>=0;g--){const f=T[g],m=f.tdList;for(let p=m.length-1;p>=0;p--){const I=m[p],C=a(I.value,I.value.length-1);if(C)return{positionContext:{isTable:!0,index:R,trIndex:g,tdIndex:p,tdId:I.id,trId:f.id,tableId:h.id},nextIndex:C.nextIndex}}}}if(!(!h.controlId||this._isSameControlIdentity(h,r)||this._isTrailingNestedControlBoundary(d,R,r)||this._isNestedParentControlElement(h,r)||this._isNestedTextContainerElement(d,h)))return{positionContext:{isTable:!1},nextIndex:this._getControlNavigationIndex(d,R,qt.UP)}}return null},c=a(i,n);if(c)return{positionContext:e.isTable?e:c.positionContext,nextIndex:c.nextIndex};if(l.tableId){const d=this.draw.getOriginalElementList(),{index:u,trIndex:R,tdIndex:h}=e,T=d[u].trList;for(let f=R;f>=0;f--){const m=T[f],p=m.tdList;for(let I=p.length-1;I>=0;I--){if(R===f&&I>=h)continue;const C=p[I],E=a(C.value,C.value.length-1);if(E)return{positionContext:{isTable:!0,index:e.index,trIndex:f,tdIndex:I,tdId:C.id,trId:m.id,tableId:l.tableId},nextIndex:E.nextIndex}}}const g=a(d,u-1);if(g)return{positionContext:{isTable:!1},nextIndex:g.nextIndex}}return null}getNextControlContext(){const e=this.draw.getPosition().getPositionContext();if(!e)return null;const{endIndex:n}=this.range.getRange(),i=this.getElementList(),l=this.activeControl?.getElement()||i[n],r=this._getCurrentControlIdentity(n),a=(d,u)=>{for(let R=u;R<d.length;R++){const h=d[R];if(h.type===s.ElementType.TABLE){const T=h.trList||[];for(let g=0;g<T.length;g++){const f=T[g],m=f.tdList;for(let p=0;p<m.length;p++){const I=m[p],C=a(I.value,0);if(C)return{positionContext:{isTable:!0,index:R,trIndex:g,tdIndex:p,tdId:I.id,trId:f.id,tableId:h.id},nextIndex:C.nextIndex}}}}if(!(!h.controlId||this._isSameControlIdentity(h,r)||this._isTrailingNestedControlBoundary(d,R,r)||this._isNestedParentControlElement(h,r)||this._isNestedTextContainerElement(d,h)))return{positionContext:{isTable:!1},nextIndex:this._getControlNavigationIndex(d,R,qt.DOWN)}}return null},c=a(i,n);if(c)return{positionContext:e.isTable?e:c.positionContext,nextIndex:c.nextIndex};if(l.tableId){const d=this.draw.getOriginalElementList(),{index:u,trIndex:R,tdIndex:h}=e,T=d[u].trList;for(let f=R;f<T.length;f++){const m=T[f],p=m.tdList;for(let I=0;I<p.length;I++){if(R===f&&I<=h)continue;const C=p[I],E=a(C.value,0);if(E)return{positionContext:{isTable:!0,index:e.index,trIndex:f,tdIndex:I,tdId:C.id,trId:m.id,tableId:l.tableId},nextIndex:E.nextIndex}}}const g=a(d,u+1);if(g)return{positionContext:{isTable:!1},nextIndex:g.nextIndex}}return null}initNextControl(t={}){const{direction:e=qt.DOWN}=t;let n=null;if(e===qt.UP?n=this.getPreControlContext():n=this.getNextControlContext(),!n)return;const{nextIndex:i,positionContext:l}=n,r=this.draw.getPosition();r.setPositionContext(l),this.draw.getRange().replaceRange({startIndex:i,endIndex:i}),this.draw.render({curIndex:i,isCompute:!1,isSetCursor:!0,isSubmitHistory:!1});const a=r.getPositionList();this.draw.getCursor().moveCursorToVisible({cursorPosition:a[i],direction:e})}setMinWidthControlInfo(t){const{row:e,rowElement:n,controlRealWidth:i,availableWidth:l}=t;if(!n.control?.minWidth)return;const{scale:r}=this.options,a=n.control.minWidth*r;let c=null;if(n.control?.minWidth&&(n.control?.rowFlex===s.RowFlex.CENTER||n.control?.rowFlex===s.RowFlex.RIGHT)){let u=n.metrics.width,R=e.elementList.length-1;for(;R>=0;){const h=e.elementList[R];if(u+=h.metrics.width,e.elementList[R-1]?.controlComponent===s.ControlComponent.PREFIX){c=h;break}R--}c&&u<a&&(n.control.rowFlex===s.RowFlex.CENTER?c.left=(a-u)/2:n.control.rowFlex===s.RowFlex.RIGHT&&(c.left=a-u-n.metrics.width))}const d=a-i;if(d>0){const u=c?.left||0,R=l-e.width-n.metrics.width,h=Math.min(R,d);n.left=h-u,e.width+=h-u}}mergeControl(t={}){const e=t.elementList||this.getElementList(),n=t.range||this.getRange(),{startIndex:i}=n,l=t.tdId??this.draw.getPosition().getPositionContext().tdId,r=l?this.draw.getTdById(l):void 0,a=e[i];if(!a?.controlId)return{range:n,elementList:[],tdId:l};const c={startIndex:i,endIndex:i},d=[];let u=!1,R=i,h=r,T=e;for(;R>=0;){const p=T[R];if(p.controlId!==a.controlId)break;if(p.type!==s.ElementType.SPLIT_TAG&&(d.unshift(p),u&&(T.splice(R,1),e[0].type===s.ElementType.SPLIT_TAG?e.splice(0,1):(n.startIndex++,n.endIndex++),e.unshift(p)),c.startIndex=R),R===0&&p.controlComponent!==s.ControlComponent.PREFIX&&h?.linkTdPrevId&&(h=this.draw.getTdById(h.linkTdPrevId),h)){T=h.value,R=h.value.length-1,u=!0;continue}if(R===0&&p.controlComponent!==s.ControlComponent.PRETEXTFIX&&h?.linkTdPrevId&&(h=this.draw.getTdById(h.linkTdPrevId),h)){T=h.value,R=h.value.length-1,u=!0;continue}R--}u=!1;let g=i+1,f=r,m=e;for(;g<m.length;){const p=m[g];if(p.controlId!==a.controlId)break;if(p.type!==s.ElementType.SPLIT_TAG&&(d.push(p),u&&(m.splice(g,1),e.push(p),g--)),g===m.length-1&&p.controlComponent!==s.ControlComponent.POSTFIX&&f?.linkTdNextId&&(f=this.draw.getTdById(f.linkTdNextId),f)){m=f.value,g=0,u=!0;continue}if(g===m.length-1&&p.controlComponent!==s.ControlComponent.POSTTEXTFIX&&f?.linkTdNextId&&(f=this.draw.getTdById(f.linkTdNextId),f)){m=f.value,g=0,u=!0;continue}g++}return c.endIndex=c.startIndex+d.length,{range:n,elementList:e,tdId:l,fullRange:{startIndex:c.startIndex,endIndex:c.endIndex-2}}}}class cT{options;currentTextFieldId=null;valueStartX=0;valueWidth=0;valueY=0;constructor(t){this.options=t.getOptions()}startTextFieldValue(t,e,n){this.currentTextFieldId=t,this.valueStartX=e,this.valueY=n,this.valueWidth=0}recordValueWidth(t){this.valueWidth+=t}endTextFieldValue(t){if(!this.currentTextFieldId||this.valueWidth<=0){this.reset();return}const{scale:e}=this.options;t.save(),t.strokeStyle=this.options.defaultColor,t.lineWidth=e,t.beginPath();const n=this.valueY-.5*e;t.moveTo(this.valueStartX,n),t.lineTo(this.valueStartX+this.valueWidth,n),t.stroke(),t.restore(),this.reset()}reset(){this.currentTextFieldId=null,this.valueStartX=0,this.valueWidth=0,this.valueY=0}}function Po(o,t){const e=n=>{for(let i=0;i<n.length;i++){const l=n[i];if(t(l),l.valueList?.length&&e(l.valueList),l.control?.value?.length&&e(l.control.value),l.type===s.ElementType.TABLE&&l.trList?.length)for(let r=0;r<l.trList.length;r++){const a=l.trList[r];for(let c=0;c<a.tdList.length;c++)e(a.tdList[c].value)}}};e(o)}function Ws(o,t){const e=t.id||gt(),n=t.subTemplateInstanceId||gt();let i=!1;t.id!==e&&(t.id=e,i=!0),t.subTemplateInstanceId!==n&&(t.subTemplateInstanceId=n,i=!0);const l=r=>{for(let a=0;a<r.length;a++){const c=r[a];if(c.subTemplateParentId&&c.subTemplateParentId!==e)continue;c.subTemplateParentId!==e&&(c.subTemplateParentId=e,i=!0);const d=c.type===s.ElementType.SUB_TEMPLATE?c.subTemplateInstanceId||gt():n;if(c.subTemplateInstanceId!==d&&(c.subTemplateInstanceId=d,i=!0),c.valueList?.length&&l(c.valueList),c.type===s.ElementType.TABLE&&c.trList?.length)for(let u=0;u<c.trList.length;u++){const R=c.trList[u];for(let h=0;h<R.tdList.length;h++)l(R.tdList[h].value)}}};return l(o),i}function Wl(o){const t=e=>{for(let n=0;n<e.length;n++){const i=e[n];if(delete i.subTemplateParentId,delete i.subTemplateInstanceId,i.subTemplateContent?.length&&t(i.subTemplateContent),i.valueList?.length&&t(i.valueList),i.control?.value?.length&&t(i.control.value),i.type===s.ElementType.TABLE&&i.trList?.length)for(let l=0;l<i.trList.length;l++){const r=i.trList[l];for(let a=0;a<r.tdList.length;a++)t(r.tdList[a].value)}}};t(o)}function dT(o){const t=o.control;return t?t.type===s.ControlType.TEXT||t.type===s.ControlType.TEXTFIELD||t.type===s.ControlType.DATE||t.type===s.ControlType.NUMBER?Pn(t.value||[])||null:(t.type===s.ControlType.SELECT||t.type===s.ControlType.CHECKBOX||t.type===s.ControlType.RADIO)&&t.code?.split(",").map(e=>t.valueSets?.find(n=>n.code===e)?.value).filter(Boolean).join("")||null:null}function uT(o){const t=new Map,e=new Set,n=new Set,i=(l,r,a)=>{if(!l||r==null)return;const c=t.get(l)||[];c.push({label:l,source:a,value:r}),t.set(l,c)};return Po(o,l=>{l.control&&l.controlId&&!e.has(l.controlId)&&(e.add(l.controlId),i(l.control.label,dT(l),"control"));const r=l.id;if(r&&!n.has(r)&&(l.type===s.ElementType.MACRO||l.type===s.ElementType.CUSTOM_MACRO||l.type===s.ElementType.REUSABLE_ITEM)){n.add(r);let a;l.type===s.ElementType.MACRO?a=l.value:l.type===s.ElementType.CUSTOM_MACRO?a=l.macroConfig?.value:l.type===s.ElementType.REUSABLE_ITEM&&(a=l.reusableItemConfig?.value),i(l.label,a,"macro")}}),t}function Us(o){const t=o.replace(/,/g,"").match(/[-+]?(?:\d+(?:\.\d+)?|\.\d+)/);if(!t)return null;const e=Number(t[0]);return Number.isFinite(e)?e:null}function hT(o,t){const{rangeMin:e,rangeMax:n,source:i="all"}=o;if(e==null||n==null)return!1;const l=Us(e),r=Us(n);return l==null||r==null||l>r?!1:t.some(a=>{if(i!=="all"&&a.source!==i)return!1;const c=Us(a.value);return c!=null&&c>=l&&c<=r})}function Ul(o,t){const{label:e,value:n,regex:i,source:l="all"}=o;if(!e)return!1;const r=t.get(e);if(!r?.length)return!1;if(o.matchMode==="range")return hT(o,r);const a=n??i;if(a==null||a==="")return!1;if(n!=null)return r.some(d=>l!=="all"&&d.source!==l?!1:d.value.trim()===n.trim());let c;try{c=new RegExp(a)}catch(d){return console.warn("子模板匹配正则无效:",a,d),!1}return r.some(d=>l!=="all"&&d.source!==l?!1:c.test(d.value))}function RT(o,t,e="and"){return o?.length?e==="or"?o.some(n=>Ul(n,t)):o.every(n=>Ul(n,t)):!0}class gT{draw;options;constructor(t){this.draw=t,this.options=t.getOptions()}setSelect(t){const{checkbox:e}=t;e?e.value=!e.value:t.checkbox={value:!0},this.draw.requestRender({isCompute:!1,isSetCursor:!1})}render(t){const{ctx:e,x:n,index:i,row:l}=t;let{y:r}=t;const{checkbox:{gap:a,lineWidth:c,fillStyle:d,strokeStyle:u,verticalAlign:R},scale:h}=this.options,T=l.elementList[i],{metrics:g,checkbox:f}=T,m=T.controlComponent?0:a;if(R===s.VerticalAlign.TOP||R===s.VerticalAlign.MIDDLE){let O=i+1,P=null;for(;O<l.elementList.length&&(P=l.elementList[O],!(P.value!==B&&P.value!==Ti));)O++;if(P){const{metrics:{boundingBoxAscent:S,boundingBoxDescent:X}}=P,U=S+X;U>g.height&&(R===s.VerticalAlign.TOP?r-=S-g.height:R===s.VerticalAlign.MIDDLE&&(r-=(U-g.height)/2))}}const p=Math.round(n+m*h),I=Math.round(r-g.height+c),C=g.width-(m+a)*h,E=g.height;e.save(),e.beginPath(),e.translate(.5,.5),f?.value?(e.lineWidth=c,e.strokeStyle=d,e.rect(p,I,C,E),e.stroke(),e.beginPath(),e.fillStyle=d,e.fillRect(p,I,C,E),e.beginPath(),e.strokeStyle=u,e.lineWidth=c*2*h,e.moveTo(p+2*h,I+E/2),e.lineTo(p+C/2,I+E-3*h),e.lineTo(p+C-2*h,I+3*h),e.stroke()):(e.lineWidth=c,e.rect(p,I,C,E),e.stroke()),e.closePath(),e.restore()}}class TT{draw;options;constructor(t){this.draw=t,this.options=t.getOptions()}setSelect(t){const{radio:e}=t;e?e.value=!e.value:t.radio={value:!0},this.draw.requestRender({isCompute:!1,isSetCursor:!1})}render(t){const{ctx:e,x:n,index:i,row:l}=t;let{y:r}=t;const{radio:{gap:a,lineWidth:c,fillStyle:d,strokeStyle:u,verticalAlign:R},scale:h}=this.options,T=l.elementList[i],{metrics:g,radio:f}=T,m=T.controlComponent?0:a;if(R===s.VerticalAlign.TOP||R===s.VerticalAlign.MIDDLE){let O=i+1,P=null;for(;O<l.elementList.length&&(P=l.elementList[O],!(P.value!==B&&P.value!==Ti));)O++;if(P){const{metrics:{boundingBoxAscent:S,boundingBoxDescent:X}}=P,U=S+X;U>g.height&&(R===s.VerticalAlign.TOP?r-=S-g.height:R===s.VerticalAlign.MIDDLE&&(r-=(U-g.height)/2))}}const p=Math.round(n+m*h),I=Math.round(r-g.height+c),C=g.width-(m+a)*h,E=g.height;e.save(),e.beginPath(),e.translate(.5,.5),e.strokeStyle=f?.value?d:u,e.lineWidth=c,e.arc(p+C/2,I+E/2,C/2,0,Math.PI*2),e.stroke(),f?.value&&(e.beginPath(),e.fillStyle=d,e.arc(p+C/2,I+E/2,C/3,0,Math.PI*2),e.fill()),e.closePath(),e.restore()}}const hi={fontSize:11,smallFontSize:9,lineHeight:12,dividerWidth:40,gap:4,totalHeight:36};class fT{draw;options;inputModal=null;isPopup=!1;measureContext=null;sizeCache=new WeakMap;constructor(t){this.draw=t,this.options=t.getOptions()}computeSize(t){const e=hi,n=this.options.scale,i=t.menstrualData,l=[n,i?.isMenopause?1:0,i?.periodMin||"",i?.periodMax||"",i?.menarcheAge||"",i?.lastPeriod||"",i?.menopauseAge||"",i?.cycleMin||"",i?.cycleMax||""].join("|"),r=this.sizeCache.get(t);if(r?.key===l)return r.size;const a=e.fontSize*n,c=e.smallFontSize*n,d=e.gap*n,u=e.dividerWidth*n;this.measureContext||(this.measureContext=document.createElement("canvas").getContext("2d"));const R=this.measureContext;R.font=`${a}px "Microsoft YaHei", sans-serif`;let h=u;R.font=`${c}px "Microsoft YaHei", sans-serif`;let T=0;if(i){const m=this.getValue(i.menarcheAge);R.font=`${a}px "Microsoft YaHei", sans-serif`,m&&(h+=R.measureText(`${m}岁`).width+d);let p="";if(i.isMenopause){const P=this.getValue(i.menopauseAge);P&&(p=`${P}岁`)}else{const P=this.getValue(i.lastPeriod);P&&(p=P)}p&&(h+=R.measureText(p).width+d),R.font=`${c}px "Microsoft YaHei", sans-serif`;const I=this.getValue(i.periodMin),C=this.getValue(i.periodMax);if(I||C){const P=`${I||""}~${C||""}`;T=Math.max(T,R.measureText(P).width)}const E=this.getValue(i.cycleMin),O=this.getValue(i.cycleMax);if(E||O){const P=`${E||""}~${O||""}`;T=Math.max(T,R.measureText(P).width)}}else R.font=`${a}px "Microsoft YaHei", sans-serif`,T=R.measureText("~").width;const f={width:Math.max(h,T),height:e.totalHeight*n};return this.sizeCache.set(t,{key:l,size:f}),f}getValue(t){return!t||t===""||t==="_"||t==="____-__-__"?"":t}render(t){const{ctx:e,x:n,y:i,element:l}=t,r=l.menstrualData,a=this.options.scale;e.save(),e.font=`${hi.fontSize*a}px "Microsoft YaHei", sans-serif`,e.fillStyle=this.options.defaultColor,e.textBaseline="bottom",r?this.renderWithData(e,n,i,r,a):this.renderEmpty(e,n,i,a),e.restore()}renderEmpty(t,e,n,i){const l=hi,r=l.fontSize*i,a=l.lineHeight*i,c=l.dividerWidth*i,d=n-a*1.5,u=e+c/2;t.font=`${r}px "Microsoft YaHei", sans-serif`;const R=t.measureText("~").width,h=u-R/2;t.fillText("~",h,d+a);const T=d+a*2;this.drawDivider(t,e,T-r/2,c,i),t.fillText("~",h,T+a)}renderWithData(t,e,n,i,l){const r=hi,a=r.fontSize*l,c=r.smallFontSize*l,d=r.lineHeight*l,u=r.gap*l,R=r.dividerWidth*l,h=n-d*2,T=h+d*2;t.font=`${a}px "Microsoft YaHei", sans-serif`;const g=this.getValue(i.menarcheAge);let f=e;if(g){const y=`${g}岁`;t.fillText(y,e,T),f=e+t.measureText(y).width+u}const m=f+R/2,p=h+d;t.font=`${c}px "Microsoft YaHei", sans-serif`;const I=this.getValue(i.periodMin),C=this.getValue(i.periodMax);let E="";I||C?E=`${I||""}~${C||""}`:(t.font=`${a}px "Microsoft YaHei", sans-serif`,E="~");const O=t.measureText(E).width,P=m-O/2;t.fillText(E,P,p),this.drawDivider(t,f,T-a/2,R,l),t.font=`${a}px "Microsoft YaHei", sans-serif`;let S="";if(i.isMenopause){const y=this.getValue(i.menopauseAge);y&&(S=`${y}岁`)}else{const y=this.getValue(i.lastPeriod);y&&(S=y)}S&&t.fillText(S,f+R+u,T);const X=T+d;t.font=`${c}px "Microsoft YaHei", sans-serif`;const U=this.getValue(i.cycleMin),b=this.getValue(i.cycleMax);let M="";U||b?M=`${U||""}~${b||""}`:(t.font=`${a}px "Microsoft YaHei", sans-serif`,M="~");const V=t.measureText(M).width,N=m-V/2;t.fillText(M,N,X)}drawDivider(t,e,n,i,l){t.save(),t.beginPath(),t.strokeStyle=this.options.defaultColor,t.lineWidth=.5*l,t.moveTo(e,n),t.lineTo(e+i,n),t.stroke(),t.restore()}clearMenstrualHistoryEditor(){this.inputModal&&(this.inputModal.remove(),this.inputModal=null),this.isPopup=!1}renderMenstrualHistoryEditor(t,e){if(this.options.mode===s.EditorMode.PRINT||this.options.mode===s.EditorMode.COMPARE)return;(this.isPopup||this.inputModal)&&this.clearMenstrualHistoryEditor(),this.isPopup=!0;const n=t.menstrualData;this.inputModal=document.createElement("div"),this.inputModal.className="menstrual-history-edit-modal",this.inputModal.setAttribute("editor-component","menstrual-history-edit-modal"),this.inputModal.innerHTML=`
|
|
214
214
|
<div class="menstrual-history-modal__mask"></div>
|
|
215
215
|
<div class="menstrual-history-modal__container">
|