From 256e7041e2cbdf5320ebbf7b061780a4ceaf865c Mon Sep 17 00:00:00 2001 From: Timo Sundvik Date: Mon, 16 Sep 2024 05:19:43 +0000 Subject: [PATCH] Removed config and refactored textdomain. --- build/index-rtl.css | 239 +- build/index.asset.php | 2 +- build/index.css | 241 +- build/index.css.map | 1 + build/index.js | 6445 ++++++++++++++++++- build/index.js.map | 1 + index.d.ts | 24 +- src/components/PostSearchControl.js | 15 +- src/components/RequireBlocks.js | 27 +- src/components/SortablePostSearchControl.js | 235 + src/components/SortablePostsControl.js | 17 +- src/components/TaxonomyControl.js | 7 +- src/config.json | 3 - 13 files changed, 7207 insertions(+), 50 deletions(-) create mode 100644 build/index.css.map create mode 100644 build/index.js.map create mode 100644 src/components/SortablePostSearchControl.js delete mode 100644 src/config.json diff --git a/build/index-rtl.css b/build/index-rtl.css index f45bb98..37cbda3 100644 --- a/build/index-rtl.css +++ b/build/index-rtl.css @@ -1 +1,238 @@ -.wpbt-inline-notice{background-color:#f8f8f8;border:2px dashed #eee;padding:20px 25px;width:100%}.wpbt-inline-notice.is-warning{background-color:#fef8ee;border-color:#f0b849}.wpbt-inline-notice.is-error{background-color:#fce8e9;border-color:#c72629}.wpbt-inline-notice.is-size-small{border-width:1px;padding:10px 15px}.wpbt-checkbox-wrapper{height:250px;margin-right:-4px;overflow:auto;padding-right:4px}.wpbt-checkbox-wrapper .components-base-control{margin-bottom:3px}.wpbt-checkbox-wrapper .components-base-control .components-checkbox-control__label>div{display:inline}.wpbt-checkbox-wrapper>ul ul{margin-right:16px}.wpbt-checkbox-wrapper li ul{margin-bottom:10px}.wbpt-tag-list{display:flex;flex-flow:row wrap;gap:3px}.wbpt-removable-tag{align-items:center;border:none;border-radius:9999px;cursor:pointer;display:flex;flex-flow:row nowrap;font-size:10px;gap:4px;padding:3px 10px 3px 7px}.wbpt-removable-tag:after{content:"×";opacity:.5}.wpbt-combobox-wrapper ul.components-form-token-field__suggestions-list{margin:4px -4px -4px;padding:0}.wpbt-search-input{display:block;margin-bottom:10px;margin-top:5px}.wpbt-search-input input{width:100%}.wpbt-sortable-posts-control{position:relative}.wpbt-sortable-posts-control__list{border:1px solid #d3d3d3;border-radius:3px;height:200px;margin-top:3px;overflow-y:scroll;padding:5px}.wpbt-sortable-posts-control__option{background-color:#fff;border:none;color:#000;cursor:pointer;display:block;margin-bottom:1px;padding-bottom:4px;padding-top:4px;text-align:right;width:100%}.wpbt-sortable-posts-control__option.is-selected{background-color:#e6e6e6}.wpbt-sortable-posts-control__sortable-list{height:100%;position:relative;width:100%}.wpbt-sortable-posts-control__sortable-item{cursor:move;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none}.wpbt-sortable-posts-control__sortable-item span{display:block;padding-bottom:3px;padding-top:3px}.wpbt-sortable-posts-control__sortable-item:hover .wpbt-sortable-posts-control__sortable-remove{visibility:visible}.wpbt-sortable-posts-control__active-item{background-color:hsla(0,0%,100%,.9);border:1px dashed #000;border-radius:5px;cursor:move;padding:3px 5px;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none}.wpbt-sortable-posts-control__sortable-remove{align-items:center;background-color:#000;border-radius:50%;cursor:pointer;display:flex;height:18px;justify-content:center;position:absolute;left:5px;top:50%;transform:translateY(-50%);visibility:hidden;width:18px;z-index:2}.wpbt-sortable-posts-control__sortable-remove:after{background-color:#fff;content:"";height:3px;right:50%;position:absolute;top:50%;transform:translate(50%,-50%);width:8px}.wpbt-sortable-posts-control__subtitle{font-weight:400;margin-bottom:3px;margin-top:10px;opacity:.5}.wpbt-sortable-posts-control__search{margin-bottom:2px;width:100%}.wpbt-post-search-control{position:relative;z-index:2}.wpbt-post-search-control__input{border-radius:2px;display:block;width:100%}.wpbt-post-search-control__options{background-color:#fff;border:1px solid var(--wp-admin-theme-color);border-radius:2px;box-shadow:0 0 0 1px var(--wp-admin-theme-color);display:flex;flex-flow:column nowrap;gap:5px;right:0;max-height:300px;overflow:auto;position:absolute;top:100%;width:100%}.wpbt-post-search-control__options:empty{display:none}.wpbt-post-search-control__options p,.wpbt-post-search-control__spinner{padding:10px}.wpbt-post-search-control__option{background-color:transparent;border:none;cursor:pointer;display:block;padding:4px 8px;text-align:right;width:100%}.wpbt-post-search-control__option:hover{background:var(--wp-admin-theme-color);color:#fff}.wpbt-post-search-control__reset{background:#fff;height:24px;min-width:24px;padding:0;position:absolute;left:0;top:50%;transform:translateY(-50%);width:auto!important}.wpbt-post-search-control__wrapper{position:relative;width:100%}.wpbt-post-search-control__more{margin:3px} +/*!****************************************************************************************************************************************************************************************************************************************!*\ + !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/editor.scss ***! + \****************************************************************************************************************************************************************************************************************************************/ +@charset "UTF-8"; +.wpbt-inline-notice { + padding: 20px 25px; + background-color: #f8f8f8; + border-style: dashed; + border-width: 2px; + border-color: #eee; + width: 100%; +} +.wpbt-inline-notice.is-warning { + background-color: #fef8ee; + border-color: #f0b849; +} +.wpbt-inline-notice.is-error { + background-color: #fce8e9; + border-color: #c72629; +} +.wpbt-inline-notice.is-size-small { + padding: 10px 15px; + border-width: 1px; +} + +.wpbt-checkbox-wrapper { + height: 250px; + overflow: auto; + padding-right: 4px; + margin-right: -4px; +} +.wpbt-checkbox-wrapper .components-base-control { + margin-bottom: 3px; +} +.wpbt-checkbox-wrapper .components-base-control .components-checkbox-control__label > div { + display: inline; +} +.wpbt-checkbox-wrapper > ul ul { + margin-right: 16px; +} +.wpbt-checkbox-wrapper li ul { + margin-bottom: 10px; +} + +.wbpt-tag-list { + display: flex; + flex-flow: row wrap; + gap: 3px; +} + +.wbpt-removable-tag { + font-size: 10px; + border-radius: 9999px; + border: none; + cursor: pointer; + display: flex; + flex-flow: row nowrap; + align-items: center; + gap: 4px; + padding: 3px 10px 3px 7px; +} +.wbpt-removable-tag::after { + content: "×"; + opacity: 0.5; +} + +.wpbt-combobox-wrapper ul.components-form-token-field__suggestions-list { + margin: 4px -4px -4px; + padding: 0; +} + +.wpbt-search-input { + display: block; + margin-top: 5px; + margin-bottom: 10px; +} +.wpbt-search-input input { + width: 100%; +} + +.wpbt-sortable-posts-control { + position: relative; +} +.wpbt-sortable-posts-control__list { + border: solid 1px #d3d3d3; + border-radius: 3px; + padding: 5px; + height: 200px; + overflow-y: scroll; + margin-top: 3px; +} +.wpbt-sortable-posts-control__option { + cursor: pointer; + padding-top: 4px; + padding-bottom: 4px; + margin-bottom: 1px; + display: block; + width: 100%; + background-color: #fff; + color: #000; + border: none; + text-align: right; +} +.wpbt-sortable-posts-control__option.is-selected { + background-color: hsl(0, 0%, 90%); +} +.wpbt-sortable-posts-control__sortable-list { + position: relative; + width: 100%; + height: 100%; +} +.wpbt-sortable-posts-control__sortable-item { + position: relative; + cursor: move; + -webkit-user-select: none; + -moz-user-select: none; + user-select: none; +} +.wpbt-sortable-posts-control__sortable-item span { + display: block; + padding-top: 3px; + padding-bottom: 3px; +} +.wpbt-sortable-posts-control__sortable-item:hover .wpbt-sortable-posts-control__sortable-remove { + visibility: visible; +} +.wpbt-sortable-posts-control__active-item { + position: relative; + padding: 3px 5px; + cursor: move; + -webkit-user-select: none; + -moz-user-select: none; + user-select: none; + background-color: rgba(255, 255, 255, 0.9); + border: dashed 1px #000; + border-radius: 5px; +} +.wpbt-sortable-posts-control__sortable-remove { + position: absolute; + top: 50%; + left: 5px; + transform: translateY(-50%); + background-color: #000; + border-radius: 50%; + width: 18px; + height: 18px; + z-index: 2; + cursor: pointer; + display: flex; + align-items: center; + justify-content: center; + visibility: hidden; +} +.wpbt-sortable-posts-control__sortable-remove::after { + content: ""; + background-color: #fff; + width: 8px; + height: 3px; + position: absolute; + top: 50%; + right: 50%; + transform: translate(50%, -50%); +} +.wpbt-sortable-posts-control__subtitle { + margin-top: 10px; + margin-bottom: 3px; + opacity: 0.5; + font-weight: 400; +} +.wpbt-sortable-posts-control__search { + margin-bottom: 2px; + width: 100%; +} + +.wpbt-post-search-control { + position: relative; + z-index: 2; +} +.wpbt-post-search-control__input { + width: 100%; + display: block; + border-radius: 2px; +} +.wpbt-post-search-control__options { + position: absolute; + top: 100%; + right: 0; + width: 100%; + background-color: #fff; + border: solid 1px var(--wp-admin-theme-color); + box-shadow: 0 0 0 1px var(--wp-admin-theme-color); + border-radius: 2px; + display: flex; + flex-flow: column nowrap; + gap: 5px; + max-height: 300px; + overflow: auto; +} +.wpbt-post-search-control__options:empty { + display: none; +} +.wpbt-post-search-control__options p { + padding: 10px; +} +.wpbt-post-search-control__spinner { + padding: 10px; +} +.wpbt-post-search-control__option { + display: block; + text-align: right; + width: 100%; + background-color: transparent; + border: none; + cursor: pointer; + padding: 4px 8px; +} +.wpbt-post-search-control__option:hover { + background: var(--wp-admin-theme-color); + color: #fff; +} +.wpbt-post-search-control__reset { + position: absolute; + top: 50%; + left: 0; + transform: translateY(-50%); + height: 24px; + min-width: 24px; + padding: 0; + background: #fff; + width: auto !important; +} +.wpbt-post-search-control__wrapper { + position: relative; + width: 100%; +} +.wpbt-post-search-control__more { + margin: 3px; +} diff --git a/build/index.asset.php b/build/index.asset.php index 65414d6..cd9d471 100644 --- a/build/index.asset.php +++ b/build/index.asset.php @@ -1 +1 @@ - array('react', 'react-dom', 'react-jsx-runtime', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '0362ec227ea21cca3047'); + array('react', 'react-dom', 'react-jsx-runtime', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '6e070825a2fb1fe9feb8'); diff --git a/build/index.css b/build/index.css index 0828c8d..2815452 100644 --- a/build/index.css +++ b/build/index.css @@ -1 +1,240 @@ -.wpbt-inline-notice{background-color:#f8f8f8;border:2px dashed #eee;padding:20px 25px;width:100%}.wpbt-inline-notice.is-warning{background-color:#fef8ee;border-color:#f0b849}.wpbt-inline-notice.is-error{background-color:#fce8e9;border-color:#c72629}.wpbt-inline-notice.is-size-small{border-width:1px;padding:10px 15px}.wpbt-checkbox-wrapper{height:250px;margin-left:-4px;overflow:auto;padding-left:4px}.wpbt-checkbox-wrapper .components-base-control{margin-bottom:3px}.wpbt-checkbox-wrapper .components-base-control .components-checkbox-control__label>div{display:inline}.wpbt-checkbox-wrapper>ul ul{margin-left:16px}.wpbt-checkbox-wrapper li ul{margin-bottom:10px}.wbpt-tag-list{display:flex;flex-flow:row wrap;gap:3px}.wbpt-removable-tag{align-items:center;border:none;border-radius:9999px;cursor:pointer;display:flex;flex-flow:row nowrap;font-size:10px;gap:4px;padding:3px 7px 3px 10px}.wbpt-removable-tag:after{content:"×";opacity:.5}.wpbt-combobox-wrapper ul.components-form-token-field__suggestions-list{margin:4px -4px -4px;padding:0}.wpbt-search-input{display:block;margin-bottom:10px;margin-top:5px}.wpbt-search-input input{width:100%}.wpbt-sortable-posts-control{position:relative}.wpbt-sortable-posts-control__list{border:1px solid #d3d3d3;border-radius:3px;height:200px;margin-top:3px;overflow-y:scroll;padding:5px}.wpbt-sortable-posts-control__option{background-color:#fff;border:none;color:#000;cursor:pointer;display:block;margin-bottom:1px;padding-bottom:4px;padding-top:4px;text-align:left;width:100%}.wpbt-sortable-posts-control__option.is-selected{background-color:#e6e6e6}.wpbt-sortable-posts-control__sortable-list{height:100%;position:relative;width:100%}.wpbt-sortable-posts-control__sortable-item{cursor:move;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none}.wpbt-sortable-posts-control__sortable-item span{display:block;padding-bottom:3px;padding-top:3px}.wpbt-sortable-posts-control__sortable-item:hover .wpbt-sortable-posts-control__sortable-remove{visibility:visible}.wpbt-sortable-posts-control__active-item{background-color:hsla(0,0%,100%,.9);border:1px dashed #000;border-radius:5px;cursor:move;padding:3px 5px;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none}.wpbt-sortable-posts-control__sortable-remove{align-items:center;background-color:#000;border-radius:50%;cursor:pointer;display:flex;height:18px;justify-content:center;position:absolute;right:5px;top:50%;transform:translateY(-50%);visibility:hidden;width:18px;z-index:2}.wpbt-sortable-posts-control__sortable-remove:after{background-color:#fff;content:"";height:3px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:8px}.wpbt-sortable-posts-control__subtitle{font-weight:400;margin-bottom:3px;margin-top:10px;opacity:.5}.wpbt-sortable-posts-control__search{margin-bottom:2px;width:100%}.wpbt-post-search-control{position:relative;z-index:2}.wpbt-post-search-control__input{border-radius:2px;display:block;width:100%}.wpbt-post-search-control__options{background-color:#fff;border:1px solid var(--wp-admin-theme-color);border-radius:2px;box-shadow:0 0 0 1px var(--wp-admin-theme-color);display:flex;flex-flow:column nowrap;gap:5px;left:0;max-height:300px;overflow:auto;position:absolute;top:100%;width:100%}.wpbt-post-search-control__options:empty{display:none}.wpbt-post-search-control__options p,.wpbt-post-search-control__spinner{padding:10px}.wpbt-post-search-control__option{background-color:transparent;border:none;cursor:pointer;display:block;padding:4px 8px;text-align:left;width:100%}.wpbt-post-search-control__option:hover{background:var(--wp-admin-theme-color);color:#fff}.wpbt-post-search-control__reset{background:#fff;height:24px;min-width:24px;padding:0;position:absolute;right:0;top:50%;transform:translateY(-50%);width:auto!important}.wpbt-post-search-control__wrapper{position:relative;width:100%}.wpbt-post-search-control__more{margin:3px} +/*!****************************************************************************************************************************************************************************************************************************************!*\ + !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/editor.scss ***! + \****************************************************************************************************************************************************************************************************************************************/ +@charset "UTF-8"; +.wpbt-inline-notice { + padding: 20px 25px; + background-color: #f8f8f8; + border-style: dashed; + border-width: 2px; + border-color: #eee; + width: 100%; +} +.wpbt-inline-notice.is-warning { + background-color: #fef8ee; + border-color: #f0b849; +} +.wpbt-inline-notice.is-error { + background-color: #fce8e9; + border-color: #c72629; +} +.wpbt-inline-notice.is-size-small { + padding: 10px 15px; + border-width: 1px; +} + +.wpbt-checkbox-wrapper { + height: 250px; + overflow: auto; + padding-left: 4px; + margin-left: -4px; +} +.wpbt-checkbox-wrapper .components-base-control { + margin-bottom: 3px; +} +.wpbt-checkbox-wrapper .components-base-control .components-checkbox-control__label > div { + display: inline; +} +.wpbt-checkbox-wrapper > ul ul { + margin-left: 16px; +} +.wpbt-checkbox-wrapper li ul { + margin-bottom: 10px; +} + +.wbpt-tag-list { + display: flex; + flex-flow: row wrap; + gap: 3px; +} + +.wbpt-removable-tag { + font-size: 10px; + border-radius: 9999px; + border: none; + cursor: pointer; + display: flex; + flex-flow: row nowrap; + align-items: center; + gap: 4px; + padding: 3px 7px 3px 10px; +} +.wbpt-removable-tag::after { + content: "×"; + opacity: 0.5; +} + +.wpbt-combobox-wrapper ul.components-form-token-field__suggestions-list { + margin: 4px -4px -4px; + padding: 0; +} + +.wpbt-search-input { + display: block; + margin-top: 5px; + margin-bottom: 10px; +} +.wpbt-search-input input { + width: 100%; +} + +.wpbt-sortable-posts-control { + position: relative; +} +.wpbt-sortable-posts-control__list { + border: solid 1px #d3d3d3; + border-radius: 3px; + padding: 5px; + height: 200px; + overflow-y: scroll; + margin-top: 3px; +} +.wpbt-sortable-posts-control__option { + cursor: pointer; + padding-top: 4px; + padding-bottom: 4px; + margin-bottom: 1px; + display: block; + width: 100%; + background-color: #fff; + color: #000; + border: none; + text-align: left; +} +.wpbt-sortable-posts-control__option.is-selected { + background-color: hsl(0, 0%, 90%); +} +.wpbt-sortable-posts-control__sortable-list { + position: relative; + width: 100%; + height: 100%; +} +.wpbt-sortable-posts-control__sortable-item { + position: relative; + cursor: move; + -webkit-user-select: none; + -moz-user-select: none; + user-select: none; +} +.wpbt-sortable-posts-control__sortable-item span { + display: block; + padding-top: 3px; + padding-bottom: 3px; +} +.wpbt-sortable-posts-control__sortable-item:hover .wpbt-sortable-posts-control__sortable-remove { + visibility: visible; +} +.wpbt-sortable-posts-control__active-item { + position: relative; + padding: 3px 5px; + cursor: move; + -webkit-user-select: none; + -moz-user-select: none; + user-select: none; + background-color: rgba(255, 255, 255, 0.9); + border: dashed 1px #000; + border-radius: 5px; +} +.wpbt-sortable-posts-control__sortable-remove { + position: absolute; + top: 50%; + right: 5px; + transform: translateY(-50%); + background-color: #000; + border-radius: 50%; + width: 18px; + height: 18px; + z-index: 2; + cursor: pointer; + display: flex; + align-items: center; + justify-content: center; + visibility: hidden; +} +.wpbt-sortable-posts-control__sortable-remove::after { + content: ""; + background-color: #fff; + width: 8px; + height: 3px; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); +} +.wpbt-sortable-posts-control__subtitle { + margin-top: 10px; + margin-bottom: 3px; + opacity: 0.5; + font-weight: 400; +} +.wpbt-sortable-posts-control__search { + margin-bottom: 2px; + width: 100%; +} + +.wpbt-post-search-control { + position: relative; + z-index: 2; +} +.wpbt-post-search-control__input { + width: 100%; + display: block; + border-radius: 2px; +} +.wpbt-post-search-control__options { + position: absolute; + top: 100%; + left: 0; + width: 100%; + background-color: #fff; + border: solid 1px var(--wp-admin-theme-color); + box-shadow: 0 0 0 1px var(--wp-admin-theme-color); + border-radius: 2px; + display: flex; + flex-flow: column nowrap; + gap: 5px; + max-height: 300px; + overflow: auto; +} +.wpbt-post-search-control__options:empty { + display: none; +} +.wpbt-post-search-control__options p { + padding: 10px; +} +.wpbt-post-search-control__spinner { + padding: 10px; +} +.wpbt-post-search-control__option { + display: block; + text-align: left; + width: 100%; + background-color: transparent; + border: none; + cursor: pointer; + padding: 4px 8px; +} +.wpbt-post-search-control__option:hover { + background: var(--wp-admin-theme-color); + color: #fff; +} +.wpbt-post-search-control__reset { + position: absolute; + top: 50%; + right: 0; + transform: translateY(-50%); + height: 24px; + min-width: 24px; + padding: 0; + background: #fff; + width: auto !important; +} +.wpbt-post-search-control__wrapper { + position: relative; + width: 100%; +} +.wpbt-post-search-control__more { + margin: 3px; +} + +/*# sourceMappingURL=index.css.map*/ \ No newline at end of file diff --git a/build/index.css.map b/build/index.css.map new file mode 100644 index 0000000..dd76bdc --- /dev/null +++ b/build/index.css.map @@ -0,0 +1 @@ +{"version":3,"file":"index.css","mappings":";;;AAAA,gBAAgB;AAAhB;EACC;EACA;EACA;EACA;EACA;EACA;AAED;AAAC;EACC;EACA;AAEF;AACC;EACC;EACA;AACF;AAEC;EACC;EACA;AAAF;;AAIA;EACC;EACA;EACA;EACA;AADD;AAGC;EACC;AADF;AAGE;EACC;AADH;AAKC;EACC;AAHF;AAMC;EACC;AAJF;;AAQA;EACC;EACA;EACA;AALD;;AAQA;EACC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AALD;AAOC;EACC;EACA;AALF;;AAUC;EACC;EACA;AAPF;;AAWA;EACC;EACA;EACA;AARD;AAUC;EACC;AARF;;AAYA;EACC;AATD;AAWC;EACC;EACA;EACA;EACA;EACA;EACA;AATF;AAYC;EACC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AAVF;AAYE;EACC;AAVH;AAcC;EACC;EACA;EACA;AAZF;AAeC;EACC;EACA;EACA;KAAA;UAAA;AAbF;AAeE;EACC;EACA;EACA;AAbH;AAiBG;EACC;AAfJ;AAoBC;EACC;EACA;EACA;EACA;KAAA;UAAA;EACA;EACA;EACA;AAlBF;AAqBC;EACC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AAnBF;AAqBE;EACC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AAnBH;AAuBC;EACC;EACA;EACA;EACA;AArBF;AAwBC;EACC;EACA;AAtBF;;AA0BA;EACC;EACA;AAvBD;AAyBC;EACC;EACA;EACA;AAvBF;AA0BC;EACC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AAxBF;AA0BE;EACC;AAxBH;AA2BE;EACC;AAzBH;AA6BC;EACC;AA3BF;AA8BC;EACC;EACA;EACA;EACA;EACA;EACA;EACA;AA5BF;AA8BE;EACC;EACA;AA5BH;AAgCC;EACC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AA9BF;AAiCC;EACC;EACA;AA/BF;AAkCC;EACC;AAhCF,C","sources":["webpack://@evermade/wp-block-toolkit/./src/editor.scss"],"sourcesContent":[".wpbt-inline-notice {\n\tpadding: 20px 25px;\n\tbackground-color: #f8f8f8;\n\tborder-style: dashed;\n\tborder-width: 2px;\n\tborder-color: #eee;\n\twidth: 100%;\n\n\t&.is-warning {\n\t\tbackground-color: #fef8ee;\n\t\tborder-color: #f0b849;\n\t}\n\n\t&.is-error {\n\t\tbackground-color: #fce8e9;\n\t\tborder-color: #c72629;\n\t}\n\n\t&.is-size-small {\n\t\tpadding: 10px 15px;\n\t\tborder-width: 1px;\n\t}\n}\n\n.wpbt-checkbox-wrapper {\n\theight: 250px;\n\toverflow: auto;\n\tpadding-left: 4px;\n\tmargin-left: -4px;\n\n\t.components-base-control {\n\t\tmargin-bottom: 3px;\n\n\t\t.components-checkbox-control__label > div {\n\t\t\tdisplay: inline;\n\t\t}\n\t}\n\n\t> ul ul {\n\t\tmargin-left: 16px;\n\t}\n\n\tli ul {\n\t\tmargin-bottom: 10px;\n\t}\n}\n\n.wbpt-tag-list {\n\tdisplay: flex;\n\tflex-flow: row wrap;\n\tgap: 3px;\n}\n\n.wbpt-removable-tag {\n\tfont-size: 10px;\n\tborder-radius: 9999px;\n\tborder: none;\n\tcursor: pointer;\n\tdisplay: flex;\n\tflex-flow: row nowrap;\n\talign-items: center;\n\tgap: 4px;\n\tpadding: 3px 7px 3px 10px;\n\n\t&::after {\n\t\tcontent: \"×\";\n\t\topacity: 0.5;\n\t}\n}\n\n.wpbt-combobox-wrapper {\n\tul.components-form-token-field__suggestions-list {\n\t\tmargin: 4px -4px -4px;\n\t\tpadding: 0;\n\t}\n}\n\n.wpbt-search-input {\n\tdisplay: block;\n\tmargin-top: 5px;\n\tmargin-bottom: 10px;\n\n\tinput {\n\t\twidth: 100%;\n\t}\n}\n\n.wpbt-sortable-posts-control {\n\tposition: relative;\n\n\t&__list {\n\t\tborder: solid 1px #d3d3d3;\n\t\tborder-radius: 3px;\n\t\tpadding: 5px;\n\t\theight: 200px;\n\t\toverflow-y: scroll;\n\t\tmargin-top: 3px;\n\t}\n\n\t&__option {\n\t\tcursor: pointer;\n\t\tpadding-top: 4px;\n\t\tpadding-bottom: 4px;\n\t\tmargin-bottom: 1px;\n\t\tdisplay: block;\n\t\twidth: 100%;\n\t\tbackground-color: #fff;\n\t\tcolor: #000;\n\t\tborder: none;\n\t\ttext-align: left;\n\n\t\t&.is-selected {\n\t\t\tbackground-color: hsl(0, 0%, 90%);\n\t\t}\n\t}\n\n\t&__sortable-list {\n\t\tposition: relative;\n\t\twidth: 100%;\n\t\theight: 100%;\n\t}\n\n\t&__sortable-item {\n\t\tposition: relative;\n\t\tcursor: move;\n\t\tuser-select: none;\n\n\t\tspan {\n\t\t\tdisplay: block;\n\t\t\tpadding-top: 3px;\n\t\t\tpadding-bottom: 3px;\n\t\t}\n\n\t\t&:hover {\n\t\t\t.wpbt-sortable-posts-control__sortable-remove {\n\t\t\t\tvisibility: visible;\n\t\t\t}\n\t\t}\n\t}\n\n\t&__active-item {\n\t\tposition: relative;\n\t\tpadding: 3px 5px;\n\t\tcursor: move;\n\t\tuser-select: none;\n\t\tbackground-color: rgba(#fff, 0.9);\n\t\tborder: dashed 1px #000;\n\t\tborder-radius: 5px;\n\t}\n\n\t&__sortable-remove {\n\t\tposition: absolute;\n\t\ttop: 50%;\n\t\tright: 5px;\n\t\ttransform: translateY(-50%);\n\t\tbackground-color: #000;\n\t\tborder-radius: 50%;\n\t\twidth: 18px;\n\t\theight: 18px;\n\t\tz-index: 2;\n\t\tcursor: pointer;\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: center;\n\t\tvisibility: hidden;\n\n\t\t&::after {\n\t\t\tcontent: \"\";\n\t\t\tbackground-color: #fff;\n\t\t\twidth: 8px;\n\t\t\theight: 3px;\n\t\t\tposition: absolute;\n\t\t\ttop: 50%;\n\t\t\tleft: 50%;\n\t\t\ttransform: translate(-50%, -50%);\n\t\t}\n\t}\n\n\t&__subtitle {\n\t\tmargin-top: 10px;\n\t\tmargin-bottom: 3px;\n\t\topacity: 0.5;\n\t\tfont-weight: 400;\n\t}\n\n\t&__search {\n\t\tmargin-bottom: 2px;\n\t\twidth: 100%;\n\t}\n}\n\n.wpbt-post-search-control {\n\tposition: relative;\n\tz-index: 2;\n\n\t&__input {\n\t\twidth: 100%;\n\t\tdisplay: block;\n\t\tborder-radius: 2px;\n\t}\n\n\t&__options {\n\t\tposition: absolute;\n\t\ttop: 100%;\n\t\tleft: 0;\n\t\twidth: 100%;\n\t\tbackground-color: #fff;\n\t\tborder: solid 1px var(--wp-admin-theme-color);\n\t\tbox-shadow: 0 0 0 1px var(--wp-admin-theme-color);\n\t\tborder-radius: 2px;\n\t\tdisplay: flex;\n\t\tflex-flow: column nowrap;\n\t\tgap: 5px;\n\t\tmax-height: 300px;\n\t\toverflow: auto;\n\n\t\t&:empty {\n\t\t\tdisplay: none;\n\t\t}\n\n\t\tp {\n\t\t\tpadding: 10px;\n\t\t}\n\t}\n\n\t&__spinner {\n\t\tpadding: 10px;\n\t}\n\n\t&__option {\n\t\tdisplay: block;\n\t\ttext-align: left;\n\t\twidth: 100%;\n\t\tbackground-color: transparent;\n\t\tborder: none;\n\t\tcursor: pointer;\n\t\tpadding: 4px 8px;\n\n\t\t&:hover {\n\t\t\tbackground: var(--wp-admin-theme-color);\n\t\t\tcolor: #fff;\n\t\t}\n\t}\n\n\t&__reset {\n\t\tposition: absolute;\n\t\ttop: 50%;\n\t\tright: 0;\n\t\ttransform: translateY(-50%);\n\t\theight: 24px;\n\t\tmin-width: 24px;\n\t\tpadding: 0;\n\t\tbackground: #fff;\n\t\twidth: auto !important;\n\t}\n\n\t&__wrapper {\n\t\tposition: relative;\n\t\twidth: 100%;\n\t}\n\n\t&__more {\n\t\tmargin: 3px;\n\t}\n}\n"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/build/index.js b/build/index.js index 5ffeb7a..bd88481 100644 --- a/build/index.js +++ b/build/index.js @@ -1 +1,6444 @@ -(()=>{var e={942:(e,t)=>{var n;!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var e="",t=0;t{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};(()=>{"use strict";n.r(r),n.d(r,{InlineNotice:()=>i,PostControl:()=>u,PostSearchControl:()=>cn,RequireBlocks:()=>g,SortablePostsControl:()=>Jt,TaxonomyControl:()=>Vt,useAllPosts:()=>un,usePost:()=>on,usePostSearch:()=>an,useRequiredBlocks:()=>p});var e=n(942),t=n.n(e);const o=window.ReactJSXRuntime,i=({children:e,status:n="warning",size:r="regular"})=>{const i=t()("wpbt-inline-notice",`is-${n}`,`is-size-${r}`);return(0,o.jsx)("div",{className:i,children:e})},a=window.wp.components,s=window.wp.element,l=e=>({id:e.id,label:e.title.raw,value:e.id}),c=(e,t)=>t?`${e} (${t})`:e,u=({label:e,posts:t,value:n,onChange:r})=>{const[i,c]=(0,s.useState)([]);return(0,s.useEffect)((()=>{t&&c(t.map(l))}),[t]),null===t?(0,o.jsx)(a.Spinner,{}):(0,o.jsx)(d,{children:(0,o.jsx)(a.ComboboxControl,{label:e,value:n,onChange:r,options:i})})},d=({children:e})=>(0,o.jsx)("div",{className:"wpbt-combobox-wrapper",children:e}),f=window.wp.i18n,h=window.wp.data;function p(e){const t=(0,h.useSelect)((e=>e("core/blocks").getBlockTypes().map((e=>e.name))),[]),n=e.filter((e=>!t.includes(e)));return{missingBlocks:n,hasRequiredBlocks:!n.length}}const v=JSON.parse('{"textdomain":"wp-block-toolkit"}'),g=({children:e,blocks:t})=>{const{textdomain:n}=v,{hasRequiredBlocks:r,missingBlocks:a}=p(t);return(0,o.jsx)(s.Fragment,{children:r?e:(0,o.jsxs)(i,{status:"error",children:[(0,f.__)("Couldn't find all the required blocks. Please install and activate the following blocks: ",n),(0,o.jsx)("strong",{children:a.join(", ")})]})})},b=window.React;var m=n.n(b);const w=window.ReactDOM,x="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function y(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function C(e){return"nodeType"in e}function R(e){var t,n;return e?y(e)?e:C(e)&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}function D(e){const{Document:t}=R(e);return e instanceof t}function S(e){return!y(e)&&e instanceof R(e).HTMLElement}function E(e){return e instanceof R(e).SVGElement}function N(e){return e?y(e)?e.document:C(e)?D(e)?e:S(e)||E(e)?e.ownerDocument:document:document:document}const M=x?b.useLayoutEffect:b.useEffect;function k(e){const t=(0,b.useRef)(e);return M((()=>{t.current=e})),(0,b.useCallback)((function(){for(var e=arguments.length,n=new Array(e),r=0;r{n.current!==e&&(n.current=e)}),t),n}function I(e,t){const n=(0,b.useRef)();return(0,b.useMemo)((()=>{const t=e(n.current);return n.current=t,t}),[...t])}function T(e){const t=k(e),n=(0,b.useRef)(null),r=(0,b.useCallback)((e=>{e!==n.current&&(null==t||t(e,n.current)),n.current=e}),[]);return[n,r]}function O(e){const t=(0,b.useRef)();return(0,b.useEffect)((()=>{t.current=e}),[e]),t.current}let _={};function L(e,t){return(0,b.useMemo)((()=>{if(t)return t;const n=null==_[e]?0:_[e]+1;return _[e]=n,e+"-"+n}),[e,t])}function A(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o{const r=Object.entries(n);for(const[n,o]of r){const r=t[n];null!=r&&(t[n]=r+e*o)}return t}),{...t})}}const B=A(1),P=A(-1);function z(e){if(!e)return!1;const{KeyboardEvent:t}=R(e.target);return t&&e instanceof t}function F(e){if(function(e){if(!e)return!1;const{TouchEvent:t}=R(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return function(e){return"clientX"in e&&"clientY"in e}(e)?{x:e.clientX,y:e.clientY}:null}const U=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[U.Translate.toString(e),U.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),X="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Y(e){return e.matches(X)?e:e.querySelector(X)}const K={display:"none"};function W(e){let{id:t,value:n}=e;return m().createElement("div",{id:t,style:K},n)}function q(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;return m().createElement("div",{id:t,style:{position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":r,"aria-atomic":!0},n)}const H=(0,b.createContext)(null),J={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},V={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function $(e){let{announcements:t=V,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=J}=e;const{announce:i,announcement:a}=function(){const[e,t]=(0,b.useState)("");return{announce:(0,b.useCallback)((e=>{null!=e&&t(e)}),[]),announcement:e}}(),s=L("DndLiveRegion"),[l,c]=(0,b.useState)(!1);if((0,b.useEffect)((()=>{c(!0)}),[]),function(e){const t=(0,b.useContext)(H);(0,b.useEffect)((()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(e)}),[e,t])}((0,b.useMemo)((()=>({onDragStart(e){let{active:n}=e;i(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&i(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;i(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;i(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;i(t.onDragCancel({active:n,over:r}))}})),[i,t])),!l)return null;const u=m().createElement(m().Fragment,null,m().createElement(W,{id:r,value:o.draggable}),m().createElement(q,{id:s,announcement:a}));return n?(0,w.createPortal)(u,n):u}var G;function Q(){}function Z(e,t){return(0,b.useMemo)((()=>({sensor:e,options:null!=t?t:{}})),[e,t])}!function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"}(G||(G={}));const ee=Object.freeze({x:0,y:0});function te(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ne(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function re(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function oe(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function ie(e,t){if(!e||0===e.length)return null;const[n]=e;return t?n[t]:n}function ae(e,t,n){return void 0===t&&(t=e.left),void 0===n&&(n=e.top),{x:t+.5*e.width,y:n+.5*e.height}}const se=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=ae(t,t.left,t.top),i=[];for(const e of r){const{id:t}=e,r=n.get(t);if(r){const n=te(ae(r),o);i.push({id:t,data:{droppableContainer:e,value:n}})}}return i.sort(ne)};function le(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),a=o-r,s=i-n;if(r{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const e of r){const{id:r}=e,i=n.get(r);if(i){const n=le(i,t);n>0&&o.push({id:r,data:{droppableContainer:e,value:n}})}}return o.sort(re)};function ue(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ee}function de(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x})),{...t})}}const fe=de(1);const he={ignoreTransform:!1};function pe(e,t){void 0===t&&(t=he);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:r}=R(e).getComputedStyle(e);t&&(n=function(e,t,n){const r=function(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}(t);if(!r)return e;const{scaleX:o,scaleY:i,x:a,y:s}=r,l=e.left-a-(1-o)*parseFloat(n),c=e.top-s-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),u=o?e.width/o:e.width,d=i?e.height/i:e.height;return{width:u,height:d,top:c,right:l+u,bottom:c+d,left:l}}(n,t,r))}const{top:r,left:o,width:i,height:a,bottom:s,right:l}=n;return{top:r,left:o,width:i,height:a,bottom:s,right:l}}function ve(e){return pe(e,{ignoreTransform:!0})}function ge(e,t){const n=[];return e?function r(o){if(null!=t&&n.length>=t)return n;if(!o)return n;if(D(o)&&null!=o.scrollingElement&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!S(o)||E(o))return n;if(n.includes(o))return n;const i=R(e).getComputedStyle(o);return o!==e&&function(e,t){void 0===t&&(t=R(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some((e=>{const r=t[e];return"string"==typeof r&&n.test(r)}))}(o,i)&&n.push(o),function(e,t){return void 0===t&&(t=R(e).getComputedStyle(e)),"fixed"===t.position}(o,i)?n:r(o.parentNode)}(e):n}function be(e){const[t]=ge(e,1);return null!=t?t:null}function me(e){return x&&e?y(e)?e:C(e)?D(e)||e===N(e).scrollingElement?window:S(e)?e:null:null:null}function we(e){return y(e)?e.scrollX:e.scrollLeft}function xe(e){return y(e)?e.scrollY:e.scrollTop}function ye(e){return{x:we(e),y:xe(e)}}var Ce;function Re(e){return!(!x||!e)&&e===document.scrollingElement}function De(e){const t={x:0,y:0},n=Re(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}(Ce||(Ce={}));const Se={x:.2,y:.2};function Ee(e,t,n,r,o){let{top:i,left:a,right:s,bottom:l}=n;void 0===r&&(r=10),void 0===o&&(o=Se);const{isTop:c,isBottom:u,isLeft:d,isRight:f}=De(e),h={x:0,y:0},p={x:0,y:0},v=t.height*o.y,g=t.width*o.x;return!c&&i<=t.top+v?(h.y=Ce.Backward,p.y=r*Math.abs((t.top+v-i)/v)):!u&&l>=t.bottom-v&&(h.y=Ce.Forward,p.y=r*Math.abs((t.bottom-v-l)/v)),!f&&s>=t.right-g?(h.x=Ce.Forward,p.x=r*Math.abs((t.right-g-s)/g)):!d&&a<=t.left+g&&(h.x=Ce.Backward,p.x=r*Math.abs((t.left+g-a)/g)),{direction:h,speed:p}}function Ne(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function Me(e){return e.reduce(((e,t)=>B(e,ye(t))),ee)}const ke=[["x",["left","right"],function(e){return e.reduce(((e,t)=>e+we(t)),0)}],["y",["top","bottom"],function(e){return e.reduce(((e,t)=>e+xe(t)),0)}]];class je{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=ge(t),r=Me(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[e,t,o]of ke)for(const i of t)Object.defineProperty(this,i,{get:()=>{const t=o(n),a=r[e]-t;return this.rect[i]+a},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ie{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach((e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)}))},this.target=e}add(e,t,n){var r;null==(r=this.target)||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function Te(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t&&r>t.y}var Oe,_e;function Le(e){e.preventDefault()}function Ae(e){e.stopPropagation()}!function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"}(Oe||(Oe={})),function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"}(_e||(_e={}));const Be={start:[_e.Space,_e.Enter],cancel:[_e.Esc],end:[_e.Space,_e.Enter]},Pe=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case _e.Right:return{...n,x:n.x+25};case _e.Left:return{...n,x:n.x-25};case _e.Down:return{...n,y:n.y+25};case _e.Up:return{...n,y:n.y-25}}};class ze{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new Ie(N(t)),this.windowListeners=new Ie(R(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Oe.Resize,this.handleCancel),this.windowListeners.add(Oe.VisibilityChange,this.handleCancel),setTimeout((()=>this.listeners.add(Oe.Keydown,this.handleKeyDown)))}handleStart(){const{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&function(e,t){if(void 0===t&&(t=pe),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);be(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}(n),t(ee)}handleKeyDown(e){if(z(e)){const{active:t,context:n,options:r}=this.props,{keyboardCodes:o=Be,coordinateGetter:i=Pe,scrollBehavior:a="smooth"}=r,{code:s}=e;if(o.end.includes(s))return void this.handleEnd(e);if(o.cancel.includes(s))return void this.handleCancel(e);const{collisionRect:l}=n.current,c=l?{x:l.left,y:l.top}:ee;this.referenceCoordinates||(this.referenceCoordinates=c);const u=i(e,{active:t,context:n.current,currentCoordinates:c});if(u){const t=P(u,c),r={x:0,y:0},{scrollableAncestors:o}=n.current;for(const n of o){const o=e.code,{isTop:i,isRight:s,isLeft:l,isBottom:c,maxScroll:d,minScroll:f}=De(n),h=Ne(n),p={x:Math.min(o===_e.Right?h.right-h.width/2:h.right,Math.max(o===_e.Right?h.left:h.left+h.width/2,u.x)),y:Math.min(o===_e.Down?h.bottom-h.height/2:h.bottom,Math.max(o===_e.Down?h.top:h.top+h.height/2,u.y))},v=o===_e.Right&&!s||o===_e.Left&&!l,g=o===_e.Down&&!c||o===_e.Up&&!i;if(v&&p.x!==u.x){const e=n.scrollLeft+t.x,i=o===_e.Right&&e<=d.x||o===_e.Left&&e>=f.x;if(i&&!t.y)return void n.scrollTo({left:e,behavior:a});r.x=i?n.scrollLeft-e:o===_e.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:a});break}if(g&&p.y!==u.y){const e=n.scrollTop+t.y,i=o===_e.Down&&e<=d.y||o===_e.Up&&e>=f.y;if(i&&!t.x)return void n.scrollTo({top:e,behavior:a});r.y=i?n.scrollTop-e:o===_e.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:a});break}}this.handleMove(e,B(P(u,this.referenceCoordinates),r))}}}handleMove(e,t){const{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function Fe(e){return Boolean(e&&"distance"in e)}function Ue(e){return Boolean(e&&"delay"in e)}ze.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Be,onActivation:o}=t,{active:i}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const t=i.activatorNode.current;return!(t&&e.target!==t||(e.preventDefault(),null==o||o({event:e.nativeEvent}),0))}return!1}}];class Xe{constructor(e,t,n){var r;void 0===n&&(n=function(e){const{EventTarget:t}=R(e);return e instanceof t?e:N(e)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:o}=e,{target:i}=o;this.props=e,this.events=t,this.document=N(i),this.documentListeners=new Ie(this.document),this.listeners=new Ie(n),this.windowListeners=new Ie(R(i)),this.initialCoordinates=null!=(r=F(o))?r:ee,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),this.windowListeners.add(Oe.Resize,this.handleCancel),this.windowListeners.add(Oe.DragStart,Le),this.windowListeners.add(Oe.VisibilityChange,this.handleCancel),this.windowListeners.add(Oe.ContextMenu,Le),this.documentListeners.add(Oe.Keydown,this.handleKeydown),t){if(null!=n&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Ue(t))return void(this.timeoutId=setTimeout(this.handleStart,t.delay));if(Fe(t))return}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Oe.Click,Ae,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Oe.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:r,props:o}=this,{onMove:i,options:{activationConstraint:a}}=o;if(!r)return;const s=null!=(t=F(e))?t:ee,l=P(r,s);if(!n&&a){if(Fe(a)){if(null!=a.tolerance&&Te(l,a.tolerance))return this.handleCancel();if(Te(l,a.distance))return this.handleStart()}return Ue(a)&&Te(l,a.tolerance)?this.handleCancel():void 0}e.cancelable&&e.preventDefault(),i(s)}handleEnd(){const{onEnd:e}=this.props;this.detach(),e()}handleCancel(){const{onCancel:e}=this.props;this.detach(),e()}handleKeydown(e){e.code===_e.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const Ye={move:{name:"pointermove"},end:{name:"pointerup"}};class Ke extends Xe{constructor(e){const{event:t}=e,n=N(t.target);super(e,Ye,n)}}Ke.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!(!n.isPrimary||0!==n.button||(null==r||r({event:n}),0))}}];const We={move:{name:"mousemove"},end:{name:"mouseup"}};var qe;!function(e){e[e.RightClick=2]="RightClick"}(qe||(qe={})),class extends Xe{constructor(e){super(e,We,N(e.event.target))}}.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==qe.RightClick&&(null==r||r({event:n}),!0)}}];const He={move:{name:"touchmove"},end:{name:"touchend"}};var Je,Ve;(class extends Xe{constructor(e){super(e,He)}static setup(){return window.addEventListener(He.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(He.move.name,e)};function e(){}}}).activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return!(o.length>1||(null==r||r({event:n}),0))}}],function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"}(Je||(Je={})),function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"}(Ve||(Ve={}));const $e={x:{[Ce.Backward]:!1,[Ce.Forward]:!1},y:{[Ce.Backward]:!1,[Ce.Forward]:!1}};var Ge,Qe;!function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"}(Ge||(Ge={})),function(e){e.Optimized="optimized"}(Qe||(Qe={}));const Ze=new Map;function et(e,t){return I((n=>e?n||("function"==typeof t?t(e):e):null),[t,e])}function tt(e){let{callback:t,disabled:n}=e;const r=k(t),o=(0,b.useMemo)((()=>{if(n||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(r)}),[n]);return(0,b.useEffect)((()=>()=>null==o?void 0:o.disconnect()),[o]),o}function nt(e){return new je(pe(e),e)}function rt(e,t,n){void 0===t&&(t=nt);const[r,o]=(0,b.useReducer)((function(r){if(!e)return null;var o;if(!1===e.isConnected)return null!=(o=null!=r?r:n)?o:null;const i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i}),null),i=function(e){let{callback:t,disabled:n}=e;const r=k(t),o=(0,b.useMemo)((()=>{if(n||"undefined"==typeof window||void 0===window.MutationObserver)return;const{MutationObserver:e}=window;return new e(r)}),[r,n]);return(0,b.useEffect)((()=>()=>null==o?void 0:o.disconnect()),[o]),o}({callback(t){if(e)for(const n of t){const{type:t,target:r}=n;if("childList"===t&&r instanceof HTMLElement&&r.contains(e)){o();break}}}}),a=tt({callback:o});return M((()=>{o(),e?(null==a||a.observe(e),null==i||i.observe(document.body,{childList:!0,subtree:!0})):(null==a||a.disconnect(),null==i||i.disconnect())}),[e]),r}const ot=[];function it(e,t){void 0===t&&(t=[]);const n=(0,b.useRef)(null);return(0,b.useEffect)((()=>{n.current=null}),t),(0,b.useEffect)((()=>{const t=e!==ee;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)}),[e]),n.current?P(e,n.current):ee}function at(e){return(0,b.useMemo)((()=>e?function(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}(e):null),[e])}const st=[];const lt=[{sensor:Ke,options:{}},{sensor:ze,options:{}}],ct={current:{}},ut={draggable:{measure:ve},droppable:{measure:ve,strategy:Ge.WhileDragging,frequency:Qe.Optimized},dragOverlay:{measure:pe}};class dt extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter((e=>{let{disabled:t}=e;return!t}))}getNodeFor(e){var t,n;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}const ft={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new dt,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Q},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ut,measureDroppableContainers:Q,windowRect:null,measuringScheduled:!1},ht={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Q,draggableNodes:new Map,over:null,measureDroppableContainers:Q},pt=(0,b.createContext)(ht),vt=(0,b.createContext)(ft);function gt(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new dt}}}function bt(e,t){switch(t.type){case G.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case G.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case G.DragEnd:case G.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case G.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new dt(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case G.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const a=new dt(e.droppable.containers);return a.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case G.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new dt(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function mt(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=(0,b.useContext)(pt),i=O(r),a=O(null==n?void 0:n.id);return(0,b.useEffect)((()=>{if(!t&&!r&&i&&null!=a){if(!z(i))return;if(document.activeElement===i.target)return;const e=o.get(a);if(!e)return;const{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame((()=>{for(const e of[t.current,n.current]){if(!e)continue;const t=Y(e);if(t){t.focus();break}}}))}}),[r,t,o,a,i]),null}const wt=(0,b.createContext)({...ee,scaleX:1,scaleY:1});var xt;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"}(xt||(xt={}));const yt=(0,b.memo)((function(e){var t,n,r,o;let{id:i,accessibility:a,autoScroll:s=!0,children:l,sensors:c=lt,collisionDetection:u=ce,measuring:d,modifiers:f,...h}=e;const p=(0,b.useReducer)(bt,void 0,gt),[v,g]=p,[y,C]=function(){const[e]=(0,b.useState)((()=>new Set)),t=(0,b.useCallback)((t=>(e.add(t),()=>e.delete(t))),[e]);return[(0,b.useCallback)((t=>{let{type:n,event:r}=t;e.forEach((e=>{var t;return null==(t=e[n])?void 0:t.call(e,r)}))}),[e]),t]}(),[D,E]=(0,b.useState)(xt.Uninitialized),N=D===xt.Initialized,{draggable:{active:k,nodes:_,translate:A},droppable:{containers:P}}=v,z=k?_.get(k):null,U=(0,b.useRef)({initial:null,translated:null}),X=(0,b.useMemo)((()=>{var e;return null!=k?{id:k,data:null!=(e=null==z?void 0:z.data)?e:ct,rect:U}:null}),[k,z]),Y=(0,b.useRef)(null),[K,W]=(0,b.useState)(null),[q,J]=(0,b.useState)(null),V=j(h,Object.values(h)),Q=L("DndDescribedBy",i),Z=(0,b.useMemo)((()=>P.getEnabled()),[P]),te=(ne=d,(0,b.useMemo)((()=>({draggable:{...ut.draggable,...null==ne?void 0:ne.draggable},droppable:{...ut.droppable,...null==ne?void 0:ne.droppable},dragOverlay:{...ut.dragOverlay,...null==ne?void 0:ne.dragOverlay}})),[null==ne?void 0:ne.draggable,null==ne?void 0:ne.droppable,null==ne?void 0:ne.dragOverlay]));var ne;const{droppableRects:re,measureDroppableContainers:oe,measuringScheduled:ae}=function(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,a]=(0,b.useState)(null),{frequency:s,measure:l,strategy:c}=o,u=(0,b.useRef)(e),d=function(){switch(c){case Ge.Always:return!1;case Ge.BeforeDragging:return n;default:return!n}}(),f=j(d),h=(0,b.useCallback)((function(e){void 0===e&&(e=[]),f.current||a((t=>null===t?e:t.concat(e.filter((e=>!t.includes(e))))))}),[f]),p=(0,b.useRef)(null),v=I((t=>{if(d&&!n)return Ze;if(!t||t===Ze||u.current!==e||null!=i){const t=new Map;for(let n of e){if(!n)continue;if(i&&i.length>0&&!i.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}const e=n.node.current,r=e?new je(l(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t}),[e,i,n,d,l]);return(0,b.useEffect)((()=>{u.current=e}),[e]),(0,b.useEffect)((()=>{d||h()}),[n,d]),(0,b.useEffect)((()=>{i&&i.length>0&&a(null)}),[JSON.stringify(i)]),(0,b.useEffect)((()=>{d||"number"!=typeof s||null!==p.current||(p.current=setTimeout((()=>{h(),p.current=null}),s))}),[s,d,h,...r]),{droppableRects:v,measureDroppableContainers:h,measuringScheduled:null!=i}}(Z,{dragging:N,dependencies:[A.x,A.y],config:te.droppable}),se=function(e,t){const n=null!==t?e.get(t):void 0,r=n?n.node.current:null;return I((e=>{var n;return null===t?null:null!=(n=null!=r?r:e)?n:null}),[r,t])}(_,k),le=(0,b.useMemo)((()=>q?F(q):null),[q]),de=function(){const e=!1===(null==K?void 0:K.autoScrollEnabled),t="object"==typeof s?!1===s.enabled:!1===s,n=N&&!e&&!t;return"object"==typeof s?{...s,enabled:n}:{enabled:n}}(),he=function(e,t){return et(e,t)}(se,te.draggable.measure);!function(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=(0,b.useRef)(!1),{x:a,y:s}="boolean"==typeof o?{x:o,y:o}:o;M((()=>{if(!a&&!s||!t)return void(i.current=!1);if(i.current||!r)return;const e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;const o=ue(n(e),r);if(a||(o.x=0),s||(o.y=0),i.current=!0,Math.abs(o.x)>0||Math.abs(o.y)>0){const t=be(e);t&&t.scrollBy({top:o.y,left:o.x})}}),[t,a,s,r,n])}({activeNode:k?_.get(k):null,config:de.layoutShiftCompensation,initialRect:he,measure:te.draggable.measure});const ve=rt(se,te.draggable.measure,he),we=rt(se?se.parentElement:null),xe=(0,b.useRef)({activatorEvent:null,active:null,activeNode:se,collisionRect:null,collisions:null,droppableRects:re,draggableNodes:_,draggingNode:null,draggingNodeRect:null,droppableContainers:P,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),De=P.getNodeFor(null==(t=xe.current.over)?void 0:t.id),Se=function(e){let{measure:t}=e;const[n,r]=(0,b.useState)(null),o=tt({callback:(0,b.useCallback)((e=>{for(const{target:n}of e)if(S(n)){r((e=>{const r=t(n);return e?{...e,width:r.width,height:r.height}:r}));break}}),[t])}),i=(0,b.useCallback)((e=>{const n=function(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return S(t)?t:e}(e);null==o||o.disconnect(),n&&(null==o||o.observe(n)),r(n?t(n):null)}),[t,o]),[a,s]=T(i);return(0,b.useMemo)((()=>({nodeRef:a,rect:n,setRef:s})),[n,a,s])}({measure:te.dragOverlay.measure}),Ne=null!=(n=Se.nodeRef.current)?n:se,ke=N?null!=(r=Se.rect)?r:ve:null,Ie=Boolean(Se.nodeRef.current&&Se.rect),Te=ue(Oe=Ie?null:ve,et(Oe));var Oe;const _e=at(Ne?R(Ne):null),Le=function(e){const t=(0,b.useRef)(e),n=I((n=>e?n&&n!==ot&&e&&t.current&&e.parentNode===t.current.parentNode?n:ge(e):ot),[e]);return(0,b.useEffect)((()=>{t.current=e}),[e]),n}(N?null!=De?De:se:null),Ae=function(e,t){void 0===t&&(t=pe);const[n]=e,r=at(n?R(n):null),[o,i]=(0,b.useReducer)((function(){return e.length?e.map((e=>Re(e)?r:new je(t(e),e))):st}),st),a=tt({callback:i});return e.length>0&&o===st&&i(),M((()=>{e.length?e.forEach((e=>null==a?void 0:a.observe(e))):(null==a||a.disconnect(),i())}),[e]),o}(Le),Be=function(e,t){let{transform:n,...r}=t;return null!=e&&e.length?e.reduce(((e,t)=>t({transform:e,...r})),n):n}(f,{transform:{x:A.x-Te.x,y:A.y-Te.y,scaleX:1,scaleY:1},activatorEvent:q,active:X,activeNodeRect:ve,containerNodeRect:we,draggingNodeRect:ke,over:xe.current.over,overlayNodeRect:Se.rect,scrollableAncestors:Le,scrollableAncestorRects:Ae,windowRect:_e}),Pe=le?B(le,A):null,ze=function(e){const[t,n]=(0,b.useState)(null),r=(0,b.useRef)(e),o=(0,b.useCallback)((e=>{const t=me(e.target);t&&n((e=>e?(e.set(t,ye(t)),new Map(e)):null))}),[]);return(0,b.useEffect)((()=>{const t=r.current;if(e!==t){i(t);const a=e.map((e=>{const t=me(e);return t?(t.addEventListener("scroll",o,{passive:!0}),[t,ye(t)]):null})).filter((e=>null!=e));n(a.length?new Map(a):null),r.current=e}return()=>{i(e),i(t)};function i(e){e.forEach((e=>{const t=me(e);null==t||t.removeEventListener("scroll",o)}))}}),[o,e]),(0,b.useMemo)((()=>e.length?t?Array.from(t.values()).reduce(((e,t)=>B(e,t)),ee):Me(e):ee),[e,t])}(Le),Fe=it(ze),Ue=it(ze,[ve]),Xe=B(Be,Fe),Ye=ke?fe(ke,Be):null,Ke=X&&Ye?u({active:X,collisionRect:Ye,droppableRects:re,droppableContainers:Z,pointerCoordinates:Pe}):null,We=ie(Ke,"id"),[qe,He]=(0,b.useState)(null),Qe=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(Ie?Be:B(Be,Ue),null!=(o=null==qe?void 0:qe.rect)?o:null,ve),nt=(0,b.useCallback)(((e,t)=>{let{sensor:n,options:r}=t;if(null==Y.current)return;const o=_.get(Y.current);if(!o)return;const i=e.nativeEvent,a=new n({active:Y.current,activeNode:o,event:i,options:r,context:xe,onStart(e){const t=Y.current;if(null==t)return;const n=_.get(t);if(!n)return;const{onDragStart:r}=V.current,o={active:{id:t,data:n.data,rect:U}};(0,w.unstable_batchedUpdates)((()=>{null==r||r(o),E(xt.Initializing),g({type:G.DragStart,initialCoordinates:e,active:t}),y({type:"onDragStart",event:o})}))},onMove(e){g({type:G.DragMove,coordinates:e})},onEnd:s(G.DragEnd),onCancel:s(G.DragCancel)});function s(e){return async function(){const{active:t,collisions:n,over:r,scrollAdjustedTranslate:o}=xe.current;let a=null;if(t&&o){const{cancelDrop:s}=V.current;a={activatorEvent:i,active:t,collisions:n,delta:o,over:r},e===G.DragEnd&&"function"==typeof s&&await Promise.resolve(s(a))&&(e=G.DragCancel)}Y.current=null,(0,w.unstable_batchedUpdates)((()=>{g({type:e}),E(xt.Uninitialized),He(null),W(null),J(null);const t=e===G.DragEnd?"onDragEnd":"onDragCancel";if(a){const e=V.current[t];null==e||e(a),y({type:t,event:a})}}))}}(0,w.unstable_batchedUpdates)((()=>{W(a),J(e.nativeEvent)}))}),[_]),dt=(0,b.useCallback)(((e,t)=>(n,r)=>{const o=n.nativeEvent,i=_.get(r);if(null!==Y.current||!i||o.dndKit||o.defaultPrevented)return;const a={active:i};!0===e(n,t.options,a)&&(o.dndKit={capturedBy:t.sensor},Y.current=r,nt(n,t))}),[_,nt]),ft=function(e,t){return(0,b.useMemo)((()=>e.reduce(((e,n)=>{const{sensor:r}=n;return[...e,...r.activators.map((e=>({eventName:e.eventName,handler:t(e.handler,n)})))]}),[])),[e,t])}(c,dt);!function(e){(0,b.useEffect)((()=>{if(!x)return;const t=e.map((e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()}));return()=>{for(const e of t)null==e||e()}}),e.map((e=>{let{sensor:t}=e;return t})))}(c),M((()=>{ve&&D===xt.Initializing&&E(xt.Initialized)}),[ve,D]),(0,b.useEffect)((()=>{const{onDragMove:e}=V.current,{active:t,activatorEvent:n,collisions:r,over:o}=xe.current;if(!t||!n)return;const i={active:t,activatorEvent:n,collisions:r,delta:{x:Xe.x,y:Xe.y},over:o};(0,w.unstable_batchedUpdates)((()=>{null==e||e(i),y({type:"onDragMove",event:i})}))}),[Xe.x,Xe.y]),(0,b.useEffect)((()=>{const{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:o}=xe.current;if(!e||null==Y.current||!t||!o)return;const{onDragOver:i}=V.current,a=r.get(We),s=a&&a.rect.current?{id:a.id,rect:a.rect.current,data:a.data,disabled:a.disabled}:null,l={active:e,activatorEvent:t,collisions:n,delta:{x:o.x,y:o.y},over:s};(0,w.unstable_batchedUpdates)((()=>{He(s),null==i||i(l),y({type:"onDragOver",event:l})}))}),[We]),M((()=>{xe.current={activatorEvent:q,active:X,activeNode:se,collisionRect:Ye,collisions:Ke,droppableRects:re,draggableNodes:_,draggingNode:Ne,draggingNodeRect:ke,droppableContainers:P,over:qe,scrollableAncestors:Le,scrollAdjustedTranslate:Xe},U.current={initial:ke,translated:Ye}}),[X,se,Ke,Ye,_,Ne,ke,re,P,qe,Le,Xe]),function(e){let{acceleration:t,activator:n=Je.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:a=5,order:s=Ve.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:d,threshold:f}=e;const h=function(e){let{delta:t,disabled:n}=e;const r=O(t);return I((e=>{if(n||!r||!e)return $e;const o=Math.sign(t.x-r.x),i=Math.sign(t.y-r.y);return{x:{[Ce.Backward]:e.x[Ce.Backward]||-1===o,[Ce.Forward]:e.x[Ce.Forward]||1===o},y:{[Ce.Backward]:e.y[Ce.Backward]||-1===i,[Ce.Forward]:e.y[Ce.Forward]||1===i}}}),[n,t,r])}({delta:d,disabled:!i}),[p,v]=function(){const e=(0,b.useRef)(null);return[(0,b.useCallback)(((t,n)=>{e.current=setInterval(t,n)}),[]),(0,b.useCallback)((()=>{null!==e.current&&(clearInterval(e.current),e.current=null)}),[])]}(),g=(0,b.useRef)({x:0,y:0}),m=(0,b.useRef)({x:0,y:0}),w=(0,b.useMemo)((()=>{switch(n){case Je.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Je.DraggableRect:return o}}),[n,o,l]),x=(0,b.useRef)(null),y=(0,b.useCallback)((()=>{const e=x.current;if(!e)return;const t=g.current.x*m.current.x,n=g.current.y*m.current.y;e.scrollBy(t,n)}),[]),C=(0,b.useMemo)((()=>s===Ve.TreeOrder?[...c].reverse():c),[s,c]);(0,b.useEffect)((()=>{if(i&&c.length&&w){for(const e of C){if(!1===(null==r?void 0:r(e)))continue;const n=c.indexOf(e),o=u[n];if(!o)continue;const{direction:i,speed:s}=Ee(e,o,w,t,f);for(const e of["x","y"])h[e][i[e]]||(s[e]=0,i[e]=0);if(s.x>0||s.y>0)return v(),x.current=e,p(y,a),g.current=s,void(m.current=i)}g.current={x:0,y:0},m.current={x:0,y:0},v()}else v()}),[t,y,r,v,i,a,JSON.stringify(w),JSON.stringify(h),p,c,C,u,JSON.stringify(f)])}({...de,delta:A,draggingRect:Ye,pointerCoordinates:Pe,scrollableAncestors:Le,scrollableAncestorRects:Ae});const ht=(0,b.useMemo)((()=>({active:X,activeNode:se,activeNodeRect:ve,activatorEvent:q,collisions:Ke,containerNodeRect:we,dragOverlay:Se,draggableNodes:_,droppableContainers:P,droppableRects:re,over:qe,measureDroppableContainers:oe,scrollableAncestors:Le,scrollableAncestorRects:Ae,measuringConfiguration:te,measuringScheduled:ae,windowRect:_e})),[X,se,ve,q,Ke,we,Se,_,P,re,qe,oe,Le,Ae,te,ae,_e]),yt=(0,b.useMemo)((()=>({activatorEvent:q,activators:ft,active:X,activeNodeRect:ve,ariaDescribedById:{draggable:Q},dispatch:g,draggableNodes:_,over:qe,measureDroppableContainers:oe})),[q,ft,X,ve,g,Q,_,qe,oe]);return m().createElement(H.Provider,{value:C},m().createElement(pt.Provider,{value:yt},m().createElement(vt.Provider,{value:ht},m().createElement(wt.Provider,{value:Qe},l)),m().createElement(mt,{disabled:!1===(null==a?void 0:a.restoreFocus)})),m().createElement($,{...a,hiddenTextDescribedById:Q}))})),Ct=(0,b.createContext)(null),Rt="button",Dt="Droppable";const St={timeout:25};function Et(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Nt(e,t){return e.reduce(((e,n,r)=>{const o=t.get(n);return o&&(e[r]=o),e}),Array(e.length))}function Mt(e){return null!==e&&e>=0}const kt=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=Et(t,r,n),a=t[o],s=i[o];return s&&a?{x:s.left-a.left,y:s.top-a.top,scaleX:s.width/a.width,scaleY:s.height/a.height}:null},jt={scaleX:1,scaleY:1},It=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:a}=e;const s=null!=(t=i[n])?t:r;if(!s)return null;if(o===n){const e=i[a];return e?{x:0,y:nn&&o<=a?{x:0,y:-s.height-l,...jt}:o=a?{x:0,y:s.height+l,...jt}:{x:0,y:0,...jt}},Tt="Sortable",Ot=m().createContext({activeIndex:-1,containerId:Tt,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:kt,disabled:{draggable:!1,droppable:!1}});function _t(e){let{children:t,id:n,items:r,strategy:o=kt,disabled:i=!1}=e;const{active:a,dragOverlay:s,droppableRects:l,over:c,measureDroppableContainers:u}=(0,b.useContext)(vt),d=L(Tt,n),f=Boolean(null!==s.rect),h=(0,b.useMemo)((()=>r.map((e=>"object"==typeof e&&"id"in e?e.id:e))),[r]),p=null!=a,v=a?h.indexOf(a.id):-1,g=c?h.indexOf(c.id):-1,w=(0,b.useRef)(h),x=!function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n{x&&p&&u(h)}),[x,h,p,u]),(0,b.useEffect)((()=>{w.current=h}),[h]);const R=(0,b.useMemo)((()=>({activeIndex:v,containerId:d,disabled:C,disableTransforms:y,items:h,overIndex:g,useDragOverlay:f,sortedRects:Nt(h,l),strategy:o})),[v,d,C.draggable,C.droppable,y,h,g,l,f,o]);return m().createElement(Ot.Provider,{value:R},t)}const Lt=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return Et(n,r,o).indexOf(t)},At=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:a,previousItems:s,previousContainerId:l,transition:c}=e;return!(!c||!r||s!==i&&o===a||!n&&(a===o||t!==l))},Bt={duration:200,easing:"ease"},Pt="transform",zt=U.Transition.toString({property:Pt,duration:0,easing:"linear"}),Ft={roleDescription:"sortable"};function Ut(e){let{animateLayoutChanges:t=At,attributes:n,disabled:r,data:o,getNewIndex:i=Lt,id:a,strategy:s,resizeObserverConfig:l,transition:c=Bt}=e;const{items:u,containerId:d,activeIndex:f,disabled:h,disableTransforms:p,sortedRects:v,overIndex:g,useDragOverlay:m,strategy:w}=(0,b.useContext)(Ot),x=function(e,t){var n,r;return"boolean"==typeof e?{draggable:e,droppable:!1}:{draggable:null!=(n=null==e?void 0:e.draggable)?n:t.draggable,droppable:null!=(r=null==e?void 0:e.droppable)?r:t.droppable}}(r,h),y=u.indexOf(a),C=(0,b.useMemo)((()=>({sortable:{containerId:d,index:y,items:u},...o})),[d,o,y,u]),R=(0,b.useMemo)((()=>u.slice(u.indexOf(a))),[u,a]),{rect:D,node:S,isOver:E,setNodeRef:N}=function(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=L("Droppable"),{active:a,dispatch:s,over:l,measureDroppableContainers:c}=(0,b.useContext)(pt),u=(0,b.useRef)({disabled:n}),d=(0,b.useRef)(!1),f=(0,b.useRef)(null),h=(0,b.useRef)(null),{disabled:p,updateMeasurementsFor:v,timeout:g}={...St,...o},m=j(null!=v?v:r),w=tt({callback:(0,b.useCallback)((()=>{d.current?(null!=h.current&&clearTimeout(h.current),h.current=setTimeout((()=>{c(Array.isArray(m.current)?m.current:[m.current]),h.current=null}),g)):d.current=!0}),[g]),disabled:p||!a}),x=(0,b.useCallback)(((e,t)=>{w&&(t&&(w.unobserve(t),d.current=!1),e&&w.observe(e))}),[w]),[y,C]=T(x),R=j(t);return(0,b.useEffect)((()=>{w&&y.current&&(w.disconnect(),d.current=!1,w.observe(y.current))}),[y,w]),M((()=>(s({type:G.RegisterDroppable,element:{id:r,key:i,disabled:n,node:y,rect:f,data:R}}),()=>s({type:G.UnregisterDroppable,key:i,id:r}))),[r]),(0,b.useEffect)((()=>{n!==u.current.disabled&&(s({type:G.SetDroppableDisabled,id:r,key:i,disabled:n}),u.current.disabled=n)}),[r,i,n,s]),{active:a,rect:f,isOver:(null==l?void 0:l.id)===r,node:y,over:l,setNodeRef:C}}({id:a,data:C,disabled:x.droppable,resizeObserverConfig:{updateMeasurementsFor:R,...l}}),{active:k,activatorEvent:I,activeNodeRect:O,attributes:_,setNodeRef:A,listeners:B,isDragging:P,over:F,setActivatorNodeRef:X,transform:Y}=function(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=L(Dt),{activators:a,activatorEvent:s,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:d,over:f}=(0,b.useContext)(pt),{role:h=Rt,roleDescription:p="draggable",tabIndex:v=0}=null!=o?o:{},g=(null==l?void 0:l.id)===t,m=(0,b.useContext)(g?wt:Ct),[w,x]=T(),[y,C]=T(),R=function(e,t){return(0,b.useMemo)((()=>e.reduce(((e,n)=>{let{eventName:r,handler:o}=n;return e[r]=e=>{o(e,t)},e}),{})),[e,t])}(a,t),D=j(n);return M((()=>(d.set(t,{id:t,key:i,node:w,activatorNode:y,data:D}),()=>{const e=d.get(t);e&&e.key===i&&d.delete(t)})),[d,t]),{active:l,activatorEvent:s,activeNodeRect:c,attributes:(0,b.useMemo)((()=>({role:h,tabIndex:v,"aria-disabled":r,"aria-pressed":!(!g||h!==Rt)||void 0,"aria-roledescription":p,"aria-describedby":u.draggable})),[r,h,v,g,p,u.draggable]),isDragging:g,listeners:r?void 0:R,node:w,over:f,setNodeRef:x,setActivatorNodeRef:C,transform:m}}({id:a,data:C,attributes:{...Ft,...n},disabled:x.draggable}),K=function(){for(var e=arguments.length,t=new Array(e),n=0;ne=>{t.forEach((t=>t(e)))}),t)}(N,A),W=Boolean(k),q=W&&!p&&Mt(f)&&Mt(g),H=!m&&P,J=H&&q?Y:null,V=q?null!=J?J:(null!=s?s:w)({rects:v,activeNodeRect:O,activeIndex:f,overIndex:g,index:y}):null,$=Mt(f)&&Mt(g)?i({id:a,items:u,activeIndex:f,overIndex:g}):y,Q=null==k?void 0:k.id,Z=(0,b.useRef)({activeId:Q,items:u,newIndex:$,containerId:d}),ee=u!==Z.current.items,te=t({active:k,containerId:d,isDragging:P,isSorting:W,id:a,index:y,items:u,newIndex:Z.current.newIndex,previousItems:Z.current.items,previousContainerId:Z.current.containerId,transition:c,wasDragging:null!=Z.current.activeId}),ne=function(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,a]=(0,b.useState)(null),s=(0,b.useRef)(n);return M((()=>{if(!t&&n!==s.current&&r.current){const e=o.current;if(e){const t=pe(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&a(n)}}n!==s.current&&(s.current=n)}),[t,n,r,o]),(0,b.useEffect)((()=>{i&&a(null)}),[i]),i}({disabled:!te,index:y,node:S,rect:D});return(0,b.useEffect)((()=>{W&&Z.current.newIndex!==$&&(Z.current.newIndex=$),d!==Z.current.containerId&&(Z.current.containerId=d),u!==Z.current.items&&(Z.current.items=u)}),[W,$,d,u]),(0,b.useEffect)((()=>{if(Q===Z.current.activeId)return;if(Q&&!Z.current.activeId)return void(Z.current.activeId=Q);const e=setTimeout((()=>{Z.current.activeId=Q}),50);return()=>clearTimeout(e)}),[Q]),{active:k,activeIndex:f,attributes:_,data:C,rect:D,index:y,newIndex:$,items:u,isOver:E,isSorting:W,isDragging:P,listeners:B,node:S,overIndex:g,over:F,setNodeRef:K,setActivatorNodeRef:X,setDroppableNodeRef:N,setDraggableNodeRef:A,transform:null!=ne?ne:V,transition:ne||ee&&Z.current.newIndex===y?zt:H&&!z(I)||!c?void 0:W||te?U.Transition.toString({...c,property:Pt}):void 0}}function Xt(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&"object"==typeof t.sortable&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const Yt=[_e.Down,_e.Right,_e.Up,_e.Left],Kt=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:i,over:a,scrollableAncestors:s}}=t;if(Yt.includes(e.code)){if(e.preventDefault(),!n||!r)return;const t=[];i.getEnabled().forEach((n=>{if(!n||null!=n&&n.disabled)return;const i=o.get(n.id);if(i)switch(e.code){case _e.Down:r.topi.top&&t.push(n);break;case _e.Left:r.left>i.left&&t.push(n);break;case _e.Right:r.left{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=oe(t),i=[];for(const e of r){const{id:t}=e,r=n.get(t);if(r){const n=oe(r),a=o.reduce(((e,t,r)=>e+te(n[r],t)),0),s=Number((a/4).toFixed(4));i.push({id:t,data:{droppableContainer:e,value:s}})}}return i.sort(ne)})({active:n,collisionRect:r,droppableRects:o,droppableContainers:t,pointerCoordinates:null});let c=ie(l,"id");if(c===(null==a?void 0:a.id)&&l.length>1&&(c=l[1].id),null!=c){const e=i.get(n.id),t=i.get(c),a=t?o.get(t.id):null,l=null==t?void 0:t.node.current;if(l&&a&&e&&t){const n=ge(l).some(((e,t)=>s[t]!==e)),o=Wt(e,t),i=function(e,t){return!(!Xt(e)||!Xt(t))&&(!!Wt(e,t)&&e.data.current.sortable.index{const{attributes:i,listeners:a,setNodeRef:s,transform:l,transition:c}=Ut({id:e}),u={transform:U.Transform.toString({x:0,y:l?.y,scaleX:1,scaleY:1}),transition:c};return(0,o.jsxs)("div",{className:"wpbt-sortable-posts-control__sortable-item",ref:s,style:u,children:[(0,o.jsx)("span",{...i,...a,children:t.label}),!r&&(0,o.jsx)("div",{className:"wpbt-sortable-posts-control__sortable-remove",onClick:()=>n(t)})]})},Ht=({items:e,onChange:t,onItemRemove:n})=>{const[r,i]=(0,s.useState)(!1),a=function(){for(var e=arguments.length,t=new Array(e),n=0;n[...t].filter((e=>null!=e))),[...t])}(Z(Ke),Z(ze,{coordinateGetter:Kt}));return(0,o.jsx)("div",{className:"wpbt-sortable-posts-control__list",children:(0,o.jsx)(yt,{sensors:a,collisionDetection:se,onDragStart:e=>{i(!0)},onDragEnd:n=>{i(!1);const{active:r,over:o}=n;if(r.id!==o.id){const n=e.map((e=>e.value)),i=n.indexOf(r.id),a=n.indexOf(o.id),s=Et(n,i,a);t(s)}},children:(0,o.jsx)(_t,{items:e,strategy:It,children:(0,o.jsx)("div",{className:"wpbt-sortable-posts-control__sortable-list",children:e.map(((e,t)=>(0,o.jsx)(qt,{id:e.value,index:t,value:e,onRemove:n,isDragging:r},`item-${e.value}`)))})})})})},Jt=({label:e,posts:n,value:r,onChange:i})=>{const{textdomain:c}=v,[u,d]=(0,s.useState)([]),[h,p]=(0,s.useState)([]),[g,b]=(0,s.useState)("");if((0,s.useEffect)((()=>{n&&d(n.map(l))}),[n]),(0,s.useEffect)((()=>{const e=g?u.filter((e=>e.label.toLowerCase().includes(g.toLowerCase()))):u;p(e)}),[u,g]),null===n)return(0,o.jsx)(a.Spinner,{});if(!u||!u.length)return null;const m=r.reduce(((e,t)=>{const n=u.find((e=>e.value===t));return n&&e.push(n),e}),[]);return(0,o.jsxs)(a.BaseControl,{label:e,className:"wpbt-sortable-posts-control",children:[(0,o.jsx)("h4",{className:"wpbt-sortable-posts-control__subtitle",children:(0,f.__)("Select posts",c)}),(0,o.jsx)("input",{type:"text",placeholder:(0,f.__)("Search",c),value:g,onChange:e=>b(e.target.value),className:"wpbt-sortable-posts-control__search"}),(0,o.jsx)("div",{className:"wpbt-sortable-posts-control__list",children:h.map(((e,n)=>{const a=r.find((t=>t===e.value)),s=t()("wpbt-sortable-posts-control__option",{"is-selected":a});return(0,o.jsx)("button",{onClick:()=>((e,t)=>{i(t?r.filter((t=>t!==e.value)):[...r,e.value])})(e,a),className:s,children:e.label},n)}))}),(0,o.jsx)("h4",{className:"wpbt-sortable-posts-control__subtitle",children:(0,f.__)("Select order",c)}),(0,o.jsx)(Ht,{items:m,onChange:e=>{i(e)},onItemRemove:e=>{i(r.filter((t=>t!==e.value)))}})]})},Vt=({slug:e,label:t,value:n,onChange:r})=>{const[i,l]=(0,s.useState)([]),[u,d]=(0,s.useState)(""),p=i.length>0,g=(0,h.useSelect)((t=>t("core").getEntityRecords("taxonomy",e,{per_page:-1})),[e]),b=null===g;(0,s.useEffect)((()=>{if(g){const e=g.reduce(((e,t)=>{const n=t.parent||0;return e[n]=[...e[n]||[],t],e}),{}),t=n=>({...n,children:e[n.id]?e[n.id].map(t):[]});if(e[0]){const n=e[0].map(t);l(n)}}}),[g]);const m=(e,t)=>{r(t?[...n,e]:n.filter((t=>t!==e)))},w=({name:e})=>e.toLowerCase().includes(u.toLowerCase()),x=e=>{const t=[];return e.forEach((e=>{(w(e)||e.children.some(w))&&t.push({...e,children:x(e.children)})})),t};return(0,o.jsxs)(a.BaseControl,{label:c(t,n?.length),children:[(0,o.jsx)(Gt,{value:u,onChange:e=>d(e.target.value)}),!b&&n.length>0&&(0,o.jsx)("div",{className:"wbpt-tag-list",children:n.map((e=>(0,o.jsx)(Qt,{id:e,label:g.find((t=>t.id===e))?.name,onClick:()=>m(e,!1)},e)))}),(0,o.jsx)(Zt,{children:b?(0,o.jsx)(a.Spinner,{}):p?(0,o.jsx)($t,{data:u?x(i):i,value:n,onCheckboxClick:m}):(0,o.jsx)("p",{children:(0,f.__)(`No taxonomies of type "${e}" found.`,v?.textdomain)})})]})},$t=({data:e,value:t,onCheckboxClick:n})=>(0,o.jsx)("ul",{children:e.map((e=>(0,o.jsxs)("li",{children:[(0,o.jsx)(a.CheckboxControl,{label:(0,o.jsx)(s.RawHTML,{children:e.name}),checked:t.includes(e.id),onChange:t=>n(e.id,t)},e.id),e.children&&(0,o.jsx)($t,{data:e.children,value:t,onCheckboxClick:n})]},e.id)))}),Gt=({value:e,onChange:t})=>(0,o.jsx)("div",{className:"wpbt-search-input",children:(0,o.jsx)("input",{type:"text",placeholder:(0,f.__)("Search",v?.textdomain),value:e,onChange:t})}),Qt=({id:e,label:t,onClick:n})=>(0,o.jsx)("button",{onClick:n,className:"wbpt-removable-tag",children:(0,o.jsx)(s.RawHTML,{children:t})},e),Zt=({children:e})=>(0,o.jsx)("div",{className:"wpbt-checkbox-wrapper",children:e});function en(e,t){return e===t}function tn(e,t){return t}const nn=window.wp.primitives,rn=(0,o.jsx)(nn.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,o.jsx)(nn.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"})});function on(e,t){return(0,h.useSelect)((n=>t?n("core").getEntityRecord("postType",e,t):null),[t])}function an({postType:e="post",postStatus:t="publish",search:n="",minimumLength:r=3,perPage:o=20}){return(0,h.useSelect)((i=>n.length{const r=null===e,i=e&&e.length>0,s=t.length>0,l=t.length>=3;return s?r?(0,o.jsx)("div",{className:"wpbt-post-search-control__spinner",children:(0,o.jsx)(a.Spinner,{})}):i?e.map(n):l?(0,o.jsx)("p",{children:(0,f.__)("No posts were found with your search.",sn)}):(0,o.jsx)("p",{children:(0,f.__)("Your search needs to be at least 3 characters long.",sn)}):null},cn=({type:e="post",status:t="publish",value:n=0,onChange:r,placeholder:i=(0,f.__)("Search",sn),label:l=(0,f.__)("Select a post",sn),inputProps:c={},filterResults:u=null,numOfInitialResults:d=20,...h})=>{const[p,v]=(0,s.useState)(!1),[g,m]=(0,s.useState)(""),[w]=(M=g,j=en,I=(0,b.useReducer)(tn,M),T=I[0],O=I[1],_=function(e,t,n){var r=this,o=(0,b.useRef)(null),i=(0,b.useRef)(0),a=(0,b.useRef)(null),s=(0,b.useRef)([]),l=(0,b.useRef)(),c=(0,b.useRef)(),u=(0,b.useRef)(e),d=(0,b.useRef)(!0);u.current=e;var f="undefined"!=typeof window,h=!t&&0!==t&&f;if("function"!=typeof e)throw new TypeError("Expected a function");t=+t||0;var p=!!(n=n||{}).leading,v=!("trailing"in n)||!!n.trailing,g="maxWait"in n,m="debounceOnServer"in n&&!!n.debounceOnServer,w=g?Math.max(+n.maxWait||0,t):null;(0,b.useEffect)((function(){return d.current=!0,function(){d.current=!1}}),[]);var x=(0,b.useMemo)((function(){var e=function(e){var t=s.current,n=l.current;return s.current=l.current=null,i.current=e,c.current=u.current.apply(n,t)},n=function(e,t){h&&cancelAnimationFrame(a.current),a.current=h?requestAnimationFrame(e):setTimeout(e,t)},b=function(e){if(!d.current)return!1;var n=e-o.current;return!o.current||n>=t||n<0||g&&e-i.current>=w},x=function(t){return a.current=null,v&&s.current?e(t):(s.current=l.current=null,c.current)},y=function e(){var r=Date.now();if(b(r))return x(r);if(d.current){var a=t-(r-o.current),s=g?Math.min(a,w-(r-i.current)):a;n(e,s)}},C=function(){if(f||m){var u=Date.now(),h=b(u);if(s.current=[].slice.call(arguments),l.current=r,o.current=u,h){if(!a.current&&d.current)return i.current=o.current,n(y,t),p?e(o.current):c.current;if(g)return n(y,t),e(o.current)}return a.current||n(y,t),c.current}};return C.cancel=function(){a.current&&(h?cancelAnimationFrame(a.current):clearTimeout(a.current)),i.current=0,s.current=o.current=l.current=a.current=null},C.isPending=function(){return!!a.current},C.flush=function(){return a.current?x(Date.now()):c.current},C}),[p,g,t,w,v,h,f,m]);return x}((0,b.useCallback)((function(e){return O(e)}),[O]),500,k),L=(0,b.useRef)(M),j(L.current,M)||(_(M),L.current=M),j(T,M)&&_.cancel(),[T,_]),[x,y]=(0,s.useState)(d),[C,R]=(0,s.useState)(!1),D=on(e,n),S=an({postType:e,postStatus:t,search:w,minimumLength:3,perPage:x}),E=S?.length===d,N=u?u(S):S;var M,k,j,I,T,O,_,L;return(0,o.jsxs)(a.BaseControl,{className:"wpbt-post-search-control",tabIndex:"-1",label:l,...h,children:[(0,o.jsxs)("div",{className:"wpbt-post-search-control__wrapper",onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),v(!1))},children:[(0,o.jsx)("input",{type:"text",value:p?g:D?.title?.raw||"",onChange:e=>m(e.currentTarget.value),placeholder:i,onFocus:()=>v(!0),className:"wpbt-post-search-control__input",...c}),(0,o.jsx)(a.Button,{className:"wpbt-post-search-control__reset",icon:rn,disabled:!n,onClick:()=>r(null),label:(0,f.__)("Reset")})]}),(0,o.jsx)("div",{className:"wpbt-post-search-control__options",children:p&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(ln,{options:N,search:w,renderOption:e=>(0,o.jsx)("button",{className:"wpbt-post-search-control__option",onClick:()=>{r(e.id),m(""),v(!1)},children:(0,o.jsx)(s.RawHTML,{children:e?.title?.rendered})},e.id)}),E&&(0,o.jsx)("div",{className:"wpbt-post-search-control__more",children:C?(0,o.jsx)(a.Spinner,{}):(0,o.jsx)("button",{className:"components-button is-tertiary",onClick:()=>{R(!0),y(-1)},children:(0,f.__)("View more results",sn)})})]})})]})};function un(e){return(0,h.useSelect)((t=>t("core").getEntityRecords("postType",e,{per_page:-1,orderby:"title",order:"asc",status:"publish"})),[e])}})(),module.exports=r})(); \ No newline at end of file +/******/ (() => { // webpackBootstrap +/******/ var __webpack_modules__ = ({ + +/***/ "./node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js": +/*!***********************************************************************!*\ + !*** ./node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js ***! + \***********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ HiddenText: () => (/* binding */ HiddenText), +/* harmony export */ LiveRegion: () => (/* binding */ LiveRegion), +/* harmony export */ useAnnouncement: () => (/* binding */ useAnnouncement) +/* harmony export */ }); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); + + +const hiddenStyles = { + display: 'none' +}; +function HiddenText(_ref) { + let { + id, + value + } = _ref; + return react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { + id: id, + style: hiddenStyles + }, value); +} + +function LiveRegion(_ref) { + let { + id, + announcement, + ariaLiveType = "assertive" + } = _ref; + // Hide element visually but keep it readable by screen readers + const visuallyHidden = { + position: 'fixed', + width: 1, + height: 1, + margin: -1, + border: 0, + padding: 0, + overflow: 'hidden', + clip: 'rect(0 0 0 0)', + clipPath: 'inset(100%)', + whiteSpace: 'nowrap' + }; + return react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { + id: id, + style: visuallyHidden, + role: "status", + "aria-live": ariaLiveType, + "aria-atomic": true + }, announcement); +} + +function useAnnouncement() { + const [announcement, setAnnouncement] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(''); + const announce = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(value => { + if (value != null) { + setAnnouncement(value); + } + }, []); + return { + announce, + announcement + }; +} + + +//# sourceMappingURL=accessibility.esm.js.map + + +/***/ }), + +/***/ "./node_modules/@dnd-kit/core/dist/core.esm.js": +/*!*****************************************************!*\ + !*** ./node_modules/@dnd-kit/core/dist/core.esm.js ***! + \*****************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ AutoScrollActivator: () => (/* binding */ AutoScrollActivator), +/* harmony export */ DndContext: () => (/* binding */ DndContext), +/* harmony export */ DragOverlay: () => (/* binding */ DragOverlay), +/* harmony export */ KeyboardCode: () => (/* binding */ KeyboardCode), +/* harmony export */ KeyboardSensor: () => (/* binding */ KeyboardSensor), +/* harmony export */ MeasuringFrequency: () => (/* binding */ MeasuringFrequency), +/* harmony export */ MeasuringStrategy: () => (/* binding */ MeasuringStrategy), +/* harmony export */ MouseSensor: () => (/* binding */ MouseSensor), +/* harmony export */ PointerSensor: () => (/* binding */ PointerSensor), +/* harmony export */ TouchSensor: () => (/* binding */ TouchSensor), +/* harmony export */ TraversalOrder: () => (/* binding */ TraversalOrder), +/* harmony export */ applyModifiers: () => (/* binding */ applyModifiers), +/* harmony export */ closestCenter: () => (/* binding */ closestCenter), +/* harmony export */ closestCorners: () => (/* binding */ closestCorners), +/* harmony export */ defaultAnnouncements: () => (/* binding */ defaultAnnouncements), +/* harmony export */ defaultCoordinates: () => (/* binding */ defaultCoordinates), +/* harmony export */ defaultDropAnimation: () => (/* binding */ defaultDropAnimationConfiguration), +/* harmony export */ defaultDropAnimationSideEffects: () => (/* binding */ defaultDropAnimationSideEffects), +/* harmony export */ defaultScreenReaderInstructions: () => (/* binding */ defaultScreenReaderInstructions), +/* harmony export */ getClientRect: () => (/* binding */ getClientRect), +/* harmony export */ getFirstCollision: () => (/* binding */ getFirstCollision), +/* harmony export */ getScrollableAncestors: () => (/* binding */ getScrollableAncestors), +/* harmony export */ pointerWithin: () => (/* binding */ pointerWithin), +/* harmony export */ rectIntersection: () => (/* binding */ rectIntersection), +/* harmony export */ useDndContext: () => (/* binding */ useDndContext), +/* harmony export */ useDndMonitor: () => (/* binding */ useDndMonitor), +/* harmony export */ useDraggable: () => (/* binding */ useDraggable), +/* harmony export */ useDroppable: () => (/* binding */ useDroppable), +/* harmony export */ useSensor: () => (/* binding */ useSensor), +/* harmony export */ useSensors: () => (/* binding */ useSensors) +/* harmony export */ }); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ "react-dom"); +/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @dnd-kit/utilities */ "./node_modules/@dnd-kit/utilities/dist/utilities.esm.js"); +/* harmony import */ var _dnd_kit_accessibility__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @dnd-kit/accessibility */ "./node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js"); + + + + + +const DndMonitorContext = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(null); + +function useDndMonitor(listener) { + const registerListener = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(DndMonitorContext); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (!registerListener) { + throw new Error('useDndMonitor must be used within a children of '); + } + + const unsubscribe = registerListener(listener); + return unsubscribe; + }, [listener, registerListener]); +} + +function useDndMonitorProvider() { + const [listeners] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(() => new Set()); + const registerListener = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(listener => { + listeners.add(listener); + return () => listeners.delete(listener); + }, [listeners]); + const dispatch = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(_ref => { + let { + type, + event + } = _ref; + listeners.forEach(listener => { + var _listener$type; + + return (_listener$type = listener[type]) == null ? void 0 : _listener$type.call(listener, event); + }); + }, [listeners]); + return [dispatch, registerListener]; +} + +const defaultScreenReaderInstructions = { + draggable: "\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n " +}; +const defaultAnnouncements = { + onDragStart(_ref) { + let { + active + } = _ref; + return "Picked up draggable item " + active.id + "."; + }, + + onDragOver(_ref2) { + let { + active, + over + } = _ref2; + + if (over) { + return "Draggable item " + active.id + " was moved over droppable area " + over.id + "."; + } + + return "Draggable item " + active.id + " is no longer over a droppable area."; + }, + + onDragEnd(_ref3) { + let { + active, + over + } = _ref3; + + if (over) { + return "Draggable item " + active.id + " was dropped over droppable area " + over.id; + } + + return "Draggable item " + active.id + " was dropped."; + }, + + onDragCancel(_ref4) { + let { + active + } = _ref4; + return "Dragging was cancelled. Draggable item " + active.id + " was dropped."; + } + +}; + +function Accessibility(_ref) { + let { + announcements = defaultAnnouncements, + container, + hiddenTextDescribedById, + screenReaderInstructions = defaultScreenReaderInstructions + } = _ref; + const { + announce, + announcement + } = (0,_dnd_kit_accessibility__WEBPACK_IMPORTED_MODULE_3__.useAnnouncement)(); + const liveRegionId = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useUniqueId)("DndLiveRegion"); + const [mounted, setMounted] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + setMounted(true); + }, []); + useDndMonitor((0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => ({ + onDragStart(_ref2) { + let { + active + } = _ref2; + announce(announcements.onDragStart({ + active + })); + }, + + onDragMove(_ref3) { + let { + active, + over + } = _ref3; + + if (announcements.onDragMove) { + announce(announcements.onDragMove({ + active, + over + })); + } + }, + + onDragOver(_ref4) { + let { + active, + over + } = _ref4; + announce(announcements.onDragOver({ + active, + over + })); + }, + + onDragEnd(_ref5) { + let { + active, + over + } = _ref5; + announce(announcements.onDragEnd({ + active, + over + })); + }, + + onDragCancel(_ref6) { + let { + active, + over + } = _ref6; + announce(announcements.onDragCancel({ + active, + over + })); + } + + }), [announce, announcements])); + + if (!mounted) { + return null; + } + + const markup = react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_dnd_kit_accessibility__WEBPACK_IMPORTED_MODULE_3__.HiddenText, { + id: hiddenTextDescribedById, + value: screenReaderInstructions.draggable + }), react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_dnd_kit_accessibility__WEBPACK_IMPORTED_MODULE_3__.LiveRegion, { + id: liveRegionId, + announcement: announcement + })); + return container ? (0,react_dom__WEBPACK_IMPORTED_MODULE_1__.createPortal)(markup, container) : markup; +} + +var Action; + +(function (Action) { + Action["DragStart"] = "dragStart"; + Action["DragMove"] = "dragMove"; + Action["DragEnd"] = "dragEnd"; + Action["DragCancel"] = "dragCancel"; + Action["DragOver"] = "dragOver"; + Action["RegisterDroppable"] = "registerDroppable"; + Action["SetDroppableDisabled"] = "setDroppableDisabled"; + Action["UnregisterDroppable"] = "unregisterDroppable"; +})(Action || (Action = {})); + +function noop() {} + +function useSensor(sensor, options) { + return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => ({ + sensor, + options: options != null ? options : {} + }), // eslint-disable-next-line react-hooks/exhaustive-deps + [sensor, options]); +} + +function useSensors() { + for (var _len = arguments.length, sensors = new Array(_len), _key = 0; _key < _len; _key++) { + sensors[_key] = arguments[_key]; + } + + return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => [...sensors].filter(sensor => sensor != null), // eslint-disable-next-line react-hooks/exhaustive-deps + [...sensors]); +} + +const defaultCoordinates = /*#__PURE__*/Object.freeze({ + x: 0, + y: 0 +}); + +/** + * Returns the distance between two points + */ +function distanceBetween(p1, p2) { + return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2)); +} + +function getRelativeTransformOrigin(event, rect) { + const eventCoordinates = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getEventCoordinates)(event); + + if (!eventCoordinates) { + return '0 0'; + } + + const transformOrigin = { + x: (eventCoordinates.x - rect.left) / rect.width * 100, + y: (eventCoordinates.y - rect.top) / rect.height * 100 + }; + return transformOrigin.x + "% " + transformOrigin.y + "%"; +} + +/** + * Sort collisions from smallest to greatest value + */ +function sortCollisionsAsc(_ref, _ref2) { + let { + data: { + value: a + } + } = _ref; + let { + data: { + value: b + } + } = _ref2; + return a - b; +} +/** + * Sort collisions from greatest to smallest value + */ + +function sortCollisionsDesc(_ref3, _ref4) { + let { + data: { + value: a + } + } = _ref3; + let { + data: { + value: b + } + } = _ref4; + return b - a; +} +/** + * Returns the coordinates of the corners of a given rectangle: + * [TopLeft {x, y}, TopRight {x, y}, BottomLeft {x, y}, BottomRight {x, y}] + */ + +function cornersOfRectangle(_ref5) { + let { + left, + top, + height, + width + } = _ref5; + return [{ + x: left, + y: top + }, { + x: left + width, + y: top + }, { + x: left, + y: top + height + }, { + x: left + width, + y: top + height + }]; +} +function getFirstCollision(collisions, property) { + if (!collisions || collisions.length === 0) { + return null; + } + + const [firstCollision] = collisions; + return property ? firstCollision[property] : firstCollision; +} + +/** + * Returns the coordinates of the center of a given ClientRect + */ + +function centerOfRectangle(rect, left, top) { + if (left === void 0) { + left = rect.left; + } + + if (top === void 0) { + top = rect.top; + } + + return { + x: left + rect.width * 0.5, + y: top + rect.height * 0.5 + }; +} +/** + * Returns the closest rectangles from an array of rectangles to the center of a given + * rectangle. + */ + + +const closestCenter = _ref => { + let { + collisionRect, + droppableRects, + droppableContainers + } = _ref; + const centerRect = centerOfRectangle(collisionRect, collisionRect.left, collisionRect.top); + const collisions = []; + + for (const droppableContainer of droppableContainers) { + const { + id + } = droppableContainer; + const rect = droppableRects.get(id); + + if (rect) { + const distBetween = distanceBetween(centerOfRectangle(rect), centerRect); + collisions.push({ + id, + data: { + droppableContainer, + value: distBetween + } + }); + } + } + + return collisions.sort(sortCollisionsAsc); +}; + +/** + * Returns the closest rectangles from an array of rectangles to the corners of + * another rectangle. + */ + +const closestCorners = _ref => { + let { + collisionRect, + droppableRects, + droppableContainers + } = _ref; + const corners = cornersOfRectangle(collisionRect); + const collisions = []; + + for (const droppableContainer of droppableContainers) { + const { + id + } = droppableContainer; + const rect = droppableRects.get(id); + + if (rect) { + const rectCorners = cornersOfRectangle(rect); + const distances = corners.reduce((accumulator, corner, index) => { + return accumulator + distanceBetween(rectCorners[index], corner); + }, 0); + const effectiveDistance = Number((distances / 4).toFixed(4)); + collisions.push({ + id, + data: { + droppableContainer, + value: effectiveDistance + } + }); + } + } + + return collisions.sort(sortCollisionsAsc); +}; + +/** + * Returns the intersecting rectangle area between two rectangles + */ + +function getIntersectionRatio(entry, target) { + const top = Math.max(target.top, entry.top); + const left = Math.max(target.left, entry.left); + const right = Math.min(target.left + target.width, entry.left + entry.width); + const bottom = Math.min(target.top + target.height, entry.top + entry.height); + const width = right - left; + const height = bottom - top; + + if (left < right && top < bottom) { + const targetArea = target.width * target.height; + const entryArea = entry.width * entry.height; + const intersectionArea = width * height; + const intersectionRatio = intersectionArea / (targetArea + entryArea - intersectionArea); + return Number(intersectionRatio.toFixed(4)); + } // Rectangles do not overlap, or overlap has an area of zero (edge/corner overlap) + + + return 0; +} +/** + * Returns the rectangles that has the greatest intersection area with a given + * rectangle in an array of rectangles. + */ + +const rectIntersection = _ref => { + let { + collisionRect, + droppableRects, + droppableContainers + } = _ref; + const collisions = []; + + for (const droppableContainer of droppableContainers) { + const { + id + } = droppableContainer; + const rect = droppableRects.get(id); + + if (rect) { + const intersectionRatio = getIntersectionRatio(rect, collisionRect); + + if (intersectionRatio > 0) { + collisions.push({ + id, + data: { + droppableContainer, + value: intersectionRatio + } + }); + } + } + } + + return collisions.sort(sortCollisionsDesc); +}; + +/** + * Check if a given point is contained within a bounding rectangle + */ + +function isPointWithinRect(point, rect) { + const { + top, + left, + bottom, + right + } = rect; + return top <= point.y && point.y <= bottom && left <= point.x && point.x <= right; +} +/** + * Returns the rectangles that the pointer is hovering over + */ + + +const pointerWithin = _ref => { + let { + droppableContainers, + droppableRects, + pointerCoordinates + } = _ref; + + if (!pointerCoordinates) { + return []; + } + + const collisions = []; + + for (const droppableContainer of droppableContainers) { + const { + id + } = droppableContainer; + const rect = droppableRects.get(id); + + if (rect && isPointWithinRect(pointerCoordinates, rect)) { + /* There may be more than a single rectangle intersecting + * with the pointer coordinates. In order to sort the + * colliding rectangles, we measure the distance between + * the pointer and the corners of the intersecting rectangle + */ + const corners = cornersOfRectangle(rect); + const distances = corners.reduce((accumulator, corner) => { + return accumulator + distanceBetween(pointerCoordinates, corner); + }, 0); + const effectiveDistance = Number((distances / 4).toFixed(4)); + collisions.push({ + id, + data: { + droppableContainer, + value: effectiveDistance + } + }); + } + } + + return collisions.sort(sortCollisionsAsc); +}; + +function adjustScale(transform, rect1, rect2) { + return { ...transform, + scaleX: rect1 && rect2 ? rect1.width / rect2.width : 1, + scaleY: rect1 && rect2 ? rect1.height / rect2.height : 1 + }; +} + +function getRectDelta(rect1, rect2) { + return rect1 && rect2 ? { + x: rect1.left - rect2.left, + y: rect1.top - rect2.top + } : defaultCoordinates; +} + +function createRectAdjustmentFn(modifier) { + return function adjustClientRect(rect) { + for (var _len = arguments.length, adjustments = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + adjustments[_key - 1] = arguments[_key]; + } + + return adjustments.reduce((acc, adjustment) => ({ ...acc, + top: acc.top + modifier * adjustment.y, + bottom: acc.bottom + modifier * adjustment.y, + left: acc.left + modifier * adjustment.x, + right: acc.right + modifier * adjustment.x + }), { ...rect + }); + }; +} +const getAdjustedRect = /*#__PURE__*/createRectAdjustmentFn(1); + +function parseTransform(transform) { + if (transform.startsWith('matrix3d(')) { + const transformArray = transform.slice(9, -1).split(/, /); + return { + x: +transformArray[12], + y: +transformArray[13], + scaleX: +transformArray[0], + scaleY: +transformArray[5] + }; + } else if (transform.startsWith('matrix(')) { + const transformArray = transform.slice(7, -1).split(/, /); + return { + x: +transformArray[4], + y: +transformArray[5], + scaleX: +transformArray[0], + scaleY: +transformArray[3] + }; + } + + return null; +} + +function inverseTransform(rect, transform, transformOrigin) { + const parsedTransform = parseTransform(transform); + + if (!parsedTransform) { + return rect; + } + + const { + scaleX, + scaleY, + x: translateX, + y: translateY + } = parsedTransform; + const x = rect.left - translateX - (1 - scaleX) * parseFloat(transformOrigin); + const y = rect.top - translateY - (1 - scaleY) * parseFloat(transformOrigin.slice(transformOrigin.indexOf(' ') + 1)); + const w = scaleX ? rect.width / scaleX : rect.width; + const h = scaleY ? rect.height / scaleY : rect.height; + return { + width: w, + height: h, + top: y, + right: x + w, + bottom: y + h, + left: x + }; +} + +const defaultOptions = { + ignoreTransform: false +}; +/** + * Returns the bounding client rect of an element relative to the viewport. + */ + +function getClientRect(element, options) { + if (options === void 0) { + options = defaultOptions; + } + + let rect = element.getBoundingClientRect(); + + if (options.ignoreTransform) { + const { + transform, + transformOrigin + } = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getWindow)(element).getComputedStyle(element); + + if (transform) { + rect = inverseTransform(rect, transform, transformOrigin); + } + } + + const { + top, + left, + width, + height, + bottom, + right + } = rect; + return { + top, + left, + width, + height, + bottom, + right + }; +} +/** + * Returns the bounding client rect of an element relative to the viewport. + * + * @remarks + * The ClientRect returned by this method does not take into account transforms + * applied to the element it measures. + * + */ + +function getTransformAgnosticClientRect(element) { + return getClientRect(element, { + ignoreTransform: true + }); +} + +function getWindowClientRect(element) { + const width = element.innerWidth; + const height = element.innerHeight; + return { + top: 0, + left: 0, + right: width, + bottom: height, + width, + height + }; +} + +function isFixed(node, computedStyle) { + if (computedStyle === void 0) { + computedStyle = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getWindow)(node).getComputedStyle(node); + } + + return computedStyle.position === 'fixed'; +} + +function isScrollable(element, computedStyle) { + if (computedStyle === void 0) { + computedStyle = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getWindow)(element).getComputedStyle(element); + } + + const overflowRegex = /(auto|scroll|overlay)/; + const properties = ['overflow', 'overflowX', 'overflowY']; + return properties.some(property => { + const value = computedStyle[property]; + return typeof value === 'string' ? overflowRegex.test(value) : false; + }); +} + +function getScrollableAncestors(element, limit) { + const scrollParents = []; + + function findScrollableAncestors(node) { + if (limit != null && scrollParents.length >= limit) { + return scrollParents; + } + + if (!node) { + return scrollParents; + } + + if ((0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.isDocument)(node) && node.scrollingElement != null && !scrollParents.includes(node.scrollingElement)) { + scrollParents.push(node.scrollingElement); + return scrollParents; + } + + if (!(0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.isHTMLElement)(node) || (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.isSVGElement)(node)) { + return scrollParents; + } + + if (scrollParents.includes(node)) { + return scrollParents; + } + + const computedStyle = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getWindow)(element).getComputedStyle(node); + + if (node !== element) { + if (isScrollable(node, computedStyle)) { + scrollParents.push(node); + } + } + + if (isFixed(node, computedStyle)) { + return scrollParents; + } + + return findScrollableAncestors(node.parentNode); + } + + if (!element) { + return scrollParents; + } + + return findScrollableAncestors(element); +} +function getFirstScrollableAncestor(node) { + const [firstScrollableAncestor] = getScrollableAncestors(node, 1); + return firstScrollableAncestor != null ? firstScrollableAncestor : null; +} + +function getScrollableElement(element) { + if (!_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.canUseDOM || !element) { + return null; + } + + if ((0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.isWindow)(element)) { + return element; + } + + if (!(0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.isNode)(element)) { + return null; + } + + if ((0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.isDocument)(element) || element === (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getOwnerDocument)(element).scrollingElement) { + return window; + } + + if ((0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.isHTMLElement)(element)) { + return element; + } + + return null; +} + +function getScrollXCoordinate(element) { + if ((0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.isWindow)(element)) { + return element.scrollX; + } + + return element.scrollLeft; +} +function getScrollYCoordinate(element) { + if ((0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.isWindow)(element)) { + return element.scrollY; + } + + return element.scrollTop; +} +function getScrollCoordinates(element) { + return { + x: getScrollXCoordinate(element), + y: getScrollYCoordinate(element) + }; +} + +var Direction; + +(function (Direction) { + Direction[Direction["Forward"] = 1] = "Forward"; + Direction[Direction["Backward"] = -1] = "Backward"; +})(Direction || (Direction = {})); + +function isDocumentScrollingElement(element) { + if (!_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.canUseDOM || !element) { + return false; + } + + return element === document.scrollingElement; +} + +function getScrollPosition(scrollingContainer) { + const minScroll = { + x: 0, + y: 0 + }; + const dimensions = isDocumentScrollingElement(scrollingContainer) ? { + height: window.innerHeight, + width: window.innerWidth + } : { + height: scrollingContainer.clientHeight, + width: scrollingContainer.clientWidth + }; + const maxScroll = { + x: scrollingContainer.scrollWidth - dimensions.width, + y: scrollingContainer.scrollHeight - dimensions.height + }; + const isTop = scrollingContainer.scrollTop <= minScroll.y; + const isLeft = scrollingContainer.scrollLeft <= minScroll.x; + const isBottom = scrollingContainer.scrollTop >= maxScroll.y; + const isRight = scrollingContainer.scrollLeft >= maxScroll.x; + return { + isTop, + isLeft, + isBottom, + isRight, + maxScroll, + minScroll + }; +} + +const defaultThreshold = { + x: 0.2, + y: 0.2 +}; +function getScrollDirectionAndSpeed(scrollContainer, scrollContainerRect, _ref, acceleration, thresholdPercentage) { + let { + top, + left, + right, + bottom + } = _ref; + + if (acceleration === void 0) { + acceleration = 10; + } + + if (thresholdPercentage === void 0) { + thresholdPercentage = defaultThreshold; + } + + const { + isTop, + isBottom, + isLeft, + isRight + } = getScrollPosition(scrollContainer); + const direction = { + x: 0, + y: 0 + }; + const speed = { + x: 0, + y: 0 + }; + const threshold = { + height: scrollContainerRect.height * thresholdPercentage.y, + width: scrollContainerRect.width * thresholdPercentage.x + }; + + if (!isTop && top <= scrollContainerRect.top + threshold.height) { + // Scroll Up + direction.y = Direction.Backward; + speed.y = acceleration * Math.abs((scrollContainerRect.top + threshold.height - top) / threshold.height); + } else if (!isBottom && bottom >= scrollContainerRect.bottom - threshold.height) { + // Scroll Down + direction.y = Direction.Forward; + speed.y = acceleration * Math.abs((scrollContainerRect.bottom - threshold.height - bottom) / threshold.height); + } + + if (!isRight && right >= scrollContainerRect.right - threshold.width) { + // Scroll Right + direction.x = Direction.Forward; + speed.x = acceleration * Math.abs((scrollContainerRect.right - threshold.width - right) / threshold.width); + } else if (!isLeft && left <= scrollContainerRect.left + threshold.width) { + // Scroll Left + direction.x = Direction.Backward; + speed.x = acceleration * Math.abs((scrollContainerRect.left + threshold.width - left) / threshold.width); + } + + return { + direction, + speed + }; +} + +function getScrollElementRect(element) { + if (element === document.scrollingElement) { + const { + innerWidth, + innerHeight + } = window; + return { + top: 0, + left: 0, + right: innerWidth, + bottom: innerHeight, + width: innerWidth, + height: innerHeight + }; + } + + const { + top, + left, + right, + bottom + } = element.getBoundingClientRect(); + return { + top, + left, + right, + bottom, + width: element.clientWidth, + height: element.clientHeight + }; +} + +function getScrollOffsets(scrollableAncestors) { + return scrollableAncestors.reduce((acc, node) => { + return (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.add)(acc, getScrollCoordinates(node)); + }, defaultCoordinates); +} +function getScrollXOffset(scrollableAncestors) { + return scrollableAncestors.reduce((acc, node) => { + return acc + getScrollXCoordinate(node); + }, 0); +} +function getScrollYOffset(scrollableAncestors) { + return scrollableAncestors.reduce((acc, node) => { + return acc + getScrollYCoordinate(node); + }, 0); +} + +function scrollIntoViewIfNeeded(element, measure) { + if (measure === void 0) { + measure = getClientRect; + } + + if (!element) { + return; + } + + const { + top, + left, + bottom, + right + } = measure(element); + const firstScrollableAncestor = getFirstScrollableAncestor(element); + + if (!firstScrollableAncestor) { + return; + } + + if (bottom <= 0 || right <= 0 || top >= window.innerHeight || left >= window.innerWidth) { + element.scrollIntoView({ + block: 'center', + inline: 'center' + }); + } +} + +const properties = [['x', ['left', 'right'], getScrollXOffset], ['y', ['top', 'bottom'], getScrollYOffset]]; +class Rect { + constructor(rect, element) { + this.rect = void 0; + this.width = void 0; + this.height = void 0; + this.top = void 0; + this.bottom = void 0; + this.right = void 0; + this.left = void 0; + const scrollableAncestors = getScrollableAncestors(element); + const scrollOffsets = getScrollOffsets(scrollableAncestors); + this.rect = { ...rect + }; + this.width = rect.width; + this.height = rect.height; + + for (const [axis, keys, getScrollOffset] of properties) { + for (const key of keys) { + Object.defineProperty(this, key, { + get: () => { + const currentOffsets = getScrollOffset(scrollableAncestors); + const scrollOffsetsDeltla = scrollOffsets[axis] - currentOffsets; + return this.rect[key] + scrollOffsetsDeltla; + }, + enumerable: true + }); + } + } + + Object.defineProperty(this, 'rect', { + enumerable: false + }); + } + +} + +class Listeners { + constructor(target) { + this.target = void 0; + this.listeners = []; + + this.removeAll = () => { + this.listeners.forEach(listener => { + var _this$target; + + return (_this$target = this.target) == null ? void 0 : _this$target.removeEventListener(...listener); + }); + }; + + this.target = target; + } + + add(eventName, handler, options) { + var _this$target2; + + (_this$target2 = this.target) == null ? void 0 : _this$target2.addEventListener(eventName, handler, options); + this.listeners.push([eventName, handler, options]); + } + +} + +function getEventListenerTarget(target) { + // If the `event.target` element is removed from the document events will still be targeted + // at it, and hence won't always bubble up to the window or document anymore. + // If there is any risk of an element being removed while it is being dragged, + // the best practice is to attach the event listeners directly to the target. + // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget + const { + EventTarget + } = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getWindow)(target); + return target instanceof EventTarget ? target : (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getOwnerDocument)(target); +} + +function hasExceededDistance(delta, measurement) { + const dx = Math.abs(delta.x); + const dy = Math.abs(delta.y); + + if (typeof measurement === 'number') { + return Math.sqrt(dx ** 2 + dy ** 2) > measurement; + } + + if ('x' in measurement && 'y' in measurement) { + return dx > measurement.x && dy > measurement.y; + } + + if ('x' in measurement) { + return dx > measurement.x; + } + + if ('y' in measurement) { + return dy > measurement.y; + } + + return false; +} + +var EventName; + +(function (EventName) { + EventName["Click"] = "click"; + EventName["DragStart"] = "dragstart"; + EventName["Keydown"] = "keydown"; + EventName["ContextMenu"] = "contextmenu"; + EventName["Resize"] = "resize"; + EventName["SelectionChange"] = "selectionchange"; + EventName["VisibilityChange"] = "visibilitychange"; +})(EventName || (EventName = {})); + +function preventDefault(event) { + event.preventDefault(); +} +function stopPropagation(event) { + event.stopPropagation(); +} + +var KeyboardCode; + +(function (KeyboardCode) { + KeyboardCode["Space"] = "Space"; + KeyboardCode["Down"] = "ArrowDown"; + KeyboardCode["Right"] = "ArrowRight"; + KeyboardCode["Left"] = "ArrowLeft"; + KeyboardCode["Up"] = "ArrowUp"; + KeyboardCode["Esc"] = "Escape"; + KeyboardCode["Enter"] = "Enter"; +})(KeyboardCode || (KeyboardCode = {})); + +const defaultKeyboardCodes = { + start: [KeyboardCode.Space, KeyboardCode.Enter], + cancel: [KeyboardCode.Esc], + end: [KeyboardCode.Space, KeyboardCode.Enter] +}; +const defaultKeyboardCoordinateGetter = (event, _ref) => { + let { + currentCoordinates + } = _ref; + + switch (event.code) { + case KeyboardCode.Right: + return { ...currentCoordinates, + x: currentCoordinates.x + 25 + }; + + case KeyboardCode.Left: + return { ...currentCoordinates, + x: currentCoordinates.x - 25 + }; + + case KeyboardCode.Down: + return { ...currentCoordinates, + y: currentCoordinates.y + 25 + }; + + case KeyboardCode.Up: + return { ...currentCoordinates, + y: currentCoordinates.y - 25 + }; + } + + return undefined; +}; + +class KeyboardSensor { + constructor(props) { + this.props = void 0; + this.autoScrollEnabled = false; + this.referenceCoordinates = void 0; + this.listeners = void 0; + this.windowListeners = void 0; + this.props = props; + const { + event: { + target + } + } = props; + this.props = props; + this.listeners = new Listeners((0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getOwnerDocument)(target)); + this.windowListeners = new Listeners((0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getWindow)(target)); + this.handleKeyDown = this.handleKeyDown.bind(this); + this.handleCancel = this.handleCancel.bind(this); + this.attach(); + } + + attach() { + this.handleStart(); + this.windowListeners.add(EventName.Resize, this.handleCancel); + this.windowListeners.add(EventName.VisibilityChange, this.handleCancel); + setTimeout(() => this.listeners.add(EventName.Keydown, this.handleKeyDown)); + } + + handleStart() { + const { + activeNode, + onStart + } = this.props; + const node = activeNode.node.current; + + if (node) { + scrollIntoViewIfNeeded(node); + } + + onStart(defaultCoordinates); + } + + handleKeyDown(event) { + if ((0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.isKeyboardEvent)(event)) { + const { + active, + context, + options + } = this.props; + const { + keyboardCodes = defaultKeyboardCodes, + coordinateGetter = defaultKeyboardCoordinateGetter, + scrollBehavior = 'smooth' + } = options; + const { + code + } = event; + + if (keyboardCodes.end.includes(code)) { + this.handleEnd(event); + return; + } + + if (keyboardCodes.cancel.includes(code)) { + this.handleCancel(event); + return; + } + + const { + collisionRect + } = context.current; + const currentCoordinates = collisionRect ? { + x: collisionRect.left, + y: collisionRect.top + } : defaultCoordinates; + + if (!this.referenceCoordinates) { + this.referenceCoordinates = currentCoordinates; + } + + const newCoordinates = coordinateGetter(event, { + active, + context: context.current, + currentCoordinates + }); + + if (newCoordinates) { + const coordinatesDelta = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.subtract)(newCoordinates, currentCoordinates); + const scrollDelta = { + x: 0, + y: 0 + }; + const { + scrollableAncestors + } = context.current; + + for (const scrollContainer of scrollableAncestors) { + const direction = event.code; + const { + isTop, + isRight, + isLeft, + isBottom, + maxScroll, + minScroll + } = getScrollPosition(scrollContainer); + const scrollElementRect = getScrollElementRect(scrollContainer); + const clampedCoordinates = { + x: Math.min(direction === KeyboardCode.Right ? scrollElementRect.right - scrollElementRect.width / 2 : scrollElementRect.right, Math.max(direction === KeyboardCode.Right ? scrollElementRect.left : scrollElementRect.left + scrollElementRect.width / 2, newCoordinates.x)), + y: Math.min(direction === KeyboardCode.Down ? scrollElementRect.bottom - scrollElementRect.height / 2 : scrollElementRect.bottom, Math.max(direction === KeyboardCode.Down ? scrollElementRect.top : scrollElementRect.top + scrollElementRect.height / 2, newCoordinates.y)) + }; + const canScrollX = direction === KeyboardCode.Right && !isRight || direction === KeyboardCode.Left && !isLeft; + const canScrollY = direction === KeyboardCode.Down && !isBottom || direction === KeyboardCode.Up && !isTop; + + if (canScrollX && clampedCoordinates.x !== newCoordinates.x) { + const newScrollCoordinates = scrollContainer.scrollLeft + coordinatesDelta.x; + const canScrollToNewCoordinates = direction === KeyboardCode.Right && newScrollCoordinates <= maxScroll.x || direction === KeyboardCode.Left && newScrollCoordinates >= minScroll.x; + + if (canScrollToNewCoordinates && !coordinatesDelta.y) { + // We don't need to update coordinates, the scroll adjustment alone will trigger + // logic to auto-detect the new container we are over + scrollContainer.scrollTo({ + left: newScrollCoordinates, + behavior: scrollBehavior + }); + return; + } + + if (canScrollToNewCoordinates) { + scrollDelta.x = scrollContainer.scrollLeft - newScrollCoordinates; + } else { + scrollDelta.x = direction === KeyboardCode.Right ? scrollContainer.scrollLeft - maxScroll.x : scrollContainer.scrollLeft - minScroll.x; + } + + if (scrollDelta.x) { + scrollContainer.scrollBy({ + left: -scrollDelta.x, + behavior: scrollBehavior + }); + } + + break; + } else if (canScrollY && clampedCoordinates.y !== newCoordinates.y) { + const newScrollCoordinates = scrollContainer.scrollTop + coordinatesDelta.y; + const canScrollToNewCoordinates = direction === KeyboardCode.Down && newScrollCoordinates <= maxScroll.y || direction === KeyboardCode.Up && newScrollCoordinates >= minScroll.y; + + if (canScrollToNewCoordinates && !coordinatesDelta.x) { + // We don't need to update coordinates, the scroll adjustment alone will trigger + // logic to auto-detect the new container we are over + scrollContainer.scrollTo({ + top: newScrollCoordinates, + behavior: scrollBehavior + }); + return; + } + + if (canScrollToNewCoordinates) { + scrollDelta.y = scrollContainer.scrollTop - newScrollCoordinates; + } else { + scrollDelta.y = direction === KeyboardCode.Down ? scrollContainer.scrollTop - maxScroll.y : scrollContainer.scrollTop - minScroll.y; + } + + if (scrollDelta.y) { + scrollContainer.scrollBy({ + top: -scrollDelta.y, + behavior: scrollBehavior + }); + } + + break; + } + } + + this.handleMove(event, (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.add)((0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.subtract)(newCoordinates, this.referenceCoordinates), scrollDelta)); + } + } + } + + handleMove(event, coordinates) { + const { + onMove + } = this.props; + event.preventDefault(); + onMove(coordinates); + } + + handleEnd(event) { + const { + onEnd + } = this.props; + event.preventDefault(); + this.detach(); + onEnd(); + } + + handleCancel(event) { + const { + onCancel + } = this.props; + event.preventDefault(); + this.detach(); + onCancel(); + } + + detach() { + this.listeners.removeAll(); + this.windowListeners.removeAll(); + } + +} +KeyboardSensor.activators = [{ + eventName: 'onKeyDown', + handler: (event, _ref, _ref2) => { + let { + keyboardCodes = defaultKeyboardCodes, + onActivation + } = _ref; + let { + active + } = _ref2; + const { + code + } = event.nativeEvent; + + if (keyboardCodes.start.includes(code)) { + const activator = active.activatorNode.current; + + if (activator && event.target !== activator) { + return false; + } + + event.preventDefault(); + onActivation == null ? void 0 : onActivation({ + event: event.nativeEvent + }); + return true; + } + + return false; + } +}]; + +function isDistanceConstraint(constraint) { + return Boolean(constraint && 'distance' in constraint); +} + +function isDelayConstraint(constraint) { + return Boolean(constraint && 'delay' in constraint); +} + +class AbstractPointerSensor { + constructor(props, events, listenerTarget) { + var _getEventCoordinates; + + if (listenerTarget === void 0) { + listenerTarget = getEventListenerTarget(props.event.target); + } + + this.props = void 0; + this.events = void 0; + this.autoScrollEnabled = true; + this.document = void 0; + this.activated = false; + this.initialCoordinates = void 0; + this.timeoutId = null; + this.listeners = void 0; + this.documentListeners = void 0; + this.windowListeners = void 0; + this.props = props; + this.events = events; + const { + event + } = props; + const { + target + } = event; + this.props = props; + this.events = events; + this.document = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getOwnerDocument)(target); + this.documentListeners = new Listeners(this.document); + this.listeners = new Listeners(listenerTarget); + this.windowListeners = new Listeners((0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getWindow)(target)); + this.initialCoordinates = (_getEventCoordinates = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getEventCoordinates)(event)) != null ? _getEventCoordinates : defaultCoordinates; + this.handleStart = this.handleStart.bind(this); + this.handleMove = this.handleMove.bind(this); + this.handleEnd = this.handleEnd.bind(this); + this.handleCancel = this.handleCancel.bind(this); + this.handleKeydown = this.handleKeydown.bind(this); + this.removeTextSelection = this.removeTextSelection.bind(this); + this.attach(); + } + + attach() { + const { + events, + props: { + options: { + activationConstraint, + bypassActivationConstraint + } + } + } = this; + this.listeners.add(events.move.name, this.handleMove, { + passive: false + }); + this.listeners.add(events.end.name, this.handleEnd); + this.windowListeners.add(EventName.Resize, this.handleCancel); + this.windowListeners.add(EventName.DragStart, preventDefault); + this.windowListeners.add(EventName.VisibilityChange, this.handleCancel); + this.windowListeners.add(EventName.ContextMenu, preventDefault); + this.documentListeners.add(EventName.Keydown, this.handleKeydown); + + if (activationConstraint) { + if (bypassActivationConstraint != null && bypassActivationConstraint({ + event: this.props.event, + activeNode: this.props.activeNode, + options: this.props.options + })) { + return this.handleStart(); + } + + if (isDelayConstraint(activationConstraint)) { + this.timeoutId = setTimeout(this.handleStart, activationConstraint.delay); + return; + } + + if (isDistanceConstraint(activationConstraint)) { + return; + } + } + + this.handleStart(); + } + + detach() { + this.listeners.removeAll(); + this.windowListeners.removeAll(); // Wait until the next event loop before removing document listeners + // This is necessary because we listen for `click` and `selection` events on the document + + setTimeout(this.documentListeners.removeAll, 50); + + if (this.timeoutId !== null) { + clearTimeout(this.timeoutId); + this.timeoutId = null; + } + } + + handleStart() { + const { + initialCoordinates + } = this; + const { + onStart + } = this.props; + + if (initialCoordinates) { + this.activated = true; // Stop propagation of click events once activation constraints are met + + this.documentListeners.add(EventName.Click, stopPropagation, { + capture: true + }); // Remove any text selection from the document + + this.removeTextSelection(); // Prevent further text selection while dragging + + this.documentListeners.add(EventName.SelectionChange, this.removeTextSelection); + onStart(initialCoordinates); + } + } + + handleMove(event) { + var _getEventCoordinates2; + + const { + activated, + initialCoordinates, + props + } = this; + const { + onMove, + options: { + activationConstraint + } + } = props; + + if (!initialCoordinates) { + return; + } + + const coordinates = (_getEventCoordinates2 = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getEventCoordinates)(event)) != null ? _getEventCoordinates2 : defaultCoordinates; + const delta = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.subtract)(initialCoordinates, coordinates); // Constraint validation + + if (!activated && activationConstraint) { + if (isDistanceConstraint(activationConstraint)) { + if (activationConstraint.tolerance != null && hasExceededDistance(delta, activationConstraint.tolerance)) { + return this.handleCancel(); + } + + if (hasExceededDistance(delta, activationConstraint.distance)) { + return this.handleStart(); + } + } + + if (isDelayConstraint(activationConstraint)) { + if (hasExceededDistance(delta, activationConstraint.tolerance)) { + return this.handleCancel(); + } + } + + return; + } + + if (event.cancelable) { + event.preventDefault(); + } + + onMove(coordinates); + } + + handleEnd() { + const { + onEnd + } = this.props; + this.detach(); + onEnd(); + } + + handleCancel() { + const { + onCancel + } = this.props; + this.detach(); + onCancel(); + } + + handleKeydown(event) { + if (event.code === KeyboardCode.Esc) { + this.handleCancel(); + } + } + + removeTextSelection() { + var _this$document$getSel; + + (_this$document$getSel = this.document.getSelection()) == null ? void 0 : _this$document$getSel.removeAllRanges(); + } + +} + +const events = { + move: { + name: 'pointermove' + }, + end: { + name: 'pointerup' + } +}; +class PointerSensor extends AbstractPointerSensor { + constructor(props) { + const { + event + } = props; // Pointer events stop firing if the target is unmounted while dragging + // Therefore we attach listeners to the owner document instead + + const listenerTarget = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getOwnerDocument)(event.target); + super(props, events, listenerTarget); + } + +} +PointerSensor.activators = [{ + eventName: 'onPointerDown', + handler: (_ref, _ref2) => { + let { + nativeEvent: event + } = _ref; + let { + onActivation + } = _ref2; + + if (!event.isPrimary || event.button !== 0) { + return false; + } + + onActivation == null ? void 0 : onActivation({ + event + }); + return true; + } +}]; + +const events$1 = { + move: { + name: 'mousemove' + }, + end: { + name: 'mouseup' + } +}; +var MouseButton; + +(function (MouseButton) { + MouseButton[MouseButton["RightClick"] = 2] = "RightClick"; +})(MouseButton || (MouseButton = {})); + +class MouseSensor extends AbstractPointerSensor { + constructor(props) { + super(props, events$1, (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getOwnerDocument)(props.event.target)); + } + +} +MouseSensor.activators = [{ + eventName: 'onMouseDown', + handler: (_ref, _ref2) => { + let { + nativeEvent: event + } = _ref; + let { + onActivation + } = _ref2; + + if (event.button === MouseButton.RightClick) { + return false; + } + + onActivation == null ? void 0 : onActivation({ + event + }); + return true; + } +}]; + +const events$2 = { + move: { + name: 'touchmove' + }, + end: { + name: 'touchend' + } +}; +class TouchSensor extends AbstractPointerSensor { + constructor(props) { + super(props, events$2); + } + + static setup() { + // Adding a non-capture and non-passive `touchmove` listener in order + // to force `event.preventDefault()` calls to work in dynamically added + // touchmove event handlers. This is required for iOS Safari. + window.addEventListener(events$2.move.name, noop, { + capture: false, + passive: false + }); + return function teardown() { + window.removeEventListener(events$2.move.name, noop); + }; // We create a new handler because the teardown function of another sensor + // could remove our event listener if we use a referentially equal listener. + + function noop() {} + } + +} +TouchSensor.activators = [{ + eventName: 'onTouchStart', + handler: (_ref, _ref2) => { + let { + nativeEvent: event + } = _ref; + let { + onActivation + } = _ref2; + const { + touches + } = event; + + if (touches.length > 1) { + return false; + } + + onActivation == null ? void 0 : onActivation({ + event + }); + return true; + } +}]; + +var AutoScrollActivator; + +(function (AutoScrollActivator) { + AutoScrollActivator[AutoScrollActivator["Pointer"] = 0] = "Pointer"; + AutoScrollActivator[AutoScrollActivator["DraggableRect"] = 1] = "DraggableRect"; +})(AutoScrollActivator || (AutoScrollActivator = {})); + +var TraversalOrder; + +(function (TraversalOrder) { + TraversalOrder[TraversalOrder["TreeOrder"] = 0] = "TreeOrder"; + TraversalOrder[TraversalOrder["ReversedTreeOrder"] = 1] = "ReversedTreeOrder"; +})(TraversalOrder || (TraversalOrder = {})); + +function useAutoScroller(_ref) { + let { + acceleration, + activator = AutoScrollActivator.Pointer, + canScroll, + draggingRect, + enabled, + interval = 5, + order = TraversalOrder.TreeOrder, + pointerCoordinates, + scrollableAncestors, + scrollableAncestorRects, + delta, + threshold + } = _ref; + const scrollIntent = useScrollIntent({ + delta, + disabled: !enabled + }); + const [setAutoScrollInterval, clearAutoScrollInterval] = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useInterval)(); + const scrollSpeed = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)({ + x: 0, + y: 0 + }); + const scrollDirection = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)({ + x: 0, + y: 0 + }); + const rect = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { + switch (activator) { + case AutoScrollActivator.Pointer: + return pointerCoordinates ? { + top: pointerCoordinates.y, + bottom: pointerCoordinates.y, + left: pointerCoordinates.x, + right: pointerCoordinates.x + } : null; + + case AutoScrollActivator.DraggableRect: + return draggingRect; + } + }, [activator, draggingRect, pointerCoordinates]); + const scrollContainerRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); + const autoScroll = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(() => { + const scrollContainer = scrollContainerRef.current; + + if (!scrollContainer) { + return; + } + + const scrollLeft = scrollSpeed.current.x * scrollDirection.current.x; + const scrollTop = scrollSpeed.current.y * scrollDirection.current.y; + scrollContainer.scrollBy(scrollLeft, scrollTop); + }, []); + const sortedScrollableAncestors = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => order === TraversalOrder.TreeOrder ? [...scrollableAncestors].reverse() : scrollableAncestors, [order, scrollableAncestors]); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (!enabled || !scrollableAncestors.length || !rect) { + clearAutoScrollInterval(); + return; + } + + for (const scrollContainer of sortedScrollableAncestors) { + if ((canScroll == null ? void 0 : canScroll(scrollContainer)) === false) { + continue; + } + + const index = scrollableAncestors.indexOf(scrollContainer); + const scrollContainerRect = scrollableAncestorRects[index]; + + if (!scrollContainerRect) { + continue; + } + + const { + direction, + speed + } = getScrollDirectionAndSpeed(scrollContainer, scrollContainerRect, rect, acceleration, threshold); + + for (const axis of ['x', 'y']) { + if (!scrollIntent[axis][direction[axis]]) { + speed[axis] = 0; + direction[axis] = 0; + } + } + + if (speed.x > 0 || speed.y > 0) { + clearAutoScrollInterval(); + scrollContainerRef.current = scrollContainer; + setAutoScrollInterval(autoScroll, interval); + scrollSpeed.current = speed; + scrollDirection.current = direction; + return; + } + } + + scrollSpeed.current = { + x: 0, + y: 0 + }; + scrollDirection.current = { + x: 0, + y: 0 + }; + clearAutoScrollInterval(); + }, // eslint-disable-next-line react-hooks/exhaustive-deps + [acceleration, autoScroll, canScroll, clearAutoScrollInterval, enabled, interval, // eslint-disable-next-line react-hooks/exhaustive-deps + JSON.stringify(rect), // eslint-disable-next-line react-hooks/exhaustive-deps + JSON.stringify(scrollIntent), setAutoScrollInterval, scrollableAncestors, sortedScrollableAncestors, scrollableAncestorRects, // eslint-disable-next-line react-hooks/exhaustive-deps + JSON.stringify(threshold)]); +} +const defaultScrollIntent = { + x: { + [Direction.Backward]: false, + [Direction.Forward]: false + }, + y: { + [Direction.Backward]: false, + [Direction.Forward]: false + } +}; + +function useScrollIntent(_ref2) { + let { + delta, + disabled + } = _ref2; + const previousDelta = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.usePrevious)(delta); + return (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useLazyMemo)(previousIntent => { + if (disabled || !previousDelta || !previousIntent) { + // Reset scroll intent tracking when auto-scrolling is disabled + return defaultScrollIntent; + } + + const direction = { + x: Math.sign(delta.x - previousDelta.x), + y: Math.sign(delta.y - previousDelta.y) + }; // Keep track of the user intent to scroll in each direction for both axis + + return { + x: { + [Direction.Backward]: previousIntent.x[Direction.Backward] || direction.x === -1, + [Direction.Forward]: previousIntent.x[Direction.Forward] || direction.x === 1 + }, + y: { + [Direction.Backward]: previousIntent.y[Direction.Backward] || direction.y === -1, + [Direction.Forward]: previousIntent.y[Direction.Forward] || direction.y === 1 + } + }; + }, [disabled, delta, previousDelta]); +} + +function useCachedNode(draggableNodes, id) { + const draggableNode = id !== null ? draggableNodes.get(id) : undefined; + const node = draggableNode ? draggableNode.node.current : null; + return (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useLazyMemo)(cachedNode => { + var _ref; + + if (id === null) { + return null; + } // In some cases, the draggable node can unmount while dragging + // This is the case for virtualized lists. In those situations, + // we fall back to the last known value for that node. + + + return (_ref = node != null ? node : cachedNode) != null ? _ref : null; + }, [node, id]); +} + +function useCombineActivators(sensors, getSyntheticHandler) { + return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => sensors.reduce((accumulator, sensor) => { + const { + sensor: Sensor + } = sensor; + const sensorActivators = Sensor.activators.map(activator => ({ + eventName: activator.eventName, + handler: getSyntheticHandler(activator.handler, sensor) + })); + return [...accumulator, ...sensorActivators]; + }, []), [sensors, getSyntheticHandler]); +} + +var MeasuringStrategy; + +(function (MeasuringStrategy) { + MeasuringStrategy[MeasuringStrategy["Always"] = 0] = "Always"; + MeasuringStrategy[MeasuringStrategy["BeforeDragging"] = 1] = "BeforeDragging"; + MeasuringStrategy[MeasuringStrategy["WhileDragging"] = 2] = "WhileDragging"; +})(MeasuringStrategy || (MeasuringStrategy = {})); + +var MeasuringFrequency; + +(function (MeasuringFrequency) { + MeasuringFrequency["Optimized"] = "optimized"; +})(MeasuringFrequency || (MeasuringFrequency = {})); + +const defaultValue = /*#__PURE__*/new Map(); +function useDroppableMeasuring(containers, _ref) { + let { + dragging, + dependencies, + config + } = _ref; + const [queue, setQueue] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null); + const { + frequency, + measure, + strategy + } = config; + const containersRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(containers); + const disabled = isDisabled(); + const disabledRef = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useLatestValue)(disabled); + const measureDroppableContainers = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function (ids) { + if (ids === void 0) { + ids = []; + } + + if (disabledRef.current) { + return; + } + + setQueue(value => { + if (value === null) { + return ids; + } + + return value.concat(ids.filter(id => !value.includes(id))); + }); + }, [disabledRef]); + const timeoutId = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); + const droppableRects = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useLazyMemo)(previousValue => { + if (disabled && !dragging) { + return defaultValue; + } + + if (!previousValue || previousValue === defaultValue || containersRef.current !== containers || queue != null) { + const map = new Map(); + + for (let container of containers) { + if (!container) { + continue; + } + + if (queue && queue.length > 0 && !queue.includes(container.id) && container.rect.current) { + // This container does not need to be re-measured + map.set(container.id, container.rect.current); + continue; + } + + const node = container.node.current; + const rect = node ? new Rect(measure(node), node) : null; + container.rect.current = rect; + + if (rect) { + map.set(container.id, rect); + } + } + + return map; + } + + return previousValue; + }, [containers, queue, dragging, disabled, measure]); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + containersRef.current = containers; + }, [containers]); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (disabled) { + return; + } + + measureDroppableContainers(); + }, // eslint-disable-next-line react-hooks/exhaustive-deps + [dragging, disabled]); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (queue && queue.length > 0) { + setQueue(null); + } + }, //eslint-disable-next-line react-hooks/exhaustive-deps + [JSON.stringify(queue)]); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (disabled || typeof frequency !== 'number' || timeoutId.current !== null) { + return; + } + + timeoutId.current = setTimeout(() => { + measureDroppableContainers(); + timeoutId.current = null; + }, frequency); + }, // eslint-disable-next-line react-hooks/exhaustive-deps + [frequency, disabled, measureDroppableContainers, ...dependencies]); + return { + droppableRects, + measureDroppableContainers, + measuringScheduled: queue != null + }; + + function isDisabled() { + switch (strategy) { + case MeasuringStrategy.Always: + return false; + + case MeasuringStrategy.BeforeDragging: + return dragging; + + default: + return !dragging; + } + } +} + +function useInitialValue(value, computeFn) { + return (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useLazyMemo)(previousValue => { + if (!value) { + return null; + } + + if (previousValue) { + return previousValue; + } + + return typeof computeFn === 'function' ? computeFn(value) : value; + }, [computeFn, value]); +} + +function useInitialRect(node, measure) { + return useInitialValue(node, measure); +} + +/** + * Returns a new MutationObserver instance. + * If `MutationObserver` is undefined in the execution environment, returns `undefined`. + */ + +function useMutationObserver(_ref) { + let { + callback, + disabled + } = _ref; + const handleMutations = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useEvent)(callback); + const mutationObserver = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { + if (disabled || typeof window === 'undefined' || typeof window.MutationObserver === 'undefined') { + return undefined; + } + + const { + MutationObserver + } = window; + return new MutationObserver(handleMutations); + }, [handleMutations, disabled]); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + return () => mutationObserver == null ? void 0 : mutationObserver.disconnect(); + }, [mutationObserver]); + return mutationObserver; +} + +/** + * Returns a new ResizeObserver instance bound to the `onResize` callback. + * If `ResizeObserver` is undefined in the execution environment, returns `undefined`. + */ + +function useResizeObserver(_ref) { + let { + callback, + disabled + } = _ref; + const handleResize = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useEvent)(callback); + const resizeObserver = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { + if (disabled || typeof window === 'undefined' || typeof window.ResizeObserver === 'undefined') { + return undefined; + } + + const { + ResizeObserver + } = window; + return new ResizeObserver(handleResize); + }, // eslint-disable-next-line react-hooks/exhaustive-deps + [disabled]); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + return () => resizeObserver == null ? void 0 : resizeObserver.disconnect(); + }, [resizeObserver]); + return resizeObserver; +} + +function defaultMeasure(element) { + return new Rect(getClientRect(element), element); +} + +function useRect(element, measure, fallbackRect) { + if (measure === void 0) { + measure = defaultMeasure; + } + + const [rect, measureRect] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useReducer)(reducer, null); + const mutationObserver = useMutationObserver({ + callback(records) { + if (!element) { + return; + } + + for (const record of records) { + const { + type, + target + } = record; + + if (type === 'childList' && target instanceof HTMLElement && target.contains(element)) { + measureRect(); + break; + } + } + } + + }); + const resizeObserver = useResizeObserver({ + callback: measureRect + }); + (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useIsomorphicLayoutEffect)(() => { + measureRect(); + + if (element) { + resizeObserver == null ? void 0 : resizeObserver.observe(element); + mutationObserver == null ? void 0 : mutationObserver.observe(document.body, { + childList: true, + subtree: true + }); + } else { + resizeObserver == null ? void 0 : resizeObserver.disconnect(); + mutationObserver == null ? void 0 : mutationObserver.disconnect(); + } + }, [element]); + return rect; + + function reducer(currentRect) { + if (!element) { + return null; + } + + if (element.isConnected === false) { + var _ref; + + // Fall back to last rect we measured if the element is + // no longer connected to the DOM. + return (_ref = currentRect != null ? currentRect : fallbackRect) != null ? _ref : null; + } + + const newRect = measure(element); + + if (JSON.stringify(currentRect) === JSON.stringify(newRect)) { + return currentRect; + } + + return newRect; + } +} + +function useRectDelta(rect) { + const initialRect = useInitialValue(rect); + return getRectDelta(rect, initialRect); +} + +const defaultValue$1 = []; +function useScrollableAncestors(node) { + const previousNode = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(node); + const ancestors = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useLazyMemo)(previousValue => { + if (!node) { + return defaultValue$1; + } + + if (previousValue && previousValue !== defaultValue$1 && node && previousNode.current && node.parentNode === previousNode.current.parentNode) { + return previousValue; + } + + return getScrollableAncestors(node); + }, [node]); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + previousNode.current = node; + }, [node]); + return ancestors; +} + +function useScrollOffsets(elements) { + const [scrollCoordinates, setScrollCoordinates] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null); + const prevElements = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(elements); // To-do: Throttle the handleScroll callback + + const handleScroll = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(event => { + const scrollingElement = getScrollableElement(event.target); + + if (!scrollingElement) { + return; + } + + setScrollCoordinates(scrollCoordinates => { + if (!scrollCoordinates) { + return null; + } + + scrollCoordinates.set(scrollingElement, getScrollCoordinates(scrollingElement)); + return new Map(scrollCoordinates); + }); + }, []); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + const previousElements = prevElements.current; + + if (elements !== previousElements) { + cleanup(previousElements); + const entries = elements.map(element => { + const scrollableElement = getScrollableElement(element); + + if (scrollableElement) { + scrollableElement.addEventListener('scroll', handleScroll, { + passive: true + }); + return [scrollableElement, getScrollCoordinates(scrollableElement)]; + } + + return null; + }).filter(entry => entry != null); + setScrollCoordinates(entries.length ? new Map(entries) : null); + prevElements.current = elements; + } + + return () => { + cleanup(elements); + cleanup(previousElements); + }; + + function cleanup(elements) { + elements.forEach(element => { + const scrollableElement = getScrollableElement(element); + scrollableElement == null ? void 0 : scrollableElement.removeEventListener('scroll', handleScroll); + }); + } + }, [handleScroll, elements]); + return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { + if (elements.length) { + return scrollCoordinates ? Array.from(scrollCoordinates.values()).reduce((acc, coordinates) => (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.add)(acc, coordinates), defaultCoordinates) : getScrollOffsets(elements); + } + + return defaultCoordinates; + }, [elements, scrollCoordinates]); +} + +function useScrollOffsetsDelta(scrollOffsets, dependencies) { + if (dependencies === void 0) { + dependencies = []; + } + + const initialScrollOffsets = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + initialScrollOffsets.current = null; + }, // eslint-disable-next-line react-hooks/exhaustive-deps + dependencies); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + const hasScrollOffsets = scrollOffsets !== defaultCoordinates; + + if (hasScrollOffsets && !initialScrollOffsets.current) { + initialScrollOffsets.current = scrollOffsets; + } + + if (!hasScrollOffsets && initialScrollOffsets.current) { + initialScrollOffsets.current = null; + } + }, [scrollOffsets]); + return initialScrollOffsets.current ? (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.subtract)(scrollOffsets, initialScrollOffsets.current) : defaultCoordinates; +} + +function useSensorSetup(sensors) { + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (!_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.canUseDOM) { + return; + } + + const teardownFns = sensors.map(_ref => { + let { + sensor + } = _ref; + return sensor.setup == null ? void 0 : sensor.setup(); + }); + return () => { + for (const teardown of teardownFns) { + teardown == null ? void 0 : teardown(); + } + }; + }, // TO-DO: Sensors length could theoretically change which would not be a valid dependency + // eslint-disable-next-line react-hooks/exhaustive-deps + sensors.map(_ref2 => { + let { + sensor + } = _ref2; + return sensor; + })); +} + +function useSyntheticListeners(listeners, id) { + return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { + return listeners.reduce((acc, _ref) => { + let { + eventName, + handler + } = _ref; + + acc[eventName] = event => { + handler(event, id); + }; + + return acc; + }, {}); + }, [listeners, id]); +} + +function useWindowRect(element) { + return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => element ? getWindowClientRect(element) : null, [element]); +} + +const defaultValue$2 = []; +function useRects(elements, measure) { + if (measure === void 0) { + measure = getClientRect; + } + + const [firstElement] = elements; + const windowRect = useWindowRect(firstElement ? (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getWindow)(firstElement) : null); + const [rects, measureRects] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useReducer)(reducer, defaultValue$2); + const resizeObserver = useResizeObserver({ + callback: measureRects + }); + + if (elements.length > 0 && rects === defaultValue$2) { + measureRects(); + } + + (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useIsomorphicLayoutEffect)(() => { + if (elements.length) { + elements.forEach(element => resizeObserver == null ? void 0 : resizeObserver.observe(element)); + } else { + resizeObserver == null ? void 0 : resizeObserver.disconnect(); + measureRects(); + } + }, [elements]); + return rects; + + function reducer() { + if (!elements.length) { + return defaultValue$2; + } + + return elements.map(element => isDocumentScrollingElement(element) ? windowRect : new Rect(measure(element), element)); + } +} + +function getMeasurableNode(node) { + if (!node) { + return null; + } + + if (node.children.length > 1) { + return node; + } + + const firstChild = node.children[0]; + return (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.isHTMLElement)(firstChild) ? firstChild : node; +} + +function useDragOverlayMeasuring(_ref) { + let { + measure + } = _ref; + const [rect, setRect] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null); + const handleResize = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(entries => { + for (const { + target + } of entries) { + if ((0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.isHTMLElement)(target)) { + setRect(rect => { + const newRect = measure(target); + return rect ? { ...rect, + width: newRect.width, + height: newRect.height + } : newRect; + }); + break; + } + } + }, [measure]); + const resizeObserver = useResizeObserver({ + callback: handleResize + }); + const handleNodeChange = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(element => { + const node = getMeasurableNode(element); + resizeObserver == null ? void 0 : resizeObserver.disconnect(); + + if (node) { + resizeObserver == null ? void 0 : resizeObserver.observe(node); + } + + setRect(node ? measure(node) : null); + }, [measure, resizeObserver]); + const [nodeRef, setRef] = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useNodeRef)(handleNodeChange); + return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => ({ + nodeRef, + rect, + setRef + }), [rect, nodeRef, setRef]); +} + +const defaultSensors = [{ + sensor: PointerSensor, + options: {} +}, { + sensor: KeyboardSensor, + options: {} +}]; +const defaultData = { + current: {} +}; +const defaultMeasuringConfiguration = { + draggable: { + measure: getTransformAgnosticClientRect + }, + droppable: { + measure: getTransformAgnosticClientRect, + strategy: MeasuringStrategy.WhileDragging, + frequency: MeasuringFrequency.Optimized + }, + dragOverlay: { + measure: getClientRect + } +}; + +class DroppableContainersMap extends Map { + get(id) { + var _super$get; + + return id != null ? (_super$get = super.get(id)) != null ? _super$get : undefined : undefined; + } + + toArray() { + return Array.from(this.values()); + } + + getEnabled() { + return this.toArray().filter(_ref => { + let { + disabled + } = _ref; + return !disabled; + }); + } + + getNodeFor(id) { + var _this$get$node$curren, _this$get; + + return (_this$get$node$curren = (_this$get = this.get(id)) == null ? void 0 : _this$get.node.current) != null ? _this$get$node$curren : undefined; + } + +} + +const defaultPublicContext = { + activatorEvent: null, + active: null, + activeNode: null, + activeNodeRect: null, + collisions: null, + containerNodeRect: null, + draggableNodes: /*#__PURE__*/new Map(), + droppableRects: /*#__PURE__*/new Map(), + droppableContainers: /*#__PURE__*/new DroppableContainersMap(), + over: null, + dragOverlay: { + nodeRef: { + current: null + }, + rect: null, + setRef: noop + }, + scrollableAncestors: [], + scrollableAncestorRects: [], + measuringConfiguration: defaultMeasuringConfiguration, + measureDroppableContainers: noop, + windowRect: null, + measuringScheduled: false +}; +const defaultInternalContext = { + activatorEvent: null, + activators: [], + active: null, + activeNodeRect: null, + ariaDescribedById: { + draggable: '' + }, + dispatch: noop, + draggableNodes: /*#__PURE__*/new Map(), + over: null, + measureDroppableContainers: noop +}; +const InternalContext = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(defaultInternalContext); +const PublicContext = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(defaultPublicContext); + +function getInitialState() { + return { + draggable: { + active: null, + initialCoordinates: { + x: 0, + y: 0 + }, + nodes: new Map(), + translate: { + x: 0, + y: 0 + } + }, + droppable: { + containers: new DroppableContainersMap() + } + }; +} +function reducer(state, action) { + switch (action.type) { + case Action.DragStart: + return { ...state, + draggable: { ...state.draggable, + initialCoordinates: action.initialCoordinates, + active: action.active + } + }; + + case Action.DragMove: + if (!state.draggable.active) { + return state; + } + + return { ...state, + draggable: { ...state.draggable, + translate: { + x: action.coordinates.x - state.draggable.initialCoordinates.x, + y: action.coordinates.y - state.draggable.initialCoordinates.y + } + } + }; + + case Action.DragEnd: + case Action.DragCancel: + return { ...state, + draggable: { ...state.draggable, + active: null, + initialCoordinates: { + x: 0, + y: 0 + }, + translate: { + x: 0, + y: 0 + } + } + }; + + case Action.RegisterDroppable: + { + const { + element + } = action; + const { + id + } = element; + const containers = new DroppableContainersMap(state.droppable.containers); + containers.set(id, element); + return { ...state, + droppable: { ...state.droppable, + containers + } + }; + } + + case Action.SetDroppableDisabled: + { + const { + id, + key, + disabled + } = action; + const element = state.droppable.containers.get(id); + + if (!element || key !== element.key) { + return state; + } + + const containers = new DroppableContainersMap(state.droppable.containers); + containers.set(id, { ...element, + disabled + }); + return { ...state, + droppable: { ...state.droppable, + containers + } + }; + } + + case Action.UnregisterDroppable: + { + const { + id, + key + } = action; + const element = state.droppable.containers.get(id); + + if (!element || key !== element.key) { + return state; + } + + const containers = new DroppableContainersMap(state.droppable.containers); + containers.delete(id); + return { ...state, + droppable: { ...state.droppable, + containers + } + }; + } + + default: + { + return state; + } + } +} + +function RestoreFocus(_ref) { + let { + disabled + } = _ref; + const { + active, + activatorEvent, + draggableNodes + } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(InternalContext); + const previousActivatorEvent = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.usePrevious)(activatorEvent); + const previousActiveId = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.usePrevious)(active == null ? void 0 : active.id); // Restore keyboard focus on the activator node + + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (disabled) { + return; + } + + if (!activatorEvent && previousActivatorEvent && previousActiveId != null) { + if (!(0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.isKeyboardEvent)(previousActivatorEvent)) { + return; + } + + if (document.activeElement === previousActivatorEvent.target) { + // No need to restore focus + return; + } + + const draggableNode = draggableNodes.get(previousActiveId); + + if (!draggableNode) { + return; + } + + const { + activatorNode, + node + } = draggableNode; + + if (!activatorNode.current && !node.current) { + return; + } + + requestAnimationFrame(() => { + for (const element of [activatorNode.current, node.current]) { + if (!element) { + continue; + } + + const focusableNode = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.findFirstFocusableNode)(element); + + if (focusableNode) { + focusableNode.focus(); + break; + } + } + }); + } + }, [activatorEvent, disabled, draggableNodes, previousActiveId, previousActivatorEvent]); + return null; +} + +function applyModifiers(modifiers, _ref) { + let { + transform, + ...args + } = _ref; + return modifiers != null && modifiers.length ? modifiers.reduce((accumulator, modifier) => { + return modifier({ + transform: accumulator, + ...args + }); + }, transform) : transform; +} + +function useMeasuringConfiguration(config) { + return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => ({ + draggable: { ...defaultMeasuringConfiguration.draggable, + ...(config == null ? void 0 : config.draggable) + }, + droppable: { ...defaultMeasuringConfiguration.droppable, + ...(config == null ? void 0 : config.droppable) + }, + dragOverlay: { ...defaultMeasuringConfiguration.dragOverlay, + ...(config == null ? void 0 : config.dragOverlay) + } + }), // eslint-disable-next-line react-hooks/exhaustive-deps + [config == null ? void 0 : config.draggable, config == null ? void 0 : config.droppable, config == null ? void 0 : config.dragOverlay]); +} + +function useLayoutShiftScrollCompensation(_ref) { + let { + activeNode, + measure, + initialRect, + config = true + } = _ref; + const initialized = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(false); + const { + x, + y + } = typeof config === 'boolean' ? { + x: config, + y: config + } : config; + (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useIsomorphicLayoutEffect)(() => { + const disabled = !x && !y; + + if (disabled || !activeNode) { + initialized.current = false; + return; + } + + if (initialized.current || !initialRect) { + // Return early if layout shift scroll compensation was already attempted + // or if there is no initialRect to compare to. + return; + } // Get the most up to date node ref for the active draggable + + + const node = activeNode == null ? void 0 : activeNode.node.current; + + if (!node || node.isConnected === false) { + // Return early if there is no attached node ref or if the node is + // disconnected from the document. + return; + } + + const rect = measure(node); + const rectDelta = getRectDelta(rect, initialRect); + + if (!x) { + rectDelta.x = 0; + } + + if (!y) { + rectDelta.y = 0; + } // Only perform layout shift scroll compensation once + + + initialized.current = true; + + if (Math.abs(rectDelta.x) > 0 || Math.abs(rectDelta.y) > 0) { + const firstScrollableAncestor = getFirstScrollableAncestor(node); + + if (firstScrollableAncestor) { + firstScrollableAncestor.scrollBy({ + top: rectDelta.y, + left: rectDelta.x + }); + } + } + }, [activeNode, x, y, initialRect, measure]); +} + +const ActiveDraggableContext = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)({ ...defaultCoordinates, + scaleX: 1, + scaleY: 1 +}); +var Status; + +(function (Status) { + Status[Status["Uninitialized"] = 0] = "Uninitialized"; + Status[Status["Initializing"] = 1] = "Initializing"; + Status[Status["Initialized"] = 2] = "Initialized"; +})(Status || (Status = {})); + +const DndContext = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.memo)(function DndContext(_ref) { + var _sensorContext$curren, _dragOverlay$nodeRef$, _dragOverlay$rect, _over$rect; + + let { + id, + accessibility, + autoScroll = true, + children, + sensors = defaultSensors, + collisionDetection = rectIntersection, + measuring, + modifiers, + ...props + } = _ref; + const store = (0,react__WEBPACK_IMPORTED_MODULE_0__.useReducer)(reducer, undefined, getInitialState); + const [state, dispatch] = store; + const [dispatchMonitorEvent, registerMonitorListener] = useDndMonitorProvider(); + const [status, setStatus] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(Status.Uninitialized); + const isInitialized = status === Status.Initialized; + const { + draggable: { + active: activeId, + nodes: draggableNodes, + translate + }, + droppable: { + containers: droppableContainers + } + } = state; + const node = activeId ? draggableNodes.get(activeId) : null; + const activeRects = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)({ + initial: null, + translated: null + }); + const active = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { + var _node$data; + + return activeId != null ? { + id: activeId, + // It's possible for the active node to unmount while dragging + data: (_node$data = node == null ? void 0 : node.data) != null ? _node$data : defaultData, + rect: activeRects + } : null; + }, [activeId, node]); + const activeRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); + const [activeSensor, setActiveSensor] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null); + const [activatorEvent, setActivatorEvent] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null); + const latestProps = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useLatestValue)(props, Object.values(props)); + const draggableDescribedById = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useUniqueId)("DndDescribedBy", id); + const enabledDroppableContainers = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => droppableContainers.getEnabled(), [droppableContainers]); + const measuringConfiguration = useMeasuringConfiguration(measuring); + const { + droppableRects, + measureDroppableContainers, + measuringScheduled + } = useDroppableMeasuring(enabledDroppableContainers, { + dragging: isInitialized, + dependencies: [translate.x, translate.y], + config: measuringConfiguration.droppable + }); + const activeNode = useCachedNode(draggableNodes, activeId); + const activationCoordinates = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => activatorEvent ? (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getEventCoordinates)(activatorEvent) : null, [activatorEvent]); + const autoScrollOptions = getAutoScrollerOptions(); + const initialActiveNodeRect = useInitialRect(activeNode, measuringConfiguration.draggable.measure); + useLayoutShiftScrollCompensation({ + activeNode: activeId ? draggableNodes.get(activeId) : null, + config: autoScrollOptions.layoutShiftCompensation, + initialRect: initialActiveNodeRect, + measure: measuringConfiguration.draggable.measure + }); + const activeNodeRect = useRect(activeNode, measuringConfiguration.draggable.measure, initialActiveNodeRect); + const containerNodeRect = useRect(activeNode ? activeNode.parentElement : null); + const sensorContext = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)({ + activatorEvent: null, + active: null, + activeNode, + collisionRect: null, + collisions: null, + droppableRects, + draggableNodes, + draggingNode: null, + draggingNodeRect: null, + droppableContainers, + over: null, + scrollableAncestors: [], + scrollAdjustedTranslate: null + }); + const overNode = droppableContainers.getNodeFor((_sensorContext$curren = sensorContext.current.over) == null ? void 0 : _sensorContext$curren.id); + const dragOverlay = useDragOverlayMeasuring({ + measure: measuringConfiguration.dragOverlay.measure + }); // Use the rect of the drag overlay if it is mounted + + const draggingNode = (_dragOverlay$nodeRef$ = dragOverlay.nodeRef.current) != null ? _dragOverlay$nodeRef$ : activeNode; + const draggingNodeRect = isInitialized ? (_dragOverlay$rect = dragOverlay.rect) != null ? _dragOverlay$rect : activeNodeRect : null; + const usesDragOverlay = Boolean(dragOverlay.nodeRef.current && dragOverlay.rect); // The delta between the previous and new position of the draggable node + // is only relevant when there is no drag overlay + + const nodeRectDelta = useRectDelta(usesDragOverlay ? null : activeNodeRect); // Get the window rect of the dragging node + + const windowRect = useWindowRect(draggingNode ? (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getWindow)(draggingNode) : null); // Get scrollable ancestors of the dragging node + + const scrollableAncestors = useScrollableAncestors(isInitialized ? overNode != null ? overNode : activeNode : null); + const scrollableAncestorRects = useRects(scrollableAncestors); // Apply modifiers + + const modifiedTranslate = applyModifiers(modifiers, { + transform: { + x: translate.x - nodeRectDelta.x, + y: translate.y - nodeRectDelta.y, + scaleX: 1, + scaleY: 1 + }, + activatorEvent, + active, + activeNodeRect, + containerNodeRect, + draggingNodeRect, + over: sensorContext.current.over, + overlayNodeRect: dragOverlay.rect, + scrollableAncestors, + scrollableAncestorRects, + windowRect + }); + const pointerCoordinates = activationCoordinates ? (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.add)(activationCoordinates, translate) : null; + const scrollOffsets = useScrollOffsets(scrollableAncestors); // Represents the scroll delta since dragging was initiated + + const scrollAdjustment = useScrollOffsetsDelta(scrollOffsets); // Represents the scroll delta since the last time the active node rect was measured + + const activeNodeScrollDelta = useScrollOffsetsDelta(scrollOffsets, [activeNodeRect]); + const scrollAdjustedTranslate = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.add)(modifiedTranslate, scrollAdjustment); + const collisionRect = draggingNodeRect ? getAdjustedRect(draggingNodeRect, modifiedTranslate) : null; + const collisions = active && collisionRect ? collisionDetection({ + active, + collisionRect, + droppableRects, + droppableContainers: enabledDroppableContainers, + pointerCoordinates + }) : null; + const overId = getFirstCollision(collisions, 'id'); + const [over, setOver] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null); // When there is no drag overlay used, we need to account for the + // window scroll delta + + const appliedTranslate = usesDragOverlay ? modifiedTranslate : (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.add)(modifiedTranslate, activeNodeScrollDelta); + const transform = adjustScale(appliedTranslate, (_over$rect = over == null ? void 0 : over.rect) != null ? _over$rect : null, activeNodeRect); + const instantiateSensor = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((event, _ref2) => { + let { + sensor: Sensor, + options + } = _ref2; + + if (activeRef.current == null) { + return; + } + + const activeNode = draggableNodes.get(activeRef.current); + + if (!activeNode) { + return; + } + + const activatorEvent = event.nativeEvent; + const sensorInstance = new Sensor({ + active: activeRef.current, + activeNode, + event: activatorEvent, + options, + // Sensors need to be instantiated with refs for arguments that change over time + // otherwise they are frozen in time with the stale arguments + context: sensorContext, + + onStart(initialCoordinates) { + const id = activeRef.current; + + if (id == null) { + return; + } + + const draggableNode = draggableNodes.get(id); + + if (!draggableNode) { + return; + } + + const { + onDragStart + } = latestProps.current; + const event = { + active: { + id, + data: draggableNode.data, + rect: activeRects + } + }; + (0,react_dom__WEBPACK_IMPORTED_MODULE_1__.unstable_batchedUpdates)(() => { + onDragStart == null ? void 0 : onDragStart(event); + setStatus(Status.Initializing); + dispatch({ + type: Action.DragStart, + initialCoordinates, + active: id + }); + dispatchMonitorEvent({ + type: 'onDragStart', + event + }); + }); + }, + + onMove(coordinates) { + dispatch({ + type: Action.DragMove, + coordinates + }); + }, + + onEnd: createHandler(Action.DragEnd), + onCancel: createHandler(Action.DragCancel) + }); + (0,react_dom__WEBPACK_IMPORTED_MODULE_1__.unstable_batchedUpdates)(() => { + setActiveSensor(sensorInstance); + setActivatorEvent(event.nativeEvent); + }); + + function createHandler(type) { + return async function handler() { + const { + active, + collisions, + over, + scrollAdjustedTranslate + } = sensorContext.current; + let event = null; + + if (active && scrollAdjustedTranslate) { + const { + cancelDrop + } = latestProps.current; + event = { + activatorEvent, + active: active, + collisions, + delta: scrollAdjustedTranslate, + over + }; + + if (type === Action.DragEnd && typeof cancelDrop === 'function') { + const shouldCancel = await Promise.resolve(cancelDrop(event)); + + if (shouldCancel) { + type = Action.DragCancel; + } + } + } + + activeRef.current = null; + (0,react_dom__WEBPACK_IMPORTED_MODULE_1__.unstable_batchedUpdates)(() => { + dispatch({ + type + }); + setStatus(Status.Uninitialized); + setOver(null); + setActiveSensor(null); + setActivatorEvent(null); + const eventName = type === Action.DragEnd ? 'onDragEnd' : 'onDragCancel'; + + if (event) { + const handler = latestProps.current[eventName]; + handler == null ? void 0 : handler(event); + dispatchMonitorEvent({ + type: eventName, + event + }); + } + }); + }; + } + }, // eslint-disable-next-line react-hooks/exhaustive-deps + [draggableNodes]); + const bindActivatorToSensorInstantiator = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((handler, sensor) => { + return (event, active) => { + const nativeEvent = event.nativeEvent; + const activeDraggableNode = draggableNodes.get(active); + + if ( // Another sensor is already instantiating + activeRef.current !== null || // No active draggable + !activeDraggableNode || // Event has already been captured + nativeEvent.dndKit || nativeEvent.defaultPrevented) { + return; + } + + const activationContext = { + active: activeDraggableNode + }; + const shouldActivate = handler(event, sensor.options, activationContext); + + if (shouldActivate === true) { + nativeEvent.dndKit = { + capturedBy: sensor.sensor + }; + activeRef.current = active; + instantiateSensor(event, sensor); + } + }; + }, [draggableNodes, instantiateSensor]); + const activators = useCombineActivators(sensors, bindActivatorToSensorInstantiator); + useSensorSetup(sensors); + (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useIsomorphicLayoutEffect)(() => { + if (activeNodeRect && status === Status.Initializing) { + setStatus(Status.Initialized); + } + }, [activeNodeRect, status]); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + const { + onDragMove + } = latestProps.current; + const { + active, + activatorEvent, + collisions, + over + } = sensorContext.current; + + if (!active || !activatorEvent) { + return; + } + + const event = { + active, + activatorEvent, + collisions, + delta: { + x: scrollAdjustedTranslate.x, + y: scrollAdjustedTranslate.y + }, + over + }; + (0,react_dom__WEBPACK_IMPORTED_MODULE_1__.unstable_batchedUpdates)(() => { + onDragMove == null ? void 0 : onDragMove(event); + dispatchMonitorEvent({ + type: 'onDragMove', + event + }); + }); + }, // eslint-disable-next-line react-hooks/exhaustive-deps + [scrollAdjustedTranslate.x, scrollAdjustedTranslate.y]); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + const { + active, + activatorEvent, + collisions, + droppableContainers, + scrollAdjustedTranslate + } = sensorContext.current; + + if (!active || activeRef.current == null || !activatorEvent || !scrollAdjustedTranslate) { + return; + } + + const { + onDragOver + } = latestProps.current; + const overContainer = droppableContainers.get(overId); + const over = overContainer && overContainer.rect.current ? { + id: overContainer.id, + rect: overContainer.rect.current, + data: overContainer.data, + disabled: overContainer.disabled + } : null; + const event = { + active, + activatorEvent, + collisions, + delta: { + x: scrollAdjustedTranslate.x, + y: scrollAdjustedTranslate.y + }, + over + }; + (0,react_dom__WEBPACK_IMPORTED_MODULE_1__.unstable_batchedUpdates)(() => { + setOver(over); + onDragOver == null ? void 0 : onDragOver(event); + dispatchMonitorEvent({ + type: 'onDragOver', + event + }); + }); + }, // eslint-disable-next-line react-hooks/exhaustive-deps + [overId]); + (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useIsomorphicLayoutEffect)(() => { + sensorContext.current = { + activatorEvent, + active, + activeNode, + collisionRect, + collisions, + droppableRects, + draggableNodes, + draggingNode, + draggingNodeRect, + droppableContainers, + over, + scrollableAncestors, + scrollAdjustedTranslate + }; + activeRects.current = { + initial: draggingNodeRect, + translated: collisionRect + }; + }, [active, activeNode, collisions, collisionRect, draggableNodes, draggingNode, draggingNodeRect, droppableRects, droppableContainers, over, scrollableAncestors, scrollAdjustedTranslate]); + useAutoScroller({ ...autoScrollOptions, + delta: translate, + draggingRect: collisionRect, + pointerCoordinates, + scrollableAncestors, + scrollableAncestorRects + }); + const publicContext = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { + const context = { + active, + activeNode, + activeNodeRect, + activatorEvent, + collisions, + containerNodeRect, + dragOverlay, + draggableNodes, + droppableContainers, + droppableRects, + over, + measureDroppableContainers, + scrollableAncestors, + scrollableAncestorRects, + measuringConfiguration, + measuringScheduled, + windowRect + }; + return context; + }, [active, activeNode, activeNodeRect, activatorEvent, collisions, containerNodeRect, dragOverlay, draggableNodes, droppableContainers, droppableRects, over, measureDroppableContainers, scrollableAncestors, scrollableAncestorRects, measuringConfiguration, measuringScheduled, windowRect]); + const internalContext = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { + const context = { + activatorEvent, + activators, + active, + activeNodeRect, + ariaDescribedById: { + draggable: draggableDescribedById + }, + dispatch, + draggableNodes, + over, + measureDroppableContainers + }; + return context; + }, [activatorEvent, activators, active, activeNodeRect, dispatch, draggableDescribedById, draggableNodes, over, measureDroppableContainers]); + return react__WEBPACK_IMPORTED_MODULE_0___default().createElement(DndMonitorContext.Provider, { + value: registerMonitorListener + }, react__WEBPACK_IMPORTED_MODULE_0___default().createElement(InternalContext.Provider, { + value: internalContext + }, react__WEBPACK_IMPORTED_MODULE_0___default().createElement(PublicContext.Provider, { + value: publicContext + }, react__WEBPACK_IMPORTED_MODULE_0___default().createElement(ActiveDraggableContext.Provider, { + value: transform + }, children)), react__WEBPACK_IMPORTED_MODULE_0___default().createElement(RestoreFocus, { + disabled: (accessibility == null ? void 0 : accessibility.restoreFocus) === false + })), react__WEBPACK_IMPORTED_MODULE_0___default().createElement(Accessibility, { ...accessibility, + hiddenTextDescribedById: draggableDescribedById + })); + + function getAutoScrollerOptions() { + const activeSensorDisablesAutoscroll = (activeSensor == null ? void 0 : activeSensor.autoScrollEnabled) === false; + const autoScrollGloballyDisabled = typeof autoScroll === 'object' ? autoScroll.enabled === false : autoScroll === false; + const enabled = isInitialized && !activeSensorDisablesAutoscroll && !autoScrollGloballyDisabled; + + if (typeof autoScroll === 'object') { + return { ...autoScroll, + enabled + }; + } + + return { + enabled + }; + } +}); + +const NullContext = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(null); +const defaultRole = 'button'; +const ID_PREFIX = 'Droppable'; +function useDraggable(_ref) { + let { + id, + data, + disabled = false, + attributes + } = _ref; + const key = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useUniqueId)(ID_PREFIX); + const { + activators, + activatorEvent, + active, + activeNodeRect, + ariaDescribedById, + draggableNodes, + over + } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(InternalContext); + const { + role = defaultRole, + roleDescription = 'draggable', + tabIndex = 0 + } = attributes != null ? attributes : {}; + const isDragging = (active == null ? void 0 : active.id) === id; + const transform = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(isDragging ? ActiveDraggableContext : NullContext); + const [node, setNodeRef] = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useNodeRef)(); + const [activatorNode, setActivatorNodeRef] = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useNodeRef)(); + const listeners = useSyntheticListeners(activators, id); + const dataRef = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useLatestValue)(data); + (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useIsomorphicLayoutEffect)(() => { + draggableNodes.set(id, { + id, + key, + node, + activatorNode, + data: dataRef + }); + return () => { + const node = draggableNodes.get(id); + + if (node && node.key === key) { + draggableNodes.delete(id); + } + }; + }, // eslint-disable-next-line react-hooks/exhaustive-deps + [draggableNodes, id]); + const memoizedAttributes = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => ({ + role, + tabIndex, + 'aria-disabled': disabled, + 'aria-pressed': isDragging && role === defaultRole ? true : undefined, + 'aria-roledescription': roleDescription, + 'aria-describedby': ariaDescribedById.draggable + }), [disabled, role, tabIndex, isDragging, roleDescription, ariaDescribedById.draggable]); + return { + active, + activatorEvent, + activeNodeRect, + attributes: memoizedAttributes, + isDragging, + listeners: disabled ? undefined : listeners, + node, + over, + setNodeRef, + setActivatorNodeRef, + transform + }; +} + +function useDndContext() { + return (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(PublicContext); +} + +const ID_PREFIX$1 = 'Droppable'; +const defaultResizeObserverConfig = { + timeout: 25 +}; +function useDroppable(_ref) { + let { + data, + disabled = false, + id, + resizeObserverConfig + } = _ref; + const key = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useUniqueId)(ID_PREFIX$1); + const { + active, + dispatch, + over, + measureDroppableContainers + } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(InternalContext); + const previous = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)({ + disabled + }); + const resizeObserverConnected = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(false); + const rect = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); + const callbackId = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); + const { + disabled: resizeObserverDisabled, + updateMeasurementsFor, + timeout: resizeObserverTimeout + } = { ...defaultResizeObserverConfig, + ...resizeObserverConfig + }; + const ids = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useLatestValue)(updateMeasurementsFor != null ? updateMeasurementsFor : id); + const handleResize = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(() => { + if (!resizeObserverConnected.current) { + // ResizeObserver invokes the `handleResize` callback as soon as `observe` is called, + // assuming the element is rendered and displayed. + resizeObserverConnected.current = true; + return; + } + + if (callbackId.current != null) { + clearTimeout(callbackId.current); + } + + callbackId.current = setTimeout(() => { + measureDroppableContainers(Array.isArray(ids.current) ? ids.current : [ids.current]); + callbackId.current = null; + }, resizeObserverTimeout); + }, //eslint-disable-next-line react-hooks/exhaustive-deps + [resizeObserverTimeout]); + const resizeObserver = useResizeObserver({ + callback: handleResize, + disabled: resizeObserverDisabled || !active + }); + const handleNodeChange = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((newElement, previousElement) => { + if (!resizeObserver) { + return; + } + + if (previousElement) { + resizeObserver.unobserve(previousElement); + resizeObserverConnected.current = false; + } + + if (newElement) { + resizeObserver.observe(newElement); + } + }, [resizeObserver]); + const [nodeRef, setNodeRef] = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useNodeRef)(handleNodeChange); + const dataRef = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useLatestValue)(data); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (!resizeObserver || !nodeRef.current) { + return; + } + + resizeObserver.disconnect(); + resizeObserverConnected.current = false; + resizeObserver.observe(nodeRef.current); + }, [nodeRef, resizeObserver]); + (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useIsomorphicLayoutEffect)(() => { + dispatch({ + type: Action.RegisterDroppable, + element: { + id, + key, + disabled, + node: nodeRef, + rect, + data: dataRef + } + }); + return () => dispatch({ + type: Action.UnregisterDroppable, + key, + id + }); + }, // eslint-disable-next-line react-hooks/exhaustive-deps + [id]); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (disabled !== previous.current.disabled) { + dispatch({ + type: Action.SetDroppableDisabled, + id, + key, + disabled + }); + previous.current.disabled = disabled; + } + }, [id, key, disabled, dispatch]); + return { + active, + rect, + isOver: (over == null ? void 0 : over.id) === id, + node: nodeRef, + over, + setNodeRef + }; +} + +function AnimationManager(_ref) { + let { + animation, + children + } = _ref; + const [clonedChildren, setClonedChildren] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null); + const [element, setElement] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null); + const previousChildren = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.usePrevious)(children); + + if (!children && !clonedChildren && previousChildren) { + setClonedChildren(previousChildren); + } + + (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useIsomorphicLayoutEffect)(() => { + if (!element) { + return; + } + + const key = clonedChildren == null ? void 0 : clonedChildren.key; + const id = clonedChildren == null ? void 0 : clonedChildren.props.id; + + if (key == null || id == null) { + setClonedChildren(null); + return; + } + + Promise.resolve(animation(id, element)).then(() => { + setClonedChildren(null); + }); + }, [animation, clonedChildren, element]); + return react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, children, clonedChildren ? (0,react__WEBPACK_IMPORTED_MODULE_0__.cloneElement)(clonedChildren, { + ref: setElement + }) : null); +} + +const defaultTransform = { + x: 0, + y: 0, + scaleX: 1, + scaleY: 1 +}; +function NullifiedContextProvider(_ref) { + let { + children + } = _ref; + return react__WEBPACK_IMPORTED_MODULE_0___default().createElement(InternalContext.Provider, { + value: defaultInternalContext + }, react__WEBPACK_IMPORTED_MODULE_0___default().createElement(ActiveDraggableContext.Provider, { + value: defaultTransform + }, children)); +} + +const baseStyles = { + position: 'fixed', + touchAction: 'none' +}; + +const defaultTransition = activatorEvent => { + const isKeyboardActivator = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.isKeyboardEvent)(activatorEvent); + return isKeyboardActivator ? 'transform 250ms ease' : undefined; +}; + +const PositionedOverlay = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)((_ref, ref) => { + let { + as, + activatorEvent, + adjustScale, + children, + className, + rect, + style, + transform, + transition = defaultTransition + } = _ref; + + if (!rect) { + return null; + } + + const scaleAdjustedTransform = adjustScale ? transform : { ...transform, + scaleX: 1, + scaleY: 1 + }; + const styles = { ...baseStyles, + width: rect.width, + height: rect.height, + top: rect.top, + left: rect.left, + transform: _dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.CSS.Transform.toString(scaleAdjustedTransform), + transformOrigin: adjustScale && activatorEvent ? getRelativeTransformOrigin(activatorEvent, rect) : undefined, + transition: typeof transition === 'function' ? transition(activatorEvent) : transition, + ...style + }; + return react__WEBPACK_IMPORTED_MODULE_0___default().createElement(as, { + className, + style: styles, + ref + }, children); +}); + +const defaultDropAnimationSideEffects = options => _ref => { + let { + active, + dragOverlay + } = _ref; + const originalStyles = {}; + const { + styles, + className + } = options; + + if (styles != null && styles.active) { + for (const [key, value] of Object.entries(styles.active)) { + if (value === undefined) { + continue; + } + + originalStyles[key] = active.node.style.getPropertyValue(key); + active.node.style.setProperty(key, value); + } + } + + if (styles != null && styles.dragOverlay) { + for (const [key, value] of Object.entries(styles.dragOverlay)) { + if (value === undefined) { + continue; + } + + dragOverlay.node.style.setProperty(key, value); + } + } + + if (className != null && className.active) { + active.node.classList.add(className.active); + } + + if (className != null && className.dragOverlay) { + dragOverlay.node.classList.add(className.dragOverlay); + } + + return function cleanup() { + for (const [key, value] of Object.entries(originalStyles)) { + active.node.style.setProperty(key, value); + } + + if (className != null && className.active) { + active.node.classList.remove(className.active); + } + }; +}; + +const defaultKeyframeResolver = _ref2 => { + let { + transform: { + initial, + final + } + } = _ref2; + return [{ + transform: _dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.CSS.Transform.toString(initial) + }, { + transform: _dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.CSS.Transform.toString(final) + }]; +}; + +const defaultDropAnimationConfiguration = { + duration: 250, + easing: 'ease', + keyframes: defaultKeyframeResolver, + sideEffects: /*#__PURE__*/defaultDropAnimationSideEffects({ + styles: { + active: { + opacity: '0' + } + } + }) +}; +function useDropAnimation(_ref3) { + let { + config, + draggableNodes, + droppableContainers, + measuringConfiguration + } = _ref3; + return (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useEvent)((id, node) => { + if (config === null) { + return; + } + + const activeDraggable = draggableNodes.get(id); + + if (!activeDraggable) { + return; + } + + const activeNode = activeDraggable.node.current; + + if (!activeNode) { + return; + } + + const measurableNode = getMeasurableNode(node); + + if (!measurableNode) { + return; + } + + const { + transform + } = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.getWindow)(node).getComputedStyle(node); + const parsedTransform = parseTransform(transform); + + if (!parsedTransform) { + return; + } + + const animation = typeof config === 'function' ? config : createDefaultDropAnimation(config); + scrollIntoViewIfNeeded(activeNode, measuringConfiguration.draggable.measure); + return animation({ + active: { + id, + data: activeDraggable.data, + node: activeNode, + rect: measuringConfiguration.draggable.measure(activeNode) + }, + draggableNodes, + dragOverlay: { + node, + rect: measuringConfiguration.dragOverlay.measure(measurableNode) + }, + droppableContainers, + measuringConfiguration, + transform: parsedTransform + }); + }); +} + +function createDefaultDropAnimation(options) { + const { + duration, + easing, + sideEffects, + keyframes + } = { ...defaultDropAnimationConfiguration, + ...options + }; + return _ref4 => { + let { + active, + dragOverlay, + transform, + ...rest + } = _ref4; + + if (!duration) { + // Do not animate if animation duration is zero. + return; + } + + const delta = { + x: dragOverlay.rect.left - active.rect.left, + y: dragOverlay.rect.top - active.rect.top + }; + const scale = { + scaleX: transform.scaleX !== 1 ? active.rect.width * transform.scaleX / dragOverlay.rect.width : 1, + scaleY: transform.scaleY !== 1 ? active.rect.height * transform.scaleY / dragOverlay.rect.height : 1 + }; + const finalTransform = { + x: transform.x - delta.x, + y: transform.y - delta.y, + ...scale + }; + const animationKeyframes = keyframes({ ...rest, + active, + dragOverlay, + transform: { + initial: transform, + final: finalTransform + } + }); + const [firstKeyframe] = animationKeyframes; + const lastKeyframe = animationKeyframes[animationKeyframes.length - 1]; + + if (JSON.stringify(firstKeyframe) === JSON.stringify(lastKeyframe)) { + // The start and end keyframes are the same, infer that there is no animation needed. + return; + } + + const cleanup = sideEffects == null ? void 0 : sideEffects({ + active, + dragOverlay, + ...rest + }); + const animation = dragOverlay.node.animate(animationKeyframes, { + duration, + easing, + fill: 'forwards' + }); + return new Promise(resolve => { + animation.onfinish = () => { + cleanup == null ? void 0 : cleanup(); + resolve(); + }; + }); + }; +} + +let key = 0; +function useKey(id) { + return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { + if (id == null) { + return; + } + + key++; + return key; + }, [id]); +} + +const DragOverlay = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().memo(_ref => { + let { + adjustScale = false, + children, + dropAnimation: dropAnimationConfig, + style, + transition, + modifiers, + wrapperElement = 'div', + className, + zIndex = 999 + } = _ref; + const { + activatorEvent, + active, + activeNodeRect, + containerNodeRect, + draggableNodes, + droppableContainers, + dragOverlay, + over, + measuringConfiguration, + scrollableAncestors, + scrollableAncestorRects, + windowRect + } = useDndContext(); + const transform = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(ActiveDraggableContext); + const key = useKey(active == null ? void 0 : active.id); + const modifiedTransform = applyModifiers(modifiers, { + activatorEvent, + active, + activeNodeRect, + containerNodeRect, + draggingNodeRect: dragOverlay.rect, + over, + overlayNodeRect: dragOverlay.rect, + scrollableAncestors, + scrollableAncestorRects, + transform, + windowRect + }); + const initialRect = useInitialValue(activeNodeRect); + const dropAnimation = useDropAnimation({ + config: dropAnimationConfig, + draggableNodes, + droppableContainers, + measuringConfiguration + }); // We need to wait for the active node to be measured before connecting the drag overlay ref + // otherwise collisions can be computed against a mispositioned drag overlay + + const ref = initialRect ? dragOverlay.setRef : undefined; + return react__WEBPACK_IMPORTED_MODULE_0___default().createElement(NullifiedContextProvider, null, react__WEBPACK_IMPORTED_MODULE_0___default().createElement(AnimationManager, { + animation: dropAnimation + }, active && key ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement(PositionedOverlay, { + key: key, + id: active.id, + ref: ref, + as: wrapperElement, + activatorEvent: activatorEvent, + adjustScale: adjustScale, + className: className, + transition: transition, + rect: initialRect, + style: { + zIndex, + ...style + }, + transform: modifiedTransform + }, children) : null)); +}); + + +//# sourceMappingURL=core.esm.js.map + + +/***/ }), + +/***/ "./node_modules/@dnd-kit/sortable/dist/sortable.esm.js": +/*!*************************************************************!*\ + !*** ./node_modules/@dnd-kit/sortable/dist/sortable.esm.js ***! + \*************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ SortableContext: () => (/* binding */ SortableContext), +/* harmony export */ arrayMove: () => (/* binding */ arrayMove), +/* harmony export */ arraySwap: () => (/* binding */ arraySwap), +/* harmony export */ defaultAnimateLayoutChanges: () => (/* binding */ defaultAnimateLayoutChanges), +/* harmony export */ defaultNewIndexGetter: () => (/* binding */ defaultNewIndexGetter), +/* harmony export */ hasSortableData: () => (/* binding */ hasSortableData), +/* harmony export */ horizontalListSortingStrategy: () => (/* binding */ horizontalListSortingStrategy), +/* harmony export */ rectSortingStrategy: () => (/* binding */ rectSortingStrategy), +/* harmony export */ rectSwappingStrategy: () => (/* binding */ rectSwappingStrategy), +/* harmony export */ sortableKeyboardCoordinates: () => (/* binding */ sortableKeyboardCoordinates), +/* harmony export */ useSortable: () => (/* binding */ useSortable), +/* harmony export */ verticalListSortingStrategy: () => (/* binding */ verticalListSortingStrategy) +/* harmony export */ }); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _dnd_kit_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @dnd-kit/core */ "./node_modules/@dnd-kit/core/dist/core.esm.js"); +/* harmony import */ var _dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @dnd-kit/utilities */ "./node_modules/@dnd-kit/utilities/dist/utilities.esm.js"); + + + + +/** + * Move an array item to a different position. Returns a new array with the item moved to the new position. + */ +function arrayMove(array, from, to) { + const newArray = array.slice(); + newArray.splice(to < 0 ? newArray.length + to : to, 0, newArray.splice(from, 1)[0]); + return newArray; +} + +/** + * Swap an array item to a different position. Returns a new array with the item swapped to the new position. + */ +function arraySwap(array, from, to) { + const newArray = array.slice(); + newArray[from] = array[to]; + newArray[to] = array[from]; + return newArray; +} + +function getSortedRects(items, rects) { + return items.reduce((accumulator, id, index) => { + const rect = rects.get(id); + + if (rect) { + accumulator[index] = rect; + } + + return accumulator; + }, Array(items.length)); +} + +function isValidIndex(index) { + return index !== null && index >= 0; +} + +function itemsEqual(a, b) { + if (a === b) { + return true; + } + + if (a.length !== b.length) { + return false; + } + + for (let i = 0; i < a.length; i++) { + if (a[i] !== b[i]) { + return false; + } + } + + return true; +} + +function normalizeDisabled(disabled) { + if (typeof disabled === 'boolean') { + return { + draggable: disabled, + droppable: disabled + }; + } + + return disabled; +} + +// To-do: We should be calculating scale transformation +const defaultScale = { + scaleX: 1, + scaleY: 1 +}; +const horizontalListSortingStrategy = _ref => { + var _rects$activeIndex; + + let { + rects, + activeNodeRect: fallbackActiveRect, + activeIndex, + overIndex, + index + } = _ref; + const activeNodeRect = (_rects$activeIndex = rects[activeIndex]) != null ? _rects$activeIndex : fallbackActiveRect; + + if (!activeNodeRect) { + return null; + } + + const itemGap = getItemGap(rects, index, activeIndex); + + if (index === activeIndex) { + const newIndexRect = rects[overIndex]; + + if (!newIndexRect) { + return null; + } + + return { + x: activeIndex < overIndex ? newIndexRect.left + newIndexRect.width - (activeNodeRect.left + activeNodeRect.width) : newIndexRect.left - activeNodeRect.left, + y: 0, + ...defaultScale + }; + } + + if (index > activeIndex && index <= overIndex) { + return { + x: -activeNodeRect.width - itemGap, + y: 0, + ...defaultScale + }; + } + + if (index < activeIndex && index >= overIndex) { + return { + x: activeNodeRect.width + itemGap, + y: 0, + ...defaultScale + }; + } + + return { + x: 0, + y: 0, + ...defaultScale + }; +}; + +function getItemGap(rects, index, activeIndex) { + const currentRect = rects[index]; + const previousRect = rects[index - 1]; + const nextRect = rects[index + 1]; + + if (!currentRect || !previousRect && !nextRect) { + return 0; + } + + if (activeIndex < index) { + return previousRect ? currentRect.left - (previousRect.left + previousRect.width) : nextRect.left - (currentRect.left + currentRect.width); + } + + return nextRect ? nextRect.left - (currentRect.left + currentRect.width) : currentRect.left - (previousRect.left + previousRect.width); +} + +const rectSortingStrategy = _ref => { + let { + rects, + activeIndex, + overIndex, + index + } = _ref; + const newRects = arrayMove(rects, overIndex, activeIndex); + const oldRect = rects[index]; + const newRect = newRects[index]; + + if (!newRect || !oldRect) { + return null; + } + + return { + x: newRect.left - oldRect.left, + y: newRect.top - oldRect.top, + scaleX: newRect.width / oldRect.width, + scaleY: newRect.height / oldRect.height + }; +}; + +const rectSwappingStrategy = _ref => { + let { + activeIndex, + index, + rects, + overIndex + } = _ref; + let oldRect; + let newRect; + + if (index === activeIndex) { + oldRect = rects[index]; + newRect = rects[overIndex]; + } + + if (index === overIndex) { + oldRect = rects[index]; + newRect = rects[activeIndex]; + } + + if (!newRect || !oldRect) { + return null; + } + + return { + x: newRect.left - oldRect.left, + y: newRect.top - oldRect.top, + scaleX: newRect.width / oldRect.width, + scaleY: newRect.height / oldRect.height + }; +}; + +// To-do: We should be calculating scale transformation +const defaultScale$1 = { + scaleX: 1, + scaleY: 1 +}; +const verticalListSortingStrategy = _ref => { + var _rects$activeIndex; + + let { + activeIndex, + activeNodeRect: fallbackActiveRect, + index, + rects, + overIndex + } = _ref; + const activeNodeRect = (_rects$activeIndex = rects[activeIndex]) != null ? _rects$activeIndex : fallbackActiveRect; + + if (!activeNodeRect) { + return null; + } + + if (index === activeIndex) { + const overIndexRect = rects[overIndex]; + + if (!overIndexRect) { + return null; + } + + return { + x: 0, + y: activeIndex < overIndex ? overIndexRect.top + overIndexRect.height - (activeNodeRect.top + activeNodeRect.height) : overIndexRect.top - activeNodeRect.top, + ...defaultScale$1 + }; + } + + const itemGap = getItemGap$1(rects, index, activeIndex); + + if (index > activeIndex && index <= overIndex) { + return { + x: 0, + y: -activeNodeRect.height - itemGap, + ...defaultScale$1 + }; + } + + if (index < activeIndex && index >= overIndex) { + return { + x: 0, + y: activeNodeRect.height + itemGap, + ...defaultScale$1 + }; + } + + return { + x: 0, + y: 0, + ...defaultScale$1 + }; +}; + +function getItemGap$1(clientRects, index, activeIndex) { + const currentRect = clientRects[index]; + const previousRect = clientRects[index - 1]; + const nextRect = clientRects[index + 1]; + + if (!currentRect) { + return 0; + } + + if (activeIndex < index) { + return previousRect ? currentRect.top - (previousRect.top + previousRect.height) : nextRect ? nextRect.top - (currentRect.top + currentRect.height) : 0; + } + + return nextRect ? nextRect.top - (currentRect.top + currentRect.height) : previousRect ? currentRect.top - (previousRect.top + previousRect.height) : 0; +} + +const ID_PREFIX = 'Sortable'; +const Context = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext({ + activeIndex: -1, + containerId: ID_PREFIX, + disableTransforms: false, + items: [], + overIndex: -1, + useDragOverlay: false, + sortedRects: [], + strategy: rectSortingStrategy, + disabled: { + draggable: false, + droppable: false + } +}); +function SortableContext(_ref) { + let { + children, + id, + items: userDefinedItems, + strategy = rectSortingStrategy, + disabled: disabledProp = false + } = _ref; + const { + active, + dragOverlay, + droppableRects, + over, + measureDroppableContainers + } = (0,_dnd_kit_core__WEBPACK_IMPORTED_MODULE_1__.useDndContext)(); + const containerId = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useUniqueId)(ID_PREFIX, id); + const useDragOverlay = Boolean(dragOverlay.rect !== null); + const items = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => userDefinedItems.map(item => typeof item === 'object' && 'id' in item ? item.id : item), [userDefinedItems]); + const isDragging = active != null; + const activeIndex = active ? items.indexOf(active.id) : -1; + const overIndex = over ? items.indexOf(over.id) : -1; + const previousItemsRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(items); + const itemsHaveChanged = !itemsEqual(items, previousItemsRef.current); + const disableTransforms = overIndex !== -1 && activeIndex === -1 || itemsHaveChanged; + const disabled = normalizeDisabled(disabledProp); + (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useIsomorphicLayoutEffect)(() => { + if (itemsHaveChanged && isDragging) { + measureDroppableContainers(items); + } + }, [itemsHaveChanged, items, isDragging, measureDroppableContainers]); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + previousItemsRef.current = items; + }, [items]); + const contextValue = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => ({ + activeIndex, + containerId, + disabled, + disableTransforms, + items, + overIndex, + useDragOverlay, + sortedRects: getSortedRects(items, droppableRects), + strategy + }), // eslint-disable-next-line react-hooks/exhaustive-deps + [activeIndex, containerId, disabled.draggable, disabled.droppable, disableTransforms, items, overIndex, droppableRects, useDragOverlay, strategy]); + return react__WEBPACK_IMPORTED_MODULE_0___default().createElement(Context.Provider, { + value: contextValue + }, children); +} + +const defaultNewIndexGetter = _ref => { + let { + id, + items, + activeIndex, + overIndex + } = _ref; + return arrayMove(items, activeIndex, overIndex).indexOf(id); +}; +const defaultAnimateLayoutChanges = _ref2 => { + let { + containerId, + isSorting, + wasDragging, + index, + items, + newIndex, + previousItems, + previousContainerId, + transition + } = _ref2; + + if (!transition || !wasDragging) { + return false; + } + + if (previousItems !== items && index === newIndex) { + return false; + } + + if (isSorting) { + return true; + } + + return newIndex !== index && containerId === previousContainerId; +}; +const defaultTransition = { + duration: 200, + easing: 'ease' +}; +const transitionProperty = 'transform'; +const disabledTransition = /*#__PURE__*/_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.CSS.Transition.toString({ + property: transitionProperty, + duration: 0, + easing: 'linear' +}); +const defaultAttributes = { + roleDescription: 'sortable' +}; + +/* + * When the index of an item changes while sorting, + * we need to temporarily disable the transforms + */ + +function useDerivedTransform(_ref) { + let { + disabled, + index, + node, + rect + } = _ref; + const [derivedTransform, setDerivedtransform] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null); + const previousIndex = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(index); + (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useIsomorphicLayoutEffect)(() => { + if (!disabled && index !== previousIndex.current && node.current) { + const initial = rect.current; + + if (initial) { + const current = (0,_dnd_kit_core__WEBPACK_IMPORTED_MODULE_1__.getClientRect)(node.current, { + ignoreTransform: true + }); + const delta = { + x: initial.left - current.left, + y: initial.top - current.top, + scaleX: initial.width / current.width, + scaleY: initial.height / current.height + }; + + if (delta.x || delta.y) { + setDerivedtransform(delta); + } + } + } + + if (index !== previousIndex.current) { + previousIndex.current = index; + } + }, [disabled, index, node, rect]); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (derivedTransform) { + setDerivedtransform(null); + } + }, [derivedTransform]); + return derivedTransform; +} + +function useSortable(_ref) { + let { + animateLayoutChanges = defaultAnimateLayoutChanges, + attributes: userDefinedAttributes, + disabled: localDisabled, + data: customData, + getNewIndex = defaultNewIndexGetter, + id, + strategy: localStrategy, + resizeObserverConfig, + transition = defaultTransition + } = _ref; + const { + items, + containerId, + activeIndex, + disabled: globalDisabled, + disableTransforms, + sortedRects, + overIndex, + useDragOverlay, + strategy: globalStrategy + } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(Context); + const disabled = normalizeLocalDisabled(localDisabled, globalDisabled); + const index = items.indexOf(id); + const data = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => ({ + sortable: { + containerId, + index, + items + }, + ...customData + }), [containerId, customData, index, items]); + const itemsAfterCurrentSortable = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => items.slice(items.indexOf(id)), [items, id]); + const { + rect, + node, + isOver, + setNodeRef: setDroppableNodeRef + } = (0,_dnd_kit_core__WEBPACK_IMPORTED_MODULE_1__.useDroppable)({ + id, + data, + disabled: disabled.droppable, + resizeObserverConfig: { + updateMeasurementsFor: itemsAfterCurrentSortable, + ...resizeObserverConfig + } + }); + const { + active, + activatorEvent, + activeNodeRect, + attributes, + setNodeRef: setDraggableNodeRef, + listeners, + isDragging, + over, + setActivatorNodeRef, + transform + } = (0,_dnd_kit_core__WEBPACK_IMPORTED_MODULE_1__.useDraggable)({ + id, + data, + attributes: { ...defaultAttributes, + ...userDefinedAttributes + }, + disabled: disabled.draggable + }); + const setNodeRef = (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.useCombinedRefs)(setDroppableNodeRef, setDraggableNodeRef); + const isSorting = Boolean(active); + const displaceItem = isSorting && !disableTransforms && isValidIndex(activeIndex) && isValidIndex(overIndex); + const shouldDisplaceDragSource = !useDragOverlay && isDragging; + const dragSourceDisplacement = shouldDisplaceDragSource && displaceItem ? transform : null; + const strategy = localStrategy != null ? localStrategy : globalStrategy; + const finalTransform = displaceItem ? dragSourceDisplacement != null ? dragSourceDisplacement : strategy({ + rects: sortedRects, + activeNodeRect, + activeIndex, + overIndex, + index + }) : null; + const newIndex = isValidIndex(activeIndex) && isValidIndex(overIndex) ? getNewIndex({ + id, + items, + activeIndex, + overIndex + }) : index; + const activeId = active == null ? void 0 : active.id; + const previous = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)({ + activeId, + items, + newIndex, + containerId + }); + const itemsHaveChanged = items !== previous.current.items; + const shouldAnimateLayoutChanges = animateLayoutChanges({ + active, + containerId, + isDragging, + isSorting, + id, + index, + items, + newIndex: previous.current.newIndex, + previousItems: previous.current.items, + previousContainerId: previous.current.containerId, + transition, + wasDragging: previous.current.activeId != null + }); + const derivedTransform = useDerivedTransform({ + disabled: !shouldAnimateLayoutChanges, + index, + node, + rect + }); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (isSorting && previous.current.newIndex !== newIndex) { + previous.current.newIndex = newIndex; + } + + if (containerId !== previous.current.containerId) { + previous.current.containerId = containerId; + } + + if (items !== previous.current.items) { + previous.current.items = items; + } + }, [isSorting, newIndex, containerId, items]); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (activeId === previous.current.activeId) { + return; + } + + if (activeId && !previous.current.activeId) { + previous.current.activeId = activeId; + return; + } + + const timeoutId = setTimeout(() => { + previous.current.activeId = activeId; + }, 50); + return () => clearTimeout(timeoutId); + }, [activeId]); + return { + active, + activeIndex, + attributes, + data, + rect, + index, + newIndex, + items, + isOver, + isSorting, + isDragging, + listeners, + node, + overIndex, + over, + setNodeRef, + setActivatorNodeRef, + setDroppableNodeRef, + setDraggableNodeRef, + transform: derivedTransform != null ? derivedTransform : finalTransform, + transition: getTransition() + }; + + function getTransition() { + if ( // Temporarily disable transitions for a single frame to set up derived transforms + derivedTransform || // Or to prevent items jumping to back to their "new" position when items change + itemsHaveChanged && previous.current.newIndex === index) { + return disabledTransition; + } + + if (shouldDisplaceDragSource && !(0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.isKeyboardEvent)(activatorEvent) || !transition) { + return undefined; + } + + if (isSorting || shouldAnimateLayoutChanges) { + return _dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.CSS.Transition.toString({ ...transition, + property: transitionProperty + }); + } + + return undefined; + } +} + +function normalizeLocalDisabled(localDisabled, globalDisabled) { + var _localDisabled$dragga, _localDisabled$droppa; + + if (typeof localDisabled === 'boolean') { + return { + draggable: localDisabled, + // Backwards compatibility + droppable: false + }; + } + + return { + draggable: (_localDisabled$dragga = localDisabled == null ? void 0 : localDisabled.draggable) != null ? _localDisabled$dragga : globalDisabled.draggable, + droppable: (_localDisabled$droppa = localDisabled == null ? void 0 : localDisabled.droppable) != null ? _localDisabled$droppa : globalDisabled.droppable + }; +} + +function hasSortableData(entry) { + if (!entry) { + return false; + } + + const data = entry.data.current; + + if (data && 'sortable' in data && typeof data.sortable === 'object' && 'containerId' in data.sortable && 'items' in data.sortable && 'index' in data.sortable) { + return true; + } + + return false; +} + +const directions = [_dnd_kit_core__WEBPACK_IMPORTED_MODULE_1__.KeyboardCode.Down, _dnd_kit_core__WEBPACK_IMPORTED_MODULE_1__.KeyboardCode.Right, _dnd_kit_core__WEBPACK_IMPORTED_MODULE_1__.KeyboardCode.Up, _dnd_kit_core__WEBPACK_IMPORTED_MODULE_1__.KeyboardCode.Left]; +const sortableKeyboardCoordinates = (event, _ref) => { + let { + context: { + active, + collisionRect, + droppableRects, + droppableContainers, + over, + scrollableAncestors + } + } = _ref; + + if (directions.includes(event.code)) { + event.preventDefault(); + + if (!active || !collisionRect) { + return; + } + + const filteredContainers = []; + droppableContainers.getEnabled().forEach(entry => { + if (!entry || entry != null && entry.disabled) { + return; + } + + const rect = droppableRects.get(entry.id); + + if (!rect) { + return; + } + + switch (event.code) { + case _dnd_kit_core__WEBPACK_IMPORTED_MODULE_1__.KeyboardCode.Down: + if (collisionRect.top < rect.top) { + filteredContainers.push(entry); + } + + break; + + case _dnd_kit_core__WEBPACK_IMPORTED_MODULE_1__.KeyboardCode.Up: + if (collisionRect.top > rect.top) { + filteredContainers.push(entry); + } + + break; + + case _dnd_kit_core__WEBPACK_IMPORTED_MODULE_1__.KeyboardCode.Left: + if (collisionRect.left > rect.left) { + filteredContainers.push(entry); + } + + break; + + case _dnd_kit_core__WEBPACK_IMPORTED_MODULE_1__.KeyboardCode.Right: + if (collisionRect.left < rect.left) { + filteredContainers.push(entry); + } + + break; + } + }); + const collisions = (0,_dnd_kit_core__WEBPACK_IMPORTED_MODULE_1__.closestCorners)({ + active, + collisionRect: collisionRect, + droppableRects, + droppableContainers: filteredContainers, + pointerCoordinates: null + }); + let closestId = (0,_dnd_kit_core__WEBPACK_IMPORTED_MODULE_1__.getFirstCollision)(collisions, 'id'); + + if (closestId === (over == null ? void 0 : over.id) && collisions.length > 1) { + closestId = collisions[1].id; + } + + if (closestId != null) { + const activeDroppable = droppableContainers.get(active.id); + const newDroppable = droppableContainers.get(closestId); + const newRect = newDroppable ? droppableRects.get(newDroppable.id) : null; + const newNode = newDroppable == null ? void 0 : newDroppable.node.current; + + if (newNode && newRect && activeDroppable && newDroppable) { + const newScrollAncestors = (0,_dnd_kit_core__WEBPACK_IMPORTED_MODULE_1__.getScrollableAncestors)(newNode); + const hasDifferentScrollAncestors = newScrollAncestors.some((element, index) => scrollableAncestors[index] !== element); + const hasSameContainer = isSameContainer(activeDroppable, newDroppable); + const isAfterActive = isAfter(activeDroppable, newDroppable); + const offset = hasDifferentScrollAncestors || !hasSameContainer ? { + x: 0, + y: 0 + } : { + x: isAfterActive ? collisionRect.width - newRect.width : 0, + y: isAfterActive ? collisionRect.height - newRect.height : 0 + }; + const rectCoordinates = { + x: newRect.left, + y: newRect.top + }; + const newCoordinates = offset.x && offset.y ? rectCoordinates : (0,_dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.subtract)(rectCoordinates, offset); + return newCoordinates; + } + } + } + + return undefined; +}; + +function isSameContainer(a, b) { + if (!hasSortableData(a) || !hasSortableData(b)) { + return false; + } + + return a.data.current.sortable.containerId === b.data.current.sortable.containerId; +} + +function isAfter(a, b) { + if (!hasSortableData(a) || !hasSortableData(b)) { + return false; + } + + if (!isSameContainer(a, b)) { + return false; + } + + return a.data.current.sortable.index < b.data.current.sortable.index; +} + + +//# sourceMappingURL=sortable.esm.js.map + + +/***/ }), + +/***/ "./node_modules/@dnd-kit/utilities/dist/utilities.esm.js": +/*!***************************************************************!*\ + !*** ./node_modules/@dnd-kit/utilities/dist/utilities.esm.js ***! + \***************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ CSS: () => (/* binding */ CSS), +/* harmony export */ add: () => (/* binding */ add), +/* harmony export */ canUseDOM: () => (/* binding */ canUseDOM), +/* harmony export */ findFirstFocusableNode: () => (/* binding */ findFirstFocusableNode), +/* harmony export */ getEventCoordinates: () => (/* binding */ getEventCoordinates), +/* harmony export */ getOwnerDocument: () => (/* binding */ getOwnerDocument), +/* harmony export */ getWindow: () => (/* binding */ getWindow), +/* harmony export */ hasViewportRelativeCoordinates: () => (/* binding */ hasViewportRelativeCoordinates), +/* harmony export */ isDocument: () => (/* binding */ isDocument), +/* harmony export */ isHTMLElement: () => (/* binding */ isHTMLElement), +/* harmony export */ isKeyboardEvent: () => (/* binding */ isKeyboardEvent), +/* harmony export */ isNode: () => (/* binding */ isNode), +/* harmony export */ isSVGElement: () => (/* binding */ isSVGElement), +/* harmony export */ isTouchEvent: () => (/* binding */ isTouchEvent), +/* harmony export */ isWindow: () => (/* binding */ isWindow), +/* harmony export */ subtract: () => (/* binding */ subtract), +/* harmony export */ useCombinedRefs: () => (/* binding */ useCombinedRefs), +/* harmony export */ useEvent: () => (/* binding */ useEvent), +/* harmony export */ useInterval: () => (/* binding */ useInterval), +/* harmony export */ useIsomorphicLayoutEffect: () => (/* binding */ useIsomorphicLayoutEffect), +/* harmony export */ useLatestValue: () => (/* binding */ useLatestValue), +/* harmony export */ useLazyMemo: () => (/* binding */ useLazyMemo), +/* harmony export */ useNodeRef: () => (/* binding */ useNodeRef), +/* harmony export */ usePrevious: () => (/* binding */ usePrevious), +/* harmony export */ useUniqueId: () => (/* binding */ useUniqueId) +/* harmony export */ }); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); + + +function useCombinedRefs() { + for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) { + refs[_key] = arguments[_key]; + } + + return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => node => { + refs.forEach(ref => ref(node)); + }, // eslint-disable-next-line react-hooks/exhaustive-deps + refs); +} + +// https://github.com/facebook/react/blob/master/packages/shared/ExecutionEnvironment.js +const canUseDOM = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined'; + +function isWindow(element) { + const elementString = Object.prototype.toString.call(element); + return elementString === '[object Window]' || // In Electron context the Window object serializes to [object global] + elementString === '[object global]'; +} + +function isNode(node) { + return 'nodeType' in node; +} + +function getWindow(target) { + var _target$ownerDocument, _target$ownerDocument2; + + if (!target) { + return window; + } + + if (isWindow(target)) { + return target; + } + + if (!isNode(target)) { + return window; + } + + return (_target$ownerDocument = (_target$ownerDocument2 = target.ownerDocument) == null ? void 0 : _target$ownerDocument2.defaultView) != null ? _target$ownerDocument : window; +} + +function isDocument(node) { + const { + Document + } = getWindow(node); + return node instanceof Document; +} + +function isHTMLElement(node) { + if (isWindow(node)) { + return false; + } + + return node instanceof getWindow(node).HTMLElement; +} + +function isSVGElement(node) { + return node instanceof getWindow(node).SVGElement; +} + +function getOwnerDocument(target) { + if (!target) { + return document; + } + + if (isWindow(target)) { + return target.document; + } + + if (!isNode(target)) { + return document; + } + + if (isDocument(target)) { + return target; + } + + if (isHTMLElement(target) || isSVGElement(target)) { + return target.ownerDocument; + } + + return document; +} + +/** + * A hook that resolves to useEffect on the server and useLayoutEffect on the client + * @param callback {function} Callback function that is invoked when the dependencies of the hook change + */ + +const useIsomorphicLayoutEffect = canUseDOM ? react__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect : react__WEBPACK_IMPORTED_MODULE_0__.useEffect; + +function useEvent(handler) { + const handlerRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(handler); + useIsomorphicLayoutEffect(() => { + handlerRef.current = handler; + }); + return (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function () { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return handlerRef.current == null ? void 0 : handlerRef.current(...args); + }, []); +} + +function useInterval() { + const intervalRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); + const set = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((listener, duration) => { + intervalRef.current = setInterval(listener, duration); + }, []); + const clear = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(() => { + if (intervalRef.current !== null) { + clearInterval(intervalRef.current); + intervalRef.current = null; + } + }, []); + return [set, clear]; +} + +function useLatestValue(value, dependencies) { + if (dependencies === void 0) { + dependencies = [value]; + } + + const valueRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(value); + useIsomorphicLayoutEffect(() => { + if (valueRef.current !== value) { + valueRef.current = value; + } + }, dependencies); + return valueRef; +} + +function useLazyMemo(callback, dependencies) { + const valueRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(); + return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { + const newValue = callback(valueRef.current); + valueRef.current = newValue; + return newValue; + }, // eslint-disable-next-line react-hooks/exhaustive-deps + [...dependencies]); +} + +function useNodeRef(onChange) { + const onChangeHandler = useEvent(onChange); + const node = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); + const setNodeRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(element => { + if (element !== node.current) { + onChangeHandler == null ? void 0 : onChangeHandler(element, node.current); + } + + node.current = element; + }, //eslint-disable-next-line + []); + return [node, setNodeRef]; +} + +function usePrevious(value) { + const ref = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + ref.current = value; + }, [value]); + return ref.current; +} + +let ids = {}; +function useUniqueId(prefix, value) { + return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { + if (value) { + return value; + } + + const id = ids[prefix] == null ? 0 : ids[prefix] + 1; + ids[prefix] = id; + return prefix + "-" + id; + }, [prefix, value]); +} + +function createAdjustmentFn(modifier) { + return function (object) { + for (var _len = arguments.length, adjustments = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + adjustments[_key - 1] = arguments[_key]; + } + + return adjustments.reduce((accumulator, adjustment) => { + const entries = Object.entries(adjustment); + + for (const [key, valueAdjustment] of entries) { + const value = accumulator[key]; + + if (value != null) { + accumulator[key] = value + modifier * valueAdjustment; + } + } + + return accumulator; + }, { ...object + }); + }; +} + +const add = /*#__PURE__*/createAdjustmentFn(1); +const subtract = /*#__PURE__*/createAdjustmentFn(-1); + +function hasViewportRelativeCoordinates(event) { + return 'clientX' in event && 'clientY' in event; +} + +function isKeyboardEvent(event) { + if (!event) { + return false; + } + + const { + KeyboardEvent + } = getWindow(event.target); + return KeyboardEvent && event instanceof KeyboardEvent; +} + +function isTouchEvent(event) { + if (!event) { + return false; + } + + const { + TouchEvent + } = getWindow(event.target); + return TouchEvent && event instanceof TouchEvent; +} + +/** + * Returns the normalized x and y coordinates for mouse and touch events. + */ + +function getEventCoordinates(event) { + if (isTouchEvent(event)) { + if (event.touches && event.touches.length) { + const { + clientX: x, + clientY: y + } = event.touches[0]; + return { + x, + y + }; + } else if (event.changedTouches && event.changedTouches.length) { + const { + clientX: x, + clientY: y + } = event.changedTouches[0]; + return { + x, + y + }; + } + } + + if (hasViewportRelativeCoordinates(event)) { + return { + x: event.clientX, + y: event.clientY + }; + } + + return null; +} + +const CSS = /*#__PURE__*/Object.freeze({ + Translate: { + toString(transform) { + if (!transform) { + return; + } + + const { + x, + y + } = transform; + return "translate3d(" + (x ? Math.round(x) : 0) + "px, " + (y ? Math.round(y) : 0) + "px, 0)"; + } + + }, + Scale: { + toString(transform) { + if (!transform) { + return; + } + + const { + scaleX, + scaleY + } = transform; + return "scaleX(" + scaleX + ") scaleY(" + scaleY + ")"; + } + + }, + Transform: { + toString(transform) { + if (!transform) { + return; + } + + return [CSS.Translate.toString(transform), CSS.Scale.toString(transform)].join(' '); + } + + }, + Transition: { + toString(_ref) { + let { + property, + duration, + easing + } = _ref; + return property + " " + duration + "ms " + easing; + } + + } +}); + +const SELECTOR = 'a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]'; +function findFirstFocusableNode(element) { + if (element.matches(SELECTOR)) { + return element; + } + + return element.querySelector(SELECTOR); +} + + +//# sourceMappingURL=utilities.esm.js.map + + +/***/ }), + +/***/ "./node_modules/@wordpress/icons/build-module/library/close-small.js": +/*!***************************************************************************!*\ + !*** ./node_modules/@wordpress/icons/build-module/library/close-small.js ***! + \***************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/primitives */ "@wordpress/primitives"); +/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime"); +/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__); +/** + * WordPress dependencies + */ + + +const closeSmall = /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_0__.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_0__.Path, { + d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z" + }) +}); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (closeSmall); +//# sourceMappingURL=close-small.js.map + +/***/ }), + +/***/ "./src/components/InlineNotice.js": +/*!****************************************!*\ + !*** ./src/components/InlineNotice.js ***! + \****************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); +/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime"); +/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__); +/** + * External dependencies + */ + + +const InlineNotice = ({ + children, + status = 'warning', + size = 'regular' +}) => { + const className = classnames__WEBPACK_IMPORTED_MODULE_0___default()('wpbt-inline-notice', `is-${status}`, `is-size-${size}`); + return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("div", { + className: className, + children: children + }); +}; +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (InlineNotice); + +/***/ }), + +/***/ "./src/components/PostControl.js": +/*!***************************************!*\ + !*** ./src/components/PostControl.js ***! + \***************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils */ "./src/utils.js"); +/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime"); +/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__); +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + +const PostControl = ({ + label, + posts, + value, + onChange +}) => { + const [options, setOptions] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.useState)([]); + (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.useEffect)(() => { + if (posts) { + setOptions(posts.map(_utils__WEBPACK_IMPORTED_MODULE_2__.postToControlOption)); + } + }, [posts]); + if (posts === null) return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_0__.Spinner, {}); + return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(ComboboxWrapper, { + children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_0__.ComboboxControl, { + label: label, + value: value, + onChange: onChange, + options: options + }) + }); +}; +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (PostControl); +const ComboboxWrapper = ({ + children +}) => { + return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", { + className: "wpbt-combobox-wrapper", + children: children + }); +}; + +/***/ }), + +/***/ "./src/components/PostSearchControl.js": +/*!*********************************************!*\ + !*** ./src/components/PostSearchControl.js ***! + \*********************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var use_debounce__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! use-debounce */ "./node_modules/use-debounce/dist/index.module.js"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/icons */ "./node_modules/@wordpress/icons/build-module/library/close-small.js"); +/* harmony import */ var _hooks_use_post__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../hooks/use-post */ "./src/hooks/use-post.js"); +/* harmony import */ var _hooks_use_post_search__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../hooks/use-post-search */ "./src/hooks/use-post-search.js"); +/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime"); +/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__); +/** + * External dependencies + */ + + +/** + * WordPress dependecies + */ + + + + + +/** + * Internal dependencies + */ + + + +/** + * Constants + */ + +const SEARCH_DEBOUNCE_DELAY = 500; +const SEARCH_MINIMUM_LENGTH = 3; +const PostSearchControl = ({ + type = "post", + status = "publish", + value = 0, + onChange, + placeholder = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Search", "wp-block-toolkit"), + label = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Select a post", "wp-block-toolkit"), + inputProps = {}, + filterResults = null, + numOfInitialResults = 20, + ...rest +}) => { + const [isExpanded, setIsExpanded] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_2__.useState)(false); + const [search, setSearch] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_2__.useState)(""); + const [debouncedSearch] = (0,use_debounce__WEBPACK_IMPORTED_MODULE_6__.useDebounce)(search, SEARCH_DEBOUNCE_DELAY); + const [perPage, setPerPage] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_2__.useState)(numOfInitialResults); + const [isLoadingMore, setIsLoadingMore] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_2__.useState)(false); + const selected = (0,_hooks_use_post__WEBPACK_IMPORTED_MODULE_3__.usePost)(type, value); + const posts = (0,_hooks_use_post_search__WEBPACK_IMPORTED_MODULE_4__.usePostSearch)({ + postType: type, + postStatus: status, + search: debouncedSearch, + minimumLength: SEARCH_MINIMUM_LENGTH, + perPage + }); + const maybeHasMorePosts = posts?.length === numOfInitialResults; + const filteredPosts = filterResults ? filterResults(posts) : posts; + const onKeyDown = e => { + if (e.key === "Escape") { + e.preventDefault(); + setIsExpanded(false); + } + }; + return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.BaseControl, { + className: "wpbt-post-search-control", + tabIndex: "-1", + label: label, + ...rest, + children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)("div", { + className: "wpbt-post-search-control__wrapper", + onKeyDown: onKeyDown, + children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("input", { + type: "text", + value: isExpanded ? search : selected?.title?.raw || "", + onChange: e => setSearch(e.currentTarget.value), + placeholder: placeholder, + onFocus: () => setIsExpanded(true), + className: "wpbt-post-search-control__input", + ...inputProps + }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Button, { + className: "wpbt-post-search-control__reset", + icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_7__["default"], + disabled: !value, + onClick: () => onChange(null), + label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Reset") + })] + }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div", { + className: "wpbt-post-search-control__options", + children: isExpanded && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.Fragment, { + children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(Options, { + options: filteredPosts, + search: debouncedSearch, + renderOption: post => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("button", { + className: "wpbt-post-search-control__option", + onClick: () => { + onChange(post.id); + setSearch(""); + setIsExpanded(false); + }, + children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__.RawHTML, { + children: post?.title?.rendered + }) + }, post.id) + }), maybeHasMorePosts && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div", { + className: "wpbt-post-search-control__more", + children: isLoadingMore ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Spinner, {}) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("button", { + className: "components-button is-tertiary", + onClick: () => { + setIsLoadingMore(true); + setPerPage(-1); + }, + children: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("View more results", "wp-block-toolkit") + }) + })] + }) + })] + }); +}; +const Options = ({ + options, + search, + renderOption +}) => { + const isLoading = options === null; + const hasOptions = options && options.length > 0; + const hasSearch = search.length > 0; + const hasMinimumSearchLength = search.length >= SEARCH_MINIMUM_LENGTH; + if (!hasSearch) { + return null; + } + if (isLoading) { + return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div", { + className: "wpbt-post-search-control__spinner", + children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Spinner, {}) + }); + } + if (!hasOptions) { + if (!hasMinimumSearchLength) { + return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("p", { + children: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)(`Your search needs to be at least ${SEARCH_MINIMUM_LENGTH} characters long.`, "wp-block-toolkit") + }); + } + return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("p", { + children: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("No posts were found with your search.", "wp-block-toolkit") + }); + } + return options.map(renderOption); +}; +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (PostSearchControl); + +/***/ }), + +/***/ "./src/components/RequireBlocks.js": +/*!*****************************************!*\ + !*** ./src/components/RequireBlocks.js ***! + \*****************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _InlineNotice__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./InlineNotice */ "./src/components/InlineNotice.js"); +/* harmony import */ var _hooks_use_required_blocks__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../hooks/use-required-blocks */ "./src/hooks/use-required-blocks.js"); +/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime"); +/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__); +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + +const RequireBlocks = ({ + children, + blocks +}) => { + const { + hasRequiredBlocks, + missingBlocks + } = (0,_hooks_use_required_blocks__WEBPACK_IMPORTED_MODULE_3__.useRequiredBlocks)(blocks); + return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.Fragment, { + children: hasRequiredBlocks ? children : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(_InlineNotice__WEBPACK_IMPORTED_MODULE_2__["default"], { + status: "error", + children: [(0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Couldn't find all the required blocks. Please install and activate the following blocks: ", "wp-block-toolkit"), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("strong", { + children: missingBlocks.join(", ") + })] + }) + }); +}; +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (RequireBlocks); + +/***/ }), + +/***/ "./src/components/SortablePostsControl.js": +/*!************************************************!*\ + !*** ./src/components/SortablePostsControl.js ***! + \************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _dnd_kit_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @dnd-kit/core */ "./node_modules/@dnd-kit/core/dist/core.esm.js"); +/* harmony import */ var _dnd_kit_sortable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @dnd-kit/sortable */ "./node_modules/@dnd-kit/sortable/dist/sortable.esm.js"); +/* harmony import */ var _dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @dnd-kit/utilities */ "./node_modules/@dnd-kit/utilities/dist/utilities.esm.js"); +/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); +/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__); +/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils */ "./src/utils.js"); +/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime"); +/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__); +/** + * External dependencies + */ + + + + + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + +const SortablePostsControl = ({ + label, + posts, + value, + onChange +}) => { + const [options, setOptions] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_5__.useState)([]); + const [filteredOptions, setFilteredOptions] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_5__.useState)([]); + const [query, setQuery] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_5__.useState)(""); + (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_5__.useEffect)(() => { + if (posts) { + setOptions(posts.map(_utils__WEBPACK_IMPORTED_MODULE_7__.postToControlOption)); + } + }, [posts]); + (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_5__.useEffect)(() => { + const newFilteredOptions = query ? options.filter(each => each.label.toLowerCase().includes(query.toLowerCase())) : options; + setFilteredOptions(newFilteredOptions); + }, [options, query]); + if (posts === null) return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.Spinner, {}); + if (!options || !options.length) return null; + const onOptionClick = (option, isSelected) => { + onChange(isSelected ? value.filter(id => id !== option.value) : [...value, option.value]); + }; + const onSortEnd = newValues => { + onChange(newValues); + }; + const onItemRemove = option => { + onChange(value.filter(id => id !== option.value)); + }; + const sortableOptions = value.reduce((items, id) => { + const option = options.find(option => option.value === id); + if (option) { + items.push(option); + } + return items; + }, []); + return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxs)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.BaseControl, { + label: label, + className: "wpbt-sortable-posts-control", + children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)("h4", { + className: "wpbt-sortable-posts-control__subtitle", + children: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)("Select posts", "wp-block-toolkit") + }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)("input", { + type: "text", + placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)("Search", "wp-block-toolkit"), + value: query, + onChange: event => setQuery(event.target.value), + className: "wpbt-sortable-posts-control__search" + }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)("div", { + className: "wpbt-sortable-posts-control__list", + children: filteredOptions.map((option, index) => { + const isSelected = value.find(id => id === option.value); + const optionClassName = classnames__WEBPACK_IMPORTED_MODULE_3___default()("wpbt-sortable-posts-control__option", { + "is-selected": isSelected + }); + return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)("button", { + onClick: () => onOptionClick(option, isSelected), + className: optionClassName, + children: option.label + }, index); + }) + }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)("h4", { + className: "wpbt-sortable-posts-control__subtitle", + children: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)("Select order", "wp-block-toolkit") + }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(SortableList, { + items: sortableOptions, + onChange: onSortEnd, + onItemRemove: onItemRemove + })] + }); +}; +const SortableItem = ({ + id, + value, + onRemove, + isDragging +}) => { + const { + attributes, + listeners, + setNodeRef, + transform, + transition + } = (0,_dnd_kit_sortable__WEBPACK_IMPORTED_MODULE_1__.useSortable)({ + id + }); + const style = { + transform: _dnd_kit_utilities__WEBPACK_IMPORTED_MODULE_2__.CSS.Transform.toString({ + x: 0, + y: transform?.y, + scaleX: 1, + scaleY: 1 + }), + transition + }; + return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxs)("div", { + className: "wpbt-sortable-posts-control__sortable-item", + ref: setNodeRef, + style: style, + children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)("span", { + ...attributes, + ...listeners, + children: value.label + }), !isDragging && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)("div", { + className: "wpbt-sortable-posts-control__sortable-remove", + onClick: () => onRemove(value) + })] + }); +}; +const SortableList = ({ + items, + onChange, + onItemRemove +}) => { + const [isDragging, setIsDragging] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_5__.useState)(false); + const sensors = (0,_dnd_kit_core__WEBPACK_IMPORTED_MODULE_0__.useSensors)((0,_dnd_kit_core__WEBPACK_IMPORTED_MODULE_0__.useSensor)(_dnd_kit_core__WEBPACK_IMPORTED_MODULE_0__.PointerSensor), (0,_dnd_kit_core__WEBPACK_IMPORTED_MODULE_0__.useSensor)(_dnd_kit_core__WEBPACK_IMPORTED_MODULE_0__.KeyboardSensor, { + coordinateGetter: _dnd_kit_sortable__WEBPACK_IMPORTED_MODULE_1__.sortableKeyboardCoordinates + })); + const handleDragStart = event => { + setIsDragging(true); + }; + const handleDragEnd = event => { + setIsDragging(false); + const { + active, + over + } = event; + if (active.id !== over.id) { + const ids = items.map(item => item.value); + const oldIndex = ids.indexOf(active.id); + const newIndex = ids.indexOf(over.id); + const newIds = (0,_dnd_kit_sortable__WEBPACK_IMPORTED_MODULE_1__.arrayMove)(ids, oldIndex, newIndex); + onChange(newIds); + } + }; + return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)("div", { + className: "wpbt-sortable-posts-control__list", + children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_dnd_kit_core__WEBPACK_IMPORTED_MODULE_0__.DndContext, { + sensors: sensors, + collisionDetection: _dnd_kit_core__WEBPACK_IMPORTED_MODULE_0__.closestCenter, + onDragStart: handleDragStart, + onDragEnd: handleDragEnd, + children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_dnd_kit_sortable__WEBPACK_IMPORTED_MODULE_1__.SortableContext, { + items: items, + strategy: _dnd_kit_sortable__WEBPACK_IMPORTED_MODULE_1__.verticalListSortingStrategy, + children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)("div", { + className: "wpbt-sortable-posts-control__sortable-list", + children: items.map((item, index) => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(SortableItem, { + id: item.value, + index: index, + value: item, + onRemove: onItemRemove, + isDragging: isDragging + }, `item-${item.value}`)) + }) + }) + }) + }); +}; +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SortablePostsControl); + +/***/ }), + +/***/ "./src/components/TaxonomyControl.js": +/*!*******************************************!*\ + !*** ./src/components/TaxonomyControl.js ***! + \*******************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils */ "./src/utils.js"); +/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime"); +/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__); +/** + * WordPress dependencies + */ + + + + + +/** + * Internal dependencies + */ + + +const TaxonomyControl = ({ + slug, + label, + value, + onChange +}) => { + const [taxonomies, setTaxonomies] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_2__.useState)([]); + const [query, setQuery] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_2__.useState)(""); + const hasTaxonomies = taxonomies.length > 0; + + /** + * Get all taxonomies of slug type + */ + const data = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_3__.useSelect)(select => { + return select("core").getEntityRecords("taxonomy", slug, { + per_page: -1 + }); + }, [slug]); + const isLoading = data === null; + + /** + * Convert data shape from flat to hierarchical + */ + (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_2__.useEffect)(() => { + if (data) { + const groupedByParent = data.reduce((acc, cur) => { + const key = cur.parent || 0; + acc[key] = [...(acc[key] || []), cur]; + return acc; + }, {}); + const withNestedChildren = item => { + return { + ...item, + children: groupedByParent[item.id] ? groupedByParent[item.id].map(withNestedChildren) : [] + }; + }; + if (groupedByParent[0]) { + const newTaxonomies = groupedByParent[0].map(withNestedChildren); + setTaxonomies(newTaxonomies); + } + } + }, [data]); + const handleClick = (id, checked) => { + if (checked) { + onChange([...value, id]); + } else { + onChange(value.filter(each => each !== id)); + } + }; + const isMatch = ({ + name + }) => { + return name.toLowerCase().includes(query.toLowerCase()); + }; + const filter = data => { + const arr = []; + data.forEach(item => { + if (isMatch(item) || item.children.some(isMatch)) { + arr.push({ + ...item, + children: filter(item.children) + }); + } + }); + return arr; + }; + return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.BaseControl, { + label: (0,_utils__WEBPACK_IMPORTED_MODULE_4__.labelWithCount)(label, value?.length), + children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(SearchInput, { + value: query, + onChange: event => setQuery(event.target.value) + }), !isLoading && value.length > 0 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div", { + className: "wbpt-tag-list", + children: value.map(id => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(RemovableTag, { + id: id, + label: data.find(each => each.id === id)?.name, + onClick: () => handleClick(id, false) + }, id)) + }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(CheckboxWrapper, { + children: isLoading ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Spinner, {}) : !hasTaxonomies ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("p", { + children: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)(`No taxonomies of type "${slug}" found.`, "wp-block-toolkit") + }) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(CheckboxGroup, { + data: query ? filter(taxonomies) : taxonomies, + value: value, + onCheckboxClick: handleClick + }) + })] + }); +}; +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (TaxonomyControl); +const CheckboxGroup = ({ + data, + value, + onCheckboxClick +}) => { + return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("ul", { + children: data.map(item => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)("li", { + children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.CheckboxControl, { + label: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__.RawHTML, { + children: item.name + }), + checked: value.includes(item.id), + onChange: checked => onCheckboxClick(item.id, checked) + }, item.id), item.children && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(CheckboxGroup, { + data: item.children, + value: value, + onCheckboxClick: onCheckboxClick + })] + }, item.id)) + }); +}; +const SearchInput = ({ + value, + onChange +}) => { + return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div", { + className: "wpbt-search-input", + children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("input", { + type: "text", + placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Search", "wp-block-toolkit"), + value: value, + onChange: onChange + }) + }); +}; +const RemovableTag = ({ + id, + label, + onClick +}) => { + return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("button", { + onClick: onClick, + className: "wbpt-removable-tag", + children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__.RawHTML, { + children: label + }) + }, id); +}; +const CheckboxWrapper = ({ + children +}) => { + return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div", { + className: "wpbt-checkbox-wrapper", + children: children + }); +}; + +/***/ }), + +/***/ "./src/hooks/use-all-posts.js": +/*!************************************!*\ + !*** ./src/hooks/use-all-posts.js ***! + \************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ useAllPosts: () => (/* binding */ useAllPosts) +/* harmony export */ }); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_0__); +/** + * WordPress dependencies + */ + +function useAllPosts(postType) { + const posts = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_0__.useSelect)(select => select('core').getEntityRecords('postType', postType, { + per_page: -1, + orderby: 'title', + order: 'asc', + status: 'publish' + }), [postType]); + return posts; +} + +/***/ }), + +/***/ "./src/hooks/use-post-search.js": +/*!**************************************!*\ + !*** ./src/hooks/use-post-search.js ***! + \**************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ usePostSearch: () => (/* binding */ usePostSearch) +/* harmony export */ }); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_0__); +/** + * WordPress dependencies + */ + +function usePostSearch({ + postType = "post", + postStatus = "publish", + search = "", + minimumLength = 3, + perPage = 20 +}) { + const posts = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_0__.useSelect)(select => { + if (search.length < minimumLength) { + return []; + } + return select("core").getEntityRecords("postType", postType, { + per_page: perPage, + orderby: "title", + order: "asc", + status: postStatus, + search + }); + }, [postType, search, minimumLength, perPage]); + return posts; +} + +/***/ }), + +/***/ "./src/hooks/use-post.js": +/*!*******************************!*\ + !*** ./src/hooks/use-post.js ***! + \*******************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ usePost: () => (/* binding */ usePost) +/* harmony export */ }); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_0__); +/** + * WordPress dependencies + */ + +function usePost(postType, id) { + const post = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_0__.useSelect)(select => { + if (!id) { + return null; + } + return select("core").getEntityRecord("postType", postType, id); + }, [id]); + return post; +} + +/***/ }), + +/***/ "./src/hooks/use-required-blocks.js": +/*!******************************************!*\ + !*** ./src/hooks/use-required-blocks.js ***! + \******************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ useRequiredBlocks: () => (/* binding */ useRequiredBlocks) +/* harmony export */ }); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_0__); +/** + * WordPress dependencies + */ + +function useRequiredBlocks(requiredBlocks) { + const blockNames = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_0__.useSelect)(select => { + return select('core/blocks').getBlockTypes().map(each => each.name); + }, []); + const missingBlocks = requiredBlocks.filter(block => !blockNames.includes(block)); + return { + missingBlocks, + hasRequiredBlocks: !missingBlocks.length + }; +} + +/***/ }), + +/***/ "./src/utils.js": +/*!**********************!*\ + !*** ./src/utils.js ***! + \**********************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ labelWithCount: () => (/* binding */ labelWithCount), +/* harmony export */ postToControlOption: () => (/* binding */ postToControlOption) +/* harmony export */ }); +const postToControlOption = post => ({ + id: post.id, + label: post.title.raw, + value: post.id +}); +const labelWithCount = (label, count) => { + if (!count) { + return label; + } + return `${label} (${count})`; +}; + +/***/ }), + +/***/ "./src/editor.scss": +/*!*************************!*\ + !*** ./src/editor.scss ***! + \*************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +// extracted by mini-css-extract-plugin + + +/***/ }), + +/***/ "./node_modules/use-debounce/dist/index.module.js": +/*!********************************************************!*\ + !*** ./node_modules/use-debounce/dist/index.module.js ***! + \********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ useDebounce: () => (/* binding */ o), +/* harmony export */ useDebouncedCallback: () => (/* binding */ c), +/* harmony export */ useThrottledCallback: () => (/* binding */ f) +/* harmony export */ }); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); +function c(e,u,c){var i=this,a=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null),o=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(0),f=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null),l=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)([]),v=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(),m=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(),d=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(e),g=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(!0);d.current=e;var p="undefined"!=typeof window,w=!u&&0!==u&&p;if("function"!=typeof e)throw new TypeError("Expected a function");u=+u||0;var s=!!(c=c||{}).leading,x=!("trailing"in c)||!!c.trailing,h="maxWait"in c,y="debounceOnServer"in c&&!!c.debounceOnServer,F=h?Math.max(+c.maxWait||0,u):null;(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function(){return g.current=!0,function(){g.current=!1}},[]);var A=(0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(function(){var r=function(r){var n=l.current,t=v.current;return l.current=v.current=null,o.current=r,m.current=d.current.apply(t,n)},n=function(r,n){w&&cancelAnimationFrame(f.current),f.current=w?requestAnimationFrame(r):setTimeout(r,n)},t=function(r){if(!g.current)return!1;var n=r-a.current;return!a.current||n>=u||n<0||h&&r-o.current>=F},e=function(n){return f.current=null,x&&l.current?r(n):(l.current=v.current=null,m.current)},c=function r(){var c=Date.now();if(t(c))return e(c);if(g.current){var i=u-(c-a.current),f=h?Math.min(i,F-(c-o.current)):i;n(r,f)}},A=function(){if(p||y){var e=Date.now(),d=t(e);if(l.current=[].slice.call(arguments),v.current=i,a.current=e,d){if(!f.current&&g.current)return o.current=a.current,n(c,u),s?r(a.current):m.current;if(h)return n(c,u),r(a.current)}return f.current||n(c,u),m.current}};return A.cancel=function(){f.current&&(w?cancelAnimationFrame(f.current):clearTimeout(f.current)),o.current=0,l.current=a.current=v.current=f.current=null},A.isPending=function(){return!!f.current},A.flush=function(){return f.current?e(Date.now()):m.current},A},[s,h,u,F,x,w,p,y]);return A}function i(r,n){return r===n}function a(r,n){return n}function o(n,t,o){var f=o&&o.equalityFn||i,l=(0,react__WEBPACK_IMPORTED_MODULE_0__.useReducer)(a,n),v=l[0],m=l[1],d=c((0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function(r){return m(r)},[m]),t,o),g=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(n);return f(g.current,n)||(d(n),g.current=n),f(v,n)&&d.cancel(),[v,d]}function f(r,n,t){var e=void 0===t?{}:t,u=e.leading,i=e.trailing;return c(r,n,{maxWait:n,leading:void 0===u||u,trailing:void 0===i||i})} +//# sourceMappingURL=index.module.js.map + + +/***/ }), + +/***/ "react": +/*!************************!*\ + !*** external "React" ***! + \************************/ +/***/ ((module) => { + +"use strict"; +module.exports = window["React"]; + +/***/ }), + +/***/ "react-dom": +/*!***************************!*\ + !*** external "ReactDOM" ***! + \***************************/ +/***/ ((module) => { + +"use strict"; +module.exports = window["ReactDOM"]; + +/***/ }), + +/***/ "react/jsx-runtime": +/*!**********************************!*\ + !*** external "ReactJSXRuntime" ***! + \**********************************/ +/***/ ((module) => { + +"use strict"; +module.exports = window["ReactJSXRuntime"]; + +/***/ }), + +/***/ "@wordpress/components": +/*!************************************!*\ + !*** external ["wp","components"] ***! + \************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = window["wp"]["components"]; + +/***/ }), + +/***/ "@wordpress/data": +/*!******************************!*\ + !*** external ["wp","data"] ***! + \******************************/ +/***/ ((module) => { + +"use strict"; +module.exports = window["wp"]["data"]; + +/***/ }), + +/***/ "@wordpress/element": +/*!*********************************!*\ + !*** external ["wp","element"] ***! + \*********************************/ +/***/ ((module) => { + +"use strict"; +module.exports = window["wp"]["element"]; + +/***/ }), + +/***/ "@wordpress/i18n": +/*!******************************!*\ + !*** external ["wp","i18n"] ***! + \******************************/ +/***/ ((module) => { + +"use strict"; +module.exports = window["wp"]["i18n"]; + +/***/ }), + +/***/ "@wordpress/primitives": +/*!************************************!*\ + !*** external ["wp","primitives"] ***! + \************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = window["wp"]["primitives"]; + +/***/ }), + +/***/ "./node_modules/classnames/index.js": +/*!******************************************!*\ + !*** ./node_modules/classnames/index.js ***! + \******************************************/ +/***/ ((module, exports) => { + +var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! + Copyright (c) 2018 Jed Watson. + Licensed under the MIT License (MIT), see + http://jedwatson.github.io/classnames +*/ +/* global define */ + +(function () { + 'use strict'; + + var hasOwn = {}.hasOwnProperty; + + function classNames () { + var classes = ''; + + for (var i = 0; i < arguments.length; i++) { + var arg = arguments[i]; + if (arg) { + classes = appendClass(classes, parseValue(arg)); + } + } + + return classes; + } + + function parseValue (arg) { + if (typeof arg === 'string' || typeof arg === 'number') { + return arg; + } + + if (typeof arg !== 'object') { + return ''; + } + + if (Array.isArray(arg)) { + return classNames.apply(null, arg); + } + + if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) { + return arg.toString(); + } + + var classes = ''; + + for (var key in arg) { + if (hasOwn.call(arg, key) && arg[key]) { + classes = appendClass(classes, key); + } + } + + return classes; + } + + function appendClass (value, newClass) { + if (!newClass) { + return value; + } + + if (value) { + return value + ' ' + newClass; + } + + return value + newClass; + } + + if ( true && module.exports) { + classNames.default = classNames; + module.exports = classNames; + } else if (true) { + // register as 'classnames', consistent with npm package name + !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { + return classNames; + }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + } else {} +}()); + + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/compat get default export */ +/******/ (() => { +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = (module) => { +/******/ var getter = module && module.__esModule ? +/******/ () => (module['default']) : +/******/ () => (module); +/******/ __webpack_require__.d(getter, { a: getter }); +/******/ return getter; +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be in strict mode. +(() => { +"use strict"; +/*!**********************!*\ + !*** ./src/index.js ***! + \**********************/ +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ InlineNotice: () => (/* reexport safe */ _components_InlineNotice__WEBPACK_IMPORTED_MODULE_1__["default"]), +/* harmony export */ PostControl: () => (/* reexport safe */ _components_PostControl__WEBPACK_IMPORTED_MODULE_2__["default"]), +/* harmony export */ PostSearchControl: () => (/* reexport safe */ _components_PostSearchControl__WEBPACK_IMPORTED_MODULE_6__["default"]), +/* harmony export */ RequireBlocks: () => (/* reexport safe */ _components_RequireBlocks__WEBPACK_IMPORTED_MODULE_3__["default"]), +/* harmony export */ SortablePostsControl: () => (/* reexport safe */ _components_SortablePostsControl__WEBPACK_IMPORTED_MODULE_4__["default"]), +/* harmony export */ TaxonomyControl: () => (/* reexport safe */ _components_TaxonomyControl__WEBPACK_IMPORTED_MODULE_5__["default"]), +/* harmony export */ useAllPosts: () => (/* reexport safe */ _hooks_use_all_posts__WEBPACK_IMPORTED_MODULE_7__.useAllPosts), +/* harmony export */ usePost: () => (/* reexport safe */ _hooks_use_post__WEBPACK_IMPORTED_MODULE_9__.usePost), +/* harmony export */ usePostSearch: () => (/* reexport safe */ _hooks_use_post_search__WEBPACK_IMPORTED_MODULE_10__.usePostSearch), +/* harmony export */ useRequiredBlocks: () => (/* reexport safe */ _hooks_use_required_blocks__WEBPACK_IMPORTED_MODULE_8__.useRequiredBlocks) +/* harmony export */ }); +/* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./editor.scss */ "./src/editor.scss"); +/* harmony import */ var _components_InlineNotice__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./components/InlineNotice */ "./src/components/InlineNotice.js"); +/* harmony import */ var _components_PostControl__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components/PostControl */ "./src/components/PostControl.js"); +/* harmony import */ var _components_RequireBlocks__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components/RequireBlocks */ "./src/components/RequireBlocks.js"); +/* harmony import */ var _components_SortablePostsControl__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./components/SortablePostsControl */ "./src/components/SortablePostsControl.js"); +/* harmony import */ var _components_TaxonomyControl__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./components/TaxonomyControl */ "./src/components/TaxonomyControl.js"); +/* harmony import */ var _components_PostSearchControl__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./components/PostSearchControl */ "./src/components/PostSearchControl.js"); +/* harmony import */ var _hooks_use_all_posts__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./hooks/use-all-posts */ "./src/hooks/use-all-posts.js"); +/* harmony import */ var _hooks_use_required_blocks__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./hooks/use-required-blocks */ "./src/hooks/use-required-blocks.js"); +/* harmony import */ var _hooks_use_post__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./hooks/use-post */ "./src/hooks/use-post.js"); +/* harmony import */ var _hooks_use_post_search__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./hooks/use-post-search */ "./src/hooks/use-post-search.js"); +/** + * Styles + */ + + +/** + * Components + */ + + + + + + + +/** + * Hooks + */ + + + + + +})(); + +module.exports = __webpack_exports__; +/******/ })() +; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/build/index.js.map b/build/index.js.map new file mode 100644 index 0000000..639e395 --- /dev/null +++ b/build/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;AAAqD;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ,SAAS,0DAAmB;AAC5B;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,0DAAmB;AAC5B;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA,0CAA0C,+CAAQ;AAClD,mBAAmB,kDAAW;AAC9B;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEmD;AACnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC1DwJ;AACtF;AAC4Q;AAC7P;;AAEjF,uCAAuC,oDAAa;;AAEpD;AACA,2BAA2B,iDAAU;AACrC,EAAE,gDAAS;AACX;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;;AAEA;AACA,sBAAsB,+CAAQ;AAC9B,2BAA2B,kDAAW;AACtC;AACA;AACA,GAAG;AACH,mBAAmB,kDAAW;AAC9B;AACA;AACA;AACA,MAAM;AACN;AACA;;AAEA;AACA,KAAK;AACL,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA,MAAM;;AAEN;AACA;AACA;;AAEA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA,MAAM;;AAEN;AACA;AACA;;AAEA;AACA,GAAG;;AAEH;AACA;AACA;AACA,MAAM;AACN;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,IAAI,EAAE,uEAAe;AACrB,uBAAuB,+DAAW;AAClC,gCAAgC,+CAAQ;AACxC,EAAE,gDAAS;AACX;AACA,GAAG;AACH,gBAAgB,8CAAO;AACvB;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,OAAO;AACP,KAAK;;AAEL;AACA;AACA;AACA;AACA,QAAQ;;AAER;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA,OAAO;AACP,KAAK;;AAEL;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA,OAAO;AACP,KAAK;;AAEL;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA,OAAO;AACP;;AAEA,GAAG;;AAEH;AACA;AACA;;AAEA,iBAAiB,0DAAmB,CAAC,uDAAc,QAAQ,0DAAmB,CAAC,8DAAU;AACzF;AACA;AACA,GAAG,GAAG,0DAAmB,CAAC,8DAAU;AACpC;AACA;AACA,GAAG;AACH,qBAAqB,uDAAY;AACjC;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,wBAAwB;;AAEzB;;AAEA;AACA,SAAS,8CAAO;AAChB;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA,yEAAyE,aAAa;AACtF;AACA;;AAEA,SAAS,8CAAO;AAChB;AACA;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,2BAA2B,uEAAmB;;AAE9C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,aAAa,KAAK,YAAY,KAAK,cAAc,KAAK,eAAe,KAAK;AAC1E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;;AAGJ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;;AAEA;AACA;AACA;AACA,MAAM;AACN;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,MAAM;AACN;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;;AAEA;AACA,WAAW;AACX;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;;AAEA;AACA;AACA,kGAAkG,aAAa;AAC/G;AACA;;AAEA,sDAAsD;AACtD;AACA;AACA;AACA;AACA,KAAK,KAAK;AACV,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,MAAM,EAAE,6DAAS;;AAEjB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB,6DAAS;AAC7B;;AAEA;AACA;;AAEA;AACA;AACA,oBAAoB,6DAAS;AAC7B;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,QAAQ,8DAAU;AAClB;AACA;AACA;;AAEA,SAAS,iEAAa,UAAU,gEAAY;AAC5C;AACA;;AAEA;AACA;AACA;;AAEA,0BAA0B,6DAAS;;AAEnC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,OAAO,yDAAS;AAChB;AACA;;AAEA,MAAM,4DAAQ;AACd;AACA;;AAEA,OAAO,0DAAM;AACb;AACA;;AAEA,MAAM,8DAAU,yBAAyB,oEAAgB;AACzD;AACA;;AAEA,MAAM,iEAAa;AACnB;AACA;;AAEA;AACA;;AAEA;AACA,MAAM,4DAAQ;AACd;AACA;;AAEA;AACA;AACA;AACA,MAAM,4DAAQ;AACd;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,CAAC,8BAA8B;;AAE/B;AACA,OAAO,yDAAS;AAChB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,uDAAG;AACd,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,OAAO;AACP;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,EAAE,6DAAS;AACf,kDAAkD,oEAAgB;AAClE;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,8BAA8B;;AAE/B;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,oCAAoC;;AAErC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA,eAAe;AACf;AACA;;AAEA;AACA,eAAe;AACf;AACA;;AAEA;AACA,eAAe;AACf;AACA;;AAEA;AACA,eAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,mCAAmC,oEAAgB;AACnD,yCAAyC,6DAAS;AAClD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAM;AACN;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,QAAQ,mEAAe;AACvB;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,QAAQ;;AAER;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA,QAAQ;;AAER;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;;AAEP;AACA,iCAAiC,4DAAQ;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;;AAEV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe;AACf;;AAEA;AACA,YAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe;AACf;;AAEA;AACA;AACA;;AAEA,+BAA+B,uDAAG,CAAC,4DAAQ;AAC3C;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,MAAM;AACN;AACA;AACA,MAAM;;AAEN;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA,CAAC;;AAED;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,MAAM;AACN;AACA;AACA,oBAAoB,oEAAgB;AACpC;AACA;AACA,yCAAyC,6DAAS;AAClD,sDAAsD,uEAAmB;AACzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,sCAAsC;AACtC;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,MAAM;;AAEN;AACA,6BAA6B;;AAE7B;AACA;AACA,OAAO,GAAG;;AAEV,kCAAkC;;AAElC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA,MAAM;;AAEN;AACA;AACA;;AAEA,iDAAiD,uEAAmB;AACpE,kBAAkB,4DAAQ,mCAAmC;;AAE7D;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,SAAS;AACf;;AAEA,2BAA2B,oEAAgB;AAC3C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,MAAM;;AAEN;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC,kCAAkC;;AAEnC;AACA;AACA,2BAA2B,oEAAgB;AAC3C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,MAAM;;AAEN;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,OAAO;AACP;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,MAAM;AACN;AACA;AACA,MAAM;;AAEN;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA,CAAC;;AAED;;AAEA;AACA;AACA;AACA,CAAC,kDAAkD;;AAEnD;;AAEA;AACA;AACA;AACA,CAAC,wCAAwC;;AAEzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,GAAG;AACH,2DAA2D,+DAAW;AACtE,sBAAsB,6CAAM;AAC5B;AACA;AACA,GAAG;AACH,0BAA0B,6CAAM;AAChC;AACA;AACA,GAAG;AACH,eAAe,8CAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;;AAEV;AACA;AACA;AACA,GAAG;AACH,6BAA6B,6CAAM;AACnC,qBAAqB,kDAAW;AAChC;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH,oCAAoC,8CAAO;AAC3C,EAAE,gDAAS;AACX;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,QAAQ;;AAER;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ,wBAAwB,+DAAW;AACnC,SAAS,+DAAW;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;;AAEP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA,SAAS,+DAAW;AACpB;;AAEA;AACA;AACA,MAAM;AACN;AACA;;;AAGA;AACA,GAAG;AACH;;AAEA;AACA,SAAS,8CAAO;AAChB;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,KAAK;AACL;AACA,GAAG;AACH;;AAEA;;AAEA;AACA;AACA;AACA;AACA,CAAC,8CAA8C;;AAE/C;;AAEA;AACA;AACA,CAAC,gDAAgD;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ,4BAA4B,+CAAQ;AACpC;AACA;AACA;AACA;AACA,IAAI;AACJ,wBAAwB,6CAAM;AAC9B;AACA,sBAAsB,kEAAc;AACpC,qCAAqC,kDAAW;AAChD;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL,GAAG;AACH,oBAAoB,6CAAM;AAC1B,yBAAyB,+DAAW;AACpC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,GAAG;AACH,EAAE,gDAAS;AACX;AACA,GAAG;AACH,EAAE,gDAAS;AACX;AACA;AACA;;AAEA;AACA,GAAG;AACH;AACA,EAAE,gDAAS;AACX;AACA;AACA;AACA,GAAG;AACH;AACA,EAAE,gDAAS;AACX;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS,+DAAW;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,GAAG;AACH;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ,0BAA0B,4DAAQ;AAClC,2BAA2B,8CAAO;AAClC;AACA;AACA;;AAEA;AACA;AACA,MAAM;AACN;AACA,GAAG;AACH,EAAE,gDAAS;AACX;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ,uBAAuB,4DAAQ;AAC/B,yBAAyB,8CAAO;AAChC;AACA;AACA;;AAEA;AACA;AACA,MAAM;AACN;AACA,GAAG;AACH;AACA,EAAE,gDAAS;AACX;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,8BAA8B,iDAAU;AACxC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,UAAU;;AAEV;AACA;AACA;AACA;AACA;AACA;;AAEA,GAAG;AACH;AACA;AACA,GAAG;AACH,EAAE,6EAAyB;AAC3B;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,MAAM;AACN;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,6CAAM;AAC7B,oBAAoB,+DAAW;AAC/B;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,GAAG;AACH,EAAE,gDAAS;AACX;AACA,GAAG;AACH;AACA;;AAEA;AACA,oDAAoD,+CAAQ;AAC5D,uBAAuB,6CAAM,YAAY;;AAEzC,uBAAuB,kDAAW;AAClC;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL,GAAG;AACH,EAAE,gDAAS;AACX;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW;AACX;AACA;;AAEA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,GAAG;AACH,SAAS,8CAAO;AAChB;AACA,qGAAqG,uDAAG;AACxG;;AAEA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;;AAEA,+BAA+B,6CAAM;AACrC,EAAE,gDAAS;AACX;AACA,GAAG;AACH;AACA,EAAE,gDAAS;AACX;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH,wCAAwC,4DAAQ;AAChD;;AAEA;AACA,EAAE,gDAAS;AACX,SAAS,yDAAS;AAClB;AACA;;AAEA;AACA;AACA;AACA,QAAQ;AACR;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,GAAG;AACH;;AAEA;AACA,SAAS,8CAAO;AAChB;AACA;AACA;AACA;AACA,QAAQ;;AAER;AACA;AACA;;AAEA;AACA,KAAK,IAAI;AACT,GAAG;AACH;;AAEA;AACA,SAAS,8CAAO;AAChB;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,kDAAkD,6DAAS;AAC3D,gCAAgC,iDAAU;AAC1C;AACA;AACA,GAAG;;AAEH;AACA;AACA;;AAEA,EAAE,6EAAyB;AAC3B;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,SAAS,iEAAa;AACtB;;AAEA;AACA;AACA;AACA,IAAI;AACJ,0BAA0B,+CAAQ;AAClC,uBAAuB,kDAAW;AAClC;AACA;AACA,MAAM;AACN,UAAU,iEAAa;AACvB;AACA;AACA,0BAA0B;AAC1B;AACA;AACA,YAAY;AACZ,SAAS;AACT;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH,2BAA2B,kDAAW;AACtC;AACA;;AAEA;AACA;AACA;;AAEA;AACA,GAAG;AACH,4BAA4B,8DAAU;AACtC,SAAS,8CAAO;AAChB;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,qCAAqC,oDAAa;AAClD,mCAAmC,oDAAa;;AAEhD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf,qBAAqB;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,eAAe;AACf,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe;AACf,qBAAqB;AACrB;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA,UAAU;AACV;AACA;AACA,iBAAiB;AACjB,uBAAuB;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;;AAEA;AACA;AACA;;AAEA;AACA,6BAA6B;AAC7B;AACA,SAAS;AACT,iBAAiB;AACjB,uBAAuB;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;;AAEA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB;AACjB,uBAAuB;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,IAAI,EAAE,iDAAU;AAChB,iCAAiC,+DAAW;AAC5C,2BAA2B,+DAAW,uCAAuC;;AAE7E,EAAE,gDAAS;AACX;AACA;AACA;;AAEA;AACA,WAAW,mEAAe;AAC1B;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,QAAQ;;AAER;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,gCAAgC,0EAAsB;;AAEtD;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH;;AAEA;AACA,SAAS,8CAAO;AAChB,iBAAiB;AACjB;AACA,KAAK;AACL,iBAAiB;AACjB;AACA,KAAK;AACL,mBAAmB;AACnB;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ,sBAAsB,6CAAM;AAC5B;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ,EAAE,6EAAyB;AAC3B;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAM;;;AAGN;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,MAAM;;;AAGN;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,GAAG;AACH;;AAEA,4CAA4C,oDAAa,GAAG;AAC5D;AACA;AACA,CAAC;AACD;;AAEA;AACA;AACA;AACA;AACA,CAAC,wBAAwB;;AAEzB,gCAAgC,2CAAI;AACpC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ,gBAAgB,iDAAU;AAC1B;AACA;AACA,8BAA8B,+CAAQ;AACtC;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,IAAI;AACJ;AACA,sBAAsB,6CAAM;AAC5B;AACA;AACA,GAAG;AACH,iBAAiB,8CAAO;AACxB;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN,GAAG;AACH,oBAAoB,6CAAM;AAC1B,0CAA0C,+CAAQ;AAClD,8CAA8C,+CAAQ;AACtD,sBAAsB,kEAAc;AACpC,iCAAiC,+DAAW;AAC5C,qCAAqC,8CAAO;AAC5C;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,GAAG;AACH;AACA,gCAAgC,8CAAO,wBAAwB,uEAAmB;AAClF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,wBAAwB,6CAAM;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG,GAAG;;AAEN;AACA;AACA,oFAAoF;AACpF;;AAEA,+EAA+E;;AAE/E,kDAAkD,6DAAS,wBAAwB;;AAEnF;AACA,iEAAiE;;AAEjE;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,qDAAqD,uDAAG;AACxD,+DAA+D;;AAE/D,iEAAiE;;AAEjE;AACA,kCAAkC,uDAAG;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,0BAA0B,+CAAQ,QAAQ;AAC1C;;AAEA,iEAAiE,uDAAG;AACpE;AACA,4BAA4B,kDAAW;AACvC;AACA;AACA;AACA,MAAM;;AAEN;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,kEAAuB;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,WAAW;AACX,SAAS;AACT,OAAO;;AAEP;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;;AAEP;AACA;AACA,KAAK;AACL,IAAI,kEAAuB;AAC3B;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;;AAEA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,QAAQ,kEAAuB;AAC/B;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,SAAS;AACT;AACA;AACA,GAAG;AACH;AACA,4CAA4C,kDAAW;AACvD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,EAAE,6EAAyB;AAC3B;AACA;AACA;AACA,GAAG;AACH,EAAE,gDAAS;AACX;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA,MAAM;;AAEN;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,IAAI,kEAAuB;AAC3B;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL,GAAG;AACH;AACA,EAAE,gDAAS;AACX;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;;AAEN;AACA;AACA;;AAEA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,IAAI,kEAAuB;AAC3B;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL,GAAG;AACH;AACA,EAAE,6EAAyB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,wBAAwB,8CAAO;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,0BAA0B,8CAAO;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,SAAS,0DAAmB;AAC5B;AACA,GAAG,EAAE,0DAAmB;AACxB;AACA,GAAG,EAAE,0DAAmB;AACxB;AACA,GAAG,EAAE,0DAAmB;AACxB;AACA,GAAG,cAAc,0DAAmB;AACpC;AACA,GAAG,IAAI,0DAAmB,kBAAkB;AAC5C;AACA,GAAG;;AAEH;AACA;AACA;AACA;;AAEA;AACA,eAAe;AACf;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,CAAC;;AAED,iCAAiC,oDAAa;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ,cAAc,+DAAW;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,EAAE,iDAAU;AAChB;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA,oBAAoB,iDAAU;AAC9B,6BAA6B,8DAAU;AACvC,+CAA+C,8DAAU;AACzD;AACA,kBAAkB,kEAAc;AAChC,EAAE,6EAAyB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,6BAA6B,8CAAO;AACpC;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS,iDAAU;AACnB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ,cAAc,+DAAW;AACzB;AACA;AACA;AACA;AACA;AACA,IAAI,EAAE,iDAAU;AAChB,mBAAmB,6CAAM;AACzB;AACA,GAAG;AACH,kCAAkC,6CAAM;AACxC,eAAe,6CAAM;AACrB,qBAAqB,6CAAM;AAC3B;AACA;AACA;AACA;AACA,IAAI,IAAI;AACR;AACA;AACA,cAAc,kEAAc;AAC5B,uBAAuB,kDAAW;AAClC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH,2BAA2B,kDAAW;AACtC;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH,gCAAgC,8DAAU;AAC1C,kBAAkB,kEAAc;AAChC,EAAE,gDAAS;AACX;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH,EAAE,6EAAyB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH;AACA,EAAE,gDAAS;AACX;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ,8CAA8C,+CAAQ;AACtD,gCAAgC,+CAAQ;AACxC,2BAA2B,+DAAW;;AAEtC;AACA;AACA;;AAEA,EAAE,6EAAyB;AAC3B;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL,GAAG;AACH,SAAS,0DAAmB,CAAC,uDAAc,mCAAmC,mDAAY;AAC1F;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ,SAAS,0DAAmB;AAC5B;AACA,GAAG,EAAE,0DAAmB;AACxB;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;;AAEA;AACA,8BAA8B,mEAAe;AAC7C;AACA;;AAEA,uCAAuC,iDAAU;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;;AAEA,6DAA6D;AAC7D;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA,eAAe,mDAAG;AAClB;AACA;AACA;AACA;AACA,SAAS,0DAAmB;AAC5B;AACA;AACA;AACA,GAAG;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA,eAAe,mDAAG;AAClB,GAAG;AACH,eAAe,mDAAG;AAClB,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ,SAAS,4DAAQ;AACjB;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,MAAM,EAAE,6DAAS;AACjB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,IAAI;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;;AAEN;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA,SAAS,8CAAO;AAChB;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;;AAEA,iCAAiC,iDAAU;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ,oBAAoB,iDAAU;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG,GAAG;AACN;;AAEA;AACA,SAAS,0DAAmB,iCAAiC,0DAAmB;AAChF;AACA,GAAG,kBAAkB,0DAAmB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,GAAG;AACH,CAAC;;AAEujB;AACxjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AClzHgF;AACkF;AACrC;;AAE7H;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,GAAG;AACH;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,cAAc;AAChC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,6BAA6B,0DAAmB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,EAAE,4DAAa;AACnB,sBAAsB,+DAAW;AACjC;AACA,gBAAgB,8CAAO;AACvB;AACA;AACA;AACA,2BAA2B,6CAAM;AACjC;AACA;AACA;AACA,EAAE,6EAAyB;AAC3B;AACA;AACA;AACA,GAAG;AACH,EAAE,gDAAS;AACX;AACA,GAAG;AACH,uBAAuB,8CAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,SAAS,0DAAmB;AAC5B;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,mDAAG;AAC3C;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ,kDAAkD,+CAAQ;AAC1D,wBAAwB,6CAAM;AAC9B,EAAE,6EAAyB;AAC3B;AACA;;AAEA;AACA,wBAAwB,4DAAa;AACrC;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH,EAAE,gDAAS;AACX;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,EAAE,iDAAU;AAChB;AACA;AACA,eAAe,8CAAO;AACtB;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,GAAG;AACH,oCAAoC,8CAAO;AAC3C;AACA;AACA;AACA;AACA;AACA,IAAI,EAAE,2DAAY;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,EAAE,2DAAY;AAClB;AACA;AACA,kBAAkB;AAClB;AACA,KAAK;AACL;AACA,GAAG;AACH,qBAAqB,mEAAe;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,mBAAmB,6CAAM;AACzB;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,EAAE,gDAAS;AACX;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH,EAAE,gDAAS;AACX;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,qCAAqC,mEAAe;AACpD;AACA;;AAEA;AACA,aAAa,mDAAG,uBAAuB;AACvC;AACA,OAAO;AACP;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,oBAAoB,uDAAY,OAAO,uDAAY,QAAQ,uDAAY,KAAK,uDAAY;AACxF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,aAAa,uDAAY;AACzB;AACA;AACA;;AAEA;;AAEA,aAAa,uDAAY;AACzB;AACA;AACA;;AAEA;;AAEA,aAAa,uDAAY;AACzB;AACA;AACA;;AAEA;;AAEA,aAAa,uDAAY;AACzB;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL,uBAAuB,6DAAc;AACrC;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,oBAAoB,gEAAiB;;AAErC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,mCAAmC,qEAAsB;AACzD;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wEAAwE,4DAAQ;AAChF;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEuQ;AACvQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC9wBiF;;AAEjF;AACA,sEAAsE,aAAa;AACnF;AACA;;AAEA,SAAS,8CAAO;AAChB;AACA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,oBAAoB,UAAU;AAC9B;;AAEA,8CAA8C,kDAAe,GAAG,4CAAS;;AAEzE;AACA,qBAAqB,6CAAM;AAC3B;AACA;AACA,GAAG;AACH,SAAS,kDAAW;AACpB,wEAAwE,aAAa;AACrF;AACA;;AAEA;AACA,GAAG;AACH;;AAEA;AACA,sBAAsB,6CAAM;AAC5B,cAAc,kDAAW;AACzB;AACA,GAAG;AACH,gBAAgB,kDAAW;AAC3B;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;;AAEA,mBAAmB,6CAAM;AACzB;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA,mBAAmB,6CAAM;AACzB,SAAS,8CAAO;AAChB;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA,eAAe,6CAAM;AACrB,qBAAqB,kDAAW;AAChC;AACA;AACA;;AAEA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA,cAAc,6CAAM;AACpB,EAAE,gDAAS;AACX;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA,SAAS,8CAAO;AAChB;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA,kGAAkG,aAAa;AAC/G;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK,IAAI;AACT,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,QAAQ;AACR;AACA;;AAEA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,QAAQ;AACR;AACA;;AAEA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;;AAEA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEmX;AACnX;;;;;;;;;;;;;;;;;;;;AC5UA;AACA;AACA;AACkD;AACF;AAChD,gCAAgC,sDAAI,CAAC,sDAAG;AACxC;AACA;AACA,yBAAyB,sDAAI,CAAC,uDAAI;AAClC;AACA,GAAG;AACH,CAAC;AACD,iEAAe,UAAU,EAAC;AAC1B;;;;;;;;;;;;;;;;;;;ACbA;AACA;AACA;AACoC;AAAA;AAEpC,MAAMG,YAAY,GAAGA,CAAE;EAAEC,QAAQ;EAAEC,MAAM,GAAG,SAAS;EAAEC,IAAI,GAAG;AAAU,CAAC,KAAM;EAC9E,MAAMC,SAAS,GAAGP,iDAAU,CAC3B,oBAAoB,EACpB,MAAOK,MAAM,EAAG,EAChB,WAAYC,IAAI,EACjB,CAAC;EAED,oBAAOJ,sDAAA;IAAKK,SAAS,EAAGA,SAAW;IAAAH,QAAA,EAAGA;EAAQ,CAAO,CAAC;AACvD,CAAC;AAED,iEAAeD,YAAY;;;;;;;;;;;;;;;;;;;;;;ACf3B;AACA;AACA;AACiE;AACR;;AAEzD;AACA;AACA;AAC+C;AAAA;AAE/C,MAAMU,WAAW,GAAGA,CAAE;EAAEC,KAAK;EAAEC,KAAK;EAAEC,KAAK;EAAEC;AAAS,CAAC,KAAM;EAC5D,MAAM,CAAEC,OAAO,EAAEC,UAAU,CAAE,GAAGT,4DAAQ,CAAE,EAAG,CAAC;EAE9CC,6DAAS,CAAE,MAAM;IAChB,IAAKI,KAAK,EAAG;MACZI,UAAU,CAAEJ,KAAK,CAACK,GAAG,CAAER,uDAAoB,CAAE,CAAC;IAC/C;EACD,CAAC,EAAE,CAAEG,KAAK,CAAG,CAAC;EAEd,IAAKA,KAAK,KAAK,IAAI,EAAG,oBAAOb,sDAAA,CAACO,0DAAO,IAAE,CAAC;EAExC,oBACCP,sDAAA,CAACmB,eAAe;IAAAjB,QAAA,eACfF,sDAAA,CAACM,kEAAe;MACfM,KAAK,EAAGA,KAAO;MACfE,KAAK,EAAGA,KAAO;MACfC,QAAQ,EAAGA,QAAU;MACrBC,OAAO,EAAGA;IAAS,CACnB;EAAC,CACc,CAAC;AAEpB,CAAC;AAED,iEAAeL,WAAW,EAAC;AAE3B,MAAMQ,eAAe,GAAGA,CAAE;EAAEjB;AAAS,CAAC,KAAM;EAC3C,oBAAOF,sDAAA;IAAKK,SAAS,EAAC,uBAAuB;IAAAH,QAAA,EAAGA;EAAQ,CAAO,CAAC;AACjE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;ACtCD;AACA;AACA;AAC2C;;AAE3C;AACA;AACA;AACqC;AACgC;AACd;AACT;;AAE9C;AACA;AACA;AAC4C;AACa;;AAEzD;AACA;AACA;AAFA;AAGA,MAAM8B,qBAAqB,GAAG,GAAG;AACjC,MAAMC,qBAAqB,GAAG,CAAC;AAE/B,MAAMC,iBAAiB,GAAGA,CAAC;EAC1BC,IAAI,GAAG,MAAM;EACbhC,MAAM,GAAG,SAAS;EAClBW,KAAK,GAAG,CAAC;EACTC,QAAQ;EACRqB,WAAW,GAAGf,mDAAE,CAAC,QAAQ,EAAE,kBAAkB,CAAC;EAC9CT,KAAK,GAAGS,mDAAE,CAAC,eAAe,EAAE,kBAAkB,CAAC;EAC/CgB,UAAU,GAAG,CAAC,CAAC;EACfC,aAAa,GAAG,IAAI;EACpBC,mBAAmB,GAAG,EAAE;EACxB,GAAGC;AACJ,CAAC,KAAK;EACL,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAGlC,4DAAQ,CAAC,KAAK,CAAC;EACnD,MAAM,CAACmC,MAAM,EAAEC,SAAS,CAAC,GAAGpC,4DAAQ,CAAC,EAAE,CAAC;EACxC,MAAM,CAACqC,eAAe,CAAC,GAAGzB,yDAAW,CAACuB,MAAM,EAAEX,qBAAqB,CAAC;EACpE,MAAM,CAACc,OAAO,EAAEC,UAAU,CAAC,GAAGvC,4DAAQ,CAAC+B,mBAAmB,CAAC;EAC3D,MAAM,CAACS,aAAa,EAAEC,gBAAgB,CAAC,GAAGzC,4DAAQ,CAAC,KAAK,CAAC;EAEzD,MAAM0C,QAAQ,GAAGxB,wDAAO,CAACS,IAAI,EAAErB,KAAK,CAAC;EAErC,MAAMD,KAAK,GAAGc,qEAAa,CAAC;IAC3BwB,QAAQ,EAAEhB,IAAI;IACdiB,UAAU,EAAEjD,MAAM;IAClBwC,MAAM,EAAEE,eAAe;IACvBQ,aAAa,EAAEpB,qBAAqB;IACpCa;EACD,CAAC,CAAC;EAEF,MAAMQ,iBAAiB,GAAGzC,KAAK,EAAE0C,MAAM,KAAKhB,mBAAmB;EAE/D,MAAMiB,aAAa,GAAGlB,aAAa,GAAGA,aAAa,CAACzB,KAAK,CAAC,GAAGA,KAAK;EAElE,MAAM4C,SAAS,GAAIC,CAAC,IAAK;IACxB,IAAIA,CAAC,CAACC,GAAG,KAAK,QAAQ,EAAE;MACvBD,CAAC,CAACE,cAAc,CAAC,CAAC;MAClBlB,aAAa,CAAC,KAAK,CAAC;IACrB;EACD,CAAC;EAED,oBACCb,uDAAA,CAACP,8DAAW;IACXjB,SAAS,EAAC,0BAA0B;IACpCwD,QAAQ,EAAC,IAAI;IACbjD,KAAK,EAAEA,KAAM;IAAA,GACT4B,IAAI;IAAAtC,QAAA,gBAER2B,uDAAA;MAAKxB,SAAS,EAAC,mCAAmC;MAACoD,SAAS,EAAEA,SAAU;MAAAvD,QAAA,gBACvEF,sDAAA;QACCmC,IAAI,EAAC,MAAM;QACXrB,KAAK,EAAE2B,UAAU,GAAGE,MAAM,GAAGO,QAAQ,EAAEY,KAAK,EAAEC,GAAG,IAAI,EAAG;QACxDhD,QAAQ,EAAG2C,CAAC,IAAKd,SAAS,CAACc,CAAC,CAACM,aAAa,CAAClD,KAAK,CAAE;QAClDsB,WAAW,EAAEA,WAAY;QACzB6B,OAAO,EAAEA,CAAA,KAAMvB,aAAa,CAAC,IAAI,CAAE;QACnCrC,SAAS,EAAC,iCAAiC;QAAA,GACvCgC;MAAU,CACd,CAAC,eAEFrC,sDAAA,CAACuB,yDAAM;QACNlB,SAAS,EAAC,iCAAiC;QAC3C6D,IAAI,EAAEzC,wDAAW;QACjB0C,QAAQ,EAAE,CAACrD,KAAM;QACjBsD,OAAO,EAAEA,CAAA,KAAMrD,QAAQ,CAAC,IAAI,CAAE;QAC9BH,KAAK,EAAES,mDAAE,CAAC,OAAO;MAAE,CACnB,CAAC;IAAA,CACE,CAAC,eAENrB,sDAAA;MAAKK,SAAS,EAAC,mCAAmC;MAAAH,QAAA,EAChDuC,UAAU,iBACVZ,uDAAA,CAAAE,uDAAA;QAAA7B,QAAA,gBACCF,sDAAA,CAACqE,OAAO;UACPrD,OAAO,EAAEwC,aAAc;UACvBb,MAAM,EAAEE,eAAgB;UACxByB,YAAY,EAAGC,IAAI,iBAClBvE,sDAAA;YAECK,SAAS,EAAC,kCAAkC;YAC5C+D,OAAO,EAAEA,CAAA,KAAM;cACdrD,QAAQ,CAACwD,IAAI,CAACC,EAAE,CAAC;cACjB5B,SAAS,CAAC,EAAE,CAAC;cACbF,aAAa,CAAC,KAAK,CAAC;YACrB,CAAE;YAAAxC,QAAA,eAEFF,sDAAA,CAACwB,uDAAO;cAAAtB,QAAA,EAAEqE,IAAI,EAAET,KAAK,EAAEW;YAAQ,CAAU;UAAC,GARrCF,IAAI,CAACC,EASH;QACP,CACF,CAAC,EAEDlB,iBAAiB,iBACjBtD,sDAAA;UAAKK,SAAS,EAAC,gCAAgC;UAAAH,QAAA,EAC7C8C,aAAa,gBACbhD,sDAAA,CAACO,0DAAO,IAAE,CAAC,gBAEXP,sDAAA;YACCK,SAAS,EAAC,+BAA+B;YACzC+D,OAAO,EAAEA,CAAA,KAAM;cACdnB,gBAAgB,CAAC,IAAI,CAAC;cACtBF,UAAU,CAAC,CAAC,CAAC,CAAC;YACf,CAAE;YAAA7C,QAAA,EAEDmB,mDAAE,CAAC,mBAAmB,EAAE,kBAAkB;UAAC,CACrC;QACR,CACG,CACL;MAAA,CACA;IACF,CACG,CAAC;EAAA,CACM,CAAC;AAEhB,CAAC;AAED,MAAMgD,OAAO,GAAGA,CAAC;EAAErD,OAAO;EAAE2B,MAAM;EAAE2B;AAAa,CAAC,KAAK;EACtD,MAAMI,SAAS,GAAG1D,OAAO,KAAK,IAAI;EAClC,MAAM2D,UAAU,GAAG3D,OAAO,IAAIA,OAAO,CAACuC,MAAM,GAAG,CAAC;EAChD,MAAMqB,SAAS,GAAGjC,MAAM,CAACY,MAAM,GAAG,CAAC;EACnC,MAAMsB,sBAAsB,GAAGlC,MAAM,CAACY,MAAM,IAAItB,qBAAqB;EAErE,IAAI,CAAC2C,SAAS,EAAE;IACf,OAAO,IAAI;EACZ;EAEA,IAAIF,SAAS,EAAE;IACd,oBACC1E,sDAAA;MAAKK,SAAS,EAAC,mCAAmC;MAAAH,QAAA,eACjDF,sDAAA,CAACO,0DAAO,IAAE;IAAC,CACP,CAAC;EAER;EAEA,IAAI,CAACoE,UAAU,EAAE;IAChB,IAAI,CAACE,sBAAsB,EAAE;MAC5B,oBACC7E,sDAAA;QAAAE,QAAA,EACEmB,mDAAE,CACF,oCAAoCY,qBAAqB,mBAAmB,EAC5E,kBACD;MAAC,CACC,CAAC;IAEN;IAEA,oBACCjC,sDAAA;MAAAE,QAAA,EAAImB,mDAAE,CAAC,uCAAuC,EAAE,kBAAkB;IAAC,CAAI,CAAC;EAE1E;EAEA,OAAOL,OAAO,CAACE,GAAG,CAACoD,YAAY,CAAC;AACjC,CAAC;AAED,iEAAepC,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;AC9KhC;AACA;AACA;AACqC;AACS;;AAE9C;AACA;AACA;AAC0C;AACuB;AAAA;AAEjE,MAAM6C,aAAa,GAAGA,CAAC;EAAE7E,QAAQ;EAAE8E;AAAO,CAAC,KAAK;EAC/C,MAAM;IAAEC,iBAAiB;IAAEC;EAAc,CAAC,GAAGJ,6EAAiB,CAACE,MAAM,CAAC;EAEtE,oBACChF,sDAAA,CAAC8B,wDAAQ;IAAA5B,QAAA,EACP+E,iBAAiB,GACjB/E,QAAQ,gBAER2B,uDAAA,CAAC5B,qDAAY;MAACE,MAAM,EAAC,OAAO;MAAAD,QAAA,GAC1BmB,mDAAE,CACF,2FAA2F,EAC3F,kBACD,CAAC,eACDrB,sDAAA;QAAAE,QAAA,EAASgF,aAAa,CAACC,IAAI,CAAC,IAAI;MAAC,CAAS,CAAC;IAAA,CAC9B;EACd,CACQ,CAAC;AAEb,CAAC;AAED,iEAAeJ,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AChC5B;AACA;AACA;AAQuB;AAOI;AACc;AACL;;AAEpC;AACA;AACA;AACqC;AACoB;AACI;;AAE7D;AACA;AACA;AAC+C;AAAA;AAE/C,MAAMiB,oBAAoB,GAAGA,CAAC;EAAEpF,KAAK;EAAEC,KAAK;EAAEC,KAAK;EAAEC;AAAS,CAAC,KAAK;EACnE,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGT,4DAAQ,CAAC,EAAE,CAAC;EAC1C,MAAM,CAACyF,eAAe,EAAEC,kBAAkB,CAAC,GAAG1F,4DAAQ,CAAC,EAAE,CAAC;EAC1D,MAAM,CAAC2F,KAAK,EAAEC,QAAQ,CAAC,GAAG5F,4DAAQ,CAAC,EAAE,CAAC;EAEtCC,6DAAS,CAAC,MAAM;IACf,IAAII,KAAK,EAAE;MACVI,UAAU,CAACJ,KAAK,CAACK,GAAG,CAACR,uDAAmB,CAAC,CAAC;IAC3C;EACD,CAAC,EAAE,CAACG,KAAK,CAAC,CAAC;EAEXJ,6DAAS,CAAC,MAAM;IACf,MAAM4F,kBAAkB,GAAGF,KAAK,GAC7BnF,OAAO,CAACsF,MAAM,CAAEC,IAAI,IACpBA,IAAI,CAAC3F,KAAK,CAAC4F,WAAW,CAAC,CAAC,CAACC,QAAQ,CAACN,KAAK,CAACK,WAAW,CAAC,CAAC,CACrD,CAAC,GACDxF,OAAO;IAEVkF,kBAAkB,CAACG,kBAAkB,CAAC;EACvC,CAAC,EAAE,CAACrF,OAAO,EAAEmF,KAAK,CAAC,CAAC;EAEpB,IAAItF,KAAK,KAAK,IAAI,EAAE,oBAAOb,sDAAA,CAACO,0DAAO,IAAE,CAAC;EAEtC,IAAI,CAACS,OAAO,IAAI,CAACA,OAAO,CAACuC,MAAM,EAAE,OAAO,IAAI;EAE5C,MAAMmD,aAAa,GAAGA,CAACC,MAAM,EAAEC,UAAU,KAAK;IAC7C7F,QAAQ,CACP6F,UAAU,GACP9F,KAAK,CAACwF,MAAM,CAAE9B,EAAE,IAAKA,EAAE,KAAKmC,MAAM,CAAC7F,KAAK,CAAC,GACzC,CAAC,GAAGA,KAAK,EAAE6F,MAAM,CAAC7F,KAAK,CAC3B,CAAC;EACF,CAAC;EAED,MAAM+F,SAAS,GAAIC,SAAS,IAAK;IAChC/F,QAAQ,CAAC+F,SAAS,CAAC;EACpB,CAAC;EAED,MAAMC,YAAY,GAAIJ,MAAM,IAAK;IAChC5F,QAAQ,CAACD,KAAK,CAACwF,MAAM,CAAE9B,EAAE,IAAKA,EAAE,KAAKmC,MAAM,CAAC7F,KAAK,CAAC,CAAC;EACpD,CAAC;EAED,MAAMkG,eAAe,GAAGlG,KAAK,CAACmG,MAAM,CAAC,CAACC,KAAK,EAAE1C,EAAE,KAAK;IACnD,MAAMmC,MAAM,GAAG3F,OAAO,CAACmG,IAAI,CAAER,MAAM,IAAKA,MAAM,CAAC7F,KAAK,KAAK0D,EAAE,CAAC;IAE5D,IAAImC,MAAM,EAAE;MACXO,KAAK,CAACE,IAAI,CAACT,MAAM,CAAC;IACnB;IAEA,OAAOO,KAAK;EACb,CAAC,EAAE,EAAE,CAAC;EAEN,oBACCrF,uDAAA,CAACP,8DAAW;IAACV,KAAK,EAAEA,KAAM;IAACP,SAAS,EAAC,6BAA6B;IAAAH,QAAA,gBACjEF,sDAAA;MAAIK,SAAS,EAAC,uCAAuC;MAAAH,QAAA,EACnDmB,mDAAE,CAAC,cAAc,EAAE,kBAAkB;IAAC,CACpC,CAAC,eAELrB,sDAAA;MACCmC,IAAI,EAAC,MAAM;MACXC,WAAW,EAAEf,mDAAE,CAAC,QAAQ,EAAE,kBAAkB,CAAE;MAC9CP,KAAK,EAAEqF,KAAM;MACbpF,QAAQ,EAAGsG,KAAK,IAAKjB,QAAQ,CAACiB,KAAK,CAACC,MAAM,CAACxG,KAAK,CAAE;MAClDT,SAAS,EAAC;IAAqC,CAC/C,CAAC,eAEFL,sDAAA;MAAKK,SAAS,EAAC,mCAAmC;MAAAH,QAAA,EAChD+F,eAAe,CAAC/E,GAAG,CAAC,CAACyF,MAAM,EAAEY,KAAK,KAAK;QACvC,MAAMX,UAAU,GAAG9F,KAAK,CAACqG,IAAI,CAAE3C,EAAE,IAAKA,EAAE,KAAKmC,MAAM,CAAC7F,KAAK,CAAC;QAE1D,MAAM0G,eAAe,GAAG1H,iDAAU,CACjC,qCAAqC,EACrC;UACC,aAAa,EAAE8G;QAChB,CACD,CAAC;QAED,oBACC5G,sDAAA;UAECoE,OAAO,EAAEA,CAAA,KAAMsC,aAAa,CAACC,MAAM,EAAEC,UAAU,CAAE;UACjDvG,SAAS,EAAEmH,eAAgB;UAAAtH,QAAA,EAE1ByG,MAAM,CAAC/F;QAAK,GAJR2G,KAKE,CAAC;MAEX,CAAC;IAAC,CACE,CAAC,eAENvH,sDAAA;MAAIK,SAAS,EAAC,uCAAuC;MAAAH,QAAA,EACnDmB,mDAAE,CAAC,cAAc,EAAE,kBAAkB;IAAC,CACpC,CAAC,eAELrB,sDAAA,CAACyH,YAAY;MACZP,KAAK,EAAEF,eAAgB;MACvBjG,QAAQ,EAAE8F,SAAU;MACpBE,YAAY,EAAEA;IAAa,CAC3B,CAAC;EAAA,CACU,CAAC;AAEhB,CAAC;AAED,MAAMW,YAAY,GAAGA,CAAC;EAAElD,EAAE;EAAE1D,KAAK;EAAE6G,QAAQ;EAAEC;AAAW,CAAC,KAAK;EAC7D,MAAM;IAAEC,UAAU;IAAEC,SAAS;IAAEC,UAAU;IAAEC,SAAS;IAAEC;EAAW,CAAC,GACjEnC,8DAAW,CAAC;IAAEtB;EAAG,CAAC,CAAC;EAEpB,MAAM0D,KAAK,GAAG;IACbF,SAAS,EAAEjC,mDAAG,CAACoC,SAAS,CAACC,QAAQ,CAAC;MACjCC,CAAC,EAAE,CAAC;MACJC,CAAC,EAAEN,SAAS,EAAEM,CAAC;MACfC,MAAM,EAAE,CAAC;MACTC,MAAM,EAAE;IACT,CAAC,CAAC;IACFP;EACD,CAAC;EAED,oBACCpG,uDAAA;IACCxB,SAAS,EAAC,4CAA4C;IACtDoI,GAAG,EAAEV,UAAW;IAChBG,KAAK,EAAEA,KAAM;IAAAhI,QAAA,gBAEbF,sDAAA;MAAA,GAAU6H,UAAU;MAAA,GAAMC,SAAS;MAAA5H,QAAA,EACjCY,KAAK,CAACF;IAAK,CACP,CAAC,EACN,CAACgH,UAAU,iBACX5H,sDAAA;MACCK,SAAS,EAAC,8CAA8C;MACxD+D,OAAO,EAAEA,CAAA,KAAMuD,QAAQ,CAAC7G,KAAK;IAAE,CAC/B,CACD;EAAA,CACG,CAAC;AAER,CAAC;AAED,MAAM2G,YAAY,GAAGA,CAAC;EAAEP,KAAK;EAAEnG,QAAQ;EAAEgG;AAAa,CAAC,KAAK;EAC3D,MAAM,CAACa,UAAU,EAAEc,aAAa,CAAC,GAAGlI,4DAAQ,CAAC,KAAK,CAAC;EAEnD,MAAMmI,OAAO,GAAGlD,yDAAU,CACzBD,wDAAS,CAACD,wDAAa,CAAC,EACxBC,wDAAS,CAACF,yDAAc,EAAE;IACzBsD,gBAAgB,EAAEhD,0EAA2BA;EAC9C,CAAC,CACF,CAAC;EAED,MAAMiD,eAAe,GAAIxB,KAAK,IAAK;IAClCqB,aAAa,CAAC,IAAI,CAAC;EACpB,CAAC;EAED,MAAMI,aAAa,GAAIzB,KAAK,IAAK;IAChCqB,aAAa,CAAC,KAAK,CAAC;IAEpB,MAAM;MAAEK,MAAM;MAAEC;IAAK,CAAC,GAAG3B,KAAK;IAE9B,IAAI0B,MAAM,CAACvE,EAAE,KAAKwE,IAAI,CAACxE,EAAE,EAAE;MAC1B,MAAMyE,GAAG,GAAG/B,KAAK,CAAChG,GAAG,CAAEgI,IAAI,IAAKA,IAAI,CAACpI,KAAK,CAAC;MAC3C,MAAMqI,QAAQ,GAAGF,GAAG,CAACG,OAAO,CAACL,MAAM,CAACvE,EAAE,CAAC;MACvC,MAAM6E,QAAQ,GAAGJ,GAAG,CAACG,OAAO,CAACJ,IAAI,CAACxE,EAAE,CAAC;MACrC,MAAM8E,MAAM,GAAG5D,4DAAS,CAACuD,GAAG,EAAEE,QAAQ,EAAEE,QAAQ,CAAC;MAEjDtI,QAAQ,CAACuI,MAAM,CAAC;IACjB;EACD,CAAC;EAED,oBACCtJ,sDAAA;IAAKK,SAAS,EAAC,mCAAmC;IAAAH,QAAA,eACjDF,sDAAA,CAACoF,qDAAU;MACVuD,OAAO,EAAEA,OAAQ;MACjBY,kBAAkB,EAAElE,wDAAc;MAClCmE,WAAW,EAAEX,eAAgB;MAC7BY,SAAS,EAAEX,aAAc;MAAA5I,QAAA,eAEzBF,sDAAA,CAAC2F,8DAAe;QAACuB,KAAK,EAAEA,KAAM;QAACwC,QAAQ,EAAE7D,0EAA4B;QAAA3F,QAAA,eACpEF,sDAAA;UAAKK,SAAS,EAAC,4CAA4C;UAAAH,QAAA,EACzDgH,KAAK,CAAChG,GAAG,CAAC,CAACgI,IAAI,EAAE3B,KAAK,kBACtBvH,sDAAA,CAAC0H,YAAY;YAEZlD,EAAE,EAAE0E,IAAI,CAACpI,KAAM;YACfyG,KAAK,EAAEA,KAAM;YACbzG,KAAK,EAAEoI,IAAK;YACZvB,QAAQ,EAAEZ,YAAa;YACvBa,UAAU,EAAEA;UAAW,GALlB,QAAQsB,IAAI,CAACpI,KAAK,EAMvB,CACD;QAAC,CACE;MAAC,CACU;IAAC,CACP;EAAC,CACT,CAAC;AAER,CAAC;AAED,iEAAekF,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;AC/NnC;AACA;AACA;AACqC;AACyC;AACZ;AACtB;;AAE5C;AACA;AACA;AAC0C;AAAA;AAE1C,MAAM8D,eAAe,GAAGA,CAAC;EAAEC,IAAI;EAAEnJ,KAAK;EAAEE,KAAK;EAAEC;AAAS,CAAC,KAAK;EAC7D,MAAM,CAACiJ,UAAU,EAAEC,aAAa,CAAC,GAAGzJ,4DAAQ,CAAC,EAAE,CAAC;EAChD,MAAM,CAAC2F,KAAK,EAAEC,QAAQ,CAAC,GAAG5F,4DAAQ,CAAC,EAAE,CAAC;EACtC,MAAM0J,aAAa,GAAGF,UAAU,CAACzG,MAAM,GAAG,CAAC;;EAE3C;AACD;AACA;EACC,MAAM4G,IAAI,GAAGP,0DAAS,CACpBQ,MAAM,IAAK;IACX,OAAOA,MAAM,CAAC,MAAM,CAAC,CAACC,gBAAgB,CAAC,UAAU,EAAEN,IAAI,EAAE;MACxDO,QAAQ,EAAE,CAAC;IACZ,CAAC,CAAC;EACH,CAAC,EACD,CAACP,IAAI,CACN,CAAC;EAED,MAAMrF,SAAS,GAAGyF,IAAI,KAAK,IAAI;;EAE/B;AACD;AACA;EACC1J,6DAAS,CAAC,MAAM;IACf,IAAI0J,IAAI,EAAE;MACT,MAAMI,eAAe,GAAGJ,IAAI,CAAClD,MAAM,CAAC,CAACuD,GAAG,EAAEC,GAAG,KAAK;QACjD,MAAM9G,GAAG,GAAG8G,GAAG,CAACC,MAAM,IAAI,CAAC;QAC3BF,GAAG,CAAC7G,GAAG,CAAC,GAAG,CAAC,IAAI6G,GAAG,CAAC7G,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE8G,GAAG,CAAC;QACrC,OAAOD,GAAG;MACX,CAAC,EAAE,CAAC,CAAC,CAAC;MAEN,MAAMG,kBAAkB,GAAIzB,IAAI,IAAK;QACpC,OAAO;UACN,GAAGA,IAAI;UACPhJ,QAAQ,EAAEqK,eAAe,CAACrB,IAAI,CAAC1E,EAAE,CAAC,GAC/B+F,eAAe,CAACrB,IAAI,CAAC1E,EAAE,CAAC,CAACtD,GAAG,CAACyJ,kBAAkB,CAAC,GAChD;QACJ,CAAC;MACF,CAAC;MAED,IAAIJ,eAAe,CAAC,CAAC,CAAC,EAAE;QACvB,MAAMK,aAAa,GAAGL,eAAe,CAAC,CAAC,CAAC,CAACrJ,GAAG,CAACyJ,kBAAkB,CAAC;QAChEV,aAAa,CAACW,aAAa,CAAC;MAC7B;IACD;EACD,CAAC,EAAE,CAACT,IAAI,CAAC,CAAC;EAEV,MAAMU,WAAW,GAAGA,CAACrG,EAAE,EAAEsG,OAAO,KAAK;IACpC,IAAIA,OAAO,EAAE;MACZ/J,QAAQ,CAAC,CAAC,GAAGD,KAAK,EAAE0D,EAAE,CAAC,CAAC;IACzB,CAAC,MAAM;MACNzD,QAAQ,CAACD,KAAK,CAACwF,MAAM,CAAEC,IAAI,IAAKA,IAAI,KAAK/B,EAAE,CAAC,CAAC;IAC9C;EACD,CAAC;EAED,MAAMuG,OAAO,GAAGA,CAAC;IAAEC;EAAK,CAAC,KAAK;IAC7B,OAAOA,IAAI,CAACxE,WAAW,CAAC,CAAC,CAACC,QAAQ,CAACN,KAAK,CAACK,WAAW,CAAC,CAAC,CAAC;EACxD,CAAC;EAED,MAAMF,MAAM,GAAI6D,IAAI,IAAK;IACxB,MAAMc,GAAG,GAAG,EAAE;IAEdd,IAAI,CAACe,OAAO,CAAEhC,IAAI,IAAK;MACtB,IAAI6B,OAAO,CAAC7B,IAAI,CAAC,IAAIA,IAAI,CAAChJ,QAAQ,CAACiL,IAAI,CAACJ,OAAO,CAAC,EAAE;QACjDE,GAAG,CAAC7D,IAAI,CAAC;UAAE,GAAG8B,IAAI;UAAEhJ,QAAQ,EAAEoG,MAAM,CAAC4C,IAAI,CAAChJ,QAAQ;QAAE,CAAC,CAAC;MACvD;IACD,CAAC,CAAC;IAEF,OAAO+K,GAAG;EACX,CAAC;EAED,oBACCpJ,uDAAA,CAACP,8DAAW;IAACV,KAAK,EAAEiJ,sDAAc,CAACjJ,KAAK,EAAEE,KAAK,EAAEyC,MAAM,CAAE;IAAArD,QAAA,gBACxDF,sDAAA,CAACoL,WAAW;MACXtK,KAAK,EAAEqF,KAAM;MACbpF,QAAQ,EAAGsG,KAAK,IAAKjB,QAAQ,CAACiB,KAAK,CAACC,MAAM,CAACxG,KAAK;IAAE,CAClD,CAAC,EACD,CAAC4D,SAAS,IAAI5D,KAAK,CAACyC,MAAM,GAAG,CAAC,iBAC9BvD,sDAAA;MAAKK,SAAS,EAAC,eAAe;MAAAH,QAAA,EAC5BY,KAAK,CAACI,GAAG,CAAEsD,EAAE,iBACbxE,sDAAA,CAACqL,YAAY;QAEZ7G,EAAE,EAAEA,EAAG;QACP5D,KAAK,EAAEuJ,IAAI,CAAChD,IAAI,CAAEZ,IAAI,IAAKA,IAAI,CAAC/B,EAAE,KAAKA,EAAE,CAAC,EAAEwG,IAAK;QACjD5G,OAAO,EAAEA,CAAA,KAAMyG,WAAW,CAACrG,EAAE,EAAE,KAAK;MAAE,GAHjCA,EAIL,CACD;IAAC,CACE,CACL,eACDxE,sDAAA,CAACsL,eAAe;MAAApL,QAAA,EACdwE,SAAS,gBACT1E,sDAAA,CAACO,0DAAO,IAAE,CAAC,GACR,CAAC2J,aAAa,gBACjBlK,sDAAA;QAAAE,QAAA,EACEmB,mDAAE,CAAC,0BAA0B0I,IAAI,UAAU,EAAE,kBAAkB;MAAC,CAC/D,CAAC,gBAEJ/J,sDAAA,CAACuL,aAAa;QACbpB,IAAI,EAAEhE,KAAK,GAAGG,MAAM,CAAC0D,UAAU,CAAC,GAAGA,UAAW;QAC9ClJ,KAAK,EAAEA,KAAM;QACb0K,eAAe,EAAEX;MAAY,CAC7B;IACD,CACe,CAAC;EAAA,CACN,CAAC;AAEhB,CAAC;AAED,iEAAef,eAAe,EAAC;AAE/B,MAAMyB,aAAa,GAAGA,CAAC;EAAEpB,IAAI;EAAErJ,KAAK;EAAE0K;AAAgB,CAAC,KAAK;EAC3D,oBACCxL,sDAAA;IAAAE,QAAA,EACEiK,IAAI,CAACjJ,GAAG,CAAEgI,IAAI,iBACdrH,uDAAA;MAAA3B,QAAA,gBACCF,sDAAA,CAAC2J,kEAAe;QAEf/I,KAAK,eAAEZ,sDAAA,CAACwB,uDAAO;UAAAtB,QAAA,EAAEgJ,IAAI,CAAC8B;QAAI,CAAU,CAAE;QACtCF,OAAO,EAAEhK,KAAK,CAAC2F,QAAQ,CAACyC,IAAI,CAAC1E,EAAE,CAAE;QACjCzD,QAAQ,EAAG+J,OAAO,IAAKU,eAAe,CAACtC,IAAI,CAAC1E,EAAE,EAAEsG,OAAO;MAAE,GAHpD5B,IAAI,CAAC1E,EAIV,CAAC,EACD0E,IAAI,CAAChJ,QAAQ,iBACbF,sDAAA,CAACuL,aAAa;QACbpB,IAAI,EAAEjB,IAAI,CAAChJ,QAAS;QACpBY,KAAK,EAAEA,KAAM;QACb0K,eAAe,EAAEA;MAAgB,CACjC,CACD;IAAA,GAbOtC,IAAI,CAAC1E,EAcV,CACJ;EAAC,CACC,CAAC;AAEP,CAAC;AAED,MAAM4G,WAAW,GAAGA,CAAC;EAAEtK,KAAK;EAAEC;AAAS,CAAC,KAAK;EAC5C,oBACCf,sDAAA;IAAKK,SAAS,EAAC,mBAAmB;IAAAH,QAAA,eACjCF,sDAAA;MACCmC,IAAI,EAAC,MAAM;MACXC,WAAW,EAAEf,mDAAE,CAAC,QAAQ,EAAE,kBAAkB,CAAE;MAC9CP,KAAK,EAAEA,KAAM;MACbC,QAAQ,EAAEA;IAAS,CACnB;EAAC,CACE,CAAC;AAER,CAAC;AAED,MAAMsK,YAAY,GAAGA,CAAC;EAAE7G,EAAE;EAAE5D,KAAK;EAAEwD;AAAQ,CAAC,KAAK;EAChD,oBACCpE,sDAAA;IAAiBoE,OAAO,EAAEA,OAAQ;IAAC/D,SAAS,EAAC,oBAAoB;IAAAH,QAAA,eAChEF,sDAAA,CAACwB,uDAAO;MAAAtB,QAAA,EAAEU;IAAK,CAAU;EAAC,GADd4D,EAEL,CAAC;AAEX,CAAC;AAED,MAAM8G,eAAe,GAAGA,CAAC;EAAEpL;AAAS,CAAC,KAAK;EACzC,oBAAOF,sDAAA;IAAKK,SAAS,EAAC,uBAAuB;IAAAH,QAAA,EAAEA;EAAQ,CAAM,CAAC;AAC/D,CAAC;;;;;;;;;;;;;;;;;ACzKD;AACA;AACA;AAC4C;AAErC,SAASuL,WAAWA,CAAEtI,QAAQ,EAAG;EACvC,MAAMtC,KAAK,GAAG+I,0DAAS,CACpBQ,MAAM,IACPA,MAAM,CAAE,MAAO,CAAC,CAACC,gBAAgB,CAAE,UAAU,EAAElH,QAAQ,EAAE;IACxDmH,QAAQ,EAAE,CAAC,CAAC;IACZoB,OAAO,EAAE,OAAO;IAChBC,KAAK,EAAE,KAAK;IACZxL,MAAM,EAAE;EACT,CAAE,CAAC,EACJ,CAAEgD,QAAQ,CACX,CAAC;EAED,OAAOtC,KAAK;AACb;;;;;;;;;;;;;;;;;AClBA;AACA;AACA;AAC4C;AAErC,SAASc,aAAaA,CAAC;EAC7BwB,QAAQ,GAAG,MAAM;EACjBC,UAAU,GAAG,SAAS;EACtBT,MAAM,GAAG,EAAE;EACXU,aAAa,GAAG,CAAC;EACjBP,OAAO,GAAG;AACX,CAAC,EAAE;EACF,MAAMjC,KAAK,GAAG+I,0DAAS,CACrBQ,MAAM,IAAK;IACX,IAAIzH,MAAM,CAACY,MAAM,GAAGF,aAAa,EAAE;MAClC,OAAO,EAAE;IACV;IAEA,OAAO+G,MAAM,CAAC,MAAM,CAAC,CAACC,gBAAgB,CAAC,UAAU,EAAElH,QAAQ,EAAE;MAC5DmH,QAAQ,EAAExH,OAAO;MACjB4I,OAAO,EAAE,OAAO;MAChBC,KAAK,EAAE,KAAK;MACZxL,MAAM,EAAEiD,UAAU;MAClBT;IACD,CAAC,CAAC;EACH,CAAC,EACD,CAACQ,QAAQ,EAAER,MAAM,EAAEU,aAAa,EAAEP,OAAO,CAC1C,CAAC;EAED,OAAOjC,KAAK;AACb;;;;;;;;;;;;;;;;;AC9BA;AACA;AACA;AAC4C;AAErC,SAASa,OAAOA,CAACyB,QAAQ,EAAEqB,EAAE,EAAE;EACrC,MAAMD,IAAI,GAAGqF,0DAAS,CACpBQ,MAAM,IAAK;IACX,IAAI,CAAC5F,EAAE,EAAE;MACR,OAAO,IAAI;IACZ;IAEA,OAAO4F,MAAM,CAAC,MAAM,CAAC,CAACwB,eAAe,CAAC,UAAU,EAAEzI,QAAQ,EAAEqB,EAAE,CAAC;EAChE,CAAC,EACD,CAACA,EAAE,CACJ,CAAC;EAED,OAAOD,IAAI;AACZ;;;;;;;;;;;;;;;;;AClBA;AACA;AACA;AAC4C;AAErC,SAASO,iBAAiBA,CAAE+G,cAAc,EAAG;EACnD,MAAMC,UAAU,GAAGlC,0DAAS,CAAIQ,MAAM,IAAM;IAC3C,OAAOA,MAAM,CAAE,aAAc,CAAC,CAC5B2B,aAAa,CAAC,CAAC,CACf7K,GAAG,CAAIqF,IAAI,IAAMA,IAAI,CAACyE,IAAK,CAAC;EAC/B,CAAC,EAAE,EAAG,CAAC;EAEP,MAAM9F,aAAa,GAAG2G,cAAc,CAACvF,MAAM,CACxC0F,KAAK,IAAM,CAAEF,UAAU,CAACrF,QAAQ,CAAEuF,KAAM,CAC3C,CAAC;EAED,OAAO;IACN9G,aAAa;IACbD,iBAAiB,EAAE,CAAEC,aAAa,CAAC3B;EACpC,CAAC;AACF;;;;;;;;;;;;;;;;ACpBO,MAAM7C,mBAAmB,GAAI6D,IAAI,KAAM;EAC7CC,EAAE,EAAED,IAAI,CAACC,EAAE;EACX5D,KAAK,EAAE2D,IAAI,CAACT,KAAK,CAACC,GAAG;EACrBjD,KAAK,EAAEyD,IAAI,CAACC;AACb,CAAC,CAAC;AAEK,MAAMqF,cAAc,GAAGA,CAACjJ,KAAK,EAAEqL,KAAK,KAAK;EAC/C,IAAI,CAACA,KAAK,EAAE;IACX,OAAOrL,KAAK;EACb;EAEA,OAAO,GAAGA,KAAK,KAAKqL,KAAK,GAAG;AAC7B,CAAC;;;;;;;;;;;;ACZD;;;;;;;;;;;;;;;;;;;;ACA4F,kBAAkB,aAAa,6CAAC,SAAS,6CAAC,MAAM,6CAAC,SAAS,6CAAC,OAAO,6CAAC,KAAK,6CAAC,KAAK,6CAAC,MAAM,6CAAC,KAAK,YAAY,gDAAgD,mEAAmE,QAAQ,gBAAgB,8IAA8I,gDAAC,YAAY,+BAA+B,cAAc,KAAK,MAAM,8CAAC,YAAY,kBAAkB,4BAA4B,2EAA2E,iBAAiB,wFAAwF,eAAe,uBAAuB,kBAAkB,+CAA+C,eAAe,6EAA6E,gBAAgB,iBAAiB,oBAAoB,cAAc,wDAAwD,QAAQ,cAAc,SAAS,wBAAwB,iEAAiE,oFAAoF,gCAAgC,qCAAqC,2BAA2B,gIAAgI,wBAAwB,kBAAkB,oBAAoB,yCAAyC,GAAG,oBAAoB,SAAS,gBAAgB,aAAa,gBAAgB,SAAS,kBAAkB,2BAA2B,iDAAC,wBAAwB,kDAAC,aAAa,YAAY,aAAa,6CAAC,IAAI,mEAAmE,kBAAkB,mBAAmB,4BAA4B,cAAc,uDAAuD,EAA+E;AACjkE;;;;;;;;;;;;ACDA;;;;;;;;;;;ACAA;;;;;;;;;;;ACAA;;;;;;;;;;;ACAA;;;;;;;;;;;ACAA;;;;;;;;;;;ACAA;;;;;;;;;;;ACAA;;;;;;;;;;;ACAA;;;;;;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,gBAAgB;;AAEhB;AACA;;AAEA,kBAAkB,sBAAsB;AACxC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,KAAK,KAA6B;AAClC;AACA;AACA,GAAG,SAAS,IAA4E;AACxF;AACA,EAAE,iCAAqB,EAAE,mCAAE;AAC3B;AACA,GAAG;AAAA,kGAAC;AACJ,GAAG,KAAK,EAEN;AACF,CAAC;;;;;;;UC5ED;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACNA;AACA;AACA;AACuB;;AAEvB;AACA;AACA;AACqD;AACF;AACI;AACc;AACV;AACI;;AAE/D;AACA;AACA;AACoD;AACY;AACrB;AACa","sources":["webpack://@evermade/wp-block-toolkit/./node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js","webpack://@evermade/wp-block-toolkit/./node_modules/@dnd-kit/core/dist/core.esm.js","webpack://@evermade/wp-block-toolkit/./node_modules/@dnd-kit/sortable/dist/sortable.esm.js","webpack://@evermade/wp-block-toolkit/./node_modules/@dnd-kit/utilities/dist/utilities.esm.js","webpack://@evermade/wp-block-toolkit/./node_modules/@wordpress/icons/build-module/library/close-small.js","webpack://@evermade/wp-block-toolkit/./src/components/InlineNotice.js","webpack://@evermade/wp-block-toolkit/./src/components/PostControl.js","webpack://@evermade/wp-block-toolkit/./src/components/PostSearchControl.js","webpack://@evermade/wp-block-toolkit/./src/components/RequireBlocks.js","webpack://@evermade/wp-block-toolkit/./src/components/SortablePostsControl.js","webpack://@evermade/wp-block-toolkit/./src/components/TaxonomyControl.js","webpack://@evermade/wp-block-toolkit/./src/hooks/use-all-posts.js","webpack://@evermade/wp-block-toolkit/./src/hooks/use-post-search.js","webpack://@evermade/wp-block-toolkit/./src/hooks/use-post.js","webpack://@evermade/wp-block-toolkit/./src/hooks/use-required-blocks.js","webpack://@evermade/wp-block-toolkit/./src/utils.js","webpack://@evermade/wp-block-toolkit/./src/editor.scss","webpack://@evermade/wp-block-toolkit/./node_modules/use-debounce/dist/index.module.js","webpack://@evermade/wp-block-toolkit/external window \"React\"","webpack://@evermade/wp-block-toolkit/external window \"ReactDOM\"","webpack://@evermade/wp-block-toolkit/external window \"ReactJSXRuntime\"","webpack://@evermade/wp-block-toolkit/external window [\"wp\",\"components\"]","webpack://@evermade/wp-block-toolkit/external window [\"wp\",\"data\"]","webpack://@evermade/wp-block-toolkit/external window [\"wp\",\"element\"]","webpack://@evermade/wp-block-toolkit/external window [\"wp\",\"i18n\"]","webpack://@evermade/wp-block-toolkit/external window [\"wp\",\"primitives\"]","webpack://@evermade/wp-block-toolkit/./node_modules/classnames/index.js","webpack://@evermade/wp-block-toolkit/webpack/bootstrap","webpack://@evermade/wp-block-toolkit/webpack/runtime/compat get default export","webpack://@evermade/wp-block-toolkit/webpack/runtime/define property getters","webpack://@evermade/wp-block-toolkit/webpack/runtime/hasOwnProperty shorthand","webpack://@evermade/wp-block-toolkit/webpack/runtime/make namespace object","webpack://@evermade/wp-block-toolkit/./src/index.js"],"sourcesContent":["import React, { useState, useCallback } from 'react';\n\nconst hiddenStyles = {\n display: 'none'\n};\nfunction HiddenText(_ref) {\n let {\n id,\n value\n } = _ref;\n return React.createElement(\"div\", {\n id: id,\n style: hiddenStyles\n }, value);\n}\n\nfunction LiveRegion(_ref) {\n let {\n id,\n announcement,\n ariaLiveType = \"assertive\"\n } = _ref;\n // Hide element visually but keep it readable by screen readers\n const visuallyHidden = {\n position: 'fixed',\n width: 1,\n height: 1,\n margin: -1,\n border: 0,\n padding: 0,\n overflow: 'hidden',\n clip: 'rect(0 0 0 0)',\n clipPath: 'inset(100%)',\n whiteSpace: 'nowrap'\n };\n return React.createElement(\"div\", {\n id: id,\n style: visuallyHidden,\n role: \"status\",\n \"aria-live\": ariaLiveType,\n \"aria-atomic\": true\n }, announcement);\n}\n\nfunction useAnnouncement() {\n const [announcement, setAnnouncement] = useState('');\n const announce = useCallback(value => {\n if (value != null) {\n setAnnouncement(value);\n }\n }, []);\n return {\n announce,\n announcement\n };\n}\n\nexport { HiddenText, LiveRegion, useAnnouncement };\n//# sourceMappingURL=accessibility.esm.js.map\n","import React, { createContext, useContext, useEffect, useState, useCallback, useMemo, useRef, useReducer, memo, cloneElement, forwardRef } from 'react';\nimport { createPortal, unstable_batchedUpdates } from 'react-dom';\nimport { useUniqueId, getEventCoordinates, getWindow, isDocument, isHTMLElement, isSVGElement, canUseDOM, isWindow, isNode, getOwnerDocument, add, isKeyboardEvent, subtract, useLazyMemo, useInterval, usePrevious, useLatestValue, useEvent, useIsomorphicLayoutEffect, useNodeRef, findFirstFocusableNode, CSS } from '@dnd-kit/utilities';\nimport { useAnnouncement, HiddenText, LiveRegion } from '@dnd-kit/accessibility';\n\nconst DndMonitorContext = /*#__PURE__*/createContext(null);\n\nfunction useDndMonitor(listener) {\n const registerListener = useContext(DndMonitorContext);\n useEffect(() => {\n if (!registerListener) {\n throw new Error('useDndMonitor must be used within a children of ');\n }\n\n const unsubscribe = registerListener(listener);\n return unsubscribe;\n }, [listener, registerListener]);\n}\n\nfunction useDndMonitorProvider() {\n const [listeners] = useState(() => new Set());\n const registerListener = useCallback(listener => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n }, [listeners]);\n const dispatch = useCallback(_ref => {\n let {\n type,\n event\n } = _ref;\n listeners.forEach(listener => {\n var _listener$type;\n\n return (_listener$type = listener[type]) == null ? void 0 : _listener$type.call(listener, event);\n });\n }, [listeners]);\n return [dispatch, registerListener];\n}\n\nconst defaultScreenReaderInstructions = {\n draggable: \"\\n To pick up a draggable item, press the space bar.\\n While dragging, use the arrow keys to move the item.\\n Press space again to drop the item in its new position, or press escape to cancel.\\n \"\n};\nconst defaultAnnouncements = {\n onDragStart(_ref) {\n let {\n active\n } = _ref;\n return \"Picked up draggable item \" + active.id + \".\";\n },\n\n onDragOver(_ref2) {\n let {\n active,\n over\n } = _ref2;\n\n if (over) {\n return \"Draggable item \" + active.id + \" was moved over droppable area \" + over.id + \".\";\n }\n\n return \"Draggable item \" + active.id + \" is no longer over a droppable area.\";\n },\n\n onDragEnd(_ref3) {\n let {\n active,\n over\n } = _ref3;\n\n if (over) {\n return \"Draggable item \" + active.id + \" was dropped over droppable area \" + over.id;\n }\n\n return \"Draggable item \" + active.id + \" was dropped.\";\n },\n\n onDragCancel(_ref4) {\n let {\n active\n } = _ref4;\n return \"Dragging was cancelled. Draggable item \" + active.id + \" was dropped.\";\n }\n\n};\n\nfunction Accessibility(_ref) {\n let {\n announcements = defaultAnnouncements,\n container,\n hiddenTextDescribedById,\n screenReaderInstructions = defaultScreenReaderInstructions\n } = _ref;\n const {\n announce,\n announcement\n } = useAnnouncement();\n const liveRegionId = useUniqueId(\"DndLiveRegion\");\n const [mounted, setMounted] = useState(false);\n useEffect(() => {\n setMounted(true);\n }, []);\n useDndMonitor(useMemo(() => ({\n onDragStart(_ref2) {\n let {\n active\n } = _ref2;\n announce(announcements.onDragStart({\n active\n }));\n },\n\n onDragMove(_ref3) {\n let {\n active,\n over\n } = _ref3;\n\n if (announcements.onDragMove) {\n announce(announcements.onDragMove({\n active,\n over\n }));\n }\n },\n\n onDragOver(_ref4) {\n let {\n active,\n over\n } = _ref4;\n announce(announcements.onDragOver({\n active,\n over\n }));\n },\n\n onDragEnd(_ref5) {\n let {\n active,\n over\n } = _ref5;\n announce(announcements.onDragEnd({\n active,\n over\n }));\n },\n\n onDragCancel(_ref6) {\n let {\n active,\n over\n } = _ref6;\n announce(announcements.onDragCancel({\n active,\n over\n }));\n }\n\n }), [announce, announcements]));\n\n if (!mounted) {\n return null;\n }\n\n const markup = React.createElement(React.Fragment, null, React.createElement(HiddenText, {\n id: hiddenTextDescribedById,\n value: screenReaderInstructions.draggable\n }), React.createElement(LiveRegion, {\n id: liveRegionId,\n announcement: announcement\n }));\n return container ? createPortal(markup, container) : markup;\n}\n\nvar Action;\n\n(function (Action) {\n Action[\"DragStart\"] = \"dragStart\";\n Action[\"DragMove\"] = \"dragMove\";\n Action[\"DragEnd\"] = \"dragEnd\";\n Action[\"DragCancel\"] = \"dragCancel\";\n Action[\"DragOver\"] = \"dragOver\";\n Action[\"RegisterDroppable\"] = \"registerDroppable\";\n Action[\"SetDroppableDisabled\"] = \"setDroppableDisabled\";\n Action[\"UnregisterDroppable\"] = \"unregisterDroppable\";\n})(Action || (Action = {}));\n\nfunction noop() {}\n\nfunction useSensor(sensor, options) {\n return useMemo(() => ({\n sensor,\n options: options != null ? options : {}\n }), // eslint-disable-next-line react-hooks/exhaustive-deps\n [sensor, options]);\n}\n\nfunction useSensors() {\n for (var _len = arguments.length, sensors = new Array(_len), _key = 0; _key < _len; _key++) {\n sensors[_key] = arguments[_key];\n }\n\n return useMemo(() => [...sensors].filter(sensor => sensor != null), // eslint-disable-next-line react-hooks/exhaustive-deps\n [...sensors]);\n}\n\nconst defaultCoordinates = /*#__PURE__*/Object.freeze({\n x: 0,\n y: 0\n});\n\n/**\r\n * Returns the distance between two points\r\n */\nfunction distanceBetween(p1, p2) {\n return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));\n}\n\nfunction getRelativeTransformOrigin(event, rect) {\n const eventCoordinates = getEventCoordinates(event);\n\n if (!eventCoordinates) {\n return '0 0';\n }\n\n const transformOrigin = {\n x: (eventCoordinates.x - rect.left) / rect.width * 100,\n y: (eventCoordinates.y - rect.top) / rect.height * 100\n };\n return transformOrigin.x + \"% \" + transformOrigin.y + \"%\";\n}\n\n/**\r\n * Sort collisions from smallest to greatest value\r\n */\nfunction sortCollisionsAsc(_ref, _ref2) {\n let {\n data: {\n value: a\n }\n } = _ref;\n let {\n data: {\n value: b\n }\n } = _ref2;\n return a - b;\n}\n/**\r\n * Sort collisions from greatest to smallest value\r\n */\n\nfunction sortCollisionsDesc(_ref3, _ref4) {\n let {\n data: {\n value: a\n }\n } = _ref3;\n let {\n data: {\n value: b\n }\n } = _ref4;\n return b - a;\n}\n/**\r\n * Returns the coordinates of the corners of a given rectangle:\r\n * [TopLeft {x, y}, TopRight {x, y}, BottomLeft {x, y}, BottomRight {x, y}]\r\n */\n\nfunction cornersOfRectangle(_ref5) {\n let {\n left,\n top,\n height,\n width\n } = _ref5;\n return [{\n x: left,\n y: top\n }, {\n x: left + width,\n y: top\n }, {\n x: left,\n y: top + height\n }, {\n x: left + width,\n y: top + height\n }];\n}\nfunction getFirstCollision(collisions, property) {\n if (!collisions || collisions.length === 0) {\n return null;\n }\n\n const [firstCollision] = collisions;\n return property ? firstCollision[property] : firstCollision;\n}\n\n/**\r\n * Returns the coordinates of the center of a given ClientRect\r\n */\n\nfunction centerOfRectangle(rect, left, top) {\n if (left === void 0) {\n left = rect.left;\n }\n\n if (top === void 0) {\n top = rect.top;\n }\n\n return {\n x: left + rect.width * 0.5,\n y: top + rect.height * 0.5\n };\n}\n/**\r\n * Returns the closest rectangles from an array of rectangles to the center of a given\r\n * rectangle.\r\n */\n\n\nconst closestCenter = _ref => {\n let {\n collisionRect,\n droppableRects,\n droppableContainers\n } = _ref;\n const centerRect = centerOfRectangle(collisionRect, collisionRect.left, collisionRect.top);\n const collisions = [];\n\n for (const droppableContainer of droppableContainers) {\n const {\n id\n } = droppableContainer;\n const rect = droppableRects.get(id);\n\n if (rect) {\n const distBetween = distanceBetween(centerOfRectangle(rect), centerRect);\n collisions.push({\n id,\n data: {\n droppableContainer,\n value: distBetween\n }\n });\n }\n }\n\n return collisions.sort(sortCollisionsAsc);\n};\n\n/**\r\n * Returns the closest rectangles from an array of rectangles to the corners of\r\n * another rectangle.\r\n */\n\nconst closestCorners = _ref => {\n let {\n collisionRect,\n droppableRects,\n droppableContainers\n } = _ref;\n const corners = cornersOfRectangle(collisionRect);\n const collisions = [];\n\n for (const droppableContainer of droppableContainers) {\n const {\n id\n } = droppableContainer;\n const rect = droppableRects.get(id);\n\n if (rect) {\n const rectCorners = cornersOfRectangle(rect);\n const distances = corners.reduce((accumulator, corner, index) => {\n return accumulator + distanceBetween(rectCorners[index], corner);\n }, 0);\n const effectiveDistance = Number((distances / 4).toFixed(4));\n collisions.push({\n id,\n data: {\n droppableContainer,\n value: effectiveDistance\n }\n });\n }\n }\n\n return collisions.sort(sortCollisionsAsc);\n};\n\n/**\r\n * Returns the intersecting rectangle area between two rectangles\r\n */\n\nfunction getIntersectionRatio(entry, target) {\n const top = Math.max(target.top, entry.top);\n const left = Math.max(target.left, entry.left);\n const right = Math.min(target.left + target.width, entry.left + entry.width);\n const bottom = Math.min(target.top + target.height, entry.top + entry.height);\n const width = right - left;\n const height = bottom - top;\n\n if (left < right && top < bottom) {\n const targetArea = target.width * target.height;\n const entryArea = entry.width * entry.height;\n const intersectionArea = width * height;\n const intersectionRatio = intersectionArea / (targetArea + entryArea - intersectionArea);\n return Number(intersectionRatio.toFixed(4));\n } // Rectangles do not overlap, or overlap has an area of zero (edge/corner overlap)\n\n\n return 0;\n}\n/**\r\n * Returns the rectangles that has the greatest intersection area with a given\r\n * rectangle in an array of rectangles.\r\n */\n\nconst rectIntersection = _ref => {\n let {\n collisionRect,\n droppableRects,\n droppableContainers\n } = _ref;\n const collisions = [];\n\n for (const droppableContainer of droppableContainers) {\n const {\n id\n } = droppableContainer;\n const rect = droppableRects.get(id);\n\n if (rect) {\n const intersectionRatio = getIntersectionRatio(rect, collisionRect);\n\n if (intersectionRatio > 0) {\n collisions.push({\n id,\n data: {\n droppableContainer,\n value: intersectionRatio\n }\n });\n }\n }\n }\n\n return collisions.sort(sortCollisionsDesc);\n};\n\n/**\r\n * Check if a given point is contained within a bounding rectangle\r\n */\n\nfunction isPointWithinRect(point, rect) {\n const {\n top,\n left,\n bottom,\n right\n } = rect;\n return top <= point.y && point.y <= bottom && left <= point.x && point.x <= right;\n}\n/**\r\n * Returns the rectangles that the pointer is hovering over\r\n */\n\n\nconst pointerWithin = _ref => {\n let {\n droppableContainers,\n droppableRects,\n pointerCoordinates\n } = _ref;\n\n if (!pointerCoordinates) {\n return [];\n }\n\n const collisions = [];\n\n for (const droppableContainer of droppableContainers) {\n const {\n id\n } = droppableContainer;\n const rect = droppableRects.get(id);\n\n if (rect && isPointWithinRect(pointerCoordinates, rect)) {\n /* There may be more than a single rectangle intersecting\r\n * with the pointer coordinates. In order to sort the\r\n * colliding rectangles, we measure the distance between\r\n * the pointer and the corners of the intersecting rectangle\r\n */\n const corners = cornersOfRectangle(rect);\n const distances = corners.reduce((accumulator, corner) => {\n return accumulator + distanceBetween(pointerCoordinates, corner);\n }, 0);\n const effectiveDistance = Number((distances / 4).toFixed(4));\n collisions.push({\n id,\n data: {\n droppableContainer,\n value: effectiveDistance\n }\n });\n }\n }\n\n return collisions.sort(sortCollisionsAsc);\n};\n\nfunction adjustScale(transform, rect1, rect2) {\n return { ...transform,\n scaleX: rect1 && rect2 ? rect1.width / rect2.width : 1,\n scaleY: rect1 && rect2 ? rect1.height / rect2.height : 1\n };\n}\n\nfunction getRectDelta(rect1, rect2) {\n return rect1 && rect2 ? {\n x: rect1.left - rect2.left,\n y: rect1.top - rect2.top\n } : defaultCoordinates;\n}\n\nfunction createRectAdjustmentFn(modifier) {\n return function adjustClientRect(rect) {\n for (var _len = arguments.length, adjustments = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n adjustments[_key - 1] = arguments[_key];\n }\n\n return adjustments.reduce((acc, adjustment) => ({ ...acc,\n top: acc.top + modifier * adjustment.y,\n bottom: acc.bottom + modifier * adjustment.y,\n left: acc.left + modifier * adjustment.x,\n right: acc.right + modifier * adjustment.x\n }), { ...rect\n });\n };\n}\nconst getAdjustedRect = /*#__PURE__*/createRectAdjustmentFn(1);\n\nfunction parseTransform(transform) {\n if (transform.startsWith('matrix3d(')) {\n const transformArray = transform.slice(9, -1).split(/, /);\n return {\n x: +transformArray[12],\n y: +transformArray[13],\n scaleX: +transformArray[0],\n scaleY: +transformArray[5]\n };\n } else if (transform.startsWith('matrix(')) {\n const transformArray = transform.slice(7, -1).split(/, /);\n return {\n x: +transformArray[4],\n y: +transformArray[5],\n scaleX: +transformArray[0],\n scaleY: +transformArray[3]\n };\n }\n\n return null;\n}\n\nfunction inverseTransform(rect, transform, transformOrigin) {\n const parsedTransform = parseTransform(transform);\n\n if (!parsedTransform) {\n return rect;\n }\n\n const {\n scaleX,\n scaleY,\n x: translateX,\n y: translateY\n } = parsedTransform;\n const x = rect.left - translateX - (1 - scaleX) * parseFloat(transformOrigin);\n const y = rect.top - translateY - (1 - scaleY) * parseFloat(transformOrigin.slice(transformOrigin.indexOf(' ') + 1));\n const w = scaleX ? rect.width / scaleX : rect.width;\n const h = scaleY ? rect.height / scaleY : rect.height;\n return {\n width: w,\n height: h,\n top: y,\n right: x + w,\n bottom: y + h,\n left: x\n };\n}\n\nconst defaultOptions = {\n ignoreTransform: false\n};\n/**\r\n * Returns the bounding client rect of an element relative to the viewport.\r\n */\n\nfunction getClientRect(element, options) {\n if (options === void 0) {\n options = defaultOptions;\n }\n\n let rect = element.getBoundingClientRect();\n\n if (options.ignoreTransform) {\n const {\n transform,\n transformOrigin\n } = getWindow(element).getComputedStyle(element);\n\n if (transform) {\n rect = inverseTransform(rect, transform, transformOrigin);\n }\n }\n\n const {\n top,\n left,\n width,\n height,\n bottom,\n right\n } = rect;\n return {\n top,\n left,\n width,\n height,\n bottom,\n right\n };\n}\n/**\r\n * Returns the bounding client rect of an element relative to the viewport.\r\n *\r\n * @remarks\r\n * The ClientRect returned by this method does not take into account transforms\r\n * applied to the element it measures.\r\n *\r\n */\n\nfunction getTransformAgnosticClientRect(element) {\n return getClientRect(element, {\n ignoreTransform: true\n });\n}\n\nfunction getWindowClientRect(element) {\n const width = element.innerWidth;\n const height = element.innerHeight;\n return {\n top: 0,\n left: 0,\n right: width,\n bottom: height,\n width,\n height\n };\n}\n\nfunction isFixed(node, computedStyle) {\n if (computedStyle === void 0) {\n computedStyle = getWindow(node).getComputedStyle(node);\n }\n\n return computedStyle.position === 'fixed';\n}\n\nfunction isScrollable(element, computedStyle) {\n if (computedStyle === void 0) {\n computedStyle = getWindow(element).getComputedStyle(element);\n }\n\n const overflowRegex = /(auto|scroll|overlay)/;\n const properties = ['overflow', 'overflowX', 'overflowY'];\n return properties.some(property => {\n const value = computedStyle[property];\n return typeof value === 'string' ? overflowRegex.test(value) : false;\n });\n}\n\nfunction getScrollableAncestors(element, limit) {\n const scrollParents = [];\n\n function findScrollableAncestors(node) {\n if (limit != null && scrollParents.length >= limit) {\n return scrollParents;\n }\n\n if (!node) {\n return scrollParents;\n }\n\n if (isDocument(node) && node.scrollingElement != null && !scrollParents.includes(node.scrollingElement)) {\n scrollParents.push(node.scrollingElement);\n return scrollParents;\n }\n\n if (!isHTMLElement(node) || isSVGElement(node)) {\n return scrollParents;\n }\n\n if (scrollParents.includes(node)) {\n return scrollParents;\n }\n\n const computedStyle = getWindow(element).getComputedStyle(node);\n\n if (node !== element) {\n if (isScrollable(node, computedStyle)) {\n scrollParents.push(node);\n }\n }\n\n if (isFixed(node, computedStyle)) {\n return scrollParents;\n }\n\n return findScrollableAncestors(node.parentNode);\n }\n\n if (!element) {\n return scrollParents;\n }\n\n return findScrollableAncestors(element);\n}\nfunction getFirstScrollableAncestor(node) {\n const [firstScrollableAncestor] = getScrollableAncestors(node, 1);\n return firstScrollableAncestor != null ? firstScrollableAncestor : null;\n}\n\nfunction getScrollableElement(element) {\n if (!canUseDOM || !element) {\n return null;\n }\n\n if (isWindow(element)) {\n return element;\n }\n\n if (!isNode(element)) {\n return null;\n }\n\n if (isDocument(element) || element === getOwnerDocument(element).scrollingElement) {\n return window;\n }\n\n if (isHTMLElement(element)) {\n return element;\n }\n\n return null;\n}\n\nfunction getScrollXCoordinate(element) {\n if (isWindow(element)) {\n return element.scrollX;\n }\n\n return element.scrollLeft;\n}\nfunction getScrollYCoordinate(element) {\n if (isWindow(element)) {\n return element.scrollY;\n }\n\n return element.scrollTop;\n}\nfunction getScrollCoordinates(element) {\n return {\n x: getScrollXCoordinate(element),\n y: getScrollYCoordinate(element)\n };\n}\n\nvar Direction;\n\n(function (Direction) {\n Direction[Direction[\"Forward\"] = 1] = \"Forward\";\n Direction[Direction[\"Backward\"] = -1] = \"Backward\";\n})(Direction || (Direction = {}));\n\nfunction isDocumentScrollingElement(element) {\n if (!canUseDOM || !element) {\n return false;\n }\n\n return element === document.scrollingElement;\n}\n\nfunction getScrollPosition(scrollingContainer) {\n const minScroll = {\n x: 0,\n y: 0\n };\n const dimensions = isDocumentScrollingElement(scrollingContainer) ? {\n height: window.innerHeight,\n width: window.innerWidth\n } : {\n height: scrollingContainer.clientHeight,\n width: scrollingContainer.clientWidth\n };\n const maxScroll = {\n x: scrollingContainer.scrollWidth - dimensions.width,\n y: scrollingContainer.scrollHeight - dimensions.height\n };\n const isTop = scrollingContainer.scrollTop <= minScroll.y;\n const isLeft = scrollingContainer.scrollLeft <= minScroll.x;\n const isBottom = scrollingContainer.scrollTop >= maxScroll.y;\n const isRight = scrollingContainer.scrollLeft >= maxScroll.x;\n return {\n isTop,\n isLeft,\n isBottom,\n isRight,\n maxScroll,\n minScroll\n };\n}\n\nconst defaultThreshold = {\n x: 0.2,\n y: 0.2\n};\nfunction getScrollDirectionAndSpeed(scrollContainer, scrollContainerRect, _ref, acceleration, thresholdPercentage) {\n let {\n top,\n left,\n right,\n bottom\n } = _ref;\n\n if (acceleration === void 0) {\n acceleration = 10;\n }\n\n if (thresholdPercentage === void 0) {\n thresholdPercentage = defaultThreshold;\n }\n\n const {\n isTop,\n isBottom,\n isLeft,\n isRight\n } = getScrollPosition(scrollContainer);\n const direction = {\n x: 0,\n y: 0\n };\n const speed = {\n x: 0,\n y: 0\n };\n const threshold = {\n height: scrollContainerRect.height * thresholdPercentage.y,\n width: scrollContainerRect.width * thresholdPercentage.x\n };\n\n if (!isTop && top <= scrollContainerRect.top + threshold.height) {\n // Scroll Up\n direction.y = Direction.Backward;\n speed.y = acceleration * Math.abs((scrollContainerRect.top + threshold.height - top) / threshold.height);\n } else if (!isBottom && bottom >= scrollContainerRect.bottom - threshold.height) {\n // Scroll Down\n direction.y = Direction.Forward;\n speed.y = acceleration * Math.abs((scrollContainerRect.bottom - threshold.height - bottom) / threshold.height);\n }\n\n if (!isRight && right >= scrollContainerRect.right - threshold.width) {\n // Scroll Right\n direction.x = Direction.Forward;\n speed.x = acceleration * Math.abs((scrollContainerRect.right - threshold.width - right) / threshold.width);\n } else if (!isLeft && left <= scrollContainerRect.left + threshold.width) {\n // Scroll Left\n direction.x = Direction.Backward;\n speed.x = acceleration * Math.abs((scrollContainerRect.left + threshold.width - left) / threshold.width);\n }\n\n return {\n direction,\n speed\n };\n}\n\nfunction getScrollElementRect(element) {\n if (element === document.scrollingElement) {\n const {\n innerWidth,\n innerHeight\n } = window;\n return {\n top: 0,\n left: 0,\n right: innerWidth,\n bottom: innerHeight,\n width: innerWidth,\n height: innerHeight\n };\n }\n\n const {\n top,\n left,\n right,\n bottom\n } = element.getBoundingClientRect();\n return {\n top,\n left,\n right,\n bottom,\n width: element.clientWidth,\n height: element.clientHeight\n };\n}\n\nfunction getScrollOffsets(scrollableAncestors) {\n return scrollableAncestors.reduce((acc, node) => {\n return add(acc, getScrollCoordinates(node));\n }, defaultCoordinates);\n}\nfunction getScrollXOffset(scrollableAncestors) {\n return scrollableAncestors.reduce((acc, node) => {\n return acc + getScrollXCoordinate(node);\n }, 0);\n}\nfunction getScrollYOffset(scrollableAncestors) {\n return scrollableAncestors.reduce((acc, node) => {\n return acc + getScrollYCoordinate(node);\n }, 0);\n}\n\nfunction scrollIntoViewIfNeeded(element, measure) {\n if (measure === void 0) {\n measure = getClientRect;\n }\n\n if (!element) {\n return;\n }\n\n const {\n top,\n left,\n bottom,\n right\n } = measure(element);\n const firstScrollableAncestor = getFirstScrollableAncestor(element);\n\n if (!firstScrollableAncestor) {\n return;\n }\n\n if (bottom <= 0 || right <= 0 || top >= window.innerHeight || left >= window.innerWidth) {\n element.scrollIntoView({\n block: 'center',\n inline: 'center'\n });\n }\n}\n\nconst properties = [['x', ['left', 'right'], getScrollXOffset], ['y', ['top', 'bottom'], getScrollYOffset]];\nclass Rect {\n constructor(rect, element) {\n this.rect = void 0;\n this.width = void 0;\n this.height = void 0;\n this.top = void 0;\n this.bottom = void 0;\n this.right = void 0;\n this.left = void 0;\n const scrollableAncestors = getScrollableAncestors(element);\n const scrollOffsets = getScrollOffsets(scrollableAncestors);\n this.rect = { ...rect\n };\n this.width = rect.width;\n this.height = rect.height;\n\n for (const [axis, keys, getScrollOffset] of properties) {\n for (const key of keys) {\n Object.defineProperty(this, key, {\n get: () => {\n const currentOffsets = getScrollOffset(scrollableAncestors);\n const scrollOffsetsDeltla = scrollOffsets[axis] - currentOffsets;\n return this.rect[key] + scrollOffsetsDeltla;\n },\n enumerable: true\n });\n }\n }\n\n Object.defineProperty(this, 'rect', {\n enumerable: false\n });\n }\n\n}\n\nclass Listeners {\n constructor(target) {\n this.target = void 0;\n this.listeners = [];\n\n this.removeAll = () => {\n this.listeners.forEach(listener => {\n var _this$target;\n\n return (_this$target = this.target) == null ? void 0 : _this$target.removeEventListener(...listener);\n });\n };\n\n this.target = target;\n }\n\n add(eventName, handler, options) {\n var _this$target2;\n\n (_this$target2 = this.target) == null ? void 0 : _this$target2.addEventListener(eventName, handler, options);\n this.listeners.push([eventName, handler, options]);\n }\n\n}\n\nfunction getEventListenerTarget(target) {\n // If the `event.target` element is removed from the document events will still be targeted\n // at it, and hence won't always bubble up to the window or document anymore.\n // If there is any risk of an element being removed while it is being dragged,\n // the best practice is to attach the event listeners directly to the target.\n // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget\n const {\n EventTarget\n } = getWindow(target);\n return target instanceof EventTarget ? target : getOwnerDocument(target);\n}\n\nfunction hasExceededDistance(delta, measurement) {\n const dx = Math.abs(delta.x);\n const dy = Math.abs(delta.y);\n\n if (typeof measurement === 'number') {\n return Math.sqrt(dx ** 2 + dy ** 2) > measurement;\n }\n\n if ('x' in measurement && 'y' in measurement) {\n return dx > measurement.x && dy > measurement.y;\n }\n\n if ('x' in measurement) {\n return dx > measurement.x;\n }\n\n if ('y' in measurement) {\n return dy > measurement.y;\n }\n\n return false;\n}\n\nvar EventName;\n\n(function (EventName) {\n EventName[\"Click\"] = \"click\";\n EventName[\"DragStart\"] = \"dragstart\";\n EventName[\"Keydown\"] = \"keydown\";\n EventName[\"ContextMenu\"] = \"contextmenu\";\n EventName[\"Resize\"] = \"resize\";\n EventName[\"SelectionChange\"] = \"selectionchange\";\n EventName[\"VisibilityChange\"] = \"visibilitychange\";\n})(EventName || (EventName = {}));\n\nfunction preventDefault(event) {\n event.preventDefault();\n}\nfunction stopPropagation(event) {\n event.stopPropagation();\n}\n\nvar KeyboardCode;\n\n(function (KeyboardCode) {\n KeyboardCode[\"Space\"] = \"Space\";\n KeyboardCode[\"Down\"] = \"ArrowDown\";\n KeyboardCode[\"Right\"] = \"ArrowRight\";\n KeyboardCode[\"Left\"] = \"ArrowLeft\";\n KeyboardCode[\"Up\"] = \"ArrowUp\";\n KeyboardCode[\"Esc\"] = \"Escape\";\n KeyboardCode[\"Enter\"] = \"Enter\";\n})(KeyboardCode || (KeyboardCode = {}));\n\nconst defaultKeyboardCodes = {\n start: [KeyboardCode.Space, KeyboardCode.Enter],\n cancel: [KeyboardCode.Esc],\n end: [KeyboardCode.Space, KeyboardCode.Enter]\n};\nconst defaultKeyboardCoordinateGetter = (event, _ref) => {\n let {\n currentCoordinates\n } = _ref;\n\n switch (event.code) {\n case KeyboardCode.Right:\n return { ...currentCoordinates,\n x: currentCoordinates.x + 25\n };\n\n case KeyboardCode.Left:\n return { ...currentCoordinates,\n x: currentCoordinates.x - 25\n };\n\n case KeyboardCode.Down:\n return { ...currentCoordinates,\n y: currentCoordinates.y + 25\n };\n\n case KeyboardCode.Up:\n return { ...currentCoordinates,\n y: currentCoordinates.y - 25\n };\n }\n\n return undefined;\n};\n\nclass KeyboardSensor {\n constructor(props) {\n this.props = void 0;\n this.autoScrollEnabled = false;\n this.referenceCoordinates = void 0;\n this.listeners = void 0;\n this.windowListeners = void 0;\n this.props = props;\n const {\n event: {\n target\n }\n } = props;\n this.props = props;\n this.listeners = new Listeners(getOwnerDocument(target));\n this.windowListeners = new Listeners(getWindow(target));\n this.handleKeyDown = this.handleKeyDown.bind(this);\n this.handleCancel = this.handleCancel.bind(this);\n this.attach();\n }\n\n attach() {\n this.handleStart();\n this.windowListeners.add(EventName.Resize, this.handleCancel);\n this.windowListeners.add(EventName.VisibilityChange, this.handleCancel);\n setTimeout(() => this.listeners.add(EventName.Keydown, this.handleKeyDown));\n }\n\n handleStart() {\n const {\n activeNode,\n onStart\n } = this.props;\n const node = activeNode.node.current;\n\n if (node) {\n scrollIntoViewIfNeeded(node);\n }\n\n onStart(defaultCoordinates);\n }\n\n handleKeyDown(event) {\n if (isKeyboardEvent(event)) {\n const {\n active,\n context,\n options\n } = this.props;\n const {\n keyboardCodes = defaultKeyboardCodes,\n coordinateGetter = defaultKeyboardCoordinateGetter,\n scrollBehavior = 'smooth'\n } = options;\n const {\n code\n } = event;\n\n if (keyboardCodes.end.includes(code)) {\n this.handleEnd(event);\n return;\n }\n\n if (keyboardCodes.cancel.includes(code)) {\n this.handleCancel(event);\n return;\n }\n\n const {\n collisionRect\n } = context.current;\n const currentCoordinates = collisionRect ? {\n x: collisionRect.left,\n y: collisionRect.top\n } : defaultCoordinates;\n\n if (!this.referenceCoordinates) {\n this.referenceCoordinates = currentCoordinates;\n }\n\n const newCoordinates = coordinateGetter(event, {\n active,\n context: context.current,\n currentCoordinates\n });\n\n if (newCoordinates) {\n const coordinatesDelta = subtract(newCoordinates, currentCoordinates);\n const scrollDelta = {\n x: 0,\n y: 0\n };\n const {\n scrollableAncestors\n } = context.current;\n\n for (const scrollContainer of scrollableAncestors) {\n const direction = event.code;\n const {\n isTop,\n isRight,\n isLeft,\n isBottom,\n maxScroll,\n minScroll\n } = getScrollPosition(scrollContainer);\n const scrollElementRect = getScrollElementRect(scrollContainer);\n const clampedCoordinates = {\n x: Math.min(direction === KeyboardCode.Right ? scrollElementRect.right - scrollElementRect.width / 2 : scrollElementRect.right, Math.max(direction === KeyboardCode.Right ? scrollElementRect.left : scrollElementRect.left + scrollElementRect.width / 2, newCoordinates.x)),\n y: Math.min(direction === KeyboardCode.Down ? scrollElementRect.bottom - scrollElementRect.height / 2 : scrollElementRect.bottom, Math.max(direction === KeyboardCode.Down ? scrollElementRect.top : scrollElementRect.top + scrollElementRect.height / 2, newCoordinates.y))\n };\n const canScrollX = direction === KeyboardCode.Right && !isRight || direction === KeyboardCode.Left && !isLeft;\n const canScrollY = direction === KeyboardCode.Down && !isBottom || direction === KeyboardCode.Up && !isTop;\n\n if (canScrollX && clampedCoordinates.x !== newCoordinates.x) {\n const newScrollCoordinates = scrollContainer.scrollLeft + coordinatesDelta.x;\n const canScrollToNewCoordinates = direction === KeyboardCode.Right && newScrollCoordinates <= maxScroll.x || direction === KeyboardCode.Left && newScrollCoordinates >= minScroll.x;\n\n if (canScrollToNewCoordinates && !coordinatesDelta.y) {\n // We don't need to update coordinates, the scroll adjustment alone will trigger\n // logic to auto-detect the new container we are over\n scrollContainer.scrollTo({\n left: newScrollCoordinates,\n behavior: scrollBehavior\n });\n return;\n }\n\n if (canScrollToNewCoordinates) {\n scrollDelta.x = scrollContainer.scrollLeft - newScrollCoordinates;\n } else {\n scrollDelta.x = direction === KeyboardCode.Right ? scrollContainer.scrollLeft - maxScroll.x : scrollContainer.scrollLeft - minScroll.x;\n }\n\n if (scrollDelta.x) {\n scrollContainer.scrollBy({\n left: -scrollDelta.x,\n behavior: scrollBehavior\n });\n }\n\n break;\n } else if (canScrollY && clampedCoordinates.y !== newCoordinates.y) {\n const newScrollCoordinates = scrollContainer.scrollTop + coordinatesDelta.y;\n const canScrollToNewCoordinates = direction === KeyboardCode.Down && newScrollCoordinates <= maxScroll.y || direction === KeyboardCode.Up && newScrollCoordinates >= minScroll.y;\n\n if (canScrollToNewCoordinates && !coordinatesDelta.x) {\n // We don't need to update coordinates, the scroll adjustment alone will trigger\n // logic to auto-detect the new container we are over\n scrollContainer.scrollTo({\n top: newScrollCoordinates,\n behavior: scrollBehavior\n });\n return;\n }\n\n if (canScrollToNewCoordinates) {\n scrollDelta.y = scrollContainer.scrollTop - newScrollCoordinates;\n } else {\n scrollDelta.y = direction === KeyboardCode.Down ? scrollContainer.scrollTop - maxScroll.y : scrollContainer.scrollTop - minScroll.y;\n }\n\n if (scrollDelta.y) {\n scrollContainer.scrollBy({\n top: -scrollDelta.y,\n behavior: scrollBehavior\n });\n }\n\n break;\n }\n }\n\n this.handleMove(event, add(subtract(newCoordinates, this.referenceCoordinates), scrollDelta));\n }\n }\n }\n\n handleMove(event, coordinates) {\n const {\n onMove\n } = this.props;\n event.preventDefault();\n onMove(coordinates);\n }\n\n handleEnd(event) {\n const {\n onEnd\n } = this.props;\n event.preventDefault();\n this.detach();\n onEnd();\n }\n\n handleCancel(event) {\n const {\n onCancel\n } = this.props;\n event.preventDefault();\n this.detach();\n onCancel();\n }\n\n detach() {\n this.listeners.removeAll();\n this.windowListeners.removeAll();\n }\n\n}\nKeyboardSensor.activators = [{\n eventName: 'onKeyDown',\n handler: (event, _ref, _ref2) => {\n let {\n keyboardCodes = defaultKeyboardCodes,\n onActivation\n } = _ref;\n let {\n active\n } = _ref2;\n const {\n code\n } = event.nativeEvent;\n\n if (keyboardCodes.start.includes(code)) {\n const activator = active.activatorNode.current;\n\n if (activator && event.target !== activator) {\n return false;\n }\n\n event.preventDefault();\n onActivation == null ? void 0 : onActivation({\n event: event.nativeEvent\n });\n return true;\n }\n\n return false;\n }\n}];\n\nfunction isDistanceConstraint(constraint) {\n return Boolean(constraint && 'distance' in constraint);\n}\n\nfunction isDelayConstraint(constraint) {\n return Boolean(constraint && 'delay' in constraint);\n}\n\nclass AbstractPointerSensor {\n constructor(props, events, listenerTarget) {\n var _getEventCoordinates;\n\n if (listenerTarget === void 0) {\n listenerTarget = getEventListenerTarget(props.event.target);\n }\n\n this.props = void 0;\n this.events = void 0;\n this.autoScrollEnabled = true;\n this.document = void 0;\n this.activated = false;\n this.initialCoordinates = void 0;\n this.timeoutId = null;\n this.listeners = void 0;\n this.documentListeners = void 0;\n this.windowListeners = void 0;\n this.props = props;\n this.events = events;\n const {\n event\n } = props;\n const {\n target\n } = event;\n this.props = props;\n this.events = events;\n this.document = getOwnerDocument(target);\n this.documentListeners = new Listeners(this.document);\n this.listeners = new Listeners(listenerTarget);\n this.windowListeners = new Listeners(getWindow(target));\n this.initialCoordinates = (_getEventCoordinates = getEventCoordinates(event)) != null ? _getEventCoordinates : defaultCoordinates;\n this.handleStart = this.handleStart.bind(this);\n this.handleMove = this.handleMove.bind(this);\n this.handleEnd = this.handleEnd.bind(this);\n this.handleCancel = this.handleCancel.bind(this);\n this.handleKeydown = this.handleKeydown.bind(this);\n this.removeTextSelection = this.removeTextSelection.bind(this);\n this.attach();\n }\n\n attach() {\n const {\n events,\n props: {\n options: {\n activationConstraint,\n bypassActivationConstraint\n }\n }\n } = this;\n this.listeners.add(events.move.name, this.handleMove, {\n passive: false\n });\n this.listeners.add(events.end.name, this.handleEnd);\n this.windowListeners.add(EventName.Resize, this.handleCancel);\n this.windowListeners.add(EventName.DragStart, preventDefault);\n this.windowListeners.add(EventName.VisibilityChange, this.handleCancel);\n this.windowListeners.add(EventName.ContextMenu, preventDefault);\n this.documentListeners.add(EventName.Keydown, this.handleKeydown);\n\n if (activationConstraint) {\n if (bypassActivationConstraint != null && bypassActivationConstraint({\n event: this.props.event,\n activeNode: this.props.activeNode,\n options: this.props.options\n })) {\n return this.handleStart();\n }\n\n if (isDelayConstraint(activationConstraint)) {\n this.timeoutId = setTimeout(this.handleStart, activationConstraint.delay);\n return;\n }\n\n if (isDistanceConstraint(activationConstraint)) {\n return;\n }\n }\n\n this.handleStart();\n }\n\n detach() {\n this.listeners.removeAll();\n this.windowListeners.removeAll(); // Wait until the next event loop before removing document listeners\n // This is necessary because we listen for `click` and `selection` events on the document\n\n setTimeout(this.documentListeners.removeAll, 50);\n\n if (this.timeoutId !== null) {\n clearTimeout(this.timeoutId);\n this.timeoutId = null;\n }\n }\n\n handleStart() {\n const {\n initialCoordinates\n } = this;\n const {\n onStart\n } = this.props;\n\n if (initialCoordinates) {\n this.activated = true; // Stop propagation of click events once activation constraints are met\n\n this.documentListeners.add(EventName.Click, stopPropagation, {\n capture: true\n }); // Remove any text selection from the document\n\n this.removeTextSelection(); // Prevent further text selection while dragging\n\n this.documentListeners.add(EventName.SelectionChange, this.removeTextSelection);\n onStart(initialCoordinates);\n }\n }\n\n handleMove(event) {\n var _getEventCoordinates2;\n\n const {\n activated,\n initialCoordinates,\n props\n } = this;\n const {\n onMove,\n options: {\n activationConstraint\n }\n } = props;\n\n if (!initialCoordinates) {\n return;\n }\n\n const coordinates = (_getEventCoordinates2 = getEventCoordinates(event)) != null ? _getEventCoordinates2 : defaultCoordinates;\n const delta = subtract(initialCoordinates, coordinates); // Constraint validation\n\n if (!activated && activationConstraint) {\n if (isDistanceConstraint(activationConstraint)) {\n if (activationConstraint.tolerance != null && hasExceededDistance(delta, activationConstraint.tolerance)) {\n return this.handleCancel();\n }\n\n if (hasExceededDistance(delta, activationConstraint.distance)) {\n return this.handleStart();\n }\n }\n\n if (isDelayConstraint(activationConstraint)) {\n if (hasExceededDistance(delta, activationConstraint.tolerance)) {\n return this.handleCancel();\n }\n }\n\n return;\n }\n\n if (event.cancelable) {\n event.preventDefault();\n }\n\n onMove(coordinates);\n }\n\n handleEnd() {\n const {\n onEnd\n } = this.props;\n this.detach();\n onEnd();\n }\n\n handleCancel() {\n const {\n onCancel\n } = this.props;\n this.detach();\n onCancel();\n }\n\n handleKeydown(event) {\n if (event.code === KeyboardCode.Esc) {\n this.handleCancel();\n }\n }\n\n removeTextSelection() {\n var _this$document$getSel;\n\n (_this$document$getSel = this.document.getSelection()) == null ? void 0 : _this$document$getSel.removeAllRanges();\n }\n\n}\n\nconst events = {\n move: {\n name: 'pointermove'\n },\n end: {\n name: 'pointerup'\n }\n};\nclass PointerSensor extends AbstractPointerSensor {\n constructor(props) {\n const {\n event\n } = props; // Pointer events stop firing if the target is unmounted while dragging\n // Therefore we attach listeners to the owner document instead\n\n const listenerTarget = getOwnerDocument(event.target);\n super(props, events, listenerTarget);\n }\n\n}\nPointerSensor.activators = [{\n eventName: 'onPointerDown',\n handler: (_ref, _ref2) => {\n let {\n nativeEvent: event\n } = _ref;\n let {\n onActivation\n } = _ref2;\n\n if (!event.isPrimary || event.button !== 0) {\n return false;\n }\n\n onActivation == null ? void 0 : onActivation({\n event\n });\n return true;\n }\n}];\n\nconst events$1 = {\n move: {\n name: 'mousemove'\n },\n end: {\n name: 'mouseup'\n }\n};\nvar MouseButton;\n\n(function (MouseButton) {\n MouseButton[MouseButton[\"RightClick\"] = 2] = \"RightClick\";\n})(MouseButton || (MouseButton = {}));\n\nclass MouseSensor extends AbstractPointerSensor {\n constructor(props) {\n super(props, events$1, getOwnerDocument(props.event.target));\n }\n\n}\nMouseSensor.activators = [{\n eventName: 'onMouseDown',\n handler: (_ref, _ref2) => {\n let {\n nativeEvent: event\n } = _ref;\n let {\n onActivation\n } = _ref2;\n\n if (event.button === MouseButton.RightClick) {\n return false;\n }\n\n onActivation == null ? void 0 : onActivation({\n event\n });\n return true;\n }\n}];\n\nconst events$2 = {\n move: {\n name: 'touchmove'\n },\n end: {\n name: 'touchend'\n }\n};\nclass TouchSensor extends AbstractPointerSensor {\n constructor(props) {\n super(props, events$2);\n }\n\n static setup() {\n // Adding a non-capture and non-passive `touchmove` listener in order\n // to force `event.preventDefault()` calls to work in dynamically added\n // touchmove event handlers. This is required for iOS Safari.\n window.addEventListener(events$2.move.name, noop, {\n capture: false,\n passive: false\n });\n return function teardown() {\n window.removeEventListener(events$2.move.name, noop);\n }; // We create a new handler because the teardown function of another sensor\n // could remove our event listener if we use a referentially equal listener.\n\n function noop() {}\n }\n\n}\nTouchSensor.activators = [{\n eventName: 'onTouchStart',\n handler: (_ref, _ref2) => {\n let {\n nativeEvent: event\n } = _ref;\n let {\n onActivation\n } = _ref2;\n const {\n touches\n } = event;\n\n if (touches.length > 1) {\n return false;\n }\n\n onActivation == null ? void 0 : onActivation({\n event\n });\n return true;\n }\n}];\n\nvar AutoScrollActivator;\n\n(function (AutoScrollActivator) {\n AutoScrollActivator[AutoScrollActivator[\"Pointer\"] = 0] = \"Pointer\";\n AutoScrollActivator[AutoScrollActivator[\"DraggableRect\"] = 1] = \"DraggableRect\";\n})(AutoScrollActivator || (AutoScrollActivator = {}));\n\nvar TraversalOrder;\n\n(function (TraversalOrder) {\n TraversalOrder[TraversalOrder[\"TreeOrder\"] = 0] = \"TreeOrder\";\n TraversalOrder[TraversalOrder[\"ReversedTreeOrder\"] = 1] = \"ReversedTreeOrder\";\n})(TraversalOrder || (TraversalOrder = {}));\n\nfunction useAutoScroller(_ref) {\n let {\n acceleration,\n activator = AutoScrollActivator.Pointer,\n canScroll,\n draggingRect,\n enabled,\n interval = 5,\n order = TraversalOrder.TreeOrder,\n pointerCoordinates,\n scrollableAncestors,\n scrollableAncestorRects,\n delta,\n threshold\n } = _ref;\n const scrollIntent = useScrollIntent({\n delta,\n disabled: !enabled\n });\n const [setAutoScrollInterval, clearAutoScrollInterval] = useInterval();\n const scrollSpeed = useRef({\n x: 0,\n y: 0\n });\n const scrollDirection = useRef({\n x: 0,\n y: 0\n });\n const rect = useMemo(() => {\n switch (activator) {\n case AutoScrollActivator.Pointer:\n return pointerCoordinates ? {\n top: pointerCoordinates.y,\n bottom: pointerCoordinates.y,\n left: pointerCoordinates.x,\n right: pointerCoordinates.x\n } : null;\n\n case AutoScrollActivator.DraggableRect:\n return draggingRect;\n }\n }, [activator, draggingRect, pointerCoordinates]);\n const scrollContainerRef = useRef(null);\n const autoScroll = useCallback(() => {\n const scrollContainer = scrollContainerRef.current;\n\n if (!scrollContainer) {\n return;\n }\n\n const scrollLeft = scrollSpeed.current.x * scrollDirection.current.x;\n const scrollTop = scrollSpeed.current.y * scrollDirection.current.y;\n scrollContainer.scrollBy(scrollLeft, scrollTop);\n }, []);\n const sortedScrollableAncestors = useMemo(() => order === TraversalOrder.TreeOrder ? [...scrollableAncestors].reverse() : scrollableAncestors, [order, scrollableAncestors]);\n useEffect(() => {\n if (!enabled || !scrollableAncestors.length || !rect) {\n clearAutoScrollInterval();\n return;\n }\n\n for (const scrollContainer of sortedScrollableAncestors) {\n if ((canScroll == null ? void 0 : canScroll(scrollContainer)) === false) {\n continue;\n }\n\n const index = scrollableAncestors.indexOf(scrollContainer);\n const scrollContainerRect = scrollableAncestorRects[index];\n\n if (!scrollContainerRect) {\n continue;\n }\n\n const {\n direction,\n speed\n } = getScrollDirectionAndSpeed(scrollContainer, scrollContainerRect, rect, acceleration, threshold);\n\n for (const axis of ['x', 'y']) {\n if (!scrollIntent[axis][direction[axis]]) {\n speed[axis] = 0;\n direction[axis] = 0;\n }\n }\n\n if (speed.x > 0 || speed.y > 0) {\n clearAutoScrollInterval();\n scrollContainerRef.current = scrollContainer;\n setAutoScrollInterval(autoScroll, interval);\n scrollSpeed.current = speed;\n scrollDirection.current = direction;\n return;\n }\n }\n\n scrollSpeed.current = {\n x: 0,\n y: 0\n };\n scrollDirection.current = {\n x: 0,\n y: 0\n };\n clearAutoScrollInterval();\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [acceleration, autoScroll, canScroll, clearAutoScrollInterval, enabled, interval, // eslint-disable-next-line react-hooks/exhaustive-deps\n JSON.stringify(rect), // eslint-disable-next-line react-hooks/exhaustive-deps\n JSON.stringify(scrollIntent), setAutoScrollInterval, scrollableAncestors, sortedScrollableAncestors, scrollableAncestorRects, // eslint-disable-next-line react-hooks/exhaustive-deps\n JSON.stringify(threshold)]);\n}\nconst defaultScrollIntent = {\n x: {\n [Direction.Backward]: false,\n [Direction.Forward]: false\n },\n y: {\n [Direction.Backward]: false,\n [Direction.Forward]: false\n }\n};\n\nfunction useScrollIntent(_ref2) {\n let {\n delta,\n disabled\n } = _ref2;\n const previousDelta = usePrevious(delta);\n return useLazyMemo(previousIntent => {\n if (disabled || !previousDelta || !previousIntent) {\n // Reset scroll intent tracking when auto-scrolling is disabled\n return defaultScrollIntent;\n }\n\n const direction = {\n x: Math.sign(delta.x - previousDelta.x),\n y: Math.sign(delta.y - previousDelta.y)\n }; // Keep track of the user intent to scroll in each direction for both axis\n\n return {\n x: {\n [Direction.Backward]: previousIntent.x[Direction.Backward] || direction.x === -1,\n [Direction.Forward]: previousIntent.x[Direction.Forward] || direction.x === 1\n },\n y: {\n [Direction.Backward]: previousIntent.y[Direction.Backward] || direction.y === -1,\n [Direction.Forward]: previousIntent.y[Direction.Forward] || direction.y === 1\n }\n };\n }, [disabled, delta, previousDelta]);\n}\n\nfunction useCachedNode(draggableNodes, id) {\n const draggableNode = id !== null ? draggableNodes.get(id) : undefined;\n const node = draggableNode ? draggableNode.node.current : null;\n return useLazyMemo(cachedNode => {\n var _ref;\n\n if (id === null) {\n return null;\n } // In some cases, the draggable node can unmount while dragging\n // This is the case for virtualized lists. In those situations,\n // we fall back to the last known value for that node.\n\n\n return (_ref = node != null ? node : cachedNode) != null ? _ref : null;\n }, [node, id]);\n}\n\nfunction useCombineActivators(sensors, getSyntheticHandler) {\n return useMemo(() => sensors.reduce((accumulator, sensor) => {\n const {\n sensor: Sensor\n } = sensor;\n const sensorActivators = Sensor.activators.map(activator => ({\n eventName: activator.eventName,\n handler: getSyntheticHandler(activator.handler, sensor)\n }));\n return [...accumulator, ...sensorActivators];\n }, []), [sensors, getSyntheticHandler]);\n}\n\nvar MeasuringStrategy;\n\n(function (MeasuringStrategy) {\n MeasuringStrategy[MeasuringStrategy[\"Always\"] = 0] = \"Always\";\n MeasuringStrategy[MeasuringStrategy[\"BeforeDragging\"] = 1] = \"BeforeDragging\";\n MeasuringStrategy[MeasuringStrategy[\"WhileDragging\"] = 2] = \"WhileDragging\";\n})(MeasuringStrategy || (MeasuringStrategy = {}));\n\nvar MeasuringFrequency;\n\n(function (MeasuringFrequency) {\n MeasuringFrequency[\"Optimized\"] = \"optimized\";\n})(MeasuringFrequency || (MeasuringFrequency = {}));\n\nconst defaultValue = /*#__PURE__*/new Map();\nfunction useDroppableMeasuring(containers, _ref) {\n let {\n dragging,\n dependencies,\n config\n } = _ref;\n const [queue, setQueue] = useState(null);\n const {\n frequency,\n measure,\n strategy\n } = config;\n const containersRef = useRef(containers);\n const disabled = isDisabled();\n const disabledRef = useLatestValue(disabled);\n const measureDroppableContainers = useCallback(function (ids) {\n if (ids === void 0) {\n ids = [];\n }\n\n if (disabledRef.current) {\n return;\n }\n\n setQueue(value => {\n if (value === null) {\n return ids;\n }\n\n return value.concat(ids.filter(id => !value.includes(id)));\n });\n }, [disabledRef]);\n const timeoutId = useRef(null);\n const droppableRects = useLazyMemo(previousValue => {\n if (disabled && !dragging) {\n return defaultValue;\n }\n\n if (!previousValue || previousValue === defaultValue || containersRef.current !== containers || queue != null) {\n const map = new Map();\n\n for (let container of containers) {\n if (!container) {\n continue;\n }\n\n if (queue && queue.length > 0 && !queue.includes(container.id) && container.rect.current) {\n // This container does not need to be re-measured\n map.set(container.id, container.rect.current);\n continue;\n }\n\n const node = container.node.current;\n const rect = node ? new Rect(measure(node), node) : null;\n container.rect.current = rect;\n\n if (rect) {\n map.set(container.id, rect);\n }\n }\n\n return map;\n }\n\n return previousValue;\n }, [containers, queue, dragging, disabled, measure]);\n useEffect(() => {\n containersRef.current = containers;\n }, [containers]);\n useEffect(() => {\n if (disabled) {\n return;\n }\n\n measureDroppableContainers();\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [dragging, disabled]);\n useEffect(() => {\n if (queue && queue.length > 0) {\n setQueue(null);\n }\n }, //eslint-disable-next-line react-hooks/exhaustive-deps\n [JSON.stringify(queue)]);\n useEffect(() => {\n if (disabled || typeof frequency !== 'number' || timeoutId.current !== null) {\n return;\n }\n\n timeoutId.current = setTimeout(() => {\n measureDroppableContainers();\n timeoutId.current = null;\n }, frequency);\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [frequency, disabled, measureDroppableContainers, ...dependencies]);\n return {\n droppableRects,\n measureDroppableContainers,\n measuringScheduled: queue != null\n };\n\n function isDisabled() {\n switch (strategy) {\n case MeasuringStrategy.Always:\n return false;\n\n case MeasuringStrategy.BeforeDragging:\n return dragging;\n\n default:\n return !dragging;\n }\n }\n}\n\nfunction useInitialValue(value, computeFn) {\n return useLazyMemo(previousValue => {\n if (!value) {\n return null;\n }\n\n if (previousValue) {\n return previousValue;\n }\n\n return typeof computeFn === 'function' ? computeFn(value) : value;\n }, [computeFn, value]);\n}\n\nfunction useInitialRect(node, measure) {\n return useInitialValue(node, measure);\n}\n\n/**\r\n * Returns a new MutationObserver instance.\r\n * If `MutationObserver` is undefined in the execution environment, returns `undefined`.\r\n */\n\nfunction useMutationObserver(_ref) {\n let {\n callback,\n disabled\n } = _ref;\n const handleMutations = useEvent(callback);\n const mutationObserver = useMemo(() => {\n if (disabled || typeof window === 'undefined' || typeof window.MutationObserver === 'undefined') {\n return undefined;\n }\n\n const {\n MutationObserver\n } = window;\n return new MutationObserver(handleMutations);\n }, [handleMutations, disabled]);\n useEffect(() => {\n return () => mutationObserver == null ? void 0 : mutationObserver.disconnect();\n }, [mutationObserver]);\n return mutationObserver;\n}\n\n/**\r\n * Returns a new ResizeObserver instance bound to the `onResize` callback.\r\n * If `ResizeObserver` is undefined in the execution environment, returns `undefined`.\r\n */\n\nfunction useResizeObserver(_ref) {\n let {\n callback,\n disabled\n } = _ref;\n const handleResize = useEvent(callback);\n const resizeObserver = useMemo(() => {\n if (disabled || typeof window === 'undefined' || typeof window.ResizeObserver === 'undefined') {\n return undefined;\n }\n\n const {\n ResizeObserver\n } = window;\n return new ResizeObserver(handleResize);\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [disabled]);\n useEffect(() => {\n return () => resizeObserver == null ? void 0 : resizeObserver.disconnect();\n }, [resizeObserver]);\n return resizeObserver;\n}\n\nfunction defaultMeasure(element) {\n return new Rect(getClientRect(element), element);\n}\n\nfunction useRect(element, measure, fallbackRect) {\n if (measure === void 0) {\n measure = defaultMeasure;\n }\n\n const [rect, measureRect] = useReducer(reducer, null);\n const mutationObserver = useMutationObserver({\n callback(records) {\n if (!element) {\n return;\n }\n\n for (const record of records) {\n const {\n type,\n target\n } = record;\n\n if (type === 'childList' && target instanceof HTMLElement && target.contains(element)) {\n measureRect();\n break;\n }\n }\n }\n\n });\n const resizeObserver = useResizeObserver({\n callback: measureRect\n });\n useIsomorphicLayoutEffect(() => {\n measureRect();\n\n if (element) {\n resizeObserver == null ? void 0 : resizeObserver.observe(element);\n mutationObserver == null ? void 0 : mutationObserver.observe(document.body, {\n childList: true,\n subtree: true\n });\n } else {\n resizeObserver == null ? void 0 : resizeObserver.disconnect();\n mutationObserver == null ? void 0 : mutationObserver.disconnect();\n }\n }, [element]);\n return rect;\n\n function reducer(currentRect) {\n if (!element) {\n return null;\n }\n\n if (element.isConnected === false) {\n var _ref;\n\n // Fall back to last rect we measured if the element is\n // no longer connected to the DOM.\n return (_ref = currentRect != null ? currentRect : fallbackRect) != null ? _ref : null;\n }\n\n const newRect = measure(element);\n\n if (JSON.stringify(currentRect) === JSON.stringify(newRect)) {\n return currentRect;\n }\n\n return newRect;\n }\n}\n\nfunction useRectDelta(rect) {\n const initialRect = useInitialValue(rect);\n return getRectDelta(rect, initialRect);\n}\n\nconst defaultValue$1 = [];\nfunction useScrollableAncestors(node) {\n const previousNode = useRef(node);\n const ancestors = useLazyMemo(previousValue => {\n if (!node) {\n return defaultValue$1;\n }\n\n if (previousValue && previousValue !== defaultValue$1 && node && previousNode.current && node.parentNode === previousNode.current.parentNode) {\n return previousValue;\n }\n\n return getScrollableAncestors(node);\n }, [node]);\n useEffect(() => {\n previousNode.current = node;\n }, [node]);\n return ancestors;\n}\n\nfunction useScrollOffsets(elements) {\n const [scrollCoordinates, setScrollCoordinates] = useState(null);\n const prevElements = useRef(elements); // To-do: Throttle the handleScroll callback\n\n const handleScroll = useCallback(event => {\n const scrollingElement = getScrollableElement(event.target);\n\n if (!scrollingElement) {\n return;\n }\n\n setScrollCoordinates(scrollCoordinates => {\n if (!scrollCoordinates) {\n return null;\n }\n\n scrollCoordinates.set(scrollingElement, getScrollCoordinates(scrollingElement));\n return new Map(scrollCoordinates);\n });\n }, []);\n useEffect(() => {\n const previousElements = prevElements.current;\n\n if (elements !== previousElements) {\n cleanup(previousElements);\n const entries = elements.map(element => {\n const scrollableElement = getScrollableElement(element);\n\n if (scrollableElement) {\n scrollableElement.addEventListener('scroll', handleScroll, {\n passive: true\n });\n return [scrollableElement, getScrollCoordinates(scrollableElement)];\n }\n\n return null;\n }).filter(entry => entry != null);\n setScrollCoordinates(entries.length ? new Map(entries) : null);\n prevElements.current = elements;\n }\n\n return () => {\n cleanup(elements);\n cleanup(previousElements);\n };\n\n function cleanup(elements) {\n elements.forEach(element => {\n const scrollableElement = getScrollableElement(element);\n scrollableElement == null ? void 0 : scrollableElement.removeEventListener('scroll', handleScroll);\n });\n }\n }, [handleScroll, elements]);\n return useMemo(() => {\n if (elements.length) {\n return scrollCoordinates ? Array.from(scrollCoordinates.values()).reduce((acc, coordinates) => add(acc, coordinates), defaultCoordinates) : getScrollOffsets(elements);\n }\n\n return defaultCoordinates;\n }, [elements, scrollCoordinates]);\n}\n\nfunction useScrollOffsetsDelta(scrollOffsets, dependencies) {\n if (dependencies === void 0) {\n dependencies = [];\n }\n\n const initialScrollOffsets = useRef(null);\n useEffect(() => {\n initialScrollOffsets.current = null;\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n dependencies);\n useEffect(() => {\n const hasScrollOffsets = scrollOffsets !== defaultCoordinates;\n\n if (hasScrollOffsets && !initialScrollOffsets.current) {\n initialScrollOffsets.current = scrollOffsets;\n }\n\n if (!hasScrollOffsets && initialScrollOffsets.current) {\n initialScrollOffsets.current = null;\n }\n }, [scrollOffsets]);\n return initialScrollOffsets.current ? subtract(scrollOffsets, initialScrollOffsets.current) : defaultCoordinates;\n}\n\nfunction useSensorSetup(sensors) {\n useEffect(() => {\n if (!canUseDOM) {\n return;\n }\n\n const teardownFns = sensors.map(_ref => {\n let {\n sensor\n } = _ref;\n return sensor.setup == null ? void 0 : sensor.setup();\n });\n return () => {\n for (const teardown of teardownFns) {\n teardown == null ? void 0 : teardown();\n }\n };\n }, // TO-DO: Sensors length could theoretically change which would not be a valid dependency\n // eslint-disable-next-line react-hooks/exhaustive-deps\n sensors.map(_ref2 => {\n let {\n sensor\n } = _ref2;\n return sensor;\n }));\n}\n\nfunction useSyntheticListeners(listeners, id) {\n return useMemo(() => {\n return listeners.reduce((acc, _ref) => {\n let {\n eventName,\n handler\n } = _ref;\n\n acc[eventName] = event => {\n handler(event, id);\n };\n\n return acc;\n }, {});\n }, [listeners, id]);\n}\n\nfunction useWindowRect(element) {\n return useMemo(() => element ? getWindowClientRect(element) : null, [element]);\n}\n\nconst defaultValue$2 = [];\nfunction useRects(elements, measure) {\n if (measure === void 0) {\n measure = getClientRect;\n }\n\n const [firstElement] = elements;\n const windowRect = useWindowRect(firstElement ? getWindow(firstElement) : null);\n const [rects, measureRects] = useReducer(reducer, defaultValue$2);\n const resizeObserver = useResizeObserver({\n callback: measureRects\n });\n\n if (elements.length > 0 && rects === defaultValue$2) {\n measureRects();\n }\n\n useIsomorphicLayoutEffect(() => {\n if (elements.length) {\n elements.forEach(element => resizeObserver == null ? void 0 : resizeObserver.observe(element));\n } else {\n resizeObserver == null ? void 0 : resizeObserver.disconnect();\n measureRects();\n }\n }, [elements]);\n return rects;\n\n function reducer() {\n if (!elements.length) {\n return defaultValue$2;\n }\n\n return elements.map(element => isDocumentScrollingElement(element) ? windowRect : new Rect(measure(element), element));\n }\n}\n\nfunction getMeasurableNode(node) {\n if (!node) {\n return null;\n }\n\n if (node.children.length > 1) {\n return node;\n }\n\n const firstChild = node.children[0];\n return isHTMLElement(firstChild) ? firstChild : node;\n}\n\nfunction useDragOverlayMeasuring(_ref) {\n let {\n measure\n } = _ref;\n const [rect, setRect] = useState(null);\n const handleResize = useCallback(entries => {\n for (const {\n target\n } of entries) {\n if (isHTMLElement(target)) {\n setRect(rect => {\n const newRect = measure(target);\n return rect ? { ...rect,\n width: newRect.width,\n height: newRect.height\n } : newRect;\n });\n break;\n }\n }\n }, [measure]);\n const resizeObserver = useResizeObserver({\n callback: handleResize\n });\n const handleNodeChange = useCallback(element => {\n const node = getMeasurableNode(element);\n resizeObserver == null ? void 0 : resizeObserver.disconnect();\n\n if (node) {\n resizeObserver == null ? void 0 : resizeObserver.observe(node);\n }\n\n setRect(node ? measure(node) : null);\n }, [measure, resizeObserver]);\n const [nodeRef, setRef] = useNodeRef(handleNodeChange);\n return useMemo(() => ({\n nodeRef,\n rect,\n setRef\n }), [rect, nodeRef, setRef]);\n}\n\nconst defaultSensors = [{\n sensor: PointerSensor,\n options: {}\n}, {\n sensor: KeyboardSensor,\n options: {}\n}];\nconst defaultData = {\n current: {}\n};\nconst defaultMeasuringConfiguration = {\n draggable: {\n measure: getTransformAgnosticClientRect\n },\n droppable: {\n measure: getTransformAgnosticClientRect,\n strategy: MeasuringStrategy.WhileDragging,\n frequency: MeasuringFrequency.Optimized\n },\n dragOverlay: {\n measure: getClientRect\n }\n};\n\nclass DroppableContainersMap extends Map {\n get(id) {\n var _super$get;\n\n return id != null ? (_super$get = super.get(id)) != null ? _super$get : undefined : undefined;\n }\n\n toArray() {\n return Array.from(this.values());\n }\n\n getEnabled() {\n return this.toArray().filter(_ref => {\n let {\n disabled\n } = _ref;\n return !disabled;\n });\n }\n\n getNodeFor(id) {\n var _this$get$node$curren, _this$get;\n\n return (_this$get$node$curren = (_this$get = this.get(id)) == null ? void 0 : _this$get.node.current) != null ? _this$get$node$curren : undefined;\n }\n\n}\n\nconst defaultPublicContext = {\n activatorEvent: null,\n active: null,\n activeNode: null,\n activeNodeRect: null,\n collisions: null,\n containerNodeRect: null,\n draggableNodes: /*#__PURE__*/new Map(),\n droppableRects: /*#__PURE__*/new Map(),\n droppableContainers: /*#__PURE__*/new DroppableContainersMap(),\n over: null,\n dragOverlay: {\n nodeRef: {\n current: null\n },\n rect: null,\n setRef: noop\n },\n scrollableAncestors: [],\n scrollableAncestorRects: [],\n measuringConfiguration: defaultMeasuringConfiguration,\n measureDroppableContainers: noop,\n windowRect: null,\n measuringScheduled: false\n};\nconst defaultInternalContext = {\n activatorEvent: null,\n activators: [],\n active: null,\n activeNodeRect: null,\n ariaDescribedById: {\n draggable: ''\n },\n dispatch: noop,\n draggableNodes: /*#__PURE__*/new Map(),\n over: null,\n measureDroppableContainers: noop\n};\nconst InternalContext = /*#__PURE__*/createContext(defaultInternalContext);\nconst PublicContext = /*#__PURE__*/createContext(defaultPublicContext);\n\nfunction getInitialState() {\n return {\n draggable: {\n active: null,\n initialCoordinates: {\n x: 0,\n y: 0\n },\n nodes: new Map(),\n translate: {\n x: 0,\n y: 0\n }\n },\n droppable: {\n containers: new DroppableContainersMap()\n }\n };\n}\nfunction reducer(state, action) {\n switch (action.type) {\n case Action.DragStart:\n return { ...state,\n draggable: { ...state.draggable,\n initialCoordinates: action.initialCoordinates,\n active: action.active\n }\n };\n\n case Action.DragMove:\n if (!state.draggable.active) {\n return state;\n }\n\n return { ...state,\n draggable: { ...state.draggable,\n translate: {\n x: action.coordinates.x - state.draggable.initialCoordinates.x,\n y: action.coordinates.y - state.draggable.initialCoordinates.y\n }\n }\n };\n\n case Action.DragEnd:\n case Action.DragCancel:\n return { ...state,\n draggable: { ...state.draggable,\n active: null,\n initialCoordinates: {\n x: 0,\n y: 0\n },\n translate: {\n x: 0,\n y: 0\n }\n }\n };\n\n case Action.RegisterDroppable:\n {\n const {\n element\n } = action;\n const {\n id\n } = element;\n const containers = new DroppableContainersMap(state.droppable.containers);\n containers.set(id, element);\n return { ...state,\n droppable: { ...state.droppable,\n containers\n }\n };\n }\n\n case Action.SetDroppableDisabled:\n {\n const {\n id,\n key,\n disabled\n } = action;\n const element = state.droppable.containers.get(id);\n\n if (!element || key !== element.key) {\n return state;\n }\n\n const containers = new DroppableContainersMap(state.droppable.containers);\n containers.set(id, { ...element,\n disabled\n });\n return { ...state,\n droppable: { ...state.droppable,\n containers\n }\n };\n }\n\n case Action.UnregisterDroppable:\n {\n const {\n id,\n key\n } = action;\n const element = state.droppable.containers.get(id);\n\n if (!element || key !== element.key) {\n return state;\n }\n\n const containers = new DroppableContainersMap(state.droppable.containers);\n containers.delete(id);\n return { ...state,\n droppable: { ...state.droppable,\n containers\n }\n };\n }\n\n default:\n {\n return state;\n }\n }\n}\n\nfunction RestoreFocus(_ref) {\n let {\n disabled\n } = _ref;\n const {\n active,\n activatorEvent,\n draggableNodes\n } = useContext(InternalContext);\n const previousActivatorEvent = usePrevious(activatorEvent);\n const previousActiveId = usePrevious(active == null ? void 0 : active.id); // Restore keyboard focus on the activator node\n\n useEffect(() => {\n if (disabled) {\n return;\n }\n\n if (!activatorEvent && previousActivatorEvent && previousActiveId != null) {\n if (!isKeyboardEvent(previousActivatorEvent)) {\n return;\n }\n\n if (document.activeElement === previousActivatorEvent.target) {\n // No need to restore focus\n return;\n }\n\n const draggableNode = draggableNodes.get(previousActiveId);\n\n if (!draggableNode) {\n return;\n }\n\n const {\n activatorNode,\n node\n } = draggableNode;\n\n if (!activatorNode.current && !node.current) {\n return;\n }\n\n requestAnimationFrame(() => {\n for (const element of [activatorNode.current, node.current]) {\n if (!element) {\n continue;\n }\n\n const focusableNode = findFirstFocusableNode(element);\n\n if (focusableNode) {\n focusableNode.focus();\n break;\n }\n }\n });\n }\n }, [activatorEvent, disabled, draggableNodes, previousActiveId, previousActivatorEvent]);\n return null;\n}\n\nfunction applyModifiers(modifiers, _ref) {\n let {\n transform,\n ...args\n } = _ref;\n return modifiers != null && modifiers.length ? modifiers.reduce((accumulator, modifier) => {\n return modifier({\n transform: accumulator,\n ...args\n });\n }, transform) : transform;\n}\n\nfunction useMeasuringConfiguration(config) {\n return useMemo(() => ({\n draggable: { ...defaultMeasuringConfiguration.draggable,\n ...(config == null ? void 0 : config.draggable)\n },\n droppable: { ...defaultMeasuringConfiguration.droppable,\n ...(config == null ? void 0 : config.droppable)\n },\n dragOverlay: { ...defaultMeasuringConfiguration.dragOverlay,\n ...(config == null ? void 0 : config.dragOverlay)\n }\n }), // eslint-disable-next-line react-hooks/exhaustive-deps\n [config == null ? void 0 : config.draggable, config == null ? void 0 : config.droppable, config == null ? void 0 : config.dragOverlay]);\n}\n\nfunction useLayoutShiftScrollCompensation(_ref) {\n let {\n activeNode,\n measure,\n initialRect,\n config = true\n } = _ref;\n const initialized = useRef(false);\n const {\n x,\n y\n } = typeof config === 'boolean' ? {\n x: config,\n y: config\n } : config;\n useIsomorphicLayoutEffect(() => {\n const disabled = !x && !y;\n\n if (disabled || !activeNode) {\n initialized.current = false;\n return;\n }\n\n if (initialized.current || !initialRect) {\n // Return early if layout shift scroll compensation was already attempted\n // or if there is no initialRect to compare to.\n return;\n } // Get the most up to date node ref for the active draggable\n\n\n const node = activeNode == null ? void 0 : activeNode.node.current;\n\n if (!node || node.isConnected === false) {\n // Return early if there is no attached node ref or if the node is\n // disconnected from the document.\n return;\n }\n\n const rect = measure(node);\n const rectDelta = getRectDelta(rect, initialRect);\n\n if (!x) {\n rectDelta.x = 0;\n }\n\n if (!y) {\n rectDelta.y = 0;\n } // Only perform layout shift scroll compensation once\n\n\n initialized.current = true;\n\n if (Math.abs(rectDelta.x) > 0 || Math.abs(rectDelta.y) > 0) {\n const firstScrollableAncestor = getFirstScrollableAncestor(node);\n\n if (firstScrollableAncestor) {\n firstScrollableAncestor.scrollBy({\n top: rectDelta.y,\n left: rectDelta.x\n });\n }\n }\n }, [activeNode, x, y, initialRect, measure]);\n}\n\nconst ActiveDraggableContext = /*#__PURE__*/createContext({ ...defaultCoordinates,\n scaleX: 1,\n scaleY: 1\n});\nvar Status;\n\n(function (Status) {\n Status[Status[\"Uninitialized\"] = 0] = \"Uninitialized\";\n Status[Status[\"Initializing\"] = 1] = \"Initializing\";\n Status[Status[\"Initialized\"] = 2] = \"Initialized\";\n})(Status || (Status = {}));\n\nconst DndContext = /*#__PURE__*/memo(function DndContext(_ref) {\n var _sensorContext$curren, _dragOverlay$nodeRef$, _dragOverlay$rect, _over$rect;\n\n let {\n id,\n accessibility,\n autoScroll = true,\n children,\n sensors = defaultSensors,\n collisionDetection = rectIntersection,\n measuring,\n modifiers,\n ...props\n } = _ref;\n const store = useReducer(reducer, undefined, getInitialState);\n const [state, dispatch] = store;\n const [dispatchMonitorEvent, registerMonitorListener] = useDndMonitorProvider();\n const [status, setStatus] = useState(Status.Uninitialized);\n const isInitialized = status === Status.Initialized;\n const {\n draggable: {\n active: activeId,\n nodes: draggableNodes,\n translate\n },\n droppable: {\n containers: droppableContainers\n }\n } = state;\n const node = activeId ? draggableNodes.get(activeId) : null;\n const activeRects = useRef({\n initial: null,\n translated: null\n });\n const active = useMemo(() => {\n var _node$data;\n\n return activeId != null ? {\n id: activeId,\n // It's possible for the active node to unmount while dragging\n data: (_node$data = node == null ? void 0 : node.data) != null ? _node$data : defaultData,\n rect: activeRects\n } : null;\n }, [activeId, node]);\n const activeRef = useRef(null);\n const [activeSensor, setActiveSensor] = useState(null);\n const [activatorEvent, setActivatorEvent] = useState(null);\n const latestProps = useLatestValue(props, Object.values(props));\n const draggableDescribedById = useUniqueId(\"DndDescribedBy\", id);\n const enabledDroppableContainers = useMemo(() => droppableContainers.getEnabled(), [droppableContainers]);\n const measuringConfiguration = useMeasuringConfiguration(measuring);\n const {\n droppableRects,\n measureDroppableContainers,\n measuringScheduled\n } = useDroppableMeasuring(enabledDroppableContainers, {\n dragging: isInitialized,\n dependencies: [translate.x, translate.y],\n config: measuringConfiguration.droppable\n });\n const activeNode = useCachedNode(draggableNodes, activeId);\n const activationCoordinates = useMemo(() => activatorEvent ? getEventCoordinates(activatorEvent) : null, [activatorEvent]);\n const autoScrollOptions = getAutoScrollerOptions();\n const initialActiveNodeRect = useInitialRect(activeNode, measuringConfiguration.draggable.measure);\n useLayoutShiftScrollCompensation({\n activeNode: activeId ? draggableNodes.get(activeId) : null,\n config: autoScrollOptions.layoutShiftCompensation,\n initialRect: initialActiveNodeRect,\n measure: measuringConfiguration.draggable.measure\n });\n const activeNodeRect = useRect(activeNode, measuringConfiguration.draggable.measure, initialActiveNodeRect);\n const containerNodeRect = useRect(activeNode ? activeNode.parentElement : null);\n const sensorContext = useRef({\n activatorEvent: null,\n active: null,\n activeNode,\n collisionRect: null,\n collisions: null,\n droppableRects,\n draggableNodes,\n draggingNode: null,\n draggingNodeRect: null,\n droppableContainers,\n over: null,\n scrollableAncestors: [],\n scrollAdjustedTranslate: null\n });\n const overNode = droppableContainers.getNodeFor((_sensorContext$curren = sensorContext.current.over) == null ? void 0 : _sensorContext$curren.id);\n const dragOverlay = useDragOverlayMeasuring({\n measure: measuringConfiguration.dragOverlay.measure\n }); // Use the rect of the drag overlay if it is mounted\n\n const draggingNode = (_dragOverlay$nodeRef$ = dragOverlay.nodeRef.current) != null ? _dragOverlay$nodeRef$ : activeNode;\n const draggingNodeRect = isInitialized ? (_dragOverlay$rect = dragOverlay.rect) != null ? _dragOverlay$rect : activeNodeRect : null;\n const usesDragOverlay = Boolean(dragOverlay.nodeRef.current && dragOverlay.rect); // The delta between the previous and new position of the draggable node\n // is only relevant when there is no drag overlay\n\n const nodeRectDelta = useRectDelta(usesDragOverlay ? null : activeNodeRect); // Get the window rect of the dragging node\n\n const windowRect = useWindowRect(draggingNode ? getWindow(draggingNode) : null); // Get scrollable ancestors of the dragging node\n\n const scrollableAncestors = useScrollableAncestors(isInitialized ? overNode != null ? overNode : activeNode : null);\n const scrollableAncestorRects = useRects(scrollableAncestors); // Apply modifiers\n\n const modifiedTranslate = applyModifiers(modifiers, {\n transform: {\n x: translate.x - nodeRectDelta.x,\n y: translate.y - nodeRectDelta.y,\n scaleX: 1,\n scaleY: 1\n },\n activatorEvent,\n active,\n activeNodeRect,\n containerNodeRect,\n draggingNodeRect,\n over: sensorContext.current.over,\n overlayNodeRect: dragOverlay.rect,\n scrollableAncestors,\n scrollableAncestorRects,\n windowRect\n });\n const pointerCoordinates = activationCoordinates ? add(activationCoordinates, translate) : null;\n const scrollOffsets = useScrollOffsets(scrollableAncestors); // Represents the scroll delta since dragging was initiated\n\n const scrollAdjustment = useScrollOffsetsDelta(scrollOffsets); // Represents the scroll delta since the last time the active node rect was measured\n\n const activeNodeScrollDelta = useScrollOffsetsDelta(scrollOffsets, [activeNodeRect]);\n const scrollAdjustedTranslate = add(modifiedTranslate, scrollAdjustment);\n const collisionRect = draggingNodeRect ? getAdjustedRect(draggingNodeRect, modifiedTranslate) : null;\n const collisions = active && collisionRect ? collisionDetection({\n active,\n collisionRect,\n droppableRects,\n droppableContainers: enabledDroppableContainers,\n pointerCoordinates\n }) : null;\n const overId = getFirstCollision(collisions, 'id');\n const [over, setOver] = useState(null); // When there is no drag overlay used, we need to account for the\n // window scroll delta\n\n const appliedTranslate = usesDragOverlay ? modifiedTranslate : add(modifiedTranslate, activeNodeScrollDelta);\n const transform = adjustScale(appliedTranslate, (_over$rect = over == null ? void 0 : over.rect) != null ? _over$rect : null, activeNodeRect);\n const instantiateSensor = useCallback((event, _ref2) => {\n let {\n sensor: Sensor,\n options\n } = _ref2;\n\n if (activeRef.current == null) {\n return;\n }\n\n const activeNode = draggableNodes.get(activeRef.current);\n\n if (!activeNode) {\n return;\n }\n\n const activatorEvent = event.nativeEvent;\n const sensorInstance = new Sensor({\n active: activeRef.current,\n activeNode,\n event: activatorEvent,\n options,\n // Sensors need to be instantiated with refs for arguments that change over time\n // otherwise they are frozen in time with the stale arguments\n context: sensorContext,\n\n onStart(initialCoordinates) {\n const id = activeRef.current;\n\n if (id == null) {\n return;\n }\n\n const draggableNode = draggableNodes.get(id);\n\n if (!draggableNode) {\n return;\n }\n\n const {\n onDragStart\n } = latestProps.current;\n const event = {\n active: {\n id,\n data: draggableNode.data,\n rect: activeRects\n }\n };\n unstable_batchedUpdates(() => {\n onDragStart == null ? void 0 : onDragStart(event);\n setStatus(Status.Initializing);\n dispatch({\n type: Action.DragStart,\n initialCoordinates,\n active: id\n });\n dispatchMonitorEvent({\n type: 'onDragStart',\n event\n });\n });\n },\n\n onMove(coordinates) {\n dispatch({\n type: Action.DragMove,\n coordinates\n });\n },\n\n onEnd: createHandler(Action.DragEnd),\n onCancel: createHandler(Action.DragCancel)\n });\n unstable_batchedUpdates(() => {\n setActiveSensor(sensorInstance);\n setActivatorEvent(event.nativeEvent);\n });\n\n function createHandler(type) {\n return async function handler() {\n const {\n active,\n collisions,\n over,\n scrollAdjustedTranslate\n } = sensorContext.current;\n let event = null;\n\n if (active && scrollAdjustedTranslate) {\n const {\n cancelDrop\n } = latestProps.current;\n event = {\n activatorEvent,\n active: active,\n collisions,\n delta: scrollAdjustedTranslate,\n over\n };\n\n if (type === Action.DragEnd && typeof cancelDrop === 'function') {\n const shouldCancel = await Promise.resolve(cancelDrop(event));\n\n if (shouldCancel) {\n type = Action.DragCancel;\n }\n }\n }\n\n activeRef.current = null;\n unstable_batchedUpdates(() => {\n dispatch({\n type\n });\n setStatus(Status.Uninitialized);\n setOver(null);\n setActiveSensor(null);\n setActivatorEvent(null);\n const eventName = type === Action.DragEnd ? 'onDragEnd' : 'onDragCancel';\n\n if (event) {\n const handler = latestProps.current[eventName];\n handler == null ? void 0 : handler(event);\n dispatchMonitorEvent({\n type: eventName,\n event\n });\n }\n });\n };\n }\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [draggableNodes]);\n const bindActivatorToSensorInstantiator = useCallback((handler, sensor) => {\n return (event, active) => {\n const nativeEvent = event.nativeEvent;\n const activeDraggableNode = draggableNodes.get(active);\n\n if ( // Another sensor is already instantiating\n activeRef.current !== null || // No active draggable\n !activeDraggableNode || // Event has already been captured\n nativeEvent.dndKit || nativeEvent.defaultPrevented) {\n return;\n }\n\n const activationContext = {\n active: activeDraggableNode\n };\n const shouldActivate = handler(event, sensor.options, activationContext);\n\n if (shouldActivate === true) {\n nativeEvent.dndKit = {\n capturedBy: sensor.sensor\n };\n activeRef.current = active;\n instantiateSensor(event, sensor);\n }\n };\n }, [draggableNodes, instantiateSensor]);\n const activators = useCombineActivators(sensors, bindActivatorToSensorInstantiator);\n useSensorSetup(sensors);\n useIsomorphicLayoutEffect(() => {\n if (activeNodeRect && status === Status.Initializing) {\n setStatus(Status.Initialized);\n }\n }, [activeNodeRect, status]);\n useEffect(() => {\n const {\n onDragMove\n } = latestProps.current;\n const {\n active,\n activatorEvent,\n collisions,\n over\n } = sensorContext.current;\n\n if (!active || !activatorEvent) {\n return;\n }\n\n const event = {\n active,\n activatorEvent,\n collisions,\n delta: {\n x: scrollAdjustedTranslate.x,\n y: scrollAdjustedTranslate.y\n },\n over\n };\n unstable_batchedUpdates(() => {\n onDragMove == null ? void 0 : onDragMove(event);\n dispatchMonitorEvent({\n type: 'onDragMove',\n event\n });\n });\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [scrollAdjustedTranslate.x, scrollAdjustedTranslate.y]);\n useEffect(() => {\n const {\n active,\n activatorEvent,\n collisions,\n droppableContainers,\n scrollAdjustedTranslate\n } = sensorContext.current;\n\n if (!active || activeRef.current == null || !activatorEvent || !scrollAdjustedTranslate) {\n return;\n }\n\n const {\n onDragOver\n } = latestProps.current;\n const overContainer = droppableContainers.get(overId);\n const over = overContainer && overContainer.rect.current ? {\n id: overContainer.id,\n rect: overContainer.rect.current,\n data: overContainer.data,\n disabled: overContainer.disabled\n } : null;\n const event = {\n active,\n activatorEvent,\n collisions,\n delta: {\n x: scrollAdjustedTranslate.x,\n y: scrollAdjustedTranslate.y\n },\n over\n };\n unstable_batchedUpdates(() => {\n setOver(over);\n onDragOver == null ? void 0 : onDragOver(event);\n dispatchMonitorEvent({\n type: 'onDragOver',\n event\n });\n });\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [overId]);\n useIsomorphicLayoutEffect(() => {\n sensorContext.current = {\n activatorEvent,\n active,\n activeNode,\n collisionRect,\n collisions,\n droppableRects,\n draggableNodes,\n draggingNode,\n draggingNodeRect,\n droppableContainers,\n over,\n scrollableAncestors,\n scrollAdjustedTranslate\n };\n activeRects.current = {\n initial: draggingNodeRect,\n translated: collisionRect\n };\n }, [active, activeNode, collisions, collisionRect, draggableNodes, draggingNode, draggingNodeRect, droppableRects, droppableContainers, over, scrollableAncestors, scrollAdjustedTranslate]);\n useAutoScroller({ ...autoScrollOptions,\n delta: translate,\n draggingRect: collisionRect,\n pointerCoordinates,\n scrollableAncestors,\n scrollableAncestorRects\n });\n const publicContext = useMemo(() => {\n const context = {\n active,\n activeNode,\n activeNodeRect,\n activatorEvent,\n collisions,\n containerNodeRect,\n dragOverlay,\n draggableNodes,\n droppableContainers,\n droppableRects,\n over,\n measureDroppableContainers,\n scrollableAncestors,\n scrollableAncestorRects,\n measuringConfiguration,\n measuringScheduled,\n windowRect\n };\n return context;\n }, [active, activeNode, activeNodeRect, activatorEvent, collisions, containerNodeRect, dragOverlay, draggableNodes, droppableContainers, droppableRects, over, measureDroppableContainers, scrollableAncestors, scrollableAncestorRects, measuringConfiguration, measuringScheduled, windowRect]);\n const internalContext = useMemo(() => {\n const context = {\n activatorEvent,\n activators,\n active,\n activeNodeRect,\n ariaDescribedById: {\n draggable: draggableDescribedById\n },\n dispatch,\n draggableNodes,\n over,\n measureDroppableContainers\n };\n return context;\n }, [activatorEvent, activators, active, activeNodeRect, dispatch, draggableDescribedById, draggableNodes, over, measureDroppableContainers]);\n return React.createElement(DndMonitorContext.Provider, {\n value: registerMonitorListener\n }, React.createElement(InternalContext.Provider, {\n value: internalContext\n }, React.createElement(PublicContext.Provider, {\n value: publicContext\n }, React.createElement(ActiveDraggableContext.Provider, {\n value: transform\n }, children)), React.createElement(RestoreFocus, {\n disabled: (accessibility == null ? void 0 : accessibility.restoreFocus) === false\n })), React.createElement(Accessibility, { ...accessibility,\n hiddenTextDescribedById: draggableDescribedById\n }));\n\n function getAutoScrollerOptions() {\n const activeSensorDisablesAutoscroll = (activeSensor == null ? void 0 : activeSensor.autoScrollEnabled) === false;\n const autoScrollGloballyDisabled = typeof autoScroll === 'object' ? autoScroll.enabled === false : autoScroll === false;\n const enabled = isInitialized && !activeSensorDisablesAutoscroll && !autoScrollGloballyDisabled;\n\n if (typeof autoScroll === 'object') {\n return { ...autoScroll,\n enabled\n };\n }\n\n return {\n enabled\n };\n }\n});\n\nconst NullContext = /*#__PURE__*/createContext(null);\nconst defaultRole = 'button';\nconst ID_PREFIX = 'Droppable';\nfunction useDraggable(_ref) {\n let {\n id,\n data,\n disabled = false,\n attributes\n } = _ref;\n const key = useUniqueId(ID_PREFIX);\n const {\n activators,\n activatorEvent,\n active,\n activeNodeRect,\n ariaDescribedById,\n draggableNodes,\n over\n } = useContext(InternalContext);\n const {\n role = defaultRole,\n roleDescription = 'draggable',\n tabIndex = 0\n } = attributes != null ? attributes : {};\n const isDragging = (active == null ? void 0 : active.id) === id;\n const transform = useContext(isDragging ? ActiveDraggableContext : NullContext);\n const [node, setNodeRef] = useNodeRef();\n const [activatorNode, setActivatorNodeRef] = useNodeRef();\n const listeners = useSyntheticListeners(activators, id);\n const dataRef = useLatestValue(data);\n useIsomorphicLayoutEffect(() => {\n draggableNodes.set(id, {\n id,\n key,\n node,\n activatorNode,\n data: dataRef\n });\n return () => {\n const node = draggableNodes.get(id);\n\n if (node && node.key === key) {\n draggableNodes.delete(id);\n }\n };\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [draggableNodes, id]);\n const memoizedAttributes = useMemo(() => ({\n role,\n tabIndex,\n 'aria-disabled': disabled,\n 'aria-pressed': isDragging && role === defaultRole ? true : undefined,\n 'aria-roledescription': roleDescription,\n 'aria-describedby': ariaDescribedById.draggable\n }), [disabled, role, tabIndex, isDragging, roleDescription, ariaDescribedById.draggable]);\n return {\n active,\n activatorEvent,\n activeNodeRect,\n attributes: memoizedAttributes,\n isDragging,\n listeners: disabled ? undefined : listeners,\n node,\n over,\n setNodeRef,\n setActivatorNodeRef,\n transform\n };\n}\n\nfunction useDndContext() {\n return useContext(PublicContext);\n}\n\nconst ID_PREFIX$1 = 'Droppable';\nconst defaultResizeObserverConfig = {\n timeout: 25\n};\nfunction useDroppable(_ref) {\n let {\n data,\n disabled = false,\n id,\n resizeObserverConfig\n } = _ref;\n const key = useUniqueId(ID_PREFIX$1);\n const {\n active,\n dispatch,\n over,\n measureDroppableContainers\n } = useContext(InternalContext);\n const previous = useRef({\n disabled\n });\n const resizeObserverConnected = useRef(false);\n const rect = useRef(null);\n const callbackId = useRef(null);\n const {\n disabled: resizeObserverDisabled,\n updateMeasurementsFor,\n timeout: resizeObserverTimeout\n } = { ...defaultResizeObserverConfig,\n ...resizeObserverConfig\n };\n const ids = useLatestValue(updateMeasurementsFor != null ? updateMeasurementsFor : id);\n const handleResize = useCallback(() => {\n if (!resizeObserverConnected.current) {\n // ResizeObserver invokes the `handleResize` callback as soon as `observe` is called,\n // assuming the element is rendered and displayed.\n resizeObserverConnected.current = true;\n return;\n }\n\n if (callbackId.current != null) {\n clearTimeout(callbackId.current);\n }\n\n callbackId.current = setTimeout(() => {\n measureDroppableContainers(Array.isArray(ids.current) ? ids.current : [ids.current]);\n callbackId.current = null;\n }, resizeObserverTimeout);\n }, //eslint-disable-next-line react-hooks/exhaustive-deps\n [resizeObserverTimeout]);\n const resizeObserver = useResizeObserver({\n callback: handleResize,\n disabled: resizeObserverDisabled || !active\n });\n const handleNodeChange = useCallback((newElement, previousElement) => {\n if (!resizeObserver) {\n return;\n }\n\n if (previousElement) {\n resizeObserver.unobserve(previousElement);\n resizeObserverConnected.current = false;\n }\n\n if (newElement) {\n resizeObserver.observe(newElement);\n }\n }, [resizeObserver]);\n const [nodeRef, setNodeRef] = useNodeRef(handleNodeChange);\n const dataRef = useLatestValue(data);\n useEffect(() => {\n if (!resizeObserver || !nodeRef.current) {\n return;\n }\n\n resizeObserver.disconnect();\n resizeObserverConnected.current = false;\n resizeObserver.observe(nodeRef.current);\n }, [nodeRef, resizeObserver]);\n useIsomorphicLayoutEffect(() => {\n dispatch({\n type: Action.RegisterDroppable,\n element: {\n id,\n key,\n disabled,\n node: nodeRef,\n rect,\n data: dataRef\n }\n });\n return () => dispatch({\n type: Action.UnregisterDroppable,\n key,\n id\n });\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [id]);\n useEffect(() => {\n if (disabled !== previous.current.disabled) {\n dispatch({\n type: Action.SetDroppableDisabled,\n id,\n key,\n disabled\n });\n previous.current.disabled = disabled;\n }\n }, [id, key, disabled, dispatch]);\n return {\n active,\n rect,\n isOver: (over == null ? void 0 : over.id) === id,\n node: nodeRef,\n over,\n setNodeRef\n };\n}\n\nfunction AnimationManager(_ref) {\n let {\n animation,\n children\n } = _ref;\n const [clonedChildren, setClonedChildren] = useState(null);\n const [element, setElement] = useState(null);\n const previousChildren = usePrevious(children);\n\n if (!children && !clonedChildren && previousChildren) {\n setClonedChildren(previousChildren);\n }\n\n useIsomorphicLayoutEffect(() => {\n if (!element) {\n return;\n }\n\n const key = clonedChildren == null ? void 0 : clonedChildren.key;\n const id = clonedChildren == null ? void 0 : clonedChildren.props.id;\n\n if (key == null || id == null) {\n setClonedChildren(null);\n return;\n }\n\n Promise.resolve(animation(id, element)).then(() => {\n setClonedChildren(null);\n });\n }, [animation, clonedChildren, element]);\n return React.createElement(React.Fragment, null, children, clonedChildren ? cloneElement(clonedChildren, {\n ref: setElement\n }) : null);\n}\n\nconst defaultTransform = {\n x: 0,\n y: 0,\n scaleX: 1,\n scaleY: 1\n};\nfunction NullifiedContextProvider(_ref) {\n let {\n children\n } = _ref;\n return React.createElement(InternalContext.Provider, {\n value: defaultInternalContext\n }, React.createElement(ActiveDraggableContext.Provider, {\n value: defaultTransform\n }, children));\n}\n\nconst baseStyles = {\n position: 'fixed',\n touchAction: 'none'\n};\n\nconst defaultTransition = activatorEvent => {\n const isKeyboardActivator = isKeyboardEvent(activatorEvent);\n return isKeyboardActivator ? 'transform 250ms ease' : undefined;\n};\n\nconst PositionedOverlay = /*#__PURE__*/forwardRef((_ref, ref) => {\n let {\n as,\n activatorEvent,\n adjustScale,\n children,\n className,\n rect,\n style,\n transform,\n transition = defaultTransition\n } = _ref;\n\n if (!rect) {\n return null;\n }\n\n const scaleAdjustedTransform = adjustScale ? transform : { ...transform,\n scaleX: 1,\n scaleY: 1\n };\n const styles = { ...baseStyles,\n width: rect.width,\n height: rect.height,\n top: rect.top,\n left: rect.left,\n transform: CSS.Transform.toString(scaleAdjustedTransform),\n transformOrigin: adjustScale && activatorEvent ? getRelativeTransformOrigin(activatorEvent, rect) : undefined,\n transition: typeof transition === 'function' ? transition(activatorEvent) : transition,\n ...style\n };\n return React.createElement(as, {\n className,\n style: styles,\n ref\n }, children);\n});\n\nconst defaultDropAnimationSideEffects = options => _ref => {\n let {\n active,\n dragOverlay\n } = _ref;\n const originalStyles = {};\n const {\n styles,\n className\n } = options;\n\n if (styles != null && styles.active) {\n for (const [key, value] of Object.entries(styles.active)) {\n if (value === undefined) {\n continue;\n }\n\n originalStyles[key] = active.node.style.getPropertyValue(key);\n active.node.style.setProperty(key, value);\n }\n }\n\n if (styles != null && styles.dragOverlay) {\n for (const [key, value] of Object.entries(styles.dragOverlay)) {\n if (value === undefined) {\n continue;\n }\n\n dragOverlay.node.style.setProperty(key, value);\n }\n }\n\n if (className != null && className.active) {\n active.node.classList.add(className.active);\n }\n\n if (className != null && className.dragOverlay) {\n dragOverlay.node.classList.add(className.dragOverlay);\n }\n\n return function cleanup() {\n for (const [key, value] of Object.entries(originalStyles)) {\n active.node.style.setProperty(key, value);\n }\n\n if (className != null && className.active) {\n active.node.classList.remove(className.active);\n }\n };\n};\n\nconst defaultKeyframeResolver = _ref2 => {\n let {\n transform: {\n initial,\n final\n }\n } = _ref2;\n return [{\n transform: CSS.Transform.toString(initial)\n }, {\n transform: CSS.Transform.toString(final)\n }];\n};\n\nconst defaultDropAnimationConfiguration = {\n duration: 250,\n easing: 'ease',\n keyframes: defaultKeyframeResolver,\n sideEffects: /*#__PURE__*/defaultDropAnimationSideEffects({\n styles: {\n active: {\n opacity: '0'\n }\n }\n })\n};\nfunction useDropAnimation(_ref3) {\n let {\n config,\n draggableNodes,\n droppableContainers,\n measuringConfiguration\n } = _ref3;\n return useEvent((id, node) => {\n if (config === null) {\n return;\n }\n\n const activeDraggable = draggableNodes.get(id);\n\n if (!activeDraggable) {\n return;\n }\n\n const activeNode = activeDraggable.node.current;\n\n if (!activeNode) {\n return;\n }\n\n const measurableNode = getMeasurableNode(node);\n\n if (!measurableNode) {\n return;\n }\n\n const {\n transform\n } = getWindow(node).getComputedStyle(node);\n const parsedTransform = parseTransform(transform);\n\n if (!parsedTransform) {\n return;\n }\n\n const animation = typeof config === 'function' ? config : createDefaultDropAnimation(config);\n scrollIntoViewIfNeeded(activeNode, measuringConfiguration.draggable.measure);\n return animation({\n active: {\n id,\n data: activeDraggable.data,\n node: activeNode,\n rect: measuringConfiguration.draggable.measure(activeNode)\n },\n draggableNodes,\n dragOverlay: {\n node,\n rect: measuringConfiguration.dragOverlay.measure(measurableNode)\n },\n droppableContainers,\n measuringConfiguration,\n transform: parsedTransform\n });\n });\n}\n\nfunction createDefaultDropAnimation(options) {\n const {\n duration,\n easing,\n sideEffects,\n keyframes\n } = { ...defaultDropAnimationConfiguration,\n ...options\n };\n return _ref4 => {\n let {\n active,\n dragOverlay,\n transform,\n ...rest\n } = _ref4;\n\n if (!duration) {\n // Do not animate if animation duration is zero.\n return;\n }\n\n const delta = {\n x: dragOverlay.rect.left - active.rect.left,\n y: dragOverlay.rect.top - active.rect.top\n };\n const scale = {\n scaleX: transform.scaleX !== 1 ? active.rect.width * transform.scaleX / dragOverlay.rect.width : 1,\n scaleY: transform.scaleY !== 1 ? active.rect.height * transform.scaleY / dragOverlay.rect.height : 1\n };\n const finalTransform = {\n x: transform.x - delta.x,\n y: transform.y - delta.y,\n ...scale\n };\n const animationKeyframes = keyframes({ ...rest,\n active,\n dragOverlay,\n transform: {\n initial: transform,\n final: finalTransform\n }\n });\n const [firstKeyframe] = animationKeyframes;\n const lastKeyframe = animationKeyframes[animationKeyframes.length - 1];\n\n if (JSON.stringify(firstKeyframe) === JSON.stringify(lastKeyframe)) {\n // The start and end keyframes are the same, infer that there is no animation needed.\n return;\n }\n\n const cleanup = sideEffects == null ? void 0 : sideEffects({\n active,\n dragOverlay,\n ...rest\n });\n const animation = dragOverlay.node.animate(animationKeyframes, {\n duration,\n easing,\n fill: 'forwards'\n });\n return new Promise(resolve => {\n animation.onfinish = () => {\n cleanup == null ? void 0 : cleanup();\n resolve();\n };\n });\n };\n}\n\nlet key = 0;\nfunction useKey(id) {\n return useMemo(() => {\n if (id == null) {\n return;\n }\n\n key++;\n return key;\n }, [id]);\n}\n\nconst DragOverlay = /*#__PURE__*/React.memo(_ref => {\n let {\n adjustScale = false,\n children,\n dropAnimation: dropAnimationConfig,\n style,\n transition,\n modifiers,\n wrapperElement = 'div',\n className,\n zIndex = 999\n } = _ref;\n const {\n activatorEvent,\n active,\n activeNodeRect,\n containerNodeRect,\n draggableNodes,\n droppableContainers,\n dragOverlay,\n over,\n measuringConfiguration,\n scrollableAncestors,\n scrollableAncestorRects,\n windowRect\n } = useDndContext();\n const transform = useContext(ActiveDraggableContext);\n const key = useKey(active == null ? void 0 : active.id);\n const modifiedTransform = applyModifiers(modifiers, {\n activatorEvent,\n active,\n activeNodeRect,\n containerNodeRect,\n draggingNodeRect: dragOverlay.rect,\n over,\n overlayNodeRect: dragOverlay.rect,\n scrollableAncestors,\n scrollableAncestorRects,\n transform,\n windowRect\n });\n const initialRect = useInitialValue(activeNodeRect);\n const dropAnimation = useDropAnimation({\n config: dropAnimationConfig,\n draggableNodes,\n droppableContainers,\n measuringConfiguration\n }); // We need to wait for the active node to be measured before connecting the drag overlay ref\n // otherwise collisions can be computed against a mispositioned drag overlay\n\n const ref = initialRect ? dragOverlay.setRef : undefined;\n return React.createElement(NullifiedContextProvider, null, React.createElement(AnimationManager, {\n animation: dropAnimation\n }, active && key ? React.createElement(PositionedOverlay, {\n key: key,\n id: active.id,\n ref: ref,\n as: wrapperElement,\n activatorEvent: activatorEvent,\n adjustScale: adjustScale,\n className: className,\n transition: transition,\n rect: initialRect,\n style: {\n zIndex,\n ...style\n },\n transform: modifiedTransform\n }, children) : null));\n});\n\nexport { AutoScrollActivator, DndContext, DragOverlay, KeyboardCode, KeyboardSensor, MeasuringFrequency, MeasuringStrategy, MouseSensor, PointerSensor, TouchSensor, TraversalOrder, applyModifiers, closestCenter, closestCorners, defaultAnnouncements, defaultCoordinates, defaultDropAnimationConfiguration as defaultDropAnimation, defaultDropAnimationSideEffects, defaultScreenReaderInstructions, getClientRect, getFirstCollision, getScrollableAncestors, pointerWithin, rectIntersection, useDndContext, useDndMonitor, useDraggable, useDroppable, useSensor, useSensors };\n//# sourceMappingURL=core.esm.js.map\n","import React, { useMemo, useRef, useEffect, useState, useContext } from 'react';\nimport { useDndContext, getClientRect, useDroppable, useDraggable, closestCorners, getFirstCollision, getScrollableAncestors, KeyboardCode } from '@dnd-kit/core';\nimport { useUniqueId, useIsomorphicLayoutEffect, CSS, useCombinedRefs, isKeyboardEvent, subtract } from '@dnd-kit/utilities';\n\n/**\r\n * Move an array item to a different position. Returns a new array with the item moved to the new position.\r\n */\nfunction arrayMove(array, from, to) {\n const newArray = array.slice();\n newArray.splice(to < 0 ? newArray.length + to : to, 0, newArray.splice(from, 1)[0]);\n return newArray;\n}\n\n/**\r\n * Swap an array item to a different position. Returns a new array with the item swapped to the new position.\r\n */\nfunction arraySwap(array, from, to) {\n const newArray = array.slice();\n newArray[from] = array[to];\n newArray[to] = array[from];\n return newArray;\n}\n\nfunction getSortedRects(items, rects) {\n return items.reduce((accumulator, id, index) => {\n const rect = rects.get(id);\n\n if (rect) {\n accumulator[index] = rect;\n }\n\n return accumulator;\n }, Array(items.length));\n}\n\nfunction isValidIndex(index) {\n return index !== null && index >= 0;\n}\n\nfunction itemsEqual(a, b) {\n if (a === b) {\n return true;\n }\n\n if (a.length !== b.length) {\n return false;\n }\n\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n\n return true;\n}\n\nfunction normalizeDisabled(disabled) {\n if (typeof disabled === 'boolean') {\n return {\n draggable: disabled,\n droppable: disabled\n };\n }\n\n return disabled;\n}\n\n// To-do: We should be calculating scale transformation\nconst defaultScale = {\n scaleX: 1,\n scaleY: 1\n};\nconst horizontalListSortingStrategy = _ref => {\n var _rects$activeIndex;\n\n let {\n rects,\n activeNodeRect: fallbackActiveRect,\n activeIndex,\n overIndex,\n index\n } = _ref;\n const activeNodeRect = (_rects$activeIndex = rects[activeIndex]) != null ? _rects$activeIndex : fallbackActiveRect;\n\n if (!activeNodeRect) {\n return null;\n }\n\n const itemGap = getItemGap(rects, index, activeIndex);\n\n if (index === activeIndex) {\n const newIndexRect = rects[overIndex];\n\n if (!newIndexRect) {\n return null;\n }\n\n return {\n x: activeIndex < overIndex ? newIndexRect.left + newIndexRect.width - (activeNodeRect.left + activeNodeRect.width) : newIndexRect.left - activeNodeRect.left,\n y: 0,\n ...defaultScale\n };\n }\n\n if (index > activeIndex && index <= overIndex) {\n return {\n x: -activeNodeRect.width - itemGap,\n y: 0,\n ...defaultScale\n };\n }\n\n if (index < activeIndex && index >= overIndex) {\n return {\n x: activeNodeRect.width + itemGap,\n y: 0,\n ...defaultScale\n };\n }\n\n return {\n x: 0,\n y: 0,\n ...defaultScale\n };\n};\n\nfunction getItemGap(rects, index, activeIndex) {\n const currentRect = rects[index];\n const previousRect = rects[index - 1];\n const nextRect = rects[index + 1];\n\n if (!currentRect || !previousRect && !nextRect) {\n return 0;\n }\n\n if (activeIndex < index) {\n return previousRect ? currentRect.left - (previousRect.left + previousRect.width) : nextRect.left - (currentRect.left + currentRect.width);\n }\n\n return nextRect ? nextRect.left - (currentRect.left + currentRect.width) : currentRect.left - (previousRect.left + previousRect.width);\n}\n\nconst rectSortingStrategy = _ref => {\n let {\n rects,\n activeIndex,\n overIndex,\n index\n } = _ref;\n const newRects = arrayMove(rects, overIndex, activeIndex);\n const oldRect = rects[index];\n const newRect = newRects[index];\n\n if (!newRect || !oldRect) {\n return null;\n }\n\n return {\n x: newRect.left - oldRect.left,\n y: newRect.top - oldRect.top,\n scaleX: newRect.width / oldRect.width,\n scaleY: newRect.height / oldRect.height\n };\n};\n\nconst rectSwappingStrategy = _ref => {\n let {\n activeIndex,\n index,\n rects,\n overIndex\n } = _ref;\n let oldRect;\n let newRect;\n\n if (index === activeIndex) {\n oldRect = rects[index];\n newRect = rects[overIndex];\n }\n\n if (index === overIndex) {\n oldRect = rects[index];\n newRect = rects[activeIndex];\n }\n\n if (!newRect || !oldRect) {\n return null;\n }\n\n return {\n x: newRect.left - oldRect.left,\n y: newRect.top - oldRect.top,\n scaleX: newRect.width / oldRect.width,\n scaleY: newRect.height / oldRect.height\n };\n};\n\n// To-do: We should be calculating scale transformation\nconst defaultScale$1 = {\n scaleX: 1,\n scaleY: 1\n};\nconst verticalListSortingStrategy = _ref => {\n var _rects$activeIndex;\n\n let {\n activeIndex,\n activeNodeRect: fallbackActiveRect,\n index,\n rects,\n overIndex\n } = _ref;\n const activeNodeRect = (_rects$activeIndex = rects[activeIndex]) != null ? _rects$activeIndex : fallbackActiveRect;\n\n if (!activeNodeRect) {\n return null;\n }\n\n if (index === activeIndex) {\n const overIndexRect = rects[overIndex];\n\n if (!overIndexRect) {\n return null;\n }\n\n return {\n x: 0,\n y: activeIndex < overIndex ? overIndexRect.top + overIndexRect.height - (activeNodeRect.top + activeNodeRect.height) : overIndexRect.top - activeNodeRect.top,\n ...defaultScale$1\n };\n }\n\n const itemGap = getItemGap$1(rects, index, activeIndex);\n\n if (index > activeIndex && index <= overIndex) {\n return {\n x: 0,\n y: -activeNodeRect.height - itemGap,\n ...defaultScale$1\n };\n }\n\n if (index < activeIndex && index >= overIndex) {\n return {\n x: 0,\n y: activeNodeRect.height + itemGap,\n ...defaultScale$1\n };\n }\n\n return {\n x: 0,\n y: 0,\n ...defaultScale$1\n };\n};\n\nfunction getItemGap$1(clientRects, index, activeIndex) {\n const currentRect = clientRects[index];\n const previousRect = clientRects[index - 1];\n const nextRect = clientRects[index + 1];\n\n if (!currentRect) {\n return 0;\n }\n\n if (activeIndex < index) {\n return previousRect ? currentRect.top - (previousRect.top + previousRect.height) : nextRect ? nextRect.top - (currentRect.top + currentRect.height) : 0;\n }\n\n return nextRect ? nextRect.top - (currentRect.top + currentRect.height) : previousRect ? currentRect.top - (previousRect.top + previousRect.height) : 0;\n}\n\nconst ID_PREFIX = 'Sortable';\nconst Context = /*#__PURE__*/React.createContext({\n activeIndex: -1,\n containerId: ID_PREFIX,\n disableTransforms: false,\n items: [],\n overIndex: -1,\n useDragOverlay: false,\n sortedRects: [],\n strategy: rectSortingStrategy,\n disabled: {\n draggable: false,\n droppable: false\n }\n});\nfunction SortableContext(_ref) {\n let {\n children,\n id,\n items: userDefinedItems,\n strategy = rectSortingStrategy,\n disabled: disabledProp = false\n } = _ref;\n const {\n active,\n dragOverlay,\n droppableRects,\n over,\n measureDroppableContainers\n } = useDndContext();\n const containerId = useUniqueId(ID_PREFIX, id);\n const useDragOverlay = Boolean(dragOverlay.rect !== null);\n const items = useMemo(() => userDefinedItems.map(item => typeof item === 'object' && 'id' in item ? item.id : item), [userDefinedItems]);\n const isDragging = active != null;\n const activeIndex = active ? items.indexOf(active.id) : -1;\n const overIndex = over ? items.indexOf(over.id) : -1;\n const previousItemsRef = useRef(items);\n const itemsHaveChanged = !itemsEqual(items, previousItemsRef.current);\n const disableTransforms = overIndex !== -1 && activeIndex === -1 || itemsHaveChanged;\n const disabled = normalizeDisabled(disabledProp);\n useIsomorphicLayoutEffect(() => {\n if (itemsHaveChanged && isDragging) {\n measureDroppableContainers(items);\n }\n }, [itemsHaveChanged, items, isDragging, measureDroppableContainers]);\n useEffect(() => {\n previousItemsRef.current = items;\n }, [items]);\n const contextValue = useMemo(() => ({\n activeIndex,\n containerId,\n disabled,\n disableTransforms,\n items,\n overIndex,\n useDragOverlay,\n sortedRects: getSortedRects(items, droppableRects),\n strategy\n }), // eslint-disable-next-line react-hooks/exhaustive-deps\n [activeIndex, containerId, disabled.draggable, disabled.droppable, disableTransforms, items, overIndex, droppableRects, useDragOverlay, strategy]);\n return React.createElement(Context.Provider, {\n value: contextValue\n }, children);\n}\n\nconst defaultNewIndexGetter = _ref => {\n let {\n id,\n items,\n activeIndex,\n overIndex\n } = _ref;\n return arrayMove(items, activeIndex, overIndex).indexOf(id);\n};\nconst defaultAnimateLayoutChanges = _ref2 => {\n let {\n containerId,\n isSorting,\n wasDragging,\n index,\n items,\n newIndex,\n previousItems,\n previousContainerId,\n transition\n } = _ref2;\n\n if (!transition || !wasDragging) {\n return false;\n }\n\n if (previousItems !== items && index === newIndex) {\n return false;\n }\n\n if (isSorting) {\n return true;\n }\n\n return newIndex !== index && containerId === previousContainerId;\n};\nconst defaultTransition = {\n duration: 200,\n easing: 'ease'\n};\nconst transitionProperty = 'transform';\nconst disabledTransition = /*#__PURE__*/CSS.Transition.toString({\n property: transitionProperty,\n duration: 0,\n easing: 'linear'\n});\nconst defaultAttributes = {\n roleDescription: 'sortable'\n};\n\n/*\r\n * When the index of an item changes while sorting,\r\n * we need to temporarily disable the transforms\r\n */\n\nfunction useDerivedTransform(_ref) {\n let {\n disabled,\n index,\n node,\n rect\n } = _ref;\n const [derivedTransform, setDerivedtransform] = useState(null);\n const previousIndex = useRef(index);\n useIsomorphicLayoutEffect(() => {\n if (!disabled && index !== previousIndex.current && node.current) {\n const initial = rect.current;\n\n if (initial) {\n const current = getClientRect(node.current, {\n ignoreTransform: true\n });\n const delta = {\n x: initial.left - current.left,\n y: initial.top - current.top,\n scaleX: initial.width / current.width,\n scaleY: initial.height / current.height\n };\n\n if (delta.x || delta.y) {\n setDerivedtransform(delta);\n }\n }\n }\n\n if (index !== previousIndex.current) {\n previousIndex.current = index;\n }\n }, [disabled, index, node, rect]);\n useEffect(() => {\n if (derivedTransform) {\n setDerivedtransform(null);\n }\n }, [derivedTransform]);\n return derivedTransform;\n}\n\nfunction useSortable(_ref) {\n let {\n animateLayoutChanges = defaultAnimateLayoutChanges,\n attributes: userDefinedAttributes,\n disabled: localDisabled,\n data: customData,\n getNewIndex = defaultNewIndexGetter,\n id,\n strategy: localStrategy,\n resizeObserverConfig,\n transition = defaultTransition\n } = _ref;\n const {\n items,\n containerId,\n activeIndex,\n disabled: globalDisabled,\n disableTransforms,\n sortedRects,\n overIndex,\n useDragOverlay,\n strategy: globalStrategy\n } = useContext(Context);\n const disabled = normalizeLocalDisabled(localDisabled, globalDisabled);\n const index = items.indexOf(id);\n const data = useMemo(() => ({\n sortable: {\n containerId,\n index,\n items\n },\n ...customData\n }), [containerId, customData, index, items]);\n const itemsAfterCurrentSortable = useMemo(() => items.slice(items.indexOf(id)), [items, id]);\n const {\n rect,\n node,\n isOver,\n setNodeRef: setDroppableNodeRef\n } = useDroppable({\n id,\n data,\n disabled: disabled.droppable,\n resizeObserverConfig: {\n updateMeasurementsFor: itemsAfterCurrentSortable,\n ...resizeObserverConfig\n }\n });\n const {\n active,\n activatorEvent,\n activeNodeRect,\n attributes,\n setNodeRef: setDraggableNodeRef,\n listeners,\n isDragging,\n over,\n setActivatorNodeRef,\n transform\n } = useDraggable({\n id,\n data,\n attributes: { ...defaultAttributes,\n ...userDefinedAttributes\n },\n disabled: disabled.draggable\n });\n const setNodeRef = useCombinedRefs(setDroppableNodeRef, setDraggableNodeRef);\n const isSorting = Boolean(active);\n const displaceItem = isSorting && !disableTransforms && isValidIndex(activeIndex) && isValidIndex(overIndex);\n const shouldDisplaceDragSource = !useDragOverlay && isDragging;\n const dragSourceDisplacement = shouldDisplaceDragSource && displaceItem ? transform : null;\n const strategy = localStrategy != null ? localStrategy : globalStrategy;\n const finalTransform = displaceItem ? dragSourceDisplacement != null ? dragSourceDisplacement : strategy({\n rects: sortedRects,\n activeNodeRect,\n activeIndex,\n overIndex,\n index\n }) : null;\n const newIndex = isValidIndex(activeIndex) && isValidIndex(overIndex) ? getNewIndex({\n id,\n items,\n activeIndex,\n overIndex\n }) : index;\n const activeId = active == null ? void 0 : active.id;\n const previous = useRef({\n activeId,\n items,\n newIndex,\n containerId\n });\n const itemsHaveChanged = items !== previous.current.items;\n const shouldAnimateLayoutChanges = animateLayoutChanges({\n active,\n containerId,\n isDragging,\n isSorting,\n id,\n index,\n items,\n newIndex: previous.current.newIndex,\n previousItems: previous.current.items,\n previousContainerId: previous.current.containerId,\n transition,\n wasDragging: previous.current.activeId != null\n });\n const derivedTransform = useDerivedTransform({\n disabled: !shouldAnimateLayoutChanges,\n index,\n node,\n rect\n });\n useEffect(() => {\n if (isSorting && previous.current.newIndex !== newIndex) {\n previous.current.newIndex = newIndex;\n }\n\n if (containerId !== previous.current.containerId) {\n previous.current.containerId = containerId;\n }\n\n if (items !== previous.current.items) {\n previous.current.items = items;\n }\n }, [isSorting, newIndex, containerId, items]);\n useEffect(() => {\n if (activeId === previous.current.activeId) {\n return;\n }\n\n if (activeId && !previous.current.activeId) {\n previous.current.activeId = activeId;\n return;\n }\n\n const timeoutId = setTimeout(() => {\n previous.current.activeId = activeId;\n }, 50);\n return () => clearTimeout(timeoutId);\n }, [activeId]);\n return {\n active,\n activeIndex,\n attributes,\n data,\n rect,\n index,\n newIndex,\n items,\n isOver,\n isSorting,\n isDragging,\n listeners,\n node,\n overIndex,\n over,\n setNodeRef,\n setActivatorNodeRef,\n setDroppableNodeRef,\n setDraggableNodeRef,\n transform: derivedTransform != null ? derivedTransform : finalTransform,\n transition: getTransition()\n };\n\n function getTransition() {\n if ( // Temporarily disable transitions for a single frame to set up derived transforms\n derivedTransform || // Or to prevent items jumping to back to their \"new\" position when items change\n itemsHaveChanged && previous.current.newIndex === index) {\n return disabledTransition;\n }\n\n if (shouldDisplaceDragSource && !isKeyboardEvent(activatorEvent) || !transition) {\n return undefined;\n }\n\n if (isSorting || shouldAnimateLayoutChanges) {\n return CSS.Transition.toString({ ...transition,\n property: transitionProperty\n });\n }\n\n return undefined;\n }\n}\n\nfunction normalizeLocalDisabled(localDisabled, globalDisabled) {\n var _localDisabled$dragga, _localDisabled$droppa;\n\n if (typeof localDisabled === 'boolean') {\n return {\n draggable: localDisabled,\n // Backwards compatibility\n droppable: false\n };\n }\n\n return {\n draggable: (_localDisabled$dragga = localDisabled == null ? void 0 : localDisabled.draggable) != null ? _localDisabled$dragga : globalDisabled.draggable,\n droppable: (_localDisabled$droppa = localDisabled == null ? void 0 : localDisabled.droppable) != null ? _localDisabled$droppa : globalDisabled.droppable\n };\n}\n\nfunction hasSortableData(entry) {\n if (!entry) {\n return false;\n }\n\n const data = entry.data.current;\n\n if (data && 'sortable' in data && typeof data.sortable === 'object' && 'containerId' in data.sortable && 'items' in data.sortable && 'index' in data.sortable) {\n return true;\n }\n\n return false;\n}\n\nconst directions = [KeyboardCode.Down, KeyboardCode.Right, KeyboardCode.Up, KeyboardCode.Left];\nconst sortableKeyboardCoordinates = (event, _ref) => {\n let {\n context: {\n active,\n collisionRect,\n droppableRects,\n droppableContainers,\n over,\n scrollableAncestors\n }\n } = _ref;\n\n if (directions.includes(event.code)) {\n event.preventDefault();\n\n if (!active || !collisionRect) {\n return;\n }\n\n const filteredContainers = [];\n droppableContainers.getEnabled().forEach(entry => {\n if (!entry || entry != null && entry.disabled) {\n return;\n }\n\n const rect = droppableRects.get(entry.id);\n\n if (!rect) {\n return;\n }\n\n switch (event.code) {\n case KeyboardCode.Down:\n if (collisionRect.top < rect.top) {\n filteredContainers.push(entry);\n }\n\n break;\n\n case KeyboardCode.Up:\n if (collisionRect.top > rect.top) {\n filteredContainers.push(entry);\n }\n\n break;\n\n case KeyboardCode.Left:\n if (collisionRect.left > rect.left) {\n filteredContainers.push(entry);\n }\n\n break;\n\n case KeyboardCode.Right:\n if (collisionRect.left < rect.left) {\n filteredContainers.push(entry);\n }\n\n break;\n }\n });\n const collisions = closestCorners({\n active,\n collisionRect: collisionRect,\n droppableRects,\n droppableContainers: filteredContainers,\n pointerCoordinates: null\n });\n let closestId = getFirstCollision(collisions, 'id');\n\n if (closestId === (over == null ? void 0 : over.id) && collisions.length > 1) {\n closestId = collisions[1].id;\n }\n\n if (closestId != null) {\n const activeDroppable = droppableContainers.get(active.id);\n const newDroppable = droppableContainers.get(closestId);\n const newRect = newDroppable ? droppableRects.get(newDroppable.id) : null;\n const newNode = newDroppable == null ? void 0 : newDroppable.node.current;\n\n if (newNode && newRect && activeDroppable && newDroppable) {\n const newScrollAncestors = getScrollableAncestors(newNode);\n const hasDifferentScrollAncestors = newScrollAncestors.some((element, index) => scrollableAncestors[index] !== element);\n const hasSameContainer = isSameContainer(activeDroppable, newDroppable);\n const isAfterActive = isAfter(activeDroppable, newDroppable);\n const offset = hasDifferentScrollAncestors || !hasSameContainer ? {\n x: 0,\n y: 0\n } : {\n x: isAfterActive ? collisionRect.width - newRect.width : 0,\n y: isAfterActive ? collisionRect.height - newRect.height : 0\n };\n const rectCoordinates = {\n x: newRect.left,\n y: newRect.top\n };\n const newCoordinates = offset.x && offset.y ? rectCoordinates : subtract(rectCoordinates, offset);\n return newCoordinates;\n }\n }\n }\n\n return undefined;\n};\n\nfunction isSameContainer(a, b) {\n if (!hasSortableData(a) || !hasSortableData(b)) {\n return false;\n }\n\n return a.data.current.sortable.containerId === b.data.current.sortable.containerId;\n}\n\nfunction isAfter(a, b) {\n if (!hasSortableData(a) || !hasSortableData(b)) {\n return false;\n }\n\n if (!isSameContainer(a, b)) {\n return false;\n }\n\n return a.data.current.sortable.index < b.data.current.sortable.index;\n}\n\nexport { SortableContext, arrayMove, arraySwap, defaultAnimateLayoutChanges, defaultNewIndexGetter, hasSortableData, horizontalListSortingStrategy, rectSortingStrategy, rectSwappingStrategy, sortableKeyboardCoordinates, useSortable, verticalListSortingStrategy };\n//# sourceMappingURL=sortable.esm.js.map\n","import { useMemo, useLayoutEffect, useEffect, useRef, useCallback } from 'react';\n\nfunction useCombinedRefs() {\n for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {\n refs[_key] = arguments[_key];\n }\n\n return useMemo(() => node => {\n refs.forEach(ref => ref(node));\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n refs);\n}\n\n// https://github.com/facebook/react/blob/master/packages/shared/ExecutionEnvironment.js\nconst canUseDOM = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined';\n\nfunction isWindow(element) {\n const elementString = Object.prototype.toString.call(element);\n return elementString === '[object Window]' || // In Electron context the Window object serializes to [object global]\n elementString === '[object global]';\n}\n\nfunction isNode(node) {\n return 'nodeType' in node;\n}\n\nfunction getWindow(target) {\n var _target$ownerDocument, _target$ownerDocument2;\n\n if (!target) {\n return window;\n }\n\n if (isWindow(target)) {\n return target;\n }\n\n if (!isNode(target)) {\n return window;\n }\n\n return (_target$ownerDocument = (_target$ownerDocument2 = target.ownerDocument) == null ? void 0 : _target$ownerDocument2.defaultView) != null ? _target$ownerDocument : window;\n}\n\nfunction isDocument(node) {\n const {\n Document\n } = getWindow(node);\n return node instanceof Document;\n}\n\nfunction isHTMLElement(node) {\n if (isWindow(node)) {\n return false;\n }\n\n return node instanceof getWindow(node).HTMLElement;\n}\n\nfunction isSVGElement(node) {\n return node instanceof getWindow(node).SVGElement;\n}\n\nfunction getOwnerDocument(target) {\n if (!target) {\n return document;\n }\n\n if (isWindow(target)) {\n return target.document;\n }\n\n if (!isNode(target)) {\n return document;\n }\n\n if (isDocument(target)) {\n return target;\n }\n\n if (isHTMLElement(target) || isSVGElement(target)) {\n return target.ownerDocument;\n }\n\n return document;\n}\n\n/**\r\n * A hook that resolves to useEffect on the server and useLayoutEffect on the client\r\n * @param callback {function} Callback function that is invoked when the dependencies of the hook change\r\n */\n\nconst useIsomorphicLayoutEffect = canUseDOM ? useLayoutEffect : useEffect;\n\nfunction useEvent(handler) {\n const handlerRef = useRef(handler);\n useIsomorphicLayoutEffect(() => {\n handlerRef.current = handler;\n });\n return useCallback(function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return handlerRef.current == null ? void 0 : handlerRef.current(...args);\n }, []);\n}\n\nfunction useInterval() {\n const intervalRef = useRef(null);\n const set = useCallback((listener, duration) => {\n intervalRef.current = setInterval(listener, duration);\n }, []);\n const clear = useCallback(() => {\n if (intervalRef.current !== null) {\n clearInterval(intervalRef.current);\n intervalRef.current = null;\n }\n }, []);\n return [set, clear];\n}\n\nfunction useLatestValue(value, dependencies) {\n if (dependencies === void 0) {\n dependencies = [value];\n }\n\n const valueRef = useRef(value);\n useIsomorphicLayoutEffect(() => {\n if (valueRef.current !== value) {\n valueRef.current = value;\n }\n }, dependencies);\n return valueRef;\n}\n\nfunction useLazyMemo(callback, dependencies) {\n const valueRef = useRef();\n return useMemo(() => {\n const newValue = callback(valueRef.current);\n valueRef.current = newValue;\n return newValue;\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [...dependencies]);\n}\n\nfunction useNodeRef(onChange) {\n const onChangeHandler = useEvent(onChange);\n const node = useRef(null);\n const setNodeRef = useCallback(element => {\n if (element !== node.current) {\n onChangeHandler == null ? void 0 : onChangeHandler(element, node.current);\n }\n\n node.current = element;\n }, //eslint-disable-next-line\n []);\n return [node, setNodeRef];\n}\n\nfunction usePrevious(value) {\n const ref = useRef();\n useEffect(() => {\n ref.current = value;\n }, [value]);\n return ref.current;\n}\n\nlet ids = {};\nfunction useUniqueId(prefix, value) {\n return useMemo(() => {\n if (value) {\n return value;\n }\n\n const id = ids[prefix] == null ? 0 : ids[prefix] + 1;\n ids[prefix] = id;\n return prefix + \"-\" + id;\n }, [prefix, value]);\n}\n\nfunction createAdjustmentFn(modifier) {\n return function (object) {\n for (var _len = arguments.length, adjustments = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n adjustments[_key - 1] = arguments[_key];\n }\n\n return adjustments.reduce((accumulator, adjustment) => {\n const entries = Object.entries(adjustment);\n\n for (const [key, valueAdjustment] of entries) {\n const value = accumulator[key];\n\n if (value != null) {\n accumulator[key] = value + modifier * valueAdjustment;\n }\n }\n\n return accumulator;\n }, { ...object\n });\n };\n}\n\nconst add = /*#__PURE__*/createAdjustmentFn(1);\nconst subtract = /*#__PURE__*/createAdjustmentFn(-1);\n\nfunction hasViewportRelativeCoordinates(event) {\n return 'clientX' in event && 'clientY' in event;\n}\n\nfunction isKeyboardEvent(event) {\n if (!event) {\n return false;\n }\n\n const {\n KeyboardEvent\n } = getWindow(event.target);\n return KeyboardEvent && event instanceof KeyboardEvent;\n}\n\nfunction isTouchEvent(event) {\n if (!event) {\n return false;\n }\n\n const {\n TouchEvent\n } = getWindow(event.target);\n return TouchEvent && event instanceof TouchEvent;\n}\n\n/**\r\n * Returns the normalized x and y coordinates for mouse and touch events.\r\n */\n\nfunction getEventCoordinates(event) {\n if (isTouchEvent(event)) {\n if (event.touches && event.touches.length) {\n const {\n clientX: x,\n clientY: y\n } = event.touches[0];\n return {\n x,\n y\n };\n } else if (event.changedTouches && event.changedTouches.length) {\n const {\n clientX: x,\n clientY: y\n } = event.changedTouches[0];\n return {\n x,\n y\n };\n }\n }\n\n if (hasViewportRelativeCoordinates(event)) {\n return {\n x: event.clientX,\n y: event.clientY\n };\n }\n\n return null;\n}\n\nconst CSS = /*#__PURE__*/Object.freeze({\n Translate: {\n toString(transform) {\n if (!transform) {\n return;\n }\n\n const {\n x,\n y\n } = transform;\n return \"translate3d(\" + (x ? Math.round(x) : 0) + \"px, \" + (y ? Math.round(y) : 0) + \"px, 0)\";\n }\n\n },\n Scale: {\n toString(transform) {\n if (!transform) {\n return;\n }\n\n const {\n scaleX,\n scaleY\n } = transform;\n return \"scaleX(\" + scaleX + \") scaleY(\" + scaleY + \")\";\n }\n\n },\n Transform: {\n toString(transform) {\n if (!transform) {\n return;\n }\n\n return [CSS.Translate.toString(transform), CSS.Scale.toString(transform)].join(' ');\n }\n\n },\n Transition: {\n toString(_ref) {\n let {\n property,\n duration,\n easing\n } = _ref;\n return property + \" \" + duration + \"ms \" + easing;\n }\n\n }\n});\n\nconst SELECTOR = 'a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]';\nfunction findFirstFocusableNode(element) {\n if (element.matches(SELECTOR)) {\n return element;\n }\n\n return element.querySelector(SELECTOR);\n}\n\nexport { CSS, add, canUseDOM, findFirstFocusableNode, getEventCoordinates, getOwnerDocument, getWindow, hasViewportRelativeCoordinates, isDocument, isHTMLElement, isKeyboardEvent, isNode, isSVGElement, isTouchEvent, isWindow, subtract, useCombinedRefs, useEvent, useInterval, useIsomorphicLayoutEffect, useLatestValue, useLazyMemo, useNodeRef, usePrevious, useUniqueId };\n//# sourceMappingURL=utilities.esm.js.map\n","/**\n * WordPress dependencies\n */\nimport { SVG, Path } from '@wordpress/primitives';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst closeSmall = /*#__PURE__*/_jsx(SVG, {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 24 24\",\n children: /*#__PURE__*/_jsx(Path, {\n d: \"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z\"\n })\n});\nexport default closeSmall;\n//# sourceMappingURL=close-small.js.map","/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\nconst InlineNotice = ( { children, status = 'warning', size = 'regular' } ) => {\n\tconst className = classnames(\n\t\t'wpbt-inline-notice',\n\t\t`is-${ status }`,\n\t\t`is-size-${ size }`\n\t);\n\n\treturn
{ children }
;\n};\n\nexport default InlineNotice;\n","/**\n * WordPress dependencies\n */\nimport { ComboboxControl, Spinner } from '@wordpress/components';\nimport { useState, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { postToControlOption } from '../utils';\n\nconst PostControl = ( { label, posts, value, onChange } ) => {\n\tconst [ options, setOptions ] = useState( [] );\n\n\tuseEffect( () => {\n\t\tif ( posts ) {\n\t\t\tsetOptions( posts.map( postToControlOption ) );\n\t\t}\n\t}, [ posts ] );\n\n\tif ( posts === null ) return ;\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\n\t);\n};\n\nexport default PostControl;\n\nconst ComboboxWrapper = ( { children } ) => {\n\treturn
{ children }
;\n};\n","/**\n * External dependencies\n */\nimport { useDebounce } from \"use-debounce\";\n\n/**\n * WordPress dependecies\n */\nimport { __ } from \"@wordpress/i18n\";\nimport { Spinner, BaseControl, Button } from \"@wordpress/components\";\nimport { useState, RawHTML } from \"@wordpress/element\";\nimport { closeSmall } from \"@wordpress/icons\";\n\n/**\n * Internal dependencies\n */\nimport { usePost } from \"../hooks/use-post\";\nimport { usePostSearch } from \"../hooks/use-post-search\";\n\n/**\n * Constants\n */\nconst SEARCH_DEBOUNCE_DELAY = 500;\nconst SEARCH_MINIMUM_LENGTH = 3;\n\nconst PostSearchControl = ({\n\ttype = \"post\",\n\tstatus = \"publish\",\n\tvalue = 0,\n\tonChange,\n\tplaceholder = __(\"Search\", \"wp-block-toolkit\"),\n\tlabel = __(\"Select a post\", \"wp-block-toolkit\"),\n\tinputProps = {},\n\tfilterResults = null,\n\tnumOfInitialResults = 20,\n\t...rest\n}) => {\n\tconst [isExpanded, setIsExpanded] = useState(false);\n\tconst [search, setSearch] = useState(\"\");\n\tconst [debouncedSearch] = useDebounce(search, SEARCH_DEBOUNCE_DELAY);\n\tconst [perPage, setPerPage] = useState(numOfInitialResults);\n\tconst [isLoadingMore, setIsLoadingMore] = useState(false);\n\n\tconst selected = usePost(type, value);\n\n\tconst posts = usePostSearch({\n\t\tpostType: type,\n\t\tpostStatus: status,\n\t\tsearch: debouncedSearch,\n\t\tminimumLength: SEARCH_MINIMUM_LENGTH,\n\t\tperPage,\n\t});\n\n\tconst maybeHasMorePosts = posts?.length === numOfInitialResults;\n\n\tconst filteredPosts = filterResults ? filterResults(posts) : posts;\n\n\tconst onKeyDown = (e) => {\n\t\tif (e.key === \"Escape\") {\n\t\t\te.preventDefault();\n\t\t\tsetIsExpanded(false);\n\t\t}\n\t};\n\n\treturn (\n\t\t\n\t\t\t
\n\t\t\t\t setSearch(e.currentTarget.value)}\n\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\tonFocus={() => setIsExpanded(true)}\n\t\t\t\t\tclassName=\"wpbt-post-search-control__input\"\n\t\t\t\t\t{...inputProps}\n\t\t\t\t/>\n\n\t\t\t\t onChange(null)}\n\t\t\t\t\tlabel={__(\"Reset\")}\n\t\t\t\t/>\n\t\t\t
\n\n\t\t\t
\n\t\t\t\t{isExpanded && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t (\n\t\t\t\t\t\t\t\t {\n\t\t\t\t\t\t\t\t\t\tonChange(post.id);\n\t\t\t\t\t\t\t\t\t\tsetSearch(\"\");\n\t\t\t\t\t\t\t\t\t\tsetIsExpanded(false);\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{post?.title?.rendered}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t{maybeHasMorePosts && (\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t{isLoadingMore ? (\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t {\n\t\t\t\t\t\t\t\t\t\t\tsetIsLoadingMore(true);\n\t\t\t\t\t\t\t\t\t\t\tsetPerPage(-1);\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{__(\"View more results\", \"wp-block-toolkit\")}\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t)}\n\t\t\t\t\t\n\t\t\t\t)}\n\t\t\t
\n\t\t\n\t);\n};\n\nconst Options = ({ options, search, renderOption }) => {\n\tconst isLoading = options === null;\n\tconst hasOptions = options && options.length > 0;\n\tconst hasSearch = search.length > 0;\n\tconst hasMinimumSearchLength = search.length >= SEARCH_MINIMUM_LENGTH;\n\n\tif (!hasSearch) {\n\t\treturn null;\n\t}\n\n\tif (isLoading) {\n\t\treturn (\n\t\t\t
\n\t\t\t\t\n\t\t\t
\n\t\t);\n\t}\n\n\tif (!hasOptions) {\n\t\tif (!hasMinimumSearchLength) {\n\t\t\treturn (\n\t\t\t\t

\n\t\t\t\t\t{__(\n\t\t\t\t\t\t`Your search needs to be at least ${SEARCH_MINIMUM_LENGTH} characters long.`,\n\t\t\t\t\t\t\"wp-block-toolkit\",\n\t\t\t\t\t)}\n\t\t\t\t

\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t

{__(\"No posts were found with your search.\", \"wp-block-toolkit\")}

\n\t\t);\n\t}\n\n\treturn options.map(renderOption);\n};\n\nexport default PostSearchControl;\n","/**\n * WordPress dependencies\n */\nimport { __ } from \"@wordpress/i18n\";\nimport { Fragment } from \"@wordpress/element\";\n\n/**\n * Internal dependencies\n */\nimport InlineNotice from \"./InlineNotice\";\nimport { useRequiredBlocks } from \"../hooks/use-required-blocks\";\n\nconst RequireBlocks = ({ children, blocks }) => {\n\tconst { hasRequiredBlocks, missingBlocks } = useRequiredBlocks(blocks);\n\n\treturn (\n\t\t\n\t\t\t{hasRequiredBlocks ? (\n\t\t\t\tchildren\n\t\t\t) : (\n\t\t\t\t\n\t\t\t\t\t{__(\n\t\t\t\t\t\t\"Couldn't find all the required blocks. Please install and activate the following blocks: \",\n\t\t\t\t\t\t\"wp-block-toolkit\",\n\t\t\t\t\t)}\n\t\t\t\t\t{missingBlocks.join(\", \")}\n\t\t\t\t\n\t\t\t)}\n\t\t\n\t);\n};\n\nexport default RequireBlocks;\n","/**\n * External dependencies\n */\nimport {\n\tDndContext,\n\tclosestCenter,\n\tKeyboardSensor,\n\tPointerSensor,\n\tuseSensor,\n\tuseSensors,\n} from \"@dnd-kit/core\";\nimport {\n\tarrayMove,\n\tSortableContext,\n\tsortableKeyboardCoordinates,\n\tverticalListSortingStrategy,\n\tuseSortable,\n} from \"@dnd-kit/sortable\";\nimport { CSS } from \"@dnd-kit/utilities\";\nimport classnames from \"classnames\";\n\n/**\n * WordPress dependencies\n */\nimport { __ } from \"@wordpress/i18n\";\nimport { useState, useEffect } from \"@wordpress/element\";\nimport { BaseControl, Spinner } from \"@wordpress/components\";\n\n/**\n * Internal dependencies\n */\nimport { postToControlOption } from \"../utils\";\n\nconst SortablePostsControl = ({ label, posts, value, onChange }) => {\n\tconst [options, setOptions] = useState([]);\n\tconst [filteredOptions, setFilteredOptions] = useState([]);\n\tconst [query, setQuery] = useState(\"\");\n\n\tuseEffect(() => {\n\t\tif (posts) {\n\t\t\tsetOptions(posts.map(postToControlOption));\n\t\t}\n\t}, [posts]);\n\n\tuseEffect(() => {\n\t\tconst newFilteredOptions = query\n\t\t\t? options.filter((each) =>\n\t\t\t\t\teach.label.toLowerCase().includes(query.toLowerCase()),\n\t\t\t )\n\t\t\t: options;\n\n\t\tsetFilteredOptions(newFilteredOptions);\n\t}, [options, query]);\n\n\tif (posts === null) return ;\n\n\tif (!options || !options.length) return null;\n\n\tconst onOptionClick = (option, isSelected) => {\n\t\tonChange(\n\t\t\tisSelected\n\t\t\t\t? value.filter((id) => id !== option.value)\n\t\t\t\t: [...value, option.value],\n\t\t);\n\t};\n\n\tconst onSortEnd = (newValues) => {\n\t\tonChange(newValues);\n\t};\n\n\tconst onItemRemove = (option) => {\n\t\tonChange(value.filter((id) => id !== option.value));\n\t};\n\n\tconst sortableOptions = value.reduce((items, id) => {\n\t\tconst option = options.find((option) => option.value === id);\n\n\t\tif (option) {\n\t\t\titems.push(option);\n\t\t}\n\n\t\treturn items;\n\t}, []);\n\n\treturn (\n\t\t\n\t\t\t

\n\t\t\t\t{__(\"Select posts\", \"wp-block-toolkit\")}\n\t\t\t

\n\n\t\t\t setQuery(event.target.value)}\n\t\t\t\tclassName=\"wpbt-sortable-posts-control__search\"\n\t\t\t/>\n\n\t\t\t
\n\t\t\t\t{filteredOptions.map((option, index) => {\n\t\t\t\t\tconst isSelected = value.find((id) => id === option.value);\n\n\t\t\t\t\tconst optionClassName = classnames(\n\t\t\t\t\t\t\"wpbt-sortable-posts-control__option\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"is-selected\": isSelected,\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t onOptionClick(option, isSelected)}\n\t\t\t\t\t\t\tclassName={optionClassName}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{option.label}\n\t\t\t\t\t\t\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t
\n\n\t\t\t

\n\t\t\t\t{__(\"Select order\", \"wp-block-toolkit\")}\n\t\t\t

\n\n\t\t\t\n\t\t
\n\t);\n};\n\nconst SortableItem = ({ id, value, onRemove, isDragging }) => {\n\tconst { attributes, listeners, setNodeRef, transform, transition } =\n\t\tuseSortable({ id });\n\n\tconst style = {\n\t\ttransform: CSS.Transform.toString({\n\t\t\tx: 0,\n\t\t\ty: transform?.y,\n\t\t\tscaleX: 1,\n\t\t\tscaleY: 1,\n\t\t}),\n\t\ttransition,\n\t};\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\t{value.label}\n\t\t\t\n\t\t\t{!isDragging && (\n\t\t\t\t onRemove(value)}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\n\t);\n};\n\nconst SortableList = ({ items, onChange, onItemRemove }) => {\n\tconst [isDragging, setIsDragging] = useState(false);\n\n\tconst sensors = useSensors(\n\t\tuseSensor(PointerSensor),\n\t\tuseSensor(KeyboardSensor, {\n\t\t\tcoordinateGetter: sortableKeyboardCoordinates,\n\t\t}),\n\t);\n\n\tconst handleDragStart = (event) => {\n\t\tsetIsDragging(true);\n\t};\n\n\tconst handleDragEnd = (event) => {\n\t\tsetIsDragging(false);\n\n\t\tconst { active, over } = event;\n\n\t\tif (active.id !== over.id) {\n\t\t\tconst ids = items.map((item) => item.value);\n\t\t\tconst oldIndex = ids.indexOf(active.id);\n\t\t\tconst newIndex = ids.indexOf(over.id);\n\t\t\tconst newIds = arrayMove(ids, oldIndex, newIndex);\n\n\t\t\tonChange(newIds);\n\t\t}\n\t};\n\n\treturn (\n\t\t
\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t\t{items.map((item, index) => (\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t))}\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\n\t\t
\n\t);\n};\n\nexport default SortablePostsControl;\n","/**\n * WordPress dependencies\n */\nimport { __ } from \"@wordpress/i18n\";\nimport { CheckboxControl, Spinner, BaseControl } from \"@wordpress/components\";\nimport { useState, useEffect, RawHTML } from \"@wordpress/element\";\nimport { useSelect } from \"@wordpress/data\";\n\n/**\n * Internal dependencies\n */\nimport { labelWithCount } from \"../utils\";\n\nconst TaxonomyControl = ({ slug, label, value, onChange }) => {\n\tconst [taxonomies, setTaxonomies] = useState([]);\n\tconst [query, setQuery] = useState(\"\");\n\tconst hasTaxonomies = taxonomies.length > 0;\n\n\t/**\n\t * Get all taxonomies of slug type\n\t */\n\tconst data = useSelect(\n\t\t(select) => {\n\t\t\treturn select(\"core\").getEntityRecords(\"taxonomy\", slug, {\n\t\t\t\tper_page: -1,\n\t\t\t});\n\t\t},\n\t\t[slug],\n\t);\n\n\tconst isLoading = data === null;\n\n\t/**\n\t * Convert data shape from flat to hierarchical\n\t */\n\tuseEffect(() => {\n\t\tif (data) {\n\t\t\tconst groupedByParent = data.reduce((acc, cur) => {\n\t\t\t\tconst key = cur.parent || 0;\n\t\t\t\tacc[key] = [...(acc[key] || []), cur];\n\t\t\t\treturn acc;\n\t\t\t}, {});\n\n\t\t\tconst withNestedChildren = (item) => {\n\t\t\t\treturn {\n\t\t\t\t\t...item,\n\t\t\t\t\tchildren: groupedByParent[item.id]\n\t\t\t\t\t\t? groupedByParent[item.id].map(withNestedChildren)\n\t\t\t\t\t\t: [],\n\t\t\t\t};\n\t\t\t};\n\n\t\t\tif (groupedByParent[0]) {\n\t\t\t\tconst newTaxonomies = groupedByParent[0].map(withNestedChildren);\n\t\t\t\tsetTaxonomies(newTaxonomies);\n\t\t\t}\n\t\t}\n\t}, [data]);\n\n\tconst handleClick = (id, checked) => {\n\t\tif (checked) {\n\t\t\tonChange([...value, id]);\n\t\t} else {\n\t\t\tonChange(value.filter((each) => each !== id));\n\t\t}\n\t};\n\n\tconst isMatch = ({ name }) => {\n\t\treturn name.toLowerCase().includes(query.toLowerCase());\n\t};\n\n\tconst filter = (data) => {\n\t\tconst arr = [];\n\n\t\tdata.forEach((item) => {\n\t\t\tif (isMatch(item) || item.children.some(isMatch)) {\n\t\t\t\tarr.push({ ...item, children: filter(item.children) });\n\t\t\t}\n\t\t});\n\n\t\treturn arr;\n\t};\n\n\treturn (\n\t\t\n\t\t\t setQuery(event.target.value)}\n\t\t\t/>\n\t\t\t{!isLoading && value.length > 0 && (\n\t\t\t\t
\n\t\t\t\t\t{value.map((id) => (\n\t\t\t\t\t\t each.id === id)?.name}\n\t\t\t\t\t\t\tonClick={() => handleClick(id, false)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t
\n\t\t\t)}\n\t\t\t\n\t\t\t\t{isLoading ? (\n\t\t\t\t\t\n\t\t\t\t) : !hasTaxonomies ? (\n\t\t\t\t\t

\n\t\t\t\t\t\t{__(`No taxonomies of type \"${slug}\" found.`, \"wp-block-toolkit\")}\n\t\t\t\t\t

\n\t\t\t\t) : (\n\t\t\t\t\t\n\t\t\t\t)}\n\t\t\t
\n\t\t
\n\t);\n};\n\nexport default TaxonomyControl;\n\nconst CheckboxGroup = ({ data, value, onCheckboxClick }) => {\n\treturn (\n\t\t
    \n\t\t\t{data.map((item) => (\n\t\t\t\t
  • \n\t\t\t\t\t{item.name}}\n\t\t\t\t\t\tchecked={value.includes(item.id)}\n\t\t\t\t\t\tonChange={(checked) => onCheckboxClick(item.id, checked)}\n\t\t\t\t\t/>\n\t\t\t\t\t{item.children && (\n\t\t\t\t\t\t\n\t\t\t\t\t)}\n\t\t\t\t
  • \n\t\t\t))}\n\t\t
\n\t);\n};\n\nconst SearchInput = ({ value, onChange }) => {\n\treturn (\n\t\t
\n\t\t\t\n\t\t
\n\t);\n};\n\nconst RemovableTag = ({ id, label, onClick }) => {\n\treturn (\n\t\t\n\t);\n};\n\nconst CheckboxWrapper = ({ children }) => {\n\treturn
{children}
;\n};\n","/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n\nexport function useAllPosts( postType ) {\n\tconst posts = useSelect(\n\t\t( select ) =>\n\t\t\tselect( 'core' ).getEntityRecords( 'postType', postType, {\n\t\t\t\tper_page: -1,\n\t\t\t\torderby: 'title',\n\t\t\t\torder: 'asc',\n\t\t\t\tstatus: 'publish',\n\t\t\t} ),\n\t\t[ postType ]\n\t);\n\n\treturn posts;\n}\n","/**\n * WordPress dependencies\n */\nimport { useSelect } from \"@wordpress/data\";\n\nexport function usePostSearch({\n\tpostType = \"post\",\n\tpostStatus = \"publish\",\n\tsearch = \"\",\n\tminimumLength = 3,\n\tperPage = 20,\n}) {\n\tconst posts = useSelect(\n\t\t(select) => {\n\t\t\tif (search.length < minimumLength) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\treturn select(\"core\").getEntityRecords(\"postType\", postType, {\n\t\t\t\tper_page: perPage,\n\t\t\t\torderby: \"title\",\n\t\t\t\torder: \"asc\",\n\t\t\t\tstatus: postStatus,\n\t\t\t\tsearch,\n\t\t\t});\n\t\t},\n\t\t[postType, search, minimumLength, perPage]\n\t);\n\n\treturn posts;\n}\n","/**\n * WordPress dependencies\n */\nimport { useSelect } from \"@wordpress/data\";\n\nexport function usePost(postType, id) {\n\tconst post = useSelect(\n\t\t(select) => {\n\t\t\tif (!id) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\treturn select(\"core\").getEntityRecord(\"postType\", postType, id);\n\t\t},\n\t\t[id]\n\t);\n\n\treturn post;\n}\n","/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n\nexport function useRequiredBlocks( requiredBlocks ) {\n\tconst blockNames = useSelect( ( select ) => {\n\t\treturn select( 'core/blocks' )\n\t\t\t.getBlockTypes()\n\t\t\t.map( ( each ) => each.name );\n\t}, [] );\n\n\tconst missingBlocks = requiredBlocks.filter(\n\t\t( block ) => ! blockNames.includes( block )\n\t);\n\n\treturn {\n\t\tmissingBlocks,\n\t\thasRequiredBlocks: ! missingBlocks.length,\n\t};\n}\n","export const postToControlOption = (post) => ({\n\tid: post.id,\n\tlabel: post.title.raw,\n\tvalue: post.id,\n});\n\nexport const labelWithCount = (label, count) => {\n\tif (!count) {\n\t\treturn label;\n\t}\n\n\treturn `${label} (${count})`;\n};\n","// extracted by mini-css-extract-plugin\nexport {};","import{useRef as r,useEffect as n,useMemo as t,useReducer as e,useCallback as u}from\"react\";function c(e,u,c){var i=this,a=r(null),o=r(0),f=r(null),l=r([]),v=r(),m=r(),d=r(e),g=r(!0);d.current=e;var p=\"undefined\"!=typeof window,w=!u&&0!==u&&p;if(\"function\"!=typeof e)throw new TypeError(\"Expected a function\");u=+u||0;var s=!!(c=c||{}).leading,x=!(\"trailing\"in c)||!!c.trailing,h=\"maxWait\"in c,y=\"debounceOnServer\"in c&&!!c.debounceOnServer,F=h?Math.max(+c.maxWait||0,u):null;n(function(){return g.current=!0,function(){g.current=!1}},[]);var A=t(function(){var r=function(r){var n=l.current,t=v.current;return l.current=v.current=null,o.current=r,m.current=d.current.apply(t,n)},n=function(r,n){w&&cancelAnimationFrame(f.current),f.current=w?requestAnimationFrame(r):setTimeout(r,n)},t=function(r){if(!g.current)return!1;var n=r-a.current;return!a.current||n>=u||n<0||h&&r-o.current>=F},e=function(n){return f.current=null,x&&l.current?r(n):(l.current=v.current=null,m.current)},c=function r(){var c=Date.now();if(t(c))return e(c);if(g.current){var i=u-(c-a.current),f=h?Math.min(i,F-(c-o.current)):i;n(r,f)}},A=function(){if(p||y){var e=Date.now(),d=t(e);if(l.current=[].slice.call(arguments),v.current=i,a.current=e,d){if(!f.current&&g.current)return o.current=a.current,n(c,u),s?r(a.current):m.current;if(h)return n(c,u),r(a.current)}return f.current||n(c,u),m.current}};return A.cancel=function(){f.current&&(w?cancelAnimationFrame(f.current):clearTimeout(f.current)),o.current=0,l.current=a.current=v.current=f.current=null},A.isPending=function(){return!!f.current},A.flush=function(){return f.current?e(Date.now()):m.current},A},[s,h,u,F,x,w,p,y]);return A}function i(r,n){return r===n}function a(r,n){return n}function o(n,t,o){var f=o&&o.equalityFn||i,l=e(a,n),v=l[0],m=l[1],d=c(u(function(r){return m(r)},[m]),t,o),g=r(n);return f(g.current,n)||(d(n),g.current=n),f(v,n)&&d.cancel(),[v,d]}function f(r,n,t){var e=void 0===t?{}:t,u=e.leading,i=e.trailing;return c(r,n,{maxWait:n,leading:void 0===u||u,trailing:void 0===i||i})}export{o as useDebounce,c as useDebouncedCallback,f as useThrottledCallback};\n//# sourceMappingURL=index.module.js.map\n","module.exports = window[\"React\"];","module.exports = window[\"ReactDOM\"];","module.exports = window[\"ReactJSXRuntime\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","module.exports = window[\"wp\"][\"primitives\"];","/*!\n\tCopyright (c) 2018 Jed Watson.\n\tLicensed under the MIT License (MIT), see\n\thttp://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = '';\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (arg) {\n\t\t\t\tclasses = appendClass(classes, parseValue(arg));\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction parseValue (arg) {\n\t\tif (typeof arg === 'string' || typeof arg === 'number') {\n\t\t\treturn arg;\n\t\t}\n\n\t\tif (typeof arg !== 'object') {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (Array.isArray(arg)) {\n\t\t\treturn classNames.apply(null, arg);\n\t\t}\n\n\t\tif (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {\n\t\t\treturn arg.toString();\n\t\t}\n\n\t\tvar classes = '';\n\n\t\tfor (var key in arg) {\n\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\tclasses = appendClass(classes, key);\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction appendClass (value, newClass) {\n\t\tif (!newClass) {\n\t\t\treturn value;\n\t\t}\n\t\n\t\tif (value) {\n\t\t\treturn value + ' ' + newClass;\n\t\t}\n\t\n\t\treturn value + newClass;\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/**\n * Styles\n */\nimport \"./editor.scss\";\n\n/**\n * Components\n */\nimport InlineNotice from \"./components/InlineNotice\";\nimport PostControl from \"./components/PostControl\";\nimport RequireBlocks from \"./components/RequireBlocks\";\nimport SortablePostsControl from \"./components/SortablePostsControl\";\nimport TaxonomyControl from \"./components/TaxonomyControl\";\nimport PostSearchControl from \"./components/PostSearchControl\";\n\n/**\n * Hooks\n */\nimport { useAllPosts } from \"./hooks/use-all-posts\";\nimport { useRequiredBlocks } from \"./hooks/use-required-blocks\";\nimport { usePost } from \"./hooks/use-post\";\nimport { usePostSearch } from \"./hooks/use-post-search\";\n\nexport {\n\tInlineNotice,\n\tPostControl,\n\tRequireBlocks,\n\tSortablePostsControl,\n\tTaxonomyControl,\n\tPostSearchControl,\n\tuseAllPosts,\n\tuseRequiredBlocks,\n\tusePost,\n\tusePostSearch,\n};\n"],"names":["classnames","jsx","_jsx","InlineNotice","children","status","size","className","ComboboxControl","Spinner","useState","useEffect","postToControlOption","PostControl","label","posts","value","onChange","options","setOptions","map","ComboboxWrapper","useDebounce","__","BaseControl","Button","RawHTML","closeSmall","usePost","usePostSearch","jsxs","_jsxs","Fragment","_Fragment","SEARCH_DEBOUNCE_DELAY","SEARCH_MINIMUM_LENGTH","PostSearchControl","type","placeholder","inputProps","filterResults","numOfInitialResults","rest","isExpanded","setIsExpanded","search","setSearch","debouncedSearch","perPage","setPerPage","isLoadingMore","setIsLoadingMore","selected","postType","postStatus","minimumLength","maybeHasMorePosts","length","filteredPosts","onKeyDown","e","key","preventDefault","tabIndex","title","raw","currentTarget","onFocus","icon","disabled","onClick","Options","renderOption","post","id","rendered","isLoading","hasOptions","hasSearch","hasMinimumSearchLength","useRequiredBlocks","RequireBlocks","blocks","hasRequiredBlocks","missingBlocks","join","DndContext","closestCenter","KeyboardSensor","PointerSensor","useSensor","useSensors","arrayMove","SortableContext","sortableKeyboardCoordinates","verticalListSortingStrategy","useSortable","CSS","SortablePostsControl","filteredOptions","setFilteredOptions","query","setQuery","newFilteredOptions","filter","each","toLowerCase","includes","onOptionClick","option","isSelected","onSortEnd","newValues","onItemRemove","sortableOptions","reduce","items","find","push","event","target","index","optionClassName","SortableList","SortableItem","onRemove","isDragging","attributes","listeners","setNodeRef","transform","transition","style","Transform","toString","x","y","scaleX","scaleY","ref","setIsDragging","sensors","coordinateGetter","handleDragStart","handleDragEnd","active","over","ids","item","oldIndex","indexOf","newIndex","newIds","collisionDetection","onDragStart","onDragEnd","strategy","CheckboxControl","useSelect","labelWithCount","TaxonomyControl","slug","taxonomies","setTaxonomies","hasTaxonomies","data","select","getEntityRecords","per_page","groupedByParent","acc","cur","parent","withNestedChildren","newTaxonomies","handleClick","checked","isMatch","name","arr","forEach","some","SearchInput","RemovableTag","CheckboxWrapper","CheckboxGroup","onCheckboxClick","useAllPosts","orderby","order","getEntityRecord","requiredBlocks","blockNames","getBlockTypes","block","count"],"sourceRoot":""} \ No newline at end of file diff --git a/index.d.ts b/index.d.ts index 6494807..ba11231 100644 --- a/index.d.ts +++ b/index.d.ts @@ -8,32 +8,44 @@ type BlockNames = string[]; export const InlineNotice: React.FC<{ status: "warning" | "error"; size: "regular" | "small"; -}> = props; +}>; export const PostControl: React.FC<{ label: string; posts: any[]; value: number; onChange: (...args: any[]) => any; -}> = props; +}>; export const RequireBlocks: React.FC<{ blocks: BlockNames; -}> = props; +}>; export const SortablePostsControl: React.FC<{ label: string; posts: any[]; value: number[]; onChange: (...args: any[]) => any; -}> = props; +}>; + +export const SortablePostSearchControl: React.FC<{ + type: string; + status: string; + value: number[]; + onChange: (...args: any[]) => any; + placeholder: string; + label: string; + inputProps: object; + filterResults: (results: any[]) => any[]; + numOfInitialResults: number; +}>; export const TaxonomyControl: React.FC<{ slug: string; label: string; value: any[]; onChange: (...args: any[]) => any; -}> = props; +}>; export const PostSearchControl: React.FC<{ type: string; @@ -45,7 +57,7 @@ export const PostSearchControl: React.FC<{ inputProps: object; filterResults: (results: any[]) => any[]; numOfInitialResults: number; -}> = props; +}>; /** * Hooks diff --git a/src/components/PostSearchControl.js b/src/components/PostSearchControl.js index 7d2a570..324089e 100644 --- a/src/components/PostSearchControl.js +++ b/src/components/PostSearchControl.js @@ -16,9 +16,6 @@ import { closeSmall } from "@wordpress/icons"; */ import { usePost } from "../hooks/use-post"; import { usePostSearch } from "../hooks/use-post-search"; -import config from "../config.json"; - -const { textdomain } = config; /** * Constants @@ -31,8 +28,8 @@ const PostSearchControl = ({ status = "publish", value = 0, onChange, - placeholder = __("Search", textdomain), - label = __("Select a post", textdomain), + placeholder = __("Search", "wp-block-toolkit"), + label = __("Select a post", "wp-block-toolkit"), inputProps = {}, filterResults = null, numOfInitialResults = 20, @@ -125,7 +122,7 @@ const PostSearchControl = ({ setPerPage(-1); }} > - {__("View more results", textdomain)} + {__("View more results", "wp-block-toolkit")} )} @@ -161,13 +158,15 @@ const Options = ({ options, search, renderOption }) => {

{__( `Your search needs to be at least ${SEARCH_MINIMUM_LENGTH} characters long.`, - textdomain + "wp-block-toolkit", )}

); } - return

{__("No posts were found with your search.", textdomain)}

; + return ( +

{__("No posts were found with your search.", "wp-block-toolkit")}

+ ); } return options.map(renderOption); diff --git a/src/components/RequireBlocks.js b/src/components/RequireBlocks.js index d7902a7..ff10533 100644 --- a/src/components/RequireBlocks.js +++ b/src/components/RequireBlocks.js @@ -1,34 +1,31 @@ /** * WordPress dependencies */ -import { __ } from '@wordpress/i18n'; -import { Fragment } from '@wordpress/element'; +import { __ } from "@wordpress/i18n"; +import { Fragment } from "@wordpress/element"; /** * Internal dependencies */ -import InlineNotice from './InlineNotice'; -import { useRequiredBlocks } from '../hooks/use-required-blocks'; -import config from '../config.json'; +import InlineNotice from "./InlineNotice"; +import { useRequiredBlocks } from "../hooks/use-required-blocks"; -const RequireBlocks = ( { children, blocks } ) => { - const { textdomain } = config; - - const { hasRequiredBlocks, missingBlocks } = useRequiredBlocks( blocks ); +const RequireBlocks = ({ children, blocks }) => { + const { hasRequiredBlocks, missingBlocks } = useRequiredBlocks(blocks); return ( - { hasRequiredBlocks ? ( + {hasRequiredBlocks ? ( children ) : ( - { __( + {__( "Couldn't find all the required blocks. Please install and activate the following blocks: ", - textdomain - ) } - { missingBlocks.join( ', ' ) } + "wp-block-toolkit", + )} + {missingBlocks.join(", ")} - ) } + )} ); }; diff --git a/src/components/SortablePostSearchControl.js b/src/components/SortablePostSearchControl.js new file mode 100644 index 0000000..07631a0 --- /dev/null +++ b/src/components/SortablePostSearchControl.js @@ -0,0 +1,235 @@ +/** + * External dependencies + */ +import { + DndContext, + closestCenter, + KeyboardSensor, + PointerSensor, + useSensor, + useSensors, +} from "@dnd-kit/core"; +import { + arrayMove, + SortableContext, + sortableKeyboardCoordinates, + verticalListSortingStrategy, + useSortable, +} from "@dnd-kit/sortable"; +import { CSS } from "@dnd-kit/utilities"; +import classnames from "classnames"; + +/** + * WordPress dependencies + */ +import { __ } from "@wordpress/i18n"; +import { useState, useEffect } from "@wordpress/element"; +import { BaseControl, Spinner } from "@wordpress/components"; + +/** + * Internal dependencies + */ +import { postToControlOption } from "../utils"; + +const SortablePostSearchControl = ({ + type = "post", + status = "publish", + value, + onChange, + placeholder = __("Search", "wp-block-toolkit"), + label = __("Select a post", "wp-block-toolkit"), + inputProps = {}, + filterResults = null, + numOfInitialResults = 20, + ...rest +}) => { + const [options, setOptions] = useState([]); + const [filteredOptions, setFilteredOptions] = useState([]); + const [query, setQuery] = useState(""); + + useEffect(() => { + if (posts) { + setOptions(posts.map(postToControlOption)); + } + }, [posts]); + + useEffect(() => { + const newFilteredOptions = query + ? options.filter((each) => + each.label.toLowerCase().includes(query.toLowerCase()), + ) + : options; + + setFilteredOptions(newFilteredOptions); + }, [options, query]); + + if (posts === null) return ; + + if (!options || !options.length) return null; + + const onOptionClick = (option, isSelected) => { + onChange( + isSelected + ? value.filter((id) => id !== option.value) + : [...value, option.value], + ); + }; + + const onSortEnd = (newValues) => { + onChange(newValues); + }; + + const onItemRemove = (option) => { + onChange(value.filter((id) => id !== option.value)); + }; + + const sortableOptions = value.reduce((items, id) => { + const option = options.find((option) => option.value === id); + + if (option) { + items.push(option); + } + + return items; + }, []); + + return ( + +

+ {__("Select posts", "wp-block-toolkit")} +

+ + setQuery(event.target.value)} + className="wpbt-sortable-posts-control__search" + /> + +
+ {filteredOptions.map((option, index) => { + const isSelected = value.find((id) => id === option.value); + + const optionClassName = classnames( + "wpbt-sortable-posts-control__option", + { + "is-selected": isSelected, + }, + ); + + return ( + + ); + })} +
+ +

+ {__("Select order", "wp-block-toolkit")} +

+ + +
+ ); +}; + +const SortableItem = ({ id, value, onRemove, isDragging }) => { + const { attributes, listeners, setNodeRef, transform, transition } = + useSortable({ id }); + + const style = { + transform: CSS.Transform.toString({ + x: 0, + y: transform?.y, + scaleX: 1, + scaleY: 1, + }), + transition, + }; + + return ( +
+ + {value.label} + + {!isDragging && ( +
onRemove(value)} + /> + )} +
+ ); +}; + +const SortableList = ({ items, onChange, onItemRemove }) => { + const [isDragging, setIsDragging] = useState(false); + + const sensors = useSensors( + useSensor(PointerSensor), + useSensor(KeyboardSensor, { + coordinateGetter: sortableKeyboardCoordinates, + }), + ); + + const handleDragStart = (event) => { + setIsDragging(true); + }; + + const handleDragEnd = (event) => { + setIsDragging(false); + + const { active, over } = event; + + if (active.id !== over.id) { + const ids = items.map((item) => item.value); + const oldIndex = ids.indexOf(active.id); + const newIndex = ids.indexOf(over.id); + const newIds = arrayMove(ids, oldIndex, newIndex); + + onChange(newIds); + } + }; + + return ( +
+ + +
+ {items.map((item, index) => ( + + ))} +
+
+
+
+ ); +}; + +export default SortablePostSearchControl; diff --git a/src/components/SortablePostsControl.js b/src/components/SortablePostsControl.js index 921ff96..ce008a9 100644 --- a/src/components/SortablePostsControl.js +++ b/src/components/SortablePostsControl.js @@ -29,12 +29,9 @@ import { BaseControl, Spinner } from "@wordpress/components"; /** * Internal dependencies */ -import config from "../config.json"; import { postToControlOption } from "../utils"; const SortablePostsControl = ({ label, posts, value, onChange }) => { - const { textdomain } = config; - const [options, setOptions] = useState([]); const [filteredOptions, setFilteredOptions] = useState([]); const [query, setQuery] = useState(""); @@ -48,7 +45,7 @@ const SortablePostsControl = ({ label, posts, value, onChange }) => { useEffect(() => { const newFilteredOptions = query ? options.filter((each) => - each.label.toLowerCase().includes(query.toLowerCase()) + each.label.toLowerCase().includes(query.toLowerCase()), ) : options; @@ -63,7 +60,7 @@ const SortablePostsControl = ({ label, posts, value, onChange }) => { onChange( isSelected ? value.filter((id) => id !== option.value) - : [...value, option.value] + : [...value, option.value], ); }; @@ -88,12 +85,12 @@ const SortablePostsControl = ({ label, posts, value, onChange }) => { return (

- {__("Select posts", textdomain)} + {__("Select posts", "wp-block-toolkit")}

setQuery(event.target.value)} className="wpbt-sortable-posts-control__search" @@ -107,7 +104,7 @@ const SortablePostsControl = ({ label, posts, value, onChange }) => { "wpbt-sortable-posts-control__option", { "is-selected": isSelected, - } + }, ); return ( @@ -123,7 +120,7 @@ const SortablePostsControl = ({ label, posts, value, onChange }) => {

- {__("Select order", textdomain)} + {__("Select order", "wp-block-toolkit")}

{ useSensor(PointerSensor), useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates, - }) + }), ); const handleDragStart = (event) => { diff --git a/src/components/TaxonomyControl.js b/src/components/TaxonomyControl.js index 3e6e071..ba245b6 100644 --- a/src/components/TaxonomyControl.js +++ b/src/components/TaxonomyControl.js @@ -9,7 +9,6 @@ import { useSelect } from "@wordpress/data"; /** * Internal dependencies */ -import config from "../config.json"; import { labelWithCount } from "../utils"; const TaxonomyControl = ({ slug, label, value, onChange }) => { @@ -26,7 +25,7 @@ const TaxonomyControl = ({ slug, label, value, onChange }) => { per_page: -1, }); }, - [slug] + [slug], ); const isLoading = data === null; @@ -105,7 +104,7 @@ const TaxonomyControl = ({ slug, label, value, onChange }) => { ) : !hasTaxonomies ? (

- {__(`No taxonomies of type "${slug}" found.`, config?.textdomain)} + {__(`No taxonomies of type "${slug}" found.`, "wp-block-toolkit")}

) : ( {
diff --git a/src/config.json b/src/config.json deleted file mode 100644 index 94b4875..0000000 --- a/src/config.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "textdomain": "wp-block-toolkit" -}