PageSourceSearch

https://cutlistevo.com/assets/Calculations-DK98zCih.js

js cutlistevo.com collected 2026-10-02 05:36:02 UTC 23,957 bytes, 1 lines download raw bytes

1import{d as t,w as e,e as s,o as i,f as n,g as a,q as o,F as r,t as c,l,j as u,L as d,_ as p,h,Z as f,k as g,n as m,r as y,J as v}from"./vendor-vue-DGxDErk5.js";import{_ as k}from"./vendor-jspdf-D24f0F5F.js";import{g as b}from"./environment-B7-YnHdk.js";import"./guards-BZgibnzC.js";import"./side-E266Utm1.js";import{q as w}from"./NestingShape-_tQLr3X2.js";import"./Banding-mECukiQl.js";import"./reference-schema-BtG_FsFa.js";import"./vendor-i18next-DXNNEafL.js";import"./InputUserGroup-CzvEY2y_.js";import"./InputUserGroup.zod-Cg3ztfsQ.js";import"./sorting-D5vpszMy.js";import{t as V,q as A,D as j,u as L,x as I,o as S,n as P,y as x,v as E}from"./vendor-BpdM30IZ.js";import{u as _}from"./GlobalStore-YVhssQrP.js";import{u as O,b as T}from"./Masthead.vue_vue_type_style_index_0_lang-CRCOysoc.js";import{a as D}from"./ax-WYIXzGO7.js";import{a as M,b as $,S as U}from"./CLO-ChzoWMH3.js";import{u as C}from"./useNotices-CseXFI7a.js";import{u as G}from"./useResults-CpJa7ApO.js";const N={V0:"v0",V1:"v1",V2:"v2",V3:"v3"};function F(){return{schemaVersion:N.V3,schemaTimestamp:(new Date).toISOString()}}const W=[{version:N.V3,confidence:1,checks:{custom:t=>"v3-current"===t.schemaVersion?{found:!0,indicators:["Explicit v3-current schemaVersion marker"]}:{found:!1,indicators:[]}}},{version:N.V3,confidence:.9,checks:{custom:t=>{if(t.schemaVersion)return{found:!1,indicators:[]};const e=t.saw&&(t.saw.guillotineOptions||t.saw.efficiencyOptions||t.saw.stackHeight),s=Array.isArray(t.parts)&&t.parts.some(t=>void 0!==t.customData||void 0!==t.upDirection),i=Array.isArray(t.groups)&&t.groups.length>0&&t.groups.every(t=>t.direction&&(t.parts||t.shapes)&&void 0!==t.q),n=[];return e&&n.push("Advanced saw options present"),s&&n.push("Modern part structure"),i&&n.push("Properly structured groups"),{found:e||s||i,indicators:n}}}},{version:N.V2,confidence:.8,checks:{required:["saw"],forbidden:["stock[].blade","parts[].bandingType"],arrayChecks:[{path:"stock",lacks:["blade"]}],custom:t=>{const e="v3-current"===t.schemaVersion,s=Array.isArray(t.parts)&&t.parts.some(t=>void 0!==t.customData||void 0!==t.upDirection);if(e||s)return{found:!1,indicators:[]};const i=t.saw&&!t.saw.guillotineOptions&&!t.saw.efficiencyOptions&&!t.saw.stackHeight,n=[];return i&&n.push("Separate saw object without blade in stock"),{found:i,indicators:n}}}},{version:N.V1,confidence:.8,checks:{arrayChecks:[{path:"stock",has:["blade"],lacks:["bladeWidth"]}],forbidden:["groups","saw","stockList","partList"]}},{version:N.V0,confidence:.7,checks:{custom:t=>{const e=t.stock,s=t.parts,i=t.stockList,n=t.partList;if(!(Array.isArray(e)&&e.length>0||Array.isArray(s)&&s.length>0||Array.isArray(i)&&i.length>0||Array.isArray(n)&&n.length>0))return{found:!1,indicators:["No data to classify as v0-legacy"]};const a=t.stockList||t.partList,o=Array.isArray(t.stock)&&t.stock.some(t=>"bladeWidth"in t&&!("blade"in t)),r=Array.isArray(t.stockList)&&t.stockList.some(t=>"bladeWidth"in t&&!("blade"in t)),c=[];let l=!1;return a&&(c.push("Uses legacy stockList/partList naming"),l=!0),(o||r)&&(c.push("bladeWidth directly in stock"),l=!0),{found:l,indicators:c}},forbidden:["groups","saw"]}}];class LegacyDetector{detectVersion(t){const e=this.checkExplicitVersion(t);if(e)return e;if(this.isObject(t)&&this.isEmptyProject(t)){if(t.saw){const e=t.saw;return e.guillotineOptions||e.efficiencyOptions||e.stackHeight?{version:N.V3,confidence:.6,indicators:["Empty project with V3 saw configuration"],warnings:["Empty project detected, assuming V3 from saw options"]}:{version:N.V2,confidence:.5,indicators:["Empty project with saw configuration"],warnings:["Empty project detected, assuming V2 from saw presence"]}}return{version:N.V3,confidence:.3,indicators:["Empty project with no stock, parts, or saw data"],warnings:["Empty project detected, assuming current version (V3)"]}}const s=this.inferVersionDeclarative(t);return s||this.inferVersion(t)}checkExplicitVersion(t){if(!this.isObject(t))return null;if("schemaVersion"in t&&t.schemaVersion)return{version:t.schemaVersion,confidence:1,indicators:["Explicit schemaVersion field present"]};if("_version"in t&&t._version){const e=this.mapVersionString(t._version);if(e)return{version:e,confidence:.9,indicators:["_version field present"]}}return null}inferVersionDeclarative(t){if(!this.isObject(t))return null;for(const e of W){const s=[];let i=!0;if(e.checks.required)for(const n of e.checks.required){if(!this.hasPath(t,n)){i=!1;break}s.push(`Has required field: ${n}`)}if(i){if(e.checks.forbidden)for(const n of e.checks.forbidden){if(this.hasPath(t,n)){i=!1;break}
1s.push(`Lacks forbidden field: ${n}`)}if(i){if(e.checks.arrayChecks)for(const i of e.checks.arrayChecks){const e=this.getPath(t,i.path);if(Array.isArray(e)&&0!==e.length){if(i.has){if(!e.some(t=>i.has.every(e=>t&&"object"==typeof t&&e in t)))continue;"stock"===i.path&&i.has.includes("blade")?s.push("Blade object in stock"):s.push(`Array ${i.path} has required fields: ${i.has.join(", ")}`)}if(i.lacks){if(e.some(t=>i.lacks.some(e=>t&&"object"==typeof t&&e in t)))continue;s.push(`Array ${i.path} lacks forbidden fields: ${i.lacks.join(", ")}`)}}}if(e.checks.custom){const i=e.checks.custom(t);if(!i.found)continue;s.push(...i.indicators)}return{version:e.version,confidence:e.confidence,indicators:s}}}}return null}inferVersion(t){if(!this.isObject(t))return{version:N.V0,confidence:.1,indicators:["Non-object data"],warnings:["Unable to properly detect version for non-object data"]};const e=[];return this.hasV3Indicators(t,e),this.hasV2Indicators(t,e),this.hasV1Indicators(t,e),this.hasV0Indicators(t,e),this.hasV3Indicators(t,[])?{version:N.V3,confidence:.9,indicators:e}:this.hasV2Indicators(t,[])?{version:N.V2,confidence:.8,indicators:e}:this.hasV1Indicators(t,[])?{version:N.V1,confidence:.8,indicators:e}:this.hasV0Indicators(t,[])?{version:N.V0,confidence:.7,indicators:e}:{version:N.V0,confidence:.3,indicators:e}}hasV3Indicators(t,e){let s=!1;if(t.saw&&"object"==typeof t.saw&&(t.saw.guillotineOptions||t.saw.efficiencyOptions||t.saw.stackHeight)&&(e.push("Advanced saw options present"),s=!0),Array.isArray(t.groups)&&t.groups.length>0){t.groups.every(t=>t.direction&&(t.parts||t.shapes)&&t.q)&&(e.push("Properly structured groups"),s=!0)}if(t.saw&&Array.isArray(t.parts)&&t.parts.length>0){t.parts.some(t=>void 0!==t.customData||void 0!==t.upDirection)&&(e.push("Modern part structure with customData or upDirection"),s=!0)}return s}hasV2Indicators(t,e){let s=!1;if(t.saw&&"object"==typeof t.saw){Array.isArray(t.stock)&&t.stock.some(t=>t.blade)||(e.push("Separate saw object without blade in stock"),s=!0)}return Array.isArray(t.groups)&&t.groups.length>0&&(e.push("Groups array present"),s=!0),s}hasV1Indicators(t,e){let s=!1;if(Array.isArray(t.stock)&&t.stock.length>0){t.stock.some(t=>t.blade&&"object"==typeof t.blade)&&(e.push("Blade object in stock"),s=!0)}if(Array.isArray(t.parts)&&t.parts.length>0){t.parts.some(t=>void 0!==t.bandingType)&&(e.push("bandingType field in parts"),s=!0)}return t.groups||(e.push("No groups field"),s=!0),s}hasV0Indicators(t,e){let s=!1;if(Array.isArray(t.stock)&&t.stock.length>0){t.stock.some(e=>void 0!==e.bladeWidth&&!e.blade&&!t.saw)&&(e.push("bladeWidth directly in stock"),s=!0)}if(Array.isArray(t.stock)&&t.stock.length>0){t.stock.some(t=>["efficiency","length","width","beam"].includes(t.cutPreference))&&(e.push("Legacy cut preference values"),s=!0)}return!t.stockList&&!t.partList||t.stock||t.parts||(e.push("Uses stockList/partList naming"),s=!0),s}isObject(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}isEmptyProject(t){const e=t.stock,s=t.parts,i=t.shapes,n=t.stockList,a=t.partList,o=t.shapeList,r=Array.isArray(e)&&e.length>0||Array.isArray(n)&&n.length>0,c=Array.isArray(s)&&s.length>0||Array.isArray(a)&&a.length>0||Array.isArray(i)&&i.length>0||Array.isArray(o)&&o.length>0;return!r&&!c}mapVersionString(t){const e=t.toLowerCase().replace(/[^a-z0-9]/g,"");return e.includes("v3")||e.includes("current")?N.V3:e.includes("v2")?N.V2:e.includes("v1")?N.V1:e.includes("v0")||e.includes("legacy")?N.V0:null}detectAPIVersion(t,e){const s=this.detectFromPath(t),i=this.detectVersion(e);if(s&&i){const t=.3*s.confidence+.7*i.confidence;return{...i,confidence:t,indicators:[...s.indicators,...i.indicators]}}return i||s||{version:N.V0,confidence:.1,indicators:["No version detected"],warnings:["Unable to determine version"]}}detectFromPath(t){return t.includes("/v2/")||t.includes("/api/v2")?{version:N.V3,confidence:.7,indicators:["API v2 endpoint"]}:t.includes("/v1/")||t.includes("/api/v1")?{version:N.V1,confidence:.7,indicators:["API v1 endpoint"]}:null}hasPath(t,e){const s=this.getPath(t,e);return null!=s}getPath(t,e){if(!t||"object"!=typeof t)return;if(e.includes("[]")){const[s,...i]=e.split("[]"),n=this.getPath(t,s);if(!Array.isArray(n)||0===n.length)return;const a=i.join("[]").replace(/^\./,"");if(!a)return n;const o=n.filter(t=>this.hasPath(t,a));return o.length>0?o:void 0}const s=e.split(".");let i=t;for(const n of s){if(null==i)return;if("object"!=typeof i)return;i=i[n]}return i}}class MigrationPipeline{migrations=new Map;detector;migrationsLoaded=null;initializationError=null;constructor(){this.detector=new LegacyDetector}async initialize(){if(!this.migrationsLoaded||this.initializationError){if(this.initializationError)throw this.initializationError;this.migrationsLoaded=this.registerMigrations();try{await this.migrationsLoaded}catch(t){throw this.initializationError=t instanceof Error?t:new Error(String(t)),this.initializationError}}else await this.migrationsLoaded}async registerMigrations(){try{const{registerAllMigrations:t}=await k(async()=>{const{registerAllMigrations:t}=await import("./index-D-X8cY0L.js");return{registerAllMigrations:t}},[]);t(this)}catch(t){throw t}}registerMigration(t){const e=`${t.fromVersion}->${t.toVersion}`;this.migrations.set(e,t)}async migrate(t,e={}){await this.initialize();const s={success:!1,migrations:[],finalVersion:N.V0,warnings:[],errors:[]};try{if(this.isEmptyProject(t))return s.success=!0,s.data=t,s.finalVersion=N.V3,s.warnings.push("Empty project detected, skipping migration pipeline"),s;let n;if(!1!==e.autoDetect){const e=this.detector.detectVersion(t);if(s.detection=e,n=e.version,e.confidence<.5&&s.warnings.push(`Low confidence version detection (${Math.round(100*e.confidence)}%)`),e.warnings&&(s.warnings.push(...e.warnings),e.warnings.some(t=>t.includes("Empty project"))))return s.success=!0,s.data=t,s.finalVersion=n,s.warnings.push("Empty project detected via detection warnings"),s}else n=N.V0;const a=e.targetVersion||N.V3,o=function(t,e=N.V3){const s=Object.values(N),i=s.indexOf(t),n=s.indexOf(e);return-1===i||-1===n||i>=n?[]:s.slice(i+1,n+1)}(n,a);if(0===o.length)return n===a?(s.success=!0,s.data=t,s.finalVersion=n,s):(s.errors.push(`No migration path from ${n} to ${a}`),s);let r=t,c=n;for(const t of o){const n=`${c}->${t}`,a=this.migrations.get(n);if(!a)return s.errors.push(`Missing migration: ${n}`),s.migrations.push({from:c,to:t,applied:!1,errors:["Migration not found"]}
1),s;const o={sourceVersion:c,targetVersion:t,options:{strict:e.strict,preserveUnknown:e.preserveUnknown,logWarnings:e.logWarnings},warnings:[],errors:[],jobId:e.context?.jobId,source:e.context?.source};if("true"===b("DEBUG_MIGRATION")){e.context}let l;try{l=a.execute(r,o)}catch(i){const a=`Migration ${n} failed: ${i.message}`;e.context&&e.context.jobId;return b("DEBUG_MIGRATION"),s.migrations.push({from:c,to:t,applied:!1,errors:[i.message]}),s.warnings.push(a),e.skipOnFailure?(s.success=!0,s.data=r,s.finalVersion=c,s):(s.errors.push(a),s)}if(s.migrations.push({from:c,to:t,applied:l.migrationApplied,errors:o.errors.length>0?o.errors:void 0}),s.warnings.push(...o.warnings),s.errors.push(...o.errors),!l.success){const t=`Migration failed: ${n}`;e.context&&e.context.jobId;return b("DEBUG_MIGRATION"),s.warnings.push(t),e.skipOnFailure?(s.success=!0,s.data=r,s.finalVersion=c,s):(s.errors.push(t),s)}r=l.data,c=t}if(e.addVersionInfo&&"object"==typeof r&&null!==r){const t=F();t.migrated=!0,t.originalVersion=n,r.schemaVersion=t.schemaVersion,r.schemaTimestamp=t.schemaTimestamp,r.originalVersion=t.originalVersion}s.success=!0,s.data=r,s.finalVersion=c}catch(n){s.errors.push(`Pipeline error: ${n instanceof Error?n.message:String(n)}`)}return s}isEmptyProject(t){if(!t||"object"!=typeof t)return!1;const e=t,s=Array.isArray(e.parts)&&e.parts.length>0||Array.isArray(e.partList)&&e.partList.length>0||Array.isArray(e.inputShapes)&&e.inputShapes.length>0,i=Array.isArray(e.shapes)&&e.shapes.length>0||Array.isArray(e.shapeList)&&e.shapeList.length>0,n=Array.isArray(e.stock)&&e.stock.length>0||Array.isArray(e.stockList)&&e.stockList.length>0||Array.isArray(e.inputStock)&&e.inputStock.length>0;return!s&&!i&&!n}needsMigration(t,e=N.V3){return this.detector.detectVersion(t).version!==e}getAvailableMigrations(){return Array.from(this.migrations.keys())}}let q=null;async function z(t){const e=t;if(!(e?.data&&"object"==typeof e.data))return t;const s=t.jobId||t._id||"unknown";try{const i=new LegacyDetector,n=e.data;if(!n.stockList||0===n.stockList.length)return t;const a=!!n.saw,o={stock:n.stockList?.map(t=>({l:t.l,w:t.w,q:1,...!a&&{blade:t.blade,bladeWidth:t.bladeWidth},type:t.type,cutPreference:t.cutPreference,autoAdd:t.autoAdd||!1,allowExactFitShapes:t.allowExactFitShapes||!1,grain:t.grain||null,trim:t.trim,cost:t.cost}))||[],parts:n.shapeList?.map(t=>({l:t.l,w:t.w,q:1,banding:t.banding,bandingType:t.bandingType,orientationLock:t.orientationLock||null,stockLock:t.stockLock}))||[],...a&&{saw:n.saw}};if(i.detectVersion(o).version===N.V3)return t;const r=(q||(q=new MigrationPipeline),q),c=await r.migrate(o,{targetVersion:N.V3,autoDetect:!0,preserveUnknown:!0,addVersionInfo:!1,skipOnFailure:!0,context:{jobId:s,source:"resultMigration"}});if(c.success){const e=c.data,s=t=>{if(!t||"object"!=typeof t)return t;const e={...t};return"boolean"==typeof e.stack?delete e.stack:"number"==typeof e.stack&&(e.stack={number:e.stack}),e},i={saw:e.saw,stockList:n.stockList?.map(t=>s({...t,blade:void 0,cutPreference:void 0,bladeWidth:void 0})),shapeList:n.shapeList?.map((t,i)=>{const n=e.parts[i],a={...t};return n?.extras?(a.extras=n.extras,delete a.banding,delete a.bandingType):n?.banding&&(a.banding=n.banding,delete a.bandingType),a.stock&&"object"==typeof a.stock&&(a.stock=s(a.stock)),s(a)}),...n.cutList&&{cutList:n.cutList.map(t=>({...t,stock:t.stock?s(t.stock):t.stock}))},...n.segmentList&&{segmentList:n.segmentList.map(t=>s(t))},...n.offcuts&&{offcuts:n.offcuts.map(t=>{const e=s(t);return e.stock&&"object"==typeof e.stock&&(e.stock=s(e.stock)),e})},...n.unusableShapes&&{unusableShapes:n.unusableShapes.map(t=>{const e=s(t);return e.stock&&"object"==typeof e.stock&&(e.stock=s(e.stock)),e})},...n.unavailableStock&&{unavailableStock:n.unavailableStock.map(t=>s(t))},...n.metadata&&{metadata:n.metadata},...n.performance&&{performance:n.performance},...n.evolutionVisData&&{evolutionVisData:n.evolutionVisData},...n.apiVersion&&{apiVersion:n.apiVersion}},a={...t,stockList:i.stockList,shapeList:i.shapeList,saw:i.saw,performance:i.performance,metadata:i.metadata,...i.cutList&&{cutList:i.cutList},...i.segmentList&&{segmentList:i.segmentList},...i.offcuts&&{offcuts:i.offcuts},...i.unusableShapes&&{unusableShapes:i.unusableShapes},...i.unavailableStock&&{unavailableStock:i.unavailableStock},...i.apiVersion&&{apiVersion:i.apiVersion},data:void 0};return c.warnings.length,a}return t}catch(i){return t}}const R=V({l:S(),w:S(),t:S().optional(),q:S(),name:I().optional(),material:I().optional(),id:I().optional(),banding:L().optional(),stockLock:j(S()).optional(),orientationLock:A(["l","w",""]).optional().nullable()});R.extend({bandingType:L().optional()}),R.omit({stockLock:!0}
1).extend({banding:x(I(),E([P(),I()])).optional(),bandingOptions:x(I(),L()).optional(),finish:x(I(),I()).optional(),finishOptions:x(I(),L()).optional(),stockLock:j(I()).optional(),stockMatch:L().optional(),selectedMaterial:L().optional(),machining:L().optional(),customData:x(I(),E([I(),S(),P()])).optional(),grain:A(["l","w",""]).optional().nullable(),issues:j(I()).optional(),warnings:j(I()).optional(),selected:P().optional(),multiEdit:P().optional()});const B=V({l:S(),w:S(),t:S().optional(),q:S(),id:I().optional(),material:I().optional(),grain:A(["l","w",""]).optional().nullable(),bladeWidth:S().optional(),autoAdd:P().optional(),type:A(["sheet","linear"]),cutPreference:A(["efficiency","length","width","beam"]).optional(),cost:S().optional().nullable(),allowExactFitShapes:P().optional()});B.omit({bladeWidth:!0}).extend({blade:V({width:S()}).optional(),autoAdd:P().default(!1)}),B.omit({bladeWidth:!0,cutPreference:!0}).extend({autoAdd:P().default(!1),type:A(["sheet","linear","roll"]).optional().nullable(),saw:L().optional(),used:P().optional(),preventGrainRotation:P().optional(),issues:j(I()).optional(),warnings:j(I()).optional(),selected:P().optional(),multiEdit:P().optional(),listId:I().optional(),readonly:P().optional(),units:A(["decimal","fraction"]).optional(),notes:I().optional()});const H={sheet:"Sheet",linear:"Linear",roll:"Roll"},Q={guillotine:"Guillotine",beam:"Beam",efficiency:"Free",nesting:"Nesting"},J={sheet:"mat-sheet",linear:"mat-bar",roll:"mat-roll"},K={guillotine:"guillotine-fast",beam:"beam-saw",efficiency:"algo-free",nesting:"algo-nesting"},Y=[tt("sheet","guillotine","#5470c6"),tt("sheet","beam","#fac858"),tt("sheet","efficiency","#91cc75"),tt("sheet","nesting","#9a60b4"),tt("linear",void 0,"#73c0de"),tt("roll","guillotine","#fc8452"),tt("roll","efficiency","#ee6666"),tt("roll","nesting","#3ba272")],Z={key:"unknown",stockType:"unknown",label:"Unknown",algoIcon:null,materialIcon:"mat-sheet",color:"#888"},X=Object.fromEntries([...Y,Z].map(t=>[t.key,t]));function tt(t,e,s){return{key:et(t,e),stockType:t,cutType:e,label:e?`${H[t]} · ${Q[e]}`:H[t],algoIcon:e?K[e]:"algo-linear",materialIcon:J[t],color:s}}function et(t,e){return e?`${t}:${e}`:t}function st(t){return"sheet"===t||"linear"===t||"roll"===t?t:null}function it(t){const e=st(t?.stockType);if(!e)return Z;const s="linear"===e?null:(i=t?.cutType,"guillotine"===i||"beam"===i||"efficiency"===i||"nesting"===i?i:null);var i;const n=et(e,s??void 0);return X[n]??tt(e,s??void 0,Z.color)}const nt={class:"top"},at={class:"menu"},ot={class:"body content"},rt={key:0,class:"font-sm"},ct={key:1,class:"messages"},lt={key:0},ut={key:1},dt=["href"],pt={key:2,id:"project-search"},ht=["value"],ft={key:3,class:"grid-table negative-widget-margin"},gt={class:"cell"},mt={class:"cell name font-sm bold",style:{"user-select":"text"}},yt={class:"cell name font-sm",style:{"user-select":"text"}},vt={class:"cell name font-sm",style:{"user-select":"text"}},kt=["title"],bt=["title"],wt={class:"cell summary font-sm"},Vt={class:"cell date font-sm"},At={class:"cell"},jt=["disabled","onClick"],Lt={key:4,class:"none-found"},It=t({__name:"Calculations",emits:["loaded"],setup(t,{emit:k}){const b=O(),V=_(),A=G(),{updateFromResult:j,reset:L}=A,{updateInputs:I,updateInputSaw:S}=T({numberFormat:b.numberFormat}),{addNotice:P}=C(),{resetPagination:x}=M("inputStock"),{resetPagination:E}=M("inputShapes"),{resetPagination:N}=M("stockList"),{resetPagination:F}=M("offcuts"),W=k,q=y(!1),R=y(!1),B=y(0),Q=y(20),J=y(null),K=y(null),Y=y(!1),Z=y(null),X=y([]),tt=y(""),et=y([]),It=y("");e(q,t=>{t&&(R.value=!1,B.value=0,_t(),St())});const St=async()=>{try{const t=await D.get("calculations/users");et.value=t.data}catch(t){}},Pt=()=>{B.value=0,_t()},xt=()=>{X.value=[],Z.value=null,K.value=null,J.value=null,B.value=0,tt.value="",It.value="",_t()},Et=async()=>{if(Y.value=!0,tt.value.length<=2)return alert("Query must be longer than 2 characters");B.value=0,J.value=1;try{const t=await D.get("calculations",{params:{jobId:tt.value}});X.value=t.data}catch(t){}finally{Y.value=!1}},_t=()=>{Y.value=!0;const t={page:B.value+1,limit:Q.value};It.value&&(t.userId=It.value),D.get("calculations",{params:t}).then(t=>{if(!t?.data?.calculations)return!1;X.value=t.data?.calculations,J.value=t.data?.totalPages,K.value=t.data?.total}).then(()=>R.value=!0).catch(t=>{if(t.response&&401!==t.response.status)throw t}).finally(()=>Y.value=!1)},Ot=async(t,e)=>
1{L(),V.loadingProject=!0,Z.value=e;const s=t?.inputs?.inputSaw||t?.saw||t?.options?.saw;if(s&&S(s),t.inputs){const e={inputSaw:s,inputShapes:t.inputs.inputShapes||[],inputStock:t.inputs.inputStock||[],inputUserGroups:t.inputs.inputUserGroups||[]};await I(e,b.numberFormat)}j(t),await v(),x(),E(),N(),F(),V.loadingProject=!1,W("loaded"),P({type:"success",message:"Calculation loaded"})},Tt=t=>({model:t?.model,cutType:t?.saw?.cutType,stockType:t?.saw?.stockType}),Dt=t=>function(t){const e=t?.model,s=it(t);return e?.includes("max")?"guillotine-max":"rectangle-guillotine-fast"===e&&"guillotine"===s.cutType?"guillotine-fast":s.algoIcon}(Tt(t)),Mt=t=>function(t){const e=t?.model;return e&&w[e]?.label||it(t).label}(Tt(t)),$t=t=>it(Tt(t)).materialIcon,Ut=t=>function(t){const e=st(t?.stockType);return e?H[e]:"Unknown"}(Tt(t));return(t,e)=>{const y=s("Icon");return i(),n("div",{id:"calculations",class:m(["widget",{open:q.value}])},[a("div",nt,[o($,{action:()=>q.value=!q.value,text:"Calculations",state:q.value,icon:null,params:[]},null,8,["action","state"])]),q.value?(i(),n(r,{key:0},[a("div",at,[a("button",{type:"button",class:"c-btn",onClick:e[0]||(e[0]=t=>xt())}," Refresh ")]),a("div",ot,[K.value?(i(),n("p",rt," Total: "+c(K.value),1)):l("",!0),R.value&&u(V).loggedIn?l("",!0):(i(),n("div",ct,[u(V).loggedIn&&!R.value?(i(),n("p",lt," Fetching recent calculations... ")):l("",!0),u(V).loggedIn?l("",!0):(i(),n("p",ut," You need to be logged in ")),u(V).loggedIn?l("",!0):(i(),n("a",{key:2,href:u(V).authUrl},"Log in",8,dt))])),u(V).isAdmin?(i(),n("div",pt,[d(a("select",{"onUpdate:modelValue":e[1]||(e[1]=t=>It.value=t),onChange:Pt},[e[4]||(e[4]=a("option",{value:""}," All users ",-1)),(i(!0),n(r,null,h(et.value,t=>(i(),n("option",{key:t._id,value:t._id},c(t.username),9,ht))),128))],544),[[p,It.value]]),u(V).loggedIn?d((i(),n("input",{key:0,"onUpdate:modelValue":e[2]||(e[2]=t=>tt.value=t),type:"search",placeholder:"Search by job ID..."},null,512)),[[f,tt.value]]):l("",!0),a("button",{class:"c-btn",type:"button",onClick:Et}," Search "),a("button",{class:"c-btn",type:"button",onClick:xt}," Clear ")])):l("",!0),X.value.length?(i(),n("div",ft,[(i(!0),n(r,null,h(X.value,t=>{return i(),n("div",{key:t._id,class:"row"},[a("div",gt,[t?.app?(i(),g(y,{key:0,icon:["fass","mobile-alt"]})):t?.api&&!t?.app?(i(),g(y,{key:1,icon:"api"})):t?.widget?(i(),g(y,{key:2,icon:["fass","browser"]})):t?.api||t?.app?l("",!0):(i(),g(y,{key:3,icon:["fass","window-alt"]}))]),a("div",mt,c(t?.jobId),1),a("div",yt,c(t?.username),1),a("div",vt,c(t?.performance),1),a("div",{class:"cell",title:Mt(t)},[Dt(t)?(i(),g(y,{key:0,icon:Dt(t)},null,8,["icon"])):l("",!0)],8,kt),a("div",{class:"cell",title:Ut(t)},[o(y,{icon:$t(t)},null,8,["icon"])],8,bt),a("div",wt," P: "+c(t?.numParts??"N/A")+" S: "+c(t?.numStock??"N/A"),1),a("div",Vt,c((e=t?.createdAt,new Date(e).toLocaleString("en-GB",{timeStyle:"short",dateStyle:"short"}))),1),a("div",At,[a("button",{type:"button",disabled:Y.value,class:"load",onClick:e=>(async t=>{Y.value=!0;try{const e=await D.get("calculation",{params:{id:t}}),s=await z(e.data);Ot(s,t)}catch(e){}finally{Y.value=!1}})(t?._id)},[o(y,{icon:["fass","floppy-disk-circle-arrow-right"]})],8,jt)])]);var e}),128))])):l("",!0),u(V).loggedIn&&R.value&&!X.value.length?(i(),n("div",Lt," No calculations found ")):l("",!0)]),u(V).loggedIn&&R.value&&X.value.length?(i(),g(U,{key:0,"current-page":B.value+1,"total-pages":J.value??1,disabled:Y.value||!R.value||!X.value.length,"show-first-last":"",onGoToPage:e[3]||(e[3]=t=>{return e=t-1,void(B.value!==e&&(B.value=e,_t()));var e})},null,8,["current-page","total-pages","disabled"])):l("",!0)],64)):l("",!0)],2)}}}),St=Object.freeze(Object.defineProperty({__proto__:null,default:It},Symbol.toStringTag,{value:"Module"}));export{St as C,N as D,F as g};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.